From patchwork Thu Nov 3 21:06:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13031027 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A411C4332F for ; Thu, 3 Nov 2022 21:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ubICm32B54rlMviwRhxwc8OYumgjl8HxAaCYBiSx0Og=; b=4zIYjrHzsDMZPQ tKCHqNJiqWT4kYzb+xOmkpnG7+thUq8JEtkmJPB7EdtF2BB+73FS2kZx3+yJIudezLRvuinAIzuvP ngw+7whfUwe8EK6j4vo1oRJgPV+kCRDcYlD/doRfAHc72gyrI1rvnL3h4vLAiYQfulBbionxXWlOV g/8uIDEWoX46TYxlfUq1kOEsrmRjQhZ2l3p4bcRFW1nh/WQyCFrPhj37ON3EhpsLLtVUbJZhY/aKK mc0cx/+BP8zipReiCN4BRVdZSWoRqbvWysmRFBOZ3gTZSbtnzGzNrIZiJCfeDvGBcLkaScSVjQoZv TBkUn2SRp09rKdS8an0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqhQd-001gzb-TT; Thu, 03 Nov 2022 21:07:12 +0000 Received: from mail-eopbgr20055.outbound.protection.outlook.com ([40.107.2.55] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqhQa-001gyV-5u for linux-arm-kernel@lists.infradead.org; Thu, 03 Nov 2022 21:07:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jllPExm3RcVNhY6b9a5idDdx8wYwmCh4uSX41MXRvEwmYvxU28p8cqQIhSqqULHaJg8KMRBpnSLRiRTgevEoGSTyOPIgKjrapjpXKhQX7ml36JdaHdDXB6wVJBjBUQvhu/YR6G7TcVEzuC0sT2k3Ywhu+RoVknWohFhhnjhSgJRKXFQsnVwDjWfTb17Y+XbuHdWPtq9Ts73VNidw6x/W1T76HnR0RjZO6eGoj93CSaGmqQjwy+fsVu3Js+ipUrnBmQazvKwoBikJkiT6RuypYIYjK9r4MXcTYWc4H825K20MdYjy9ywo2VN2w+GuLUHMykP4Y19SS2+gaN+13VtqdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/aWFpvKdRzDQ6VfdGXlua6p5sRcVU+x/NlwHCOb99dY=; b=ZlMLwSnZN9R3AKW4e/jfneaqqQ1+VBDUB3cThyZQRs4Uv0cHj+sBaKg7EUtplI98uJ0lVr+zwFmIGGoEd1T8PbHgKTtTi9A4fg44sICH08jr0Ivvp1kImkLipwSAICkLDmcGXaQ6ZZnwou6mkIVbsRrCTmSjxlPsMt0DUgGkIJJ+3IxRWL68vjAIa3R3nnXAu/j5kdkbYb5CXWQX8hGEk4IOF9ZIQPickZrVG9d/HYOnasOTrBoBNh184KO1qWJwGAfdzbHv3mhj6s4atb3Wal5Vr90Bxm4h+RYwyS1eS1frXe/NTOafy2Gq5GTR04ug2Unu+DBqPv7EktKQuBVABw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/aWFpvKdRzDQ6VfdGXlua6p5sRcVU+x/NlwHCOb99dY=; b=w9P+xS+9GrOSx4vqAjE0TTvPlyUyS1xaG5wROkpZCJ0YrGGg0bnrzV/uxdvltJnUitlPZhvI+PU8ttv5YfKsK4Oz1HqgtUaF6yE6OQ57/DYVtcGe42+nsZjrX6YvCftiAmx8anSIC36AN0szB0PBv0z52lcecsJkPcSSN7/24u4W45+sc83gEhxIqshwjO5v1Wahjku5gX/6GWscQut9PIKLOtqORES9V0u3kpD1wVJc1r/2fbwwP3cBKTRBXb+3JrPqsm9VKGP7vFGBHhyQr9/ilGEGVr+64zaGM6/H/5Ara4vxS16mRW6/mTdeovZU5Sh6Ot9XQWcKqm7dx2Hjqg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by PAXPR03MB7746.eurprd03.prod.outlook.com (2603:10a6:102:208::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Thu, 3 Nov 2022 21:07:03 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::e9d6:22e1:489a:c23d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::e9d6:22e1:489a:c23d%4]) with mapi id 15.20.5791.022; Thu, 3 Nov 2022 21:07:02 +0000 From: Sean Anderson To: Heiner Kallweit , Russell King , netdev@vger.kernel.org Cc: Vladimir Oltean , Eric Dumazet , Paolo Abeni , Jakub Kicinski , linux-kernel@vger.kernel.org, Andrew Lunn , Ioana Ciornei , Madalin Bucur , "David S . Miller" , Sean Anderson , Alexandre Belloni , Benjamin Herrenschmidt , Claudiu Manoil , Florian Fainelli , Frank Rowand , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , Saravana Kannan , Shawn Guo , UNGLinuxDriver@microchip.com, Vivien Didelot , Vladimir Oltean , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH net-next v2 00/11] net: pcs: Add support for devices probed in the "usual" manner Date: Thu, 3 Nov 2022 17:06:39 -0400 Message-Id: <20221103210650.2325784-1-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty X-ClientProxiedBy: BLAP220CA0002.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::7) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|PAXPR03MB7746:EE_ X-MS-Office365-Filtering-Correlation-Id: 8aab1b63-6efb-4238-570d-08dabddf5add X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 09btDTIzlLeBlMDKz4YE8ZGXnp9YQ6nt3MdGzEn0ZvI1CA0jJ9VkODaQZ1ykVJZiA5llNBtdUuyRdDxToZI6WwU6IBIB0E838XXMxYZWEcW3z1oBqWNSU/tVRBjpBQAULcuTDpWGYcUwOWeoR8BD2lhqqFljkvZ1eNZFuC9XIUwjLb0rcm6S0HGXWwGSA7rWT2Mu/bpco8v952mhT5VYbVvufCw0PvSoHmQ7Lqm0ABvNhVWDtME05bKQwY82X5ct4Pz4Ep/tirAsOQMhA67dr4YX92n2lXFdA8D6lpq1RwVQ73XWzwBRpILbZPcVXNW8/7yjsAtSCjptCB/ufE12NJiWs3VFtE32H9vz4r6NohwAyViQ5Th/oKDTBClOSDPMCsV1kYAvsQPs21h0TUR5NSSMYfhNvuB/Xt+kMQEc0bCkl1IaarSjYYHkN5zLnwCnD5m+QzkPqgCUYl3dWJrZ6DPR6F7ScgPaUK18eY29I3cUeLKjiu7SsJDnlALYH1XONOGjfxsJw/X9qoMJfSToa5WFO+JmEENsMEzlg3K6jv2r57I6k+4/PTsSy8E0a9aRnkRKHSLyegiA5E47cF7NRTODnvvUVvn27uhBoaxhWVIg8nAI0lcYlGki/MoRq4aNOFG9HAoLlPX8o0FrFEZEFryb9rcP1VqLfFnSeT+Iw7hu1+30nJ8x4E0Oh5Eb7LGs/z1WvEI31uhy8DfzIqlPTfYCT1wKhI6GeP/EFV5xBuLJveWV8p5jbFLzAn1pOvZVpW9L6Ux2ChIKF5H249MdFg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(136003)(366004)(39850400004)(376002)(346002)(396003)(451199015)(8936002)(86362001)(36756003)(478600001)(6486002)(44832011)(5660300002)(2906002)(52116002)(26005)(6512007)(6506007)(1076003)(38350700002)(38100700002)(186003)(83380400001)(2616005)(7416002)(41300700001)(7406005)(6666004)(66946007)(66556008)(4326008)(66476007)(8676002)(316002)(54906003)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FQ3I6ZLZqIYQ9WDB6qjiaQIj8w0wyzcVJPOZ0LcMyjgtGPqKPOrdMK0XGZHigHWvxJxJIWmhPe+woqvR4ByeXVFAbW6rirnp5PJJ/pIPxbmxwvehUC0tVHxVpXJjfctBfYZ9sXnOFM8P31pjiEyETZ0C4gn5SLqj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C3Q8oTSZylZax0KGKkvmJ/AKAcNNkDwv7xq71J/rqzuMT9upcktc4RZGvq/w8DcND6OTT+MdMewqyQEyqyt+jXE4I8H+6w05KUOTFJ8FjpXCq2xfSjIO9l3c2lfm25TVI1DmniOFTHDRgP4aVVdT8WVy3YyyXWbHaDaKMkeu0uVWwGNTDYdH64TM6q38kSBKE5KMdd8HN+Dc5CdrNfTyvNQI5lTZK5oLSxE/meP/akDVo5AO6BusopklNIutg/vh8bi/r3AqOC2rDm9b9shHoCCKRMKFl0qpf2CEnv6+u3SEpZ7yC0jq+H2++f1pYjKgpqZQCFsJu1ATg2HPwoQOGaP0LM/mMWfua5Fi78xhJ5hhr11YyazvIo0APDXDJ+KiwTgmmMCsMJh22eaNg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8aab1b63-6efb-4238-570d-08dabddf5add X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2022 21:07:02.8189 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8VBecs0aoIO1LN7Yqo1ZHJ75wpIS78/JRfimgIDzCn/WuCg4s1V6hI0XWs2Xg2f+F9vTJVzMFG5gyzGiT6BAbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR03MB7746 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221103_140708_776647_335B18C8 X-CRM114-Status: GOOD ( 18.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For a long time, PCSs have been tightly coupled with their MACs. For this reason, the MAC creates the "phy" or mdio device, and then passes it to the PCS to initialize. This has a few disadvantages: - Each MAC must re-implement the same steps to look up/create a PCS - The PCS cannot use functions tied to device lifetime, such as devm_*. - Generally, the PCS does not have easy access to its device tree node This series adds a PCS subsystem which MDIO drivers can use to register PCSs. It then converts the Lynx PCS library to use this subsystem. Several (later) patches in this series cannot be applied until a stable release has occured containing the dts updates. The DTS updates are fairly straightforward (and should not affect existing systems), so I encourage them to be applied, even if the rest of the series still needs review. Changes in v2: - Add compatibles for qoriq-fman3-0-10g-2/3.dtsi as well - Fix export of _pcs_get_by_fwnode - Add device links to ensure correct probe/removal ordering - Remove module_get/put, since this is ensured by the device_get/put - Reorganize some of the control flow for legibility - Add basic documentation - Call mdio_device_register - Squash in lynx parts of "use pcs_get_by_provider to get PCS" - Rewrite probe/remove functions to use create/destroy. This lets us convert existing drivers one at a time, instead of needing a flag day. - Split off driver conversions into their own commits - Reorder and rework commits for clarity Sean Anderson (10): arm64: dts: Add compatible strings for Lynx PCSs powerpc: dts: Add compatible strings for Lynx PCSs net: pcs: Add subsystem net: pcs: lynx: Convert to an MDIO driver net: enetc: Convert to use PCS subsystem net: dsa: felix: Convert to use PCS driver of: property: Add device link support for PCS [DO NOT MERGE] net: dpaa: Convert to use PCS subsystem [DO NOT MERGE] net: dpaa2: Convert to use PCS subsystem [DO NOT MERGE] net: pcs: lynx: Remove non-device functionality Vladimir Oltean (1): net: dsa: ocelot: suppress PHY device scanning on the internal MDIO bus Documentation/networking/index.rst | 1 + Documentation/networking/pcs.rst | 109 ++++++++ MAINTAINERS | 2 + .../arm64/boot/dts/freescale/fsl-ls208xa.dtsi | 48 ++-- .../arm64/boot/dts/freescale/fsl-lx2160a.dtsi | 54 ++-- .../dts/freescale/qoriq-fman3-0-10g-0.dtsi | 3 +- .../dts/freescale/qoriq-fman3-0-10g-1.dtsi | 3 +- .../dts/freescale/qoriq-fman3-0-1g-0.dtsi | 3 +- .../dts/freescale/qoriq-fman3-0-1g-1.dtsi | 3 +- .../dts/freescale/qoriq-fman3-0-1g-2.dtsi | 3 +- .../dts/freescale/qoriq-fman3-0-1g-3.dtsi | 3 +- .../dts/freescale/qoriq-fman3-0-1g-4.dtsi | 3 +- .../dts/freescale/qoriq-fman3-0-1g-5.dtsi | 3 +- .../fsl/qoriq-fman3-0-10g-0-best-effort.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi | 3 +- .../fsl/qoriq-fman3-0-10g-1-best-effort.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi | 3 +- .../boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi | 3 +- drivers/net/dsa/ocelot/Kconfig | 2 + drivers/net/dsa/ocelot/felix_vsc9959.c | 31 +-- drivers/net/dsa/ocelot/seville_vsc9953.c | 33 +-- drivers/net/ethernet/freescale/dpaa2/Kconfig | 1 + .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 43 +--- drivers/net/ethernet/freescale/enetc/Kconfig | 1 + .../net/ethernet/freescale/enetc/enetc_pf.c | 23 +- .../net/ethernet/freescale/fman/fman_memac.c | 118 +++------ drivers/net/pcs/Kconfig | 23 +- drivers/net/pcs/Makefile | 2 + drivers/net/pcs/core.c | 243 ++++++++++++++++++ drivers/net/pcs/pcs-lynx.c | 76 ++++-- drivers/of/property.c | 4 + include/linux/pcs-lynx.h | 12 +- include/linux/pcs.h | 111 ++++++++ include/linux/phylink.h | 5 + 49 files changed, 758 insertions(+), 268 deletions(-) create mode 100644 Documentation/networking/pcs.rst create mode 100644 drivers/net/pcs/core.c create mode 100644 include/linux/pcs.h