From patchwork Thu Aug 4 19:46:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936670 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 74EC1C19F21 for ; Thu, 4 Aug 2022 19:49:10 +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:References:In-Reply-To: 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: List-Owner; bh=7zfY85a/2yPXQU81xhSS25eLKPSFKKmrdeXGWc2c/0s=; b=JM1Fom20vDOslb wik4MbJdEc9+wvZY6DybxYMVvnU2MGRimTLsKTAP8RLW38dqnZTSLBsJ3iJV4fLCTXfQ2z7sAaKza ZwcRxA8tfCgSrFGVlH/03oAKD5T0Pg6fWttMlBsnrfWAM1P66KMZTGpLCED74yBc6GJZwen9pJJl2 a9kQd8NmurQNrpftlbM9qR9DLJWP/EiFqVqfgu9wwO5YXnpYykd9d9i1NJ+kfZ3toIFSMD4TZn4zx rYmvHgHKE/z6la2Pq91ImdAT5O6P5o7hwrJDahKHmleTLg3gOkXpOoC/wmxQlzQMVOswhA2+Chuzh mAYW6o/rtp465KFvcwMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgoy-008h6k-3h; Thu, 04 Aug 2022 19:47:52 +0000 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgoh-008gwv-RH for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 19:47:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kfaVS2WdU0G5MNEsY8JZu+LDiozGu5O6LoGbkBC14mFMnaD0lUtbg2tgNTyixrBD2I+0F2XOLQg2jYKpMRPb8Dn7mCQHWzampZ5YYoEFjnw03ZY5HKeALkhFD723a5TO6zwzsv5pSYbxH4YR01mf5vLC0UmzShhz9qLjB2XEOsZg2q2bVluC11mfFg7sjBG/3afGkYQGAsJM+OBnGfiVv0VXhjs99PSGfJViYoIcN1u8/fkKJCLtKto6TsSWaWYKEgL9XqhbAhUBCi5zXH3yv4tKCkvleX4ZzW5PUtDkdr6Xx2sdy2s9PMQ0GvGT5yRzWeAUKbnnwtk7hWg8YZdtog== 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=3PvYpyeGEApRf6wgsniB+2Kn88leNN797NcDENY5oAo=; b=TtlRx6Qc1NNVQeB6kjVkF2C7b5YbJIw/oC0TdARqworb8hsUUECgctsI1AwRZydi2pHywGw7kzoqMl3n60Jc1SEYk/qKRkdQoToylpBtSqeW0WLcLqFNnOmIg6GKkebHs1tWGT9RoieAXtOSRwWUM5Qjyzy/ABDY9ss/knOdmaf/XAcoFQykypx/LL3GUEc92qq74O6BeDXSF8PyZAegVjoJSUYwhQz3K3LJSuBF7lWKHO6GphxfJWYywFKMTm+3qwtyuaW2eCWDKVcBYIX81JYhWorbblsEtSOnupH133vjHa10BTmziCMhSMYkulVhfopfeFRb2PJQZrIrIzwBig== 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=3PvYpyeGEApRf6wgsniB+2Kn88leNN797NcDENY5oAo=; b=tZXk7OyOgC4KUjbFIsB0YJJOiRxmUZaOh2YejJQziKDKKnxP2x6MGQ30qSo1GUqcaV8y69kadM0UA4rMkPThyHcc7Z21Fw1C04NklI2EzOyJRE82e9UGuonELSefKeba7GgXFNKbBah+JZrqzzXDwRwFsBHr3rWKANXmrezX1Kd6jsJFR5uBh96AwaWP9MbdNBTglDLFX0djrCT+xkcJafJNyQBogBaEISuYhoNFloV2RZTTRMMjAUAmgB/3aUYr21N8quKUGy2UXWB23y3qknAPEUdHZLtJy6W6Ax/5TPhsmp96HN5Horv4dbLa2fR480E18wf2eL11V0+s5JEx/g== 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 HE1PR0301MB2297.eurprd03.prod.outlook.com (2603:10a6:3:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 19:47:26 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 19:47:26 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: "linuxppc-dev @ lists . ozlabs . org" , linux-kernel@vger.kernel.org, Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , Russell King , Sean Anderson Subject: [PATCH net-next v4 1/8] dt-bindings: net: Expand pcs-handle to an array Date: Thu, 4 Aug 2022 15:46:58 -0400 Message-Id: <20220804194705.459670-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804194705.459670-1-sean.anderson@seco.com> References: <20220804194705.459670-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::17) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10db851f-9e2d-40e5-821b-08da76522855 X-MS-TrafficTypeDiagnostic: HE1PR0301MB2297:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9mP0mWqkZbc4aNwHKbJLCbbkR6EhSGZud+UMhgrKf/9PIOY1suazMIH5+srPJQDJvUGv6NdnTXnp+8wodOQqkVKUc2ghokdesCcL/F7BhmgLrJtgzIDkIBjmNWuDFVXav8LQZAzdoxI7JV1vYmXrZ1pgMLKGdDI4kYFtxNUGcxbeq0h3wZOir5dXZaD04jZg2VfDXZbDMa13OuQPRfycUcEps2fMXf3nTB2fh0NM4j6TemP/iV8GnLV2KSXCNkKPUuvQg8oPJi0tOhZJNgEdnQ4gXMLth5tK3U059AZCkMZST4SfiyUGr3B+b1D8D1jLSVW0+YXxSPvKWkjSKKbwISYLZYliz5FJ0pCCI/4xjHaXwDhlbPi8ry2jUocgYuqRPBi4XfQCEg1S+dkW/EuhClpdUo8gd+Muiqgxho50Qtwcx5KvJDhk75tDb23uvmh6St1bhJCxUvxCHjbW0iwf5XWYbPCJgUFtqGENlI1jcdCX6Upes00STktFtUWHz+ab6eK258fb0Pz16EfEYfTPTm9dwdblifuuq4PcTLoU9Fsj8LARg1zaMn0LwjP4NJGKbHdpMDKA3z9pK/3wWdE/TsQmqjVDGBBBsf987FrhNXjnR/n3fl/ing+wAIiIq94Sy6PKJxRMFNdXACWvVV1hiBqT81yVdGPX6q86NSssEbub5CnFj3IrEtE0aHsmi1fyU4NENfXkxm4lreb929n9k0XhpIdU7AyS/sEbuVEZT/0Ck5Vj3taBTQROmS15C3HiDQwyZHstvcBi0vuYlqjxCmo2ubIREiRjHNPWJIvnoUOX3VeeqGOcIlmGiIc5qIFoon/qeZr4cJiiB1N+yS+0xA== 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:(13230016)(39850400004)(366004)(346002)(376002)(136003)(396003)(6486002)(478600001)(186003)(1076003)(26005)(107886003)(966005)(7416002)(6506007)(6666004)(2906002)(6512007)(8936002)(83380400001)(44832011)(41300700001)(38350700002)(110136005)(38100700002)(86362001)(316002)(5660300002)(54906003)(8676002)(36756003)(66946007)(66556008)(4326008)(2616005)(66476007)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5DAHHz3NjA3zAIUgV3/Pq3B3AhppbZ6V8VwinIF1Sf74k7ibXDyxZPN7wdvQNOlJXeJTEzjtnUXX+4BRvouxtfBRaUH8q4MYE1WvqEpj6OxbxWTJA6my+O0w8wHBQNLzL5Zs2REhzfVNcTtlyCmDVRtPReGIoXhkz7J3OfA8PemNhYso+rTlQZ+TZW5j+aH59vNpy9PlWDJOiSW5ZRDrCPFIyAsLKrEGzEHiKAnpephBYHU1/sNqqGj8buddg2c7AUV/sSvw128nqqAmcYWDgETBmrSwhztEHw5y/Ny8n/hqG3l9IsoBKt+N2/TR07ibK2IC5kQN2PhJ+Mo+1AM7UFIgG+Uegnsa3vmYqFuh7QjpdakjhvXfF/SorUZyAbG/ZrvgHvEAywL4YvV4xcVXAJvHxvYeSwC8rjIwtNRlWCYeMsR/PjFJVz0Tm/RRv49cOqD5qcHijfKRZzCnqoHY+Y9jaLo1GRfzihBUDqxqhJP5vDf7GfnaZxrbCAtN3aoOVV8Q9MQv1rLSNYVm8q9yLIg3xzF0p/bjOmPiae7rOyNPn+Jqpyn+QcDoMVunFcSnYywAkPnvMV4Ng6KjwjGvvtoibY0LxBdPF9jtuUpgDXUG31YLg26HlFfm6igU0T8OvYBIOCiye9xm81CHuQjn6GJom4IuhHQX6/bmO8x0111+K4l///CfyDsYJq+ewrpBpQ7gCsEqfb2OjMlTHgMlueSv93qKq149NiI1kaPnX1tsX48fnw7AZhT8GetI2MTGCxuhIyobb0yH2SsXbRrd6i/Lk/Q5P6j8f5qxN27CZu5SFfev3xGtE4wYtiMkyYs5hnWLzbf9BTLGZKuZP/nL7J/0i+aas696tzvj+VsQyXfTeoR6BwJqh2dJ5A0pDm0tkt9aMc6U0LohSEciP18m4a7MWQXmXTA2yDui/myNXqVvkDbkI2g8ofENRWYOW6bm8wiLCxuleT/rJYpdZ2S16bY3uc9NGh+BtZtnT+xkul+Za0MMktKSuUP7if6tdkmGd14Wgqqo+HkLPrjRz75Kn0lgAUeCHenybqE5K1BkNvfbA1bG/e1saIh6QCw7ifkvxTNncj3tdYyarNr7U+MC4rDI5jfYpTUZneXFIfklSrfFYNs5b1e7mFo/4bnlWUYXBc63eYLxf6wlvAkE6Yiz/RqlzGOHY3r/QpMZIuoc3bMnxrWFncOvEXelxhbd1QSJJLM5RjagM5rOi0OA8rmt/vcAN3NmfrXT7RrRdL4YI8MNJFddipvcXOd2OETBW7aJq6gGkU7JqOmO8HMRFKz/gk1UliRcSp3Y6pL3vz2W0uTjQxzUsj3HYUzCl0PyBTGbetHTUuY8qdwGFy5d5evKDKpj8BaYlTNhNWkKEqg5vo24sBhxOTpdmvuNWQpHMhHWGRSdmLmIn4tyMJ3BJi9ZJ/iv0emZpGZ+raFJ8ApEpoaT6fVi3czP+MluhgbMFMKpHJ7WLpHoRP/Dlig4PRZMMbJ7/J3mAXi2zQLFNZUKBpcuElierQmuo3bmSzLjmAiFiytQIpQoYogKttk5VigwMpZTyM/yXJKt2VncZCa8A4TEYHnH4vFHxlARpB6wswW2N4tC6C2xwJoSKCjZWA56EA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10db851f-9e2d-40e5-821b-08da76522855 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 19:47:26.3841 (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: ldQIRXX3nMPQSTmvdH0ZAb2XK3eo+LphDapUAtP/p9R28esmUVLyCC2TFAIQpT7poKX5SUa5i4McUhijWKp3bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_124735_907252_05433722 X-CRM114-Status: GOOD ( 13.54 ) 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 This allows multiple phandles to be specified for pcs-handle, such as when multiple PCSs are present for a single MAC. To differentiate between them, also add a pcs-handle-names property. Signed-off-by: Sean Anderson --- This was previously submitted as [1]. I expect to update this series more, so I have moved it here. Changes from that version include: - Add maxItems to existing bindings - Add a depenendency from pcs-names to pcs-handle. [1] https://lore.kernel.org/netdev/20220711160519.741990-3-sean.anderson@seco.com/ Changes in v4: - Use pcs-handle-names instead of pcs-names, as discussed Changes in v3: - New .../bindings/net/dsa/renesas,rzn1-a5psw.yaml | 1 + .../devicetree/bindings/net/ethernet-controller.yaml | 10 +++++++++- .../devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml index 4d428f5ad044..b87574549df3 100644 --- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml +++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml @@ -74,6 +74,7 @@ properties: properties: pcs-handle: + maxItems: 1 description: phandle pointing to a PCS sub-node compatible with renesas,rzn1-miic.yaml# diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml index 56d9aca8c954..bc4c0b060a4f 100644 --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml @@ -107,11 +107,16 @@ properties: $ref: "#/properties/phy-connection-type" pcs-handle: - $ref: /schemas/types.yaml#/definitions/phandle + $ref: /schemas/types.yaml#/definitions/phandle-array description: Specifies a reference to a node representing a PCS PHY device on a MDIO bus to link with an external PHY (phy-handle) if exists. + pcs-handle-names: + $ref: /schemas/types.yaml#/definitions/string-array + description: + The name of each PCS in pcs-handle. + phy-handle: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -220,6 +225,9 @@ properties: required: - speed +dependencies: + pcs-handle-names: [pcs-handle] + allOf: - if: properties: diff --git a/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml b/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml index 7f620a71a972..600240281e8c 100644 --- a/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml +++ b/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml @@ -31,7 +31,7 @@ properties: phy-mode: true pcs-handle: - $ref: /schemas/types.yaml#/definitions/phandle + maxItems: 1 description: A reference to a node representing a PCS PHY device found on the internal MDIO bus. From patchwork Thu Aug 4 19:46:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936671 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 0AC58C25B06 for ; Thu, 4 Aug 2022 19:49:23 +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:References:In-Reply-To: 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: List-Owner; bh=UYIX3CYyI/oh/5We/wpZ/7jGYSHcgfzJKyM6B28/2bE=; b=2tpddhnfTruY3R owNJDrwYw801Vqqw2qbQMVb5F5eqeUQGwAmjTqL+dAMnbQ6ofXhdAr/lmClchdHoQ7AtOLCcQGMmn Hlb8Vxjz/HlEMUT7caUpv4i7sXYE5xVZbsUOJlI/Tu1BmsWBcD2Xq+e8O/FBOWG+aqm5uW/5e7wS6 1MaKdtXkmfO4y9vOENWo1D5LPgKlsEMRk8iQTiI0RmY8RtAjVHhhS/b70hEbo1i9B1LQTKfGBt1hj vBw+paqCxrxEKo7GWNNaFCE/+j47MAIXiV3E2IIZrwfTxyDxQqfHTwhDxw7rp8yoM4uc957i/ij9z 3mAkpv4orFpia70nbVuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgpG-008hEx-9t; Thu, 04 Aug 2022 19:48:10 +0000 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgoj-008gwv-SQ for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 19:47:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dgo0D1DYkVuBOCwXfdtZOFykEyUBKTvaR7eyaDM3Ms3vSYCdJ3k/Sg7eDDDnf4kAoXgV/VInJNmdMoBFW8xpPH6Dk/jFMFeimXHg8KIkFmC1QQ9UHzQZgWGoJsGaW78UBLjQYsCL0mxdkTS8jTpXVcZXVQYoWC7DulvxhpL0vGews40JCPh6P2rUPvO9c7D4lzMZF3sD00bdyLsu/ycN5e6FOUjZQpvVOSOH426tsHBts7smneFuLlrm7Ok5SF2jrn1fCByBxD/Sk35R7h1ysgXz/NhkjaPEL6tn8YXh3Z3+3+9JLnrwMed3XuWfUfYp2ZhnMyUgNiYwjDTd8MI3Bg== 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=/rFDiaVxvOHtQ65IrquHz2bwl4lCXIK1BRND8yyrpwM=; b=WhwRl48dYi/oLPDQtRcaEh9DxdywCdZDqFTSCZyTAPan1gDiJO2y72mkwEn96e5cRYlvzgZdW1xeXuI4CfXMawdxrX9mYtPv6ETxOWgFEK4bG+sDXWqixPSgIbw1pccTHQ9zzQBSFunBCrRFynvJIw+ZcctxIi484+AIh/jbNIqQ4aGmJb0kjFtuZcab49CENYGSrQfNwYPumeLnd8JZLJhgpWVZO1DlpeTkcT10I8R+AVZD1h0eTo2JrTwq6fcXZ8txGSojPsZ8m7IMdYV77RrJ334xM2v+jhu6tRi/L32piG3lOe8thiIuXw6VrRoewtXF6RxiON8Deygeh7UUtQ== 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=/rFDiaVxvOHtQ65IrquHz2bwl4lCXIK1BRND8yyrpwM=; b=rzf6CYQo1whxTqtGc2qpY2tHkNR6J238nQbS7RkWrJG7nQoiRk6E4D4JijYyjN/qulYwXb5COzTafi8VKJBUcOTkX6wFLZEh7e8bTVRr8E+YvZNKQCsaL8Y6qudKhoB7BB9FG+vstMmv5YwXHolVLiLdZo1kUHDVqARBZ101WcoqDadHVlKyDXjEKoDgYJHal23V4Tl/MG4bRMoGlOnFwksMxzHxJjV61uWyLT53tcoXT7pRt/pRe96u39vjvw3V2YPF9E+nKBN9Qfv9y/pW11711LEJs2u9INxHKUoyxQ9Tesgd313KACI/f3NerPhh5qk5BPUFlzLPzsKZriTJPA== 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 HE1PR0301MB2297.eurprd03.prod.outlook.com (2603:10a6:3:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 19:47:28 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 19:47:28 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: "linuxppc-dev @ lists . ozlabs . org" , linux-kernel@vger.kernel.org, Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , Russell King , Sean Anderson , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v4 2/8] dt-bindings: net: fman: Add additional interface properties Date: Thu, 4 Aug 2022 15:46:59 -0400 Message-Id: <20220804194705.459670-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804194705.459670-1-sean.anderson@seco.com> References: <20220804194705.459670-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::17) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b993829-0345-401d-228a-08da7652295e X-MS-TrafficTypeDiagnostic: HE1PR0301MB2297:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W/8vAQpoxTYc2AbrUW0na47iwP6XEjetfpWTBmkNWrU/K6sqeL+qcCHWxVJuSN/t3BqfUIynKmo7R+OhuIxf3CxvThTa+cDa173uJg87ctTrDG+tG3YKcVPKE/IZGU+WMISd0oZOHuAinozQ2HluQu5wt6kEDfzN1fbEJeDTrMDEVtilk4Z1dL6m3lsb4mcmYyo/jUZZhIuAHlwepar3xQvpxnJJ6oTnjjObHCnvG2zfrq+en1KKFnbAAvdppVZQiAMG/4sO0Q6hk3kY29TnOClc2GbHyOGjM0Qz4PSikecNsMXVI3OxQuO4S2u8g4ABo1EW6SBunLvU2iD0vB+jtTU6bgp3u8VvDoP0fuzz+XVtF1wwQNeGXlqHtRQme/eACUsinRalNXFhuam4pJwLvN3GPgkqR0ilQz6VimcYEcMDeS38oaOCjQPloVmfpDU4GQ5WhzScwXfHcfa+9uvjW8V8e0T2fwCO+y6EHcrORSqaeSDzEFNTPPweEygydt8S6v6E6kpCj9U2+yE/4C+G3n9XdLN5ntq50f+x1+c958v6vqUj9cwPNd+QOKcBXWfK5tSV5AIKm3fqIJL4rsZ/eggALTCwKHZqjt/JOKRJdozX1wVlt9ODcppB02omhNOQdeGJZ2hXiUgQWA6FLcDOWR/H0yMlPhysmYzRsZSGy4HhoSSGm8GDDZaDe5iEMTXvppux9daHxxN7BD31s7JMPTm53rFw6ISDdyFH0hY3t6L+sX1Tok+9K6f2e8FAE069GABD0hibTEgJomCvCt24JT1D2sjrP26WLM+Tz6VVQagZRy6PcVBSQN8+SjWqYjsO 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:(13230016)(39850400004)(366004)(346002)(376002)(136003)(396003)(6486002)(478600001)(186003)(1076003)(26005)(7416002)(6506007)(6666004)(2906002)(6512007)(8936002)(83380400001)(44832011)(41300700001)(38350700002)(110136005)(38100700002)(86362001)(316002)(5660300002)(54906003)(8676002)(36756003)(66946007)(66556008)(4326008)(2616005)(66476007)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3Mpf+df4u76op3CJLR9l/mgNxO+EZPHzPvg/66c0AQ1RuAsg6kWDJ55Tg9d3gGvp3ZWXWucYTzk9QG3GuRUnXdtrA+g+27eAz94TszzWNRDITOZ8JiMsNukjo7+sU1jhj9GJtmqJEGSNC14CMlP13RK8sF3y8EeR1sK3vPoRH2EBdbZEr7s0ELBh8E8J5cuhptxiWgqfvPUAHDLx4byhXOd5XsWvn1xLiq+IKQcRdejDJxHs5exCYI4avDbx+OzjkWc3LQohA9wozup+6KN3RtYYNNw3iW0xyoIBSm+zgw0/O1uIJdek3DFmG8jZzPm7P3sivnDRlLsbWF4SzxJVVPD9hOzUDSVJL3MAAXLZ7Nc6+ZYquWYwsI49d7UjUenHkP81WXLJt/JRv4KIOEs1yfg80lMInL08ENbsyOm+ZRObGB98DDNoM0Pf4PMTgoOxtYwKoY0Hz9eY5ZVO10tmkE+qTpQfaul+loqs1vyANzGq4lbhuBKBSQNyaHi4WNirecm6p/EjBOEcQ70IcOtuEK17RN6oVwRDWo2uxVMb65KF/kFLuUpFn7OfYr4Tki+3M63OFx+mMiPe58bPMIpbGhCPR0t3DptR8Cg6sQtjh3ZG9PI4GTOl6XTER8XDTQ14OikefSSNX2UG8hPynJyzLj042c8/zsS74hmSggOVTBeO6LwPdDN+fRrYct2G9qaGv3DdmDrTJDqG2eHPv7DlodLsgHdf/3Bg0h9c27hlJAHiC+0fkVLkURH7DtAcUvi5Zn/RYhwS1W0Fal4abCxEiPGes54azZaCa6Qz1XNpkeOUqbOPjAebbDvEKv7RVIawkHAMJLQOXnLZ9K9BJymaWx0y3JFmPX6ASCWApCiziVa+4spK0mT55sZnoyFM751QYUMmvdEIpli+gIQ03y/NSxqPEzPtUGJ4EGTB2/9zAjqvkFaTKr/cAub2Ib3BAqW5E6E5RZd32zYU/fEBGgtuaSSbe3C48EoeHLB7sbU2qKKDPBZBAe4P7seu2I7qTcIwUHUgMKOTPFx1VlFEi2P1Oxo83hRrVwacKd9U8JIVKHOLDltAmPXbKyy7+sSAagKo82zFECHE61q5prlf/Gi/cE8L+id9hMSNm2zhP2yd+DuW+e9VR0lAJQLPJNy1FmE9jgg8qMWaZOCpSRxJYZtco1lAFfb3ch/L+2P2m1VSc470UhhjSCO3R0HWJHmzR8IVq0yVz+hKm19vwvQ2SNFKe87Tbus1gwSeWst6SNtp6pbPWu91c+sDiI+JEzToxVW0oa+c65gaerHI8lyisW1s2kgzmeZKkKqcwBFxFbxDiCUgCI9vaPl5xA8COIyeytTSKNm1eyqsRyq4qivneJJpNcUqLJYo9ZVet/Bl9dmIFBhMYQ9D3ButMfyvDX7lD7JUQUJjT6AVy1PNGP5G5rEUE7zZhB+g1tvYe7kYi+AKH9nVWzPtb51Xy0HH8icgzXjjb0XDEP30+6b2B50qp9gENUmnCrCqcz6SBSgQEbHLMFh43ucT4YkakWLP95CN+5TDFn+v9GxSD86XFGAMANgqHhgkVC3UCt3bClrwvfEo0Elrcc+xPYEZAcAZn0FP96U2GfWj4ZpavcyyV5AGU8ncyA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b993829-0345-401d-228a-08da7652295e X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 19:47:28.1496 (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: jvI2IxT13BFxZ/e8/Sc7MKy+48pW6yl1+uVFaO2DJRebDghoaJA8twdrCoQLTSUlKxuJE+yMQ/jPJ3IpBXyGAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_124738_018607_C2777CAC X-CRM114-Status: GOOD ( 22.91 ) 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 At the moment, mEMACs are configured almost completely based on the phy-connection-type. That is, if the phy interface is RGMII, it assumed that RGMII is supported. For some interfaces, it is assumed that the RCW/bootloader has set up the SerDes properly. This is generally OK, but restricts runtime reconfiguration. The actual link state is never reported. To address these shortcomings, the driver will need additional information. First, it needs to know how to access the PCS/PMAs (in order to configure them and get the link status). The SGMII PCS/PMA is the only currently-described PCS/PMA. Add the XFI and QSGMII PCS/PMAs as well. The XFI (and 10GBASE-KR) PCS/PMA is a c45 "phy" which sits on the same MDIO bus as SGMII PCS/PMA. By default they will have conflicting addresses, but they are also not enabled at the same time by default. Therefore, we can let the XFI PCS/PMA be the default when phy-connection-type is xgmii. This will allow for backwards-compatibility. QSGMII, however, cannot work with the current binding. This is because the QSGMII PCS/PMAs are only present on one MAC's MDIO bus. At the moment this is worked around by having every MAC write to the PCS/PMA addresses (without checking if they are present). This only works if each MAC has the same configuration, and only if we don't need to know the status. Because the QSGMII PCS/PMA will typically be located on a different MDIO bus than the MAC's SGMII PCS/PMA, there is no fallback for the QSGMII PCS/PMA. Signed-off-by: Sean Anderson Reviewed-by: Rob Herring --- (no changes since v3) Changes in v3: - Add vendor prefix 'fsl,' to rgmii and mii properties. - Set maxItems for pcs-names - Remove phy-* properties from example because dt-schema complains and I can't be bothered to figure out how to make it work. - Add pcs-handle as a preferred version of pcsphy-handle - Deprecate pcsphy-handle - Remove mii/rmii properties Changes in v2: - Better document how we select which PCS to use in the default case .../bindings/net/fsl,fman-dtsec.yaml | 53 ++++++++++++++----- .../devicetree/bindings/net/fsl-fman.txt | 5 +- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml index 3a35ac1c260d..c80c880a9dab 100644 --- a/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml +++ b/Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml @@ -85,9 +85,39 @@ properties: $ref: /schemas/types.yaml#/definitions/phandle description: A reference to the IEEE1588 timer + phys: + description: A reference to the SerDes lane(s) + maxItems: 1 + + phy-names: + items: + - const: serdes + pcsphy-handle: - $ref: /schemas/types.yaml#/definitions/phandle - description: A reference to the PCS (typically found on the SerDes) + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 3 + deprecated: true + description: See pcs-handle. + + pcs-handle: + minItems: 1 + maxItems: 3 + description: | + A reference to the various PCSs (typically found on the SerDes). If + pcs-handle-names is absent, and phy-connection-type is "xgmii", then the first + reference will be assumed to be for "xfi". Otherwise, if pcs-handle-names is + absent, then the first reference will be assumed to be for "sgmii". + + pcs-handle-names: + minItems: 1 + maxItems: 3 + items: + enum: + - sgmii + - qsgmii + - xfi + description: The type of each PCS in pcsphy-handle. tbi-handle: $ref: /schemas/types.yaml#/definitions/phandle @@ -100,6 +130,10 @@ required: - fsl,fman-ports - ptp-timer +dependencies: + pcs-handle-names: + - pcs-handle + allOf: - $ref: ethernet-controller.yaml# - if: @@ -110,14 +144,6 @@ allOf: then: required: - tbi-handle - - if: - properties: - compatible: - contains: - const: fsl,fman-memac - then: - required: - - pcsphy-handle unevaluatedProperties: false @@ -138,8 +164,9 @@ examples: reg = <0xe8000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0c &fman0_tx_0x2c>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy4>; - phy-handle = <&sgmii_phy1>; - phy-connection-type = "sgmii"; + pcs-handle = <&pcsphy4>, <&qsgmiib_pcs1>; + pcs-handle-names = "sgmii", "qsgmii"; + phys = <&serdes1 1>; + phy-names = "serdes"; }; ... diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt index b9055335db3b..bda4b41af074 100644 --- a/Documentation/devicetree/bindings/net/fsl-fman.txt +++ b/Documentation/devicetree/bindings/net/fsl-fman.txt @@ -320,8 +320,9 @@ For internal PHY device on internal mdio bus, a PHY node should be created. See the definition of the PHY node in booting-without-of.txt for an example of how to define a PHY (Internal PHY has no interrupt line). - For "fsl,fman-mdio" compatible internal mdio bus, the PHY is TBI PHY. -- For "fsl,fman-memac-mdio" compatible internal mdio bus, the PHY is PCS PHY, - PCS PHY addr must be '0'. +- For "fsl,fman-memac-mdio" compatible internal mdio bus, the PHY is PCS PHY. + The PCS PHY address should correspond to the value of the appropriate + MDEV_PORT. EXAMPLE From patchwork Thu Aug 4 19:47:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936672 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 98900C3F6B0 for ; Thu, 4 Aug 2022 19:49:44 +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:References:In-Reply-To: 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: List-Owner; bh=YUgRT+2qCPXHD48wVQPKpNp1jf5j7rXeujMMgMM4KWo=; b=TE5xND5lUNLyRD xTybMsb28QOX9QNgYKB7nZ1pxKRQNBe32W6nOQ09yDDwOjLcs7Nm2RPBgLPRzme9rexaEGrnLrA5C 0dGO4KHnZjAKuW10Bek0H5ruTkUXXoeFY9I+M/cJ07OTUDQzZRfa1F65fl33XOKBNzr21D1Jz4WyC ARrK177fAYXCIXnktsdBx0WdzYNAE0vaYVgFngZK8mixfajmqdp1kxVTeCuqOxYEpb04cpyO1kxij dpasJlsXtU9aQrWT+BTR00iDlr0QupqTFePA+cWEIwqe/LufZWeuqAXLfBC6MWBu/+9WbYM5DfAMP sX6xjJbV1XNJ+pbzFInQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgpY-008hMn-H1; Thu, 04 Aug 2022 19:48:29 +0000 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgom-008gwv-Sf for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 19:47:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dqGCGIJHp+Y2iQck7fystPa3gBGW+wtW6sJyE7meP3/yfVcHvPCKsUr1lE00J6jDvMiXGRT6WmSx/26X8OXPVLFO692OkCrcLiEQNI4fnVHaoeRmeYG2haf8avd9To75i8++/81NKsc8oU2eMLTVR/1YUxKbm0ZBpb7trTgacwWSdnKYYAwd/8F/hIVIuooBS04ie3b3NjFsvfGYEy4gNbHJ6R7BVn1sXlsVJOxGEa5wtplSW9tBMWLwpaZLqR+ZKwjQ3AoCU+2d5RL7iazGhKPVyVIl2j0+pyoqHcthY1cDAz/TNpQHQUQu3rW9xjCKq8jrOY19XS+3E9M8YH6osA== 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=R+q9wxmuYFEtYhelB1kFPXp0tCVpIWTJa8bakEDEdas=; b=T7bbBV4DcEP0oP+BvNwCMnZEjN7cqHKsJqqOzb5ein/Yq52COzhPQAOkogQeUaAoTCa/B8RywQlN1y8LdB7ugG3Xe+1ha5/VGHDA3sH3xPeVs/HLmJ5RSzu05JmIcc7thpKZH1uruwjiy4QxTp2vhFnU3xMNrbmr5xhYn8whD7VV3gxIUyLxb4niDr4WtyJWpQKTD1kegUDt+IkXQ9QTWDMN6Ne9HKTimrfcxJNViVxg0StsB1qVwewscn1+Y7/DCfrzi6tx11anAfJOCTYSN87b5K45j1US3TYoDqnxOE5b78Z3dYX1BAhfW2BgwWLzDGi5bg5XFwx7pIg6JIN7mA== 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=R+q9wxmuYFEtYhelB1kFPXp0tCVpIWTJa8bakEDEdas=; b=jjBAGIyUVfS+/NS99JyeJxd6HVcCVrsVm2rkrViaXGUMbU38Mwe7+4/A9h8n1v3k+vF+xhnt/swQmgclKfdF1BgHzv1Y5UlnVWqRhNd1qbV9k25A9uuGuLDBS8zMWvvA9FFyrcSWGob0f+igDb59th9+7/BXYnfYI4T4rHi9v1FjqVLCc6Kj2dxuZagoOIv64zmcKZotAy6BFBhgBm7Tf91SMG6wJzi/XfKja3r7JYidSInlrOKcfpNJZuLHVKL2H8U27lqjQvRsJzZgaMhIhaVh8BVhY7ZAfZbJZpNJETrQF1B0Y84SL6QExCzafH/CnZRpxiRGlrgJXOM4SN79qg== 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 HE1PR0301MB2297.eurprd03.prod.outlook.com (2603:10a6:3:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 19:47:29 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 19:47:29 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: "linuxppc-dev @ lists . ozlabs . org" , linux-kernel@vger.kernel.org, Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , Russell King , Sean Anderson Subject: [PATCH net-next v4 3/8] net: fman: memac: Add serdes support Date: Thu, 4 Aug 2022 15:47:00 -0400 Message-Id: <20220804194705.459670-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804194705.459670-1-sean.anderson@seco.com> References: <20220804194705.459670-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::17) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 759cdf4d-dff1-4424-14e3-08da76522a37 X-MS-TrafficTypeDiagnostic: HE1PR0301MB2297:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mdMRPIhLE7mqggphjKn9snFchn3y6Efj7HqmTFv/mZZOIFDtlvjfNoOYY37ICzCBIBZMso8rVEGG1Q41CGQDGF46tofMrkg4k41HsOzvVaaOrtHrMuYNuI4oPxWJovB7790aZ67WvXTsS4ytEStqbSR/x+7chn9PAiH+dx51sktJx9lH5joDsQuu/3olFmWbL42PpgYo85su16c6hTx5SR1Nw932sHAnqJZJM3x0bQsJOUM8+U3OjU18IAGXPjq/5aJ2MWiXruSp1ZxWCSVBk1Yh53AJstv/VJopd398WPwuJDckue/CubU/gGHNmtcwWgVXfLbmRKoSeAr8vYWwXPz6ruTZ1wKYDxDpOn4851cQhlZs5dqcW4PCvzmyirdEMLeHKPtFASSLgeRRkMpJ45/yVJN7iaQBMZTvG9oYVD/sYaOZ8T9QGgBUGlgBs/gEf93hfm6Bhst7eI6t+eDrYcczSldj0umyZBbn4T5UGzL7AjcNIVfyBzwHJl2lGQdF8XpEbA8sDaX3IY2wZ740E+GdLKZb1zKHAJm+XUyVeyQFKthQoXHFKIxkSJOWynwQwrwY5uZI3L0UKGQF+01ezNKQJlQhFoR8TMWDOjk/DrUyEBWFgC/L/iMiiTy0jWzgdc4ttRqsMngoABTzkLTsvXkmyjbeNVdvOUk9A1tCklcq12stJZeE5rgzOCAxLPVP0ByVeraAeGRMaUawtiMSJTupSzbF6bOj2AXY55X7d+37IhoRTJ60vq4+kE85ygLuyQ/Z8Tjiu7QNVWSjM2RhnJumul2z0B1ew7gdh4UY9Y0KV/x+a9hBBKs285hfKdoQ 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:(13230016)(39850400004)(366004)(346002)(376002)(136003)(396003)(6486002)(478600001)(186003)(1076003)(26005)(107886003)(7416002)(6506007)(6666004)(2906002)(6512007)(8936002)(83380400001)(44832011)(41300700001)(38350700002)(110136005)(38100700002)(86362001)(316002)(5660300002)(54906003)(8676002)(36756003)(66946007)(66556008)(4326008)(2616005)(66476007)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rkOd34TvRi823iH+wR7UvL7PuBlZDsEAnYzjxXIh88RZs3t2HRkzkle4NufWzJshuxQKg1dnd9Gxp6tQ++wpGj5gTaG3OzuZ8VgBFEIrohkLVUXkSL5kAK/1uTmD9479qp8FqMZPL5uO35tg+jfHJytRLJEEddOIV+j8METPTyHoLK1QOQcaKqaxKPVguCt0s/rdWpE82Is/FEVobRNdSVnD3GvW8NZCfR0Mio4Y47MC81TnoyYwPHUtGfPilbJ3CCKqkWF45ZePRsrlnx4rHnpu8iVBFD0J5J0AwxoWOZYy+a/1GLljSY9GDetrlZniOx5smeC8wFgAQmkQ568H+LGb23bgRb2M71O3m8vRVqlZnYJ6L94OeOsGp//j+uUHOtMB58B+DG7EXVOZybd4RoVkhJqisgTmp8ndz6KTQ+M9M+gXzG14E+Tg180tLhnG3RwLh+sBxlLmamkHS6t/9YA7RsyvEtLezemWQM4ORnUErASF+HNY5y5K8ULKDooUOKm/9CE1Ntd6tKCCVCI18UNrFSB1jiiyn91LroQNqodH1a5SAamclNa9NY6JH359XfkfuBGE9TPZ6orAp83y0Jba1F9V665kSBWqyL1fWl2Y+Mxt5wVha7HaeCotZKww3rosb9Xx48i7mGmKvbIJ4p3KeLJ3k9rBZFHC4e7iUR1Bz79SnRVJ8xH1C7xrHviQW+i3actQTHw49OPIpMLsJleIJGQfuZR++tsROIIcymqCEqw8Nrhs6sP9ks0PsT2BqruDhPrGM9LSrMj65tlOYLEcSe/dhF/Zms0qNgAmKBIJ6nrscIefK5oN9eIeditlkiydNI7HvmaTMdZPPw+dAsLUDAOr050hXiqYFg5Tseu7Au4nCHSI0shRNyjZx1JV0esePudzqbK0WOFpVVJc1bLXPofCL6bFC1vb+WfbfRg7p5E4IWzMyYjQuIkxZ9yTULylN3E00MKP+5LuLPNPmFDminHyh/8NMQWO6RAzdCU2WUdNFHiJbW/q3HUOVgDS8Tbj01sSdwSi2mkR8T2p4G1++yj1aEU4eQYoqZmLJzQWm9QP4/N4tMvHvf4gwrpX+H7MiiKqoPOeKeR61+Wc6tqPjSgUdILOcejD+lsWDzj01FvtSdiXZZATCDZKq97wfMYt55DFtZbsFXPM71zrUDK1mhVcrpGa1bk2ZnDKMdw0Rhh2NFKiVsuhN5qQlhds7oKSmODHZFrO184Zw/ZLvvKRzH0xC9oP770z3JkqOnf23AwcbvO2GzwyolusBd4XClB/ttpL301c9AGiGmqy6YvfWMYOvhHxGdcMSqv+ULhgiO7QZnjDqPnwrRzLQ2Hd0V+3CKrGqOz51R0OeiQiyTfgDhPomR9s0YWFOkzmRi08sOLuLLgfxVriYg5a5ZQ+dJKiKiHf70tapbgvioUPbW3biRYH+TZWubNIX90eWto3maX02AYc8HeG9M/t71+yJVeojOYG5DSgPqwdRTPYfZDgNRs+dYu3blcizEVa4zUWjygSSGa2U2wAi0McPRv3JP0tYNyM7MytTRjFJH0tHdFR2sjpiPX2hfMVGDCyHt1LQh/OmgfuxlzB7Ej5RvCVNyMvqvzUp/+JvVtUR2pbZQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 759cdf4d-dff1-4424-14e3-08da76522a37 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 19:47:29.6026 (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: 1DQFt8ZdbMcKsANxK6coOkNXEMHgzLWoaY9iAD+Awbcf9Tcr1lG/v2TsyAvmCQj3HCXu2M6NhRbcitz4U0hgDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_124741_008405_A5964CCA X-CRM114-Status: GOOD ( 17.06 ) 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 This adds support for using a serdes which has to be configured. This is primarly in preparation for the next commit, which will then change the serdes mode dynamically. Signed-off-by: Sean Anderson --- Changes in v4: - Don't fail if phy support was not compiled in .../net/ethernet/freescale/fman/fman_memac.c | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 02b3a0a2d5d1..2886f86e45ba 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -13,6 +13,7 @@ #include #include #include +#include #include /* PCS registers */ @@ -324,6 +325,7 @@ struct fman_mac { void *fm; struct fman_rev_info fm_rev_info; bool basex_if; + struct phy *serdes; struct phy_device *pcsphy; bool allmulti_enabled; }; @@ -1203,17 +1205,56 @@ int memac_initialization(struct mac_device *mac_dev, } } + memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); + err = PTR_ERR(memac->serdes); + if (err == -ENODEV || err == -ENOSYS) { + dev_dbg(mac_dev->dev, "could not get (optional) serdes\n"); + memac->serdes = NULL; + } else if (IS_ERR(memac->serdes)) { + dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); + goto _return_fm_mac_free; + } else { + err = phy_init(memac->serdes); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not initialize serdes\n"); + goto _return_fm_mac_free; + } + + err = phy_power_on(memac->serdes); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not power on serdes\n"); + goto _return_phy_exit; + } + + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || + memac->phy_if == PHY_INTERFACE_MODE_1000BASEX || + memac->phy_if == PHY_INTERFACE_MODE_2500BASEX || + memac->phy_if == PHY_INTERFACE_MODE_QSGMII || + memac->phy_if == PHY_INTERFACE_MODE_XGMII) { + err = phy_set_mode_ext(memac->serdes, PHY_MODE_ETHERNET, + memac->phy_if); + if (err) { + dev_err_probe(mac_dev->dev, err, + "could not set serdes mode to %s\n", + phy_modes(memac->phy_if)); + goto _return_phy_power_off; + } + } + } + if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { struct phy_device *phy; err = of_phy_register_fixed_link(mac_node); if (err) - goto _return_fm_mac_free; + goto _return_phy_power_off; fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); if (!fixed_link) { err = -ENOMEM; - goto _return_fm_mac_free; + goto _return_phy_power_off; } mac_dev->phy_node = of_node_get(mac_node); @@ -1242,6 +1283,10 @@ int memac_initialization(struct mac_device *mac_dev, goto _return; +_return_phy_power_off: + phy_power_off(memac->serdes); +_return_phy_exit: + phy_exit(memac->serdes); _return_fixed_link_free: kfree(fixed_link); _return_fm_mac_free: From patchwork Thu Aug 4 19:47:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936673 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 75221C19F21 for ; Thu, 4 Aug 2022 19:50: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:References:In-Reply-To: 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: List-Owner; bh=14r9X6T1ZTfUW7Ujc8tF83E5r+cvkYZVdo7i1bf+VRU=; b=CqMiCNlU2qibc8 TehVyxUwEgQvIZKiuviZFJewby9gZgwBJ1h4oNDRx2p90YOQQy/nWe7BUf8mc/ekcBTsbNHogJmKn b66/lIQYmkGaxHRbI+RtPepBWKdwhHkNWKeTiVYccjGDBBHuQjYXFlZ6qA4QxI3LkXmT6SvC7GrbG IMm/UQI3ghZgni8I6Aj2nJbd8YTUmQFEW4F0y+Hr/s020RKQhmjCIxbv0yIeVycF34BbDO9BFbdkN Xkqx/5gtz9Q1vxMS7+FcN+XcPdXI4ORi1cfGSLU1x+IyfCz5KJBYa8ZO4QkES5vzPnn3W8/n40PJD 9422efteGpBoGSIxZzZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgq3-008hZc-KX; Thu, 04 Aug 2022 19:49:01 +0000 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgoo-008gwv-Qi for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 19:47:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jfewAYCAGP1XtoPGIHjc09mA33z45CKF4E3WmAlQRATHGLFXP0fS2tFHaJxAQuNDfdjd0frqQTWOgzzpIDsqvPaIG901HLqKudEetuQjBbK4hrT5mljZFk26qF2P3VoTLAEPxSOVZB+VJ0p1ZKORfdV0SqgbiwxB7nhVS8kmPxITlDcjQyOqyWsuRZO9rmBBoUKgAz9mNtizB0HsduPz1LqCOZ8J2z8mKPjRmDPsEuw69XoOXZtZWOOTFOPKx5ikzF0k7o1sSvwalyt2LUImIK/GppGVPu27/vFBm7uipqEXa1D+cPBz5fRKCMQZkeIollpAFXUPR37TyGc/NghJzg== 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=Yg1Ggq3xdvIUN+I6gcZ2KQhsujZuotG1HTSN9jLdI/g=; b=L8x79WtV9/TnsfzU+jceFevXWTGYdIM6fPkBZyw26fLNrv2MLG7K9rpA74rB1zYL0a0S4MP8MuKtVS2ZKmRKAGBaTN6sxcZ3++7Dpkhwee7TankaCFsR8vw7QjSHc0oB7ZDpdi9oWi80sNhZ4LqBbWwa5xSqFuC1bOnPA+PAdBRMzXPMjo+U3PhVkGXEv77Uc3WDCHP6jAnRCXRrUfDZsrzqK0pq1ajBz33xn+mfqUMS+QagQ1r6TeIlNOsyPieFgCLVxNJOymrht69jkPfQiOMgBqUQ0KyhUL58NgyNIlBelOvaWh2/L90ormzI3NUi3feen+Vta9AZpYvsL3qeEg== 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=Yg1Ggq3xdvIUN+I6gcZ2KQhsujZuotG1HTSN9jLdI/g=; b=mQFS1Ve/e2RBNTrpL+sBflSr+HNzjhXqy4lq80EdRI2+geBCe+L6bjr2PjJd1B+VhYNI1dYVEaR6b3y/xKxcCYUSpzi6xYWUv5R45CcMUfAC0hafIYK/SCoGQa5UATZXwcU44mgrp0lHQNABU/lzrIqrDu2XMcMsBwXY+u0MMILPzpCYMMaZjH7whIIGauK+v7PzfpON9cMhD1jRw4UOhJjqS3bJJ27F0UBlFIWjuQJcx3QeWcqBF8fVUNhxFlC3xEPXNNPV6BLhun3/fmPXuhHky1qeeVJjIyC+jEBn/v5OykZxVbDcIvYFoSL7z06LrThX491ffX8fTpNyWBP4kw== 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 HE1PR0301MB2297.eurprd03.prod.outlook.com (2603:10a6:3:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 19:47:31 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 19:47:31 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: "linuxppc-dev @ lists . ozlabs . org" , linux-kernel@vger.kernel.org, Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , Russell King , Sean Anderson Subject: [PATCH net-next v4 4/8] net: fman: memac: Use lynx pcs driver Date: Thu, 4 Aug 2022 15:47:01 -0400 Message-Id: <20220804194705.459670-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804194705.459670-1-sean.anderson@seco.com> References: <20220804194705.459670-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::17) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0acc0832-e023-4bf7-2e2a-08da76522b17 X-MS-TrafficTypeDiagnostic: HE1PR0301MB2297:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2KXwR8WLoS1mJ6eKHS+DchGWilhcA+MeAiIm3M06jRzdPdTjoeHOUpsYqyj9DegTf/nxpo9M2KlxngiOg0csFRdeVpp4Iv3cmr3pffCRY/GP9fNflM/kk7qJPSFBvnpeALrWD2PQ5YpopkbwJKKGk0aK3HhoeAzLuXISiX2k7fmWBkm2vxsPRQaYYPo4g9co/bFPwajGobFrUbyyaS5h2i9gMdr53IlEezsCx0bFRCVPJiZZ9qNx+GliiksYWnr9U0yl8tqMQ2DO0eZHMDP/rRxe4EZVb3bUT5H33PftRTbOb5CHs2ulePmsrprMXW7cb7kY0Xo4C1QtFNiecAXPp2bPY8FHP2EN+/Vyv/5xLos6/TGlOCwGA62LUS0THNgcnNgK2jxTfDl+199GB/hYlikgGxtLru+T4WEi1IiEBYHV80fhDIaW++nelLg5/LtsBa2gIvrf1biD0aZitJOEGIYNS/tFLEzh5jy7iMVWtNFN5GYw/h6pQ3HBRXX4Acd2QfEC2NhLFPa2vu60DWJpit3L29ySLKWq/ifetMCI7eR7j5jb9HvTmzxDMnsrcs1tng6Iu9rV+CgotqCHgVSBZGZ8hIdkuOhWGniOz/t8RuXbalQ5lP9AMO5wyQsKmfgbc1vCDhhppk1sSfpVtuVIWffMNNI6EdtRNWlFm8ZoHYLMTkAO+BWNBI94fB9i811GVXvrnhTP179oEzeQrCX+Bo50lMrKAnHL/tU87FCgy08oKgavFUusp0O2opemsBaB632wXLnmVJ4rzNqI0ZmszzFRzqHkOiJGI64pc7a2fDJH4G6/JisDLvMvr1vgXb4B 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:(13230016)(39850400004)(366004)(346002)(376002)(136003)(396003)(6486002)(478600001)(186003)(1076003)(26005)(107886003)(30864003)(7416002)(6506007)(6666004)(2906002)(6512007)(8936002)(83380400001)(44832011)(41300700001)(38350700002)(110136005)(38100700002)(86362001)(316002)(5660300002)(54906003)(8676002)(36756003)(66946007)(66556008)(4326008)(2616005)(66476007)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qDcFuIfM++RY+mYuDuTJjZmi//SC+p/8d8Mei+Yk3Ee3jM2uxcg1I36TdLGM/Rz78+Xn2JLJmAvoWhb4oJ6mzLCNxW4VZit0pWdFc8A23b4QWSjg72yTSfkSdKuk33kiM0GyNx58xzL3qrrIMAjyI+VQxbWM3pBbt9aHCezRHKsI9wopSWVKBtmMVU9e7ryB2wteO2GWOddr7mIlLEDnjuEUWhozjI2uLFQlG4gQv4XN4hF/fncacJ38RwzYaZX2s3dAMGnZj0BCgITwyEPgEHLUBZo69UVeVKAltZJR5nBMhccDh47Gn9AhNU9/aqh9M7NTd4DeYvWmOTwJFAFZ9/cfM/eW8oCtvPmDX2NIQ59BbtaLuMGptyqugMldX8pCEJ6YKNjZb2q5itxy6CiKsvXEzucnVHVqjFxVQgGymvKZxT5HrEzxpfFDCnOVkrbLDWrPe1tQ4FKBH37IJY8rz6mNKYI86BMyhM+OstGlUKBwPFfIDMohQFZj7tyi+tIcRM24gVgC9jNhgk0BtJ31+uin1TR0ARUES93Ed7/T+BzzpN3WDCZL80wVOvDCazMrJA3DOQO6IVwGDt6wAkK4GatxJXgWZAJD9LvvFQAHsLky/GIsnWc9Ie+fIzRPBGWDFf/LHnWNZ5YC9ONGQ6FkpOrdD+gGOxCZ2Qze2l4pt27LoSBvbTuZF+J9ZzClXGNgyYNXX5T/OJfPG+sLY2fpKYD3QtwurHd9pbTLGKZnZy7OQBdoxraTYjAFXs1EkViW6eKGwoQE9fcEL1V6Otd+g/ZPY8X9FMxg+9kRVS9jxX/PqGZwKOvwGHNzY2k678+3//n9QZh4TDAyJICHbFEESppYbALVEpjhdXl2yNl01HDEXPzFjoUwSzS681KN74t8XAFS7HvPGwErl3UiZ3KJbY+ziMOfvPmALDJvkX5ImwLNNUFghJFKUYfe4zMh5n4ID9FVbd3NtTCbLUA5Y9FGuW18ojNaqdMJB9awB6lBihopVFfoyPxMTb8IGj94K8H9jJxIUPb31pXVRODNaQO1Ac/bv+wcIuthXokZHKA9Myz2yWYQHUDl1MJGMhjzsQGqi3RlxvyjnWvjwlFhDQSkow+VnLkNMD4kipUS9aew3SlI+g1DOvD1tBCvf7v8kKnshWbMc9nUBdxL3BWpj2qQYEyXDEZFYSiIoeejDOrfg6QesoCBsvYQuY+6tL1r5r5g2u9XoGsWSwULREXdPcSHIiJNgmnK6OjPhA+Kqw1YMjemztNCFuikESKtr3jyFTs6muxA1dh0+Lt9MkPTBWMS5nM6cOGZOss76s4ujIGAf9xpYUZkUFMO9WRFs8jKa3t5Ie2SZxA7gHjPvzX85TgvY0TLc7bOFXn6tOHvZIXA6TDenfHErcRrxpqGFcMW02++62BO5kRvcM6Fc4NdhUFS23iutaXP909F1SEUI5hLI0q+pIMlSKUbP3ctEX2XbxESIy3Sx8hxAi4tYA3kf8jWx4HJWlUch695V0dFXLGE0px3R491z+vyzMBesjaP0/71NiXvIne1LZBNGYo+l1QzVtJsBgDYClPw4vAuTpAxJjQFHWtvbrKkrb+cM5kSLXvmGMK2WWdDHywtTAhButrHmA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0acc0832-e023-4bf7-2e2a-08da76522b17 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 19:47:31.0712 (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: 0H2TNVwy4oPl8+ulzh8uvId9MozmI75axrvmOSh1IrkLzth141iQ0FzL4sGZcJM4XMaP7Q12XTNZeP/1GIOm6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_124742_918823_B8C7990C X-CRM114-Status: GOOD ( 22.44 ) 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 Although not stated in the datasheet, as far as I can tell PCS for mEMACs is a "Lynx." By reusing the existing driver, we can remove the PCS management code from the memac driver. This requires calling some PCS functions manually which phylink would usually do for us, but we will let it do that soon. One problem is that we don't actually have a PCS for QSGMII. We pretend that each mEMAC's MDIO bus has four QSGMII PCSs, but this is not the case. Only the "base" mEMAC's MDIO bus has the four QSGMII PCSs. This is not an issue yet, because we never get the PCS state. However, it will be once the conversion to phylink is complete, since the links will appear to never come up. To get around this, we allow specifying multiple PCSs in pcsphy. This breaks backwards compatibility with old device trees, but only for QSGMII. IMO this is the only reasonable way to figure out what the actual QSGMII PCS is. Additionally, we now also support a separate XFI PCS. This can allow the SerDes driver to set different addresses for the SGMII and XFI PCSs so they can be accessed at the same time. Signed-off-by: Sean Anderson --- (no changes since v3) Changes in v3: - Put the PCS mdiodev only after we are done with it (since the PCS does not perform a get itself). Changes in v2: - Move PCS_LYNX dependency to fman Kconfig drivers/net/ethernet/freescale/fman/Kconfig | 3 + .../net/ethernet/freescale/fman/fman_memac.c | 257 +++++++----------- 2 files changed, 104 insertions(+), 156 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 48bf8088795d..8f5637db41dd 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -4,6 +4,9 @@ config FSL_FMAN depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST select GENERIC_ALLOCATOR select PHYLIB + select PHYLINK + select PCS + select PCS_LYNX select CRC32 default n help diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 2886f86e45ba..23794e8d43be 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -11,43 +11,12 @@ #include #include +#include #include #include #include #include -/* PCS registers */ -#define MDIO_SGMII_CR 0x00 -#define MDIO_SGMII_DEV_ABIL_SGMII 0x04 -#define MDIO_SGMII_LINK_TMR_L 0x12 -#define MDIO_SGMII_LINK_TMR_H 0x13 -#define MDIO_SGMII_IF_MODE 0x14 - -/* SGMII Control defines */ -#define SGMII_CR_AN_EN 0x1000 -#define SGMII_CR_RESTART_AN 0x0200 -#define SGMII_CR_FD 0x0100 -#define SGMII_CR_SPEED_SEL1_1G 0x0040 -#define SGMII_CR_DEF_VAL (SGMII_CR_AN_EN | SGMII_CR_FD | \ - SGMII_CR_SPEED_SEL1_1G) - -/* SGMII Device Ability for SGMII defines */ -#define MDIO_SGMII_DEV_ABIL_SGMII_MODE 0x4001 -#define MDIO_SGMII_DEV_ABIL_BASEX_MODE 0x01A0 - -/* Link timer define */ -#define LINK_TMR_L 0xa120 -#define LINK_TMR_H 0x0007 -#define LINK_TMR_L_BASEX 0xaf08 -#define LINK_TMR_H_BASEX 0x002f - -/* SGMII IF Mode defines */ -#define IF_MODE_USE_SGMII_AN 0x0002 -#define IF_MODE_SGMII_EN 0x0001 -#define IF_MODE_SGMII_SPEED_100M 0x0004 -#define IF_MODE_SGMII_SPEED_1G 0x0008 -#define IF_MODE_SGMII_DUPLEX_HALF 0x0010 - /* Num of additional exact match MAC adr regs */ #define MEMAC_NUM_OF_PADDRS 7 @@ -326,7 +295,9 @@ struct fman_mac { struct fman_rev_info fm_rev_info; bool basex_if; struct phy *serdes; - struct phy_device *pcsphy; + struct phylink_pcs *sgmii_pcs; + struct phylink_pcs *qsgmii_pcs; + struct phylink_pcs *xfi_pcs; bool allmulti_enabled; }; @@ -487,91 +458,22 @@ static u32 get_mac_addr_hash_code(u64 eth_addr) return xor_val; } -static void setup_sgmii_internal_phy(struct fman_mac *memac, - struct fixed_phy_status *fixed_link) +static void setup_sgmii_internal(struct fman_mac *memac, + struct phylink_pcs *pcs, + struct fixed_phy_status *fixed_link) { - u16 tmp_reg16; - - if (WARN_ON(!memac->pcsphy)) - return; - - /* SGMII mode */ - tmp_reg16 = IF_MODE_SGMII_EN; - if (!fixed_link) - /* AN enable */ - tmp_reg16 |= IF_MODE_USE_SGMII_AN; - else { - switch (fixed_link->speed) { - case 10: - /* For 10M: IF_MODE[SPEED_10M] = 0 */ - break; - case 100: - tmp_reg16 |= IF_MODE_SGMII_SPEED_100M; - break; - case 1000: - default: - tmp_reg16 |= IF_MODE_SGMII_SPEED_1G; - break; - } - if (!fixed_link->duplex) - tmp_reg16 |= IF_MODE_SGMII_DUPLEX_HALF; - } - phy_write(memac->pcsphy, MDIO_SGMII_IF_MODE, tmp_reg16); - - /* Device ability according to SGMII specification */ - tmp_reg16 = MDIO_SGMII_DEV_ABIL_SGMII_MODE; - phy_write(memac->pcsphy, MDIO_SGMII_DEV_ABIL_SGMII, tmp_reg16); - - /* Adjust link timer for SGMII - - * According to Cisco SGMII specification the timer should be 1.6 ms. - * The link_timer register is configured in units of the clock. - * - When running as 1G SGMII, Serdes clock is 125 MHz, so - * unit = 1 / (125*10^6 Hz) = 8 ns. - * 1.6 ms in units of 8 ns = 1.6ms / 8ns = 2*10^5 = 0x30d40 - * - When running as 2.5G SGMII, Serdes clock is 312.5 MHz, so - * unit = 1 / (312.5*10^6 Hz) = 3.2 ns. - * 1.6 ms in units of 3.2 ns = 1.6ms / 3.2ns = 5*10^5 = 0x7a120. - * Since link_timer value of 1G SGMII will be too short for 2.5 SGMII, - * we always set up here a value of 2.5 SGMII. - */ - phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_H, LINK_TMR_H); - phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_L, LINK_TMR_L); - - if (!fixed_link) - /* Restart AN */ - tmp_reg16 = SGMII_CR_DEF_VAL | SGMII_CR_RESTART_AN; + __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); + phy_interface_t iface = memac->basex_if ? PHY_INTERFACE_MODE_1000BASEX : + PHY_INTERFACE_MODE_SGMII; + unsigned int mode = fixed_link ? MLO_AN_FIXED : MLO_AN_INBAND; + + linkmode_set_pause(advertising, true, true); + pcs->ops->pcs_config(pcs, mode, iface, advertising, true); + if (fixed_link) + pcs->ops->pcs_link_up(pcs, mode, iface, fixed_link->speed, + fixed_link->duplex); else - /* AN disabled */ - tmp_reg16 = SGMII_CR_DEF_VAL & ~SGMII_CR_AN_EN; - phy_write(memac->pcsphy, 0x0, tmp_reg16); -} - -static void setup_sgmii_internal_phy_base_x(struct fman_mac *memac) -{ - u16 tmp_reg16; - - /* AN Device capability */ - tmp_reg16 = MDIO_SGMII_DEV_ABIL_BASEX_MODE; - phy_write(memac->pcsphy, MDIO_SGMII_DEV_ABIL_SGMII, tmp_reg16); - - /* Adjust link timer for SGMII - - * For Serdes 1000BaseX auto-negotiation the timer should be 10 ms. - * The link_timer register is configured in units of the clock. - * - When running as 1G SGMII, Serdes clock is 125 MHz, so - * unit = 1 / (125*10^6 Hz) = 8 ns. - * 10 ms in units of 8 ns = 10ms / 8ns = 1250000 = 0x1312d0 - * - When running as 2.5G SGMII, Serdes clock is 312.5 MHz, so - * unit = 1 / (312.5*10^6 Hz) = 3.2 ns. - * 10 ms in units of 3.2 ns = 10ms / 3.2ns = 3125000 = 0x2faf08. - * Since link_timer value of 1G SGMII will be too short for 2.5 SGMII, - * we always set up here a value of 2.5 SGMII. - */ - phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_H, LINK_TMR_H_BASEX); - phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_L, LINK_TMR_L_BASEX); - - /* Restart AN */ - tmp_reg16 = SGMII_CR_DEF_VAL | SGMII_CR_RESTART_AN; - phy_write(memac->pcsphy, 0x0, tmp_reg16); + pcs->ops->pcs_an_restart(pcs); } static int check_init_parameters(struct fman_mac *memac) @@ -983,7 +885,6 @@ static int memac_set_exception(struct fman_mac *memac, static int memac_init(struct fman_mac *memac) { struct memac_cfg *memac_drv_param; - u8 i; enet_addr_t eth_addr; bool slow_10g_if = false; struct fixed_phy_status *fixed_link; @@ -1036,32 +937,10 @@ static int memac_init(struct fman_mac *memac) iowrite32be(reg32, &memac->regs->command_config); } - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII) { - /* Configure internal SGMII PHY */ - if (memac->basex_if) - setup_sgmii_internal_phy_base_x(memac); - else - setup_sgmii_internal_phy(memac, fixed_link); - } else if (memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { - /* Configure 4 internal SGMII PHYs */ - for (i = 0; i < 4; i++) { - u8 qsmgii_phy_addr, phy_addr; - /* QSGMII PHY address occupies 3 upper bits of 5-bit - * phy_address; the lower 2 bits are used to extend - * register address space and access each one of 4 - * ports inside QSGMII. - */ - phy_addr = memac->pcsphy->mdio.addr; - qsmgii_phy_addr = (u8)((phy_addr << 2) | i); - memac->pcsphy->mdio.addr = qsmgii_phy_addr; - if (memac->basex_if) - setup_sgmii_internal_phy_base_x(memac); - else - setup_sgmii_internal_phy(memac, fixed_link); - - memac->pcsphy->mdio.addr = phy_addr; - } - } + if (memac->phy_if == PHY_INTERFACE_MODE_SGMII) + setup_sgmii_internal(memac, memac->sgmii_pcs, fixed_link); + else if (memac->phy_if == PHY_INTERFACE_MODE_QSGMII) + setup_sgmii_internal(memac, memac->qsgmii_pcs, fixed_link); /* Max Frame Length */ err = fman_set_mac_max_frame(memac->fm, memac->mac_id, @@ -1097,12 +976,25 @@ static int memac_init(struct fman_mac *memac) return 0; } +static void pcs_put(struct phylink_pcs *pcs) +{ + struct mdio_device *mdiodev; + + if (!pcs) + return; + + mdiodev = lynx_get_mdio_device(pcs); + lynx_pcs_destroy(pcs); + mdio_device_free(mdiodev); +} + static int memac_free(struct fman_mac *memac) { free_init_resources(memac); - if (memac->pcsphy) - put_device(&memac->pcsphy->mdio.dev); + pcs_put(memac->sgmii_pcs); + pcs_put(memac->qsgmii_pcs); + pcs_put(memac->xfi_pcs); kfree(memac->memac_drv_param); kfree(memac); @@ -1153,12 +1045,31 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev, return memac; } +static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node, + int index) +{ + struct device_node *node; + struct mdio_device *mdiodev = NULL; + struct phylink_pcs *pcs; + + node = of_parse_phandle(mac_node, "pcsphy-handle", index); + if (node && of_device_is_available(node)) + mdiodev = of_mdio_find_device(node); + of_node_put(node); + + if (!mdiodev) + return ERR_PTR(-EPROBE_DEFER); + + pcs = lynx_pcs_create(mdiodev); + return pcs; +} + int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node, struct fman_mac_params *params) { int err; - struct device_node *phy_node; + struct phylink_pcs *pcs; struct fixed_phy_status *fixed_link; struct fman_mac *memac; @@ -1188,23 +1099,57 @@ int memac_initialization(struct mac_device *mac_dev, memac = mac_dev->fman_mac; memac->memac_drv_param->max_frame_length = fman_get_max_frm(); memac->memac_drv_param->reset_on_init = true; - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || - memac->phy_if == PHY_INTERFACE_MODE_QSGMII) { - phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0); - if (!phy_node) { - pr_err("PCS PHY node is not available\n"); - err = -EINVAL; + + err = of_property_match_string(mac_node, "pcs-names", "xfi"); + if (err >= 0) { + memac->xfi_pcs = memac_pcs_create(mac_node, err); + if (IS_ERR(memac->xfi_pcs)) { + err = PTR_ERR(memac->xfi_pcs); + dev_err_probe(mac_dev->dev, err, "missing xfi pcs\n"); goto _return_fm_mac_free; } + } else if (err != -EINVAL && err != -ENODATA) { + goto _return_fm_mac_free; + } - memac->pcsphy = of_phy_find_device(phy_node); - if (!memac->pcsphy) { - pr_err("of_phy_find_device (PCS PHY) failed\n"); - err = -EINVAL; + err = of_property_match_string(mac_node, "pcs-names", "qsgmii"); + if (err >= 0) { + memac->qsgmii_pcs = memac_pcs_create(mac_node, err); + if (IS_ERR(memac->qsgmii_pcs)) { + err = PTR_ERR(memac->qsgmii_pcs); + dev_err_probe(mac_dev->dev, err, "missing qsgmii pcs\n"); goto _return_fm_mac_free; } + } else if (err != -EINVAL && err != -ENODATA) { + goto _return_fm_mac_free; + } + + /* For compatibility, if pcs-names is missing, we assume this phy is + * the first one in pcsphy-handle + */ + err = of_property_match_string(mac_node, "pcs-names", "sgmii"); + if (err == -EINVAL) + pcs = memac_pcs_create(mac_node, 0); + else if (err < 0) + goto _return_fm_mac_free; + else + pcs = memac_pcs_create(mac_node, err); + + if (!pcs) { + dev_err(mac_dev->dev, "missing pcs\n"); + err = -ENOENT; + goto _return_fm_mac_free; } + /* If err is set here, it means that pcs-names was missing above (and + * therefore that xfi_pcs cannot be set). If we are defaulting to + * XGMII, assume this is for XFI. Otherwise, assume it is for SGMII. + */ + if (err && mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) + memac->xfi_pcs = pcs; + else + memac->sgmii_pcs = pcs; + memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); err = PTR_ERR(memac->serdes); if (err == -ENODEV || err == -ENOSYS) { From patchwork Thu Aug 4 19:47:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936674 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 53105C19F2A for ; Thu, 4 Aug 2022 19:51:39 +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:References:In-Reply-To: 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: List-Owner; bh=PPPeh1sDEnJzpRUtaynM5GonhP+BBwyH8qcU1rGt3eA=; b=mSQQGm1t8P8si7 2xBzeFOXHVkiGWxU/SR/3Pk960GRZ1mYFEkEZk51dVhxqPnEkS3tx8KH7CqQlKMRFLZFvHOIyf3zV o9+CvYEZbvuPRniVFopzTOcS4jxEEaZIxj7QsitkSJOSmJ8dVbynAM80gMZq8/6jPuENeensY3uWh /Iie1aCLrOqH/i1pG1I1t1I/9+6dyOLru/bRnWaomv88JTjusELaLuxZke9aGUR0AAiXZMW5jD/Vo PwYlyC1FNJqeTYIYva49h4/AaRT1VfDVZJSbVz1dzunGqtRKJ2xhBJuf1gsDjavMuUGM6nyvaxNZ+ 7Xcd2cTq/P2X5fU3LBNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgqs-008hyz-2i; Thu, 04 Aug 2022 19:49:51 +0000 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgor-008gwv-IO for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 19:47:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RRxGEn+M8APac1XJOef1dHPF3Mik2zagtfKpo6zXUy9vMDm4zfbypYpSaTdc4IRFuGfkhsKUa/5VkPyWGgYZEB+daFk5v/Vcf28janHVivV2tNhtwcVsBG5IMc4MZrWha/e7o9w8OONtvgSHUxnb5dWY/e0v6xHvW0yoY1xCfUoBkYWL0eBuWYSeGupIOt97rMM6FEDHlZ9bDspLRZvCYxLxMgoTJxmefOb/jCIgIjxqdwAiMHFD3thLyiIJxEIqtDvZt+prfBzKv4ZrYxLj7alsWbeGD+mlQmO/+n+nBfu4wwtsvR09b/6rrXvRER9GiV3WZh3PafwJS5WrZlivcA== 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=cSxdjttAU4cpzuLOwbWJvy5OFKVsN0jX049XNeVbxd4=; b=Mf6S/Aw9ScGgw/QlIA0PjTc1qXICgchZ7HDJw3ys479kFjgRsm4KRoPrVy2B9bpTd/z397EEW9DeVRxg4CR+SvJMaTTfxmUC1iMNiYK6HU9HTb4iIW9m3bYVsfuPsu95EMDrtzwHQ/ebSBCmcwqvj4Vjk5WzQOWpaT6RTE9qOkCnHik80qPjElAmp9f8kioLqaUw7w614sYiK9NhvzqdbCTEFH/mRsnQ7yeMlhb9dYoPZbCGXsUTg2Qxnb+rdBEJXOMtGV3l4yIc5PvIkT6mdAiEB1TxkLJP9LFDNjuoNmMSyifmHGf4JlNgQkh6eou7AwvICCmABRVdIhI6bt36gQ== 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=cSxdjttAU4cpzuLOwbWJvy5OFKVsN0jX049XNeVbxd4=; b=UrOj0nAXkpId8mbUIMFfAZx8JdiR7wJxrC4LjF1pmWjc1MjGbhM9l1zALeh2c4IE9tV9JFufNb+5pD1dQTpt8PBcq5AIlv0eQz10+39NL03LqyZL206icv4a0O8+nIeF5KvuMbEJjG/ra6cqjQP5IBhZxypI0VaQofZk9UA11J/U32fwfH2KX5EjMTuErfMsyqA8udPyvUV5KGHyXqsKbWcj0wTRj6YlMCmoIJeEQl1tLNHqxd0eRdsgKky4BJMNOcv3e7xTcx0PDqVRWU+eSxnETfOe9p3/+GmC81cGOOD8Q97Ybj8ubABsa5NIDzPyv1dfyJ/RiRxipDCDqWg4dQ== 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 HE1PR0301MB2297.eurprd03.prod.outlook.com (2603:10a6:3:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 19:47:33 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 19:47:32 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: "linuxppc-dev @ lists . ozlabs . org" , linux-kernel@vger.kernel.org, Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , Russell King , Sean Anderson Subject: [PATCH net-next v4 5/8] net: dpaa: Convert to phylink Date: Thu, 4 Aug 2022 15:47:02 -0400 Message-Id: <20220804194705.459670-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804194705.459670-1-sean.anderson@seco.com> References: <20220804194705.459670-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::17) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e2a68e9-3a00-46e8-32f4-08da76522c03 X-MS-TrafficTypeDiagnostic: HE1PR0301MB2297:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wY4DU0U/GQeyhzKfuCd4LnpOB2M+l61amfZuwLvz1Fhmd3mhxj517NGAF1eP+yu3hXiZhecUyes79ieYBF9QOFkPSip02R81KIfvv2aC9mrSQm4aawyHG8XwQ6vmD6Q51X0m8fvTWnSnB6CjGRLabuEeNN2mzTWl/Melaodk0nhl+oySY1/Vv5TOmKyWfSCx7cbdC/JtJhOoo5LZsHNoxo0uXIhIXaFEPvUzCbc2F7m33kCC07cyrropplcmxGVrfCMF+dM76yBl1k3tjLpyrcrn4gu+U3ArTRXN3x3qLWmYo1SSmQq+LjDYi82AJia3uzD48maq4L23ejjF0SLoG8mBePCEvxsGAPXWMKzFRWcjNTSROyPMwHXHF2iDOWU7iT56iz9L4+imK+rjihnsNDn3umBN0ydCinAzzk/SgMbcjsyU1rdyEB+rmbeXA5TGw9A4ChfOInZ8IMEVjx2Xd6ws9FCGzSGmBgs7o0XcqTzHeAh6VkiAljdrcV1sw2Bk55YMRNMFMe7NphC2NHESyiCXpWn128Snv/JBS4qBRi3ZsRYlvs9Lxyvu+0PetAyYsHo6ATZXZHOJ2QnECf0Bg6liJDch/IoOxRSDla4nfm0hReiTsUvVlo7y+96S/sZXY+ac2cNtcZqX0+F+HyQW11z9m2i4xvvvSvJC/aX850dC+rMk9L+pmZqEsZ8+vhn/V8KvrlNNduOn71uyyIjyM2+najxMNSGbHUuoLARFwYH2tNjbY02PfY55GWa0Kz++17u9xmtBJg5yyro7C0KitbnEClUa8gGdqUr6a9eZyh7I++78f7r2yVkS0DZr9J/OAWjPdHkWwUmqpsyioOSIJg== 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:(13230016)(39850400004)(366004)(346002)(376002)(136003)(396003)(6486002)(478600001)(186003)(1076003)(26005)(107886003)(30864003)(7416002)(6506007)(6666004)(2906002)(6512007)(8936002)(83380400001)(44832011)(41300700001)(38350700002)(110136005)(38100700002)(86362001)(316002)(5660300002)(54906003)(8676002)(36756003)(66946007)(66556008)(4326008)(2616005)(66476007)(52116002)(559001)(579004)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t5a50FcLT/egL+0lR+Fkd3/MgNQJEYnlVeLKNuwl4T69v62jzJCnyi6Q978bnj+rKfOvcTcm6foBLDJs/XtaasJThAxkhcl7nuKbXROtv+Wg4TwcoEP9095jmrWBwC1R53ERuM6wqCbnTO3+W+vGzZmfCMoPztgfrRtic+iNN+rNRjUmExc2EbPRq0XAHz7hiYHN6JuPbsXIIbLICD1NEHZhdlYm72e8remaFZH2XaXv5vPaXzZPx+u1DXusaqEYG5/owMW59WN4O6YJ8t/wK7sV2hU7U881MaFycPjOWMfyPfvyI+AjmG14W/1WceYkWaZd6bWF8pSQtT+LoFvX+gVFepq0d85X0zYTW8H0ONwkCPFxm+p4kKmdlNXP+b/CFnra4aawlQ/uj3SEbSBxQwc+g6mDvNGxfOKrEgc2xV2GtasglnFpHiBpYUUA1vcoMBd8fiphU19y4qtvDSay1OG8ARUE3DQ1LNOzDFxw13sdIW4vP8hSm+y4pLlBqbJIEXgP6PCRobk+EE3vUxuDVAEzMGn+F5myyH2v734SeazcTWqJ+WQtA4DS1vuq0QSTqI4XbJbcdTYVM2xX4frSNr6P0y0bHq2HZc3p8yD1L8vjOtWIdO05KtcrGluZr1TmtnScUT4/J3S2LTk5j3SHHgtd09r2XTBQxAWgs03NdA2eps1phnhfuj7g7SfjHHSRltNiWsrBIL81fH1qthYSlk4Wpfxayq9qcgmzL4ZdIiZYanOJj06wmz7Od6l5eVVWK8iVkfJX+eAji62gdOoWtIwnqERjHfu63vY9z3+sKN/VZGWpCEDQLdVoTJ8g9SfTIDHcVuPXaepxoEVjMCpbUlbuFSiuKRmM2QKLF5ZuB5KJiN1VBfEKF3zrD14SHna5QAK7qODcAofr+H8MCHcu/q40CidpM2lloNGOumvgovuRfmDAdBP9nuSgY5/YPqaEjVIn3/8Pr44eE6cIgOkibMj0gPHvsH5bFqC7J/IFKgpVlkH0RE94ObRZZBS+HtInA2ymVTzR1lAZecJ0X0lVSnSREJcMIVCXBNJ+sh+BPlZyRs8n8swjzz8zt9zCdwXJhU8OVPZfYe5/32hOnhuiTNGe/iuvhVhp6Pc4lASYcG7RMtwYE5NMyZO6tWB6m3xNvOiFpYxv77j7NohtgRm+8k8ZtDgKrEoHLl7fQFPrS0cLQcg1fKKAisNiTsRNtixWy42aC58WBYgklstiBFjNkKoNyNOCP8Yt76c09wtAjAtfFHKZGPH3hBNXlP4OHdyvepuFsSj5srdBtnwks2U6mToAF4ni3iG66GOEqqCcB3k1uiJe0SK7v7DdwojWT3Wfr3RWGtb26aX5sbwv9osZ4P5PPFMU4b/MNmLe8RKtOwsdK6C9kCcDUhXhis2WuksfoflgfMypMUxslzCSXLm2fjQfp5umYjS4jTqsLmP+tCpGBkxBzY9d9PW+2xBN3wB1MINgAt4ck6N+awPMge1YvFluFNthMhmskhakOwu89SaB1oHEnbDiFJJA0eP6r4o3kjzSVMnT0y8C00oDDuRll29CxVYaQb8Z5Z3BuDtliJ/bqak9ylK07MLUsIiN8UXml2YfqQaRyFtG3I/0qn3RTA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e2a68e9-3a00-46e8-32f4-08da76522c03 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 19:47:32.7742 (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: IGBbgJox/MaIdwC8JPgbIbH3lHppkcW77oVJxMoUebew4fvuKOeXPSFMaepqKANPBsYsnwFGGPgiDrSlwYgQbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_124745_869118_D993A793 X-CRM114-Status: GOOD ( 28.82 ) 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 This converts DPAA to phylink. All macs are converted. This should work with no device tree modifications (including those made in this series), except for QSGMII (as noted previously). The mEMAC configuration is one of the tricker areas. I have tried to capture all the restrictions across the various models. Most of the time, we assume that if the serdes supports a mode or the phy-interface-mode specifies it, then we support it. The only place we can't do this is (RG)MII, since there's no serdes. In that case, we rely on a (new) devicetree property. There are also several cases where half-duplex is broken. Unfortunately, only a single compatible is used for the MAC, so we have to use the board compatible instead. The 10GEC conversion is very straightforward, since it only supports XAUI. There is generally nothing to configure. The dTSEC conversion is broadly similar to mEMAC, but is simpler because we don't support configuring the SerDes (though this can be easily added) and we don't have multiple PCSs. From what I can tell, there's nothing different in the driver or documentation between SGMII and 1000BASE-X except for the advertising. Similarly, I couldn't find anything about 2500BASE-X. In both cases, I treat them like SGMII. These modes aren't used by any in-tree boards. Similarly, despite being mentioned in the driver, I couldn't find any documented SoCs which supported QSGMII. I have left it unimplemented for now. 10GEC and dTSEC have not been tested at all. I would greatly appreciate if someone could try them out. Signed-off-by: Sean Anderson --- This has been tested on an LS1046ARDB. With managed=phy, I was unable to get the interfaces to come up at all, hence the default to in-band. (no changes since v3) Changes in v3: - Remove _return label from memac_initialization in favor of returning directly - Fix grabbing the default PCS not checking for -ENODATA from of_property_match_string - Set DTSEC_ECNTRL_R100M in dtsec_link_up instead of dtsec_mac_config - Remove rmii/mii properties Changes in v2: - Remove unused variable slow_10g_if - Restrict valid link modes based on the phy interface. This is easier to set up, and mostly captures what I intended to do the first time. We now have a custom validate which restricts half-duplex for some SoCs for RGMII, but generally just uses the default phylink validate. - Configure the SerDes in enable/disable - Properly implement all ethtool ops and ioctls. These were mostly stubbed out just enough to compile last time. - Convert 10GEC and dTSEC as well drivers/net/ethernet/freescale/dpaa/Kconfig | 4 +- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 89 +-- .../ethernet/freescale/dpaa/dpaa_ethtool.c | 90 +-- drivers/net/ethernet/freescale/fman/Kconfig | 1 - .../net/ethernet/freescale/fman/fman_dtsec.c | 459 +++++++------- .../net/ethernet/freescale/fman/fman_mac.h | 10 - .../net/ethernet/freescale/fman/fman_memac.c | 578 +++++++++--------- .../net/ethernet/freescale/fman/fman_tgec.c | 131 ++-- drivers/net/ethernet/freescale/fman/mac.c | 168 +---- drivers/net/ethernet/freescale/fman/mac.h | 23 +- 10 files changed, 629 insertions(+), 924 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig index 0e1439fd00bd..2b560661c82a 100644 --- a/drivers/net/ethernet/freescale/dpaa/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -2,8 +2,8 @@ menuconfig FSL_DPAA_ETH tristate "DPAA Ethernet" depends on FSL_DPAA && FSL_FMAN - select PHYLIB - select FIXED_PHY + select PHYLINK + select PCS_LYNX help Data Path Acceleration Architecture Ethernet driver, supporting the Freescale QorIQ chips. diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 0a180d17121c..262a2558353b 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -264,8 +264,19 @@ static int dpaa_netdev_init(struct net_device *net_dev, net_dev->needed_headroom = priv->tx_headroom; net_dev->watchdog_timeo = msecs_to_jiffies(tx_timeout); - mac_dev->net_dev = net_dev; + /* The rest of the config is filled in by the mac device already */ + mac_dev->phylink_config.dev = &net_dev->dev; + mac_dev->phylink_config.type = PHYLINK_NETDEV; mac_dev->update_speed = dpaa_eth_cgr_set_speed; + mac_dev->phylink = phylink_create(&mac_dev->phylink_config, + dev_fwnode(mac_dev->dev), + mac_dev->phy_if, + mac_dev->phylink_ops); + if (IS_ERR(mac_dev->phylink)) { + err = PTR_ERR(mac_dev->phylink); + dev_err_probe(dev, err, "Could not create phylink\n"); + return err; + } /* start without the RUNNING flag, phylib controls it later */ netif_carrier_off(net_dev); @@ -273,6 +284,7 @@ static int dpaa_netdev_init(struct net_device *net_dev, err = register_netdev(net_dev); if (err < 0) { dev_err(dev, "register_netdev() = %d\n", err); + phylink_destroy(mac_dev->phylink); return err; } @@ -294,8 +306,7 @@ static int dpaa_stop(struct net_device *net_dev) */ msleep(200); - if (mac_dev->phy_dev) - phy_stop(mac_dev->phy_dev); + phylink_stop(mac_dev->phylink); mac_dev->disable(mac_dev->fman_mac); for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { @@ -304,8 +315,7 @@ static int dpaa_stop(struct net_device *net_dev) err = error; } - if (net_dev->phydev) - phy_disconnect(net_dev->phydev); + phylink_disconnect_phy(mac_dev->phylink); net_dev->phydev = NULL; msleep(200); @@ -833,10 +843,10 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) /* Set different thresholds based on the configured MAC speed. * This may turn suboptimal if the MAC is reconfigured at another - * speed, so MACs must call dpaa_eth_cgr_set_speed in their adjust_link + * speed, so MACs must call dpaa_eth_cgr_set_speed in their link_up * callback. */ - if (priv->mac_dev->if_support & SUPPORTED_10000baseT_Full) + if (priv->mac_dev->phylink_config.mac_capabilities & MAC_10000FD) cs_th = DPAA_CS_THRESHOLD_10G; else cs_th = DPAA_CS_THRESHOLD_1G; @@ -865,7 +875,7 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv) static void dpaa_eth_cgr_set_speed(struct mac_device *mac_dev, int speed) { - struct net_device *net_dev = mac_dev->net_dev; + struct net_device *net_dev = to_net_dev(mac_dev->phylink_config.dev); struct dpaa_priv *priv = netdev_priv(net_dev); struct qm_mcc_initcgr opts = { }; u32 cs_th; @@ -2904,58 +2914,6 @@ static void dpaa_eth_napi_disable(struct dpaa_priv *priv) } } -static void dpaa_adjust_link(struct net_device *net_dev) -{ - struct mac_device *mac_dev; - struct dpaa_priv *priv; - - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - mac_dev->adjust_link(mac_dev); -} - -/* The Aquantia PHYs are capable of performing rate adaptation */ -#define PHY_VEND_AQUANTIA 0x03a1b400 -#define PHY_VEND_AQUANTIA2 0x31c31c00 - -static int dpaa_phy_init(struct net_device *net_dev) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; - struct mac_device *mac_dev; - struct phy_device *phy_dev; - struct dpaa_priv *priv; - u32 phy_vendor; - - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - - phy_dev = of_phy_connect(net_dev, mac_dev->phy_node, - &dpaa_adjust_link, 0, - mac_dev->phy_if); - if (!phy_dev) { - netif_err(priv, ifup, net_dev, "init_phy() failed\n"); - return -ENODEV; - } - - phy_vendor = phy_dev->drv->phy_id & GENMASK(31, 10); - /* Unless the PHY is capable of rate adaptation */ - if (mac_dev->phy_if != PHY_INTERFACE_MODE_XGMII || - (phy_vendor != PHY_VEND_AQUANTIA && - phy_vendor != PHY_VEND_AQUANTIA2)) { - /* remove any features not supported by the controller */ - ethtool_convert_legacy_u32_to_link_mode(mask, - mac_dev->if_support); - linkmode_and(phy_dev->supported, phy_dev->supported, mask); - } - - phy_support_asym_pause(phy_dev); - - mac_dev->phy_dev = phy_dev; - net_dev->phydev = phy_dev; - - return 0; -} - static int dpaa_open(struct net_device *net_dev) { struct mac_device *mac_dev; @@ -2966,7 +2924,8 @@ static int dpaa_open(struct net_device *net_dev) mac_dev = priv->mac_dev; dpaa_eth_napi_enable(priv); - err = dpaa_phy_init(net_dev); + err = phylink_of_phy_connect(mac_dev->phylink, + mac_dev->dev->of_node, 0); if (err) goto phy_init_failed; @@ -2981,7 +2940,7 @@ static int dpaa_open(struct net_device *net_dev) netif_err(priv, ifup, net_dev, "mac_dev->enable() = %d\n", err); goto mac_start_failed; } - phy_start(priv->mac_dev->phy_dev); + phylink_start(mac_dev->phylink); netif_tx_start_all_queues(net_dev); @@ -2990,6 +2949,7 @@ static int dpaa_open(struct net_device *net_dev) mac_start_failed: for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) fman_port_disable(mac_dev->port[i]); + phylink_disconnect_phy(mac_dev->phylink); phy_init_failed: dpaa_eth_napi_disable(priv); @@ -3145,10 +3105,12 @@ static int dpaa_ts_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int dpaa_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd) { int ret = -EINVAL; + struct dpaa_priv *priv = netdev_priv(net_dev); if (cmd == SIOCGMIIREG) { if (net_dev->phydev) - return phy_mii_ioctl(net_dev->phydev, rq, cmd); + return phylink_mii_ioctl(priv->mac_dev->phylink, rq, + cmd); } if (cmd == SIOCSHWTSTAMP) @@ -3552,6 +3514,7 @@ static int dpaa_remove(struct platform_device *pdev) dev_set_drvdata(dev, NULL); unregister_netdev(net_dev); + phylink_destroy(priv->mac_dev->phylink); err = dpaa_fq_free(dev, &priv->dpaa_fq_list); diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c index 73f07881ce2d..7463ec7f0105 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c @@ -54,27 +54,19 @@ static char dpaa_stats_global[][ETH_GSTRING_LEN] = { static int dpaa_get_link_ksettings(struct net_device *net_dev, struct ethtool_link_ksettings *cmd) { - if (!net_dev->phydev) - return 0; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - phy_ethtool_ksettings_get(net_dev->phydev, cmd); - - return 0; + return phylink_ethtool_ksettings_get(mac_dev->phylink, cmd); } static int dpaa_set_link_ksettings(struct net_device *net_dev, const struct ethtool_link_ksettings *cmd) { - int err; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - if (!net_dev->phydev) - return -ENODEV; - - err = phy_ethtool_ksettings_set(net_dev->phydev, cmd); - if (err < 0) - netdev_err(net_dev, "phy_ethtool_ksettings_set() = %d\n", err); - - return err; + return phylink_ethtool_ksettings_set(mac_dev->phylink, cmd); } static void dpaa_get_drvinfo(struct net_device *net_dev, @@ -99,80 +91,28 @@ static void dpaa_set_msglevel(struct net_device *net_dev, static int dpaa_nway_reset(struct net_device *net_dev) { - int err; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - if (!net_dev->phydev) - return -ENODEV; - - err = 0; - if (net_dev->phydev->autoneg) { - err = phy_start_aneg(net_dev->phydev); - if (err < 0) - netdev_err(net_dev, "phy_start_aneg() = %d\n", - err); - } - - return err; + return phylink_ethtool_nway_reset(mac_dev->phylink); } static void dpaa_get_pauseparam(struct net_device *net_dev, struct ethtool_pauseparam *epause) { - struct mac_device *mac_dev; - struct dpaa_priv *priv; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - - if (!net_dev->phydev) - return; - - epause->autoneg = mac_dev->autoneg_pause; - epause->rx_pause = mac_dev->rx_pause_active; - epause->tx_pause = mac_dev->tx_pause_active; + phylink_ethtool_get_pauseparam(mac_dev->phylink, epause); } static int dpaa_set_pauseparam(struct net_device *net_dev, struct ethtool_pauseparam *epause) { - struct mac_device *mac_dev; - struct phy_device *phydev; - bool rx_pause, tx_pause; - struct dpaa_priv *priv; - int err; + struct dpaa_priv *priv = netdev_priv(net_dev); + struct mac_device *mac_dev = priv->mac_dev; - priv = netdev_priv(net_dev); - mac_dev = priv->mac_dev; - - phydev = net_dev->phydev; - if (!phydev) { - netdev_err(net_dev, "phy device not initialized\n"); - return -ENODEV; - } - - if (!phy_validate_pause(phydev, epause)) - return -EINVAL; - - /* The MAC should know how to handle PAUSE frame autonegotiation before - * adjust_link is triggered by a forced renegotiation of sym/asym PAUSE - * settings. - */ - mac_dev->autoneg_pause = !!epause->autoneg; - mac_dev->rx_pause_req = !!epause->rx_pause; - mac_dev->tx_pause_req = !!epause->tx_pause; - - /* Determine the sym/asym advertised PAUSE capabilities from the desired - * rx/tx pause settings. - */ - - phy_set_asym_pause(phydev, epause->rx_pause, epause->tx_pause); - - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - netdev_err(net_dev, "set_mac_active_pause() = %d\n", err); - - return err; + return phylink_ethtool_set_pauseparam(mac_dev->phylink, epause); } static int dpaa_get_sset_count(struct net_device *net_dev, int type) diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8f5637db41dd..e76a3d262b2b 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -3,7 +3,6 @@ config FSL_FMAN tristate "FMan support" depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST select GENERIC_ALLOCATOR - select PHYLIB select PHYLINK select PCS select PCS_LYNX diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c index 6617932fd3fd..545ebe72611c 100644 --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c @@ -17,6 +17,7 @@ #include #include #include +#include /* TBI register addresses */ #define MII_TBICON 0x11 @@ -29,9 +30,6 @@ #define TBICON_CLK_SELECT 0x0020 /* Clock select */ #define TBICON_MI_MODE 0x0010 /* GMII mode (TBI if not set) */ -#define TBIANA_SGMII 0x4001 -#define TBIANA_1000X 0x01a0 - /* Interrupt Mask Register (IMASK) */ #define DTSEC_IMASK_BREN 0x80000000 #define DTSEC_IMASK_RXCEN 0x40000000 @@ -92,9 +90,10 @@ #define DTSEC_ECNTRL_GMIIM 0x00000040 #define DTSEC_ECNTRL_TBIM 0x00000020 -#define DTSEC_ECNTRL_SGMIIM 0x00000002 #define DTSEC_ECNTRL_RPM 0x00000010 #define DTSEC_ECNTRL_R100M 0x00000008 +#define DTSEC_ECNTRL_RMM 0x00000004 +#define DTSEC_ECNTRL_SGMIIM 0x00000002 #define DTSEC_ECNTRL_QSGMIIM 0x00000001 #define TCTRL_TTSE 0x00000040 @@ -318,7 +317,8 @@ struct fman_mac { void *fm; struct fman_rev_info fm_rev_info; bool basex_if; - struct phy_device *tbiphy; + struct mdio_device *tbidev; + struct phylink_pcs pcs; }; static void set_dflts(struct dtsec_cfg *cfg) @@ -356,56 +356,14 @@ static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg, phy_interface_t iface, u16 iface_speed, u64 addr, u32 exception_mask, u8 tbi_addr) { - bool is_rgmii, is_sgmii, is_qsgmii; enet_addr_t eth_addr; - u32 tmp; + u32 tmp = 0; int i; /* Soft reset */ iowrite32be(MACCFG1_SOFT_RESET, ®s->maccfg1); iowrite32be(0, ®s->maccfg1); - /* dtsec_id2 */ - tmp = ioread32be(®s->tsec_id2); - - /* check RGMII support */ - if (iface == PHY_INTERFACE_MODE_RGMII || - iface == PHY_INTERFACE_MODE_RGMII_ID || - iface == PHY_INTERFACE_MODE_RGMII_RXID || - iface == PHY_INTERFACE_MODE_RGMII_TXID || - iface == PHY_INTERFACE_MODE_RMII) - if (tmp & DTSEC_ID2_INT_REDUCED_OFF) - return -EINVAL; - - if (iface == PHY_INTERFACE_MODE_SGMII || - iface == PHY_INTERFACE_MODE_MII) - if (tmp & DTSEC_ID2_INT_REDUCED_OFF) - return -EINVAL; - - is_rgmii = iface == PHY_INTERFACE_MODE_RGMII || - iface == PHY_INTERFACE_MODE_RGMII_ID || - iface == PHY_INTERFACE_MODE_RGMII_RXID || - iface == PHY_INTERFACE_MODE_RGMII_TXID; - is_sgmii = iface == PHY_INTERFACE_MODE_SGMII; - is_qsgmii = iface == PHY_INTERFACE_MODE_QSGMII; - - tmp = 0; - if (is_rgmii || iface == PHY_INTERFACE_MODE_GMII) - tmp |= DTSEC_ECNTRL_GMIIM; - if (is_sgmii) - tmp |= (DTSEC_ECNTRL_SGMIIM | DTSEC_ECNTRL_TBIM); - if (is_qsgmii) - tmp |= (DTSEC_ECNTRL_SGMIIM | DTSEC_ECNTRL_TBIM | - DTSEC_ECNTRL_QSGMIIM); - if (is_rgmii) - tmp |= DTSEC_ECNTRL_RPM; - if (iface_speed == SPEED_100) - tmp |= DTSEC_ECNTRL_R100M; - - iowrite32be(tmp, ®s->ecntrl); - - tmp = 0; - if (cfg->tx_pause_time) tmp |= cfg->tx_pause_time; if (cfg->tx_pause_time_extd) @@ -446,17 +404,10 @@ static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg, tmp = 0; - if (iface_speed < SPEED_1000) - tmp |= MACCFG2_NIBBLE_MODE; - else if (iface_speed == SPEED_1000) - tmp |= MACCFG2_BYTE_MODE; - tmp |= (cfg->preamble_len << MACCFG2_PREAMBLE_LENGTH_SHIFT) & MACCFG2_PREAMBLE_LENGTH_MASK; if (cfg->tx_pad_crc) tmp |= MACCFG2_PAD_CRC_EN; - /* Full Duplex */ - tmp |= MACCFG2_FULL_DUPLEX; iowrite32be(tmp, ®s->maccfg2); tmp = (((cfg->non_back_to_back_ipg1 << @@ -525,10 +476,6 @@ static void set_bucket(struct dtsec_regs __iomem *regs, int bucket, static int check_init_parameters(struct fman_mac *dtsec) { - if (dtsec->max_speed >= SPEED_10000) { - pr_err("1G MAC driver supports 1G or lower speeds\n"); - return -EINVAL; - } if ((dtsec->dtsec_drv_param)->rx_prepend > MAX_PACKET_ALIGNMENT) { pr_err("packetAlignmentPadding can't be > than %d\n", @@ -630,22 +577,10 @@ static int get_exception_flag(enum fman_mac_exceptions exception) return bit_mask; } -static bool is_init_done(struct dtsec_cfg *dtsec_drv_params) -{ - /* Checks if dTSEC driver parameters were initialized */ - if (!dtsec_drv_params) - return true; - - return false; -} - static u16 dtsec_get_max_frame_length(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; - if (is_init_done(dtsec->dtsec_drv_param)) - return 0; - return (u16)ioread32be(®s->maxfrm); } @@ -682,6 +617,7 @@ static void dtsec_isr(void *handle) dtsec->exception_cb(dtsec->dev_id, FM_MAC_EX_1G_COL_RET_LMT); if (event & DTSEC_IMASK_XFUNEN) { /* FM_TX_LOCKUP_ERRATA_DTSEC6 Errata workaround */ + /* FIXME: This races with the rest of the driver! */ if (dtsec->fm_rev_info.major == 2) { u32 tpkt1, tmp_reg1, tpkt2, tmp_reg2, i; /* a. Write 0x00E0_0C00 to DTSEC_ID @@ -814,6 +750,43 @@ static void free_init_resources(struct fman_mac *dtsec) dtsec->unicast_addr_hash = NULL; } +static struct fman_mac *pcs_to_dtsec(struct phylink_pcs *pcs) +{ + return container_of(pcs, struct fman_mac, pcs); +} + +static void dtsec_pcs_get_state(struct phylink_pcs *pcs, + struct phylink_link_state *state) +{ + struct fman_mac *dtsec = pcs_to_dtsec(pcs); + + phylink_mii_c22_pcs_get_state(dtsec->tbidev, state); +} + +static int dtsec_pcs_config(struct phylink_pcs *pcs, unsigned int mode, + phy_interface_t interface, + const unsigned long *advertising, + bool permit_pause_to_mac) +{ + struct fman_mac *dtsec = pcs_to_dtsec(pcs); + + return phylink_mii_c22_pcs_config(dtsec->tbidev, mode, interface, + advertising); +} + +static void dtsec_pcs_an_restart(struct phylink_pcs *pcs) +{ + struct fman_mac *dtsec = pcs_to_dtsec(pcs); + + phylink_mii_c22_pcs_an_restart(dtsec->tbidev); +} + +static const struct phylink_pcs_ops dtsec_pcs_ops = { + .pcs_get_state = dtsec_pcs_get_state, + .pcs_config = dtsec_pcs_config, + .pcs_an_restart = dtsec_pcs_an_restart, +}; + static void graceful_start(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; @@ -854,36 +827,11 @@ static void graceful_stop(struct fman_mac *dtsec) static int dtsec_enable(struct fman_mac *dtsec) { - struct dtsec_regs __iomem *regs = dtsec->regs; - u32 tmp; - - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - /* Enable */ - tmp = ioread32be(®s->maccfg1); - tmp |= MACCFG1_RX_EN | MACCFG1_TX_EN; - iowrite32be(tmp, ®s->maccfg1); - - /* Graceful start - clear the graceful Rx/Tx stop bit */ - graceful_start(dtsec); - return 0; } static void dtsec_disable(struct fman_mac *dtsec) { - struct dtsec_regs __iomem *regs = dtsec->regs; - u32 tmp; - - WARN_ON_ONCE(!is_init_done(dtsec->dtsec_drv_param)); - - /* Graceful stop - Assert the graceful Rx/Tx stop bit */ - graceful_stop(dtsec); - - tmp = ioread32be(®s->maccfg1); - tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); - iowrite32be(tmp, ®s->maccfg1); } static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, @@ -894,11 +842,6 @@ static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, struct dtsec_regs __iomem *regs = dtsec->regs; u32 ptv = 0; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - graceful_stop(dtsec); - if (pause_time) { /* FM_BAD_TX_TS_IN_B_2_B_ERRATA_DTSEC_A003 Errata workaround */ if (dtsec->fm_rev_info.major == 2 && pause_time <= 320) { @@ -919,8 +862,6 @@ static int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, iowrite32be(ioread32be(®s->maccfg1) & ~MACCFG1_TX_FLOW, ®s->maccfg1); - graceful_start(dtsec); - return 0; } @@ -929,11 +870,6 @@ static int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - graceful_stop(dtsec); - tmp = ioread32be(®s->maccfg1); if (en) tmp |= MACCFG1_RX_FLOW; @@ -941,17 +877,124 @@ static int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) tmp &= ~MACCFG1_RX_FLOW; iowrite32be(tmp, ®s->maccfg1); - graceful_start(dtsec); - return 0; } +static struct phylink_pcs *dtsec_select_pcs(struct phylink_config *config, + phy_interface_t iface) +{ + struct fman_mac *dtsec = fman_config_to_mac(config)->fman_mac; + + switch (iface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_2500BASEX: + return &dtsec->pcs; + default: + return NULL; + } +} + +static void dtsec_mac_config(struct phylink_config *config, unsigned int mode, + const struct phylink_link_state *state) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct dtsec_regs __iomem *regs = mac_dev->fman_mac->regs; + u32 tmp; + + switch (state->interface) { + case PHY_INTERFACE_MODE_RMII: + tmp = DTSEC_ECNTRL_RMM; + break; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + tmp = DTSEC_ECNTRL_GMIIM | DTSEC_ECNTRL_RPM; + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_2500BASEX: + tmp = DTSEC_ECNTRL_TBIM | DTSEC_ECNTRL_SGMIIM; + break; + default: + dev_warn(mac_dev->dev, "cannot configure dTSEC for %s\n", + phy_modes(state->interface)); + } + + iowrite32be(tmp, ®s->ecntrl); +} + +static void dtsec_link_up(struct phylink_config *config, struct phy_device *phy, + unsigned int mode, phy_interface_t interface, + int speed, int duplex, bool tx_pause, bool rx_pause) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct fman_mac *dtsec = mac_dev->fman_mac; + struct dtsec_regs __iomem *regs = dtsec->regs; + u16 pause_time = tx_pause ? FSL_FM_PAUSE_TIME_ENABLE : + FSL_FM_PAUSE_TIME_DISABLE; + u32 tmp; + + dtsec_set_tx_pause_frames(dtsec, 0, pause_time, 0); + dtsec_accept_rx_pause_frames(dtsec, rx_pause); + + tmp = ioread32be(®s->ecntrl); + if (speed == SPEED_100) + tmp |= DTSEC_ECNTRL_R100M; + else + tmp &= ~DTSEC_ECNTRL_R100M; + iowrite32be(tmp, ®s->ecntrl); + + tmp = ioread32be(®s->maccfg2); + tmp &= ~(MACCFG2_NIBBLE_MODE | MACCFG2_BYTE_MODE | MACCFG2_FULL_DUPLEX); + if (speed >= SPEED_1000) + tmp |= MACCFG2_BYTE_MODE; + else + tmp |= MACCFG2_NIBBLE_MODE; + + if (duplex == DUPLEX_FULL) + tmp |= MACCFG2_FULL_DUPLEX; + + iowrite32be(tmp, ®s->maccfg2); + + mac_dev->update_speed(mac_dev, speed); + + /* Enable */ + tmp = ioread32be(®s->maccfg1); + tmp |= MACCFG1_RX_EN | MACCFG1_TX_EN; + iowrite32be(tmp, ®s->maccfg1); + + /* Graceful start - clear the graceful Rx/Tx stop bit */ + graceful_start(dtsec); +} + +static void dtsec_link_down(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) +{ + struct fman_mac *dtsec = fman_config_to_mac(config)->fman_mac; + struct dtsec_regs __iomem *regs = dtsec->regs; + u32 tmp; + + /* Graceful stop - Assert the graceful Rx/Tx stop bit */ + graceful_stop(dtsec); + + tmp = ioread32be(®s->maccfg1); + tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); + iowrite32be(tmp, ®s->maccfg1); +} + +static const struct phylink_mac_ops dtsec_mac_ops = { + .validate = phylink_generic_validate, + .mac_select_pcs = dtsec_select_pcs, + .mac_config = dtsec_mac_config, + .mac_link_up = dtsec_link_up, + .mac_link_down = dtsec_link_down, +}; + static int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr) { - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - graceful_stop(dtsec); /* Initialize MAC Station Address registers (1 & 2) @@ -975,9 +1018,6 @@ static int dtsec_add_hash_mac_address(struct fman_mac *dtsec, u32 crc = 0xFFFFFFFF; bool mcast, ghtx; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); ghtx = (bool)((ioread32be(®s->rctrl) & RCTRL_GHTX) ? true : false); @@ -1037,9 +1077,6 @@ static int dtsec_set_allmulti(struct fman_mac *dtsec, bool enable) u32 tmp; struct dtsec_regs __iomem *regs = dtsec->regs; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - tmp = ioread32be(®s->rctrl); if (enable) tmp |= RCTRL_MPROM; @@ -1056,9 +1093,6 @@ static int dtsec_set_tstamp(struct fman_mac *dtsec, bool enable) struct dtsec_regs __iomem *regs = dtsec->regs; u32 rctrl, tctrl; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - rctrl = ioread32be(®s->rctrl); tctrl = ioread32be(®s->tctrl); @@ -1087,9 +1121,6 @@ static int dtsec_del_hash_mac_address(struct fman_mac *dtsec, u32 crc = 0xFFFFFFFF; bool mcast, ghtx; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); ghtx = (bool)((ioread32be(®s->rctrl) & RCTRL_GHTX) ? true : false); @@ -1153,9 +1184,6 @@ static int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) struct dtsec_regs __iomem *regs = dtsec->regs; u32 tmp; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - /* Set unicast promiscuous */ tmp = ioread32be(®s->rctrl); if (new_val) @@ -1177,90 +1205,12 @@ static int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) return 0; } -static int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) -{ - struct dtsec_regs __iomem *regs = dtsec->regs; - u32 tmp; - - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - graceful_stop(dtsec); - - tmp = ioread32be(®s->maccfg2); - - /* Full Duplex */ - tmp |= MACCFG2_FULL_DUPLEX; - - tmp &= ~(MACCFG2_NIBBLE_MODE | MACCFG2_BYTE_MODE); - if (speed < SPEED_1000) - tmp |= MACCFG2_NIBBLE_MODE; - else if (speed == SPEED_1000) - tmp |= MACCFG2_BYTE_MODE; - iowrite32be(tmp, ®s->maccfg2); - - tmp = ioread32be(®s->ecntrl); - if (speed == SPEED_100) - tmp |= DTSEC_ECNTRL_R100M; - else - tmp &= ~DTSEC_ECNTRL_R100M; - iowrite32be(tmp, ®s->ecntrl); - - graceful_start(dtsec); - - return 0; -} - -static int dtsec_restart_autoneg(struct fman_mac *dtsec) -{ - u16 tmp_reg16; - - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - - tmp_reg16 = phy_read(dtsec->tbiphy, MII_BMCR); - - tmp_reg16 &= ~(BMCR_SPEED100 | BMCR_SPEED1000); - tmp_reg16 |= (BMCR_ANENABLE | BMCR_ANRESTART | - BMCR_FULLDPLX | BMCR_SPEED1000); - - phy_write(dtsec->tbiphy, MII_BMCR, tmp_reg16); - - return 0; -} - -static void adjust_link_dtsec(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - struct fman_mac *fman_mac; - bool rx_pause, tx_pause; - int err; - - fman_mac = mac_dev->fman_mac; - if (!phy_dev->link) { - dtsec_restart_autoneg(fman_mac); - - return; - } - - dtsec_adjust_link(fman_mac, phy_dev->speed); - mac_dev->update_speed(mac_dev, phy_dev->speed); - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", - err); -} - static int dtsec_set_exception(struct fman_mac *dtsec, enum fman_mac_exceptions exception, bool enable) { struct dtsec_regs __iomem *regs = dtsec->regs; u32 bit_mask = 0; - if (!is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - if (exception != FM_MAC_EX_1G_1588_TS_RX_ERR) { bit_mask = get_exception_flag(exception); if (bit_mask) { @@ -1310,12 +1260,9 @@ static int dtsec_init(struct fman_mac *dtsec) { struct dtsec_regs __iomem *regs = dtsec->regs; struct dtsec_cfg *dtsec_drv_param; - u16 max_frm_ln; + u16 max_frm_ln, tbicon; int err; - if (is_init_done(dtsec->dtsec_drv_param)) - return -EINVAL; - if (DEFAULT_RESET_ON_INIT && (fman_reset_mac(dtsec->fm, dtsec->mac_id) != 0)) { pr_err("Can't reset MAC!\n"); @@ -1330,38 +1277,19 @@ static int dtsec_init(struct fman_mac *dtsec) err = init(dtsec->regs, dtsec_drv_param, dtsec->phy_if, dtsec->max_speed, dtsec->addr, dtsec->exceptions, - dtsec->tbiphy->mdio.addr); + dtsec->tbidev->addr); if (err) { free_init_resources(dtsec); pr_err("DTSEC version doesn't support this i/f mode\n"); return err; } - if (dtsec->phy_if == PHY_INTERFACE_MODE_SGMII) { - u16 tmp_reg16; + /* Configure the TBI PHY Control Register */ + tbicon = TBICON_CLK_SELECT | TBICON_SOFT_RESET; + mdiodev_write(dtsec->tbidev, MII_TBICON, tbicon); - /* Configure the TBI PHY Control Register */ - tmp_reg16 = TBICON_CLK_SELECT | TBICON_SOFT_RESET; - phy_write(dtsec->tbiphy, MII_TBICON, tmp_reg16); - - tmp_reg16 = TBICON_CLK_SELECT; - phy_write(dtsec->tbiphy, MII_TBICON, tmp_reg16); - - tmp_reg16 = (BMCR_RESET | BMCR_ANENABLE | - BMCR_FULLDPLX | BMCR_SPEED1000); - phy_write(dtsec->tbiphy, MII_BMCR, tmp_reg16); - - if (dtsec->basex_if) - tmp_reg16 = TBIANA_1000X; - else - tmp_reg16 = TBIANA_SGMII; - phy_write(dtsec->tbiphy, MII_ADVERTISE, tmp_reg16); - - tmp_reg16 = (BMCR_ANENABLE | BMCR_ANRESTART | - BMCR_FULLDPLX | BMCR_SPEED1000); - - phy_write(dtsec->tbiphy, MII_BMCR, tmp_reg16); - } + tbicon = TBICON_CLK_SELECT; + mdiodev_write(dtsec->tbidev, MII_TBICON, tbicon); /* Max Frame Length */ max_frm_ln = (u16)ioread32be(®s->maxfrm); @@ -1406,6 +1334,8 @@ static int dtsec_free(struct fman_mac *dtsec) kfree(dtsec->dtsec_drv_param); dtsec->dtsec_drv_param = NULL; + if (!IS_ERR_OR_NULL(dtsec->tbidev)) + put_device(&dtsec->tbidev->dev); kfree(dtsec); return 0; @@ -1434,7 +1364,6 @@ static struct fman_mac *dtsec_config(struct mac_device *mac_dev, dtsec->regs = mac_dev->vaddr; dtsec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); - dtsec->max_speed = params->max_speed; dtsec->phy_if = mac_dev->phy_if; dtsec->mac_id = params->mac_id; dtsec->exceptions = (DTSEC_IMASK_BREN | @@ -1457,7 +1386,6 @@ static struct fman_mac *dtsec_config(struct mac_device *mac_dev, dtsec->en_tsu_err_exception = dtsec->dtsec_drv_param->ptp_exception_en; dtsec->fm = params->fm; - dtsec->basex_if = params->basex_if; /* Save FMan revision */ fman_get_revision(dtsec->fm, &dtsec->fm_rev_info); @@ -1476,18 +1404,18 @@ int dtsec_initialization(struct mac_device *mac_dev, int err; struct fman_mac *dtsec; struct device_node *phy_node; + unsigned long capabilities; + unsigned long *supported; + mac_dev->phylink_ops = &dtsec_mac_ops; mac_dev->set_promisc = dtsec_set_promiscuous; mac_dev->change_addr = dtsec_modify_mac_address; mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address; mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address; - mac_dev->set_tx_pause = dtsec_set_tx_pause_frames; - mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames; mac_dev->set_exception = dtsec_set_exception; mac_dev->set_allmulti = dtsec_set_allmulti; mac_dev->set_tstamp = dtsec_set_tstamp; mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_dtsec; mac_dev->enable = dtsec_enable; mac_dev->disable = dtsec_disable; @@ -1502,19 +1430,56 @@ int dtsec_initialization(struct mac_device *mac_dev, dtsec->dtsec_drv_param->tx_pad_crc = true; phy_node = of_parse_phandle(mac_node, "tbi-handle", 0); - if (!phy_node) { - pr_err("TBI PHY node is not available\n"); + if (!phy_node || of_device_is_available(phy_node)) { + of_node_put(phy_node); err = -EINVAL; + dev_err_probe(mac_dev->dev, err, + "TBI PCS node is not available\n"); goto _return_fm_mac_free; } - dtsec->tbiphy = of_phy_find_device(phy_node); - if (!dtsec->tbiphy) { - pr_err("of_phy_find_device (TBI PHY) failed\n"); - err = -EINVAL; + dtsec->tbidev = of_mdio_find_device(phy_node); + of_node_put(phy_node); + if (!dtsec->tbidev) { + err = -EPROBE_DEFER; + dev_err_probe(mac_dev->dev, err, + "could not find mdiodev for PCS\n"); goto _return_fm_mac_free; } - put_device(&dtsec->tbiphy->mdio.dev); + dtsec->pcs.ops = &dtsec_pcs_ops; + dtsec->pcs.poll = true; + + supported = mac_dev->phylink_config.supported_interfaces; + + /* FIXME: Can we use DTSEC_ID2_INT_FULL_OFF to determine if these are + * supported? If not, we can determine support via the phy if SerDes + * support is added. + */ + if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII || + mac_dev->phy_if == PHY_INTERFACE_MODE_1000BASEX) { + __set_bit(PHY_INTERFACE_MODE_SGMII, supported); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported); + } else if (mac_dev->phy_if == PHY_INTERFACE_MODE_2500BASEX) { + __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported); + } + + if (!(ioread32be(&dtsec->regs->tsec_id2) & DTSEC_ID2_INT_REDUCED_OFF)) { + phy_interface_set_rgmii(supported); + + /* DTSEC_ID2_INT_REDUCED_OFF indicates that the dTSEC supports + * RMII and RGMII. However, the only SoCs which support RMII + * are the P1017 and P1023. Avoid advertising this mode on + * other SoCs. This is a bit of a moot point, since there's no + * in-tree support for ethernet on these platforms... + */ + if (of_machine_is_compatible("fsl,P1023") || + of_machine_is_compatible("fsl,P1023RDB")) + __set_bit(PHY_INTERFACE_MODE_RMII, supported); + } + + capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE; + capabilities |= MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD; + mac_dev->phylink_config.mac_capabilities = capabilities; err = dtsec_init(dtsec); if (err < 0) diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h index 65887a3160d7..e5d6cddea731 100644 --- a/drivers/net/ethernet/freescale/fman/fman_mac.h +++ b/drivers/net/ethernet/freescale/fman/fman_mac.h @@ -170,20 +170,10 @@ struct fman_mac_params { * 0 - FM_MAX_NUM_OF_10G_MACS */ u8 mac_id; - /* Note that the speed should indicate the maximum rate that - * this MAC should support rather than the actual speed; - */ - u16 max_speed; /* A handle to the FM object this port related to */ void *fm; fman_mac_exception_cb *event_cb; /* MDIO Events Callback Routine */ fman_mac_exception_cb *exception_cb;/* Exception Callback Routine */ - /* SGMII/QSGII interface with 1000BaseX auto-negotiation between MAC - * and phy or backplane; Note: 1000BaseX auto-negotiation relates only - * to interface between MAC and phy/backplane, SGMII phy can still - * synchronize with far-end phy at 10Mbps, 100Mbps or 1000Mbps - */ - bool basex_if; }; struct eth_hash_t { diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 23794e8d43be..3e839b3886f1 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -278,9 +278,6 @@ struct fman_mac { struct memac_regs __iomem *regs; /* MAC address of device */ u64 addr; - /* Ethernet physical interface */ - phy_interface_t phy_if; - u16 max_speed; struct mac_device *dev_id; /* device cookie used by the exception cbs */ fman_mac_exception_cb *exception_cb; fman_mac_exception_cb *event_cb; @@ -293,12 +290,12 @@ struct fman_mac { struct memac_cfg *memac_drv_param; void *fm; struct fman_rev_info fm_rev_info; - bool basex_if; struct phy *serdes; struct phylink_pcs *sgmii_pcs; struct phylink_pcs *qsgmii_pcs; struct phylink_pcs *xfi_pcs; bool allmulti_enabled; + bool rgmii_no_half_duplex; }; static void add_addr_in_paddr(struct memac_regs __iomem *regs, const u8 *adr, @@ -356,7 +353,6 @@ static void set_exception(struct memac_regs __iomem *regs, u32 val, } static int init(struct memac_regs __iomem *regs, struct memac_cfg *cfg, - phy_interface_t phy_if, u16 speed, bool slow_10g_if, u32 exceptions) { u32 tmp; @@ -384,41 +380,6 @@ static int init(struct memac_regs __iomem *regs, struct memac_cfg *cfg, iowrite32be((u32)cfg->pause_quanta, ®s->pause_quanta[0]); iowrite32be((u32)0, ®s->pause_thresh[0]); - /* IF_MODE */ - tmp = 0; - switch (phy_if) { - case PHY_INTERFACE_MODE_XGMII: - tmp |= IF_MODE_10G; - break; - case PHY_INTERFACE_MODE_MII: - tmp |= IF_MODE_MII; - break; - default: - tmp |= IF_MODE_GMII; - if (phy_if == PHY_INTERFACE_MODE_RGMII || - phy_if == PHY_INTERFACE_MODE_RGMII_ID || - phy_if == PHY_INTERFACE_MODE_RGMII_RXID || - phy_if == PHY_INTERFACE_MODE_RGMII_TXID) - tmp |= IF_MODE_RGMII | IF_MODE_RGMII_AUTO; - } - iowrite32be(tmp, ®s->if_mode); - - /* TX_FIFO_SECTIONS */ - tmp = 0; - if (phy_if == PHY_INTERFACE_MODE_XGMII) { - if (slow_10g_if) { - tmp |= (TX_FIFO_SECTIONS_TX_AVAIL_SLOW_10G | - TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_10G); - } else { - tmp |= (TX_FIFO_SECTIONS_TX_AVAIL_10G | - TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_10G); - } - } else { - tmp |= (TX_FIFO_SECTIONS_TX_AVAIL_1G | - TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_1G); - } - iowrite32be(tmp, ®s->tx_fifo_sections); - /* clear all pending events and set-up interrupts */ iowrite32be(0xffffffff, ®s->ievent); set_exception(regs, exceptions, true); @@ -458,24 +419,6 @@ static u32 get_mac_addr_hash_code(u64 eth_addr) return xor_val; } -static void setup_sgmii_internal(struct fman_mac *memac, - struct phylink_pcs *pcs, - struct fixed_phy_status *fixed_link) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); - phy_interface_t iface = memac->basex_if ? PHY_INTERFACE_MODE_1000BASEX : - PHY_INTERFACE_MODE_SGMII; - unsigned int mode = fixed_link ? MLO_AN_FIXED : MLO_AN_INBAND; - - linkmode_set_pause(advertising, true, true); - pcs->ops->pcs_config(pcs, mode, iface, advertising, true); - if (fixed_link) - pcs->ops->pcs_link_up(pcs, mode, iface, fixed_link->speed, - fixed_link->duplex); - else - pcs->ops->pcs_an_restart(pcs); -} - static int check_init_parameters(struct fman_mac *memac) { if (!memac->exception_cb) { @@ -581,41 +524,31 @@ static void free_init_resources(struct fman_mac *memac) memac->unicast_addr_hash = NULL; } -static bool is_init_done(struct memac_cfg *memac_drv_params) -{ - /* Checks if mEMAC driver parameters were initialized */ - if (!memac_drv_params) - return true; - - return false; -} - static int memac_enable(struct fman_mac *memac) { - struct memac_regs __iomem *regs = memac->regs; - u32 tmp; + int ret; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; + ret = phy_init(memac->serdes); + if (ret) { + dev_err(memac->dev_id->dev, + "could not initialize serdes: %pe\n", ERR_PTR(ret)); + return ret; + } - tmp = ioread32be(®s->command_config); - tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; - iowrite32be(tmp, ®s->command_config); + ret = phy_power_on(memac->serdes); + if (ret) { + dev_err(memac->dev_id->dev, + "could not power on serdes: %pe\n", ERR_PTR(ret)); + phy_exit(memac->serdes); + } - return 0; + return ret; } static void memac_disable(struct fman_mac *memac) - { - struct memac_regs __iomem *regs = memac->regs; - u32 tmp; - - WARN_ON_ONCE(!is_init_done(memac->memac_drv_param)); - - tmp = ioread32be(®s->command_config); - tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); - iowrite32be(tmp, ®s->command_config); + phy_power_off(memac->serdes); + phy_exit(memac->serdes); } static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) @@ -623,9 +556,6 @@ static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) struct memac_regs __iomem *regs = memac->regs; u32 tmp; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (new_val) tmp |= CMD_CFG_PROMIS_EN; @@ -637,73 +567,12 @@ static int memac_set_promiscuous(struct fman_mac *memac, bool new_val) return 0; } -static int memac_adjust_link(struct fman_mac *memac, u16 speed) -{ - struct memac_regs __iomem *regs = memac->regs; - u32 tmp; - - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - - tmp = ioread32be(®s->if_mode); - - /* Set full duplex */ - tmp &= ~IF_MODE_HD; - - if (phy_interface_mode_is_rgmii(memac->phy_if)) { - /* Configure RGMII in manual mode */ - tmp &= ~IF_MODE_RGMII_AUTO; - tmp &= ~IF_MODE_RGMII_SP_MASK; - /* Full duplex */ - tmp |= IF_MODE_RGMII_FD; - - switch (speed) { - case SPEED_1000: - tmp |= IF_MODE_RGMII_1000; - break; - case SPEED_100: - tmp |= IF_MODE_RGMII_100; - break; - case SPEED_10: - tmp |= IF_MODE_RGMII_10; - break; - default: - break; - } - } - - iowrite32be(tmp, ®s->if_mode); - - return 0; -} - -static void adjust_link_memac(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - struct fman_mac *fman_mac; - bool rx_pause, tx_pause; - int err; - - fman_mac = mac_dev->fman_mac; - memac_adjust_link(fman_mac, phy_dev->speed); - mac_dev->update_speed(mac_dev, phy_dev->speed); - - fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause); - err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause); - if (err < 0) - dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n", - err); -} - static int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, u16 pause_time, u16 thresh_time) { struct memac_regs __iomem *regs = memac->regs; u32 tmp; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - tmp = ioread32be(®s->tx_fifo_sections); GET_TX_EMPTY_DEFAULT_VALUE(tmp); @@ -738,9 +607,6 @@ static int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) struct memac_regs __iomem *regs = memac->regs; u32 tmp; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (en) tmp &= ~CMD_CFG_PAUSE_IGNORE; @@ -752,12 +618,178 @@ static int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en) return 0; } +static void memac_validate(struct phylink_config *config, + unsigned long *supported, + struct phylink_link_state *state) +{ + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; + struct fman_mac *memac = fman_config_to_mac(config)->fman_mac; + + phylink_generic_validate(config, supported, state); + + if (phy_interface_mode_is_rgmii(state->interface) && + memac->rgmii_no_half_duplex) { + phylink_caps_to_linkmodes(mask, MAC_10HD | MAC_100HD); + linkmode_andnot(supported, supported, mask); + linkmode_andnot(state->advertising, state->advertising, mask); + } +} + +/** + * memac_if_mode() - Convert an interface mode into an IF_MODE config + * @interface: A phy interface mode + * + * Return: A configuration word, suitable for programming into the lower bits + * of %IF_MODE. + */ +static u32 memac_if_mode(phy_interface_t interface) +{ + switch (interface) { + case PHY_INTERFACE_MODE_MII: + return IF_MODE_MII; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + return IF_MODE_GMII | IF_MODE_RGMII; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_QSGMII: + return IF_MODE_GMII; + case PHY_INTERFACE_MODE_10GBASER: + return IF_MODE_10G; + default: + WARN_ON_ONCE(1); + return 0; + } +} + +static struct phylink_pcs *memac_select_pcs(struct phylink_config *config, + phy_interface_t iface) +{ + struct fman_mac *memac = fman_config_to_mac(config)->fman_mac; + + switch (iface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + return memac->sgmii_pcs; + case PHY_INTERFACE_MODE_QSGMII: + return memac->qsgmii_pcs; + case PHY_INTERFACE_MODE_10GBASER: + return memac->xfi_pcs; + default: + return NULL; + } +} + +static int memac_prepare(struct phylink_config *config, unsigned int mode, + phy_interface_t iface) +{ + struct fman_mac *memac = fman_config_to_mac(config)->fman_mac; + + switch (iface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_10GBASER: + return phy_set_mode_ext(memac->serdes, PHY_MODE_ETHERNET, + iface); + default: + return 0; + } +} + +static void memac_mac_config(struct phylink_config *config, unsigned int mode, + const struct phylink_link_state *state) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct memac_regs __iomem *regs = mac_dev->fman_mac->regs; + u32 tmp = ioread32be(®s->if_mode); + + tmp &= ~(IF_MODE_MASK | IF_MODE_RGMII); + tmp |= memac_if_mode(state->interface); + if (phylink_autoneg_inband(mode)) + tmp |= IF_MODE_RGMII_AUTO; + iowrite32be(tmp, ®s->if_mode); +} + +static void memac_link_up(struct phylink_config *config, struct phy_device *phy, + unsigned int mode, phy_interface_t interface, + int speed, int duplex, bool tx_pause, bool rx_pause) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct fman_mac *memac = mac_dev->fman_mac; + struct memac_regs __iomem *regs = memac->regs; + u32 tmp = memac_if_mode(interface); + u16 pause_time = tx_pause ? FSL_FM_PAUSE_TIME_ENABLE : + FSL_FM_PAUSE_TIME_DISABLE; + + memac_set_tx_pause_frames(memac, 0, pause_time, 0); + memac_accept_rx_pause_frames(memac, rx_pause); + + if (duplex == DUPLEX_HALF) + tmp |= IF_MODE_HD; + + switch (speed) { + case SPEED_1000: + tmp |= IF_MODE_RGMII_1000; + break; + case SPEED_100: + tmp |= IF_MODE_RGMII_100; + break; + case SPEED_10: + tmp |= IF_MODE_RGMII_10; + break; + } + iowrite32be(tmp, ®s->if_mode); + + /* TODO: EEE? */ + + if (speed == SPEED_10000) { + if (memac->fm_rev_info.major == 6 && + memac->fm_rev_info.minor == 4) + tmp = TX_FIFO_SECTIONS_TX_AVAIL_SLOW_10G; + else + tmp = TX_FIFO_SECTIONS_TX_AVAIL_10G; + tmp |= TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_10G; + } else { + tmp = TX_FIFO_SECTIONS_TX_AVAIL_1G | + TX_FIFO_SECTIONS_TX_EMPTY_DEFAULT_1G; + } + iowrite32be(tmp, ®s->tx_fifo_sections); + + mac_dev->update_speed(mac_dev, speed); + + tmp = ioread32be(®s->command_config); + tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; + iowrite32be(tmp, ®s->command_config); +} + +static void memac_link_down(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) +{ + struct fman_mac *memac = fman_config_to_mac(config)->fman_mac; + struct memac_regs __iomem *regs = memac->regs; + u32 tmp; + + /* TODO: graceful */ + tmp = ioread32be(®s->command_config); + tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); + iowrite32be(tmp, ®s->command_config); +} + +static const struct phylink_mac_ops memac_mac_ops = { + .validate = memac_validate, + .mac_select_pcs = memac_select_pcs, + .mac_prepare = memac_prepare, + .mac_config = memac_mac_config, + .mac_link_up = memac_link_up, + .mac_link_down = memac_link_down, +}; + static int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_addr) { - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - add_addr_in_paddr(memac->regs, (const u8 *)(*enet_addr), 0); return 0; @@ -771,9 +803,6 @@ static int memac_add_hash_mac_address(struct fman_mac *memac, u32 hash; u64 addr; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); if (!(addr & GROUP_ADDRESS)) { @@ -802,9 +831,6 @@ static int memac_set_allmulti(struct fman_mac *memac, bool enable) u32 entry; struct memac_regs __iomem *regs = memac->regs; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - if (enable) { for (entry = 0; entry < HASH_TABLE_SIZE; entry++) iowrite32be(entry | HASH_CTRL_MCAST_EN, @@ -834,9 +860,6 @@ static int memac_del_hash_mac_address(struct fman_mac *memac, u32 hash; u64 addr; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); hash = get_mac_addr_hash_code(addr) & HASH_CTRL_ADDR_MASK; @@ -864,9 +887,6 @@ static int memac_set_exception(struct fman_mac *memac, { u32 bit_mask = 0; - if (!is_init_done(memac->memac_drv_param)) - return -EINVAL; - bit_mask = get_exception_flag(exception); if (bit_mask) { if (enable) @@ -886,23 +906,15 @@ static int memac_init(struct fman_mac *memac) { struct memac_cfg *memac_drv_param; enet_addr_t eth_addr; - bool slow_10g_if = false; - struct fixed_phy_status *fixed_link; int err; u32 reg32 = 0; - if (is_init_done(memac->memac_drv_param)) - return -EINVAL; - err = check_init_parameters(memac); if (err) return err; memac_drv_param = memac->memac_drv_param; - if (memac->fm_rev_info.major == 6 && memac->fm_rev_info.minor == 4) - slow_10g_if = true; - /* First, reset the MAC if desired. */ if (memac_drv_param->reset_on_init) { err = reset(memac->regs); @@ -918,10 +930,7 @@ static int memac_init(struct fman_mac *memac) add_addr_in_paddr(memac->regs, (const u8 *)eth_addr, 0); } - fixed_link = memac_drv_param->fixed_link; - - init(memac->regs, memac->memac_drv_param, memac->phy_if, - memac->max_speed, slow_10g_if, memac->exceptions); + init(memac->regs, memac->memac_drv_param, memac->exceptions); /* FM_RX_FIFO_CORRUPT_ERRATA_10GMAC_A006320 errata workaround * Exists only in FMan 6.0 and 6.3. @@ -937,11 +946,6 @@ static int memac_init(struct fman_mac *memac) iowrite32be(reg32, &memac->regs->command_config); } - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII) - setup_sgmii_internal(memac, memac->sgmii_pcs, fixed_link); - else if (memac->phy_if == PHY_INTERFACE_MODE_QSGMII) - setup_sgmii_internal(memac, memac->qsgmii_pcs, fixed_link); - /* Max Frame Length */ err = fman_set_mac_max_frame(memac->fm, memac->mac_id, memac_drv_param->max_frame_length); @@ -970,9 +974,6 @@ static int memac_init(struct fman_mac *memac) fman_register_intr(memac->fm, FMAN_MOD_MAC, memac->mac_id, FMAN_INTR_TYPE_NORMAL, memac_exception, memac); - kfree(memac_drv_param); - memac->memac_drv_param = NULL; - return 0; } @@ -995,7 +996,6 @@ static int memac_free(struct fman_mac *memac) pcs_put(memac->sgmii_pcs); pcs_put(memac->qsgmii_pcs); pcs_put(memac->xfi_pcs); - kfree(memac->memac_drv_param); kfree(memac); @@ -1028,8 +1028,6 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev, memac->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); memac->regs = mac_dev->vaddr; - memac->max_speed = params->max_speed; - memac->phy_if = mac_dev->phy_if; memac->mac_id = params->mac_id; memac->exceptions = (MEMAC_IMASK_TSECC_ER | MEMAC_IMASK_TECC_ER | MEMAC_IMASK_RECC_ER | MEMAC_IMASK_MGI); @@ -1037,7 +1035,6 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev, memac->event_cb = params->event_cb; memac->dev_id = mac_dev; memac->fm = params->fm; - memac->basex_if = params->basex_if; /* Save FMan revision */ fman_get_revision(memac->fm, &memac->fm_rev_info); @@ -1064,43 +1061,50 @@ static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node, return pcs; } +static bool memac_supports(struct mac_device *mac_dev, phy_interface_t iface) +{ + /* If there's no serdes device, assume that it's been configured for + * whatever the default interface mode is. + */ + if (!mac_dev->fman_mac->serdes) + return mac_dev->phy_if == iface; + /* Otherwise, ask the serdes */ + return !phy_validate(mac_dev->fman_mac->serdes, PHY_MODE_ETHERNET, + iface, NULL); +} + int memac_initialization(struct mac_device *mac_dev, struct device_node *mac_node, struct fman_mac_params *params) { int err; + struct device_node *fixed; struct phylink_pcs *pcs; - struct fixed_phy_status *fixed_link; struct fman_mac *memac; + unsigned long capabilities; + unsigned long *supported; + mac_dev->phylink_ops = &memac_mac_ops; mac_dev->set_promisc = memac_set_promiscuous; mac_dev->change_addr = memac_modify_mac_address; mac_dev->add_hash_mac_addr = memac_add_hash_mac_address; mac_dev->remove_hash_mac_addr = memac_del_hash_mac_address; - mac_dev->set_tx_pause = memac_set_tx_pause_frames; - mac_dev->set_rx_pause = memac_accept_rx_pause_frames; mac_dev->set_exception = memac_set_exception; mac_dev->set_allmulti = memac_set_allmulti; mac_dev->set_tstamp = memac_set_tstamp; mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = adjust_link_memac; mac_dev->enable = memac_enable; mac_dev->disable = memac_disable; - if (params->max_speed == SPEED_10000) - mac_dev->phy_if = PHY_INTERFACE_MODE_XGMII; - mac_dev->fman_mac = memac_config(mac_dev, params); - if (!mac_dev->fman_mac) { - err = -EINVAL; - goto _return; - } + if (!mac_dev->fman_mac) + return -EINVAL; memac = mac_dev->fman_mac; memac->memac_drv_param->max_frame_length = fman_get_max_frm(); memac->memac_drv_param->reset_on_init = true; - err = of_property_match_string(mac_node, "pcs-names", "xfi"); + err = of_property_match_string(mac_node, "pcs-handle-names", "xfi"); if (err >= 0) { memac->xfi_pcs = memac_pcs_create(mac_node, err); if (IS_ERR(memac->xfi_pcs)) { @@ -1112,7 +1116,7 @@ int memac_initialization(struct mac_device *mac_dev, goto _return_fm_mac_free; } - err = of_property_match_string(mac_node, "pcs-names", "qsgmii"); + err = of_property_match_string(mac_node, "pcs-handle-names", "qsgmii"); if (err >= 0) { memac->qsgmii_pcs = memac_pcs_create(mac_node, err); if (IS_ERR(memac->qsgmii_pcs)) { @@ -1124,25 +1128,25 @@ int memac_initialization(struct mac_device *mac_dev, goto _return_fm_mac_free; } - /* For compatibility, if pcs-names is missing, we assume this phy is - * the first one in pcsphy-handle + /* For compatibility, if pcs-handle-names is missing, we assume this + * phy is the first one in pcsphy-handle */ - err = of_property_match_string(mac_node, "pcs-names", "sgmii"); - if (err == -EINVAL) + err = of_property_match_string(mac_node, "pcs-handle-names", "sgmii"); + if (err == -EINVAL || err == -ENODATA) pcs = memac_pcs_create(mac_node, 0); else if (err < 0) goto _return_fm_mac_free; else pcs = memac_pcs_create(mac_node, err); - if (!pcs) { - dev_err(mac_dev->dev, "missing pcs\n"); - err = -ENOENT; + if (IS_ERR(pcs)) { + err = PTR_ERR(pcs); + dev_err_probe(mac_dev->dev, err, "missing pcs\n"); goto _return_fm_mac_free; } - /* If err is set here, it means that pcs-names was missing above (and - * therefore that xfi_pcs cannot be set). If we are defaulting to + /* If err is set here, it means that pcs-handle-names was missing above + * (and therefore that xfi_pcs cannot be set). If we are defaulting to * XGMII, assume this is for XFI. Otherwise, assume it is for SGMII. */ if (err && mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) @@ -1158,84 +1162,100 @@ int memac_initialization(struct mac_device *mac_dev, } else if (IS_ERR(memac->serdes)) { dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); goto _return_fm_mac_free; + } + + /* The internal connection to the serdes is XGMII, but this isn't + * really correct for the phy mode (which is the external connection). + * However, this is how all older device trees say that they want + * 10GBASE-R (aka XFI), so just convert it for them. + */ + if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) + mac_dev->phy_if = PHY_INTERFACE_MODE_10GBASER; + + /* TODO: The following interface modes are supported by (some) hardware + * but not by this driver: + * - 1000BASE-KX + * - 10GBASE-KR + * - XAUI/HiGig + */ + supported = mac_dev->phylink_config.supported_interfaces; + + /* Note that half duplex is only supported on 10/100M interfaces. */ + + if (memac->sgmii_pcs && + (memac_supports(mac_dev, PHY_INTERFACE_MODE_SGMII) || + memac_supports(mac_dev, PHY_INTERFACE_MODE_1000BASEX))) { + __set_bit(PHY_INTERFACE_MODE_SGMII, supported); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported); + } + + if (memac->sgmii_pcs && + memac_supports(mac_dev, PHY_INTERFACE_MODE_2500BASEX)) + __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported); + + if (memac->qsgmii_pcs && + memac_supports(mac_dev, PHY_INTERFACE_MODE_QSGMII)) + __set_bit(PHY_INTERFACE_MODE_QSGMII, supported); + else if (mac_dev->phy_if == PHY_INTERFACE_MODE_QSGMII) + dev_warn(mac_dev->dev, "no QSGMII pcs specified\n"); + + if (memac->xfi_pcs && + memac_supports(mac_dev, PHY_INTERFACE_MODE_10GBASER)) { + __set_bit(PHY_INTERFACE_MODE_10GBASER, supported); } else { - err = phy_init(memac->serdes); - if (err) { - dev_err_probe(mac_dev->dev, err, - "could not initialize serdes\n"); - goto _return_fm_mac_free; - } - - err = phy_power_on(memac->serdes); - if (err) { - dev_err_probe(mac_dev->dev, err, - "could not power on serdes\n"); - goto _return_phy_exit; - } - - if (memac->phy_if == PHY_INTERFACE_MODE_SGMII || - memac->phy_if == PHY_INTERFACE_MODE_1000BASEX || - memac->phy_if == PHY_INTERFACE_MODE_2500BASEX || - memac->phy_if == PHY_INTERFACE_MODE_QSGMII || - memac->phy_if == PHY_INTERFACE_MODE_XGMII) { - err = phy_set_mode_ext(memac->serdes, PHY_MODE_ETHERNET, - memac->phy_if); - if (err) { - dev_err_probe(mac_dev->dev, err, - "could not set serdes mode to %s\n", - phy_modes(memac->phy_if)); - goto _return_phy_power_off; - } - } + /* From what I can tell, no 10g macs support RGMII. */ + phy_interface_set_rgmii(supported); + __set_bit(PHY_INTERFACE_MODE_MII, supported); } - if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) { - struct phy_device *phy; - - err = of_phy_register_fixed_link(mac_node); - if (err) - goto _return_phy_power_off; - - fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL); - if (!fixed_link) { - err = -ENOMEM; - goto _return_phy_power_off; - } - - mac_dev->phy_node = of_node_get(mac_node); - phy = of_phy_find_device(mac_dev->phy_node); - if (!phy) { - err = -EINVAL; - of_node_put(mac_dev->phy_node); - goto _return_fixed_link_free; - } - - fixed_link->link = phy->link; - fixed_link->speed = phy->speed; - fixed_link->duplex = phy->duplex; - fixed_link->pause = phy->pause; - fixed_link->asym_pause = phy->asym_pause; - - put_device(&phy->mdio.dev); - memac->memac_drv_param->fixed_link = fixed_link; - } + capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE; + capabilities |= MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD | MAC_10000FD; + + /* These SoCs don't support half duplex at all; there's no different + * FMan version or compatible, so we just have to check the machine + * compatible instead + */ + if (of_machine_is_compatible("fsl,ls1043a") || + of_machine_is_compatible("fsl,ls1046a") || + of_machine_is_compatible("fsl,B4QDS")) + capabilities &= ~(MAC_10HD | MAC_100HD); + + mac_dev->phylink_config.mac_capabilities = capabilities; + + /* The T2080 and T4240 don't support half duplex RGMII. There is no + * other way to identify these SoCs, so just use the machine + * compatible. + */ + if (of_machine_is_compatible("fsl,T2080QDS") || + of_machine_is_compatible("fsl,T2080RDB") || + of_machine_is_compatible("fsl,T2081QDS") || + of_machine_is_compatible("fsl,T4240QDS") || + of_machine_is_compatible("fsl,T4240RDB")) + memac->rgmii_no_half_duplex = true; + + /* Most boards should use MLO_AN_INBAND, but existing boards don't have + * a managed property. Default to MLO_AN_INBAND if nothing else is + * specified. We need to be careful and not enable this if we have a + * fixed link or if we are using MII or RGMII, since those + * configurations modes don't use in-band autonegotiation. + */ + fixed = of_get_child_by_name(mac_node, "fixed-link"); + if (!fixed && !of_property_read_bool(mac_node, "fixed-link") && + !of_property_read_bool(mac_node, "managed") && + mac_dev->phy_if != PHY_INTERFACE_MODE_MII && + !phy_interface_mode_is_rgmii(mac_dev->phy_if)) + mac_dev->phylink_config.ovr_an_inband = true; + of_node_put(fixed); err = memac_init(mac_dev->fman_mac); if (err < 0) - goto _return_fixed_link_free; + goto _return_fm_mac_free; dev_info(mac_dev->dev, "FMan MEMAC\n"); - goto _return; + return 0; -_return_phy_power_off: - phy_power_off(memac->serdes); -_return_phy_exit: - phy_exit(memac->serdes); -_return_fixed_link_free: - kfree(fixed_link); _return_fm_mac_free: memac_free(mac_dev->fman_mac); -_return: return err; } diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index 33f3b1cc2cfe..00a8c65cdd56 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c @@ -13,6 +13,7 @@ #include #include #include +#include /* Transmit Inter-Packet Gap Length Register (TX_IPG_LENGTH) */ #define TGEC_TX_IPG_LENGTH_MASK 0x000003ff @@ -243,10 +244,6 @@ static int init(struct tgec_regs __iomem *regs, struct tgec_cfg *cfg, static int check_init_parameters(struct fman_mac *tgec) { - if (tgec->max_speed < SPEED_10000) { - pr_err("10G MAC driver only support 10G speed\n"); - return -EINVAL; - } if (!tgec->exception_cb) { pr_err("uninitialized exception_cb\n"); return -EINVAL; @@ -384,40 +381,13 @@ static void free_init_resources(struct fman_mac *tgec) tgec->unicast_addr_hash = NULL; } -static bool is_init_done(struct tgec_cfg *cfg) -{ - /* Checks if tGEC driver parameters were initialized */ - if (!cfg) - return true; - - return false; -} - static int tgec_enable(struct fman_mac *tgec) { - struct tgec_regs __iomem *regs = tgec->regs; - u32 tmp; - - if (!is_init_done(tgec->cfg)) - return -EINVAL; - - tmp = ioread32be(®s->command_config); - tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; - iowrite32be(tmp, ®s->command_config); - return 0; } static void tgec_disable(struct fman_mac *tgec) { - struct tgec_regs __iomem *regs = tgec->regs; - u32 tmp; - - WARN_ON_ONCE(!is_init_done(tgec->cfg)); - - tmp = ioread32be(®s->command_config); - tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); - iowrite32be(tmp, ®s->command_config); } static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) @@ -425,9 +395,6 @@ static int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val) struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (new_val) tmp |= CMD_CFG_PROMIS_EN; @@ -444,9 +411,6 @@ static int tgec_set_tx_pause_frames(struct fman_mac *tgec, { struct tgec_regs __iomem *regs = tgec->regs; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - iowrite32be((u32)pause_time, ®s->pause_quant); return 0; @@ -457,9 +421,6 @@ static int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (!en) tmp |= CMD_CFG_PAUSE_IGNORE; @@ -470,12 +431,53 @@ static int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en) return 0; } +static void tgec_mac_config(struct phylink_config *config, unsigned int mode, + const struct phylink_link_state *state) +{ +} + +static void tgec_link_up(struct phylink_config *config, struct phy_device *phy, + unsigned int mode, phy_interface_t interface, + int speed, int duplex, bool tx_pause, bool rx_pause) +{ + struct mac_device *mac_dev = fman_config_to_mac(config); + struct fman_mac *tgec = mac_dev->fman_mac; + struct tgec_regs __iomem *regs = tgec->regs; + u16 pause_time = tx_pause ? FSL_FM_PAUSE_TIME_ENABLE : + FSL_FM_PAUSE_TIME_DISABLE; + u32 tmp; + + tgec_set_tx_pause_frames(tgec, 0, pause_time, 0); + tgec_accept_rx_pause_frames(tgec, rx_pause); + mac_dev->update_speed(mac_dev, speed); + + tmp = ioread32be(®s->command_config); + tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN; + iowrite32be(tmp, ®s->command_config); +} + +static void tgec_link_down(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) +{ + struct fman_mac *tgec = fman_config_to_mac(config)->fman_mac; + struct tgec_regs __iomem *regs = tgec->regs; + u32 tmp; + + tmp = ioread32be(®s->command_config); + tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN); + iowrite32be(tmp, ®s->command_config); +} + +static const struct phylink_mac_ops tgec_mac_ops = { + .validate = phylink_generic_validate, + .mac_config = tgec_mac_config, + .mac_link_up = tgec_link_up, + .mac_link_down = tgec_link_down, +}; + static int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *p_enet_addr) { - if (!is_init_done(tgec->cfg)) - return -EINVAL; - tgec->addr = ENET_ADDR_TO_UINT64(*p_enet_addr); set_mac_address(tgec->regs, (const u8 *)(*p_enet_addr)); @@ -490,9 +492,6 @@ static int tgec_add_hash_mac_address(struct fman_mac *tgec, u32 crc = 0xFFFFFFFF, hash; u64 addr; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - addr = ENET_ADDR_TO_UINT64(*eth_addr); if (!(addr & GROUP_ADDRESS)) { @@ -525,9 +524,6 @@ static int tgec_set_allmulti(struct fman_mac *tgec, bool enable) u32 entry; struct tgec_regs __iomem *regs = tgec->regs; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - if (enable) { for (entry = 0; entry < TGEC_HASH_TABLE_SIZE; entry++) iowrite32be(entry | TGEC_HASH_MCAST_EN, @@ -548,9 +544,6 @@ static int tgec_set_tstamp(struct fman_mac *tgec, bool enable) struct tgec_regs __iomem *regs = tgec->regs; u32 tmp; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - tmp = ioread32be(®s->command_config); if (enable) @@ -572,9 +565,6 @@ static int tgec_del_hash_mac_address(struct fman_mac *tgec, u32 crc = 0xFFFFFFFF, hash; u64 addr; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - addr = ((*(u64 *)eth_addr) >> 16); /* CRC calculation */ @@ -601,22 +591,12 @@ static int tgec_del_hash_mac_address(struct fman_mac *tgec, return 0; } -static void tgec_adjust_link(struct mac_device *mac_dev) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - - mac_dev->update_speed(mac_dev, phy_dev->speed); -} - static int tgec_set_exception(struct fman_mac *tgec, enum fman_mac_exceptions exception, bool enable) { struct tgec_regs __iomem *regs = tgec->regs; u32 bit_mask = 0; - if (!is_init_done(tgec->cfg)) - return -EINVAL; - bit_mask = get_exception_flag(exception); if (bit_mask) { if (enable) @@ -641,9 +621,6 @@ static int tgec_init(struct fman_mac *tgec) enet_addr_t eth_addr; int err; - if (is_init_done(tgec->cfg)) - return -EINVAL; - if (DEFAULT_RESET_ON_INIT && (fman_reset_mac(tgec->fm, tgec->mac_id) != 0)) { pr_err("Can't reset MAC!\n"); @@ -752,7 +729,6 @@ static struct fman_mac *tgec_config(struct mac_device *mac_dev, struct fman_mac_ tgec->regs = mac_dev->vaddr; tgec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); - tgec->max_speed = params->max_speed; tgec->mac_id = params->mac_id; tgec->exceptions = (TGEC_IMASK_MDIO_SCAN_EVENT | TGEC_IMASK_REM_FAULT | @@ -787,17 +763,15 @@ int tgec_initialization(struct mac_device *mac_dev, int err; struct fman_mac *tgec; + mac_dev->phylink_ops = &tgec_mac_ops; mac_dev->set_promisc = tgec_set_promiscuous; mac_dev->change_addr = tgec_modify_mac_address; mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; mac_dev->remove_hash_mac_addr = tgec_del_hash_mac_address; - mac_dev->set_tx_pause = tgec_set_tx_pause_frames; - mac_dev->set_rx_pause = tgec_accept_rx_pause_frames; mac_dev->set_exception = tgec_set_exception; mac_dev->set_allmulti = tgec_set_allmulti; mac_dev->set_tstamp = tgec_set_tstamp; mac_dev->set_multi = fman_set_multi; - mac_dev->adjust_link = tgec_adjust_link; mac_dev->enable = tgec_enable; mac_dev->disable = tgec_disable; @@ -807,6 +781,19 @@ int tgec_initialization(struct mac_device *mac_dev, goto _return; } + /* The internal connection to the serdes is XGMII, but this isn't + * really correct for the phy mode (which is the external connection). + * However, this is how all older device trees say that they want + * XAUI, so just convert it for them. + */ + if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) + mac_dev->phy_if = PHY_INTERFACE_MODE_XAUI; + + __set_bit(PHY_INTERFACE_MODE_XAUI, + mac_dev->phylink_config.supported_interfaces); + mac_dev->phylink_config.mac_capabilities = + MAC_SYM_PAUSE | MAC_ASYM_PAUSE | MAC_10000FD; + tgec = mac_dev->fman_mac; tgec->cfg->max_frame_length = fman_get_max_frm(); err = tgec_init(tgec); diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 7b7526fd7da3..2b0a30f69147 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -93,130 +94,8 @@ int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev) return 0; } -/** - * fman_set_mac_active_pause - * @mac_dev: A pointer to the MAC device - * @rx: Pause frame setting for RX - * @tx: Pause frame setting for TX - * - * Set the MAC RX/TX PAUSE frames settings - * - * Avoid redundant calls to FMD, if the MAC driver already contains the desired - * active PAUSE settings. Otherwise, the new active settings should be reflected - * in FMan. - * - * Return: 0 on success; Error code otherwise. - */ -int fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx) -{ - struct fman_mac *fman_mac = mac_dev->fman_mac; - int err = 0; - - if (rx != mac_dev->rx_pause_active) { - err = mac_dev->set_rx_pause(fman_mac, rx); - if (likely(err == 0)) - mac_dev->rx_pause_active = rx; - } - - if (tx != mac_dev->tx_pause_active) { - u16 pause_time = (tx ? FSL_FM_PAUSE_TIME_ENABLE : - FSL_FM_PAUSE_TIME_DISABLE); - - err = mac_dev->set_tx_pause(fman_mac, 0, pause_time, 0); - - if (likely(err == 0)) - mac_dev->tx_pause_active = tx; - } - - return err; -} -EXPORT_SYMBOL(fman_set_mac_active_pause); - -/** - * fman_get_pause_cfg - * @mac_dev: A pointer to the MAC device - * @rx_pause: Return value for RX setting - * @tx_pause: Return value for TX setting - * - * Determine the MAC RX/TX PAUSE frames settings based on PHY - * autonegotiation or values set by eththool. - * - * Return: Pointer to FMan device. - */ -void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause, - bool *tx_pause) -{ - struct phy_device *phy_dev = mac_dev->phy_dev; - u16 lcl_adv, rmt_adv; - u8 flowctrl; - - *rx_pause = *tx_pause = false; - - if (!phy_dev->duplex) - return; - - /* If PAUSE autonegotiation is disabled, the TX/RX PAUSE settings - * are those set by ethtool. - */ - if (!mac_dev->autoneg_pause) { - *rx_pause = mac_dev->rx_pause_req; - *tx_pause = mac_dev->tx_pause_req; - return; - } - - /* Else if PAUSE autonegotiation is enabled, the TX/RX PAUSE - * settings depend on the result of the link negotiation. - */ - - /* get local capabilities */ - lcl_adv = linkmode_adv_to_lcl_adv_t(phy_dev->advertising); - - /* get link partner capabilities */ - rmt_adv = 0; - if (phy_dev->pause) - rmt_adv |= LPA_PAUSE_CAP; - if (phy_dev->asym_pause) - rmt_adv |= LPA_PAUSE_ASYM; - - /* Calculate TX/RX settings based on local and peer advertised - * symmetric/asymmetric PAUSE capabilities. - */ - flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv); - if (flowctrl & FLOW_CTRL_RX) - *rx_pause = true; - if (flowctrl & FLOW_CTRL_TX) - *tx_pause = true; -} -EXPORT_SYMBOL(fman_get_pause_cfg); - -#define DTSEC_SUPPORTED \ - (SUPPORTED_10baseT_Half \ - | SUPPORTED_10baseT_Full \ - | SUPPORTED_100baseT_Half \ - | SUPPORTED_100baseT_Full \ - | SUPPORTED_Autoneg \ - | SUPPORTED_Pause \ - | SUPPORTED_Asym_Pause \ - | SUPPORTED_FIBRE \ - | SUPPORTED_MII) - static DEFINE_MUTEX(eth_lock); -static const u16 phy2speed[] = { - [PHY_INTERFACE_MODE_MII] = SPEED_100, - [PHY_INTERFACE_MODE_GMII] = SPEED_1000, - [PHY_INTERFACE_MODE_SGMII] = SPEED_1000, - [PHY_INTERFACE_MODE_TBI] = SPEED_1000, - [PHY_INTERFACE_MODE_RMII] = SPEED_100, - [PHY_INTERFACE_MODE_RGMII] = SPEED_1000, - [PHY_INTERFACE_MODE_RGMII_ID] = SPEED_1000, - [PHY_INTERFACE_MODE_RGMII_RXID] = SPEED_1000, - [PHY_INTERFACE_MODE_RGMII_TXID] = SPEED_1000, - [PHY_INTERFACE_MODE_RTBI] = SPEED_1000, - [PHY_INTERFACE_MODE_QSGMII] = SPEED_1000, - [PHY_INTERFACE_MODE_XGMII] = SPEED_10000 -}; - static struct platform_device *dpaa_eth_add_device(int fman_id, struct mac_device *mac_dev) { @@ -263,8 +142,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id, } static const struct of_device_id mac_match[] = { - { .compatible = "fsl,fman-dtsec", .data = dtsec_initialization }, - { .compatible = "fsl,fman-xgec", .data = tgec_initialization }, + { .compatible = "fsl,fman-dtsec", .data = dtsec_initialization }, + { .compatible = "fsl,fman-xgec", .data = tgec_initialization }, { .compatible = "fsl,fman-memac", .data = memac_initialization }, {} }; @@ -296,6 +175,7 @@ static int mac_probe(struct platform_device *_of_dev) priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; + platform_set_drvdata(_of_dev, mac_dev); /* Save private information */ mac_dev->priv = priv; @@ -424,57 +304,21 @@ static int mac_probe(struct platform_device *_of_dev) } mac_dev->phy_if = phy_if; - priv->speed = phy2speed[mac_dev->phy_if]; - params.max_speed = priv->speed; - mac_dev->if_support = DTSEC_SUPPORTED; - /* We don't support half-duplex in SGMII mode */ - if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII) - mac_dev->if_support &= ~(SUPPORTED_10baseT_Half | - SUPPORTED_100baseT_Half); - - /* Gigabit support (no half-duplex) */ - if (params.max_speed == 1000) - mac_dev->if_support |= SUPPORTED_1000baseT_Full; - - /* The 10G interface only supports one mode */ - if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) - mac_dev->if_support = SUPPORTED_10000baseT_Full; - - /* Get the rest of the PHY information */ - mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0); - - params.basex_if = false; params.mac_id = priv->cell_index; params.fm = (void *)priv->fman; params.exception_cb = mac_exception; params.event_cb = mac_exception; err = init(mac_dev, mac_node, ¶ms); - if (err < 0) { - dev_err(dev, "mac_dev->init() = %d\n", err); - of_node_put(mac_dev->phy_node); - return err; - } - - /* pause frame autonegotiation enabled */ - mac_dev->autoneg_pause = true; - - /* By intializing the values to false, force FMD to enable PAUSE frames - * on RX and TX - */ - mac_dev->rx_pause_req = true; - mac_dev->tx_pause_req = true; - mac_dev->rx_pause_active = false; - mac_dev->tx_pause_active = false; - err = fman_set_mac_active_pause(mac_dev, true, true); if (err < 0) - dev_err(dev, "fman_set_mac_active_pause() = %d\n", err); + return err; if (!is_zero_ether_addr(mac_dev->addr)) dev_info(dev, "FMan MAC address: %pM\n", mac_dev->addr); priv->eth_dev = dpaa_eth_add_device(fman_id, mac_dev); if (IS_ERR(priv->eth_dev)) { + err = PTR_ERR(priv->eth_dev); dev_err(dev, "failed to add Ethernet platform device for MAC %d\n", priv->cell_index); priv->eth_dev = NULL; diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h index b95d384271bd..5bf03e1e279a 100644 --- a/drivers/net/ethernet/freescale/fman/mac.h +++ b/drivers/net/ethernet/freescale/fman/mac.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "fman_port.h" @@ -24,32 +25,22 @@ struct mac_device { struct device *dev; u8 addr[ETH_ALEN]; struct fman_port *port[2]; - u32 if_support; - struct phy_device *phy_dev; + struct phylink *phylink; + struct phylink_config phylink_config; phy_interface_t phy_if; - struct device_node *phy_node; - struct net_device *net_dev; - bool autoneg_pause; - bool rx_pause_req; - bool tx_pause_req; - bool rx_pause_active; - bool tx_pause_active; bool promisc; bool allmulti; + const struct phylink_mac_ops *phylink_ops; int (*enable)(struct fman_mac *mac_dev); void (*disable)(struct fman_mac *mac_dev); - void (*adjust_link)(struct mac_device *mac_dev); int (*set_promisc)(struct fman_mac *mac_dev, bool enable); int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr); int (*set_allmulti)(struct fman_mac *mac_dev, bool enable); int (*set_tstamp)(struct fman_mac *mac_dev, bool enable); int (*set_multi)(struct net_device *net_dev, struct mac_device *mac_dev); - int (*set_rx_pause)(struct fman_mac *mac_dev, bool en); - int (*set_tx_pause)(struct fman_mac *mac_dev, u8 priority, - u16 pause_time, u16 thresh_time); int (*set_exception)(struct fman_mac *mac_dev, enum fman_mac_exceptions exception, bool enable); int (*add_hash_mac_addr)(struct fman_mac *mac_dev, @@ -63,6 +54,12 @@ struct mac_device { struct mac_priv_s *priv; }; +static inline struct mac_device +*fman_config_to_mac(struct phylink_config *config) +{ + return container_of(config, struct mac_device, phylink_config); +} + struct dpaa_eth_data { struct mac_device *mac_dev; int mac_hw_id; From patchwork Thu Aug 4 19:47:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936675 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 82315C19F21 for ; Thu, 4 Aug 2022 19:52:03 +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:References:In-Reply-To: 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: List-Owner; bh=fjFpPq8cuzh+exZbmFLhb4/o6zWycZSroWlJiE7rXKQ=; b=jNgsi7UZR5oKTK GGtlwcJVelzFuN0bCcHPWXsQdfU6gLgm5qjF7rdJJek78rn1GzkaeeT2Vq0ecw4da4WAl+0KL7RDP SH8KqdrOk4y1vX2Y03GIpyXMPi3/IL3v4/A3B6iAizmpFUcUmM1BbSXNaHDWLu2rWYh2OvqQvRIZB Rtp6/mhH+dV4nILMFJwypLBUL3mkUgkRXR0ug8BCzCB0jM/p8FBrmnO66fNGd7bJpty++cExMFOsV PpIP9Ekp+epgK5R8LExMn95V05bqiZbVzXeEZMigjqb9HwDMApH3ypph4YXQZii63tKfZuy90p5DZ a3fVv5jlV6JAwVcq65XA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgra-008iIE-6q; Thu, 04 Aug 2022 19:50:35 +0000 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgox-008gwv-A3 for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 19:47:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VqQ8WKnDGMnVv1R9/xMB15oBmF23BprWgLMXMXh8fx9Yk63Wj/F13BR0vFC/FumOfuQJDxjof2g7w5qkLGt7LgHZ+e+MgRJTW5311hIXNwhixSJYDWKJ3JRsFrYfFUJuB40hT4TKFTAhUOft8+Hz2DHp82RBOA8ZasUdqF9m4jR/gQOsY0/WIBPX1USWVnPckj2URXJsTc9weK9LpNeLZKTUC8uDhWMToHh9xOhFlBhBLwvVz9G4ZQRoUGXkS78SGQHodhI8C6aGwq0ezcRiSemmcavyRc5Cn5QMew111XEjBUIAziFHhIL0lTW1easO1i5GRuXBHtuWtIPMfrIo6Q== 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=LCObfj5r2OYfyyq3F8oPQDtQfbz5yer0yn3O4thUwSM=; b=l5qw2BVPks1Otrx0NIkNNE6rqn08bWA5IyPgpsjlyTdSIHmoeerWbZZ855Jqqu+ijQipf9Jt4pmGZIMVyNtlnoKSD5aATTQ5yCH/f7cfsBijLI5YVoHjUog33kB+7yljTxzMLMGYnOkPB3xWtCVyygYnqi2F2wsUSeyq0wsJoJ2CDBXb6AVYBN5oYJkG74wWh6da1TG6OshKThX89sQg/mzCzt3hrjpZe08D8AofL2GinSrlWvb6BPpAwfruqZVh7Dlw2ZXM65sRoe15lpCpPEVejYAUP6xdp2ZlwYKJhynCbJnnm02KUitTycKczp86uqkwUMTPxOsfceV1eh9Xyw== 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=LCObfj5r2OYfyyq3F8oPQDtQfbz5yer0yn3O4thUwSM=; b=OFwY8YMaYrFAd0tE1sA14t5tYLqJUatz3CkVwqwE6hHZg75+5iMgI4G5I7QETi023yknwYAvnZLB0qpMypbLpDAcbr59iS6Aa5LuusCTojjrI3ZebmzNeV4Wfo9pbCnlx2cKI3VXyy4NQ2s8JiRifCrgoO37bvBonVV9J2z/RahZpDWZe5K9u8hvCtcfZIjOhuNqYwiBNQEvkQ6TICfIorN6iaJKJeInah8QUHtK4ZmDf3wFHAeE7T0zkzAOdbaPcg9nmKFj1XlkVC2AgwSSNTYyPzxj3RceRFYSty8c5A7aqZ29D0Vz/MbHZEmYs9WL2lDRmeRggPrOwy9R9FcsRg== 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 HE1PR0301MB2297.eurprd03.prod.outlook.com (2603:10a6:3:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 19:47:34 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 19:47:34 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: "linuxppc-dev @ lists . ozlabs . org" , linux-kernel@vger.kernel.org, Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , Russell King , Sean Anderson , Benjamin Herrenschmidt , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v4 6/8] powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G Date: Thu, 4 Aug 2022 15:47:03 -0400 Message-Id: <20220804194705.459670-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804194705.459670-1-sean.anderson@seco.com> References: <20220804194705.459670-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::17) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 681d5b4a-2cb3-461e-58c0-08da76522d53 X-MS-TrafficTypeDiagnostic: HE1PR0301MB2297:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YBgo/JNdCcemIDbdCADk2xytrlJZwmqmFbf5oEnnlLbzAAaeWM14HH/FtK9GQu8N+Goxsgn95+f6QSi1UKh2KD1W9lRCsz4aatlYzNXj9psA4U7ckLoUajNfbyyK397E3BLbQrXt7iv3nXnywot97Sm0O+pY1eiSXvu6YTbeFf3aZTV+gPVqNewow+yii0uAiw4EOiw1yzAL3UkgLx6yxwEoRkpsYAf/+fthsYKsiJt81ftH3PbNTPcIh68j+lUPHCGCCT5allz0Za7tEiehKYjnzfkbhABkNHCP59sJ6RmHtr33UmVDSAJX+8JRJvB+LW8HJ7N7+UAbEeskvAYJzKaFvSth63XcY6aUWeKLdMi3Tt+WKlnS0R3CaJKQKrH2MoSdNhTE/I813lAnaPOiMcYwb+SXwUu7lOqWttGaUIbkW8Jtmugy9gD/t3tw5Bf7lxryKJHAbd+dolhTHHMoeSPg6fzCowjdy/gnB5xRuPnBq0wt49MmqXwJeHJ2nWN5vH9Tq3MHiu5T9k2tqZqInTOigNBCi6dFBJaI0+z86erHUk5t8wtZIHeCDPxOJGwVd0dhB9U9HSA1mO1p1tCLmZyWqIQ3BWv4BL2beQbmeP2zUM2xu+Pw5bQ3l132V308hhoLnskvKlq/wMr/KCMUAs9bPkqgj4JfdtEJ7Va9HGq440GxxrQrvtzhpsj9GjEioqBIzLHLmxYyG45kK1tSk/Fm7HXamKJc6l30KCxlFgJUnxX1iVJ5qnlxG7klqWaefLgAsBpY4vLV26rQ0eJXvQj92SinFNAtiLmiLDPJnkM= 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:(13230016)(39850400004)(366004)(346002)(376002)(136003)(396003)(6486002)(478600001)(186003)(1076003)(26005)(7416002)(6506007)(6666004)(2906002)(6512007)(8936002)(83380400001)(44832011)(41300700001)(38350700002)(110136005)(38100700002)(86362001)(316002)(5660300002)(54906003)(8676002)(36756003)(66946007)(66556008)(4326008)(2616005)(66476007)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fYu6L3x6qWm/vFvx6EGpMwbllSNfoC6l0r/Fdcx55i5Ekj3vAfI0wMjzSGSZd9RQOF+VA2NQll6yOfM2k5qIBNueApcjFI5i2IsGpcdRn+vtpWGO3WL7cU5lqVzQcqaBi/5tt63W4GUbXxD4x7wBXqH7qhZr98M6U7J9eMY75xJeL7Rh8LMYmv13/4jRkJHIMICiW+CY/7y3dr+WpKKl1/uBS//4j/DjvcbhzhBdXSLJy4SbnyFbovcu3qG75bmTns+8PnxRx200r/FLdYLIwdLy1GDkWOz+6zQyNRhToeitOCRqeb91IqWnWnMGjK10ZkZQjL+7aBfAPHlEKTlp+Op5kCSmjqhWyiRWMIqdZ1/rNU0ThxiXrHh4iGKPygERs2Y77+yZSOpNGCXfC1UB/bdqhwxtpYogXl80aBET+G++3iMQVaSK/hgcens4LaSQIy/7nU7kq2K2VigJbFthAwk08CYoimPPCoWSgAqlKKJFm+oHyXl7AaIMVY4Iv7J9m/XnaIVwW5imDhk1Jij9Yl06oXHf6GCMg5mbj3t7Cff/f0haqPbbg9/Nj8UbhY8oMsJtQjryrMAAUGZqSCY/iUbEIk7YMN7lOLpoibliDNPSShD06WzikAdxrnep9hMrnntieV+Bofc6cvE+IfFkXvTnHG0jhE63dlTu0mXkBXOKQlcUcLPOHQKlccnE31Bq4cvBwPWDQyj0QJoYy5FSNfL06jaZF1aZ1gDp+cao4ynbaawa0YYE8U5o6bki1XsS11BNU5zWp2dot/kk59ztqip5zp3KQt/7DtzhVX0vnfB5FzmSMlUnp67mmz0lsy8EWtHoalOZmEa8acAzHeCB7u2E548cwnIy3VyCatfQJCRcy26vGFox3zoHQ3dkSK1wyNI+ZGg7PV0hHsFVMvXyEqk6FP8ntGtjQJBXe5DIaHpApJPNZXogr5fjxQCpDQB155hN52F+aYtSZwVc1gpVtPp4uYrfwhiUQPpjFhonARDlBWqOTl6zITszGVOaPEENnHkAUx+/PsNxK4seIZqwErtZ3oopOJGn3IXBDzf3j6P2/RafEP0swDGqryo14lBnGGDA4PIs1PEKFVhBZFuUop3HClPTiIgka6LXRhIOr8IkpjIwNpQgVlb/G4/kGS6xon37eg9mo0B5C+ViIzZvVx7crGXU2CR6n6lpwTOIYW7dRpaCOyu65020fc1yaTVslwxacFELmhB+ORRqGiAmafaxHQwawElE0z+aDckQvLOpAbY7Xjg10AkzzhPqubz98oMI526fwoD902PO7rCgXjjWkfnnzoWHo4pR8GQQM+S3IfgmgEJDfApR+OKKmvOpvPpuadD9eXrSBCXOdkDablZ7Li682ZvasAdQcuDlYgigMvekerVmOW7wllbwqEZ2qGeFEePS5iTV67xZfQx5z7udDBbcB6+oftR3YgDHryg9vAiPoCvHzmUKFvQQErN3MmlczebhGyGewY0vUjWJgqXwzn8rn8C+UrSPyjt7G1DRRhqgZVyjxch3p2fpW43d3Gyh26sVr8sO9+DbvCoTt047WryfmpCEXRkWanWlbLCgHB4Tm4uxoRe/ewNZYXdg2ak4uNbcSCNc4LnmayrVVg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 681d5b4a-2cb3-461e-58c0-08da76522d53 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 19:47:34.7585 (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: AMzIhOrqC6BxnY0VGkU+ouFwaySHmktzUQ/y+ax7RDzPOYCrEVFwzBFlcS9Mk1MocxiwJlgOSFt8gKKQLU/MxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_124751_420068_5CB0BD42 X-CRM114-Status: GOOD ( 15.42 ) 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 On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC dtsi fragments, and mark the QMAN ports as 10G. Fixes: da414bb923d9 ("powerpc/mpc85xx: Add FSL QorIQ DPAA FMan support to the SoC device tree(s)") Signed-off-by: Sean Anderson --- Changes in v4: - New .../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++++++++++ .../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++++++++++ arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi new file mode 100644 index 000000000000..437dab3fc017 --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later +/* + * QorIQ FMan v3 10g port #2 device tree stub [ controller @ offset 0x400000 ] + * + * Copyright 2022 Sean Anderson + * Copyright 2012 - 2015 Freescale Semiconductor Inc. + */ + +fman@400000 { + fman0_rx_0x08: port@88000 { + cell-index = <0x8>; + compatible = "fsl,fman-v3-port-rx"; + reg = <0x88000 0x1000>; + fsl,fman-10g-port; + }; + + fman0_tx_0x28: port@a8000 { + cell-index = <0x28>; + compatible = "fsl,fman-v3-port-tx"; + reg = <0xa8000 0x1000>; + fsl,fman-10g-port; + }; + + ethernet@e0000 { + cell-index = <0>; + compatible = "fsl,fman-memac"; + reg = <0xe0000 0x1000>; + fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>; + ptp-timer = <&ptp_timer0>; + pcsphy-handle = <&pcsphy0>; + }; + + mdio@e1000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe1000 0x1000>; + fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy0: ethernet-phy@0 { + reg = <0x0>; + }; + }; +}; diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi new file mode 100644 index 000000000000..ad116b17850a --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later +/* + * QorIQ FMan v3 10g port #3 device tree stub [ controller @ offset 0x400000 ] + * + * Copyright 2022 Sean Anderson + * Copyright 2012 - 2015 Freescale Semiconductor Inc. + */ + +fman@400000 { + fman0_rx_0x09: port@89000 { + cell-index = <0x9>; + compatible = "fsl,fman-v3-port-rx"; + reg = <0x89000 0x1000>; + fsl,fman-10g-port; + }; + + fman0_tx_0x29: port@a9000 { + cell-index = <0x29>; + compatible = "fsl,fman-v3-port-tx"; + reg = <0xa9000 0x1000>; + fsl,fman-10g-port; + }; + + ethernet@e2000 { + cell-index = <1>; + compatible = "fsl,fman-memac"; + reg = <0xe2000 0x1000>; + fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>; + ptp-timer = <&ptp_timer0>; + pcsphy-handle = <&pcsphy1>; + }; + + mdio@e3000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe3000 0x1000>; + fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy1: ethernet-phy@0 { + reg = <0x0>; + }; + }; +}; diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi index ecbb447920bc..74e17e134387 100644 --- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi @@ -609,8 +609,8 @@ usb1: usb@211000 { /include/ "qoriq-bman1.dtsi" /include/ "qoriq-fman3-0.dtsi" -/include/ "qoriq-fman3-0-1g-0.dtsi" -/include/ "qoriq-fman3-0-1g-1.dtsi" +/include/ "qoriq-fman3-0-10g-2.dtsi" +/include/ "qoriq-fman3-0-10g-3.dtsi" /include/ "qoriq-fman3-0-1g-2.dtsi" /include/ "qoriq-fman3-0-1g-3.dtsi" /include/ "qoriq-fman3-0-1g-4.dtsi" From patchwork Thu Aug 4 19:47:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936676 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 0CF8AC19F21 for ; Thu, 4 Aug 2022 19:52:59 +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:References:In-Reply-To: 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: List-Owner; bh=LJ55eUKoP5FgEKqOR+mHzzgM1vzP9eT+q5ipfQzNG+Q=; b=13rnPPxvNVwI8X MTiO9KDpYmWIfA/yP72WBFuaMCY8iw9Hl+Hehvul3mpKcA6F8stBvBtT7OvMbFCXK0Zy4SpuN59Sz YtXl4n/79t4BsCgWLMnv76uBF8bn7nv8YvoxWTlayUtYpShOQXo2K863iMcyThMmUhR4+z0qNVLwa jUaBo3MkdQcbercdXA38YS5gqOyCdM4MJkmIzdkoe6bIFcVkdNLV2QNfcPIBWV6dxJR+xiNJcwrx7 Q6y5biLFMaXQTG0cankw3Z/Umv/f7MClMud/hGPvRlb0bXXDmyYYpykiOpyXO2cujpKY4+K8FxwRg Qgl+FMe5biJmGheP0upA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgsY-008igb-3L; Thu, 04 Aug 2022 19:51:34 +0000 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgoz-008gwv-A7 for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 19:47:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ScXtUsp0TvagRSMwGsLyXlpkonkL9KCIYxumiNA8rof8x3m2dNq/p7aLiDZ+CDyhwb+2tHcH5iVrmTmic7fUCsf43MbkHWGMNwZd5BPZX3QKjnTm1kdk+tde3JHCt2D1Mb4s+7FvSjn7qeZRjZ30la+91Czgx2pfqxFKY49QzhZsIdfoVkTZWV7yJ3eIKa6wVG+GV95yLfgXbp88Uxu26j3irXLHCPIG5Lkno5XNDbS9qu/8rNxzbX9z4nJLbErqwaohiAw/E2XRttxVprbCJZMuo6QBCk3TEDY8ha61Jo1n0OqajRNaKkHTQd7KIbGCCwGFIDABTnPSchXZOtXKnA== 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=kTwS8vnSscMG+rpUUE6RyREyfmZgs+7McUkaDIMNE2o=; b=ES2Kd9G1lvnK2qgiLwXxoow622jw23NpxYv/s8eCb84xBHi7KeWXyESR0a7JPXJygJxnm/RzJnNNcC9dRNkW1ga1Oy3+yWP+zntPwfWk7tVyOxa1TEyjchkNu5MBQHX9NRkqqAIRHZAmb+GyDIWSwyvOTgbj+gWzvhlFmxNZgu153DJtVQ45plFSU2feT6dwUYcDqszuC0gMt64t+KVsqiNfDtEpetPGLg13Xrl7zmWvR0qpSjxWMS9cNbJ9VCBcb+k/MoUrKeI5VMnafSEzgmGtYGdr254gWCRf3KTV+MwZ/Sbj2yCu0Lap1WW6pnWTD1HOUDrBFWi8OKKrywKMNQ== 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=kTwS8vnSscMG+rpUUE6RyREyfmZgs+7McUkaDIMNE2o=; b=OkZqXR72BxM/m9YYQElW3F1rzN2rG5YJyuRDLn4wvmL3aeH+RvQsRqupyOT5/6iKBY2JtDiWu4yMb4yQe77sHIpKH6z1XJdPiUI7HhgrDRi43jziRByaLERMqqqZBVOIugZSQOjdXi2bhBV5uRwPQtXiBBx78Lnlh67GLVD9cGWJj4mvULwJcampnjYyv4yHG2lmPFRq3PiPCDXZLjuSrD/9NySpXje3yf81om6n7nrJxszrzccltcQWZEWonTEV4cVrLa2C4nhdTrmQKeaTNtuQdE8lcvVZnRIVL/qOjKKuv4J5OY/LybCxvb6OpvqhS13gBH7Q/pYqHDkHriTEXA== 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 HE1PR0301MB2297.eurprd03.prod.outlook.com (2603:10a6:3:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 19:47:37 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 19:47:37 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: "linuxppc-dev @ lists . ozlabs . org" , linux-kernel@vger.kernel.org, Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , Russell King , Sean Anderson , Benjamin Herrenschmidt , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v4 7/8] powerpc: dts: qoriq: Add nodes for QSGMII PCSs Date: Thu, 4 Aug 2022 15:47:04 -0400 Message-Id: <20220804194705.459670-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804194705.459670-1-sean.anderson@seco.com> References: <20220804194705.459670-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::17) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 26d60558-db85-4280-6c22-08da76522e90 X-MS-TrafficTypeDiagnostic: HE1PR0301MB2297:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i9lO049dI5PAdbqjshz9Z+s2rbeUzzdLrutswKUxQ1riOAC0TsRJ4bWvhGV8VUMuAT/esF5tSG/QwtNpMZPY9QXqAjMBimTVHcqDc4oK/GOHRVDb90fjz+e/zYF5xGlPWNy/ACeGpOFjMiA1B5IR8scBdlSkZRZpWbeMcp0SqQvZg8Wdi26/m+2Ik6CPDv9uZAIN6TKPhSsH3KiBDpEEnw8oVm1OON2EkDie1DneQsccm3Fsuz2cYm4fkolzC8OAih3FKVMFh9SH4sQM4ZABNhvp+yetXEgAkSU0830/Furr9RQu5rCl/y5SFrk4aBhdyLlOAiCNgmWFBeCpOaAjGmMmO5OdoNIngZ+XWM2y3aBZ8pxz4EAv7ewm+KYOd9kQADSh+FP1Sarb7fuveOcVcdIF5K+m6FicPU0/7/G5fbPwzfJPNM3pLWP8MHdHTCAEuXQ4cfroV9XrLx9NUZc0Dl0Xcn7wEAUOvxqgeSqf5Z55UYnk4x3w2WWVg7TTw0P58J0NnPOcWWctrlxHKeufBEncehTK4D98qc0jO/jEoVyS0gHRd4OU+EXeMNVxj7DStcp/v8UVVgxJF1dJZSs+67QRhyBHs+NQFqXYPsbm01mgaDUANaJiIb8XYcIkTKhi8FRf+h+2lReMgLnvkvgX/9fRa2YeZi6yy/y87m9Il6uekC96bHzd/YexpnXjxR8O3Y/b0Lx63CI8qGbe/GfaZ0t9X/8DDg8t8AdvrwEqjeu1Mdj5JNHF/LSUfgqo0wgJMGGTQUItge6CRrmt903NXeE9qu1qaoExb080wjZMV4w= 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:(13230016)(39850400004)(366004)(346002)(376002)(136003)(396003)(6486002)(478600001)(186003)(1076003)(26005)(30864003)(7416002)(6506007)(6666004)(2906002)(6512007)(8936002)(83380400001)(44832011)(41300700001)(38350700002)(110136005)(38100700002)(86362001)(316002)(5660300002)(54906003)(8676002)(36756003)(66946007)(66556008)(4326008)(2616005)(66476007)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tupO4x0v4T+NHTL3cbeD8llrDrbgo+6zC+VGz4OEA7Ur+VyF4NEzZBsx816j+1NW8fslRcuoZTBXxPK77hEgF0Z1DVAGkfGAkWlTaZZIta9T48bh9v2PWtetIZqwbRL7HyAl69FjASFwyNUoJn7+V7bslN7Hutw7jwdGOujKxIG5ypz9ui36NTg1paCkwRMPOD/zczGWsKDpsW9DJAmMg6yyA0w8+Y/xrwU2SemLmXATyT3tQ+UrpCvka3vV7gVkqYf3pFmbWa3rx8hs+HFfW3ESkZ3Q1fpuOX2TWln77jD8Qw/Hgj+MHjmqnb/wzlnti70BpzjEFDkLffn1Yfv5cMO+zZ2pLm0hyJMIXfFySxHJtfcNA7TO8dtQVWvcODJFh+M2ZdNLLcAMFhezy1hI2wUY4/WmQUDjn6jlJ0QowYMl/LF17tRI9Mjcr3D7KbnWjp2OTgonlCP2yaAoP3SIsd8tw9zQZBCpMg9VK6aQwDcHKApKdOQLR2MQi1wjbeUZsiPZdu2XErK+ZV82ZQRlBKRTF/V3qy372rr5Mwt0dFNrTi3LfKu8eaahv3zDbFWmO4W9eM69FtdjvPQSU01p9ajhparUJAdoEpEH6AJ5bVcSE2c99MvZ51MDe8t/nNOA23Vye+kYG2Mh3HeSupdm8Htcx2NwVUZa/2JM3xUlBS1o2NoyMq8mGyhlRUrFb3T6vRLWtg5xHzUHNL2zFCCmEOj3W6UjSHfKzlAgrSjqL61wpgn7OrIxxJHj8GXqzOHkl2gQUnKweWbvQ8GfY8NE4+QmpCqAq6AlvygZ0vdA4PcHSSKgl8MGoO7IZpvA1r0pz8Loc/fwTeMkkGESbqbHJEZyxT64SFzDqMmM9FeXW5JZmGPuKlMc7vq+zq2/LCzyznmDBk7vacAEI5ptL/l1ir3wM0MTng+/jWX0RaZ7GMIRGjRXaUKPl5krXdFbAv9y15g+tf4pOtyZCk8GjCjyvbL++6ph2eLEAh/cprPfD2Agfk3eNegrPbTorUsGfEQsamnQq/s1ogiH2qX4fSwFpkmABdlUpq1H1yMN2Bg6v+N748PXRqTQd+Af9LQqNgQ8PZUGSqUn7DUaPRpa9ANoMEqw6Fs6miLQtOrbGXWIb3hWEurS45aYmqgleq7o4XTS5lyDng7HOv1NLVGX1M4uH0IUz5J2OQaQEvfxRqdyQHOrkbgtlxGF6gboREHajRfTqP25tGu3J0mxKnGJR2N3ki63Jn3Vhj7m3R/w1GsDFpOkRRhJO+xwPfQ6vjhCxO3DIonpSRMcP62g6R4JGXXoLLfm6KwCjV9nBN4HNOWKnnG8uD6YKI/0evTlYstFb26KRIunfKHj8RIggPakgVQx6w59HwJQYIT1aOBHcnZlL+ExngNcRFqJ8kYRZjOfhwLMEPcMqBiA/qSYE1pQ7Q9ytfpRyeqQh4HkpT69YtpMEy0eXo3aqViT072oQ4k9jexFIwN8uIMayYLrmHG3fxfbllUXqGyabDBQjA3xze1Miw7SIFhngvojynTn8z9K6PIzMW3yep4izcx5ZMOEIaOYMdhywbKgWXWc2fny6ExJqfWxpBZ4mDcM5IataGWPjgdgMEjOw5iEgZ8JSf3FpGFr1A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26d60558-db85-4280-6c22-08da76522e90 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 19:47:37.2271 (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: y9zjgswVNPmDzCX0wI7Ax42QIwgJQgbpfO4n8SX2g6Ur3KynSoIalguBXpJtFftgl/sOIkfuLHrQeMgHjYcrjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_124753_425239_6E56A4BF X-CRM114-Status: GOOD ( 11.76 ) 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 Now that we actually read registers from QSGMII PCSs, it's important that we have the correct address (instead of hoping that we're the MAC with all the QSGMII PCSs on its bus). This adds nodes for the QSGMII PCSs. They have the same addresses on all SoCs (e.g. if QSGMIIA is present it's used for MACs 1 through 4). Since the first QSGMII PCSs share an address with the SGMII and XFI PCSs, we only add new nodes for PCSs 2-4. This avoids address conflicts on the bus. Signed-off-by: Sean Anderson --- Changes in v4: - Add XFI PCS for t208x MAC1/MAC2 Changes in v3: - Add compatibles for QSGMII PCSs - Split arm and powerpcs dts updates Changes in v2: - New .../boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi | 10 +++++++++- .../boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi | 10 +++++++++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi | 3 ++- arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi | 10 +++++++++- 20 files changed, 131 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi index baa0c503e741..7e70977f282a 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi @@ -55,7 +55,8 @@ ethernet@e0000 { reg = <0xe0000 0x1000>; fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy0>; + pcsphy-handle = <&pcsphy0>, <&pcsphy0>; + pcs-handle-names = "sgmii", "qsgmii"; }; mdio@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi index 93095600e808..5f89f7c1761f 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi @@ -52,7 +52,15 @@ ethernet@f0000 { compatible = "fsl,fman-memac"; reg = <0xf0000 0x1000>; fsl,fman-ports = <&fman0_rx_0x10 &fman0_tx_0x30>; - pcsphy-handle = <&pcsphy6>; + pcsphy-handle = <&pcsphy6>, <&qsgmiib_pcs2>, <&pcsphy6>; + pcs-handle-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@e9000 { + qsgmiib_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; + reg = <2>; + }; }; mdio@f1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi index ff4bd38f0645..71eb75e82c2e 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi @@ -55,7 +55,15 @@ ethernet@e2000 { reg = <0xe2000 0x1000>; fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy1>; + pcsphy-handle = <&pcsphy1>, <&qsgmiia_pcs1>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiia_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <1>; + }; }; mdio@e3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi index 1fa38ed6f59e..fb7032ddb7fc 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi @@ -52,7 +52,15 @@ ethernet@f2000 { compatible = "fsl,fman-memac"; reg = <0xf2000 0x1000>; fsl,fman-ports = <&fman0_rx_0x11 &fman0_tx_0x31>; - pcsphy-handle = <&pcsphy7>; + pcsphy-handle = <&pcsphy7>, <&qsgmiib_pcs3>, <&pcsphy7>; + pcs-handle-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@e9000 { + qsgmiib_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; + reg = <3>; + }; }; mdio@f3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi index 437dab3fc017..6b3609574b0f 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi @@ -27,7 +27,8 @@ ethernet@e0000 { reg = <0xe0000 0x1000>; fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy0>; + pcsphy-handle = <&pcsphy0>, <&pcsphy0>; + pcs-handle-names = "sgmii", "xfi"; }; mdio@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi index ad116b17850a..28ed1a85a436 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi @@ -27,7 +27,8 @@ ethernet@e2000 { reg = <0xe2000 0x1000>; fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy1>; + pcsphy-handle = <&pcsphy1>, <&pcsphy1>; + pcs-handle-names = "sgmii", "xfi"; }; mdio@e3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi index a8cc9780c0c4..1089d6861bfb 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi @@ -51,7 +51,8 @@ ethernet@e0000 { reg = <0xe0000 0x1000>; fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy0>; + pcsphy-handle = <&pcsphy0>, <&pcsphy0>; + pcs-handle-names = "sgmii", "qsgmii"; }; mdio@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi index 8b8bd70c9382..a95bbb4fc827 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi @@ -51,7 +51,15 @@ ethernet@e2000 { reg = <0xe2000 0x1000>; fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy1>; + pcsphy-handle = <&pcsphy1>, <&qsgmiia_pcs1>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiia_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <1>; + }; }; mdio@e3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi index 619c880b54d8..7d5af0147a25 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi @@ -51,7 +51,15 @@ ethernet@e4000 { reg = <0xe4000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0a &fman0_tx_0x2a>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy2>; + pcsphy-handle = <&pcsphy2>, <&qsgmiia_pcs2>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiia_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; + reg = <2>; + }; }; mdio@e5000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi index d7ebb73a400d..61e5466ec854 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi @@ -51,7 +51,15 @@ ethernet@e6000 { reg = <0xe6000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0b &fman0_tx_0x2b>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy3>; + pcsphy-handle = <&pcsphy3>, <&qsgmiia_pcs3>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiia_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; + reg = <3>; + }; }; mdio@e7000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi index b151d696a069..3ba0cdafc069 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi @@ -51,7 +51,8 @@ ethernet@e8000 { reg = <0xe8000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0c &fman0_tx_0x2c>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy4>; + pcsphy-handle = <&pcsphy4>, <&pcsphy4>; + pcs-handle-names = "sgmii", "qsgmii"; }; mdio@e9000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi index adc0ae0013a3..51748de0a289 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi @@ -51,7 +51,15 @@ ethernet@ea000 { reg = <0xea000 0x1000>; fsl,fman-ports = <&fman0_rx_0x0d &fman0_tx_0x2d>; ptp-timer = <&ptp_timer0>; - pcsphy-handle = <&pcsphy5>; + pcsphy-handle = <&pcsphy5>, <&qsgmiib_pcs1>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e9000 { + qsgmiib_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <1>; + }; }; mdio@eb000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi index 435047e0e250..ee4f5170f632 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi @@ -52,7 +52,15 @@ ethernet@f0000 { compatible = "fsl,fman-memac"; reg = <0xf0000 0x1000>; fsl,fman-ports = <&fman1_rx_0x10 &fman1_tx_0x30>; - pcsphy-handle = <&pcsphy14>; + pcsphy-handle = <&pcsphy14>, <&qsgmiid_pcs2>, <&pcsphy14>; + pcs-handle-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@e9000 { + qsgmiid_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; + reg = <2>; + }; }; mdio@f1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi index c098657cca0a..83d2e0ce8f7b 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi @@ -52,7 +52,15 @@ ethernet@f2000 { compatible = "fsl,fman-memac"; reg = <0xf2000 0x1000>; fsl,fman-ports = <&fman1_rx_0x11 &fman1_tx_0x31>; - pcsphy-handle = <&pcsphy15>; + pcsphy-handle = <&pcsphy15>, <&qsgmiid_pcs3>, <&pcsphy15>; + pcs-handle-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@e9000 { + qsgmiid_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; + reg = <3>; + }; }; mdio@f3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi index 9d06824815f3..3132fc73f133 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi @@ -51,7 +51,8 @@ ethernet@e0000 { reg = <0xe0000 0x1000>; fsl,fman-ports = <&fman1_rx_0x08 &fman1_tx_0x28>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy8>; + pcsphy-handle = <&pcsphy8>, <&pcsphy8>; + pcs-handle-names = "sgmii", "qsgmii"; }; mdio@e1000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi index 70e947730c4b..75e904d96602 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi @@ -51,7 +51,15 @@ ethernet@e2000 { reg = <0xe2000 0x1000>; fsl,fman-ports = <&fman1_rx_0x09 &fman1_tx_0x29>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy9>; + pcsphy-handle = <&pcsphy9>, <&qsgmiic_pcs1>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiic_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <1>; + }; }; mdio@e3000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi index ad96e6529595..69f2cc7b8f19 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi @@ -51,7 +51,15 @@ ethernet@e4000 { reg = <0xe4000 0x1000>; fsl,fman-ports = <&fman1_rx_0x0a &fman1_tx_0x2a>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy10>; + pcsphy-handle = <&pcsphy10>, <&qsgmiic_pcs2>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiic_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; + reg = <2>; + }; }; mdio@e5000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi index 034bc4b71f7a..b3aaf01d7da0 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi @@ -51,7 +51,15 @@ ethernet@e6000 { reg = <0xe6000 0x1000>; fsl,fman-ports = <&fman1_rx_0x0b &fman1_tx_0x2b>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy11>; + pcsphy-handle = <&pcsphy11>, <&qsgmiic_pcs3>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e1000 { + qsgmiic_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; + reg = <3>; + }; }; mdio@e7000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi index 93ca23d82b39..18e020432807 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi @@ -51,7 +51,8 @@ ethernet@e8000 { reg = <0xe8000 0x1000>; fsl,fman-ports = <&fman1_rx_0x0c &fman1_tx_0x2c>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy12>; + pcsphy-handle = <&pcsphy12>, <&pcsphy12>; + pcs-handle-names = "sgmii", "qsgmii"; }; mdio@e9000 { diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi index 23b3117a2fd2..55f329d13f19 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi @@ -51,7 +51,15 @@ ethernet@ea000 { reg = <0xea000 0x1000>; fsl,fman-ports = <&fman1_rx_0x0d &fman1_tx_0x2d>; ptp-timer = <&ptp_timer1>; - pcsphy-handle = <&pcsphy13>; + pcsphy-handle = <&pcsphy13>, <&qsgmiid_pcs1>; + pcs-handle-names = "sgmii", "qsgmii"; + }; + + mdio@e9000 { + qsgmiid_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <1>; + }; }; mdio@eb000 { From patchwork Thu Aug 4 19:47:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936677 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 115D8C19F21 for ; Thu, 4 Aug 2022 19:53:57 +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:References:In-Reply-To: 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: List-Owner; bh=voqTgtNfThrOAf633NtbqqJoiL9iJOyTr/P19HkbObw=; b=0FTC09kB3GvmFe 6UFUrVK6by21UGL45bdaVr1DI8tMrpChrWiv++zgTb4aWzm8DfGfK1U8dLaFduBfCYM4ttAK3xNDW NA62sPkS/sxPlcFre7UsT3+EtuZLg7e4MvpHG2tVbYL41TgBTHLM2fDajUEYlPN4AmqGWG+qob+i1 phdZX3D0/f0P4v+PCJZ1XDBj14DnL9HHsQ9psTBWsxXub7GP0IZx/VXEoDrxNWKSTdFbpiIScn5CQ 0IL+nAAwOu4N7IuNWCM8N3X6E20dzqv5NrDpo7NWsdgWPK9XXxSeFBPaa3s3NEycb2aZ5monUfJVS l8rkv+N/NzO0hUf73fXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgtZ-008j7U-Lg; Thu, 04 Aug 2022 19:52:39 +0000 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJgp2-008gwv-Me for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 19:47:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPC7zdfOAtSfg5Yfhteu4pPWi4xBe1xleu7KfO08FVaAGEFlmixjITJqXJKtN+CIt2SUaFBUDOzFnhXBeLx+F65WYheL+pK2b6h1J+rowh1ZPXcMtr2EDcmK7z21mbm3A/caimN/a3rq2NAnH1ISmfqeEu1XAak+DmXxE2M9VxtOHtMrTxyb1ch6wALfId6jeo2aF+Qchs9Lr7jn4w74fw3SZIc5RvKgDyIq2TLnAl5YK6Dt4MLfB9yX2lX15gC7Jy8989csz2uS4DAjdvPskOhUIlfnOa8qRktbr6y0fSXEAL/UJWR/Y0cEBrAnt1pkXTZCXMhbkKdi2XdcZtWhAw== 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=U8mr+E5E/bquLjHtd3y1fs2FBigd04YzSdV1VetNIuY=; b=ff2vFqkJwPrfGWUg0/xvVqxjdJTGPEq9+hvjWSbYJ7iMFwggzA/YkffAIYxPKbmmzpgQs3Pios4PVUImapMa/ED96UszJ10GF4qH77UKVnxqogWGSfH3TRZVfhed61f72ht8p45pP9ij/tW+VnOGuvpuj7Q26P4LMxgKQzjd+Poirmnivd/sCMSE+cLxtwJ/DZ1yYQhgOt8b6ok/R05fObykcNtC2amnfSGlFtyYS2/K9bRv6MX11tv25WBvT63ZPXJA8JMPDeI5ZbkcvkRZA6u2N8i4SVZx1rEyLP4qyQUU/iKTskezgSsdMbasUKFttFDT4J1S5B2V8o8lmTXCMA== 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=U8mr+E5E/bquLjHtd3y1fs2FBigd04YzSdV1VetNIuY=; b=0WGV3TG/H2yH/+mjsWnrzl5jJQ9vdJJjImtNz2jpvzSiqyu3wZ6VuFtZuUhq3kWf1KaEr42Inb+XcDmsKn+Dq017GUuQjktjuh9+vjo0qIifdMphNupVILO/b1mELXG3S5PcBf0PicHFMui9pIGpZfhkFmIIX15SWi82a2yc57cjI/rUnCooaPApojvF8HLnaH6hRqvifS1UUwMVdcogO1RrHLxDGc7dETzsIZ0HfEy5gMA7vXWuZf1pW2UWp4CqYhwAeLMU3N0SHHrc599faPsPy8HQPvQaA173Ml3hBleFsiS5ecxE65lZp9ijncu3Gy1SBNUQ3cHGDu2ymzL8dQ== 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 HE1PR0301MB2297.eurprd03.prod.outlook.com (2603:10a6:3:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 19:47:39 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 19:47:39 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: "linuxppc-dev @ lists . ozlabs . org" , linux-kernel@vger.kernel.org, Paolo Abeni , linux-arm-kernel@lists.infradead.org, Eric Dumazet , Russell King , Sean Anderson , Benjamin Herrenschmidt , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , Shawn Guo , devicetree@vger.kernel.org Subject: [PATCH net-next v4 8/8] arm64: dts: layerscape: Add nodes for QSGMII PCSs Date: Thu, 4 Aug 2022 15:47:05 -0400 Message-Id: <20220804194705.459670-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804194705.459670-1-sean.anderson@seco.com> References: <20220804194705.459670-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::17) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e97bfe2-d858-4392-b6ec-08da76523006 X-MS-TrafficTypeDiagnostic: HE1PR0301MB2297:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fXz+PRqQfnUJhVLFFaljw+gXGyBTjQS8cE6H9hjMXTUslY84RnK9UQv222at72j/7VGWFgRckHFJnKGWm8+jjnPPOMKwK8ByBaM2VtRuh9skmVDWsCXO+Lho+ZUIxxplfZTYFiwLis7pNWzml6Nan74cFlupwG6CERETv9YtVJKz2z+OTMfvPiSaRreGs5uDtzHWyp9Um5yvuuvN76vNXiCvVoQf540wy7+ZHI+fSgsFqWdB8N4ZCbTxZWmupfFXhgAQD7VhOXJuk2Rq5s7h0+NS1TgW80HD1RNu7Ed15E6PWqZ/CWRBEBfngsXM4cv4Rz9G8gk2NMtroa67fHJ0x783o9UqH02a+k6kdIbFA8MmJxR/oJ1QLtV0rI2rQpS77HdmCalyGt+0dsz+6ELPY0AVZbVkH77cz0fsF7NF9JEq/kK0HvdIMe0q4DSWZeEZgD5va4PIAV9guQgRMzguauR9yKlFX+d9Ji+ZijgUsQIrvveGBPKP8g0PU4Tw2QpsAXqIackLD+MNbEg2rGwVCKA3q15hx3IHXu2HjciWaoaj01tHqbNhY6ZFIjaL716s02a34lI6oF8a1iOrdwDMP74gu637FHv7gUOsmUXP30M4sgbFhhcoFAKX3qZ+2GyCL7fcgoTRFvRzCSHTW4wvjQ7Xw7Pn70YvFfQ5DSgAJ2Q+IxS4nADULRzEgS56AvYLmkhPoSLrJbf2aqg9LfZRVQVZ/T8bBHemeucmUsBtmAATNnGhZsdhIlNZxOGtbh7CPzzIPQ33K0JJkFJsBHPJhGl+4pGg6IeA50FOLmroDl4= 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:(13230016)(39850400004)(366004)(346002)(376002)(136003)(396003)(6486002)(478600001)(186003)(1076003)(26005)(7416002)(6506007)(6666004)(2906002)(6512007)(8936002)(44832011)(41300700001)(38350700002)(110136005)(38100700002)(86362001)(316002)(5660300002)(54906003)(8676002)(36756003)(66946007)(66556008)(4326008)(2616005)(66476007)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Uw6Z0tJ6jATFY3UNc6VaNQMlx2+4Y7eUJNGwneaqQM8pVXOstNggFtZ8BBr0bc/Bo2gSp20y+h6mYeqY/3uoHrVJtQFhSrZQvCn3wNu8Kv/MmzKI0Fhbx6KYJVEhaNtLq7ReV5hHdu4dWgWqQodRNqMl3fusfQtNDr6QA0Oiu7ziDVehroEi6R80imRV2g57EfgqZn0dWy45sFUscck34tVUquaa8eYIoX2SAr9/Sb+rEEs/uDuF3+lPKISruXUmNWR4luaZCHG1QiW/DU8Dg1bNr/a6vx9ZtaPYFeRwg27IyuVdf2HXT6Otqm/x8LZG7FbOq9j89ogc84cIi7CuYDhtC856b+Zl67sw8eEOIb1sni6Q7GaQnNRGqybEQ+vgzwpcj3nRgQ32GDWZoFSghcxtc4TG6IJkjxbj1QhJKSoQ3uOAc3gcGL2rznOeoW6E11vzQKfjEwvN0JNQl6xgEB4yMwaGR5V6C+FZi5jaKlRzNY7BIPgI1yAksaOXGPIltV9qBEhMEaRgjVPCqHdaNtACKpxQLp4GHGjoWZQ6/7AcX1brAV+vTVTtNWTCMjKbt71nhKPEVLX5uRLb48pwcp/ZT3qhowFE+jLka7CUdc1jd5lOTVaNoAn5Fv9/2PnW03cJnMnabyXbks0UkryNOu8O3KGuMsqR7OQmn/QJyCrP68vUY0bnm/sUDmwzBvSaTEEiIIhRIPEkvFFYswWPpsxrwla8KsaGsnw/sOaouNisss0HJ0qKmAQdYqH16oXMNsSZnAl+tHb7GmV2haMoGsfcwkucO2fz+/vSk+l/6Hu6z7wVTteZ9elYJr1bbxND2gAWEKaaCku/fBmXAtmQFsvo4vlHLuR9MtQ+ACD+ocGw3t04iKtHLqCEigyse46QS2uEPG4XT6LqAe4pjo92Ox5Rd1HlPwN++K7VlDyaqJcBf0OlX/rUHkMxkF742B4o3cGTB2xnL0ACfH0ef6sY1Cq7ZBMWjhmFySEsZ1NzkiyghMFpd9K/7Z2Wne/iyKRwLvTjwlF+59wj8NlGU+HKqx3dBhEuW+Gam9XJCIQ6SvCx8cOLL2yn3qio4wX1aieIMl4eYJB4M8hRTUXC4GQ9bN/VWN+lVKUmPDhlaSibor0dzsUlmArlKyUl5+ucbBMhKCMu4RZS5sYgy/uwrx44zYV179feghXVJlH26TCbqRMjDJWS7mBxe7xFUpK70OZLGJ2C6fKQAqnA4EBSZ+FZFxe1/SXoF0TeoEpLByTfSNxcmO6qrrTjJJ09usNDDhjrWqfmwJ9KwKvYOj8ClrjCTXyGDQqe3jm832NdTZN9jxIHXglxScxIB55pXFRVU45zTOE33+GjYvv1yTqmwJQ/V/qC7HZCnXSEBTRUhjUD3yalp+YgBtjDrZdWLWaseSETikL/bkFHqFe1JnksnXKGQouijrRXtCwz8M2VdOTDYLIDw6V4ITFW6sS//m5MbFObaiQQM0akR8jKG0PcqvNg0IBItkK45Cl1MuwFdc6SOd/uZBOj845UzQBMLjtZkf+acoDBEMVma/pkS/LitezqPEaQvuqpaUVrskjKdeMoDByE3ayZr/k2izxOtJuEn8raNbNLkisOI1hs8V1Do8CBQw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e97bfe2-d858-4392-b6ec-08da76523006 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 19:47:39.4457 (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: Y8E3xJV4wkfFtIDNQBlOHniGSQbfjXUq/Me/tq1uV8K7JFGo6kgFPh5ApKnkOMcuDQuBgVMDfIOA1HD288MgDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2297 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_124756_819673_ED2766E8 X-CRM114-Status: GOOD ( 12.29 ) 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 Now that we actually read registers from QSGMII PCSs, it's important that we have the correct address (instead of hoping that we're the MAC with all the QSGMII PCSs on its bus). This adds nodes for the QSGMII PCSs. The exact mapping of QSGMII to MACs depends on the SoC. Since the first QSGMII PCSs share an address with the SGMII and XFI PCSs, we only add new nodes for PCSs 2-4. This avoids address conflicts on the bus. Signed-off-by: Sean Anderson --- (no changes since v3) Changes in v3: - Split this patch off from the previous one Changes in v2: - New .../boot/dts/freescale/fsl-ls1043-post.dtsi | 24 ++++++++++++++++++ .../boot/dts/freescale/fsl-ls1046-post.dtsi | 25 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi index d237162a8744..5c4d7eef8b61 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi @@ -24,9 +24,12 @@ &fman0 { /* these aliases provide the FMan ports mapping */ enet0: ethernet@e0000 { + pcs-handle-names = "qsgmii"; }; enet1: ethernet@e2000 { + pcsphy-handle = <&pcsphy1>, <&qsgmiib_pcs1>; + pcs-handle-names = "sgmii", "qsgmii"; }; enet2: ethernet@e4000 { @@ -36,11 +39,32 @@ enet3: ethernet@e6000 { }; enet4: ethernet@e8000 { + pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs2>; + pcs-handle-names = "sgmii", "qsgmii"; }; enet5: ethernet@ea000 { + pcsphy-handle = <&pcsphy5>, <&qsgmiib_pcs3>; + pcs-handle-names = "sgmii", "qsgmii"; }; enet6: ethernet@f0000 { }; + + mdio@e1000 { + qsgmiib_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <0x1>; + }; + + qsgmiib_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; + reg = <0x2>; + }; + + qsgmiib_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; + reg = <0x3>; + }; + }; }; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi index d6caaea57d90..4e3345093943 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi @@ -23,6 +23,8 @@ &soc { &fman0 { /* these aliases provide the FMan ports mapping */ enet0: ethernet@e0000 { + pcsphy-handle = <&qsgmiib_pcs3>; + pcs-handle-names = "qsgmii"; }; enet1: ethernet@e2000 { @@ -35,14 +37,37 @@ enet3: ethernet@e6000 { }; enet4: ethernet@e8000 { + pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs1>; + pcs-handle-names = "sgmii", "qsgmii"; }; enet5: ethernet@ea000 { + pcsphy-handle = <&pcsphy5>, <&pcsphy5>; + pcs-handle-names = "sgmii", "qsgmii"; }; enet6: ethernet@f0000 { }; enet7: ethernet@f2000 { + pcsphy-handle = <&pcsphy7>, <&qsgmiib_pcs2>, <&pcsphy7>; + pcs-handle-names = "sgmii", "qsgmii", "xfi"; + }; + + mdio@eb000 { + qsgmiib_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <0x1>; + }; + + qsgmiib_pcs2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; + reg = <0x2>; + }; + + qsgmiib_pcs3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; + reg = <0x3>; + }; }; };