From patchwork Fri Sep 30 20:09:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995956 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 9D41AC433F5 for ; Fri, 30 Sep 2022 20:11:20 +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=981eE+qImfALf/JhmG0XHumGpAiQyY8gJJLDfFISwhk=; b=BIff8ngEIhuEQd CFto8bMbayq0q38kiFwZVG8v31fgceY/f0BOBb69AFanDYKmBVngSlusi7vMZ5LwZjqsR4xGt6aSn edrfRrB4ORkHYD6ST+3ZbOnybVRQAln5CDPm7YXw05ipEd81VpmmsUL8Zjxs8DtDrlIARU0V4r5OO 5rj7ULMPWpCS8YJ6wFv32SH7tKIVU420xl3EziKFRkfpVgDzqUcMHZkydtfiTI8OPgysicvOOlkPS bGlLCsXefTN4a4Dywpwy+z5k5d0/oQJt2p0NXi+IFzP/uxFUFUnsVv9XkzmNacREu8+Ta3Sw7xcbw 31ZFYD/9cXojw3JneUfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKn-00BK5T-FK; Fri, 30 Sep 2022 20:10:09 +0000 Received: from mail-dbaeur03on2073.outbound.protection.outlook.com ([40.107.104.73] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKb-00BK1P-G0 for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:09:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i2CZ7Skjhl2yNAdcwoKWF1XMdoSfPO6RupNbd/XBQ/sooqB75//6tog7yEx5i8QBdQnAcJaeqVsCFjtNTDeZUGQKiEYUlxFAj4czcB9Lqcke/XewrMF3RdkPhtrw0ZC56PRfbRFXErV4pLW9qvprak147l8CtiL1sobchUui5Gt5JBSfiA9T222H7HBpB5aTz/QJUAIb3N9J8ZdHIrWf6fhK+c8Q63pN9/nXf8qEY8DEWxMSkpMUF4qXJp4dtFlBCyYFJCDjNS1uQ0xhK3yPeBsiiNksQSQnwcYVytfTppWPWtOeIFnxfghakWiQ40nMQ/RcGeuzhd8Nv7GqDlb+NQ== 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=AXjLqwWMpV2XpC7fLGy5gkAmQLz7kjCf3t5/IDdyekg=; b=GEKKSfDC1wgOF5hf7c31OKcVbOhrZB5V2V54k9bgMqyx3CaoXUpuhcjf5xOib7To2YpsZXiQfF/keUAvutwlOvIjIWGfaF5KH9dhF/CnnpTJYQdDTV2/VKzbVMakjEJk8UvDp0vJeYwUPIxOeWMRGK3Z9GyOoMyBmP+CSjoDhi61vySSj20MToclg91AJpDlvhV/cneoYFcYlYMG9KcClHOzmS0QF+Gb8NrI6KybPbgTy5LHDz8gczRFQakAYauHak8ga6mbS9u49Gdf+zJsq+9FVQkLYKLCeK1uKyHa5BHPRPoQPMD/GwTPH2NdGt5KP0pip/1d0lJtVlepCiG1mg== 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=AXjLqwWMpV2XpC7fLGy5gkAmQLz7kjCf3t5/IDdyekg=; b=S0EXexkR7gozFnVOSAUEwtjuVurQbPTijOZyQO03IlrYPnArIGp6YtAD5XKShWrWnlUTYGtYjeSXQgPnoKDx9eGU1YOvjH9Ytng/anLOP8EMR7g/xAdaiTREpA9lg0v85+vdj291Ku1SwCTwI4G1CLhVA1KAsIpc0ckQ63rrSSMSyEoCZ5jAMMKfbQK0FOhRiwt7E45VjP7v3Yf3kMPvZdzpiqa+Q8GWK2MDxmeHfyhbZ2+WM+YOtSAXyQeNM+TdMsUWhh8Sl0f7Erw38k24a2roPzJDzjduA2QAL54K8ANPvUQUg7lEXqOEEKqM+5MhuFVjl5247ZG30ZMOp0eg0g== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:09:49 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:09:49 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v6 1/9] dt-bindings: net: Expand pcs-handle to an array Date: Fri, 30 Sep 2022 16:09:25 -0400 Message-Id: <20220930200933.4111249-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: f3f05b0c-421b-4bbb-daea-08daa31fba2c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fHlprHe/KE9vtRbLTLac4q2HTmMGg+Go5YzME30kNApyyI5SVYzLXioY2+JFDjr4Ob/mWWuaVpXO/puuZsrLehd+t+JS4mvCX7aFEtRib5z4e4EOPLCpciVsBIY6btydZzz2c40OK8eruv6+pd3e/O52lZOfPzdWxh3jdju4Nn+QWRUOqITHBRERUg6YIB/S1mfRxH5DRHbuqJBDrsaAZOW97HGijk9+qLK274LG8KdZ2Zwvfs0pJBez3DuTvQaXRJkNlI1u1i0NvyRXdbEobL8VQOj2toeomIRgMhNggQU2HxzjE8qOHAGORXa/fqEmfqO5eaxF4C+zCGep12C823giwQSI7erQ7yXN/hFAxvkU2o464QMZZRxuk4+fdnBRz9zq88TKF19vZYm6HSdFRIUWLGxVDfcWWtbYutEoPJGSPvkyXGi1TOYDl68i0rgkMpEhmtxAd3zsG/VT2RhU1X/NdohyPUdUXi34HiWTYcwl11rRhggkuArSMjVw+BFIPRBe5SkqZCKBgaUv+OOf8eZKTvjppN9wX/nXTaOJpB8pFmVMFPUd3uHgn4rO6h3ICaBi+9ArMDle2v2hNYvvyqMwpxE5UkVs8voB4JGf3W0vJKDkn2JbwcOpm7ejcL3Et1MTmA1ma3ZtpdledAOQy9W69jKD1zufh9/qS9sN4w94MGzF91Z3OoKi2L9WyBxmZKb4No+zNMl2ud9IMfbCsBqvuC8Q3iDpVbEnrg1tUZ/m8W4kCmQ4AgHwRCkt54n1vTMyzHMkLG6ppVuTu0/F3HB9GkBBT5TERSDSm1aqaoQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(83380400001)(41300700001)(36756003)(6486002)(966005)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gLSdFyfSkBAU/E21cP9rWqTRm+3Yz7lenHMSk1UpMJ1Xrrv3+qb7qgcr26jB66naE7300vzdJchUnH5RzcP9xK05lZQVp7tQ2p1F7vOyBqgnwgnICopBXxZhJnLN8iI4c9pE5/2GFcaign3kFdPsZSxPaDB1HENaUM3nH+qgkv2szOPLMA8h/ZTy9lXTApZxnkzivrtJcOhNEW1WckX7szZx7YzvxU6TDU94NfXF71fWcldgMkHIgY2Winx2zMkT6Px5wEohO5VZKTmijD53w0+Xyxsin12mhbWp9V1UckK6Al1gWKXYgaWXbK9/RG4nUyTdcr09Ma4WOzqv+dtmu4ss/a05OYflPgT+We9QCTkuLd3oCACoYI0ht248xKSZSqJhWNqnnmN7bVn0+SI7hcNyrmA2/wHU6hydprAyPmcckW8r1Ew6XxjJrJp+coD4Y8RTn2hpU42nJ+xGSjfap67u/3LxX0o1QJPk2DmSQL9dX8c+ZQMlktOaON6Zv3hVuusqisPXQso623Mg9D34sHjGP0cKX/4INViTEMaHjfgNU+9cZsgwzqTJAX+1K9/XJ96enUgZQFmaCLakATkcVUS68pH5B/OiakqOKbyuXh0RznjGOi3m3++gOeWf3PS407FpJ8U73uvSAIH551tV+PpgxtSB9vJzfYlxPr/JKaU/K8xkH+U6D6cDE/I9lz2nPEvdD8l0ycqIcACTdnxffMUrJExzUrZQAjteXQ3sl1e3G/lnm2fOAQdKKEeqVtcdHGR1HDZwF3YsCgqD2r8hkhM5VsDMhs0bqji7lRaFQmfEzty79lgngSSR69ay1Ha57lMVftLSHvgmi7ufX5AetcpJ21qF02qWtvaP2J0aKAfCLBwYxNv6Orc9/uo8c+Fj7/skrHpS9+bP6pQqNfFIIwIwi7DEmntSHN1iP9Hmuquxmhg+5L3ebyT7OC5LswLlErFemDBvHv3D3sM07fkdKB1wZMVf2e5iSJeU69q0XwM5RsuzQZSJ+gVCErCwwHdzgjyBZk13rS2MG/pcGRO8pdmIDrVjasPo954Stq1qIhJh4IuXAz9oz+0ehnuuuZdJPsNdm/4oCLx9xLFt/tBOMCEZLbaKXI2mDbEZW9OO4LH+24TOxpES12vYbHtz1lnIPr+jqSqvnRsGuwkLXKjQPj+X8SfH1G/OlONT67un4bJafc9Q9ml3s0ghVGW96zTMD1GGccBjyXsSLS9aI2FduOnMTaO8e1rvLVDyxwHVYE1nhsMDny902vqTXoYOo8uknz9zLTEHlRFcWHiGRywlxQwzJjQVsQoCdCl/4ybs/NnQzCMDwtfuFUUsexUbtX7B8PFveqzhj73BK4kiYTvH6xntxIgFfw6G991zEiP5uqykwdUOZX2mvhGehzXhNQSPDl4htQfPpv5w3V27lBn4HSWyQkz2nj0e3edRh3CtdhB+lFA8pfJHshQJqAKQOw9QI7naN43+GI03FGJpOcp2VZoOQ0kmptcHTpVOWg2NBr7k3v3fHVpu7ubsLvGRZdijaeUJamct7Kn4gg3vQWJjePT0dxLHyy/Mqyw0Uxh1i1qvppU9gECebf2YVH2eU2dFLKKCcIxshibE2s4I3OiMSg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3f05b0c-421b-4bbb-daea-08daa31fba2c X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:09:49.0724 (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: r7ATmW9qE6+M9re+ssfqZZWQp54KJ+2IyMpOOuaCl2tIEYnybayTOP0x7GaN1oz7zzu6CvuAOBYuxBscpZCToA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_130957_560310_1924E165 X-CRM114-Status: GOOD ( 14.09 ) 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 Reviewed-by: Rob Herring --- 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 dependency from pcs-names to pcs-handle. [1] https://lore.kernel.org/netdev/20220711160519.741990-3-sean.anderson@seco.com/ Changes in v6: - Remove unnecessary $ref from renesas,rzn1-a5psw - Remove unnecessary type from pcs-handle-names - Add maxItems to pcs-handle Changes in v4: - Use pcs-handle-names instead of pcs-names, as discussed Changes in v3: - New .../bindings/net/dsa/renesas,rzn1-a5psw.yaml | 2 +- .../devicetree/bindings/net/ethernet-controller.yaml | 11 ++++++++++- .../devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml index 7ca9c19a157c..0a0d62b6c00e 100644 --- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml +++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml @@ -74,10 +74,10 @@ properties: properties: pcs-handle: + maxItems: 1 description: phandle pointing to a PCS sub-node compatible with renesas,rzn1-miic.yaml# - $ref: /schemas/types.yaml#/definitions/phandle unevaluatedProperties: false diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml index 4b3c590fcebf..3aef506fa158 100644 --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml @@ -108,11 +108,17 @@ properties: $ref: "#/properties/phy-connection-type" pcs-handle: - $ref: /schemas/types.yaml#/definitions/phandle + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + maxItems: 1 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: + description: + The name of each PCS in pcs-handle. + phy-handle: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -216,6 +222,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 Fri Sep 30 20:09:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995959 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 44BCEC433FE for ; Fri, 30 Sep 2022 20:11:48 +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=Cc9T52M73v2pRex3H2SwPR6nssSkIXNuFoYZ7QKPZGw=; b=BG7EIj1IxxOoVs JyWHMkaK5Ac81+T7BK2m5ttliDhMYvWEyC5KnP9//0rdH93PVhqI0zqF6rZ0jArru/ndypq0p2ElP ukd/WQ7fLub7E1U6dQ6RSp5jVgD1zGuPNu+mcXVfiuIvJTbpbTHpyXlQsXGfsN5EuaTJ7kUqfvB8p 7f06H7Ax/R+f0My64uGzem++yTZGrNDc99XLd4Fs3Yr2hLGpSq3WDyPNrnm0GoyOGSwfrhYGyU4au MhzMcy10SX9Hmjw1ame5p7qFmNyouvC5OqwXEsgOYaJIL5HZMcIpC0vaMXYjZQJ5mtXLHrTnnnGYs aqFMuDNvBNcCIUtETx2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKw-00BK9O-Hz; Fri, 30 Sep 2022 20:10:18 +0000 Received: from mail-dbaeur03on2073.outbound.protection.outlook.com ([40.107.104.73] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKd-00BK1P-CK for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:10:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nc4xSeht9ZvV7rPyMC42rVC66s8xO5o7dwYTLtna+M22JvF6TqKXGxvFl95cy5iFCavDc7Tej68UM90PkVVtDS8AW4VaoRIJIbMX8+LuX8tmzkT0aWvoCr0MlMhygS+N9Yr72R/pmT8PyKVDykwRnmzdYgKLfedoqNyXeKMaelrRC4xDW9yUPeECOrSCLc+Ef2CrfANLOPWT6EVrlg7AjyBNty5xsPGJZMFiFO78f6+RaA6ySFeRnQkTl+sMDLQfpcr87DsyP09nLibuvSyxupRWO28ngHzWm9Xn+xif2L4n/w0CFIVJ0iWVf+eEZPjWn9UsQH3FAYS1vfW9mMF3/g== 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=OiB6zoWB32H0EkrMl3eZ7akSCrZvMfmnm7jIt71Dpkw=; b=WpxKjy4i59wpoveX68iudh0avq02sKoQywoYxpA3WKeFGq6LFSYxQVCrFhVCdhDJ3P1RW494rnANCWaLwx7rGvVMTCkSaYDPYK4bu8aiDtDSKvRABRcoJIYRu2ixNIeJ2UJLf4nJXj8Wk6bC4AFCeTZ8uDDNyuuXf2AiwxxcDGdD8wEU+CQDUrG6bkgFRv+uvWbDix08DmtsgabR85CSwK8XcOOcN2HNQMmyUzmPqcawbEx2z+rP9WYRn1y3k5DV+u00qqtiVMyXXQwPz9Y2QRyQz3B+nmif69OekewnXq5qKKk9DetCgqDn9Rf86j5JW0RiaYDmangy0HoJA5r05w== 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=OiB6zoWB32H0EkrMl3eZ7akSCrZvMfmnm7jIt71Dpkw=; b=vVKB6CCn8N3m3sD3wILzKH3mwXzPEmrXhr4YFNVgh+2HBAtsG7z9EHfcLFCCZ9wRRNe20ViO0yTgVM5g/Qe7M7hEs/VJGhN6WqvFMFmEQV1DekeiBlM/G5poYI/zcYEV2nPXrHgxPFFgvA/K1j95GAF7zTHmB8CpggHLXzRC9tKOwXL6GEoNyVBFhLbroWOxm2LurahQ0kP2odyWxrRBycG+4BtrvHBdFdCzHErHJ2PVJr1dS4gPSpF7w4xAHx7GisZ0FAvnL3cZ9bxzwLFI74vo/mxFoJdWGt3DjU9DSF3kjwD+v3U2QLtN1QrbYWb/pkroTm7bPieRZ3yvytZS8w== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:09:50 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:09:50 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson , Rob Herring , Ioana Ciornei , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v6 2/9] dt-bindings: net: Add Lynx PCS binding Date: Fri, 30 Sep 2022 16:09:26 -0400 Message-Id: <20220930200933.4111249-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e19aa6a-43a4-451f-a262-08daa31fbb3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yR+OwH4hon5QGdc/jDqD9QdWnwefM6pqLT1XXclk8Oh4LjOUYbDxQEQcvXk/zs9Q8836eiem7S0m8lpj1VkvK/C0f1CJQbUpW/se6iqHt117M8tXln0NY/5JWNtmWGZkCzansYIUt4JSui5GTAjewasm3tJ99ushpHFIjLc3ctSX7UTwubDTK0ebBCEKV1fLjylC203P3vD5vlqgiQtTegzcXo/F0rDAiGvm2LMVjkEVv5pQuYDCECBiiovjvqx7mf1Qpqt9owjarMvg6OfPeeqIDHve4cx5CZRXztWa0lrktXP+RLk8+jXwtobjydTI3WDIQTL/6Wfb41uQK6N5sgp1EZ/SCbFlrrD2Ux4EIQP51ev6VSkxTsolo12tCd5v5NkFnI0RMNMXWHZS7DpKY7IkSRdG5/uCerL6wWxVIr2LRqSxPy4aiGOGviXKZdHXV+9eOeiZssSToUNn/CK2mbKkhGDh6gE7ir7R70/Q9oTcQcks+GXO6/9unqlUhKB2ItTsiR8YIuzgDAzWlgvA7cw8Zok7UFLjQpfZ9yNRTGO2jj786F21mVt2VwsG5e6JviosVzj3fkuEWh0dnAkBaUztvlgk/kfgPCQ/eceQopzH9stFcpo8c3DplQ4nTOgCaCjrf6WHvgBSNVAxGvmTtUmPa6GdBA/MiOjLvuMWibKBkjzYYornh6IlDoH+q8OETDyk5sDUgkdnBZkr5/eIA2Rxe+GN8ltuLnAwXxo1FSSUEHkRgDzhx90XI7io45VdBpzyPmlGzQbUhH7aT/drYbW33J0p5ThsNB3oyG8zubA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(83380400001)(41300700001)(36756003)(6486002)(966005)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fg2wfRPin7PdB0ClXp00i029kacm1A7eXzPsWlDCZPZFv76Q7tpdlb6oiIFyY5MPf5C5paapSn0U+Tejw/gfnB1KetlswRJ2NL/c4+SLPXkxwVcOwgckEldYQwLO0kYob1yLaYKsx83ztiQN2uUixGdv7ud5OuuCzIPy/0GseKWf6EVt5shcj2RBOOiuAQFFqa34gNi2/ok7HW0OPjMbV4NBfBAoYAKzfmenFS1VUw2gicBAqmBer9f7b5N9Wm39oVnwMapmt3wz1PauyZTXP8il+ckYnkdErZnrKQbSwQ0zwhMkyC6nDULmXXOqCS0bvYxkW/bbBeU/HBK2lKjDFnxQ5SLYbXUVTpt05Z+rTNU1I9Z4BfoE8BIosqBAIcORvBIC+Gm/i8yn9fpkyq6mVVmK8BJObjeSEcpaGfpShAvlLfDLnb3it0l0+dIatdhlCW5/cZF+mn9MZ9Tx97KHgPVMgQhcOi4ltzj8IvYsR7YEdSqoXFnorzcHQGaaZkX8F6PIUCAWCLJcl+GI2hX+3fnbv+nmLI5Jzi410GzCPiaFyaB4xsJPyXznxai7JZYc/mtSjORWxQWDV1FEO1JQsG6nC1u9qkncvIsuCqEgM7cUyrOE6IVp3HfU+N1dRcKCIue7dBed36YN92YgRLV4ivXqP8gr1Q5QZrfgqFaRTINuFnmhHiNgMij28AH4iTwy1H6UdeEk122A/ybqLGpkmDuvtSI1gjSwat33t7PGpaIWF/0AwhmhBy9ZYv0wMv1BREYzLkTTaTneQrJGvH5uin9aevi/Q1xKTPhL64ljncjTZhlSkPoYVLBaXldGM1ZVOF9uNyHdSvvTmqxp375zhhQR4jxlpzk7dohS/KYoUPXwuG6PwPtVSY6Ip8nA1fmvhwOWcK7E0rEbPfpjgXfJqi11cRzsfuUfDPxEAbN9WSapzAtk4a7ePRcek3x0giycs2ootMfc78FR880nZnrMA2JLe21F+RxlpjXziZ1agiouJJrVt+Yguwyfu9CpDvrhSqdv1QOORCvPbw/Qw4f2BwNMrIhHu7iV0CkVoDRmQN2GkjvoVvKvt97RF5XXdby+4RCi+V93d2XKy/FOxVst0debAZtcmln+Kq9U8NDw/uTF2C/NzFuOlqnwUIek83Yyl/rGl2AXn1YxW7WKQRpcv3sb7OrltqGtJ0hBuIG4FicjfoDEDd69nZJ4EzO73+5k2vbYhxiQB4AwS3IlYwlNyOapZieTKC6qypxP/n5ra2rmicecmZMw4aJV+almQI5cu9ZSeyZYvO/ZJgEnijJz2FlnUd26y209uDTeKU8INQkOPXN1pr50JS02O45JnTeE2szHNstqNAAh05NczScrzGEzmMhgVnVbQ5jfUzIWwxHFOUUd9XlKey00jJ/sRdKb7sQNOiB+cHuOi5FVnZ3hzT3EDj6oGe5a0SRtewZ2u214ae/eek3jXsbu8G1FwEcRZtrsJUZ3B6ox2IXyXq1OGqjJjOQNYWHxWZTIPB1FZtzc4KbUdHbKlNwGKd/sDGKsLC0FT118K1NxZnAegZ/SNGfc6IEoHF0S1pIU5idNHDDJUE9Tg+XCduCl7vnxD6rmwK+joXJNvznOqoAO1xAF9A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e19aa6a-43a4-451f-a262-08daa31fbb3c X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:09:50.7754 (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: NSoq5n7QskfH86xMUFXe1NQmxmJ2PiRwpXRoKOpdLxiKmXjM5U6W9GWDiwbY3a1/1V/WOsaUyu80LuJPFuSVkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_130959_450086_044C7B25 X-CRM114-Status: GOOD ( 18.30 ) 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 binding is fairly bare-bones for now, since the Lynx driver doesn't parse any properties (or match based on the compatible). We just need it in order to prevent the PCS nodes from having phy devices attached to them. This is not really a problem, but it is a bit inefficient. This binding is really for three separate PCSs (SGMII, QSGMII, and XFI). However, the driver treats all of them the same. This works because the SGMII and XFI devices typically use the same address, and the SerDes driver (or RCW) muxes between them. The QSGMII PCSs have the same register layout as the SGMII PCSs. To do things properly, we'd probably do something like ethernet-pcs@0 { #pcs-cells = <1>; compatible = "fsl,lynx-pcs"; reg = <0>, <1>, <2>, <3>; }; but that would add complexity, and we can describe the hardware just fine using separate PCSs for now. Signed-off-by: Sean Anderson Reviewed-by: Rob Herring --- (no changes since v5) Changes in v5: - New .../bindings/net/pcs/fsl,lynx-pcs.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml diff --git a/Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml b/Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml new file mode 100644 index 000000000000..fbedf696c555 --- /dev/null +++ b/Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/pcs/fsl,lynx-pcs.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Lynx PCS + +maintainers: + - Ioana Ciornei + +description: | + NXP Lynx 10G and 28G SerDes have Ethernet PCS devices which can be used as + protocol controllers. They are accessible over the Ethernet interface's MDIO + bus. + +properties: + compatible: + const: fsl,lynx-pcs + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + qsgmii_pcs1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; + reg = <1>; + }; + }; From patchwork Fri Sep 30 20:09:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995962 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 3A085C433F5 for ; Fri, 30 Sep 2022 20:12:22 +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=ay6/VKxIBrybrWn3+bJo7q5LkzTog34Ey1tk/wCIPik=; b=QWplaCkgVkH5de RsY4cYkh3JExXaUbh71NypGV89GQOdZ2JUXBYCh5+YDXWuBXPq9kegMRu3YQvs5xeyHo8Coj8e7eC nwiavc5Q0xWfdf6ldKZv6VFJ8FwOG7V8VWHXJoc/47PZJ66ETX+KxFWtnXZkYMpqmDZ/8rFmLPeGA 4DLa24BUy5CYuiDiqMo8eMlEQ55uRxmBiFDW2AxBFjQIpTLLgMivpfGNExt2+I0q0kJLOTg6yFMcv tgUfQH2yjt/7PD2XE0fPXZhB3vaEAKQgOv2bqxlyJrfrvGmANmcRMOkZjbFOZuhrDUgEin1+3uBh4 T95Jd4JIzbZnjDzRai2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMLm-00BKUS-M2; Fri, 30 Sep 2022 20:11:10 +0000 Received: from mail-dbaeur03on2046.outbound.protection.outlook.com ([40.107.104.46] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKh-00BK2x-VZ for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:10:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sd1GB1Mqg65p6Q699ntQ1p8+VCmKltBHykUcmnLlmtekcjw5+4GKs46+pYY7AC9aH866/p1TORDU14jcEV37wWcDWCn15rptsAd+qLnddloMRFSzd0ZT6zg99qjyL/U4xR0Um6g6jSyORcnW65qKuOrrxfwj++30SEc405SguoK7go5gRY9k/1prfMaIomFBxxcbznT+5dYBl+8rpePP3yz1wXwqrSKnJuYvzL6vk9Sgy8DKkPuMkNj7Q2hz3mK3YLfGQ7YZJCy/vivQcZp9bqt3Bw1vVGKcqp9UhcaQ35ICLXP8YiIZ1x6CawVun92J2Zf4EM8pkhthZwlKHipUQg== 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=tjABrl/nqtklpdfa6OE0UzmntYkgGRDZDSkLSpYm2PA=; b=emY2/4Ea1kMTevcbLnxhsmm9hJrGnIBSLAUAoIx2EByBvEi9uRG8NbSH2i6yPAfp0CHVnKm0TXBXE33Vv4lv0q0eVqPE7JyNgmmXZjn66fHc5ZBzSXOqL01nlEokawz3b2LM/gOQLAtIxV8fpi+Cm0HVQs12oh8s2J5lMs/mLcXohrml4eiGKS9S7LXNyYQRe2z6juRYwg2ju07puo+O68qQq0cRkz4Tn1kD1FJxn8TMYvm947rJA3TWKMNenGDCFg3cRpqoHtHjphwzS5CITAJ/nffIFMNGxDQ+BEtuRqs6EJjyNC+hou0lxxBUCryADRW4kF+tWwHPN2/j7Qew5w== 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=tjABrl/nqtklpdfa6OE0UzmntYkgGRDZDSkLSpYm2PA=; b=LAwDKvGuSy+zGB7thll7gEAV9zqCEARZw6ZYTDOmM0FfDv8CY7FKRN9WmrjDqYFxHjCMDYIun7kJrUPRU2PPQQEOiSJCRJIqFNfi48vmABdqKfFbQIAMLvEo1SVY4672Arac/OF6RWUM/5wsWM9X1uYXc1BhmHyy0agvQZy+CSQ69JSsfYMQttT+w5TBVG8F2K8xp0StemmJJYgthzb7viIcdliJ4MH0uatFbOObhi3rh9ha192dkKNRSf/5LpO7v6OZqydS7UP4MuOzRB6JW39RTgaLsU56zqjrTo48GdBSpuGWU5kX9CbPyEvm5K8G4LQuKH1OGwruN0NyoRmqVw== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:09:52 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:09:52 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson , Rob Herring , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v6 3/9] dt-bindings: net: fman: Add additional interface properties Date: Fri, 30 Sep 2022 16:09:27 -0400 Message-Id: <20220930200933.4111249-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: 46550492-2dfb-46cb-929e-08daa31fbc34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hcazLOyKsjq5D0EP5g807IMRitFQBIJGs3z4IgpF6atNzceaDZcaoeeNERvo0GFIbwuVEdmBMmk0WtwTPRNkizByC+JI3tiIrWr+7DG85h4vAkq8rGz1OzbxOTSSV7J5xlQc/6J9p3b0+BdvJ7DjDNUwKKd+BU/Uh/h9P6FAKr++RhV6a+tVMe4Ko4utZablYgFvpTytLIlDpqEUjl92/Y/Do5dCo+gm+whgboPLA/SYYWyd/HyDXcHcXgUeNA2kz7cYlbZI32RzUjWVSFC9TnNEKXcAdiQh9v9oABgn+vuKLRaMeoZYYAT/jVu+XWnsa3gj1HJn4vIiCrxU4stOO8Cv7aScMVY7A7bbaBqSEx/T3e6Yk/AbJvja6bIaa343DL1KRWHCqQ5Omtgr8kjYhfigxqD5kffz9cVPBSoZedysHdScl7+3kDxRPWIA9wng8GvsBXyxpCHMdZ1lMn8Zam59DJFUisjMrgmNwreOT4t9Xzj1wFZYdVsQhDKHgcc2kLbVidP0BV4MpVb9ZK7k1lBDIpjlQB1i1ux5lesP4BFLanDqRt/m1yOipo89Ivsp/jxjQ6XqPGZiNBkZo+O/gBlDhEcBmzFuByFLVP/8Bcrh95R1QhsWs0rCHO330CJICBEMh+nq60YGlh7aWce3NXw5ZjkkPge810IlJQO/k1KSUIONIfAYED2OXsYzEHWqbJ1xSfLVjE21ja+NIbeEUik073IcZsF1CcfyqYP0Bb8HCSPXRY48MuPf8qkJPE0S3W6QDeYWfKsGaX2n6dfPPw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(83380400001)(41300700001)(36756003)(6486002)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ev+swq5SDQrlgTkPmmXyByC6mWCcFzAUKzanojGQPYuCowWRHWUf1lnet525VMvgxDGBj9M2RP2ZKNPlBizgx6aklu9DHdTuwL16pPpmADBOZ5mvb3FQyQH4nnxt5S5HtUZ/iNz2HvLsGNWk182/ABgd1XMYPMr1Gp7ffNdLKU9RQ3RdZ5ch1i7XBvOe9fXRNv8Z6esA1aKiQW1qsVgppx+k8AN4ArNZlhQXt7+XQNE+7bzSeZXHLid9fgXmknVWSf7bMQ2r3o+W1WTHoKt+ztD0JBIdrlugwYV8B40n1AwTon1p/zN/9OzcMfCJDyZhmrgeoNs3Gjo3iFQII6+XbhtRUZPOPnSbpxlCqgPf8JuIHEH/ep7uKWMxM/x/By4IzCTR6PrT2h1f13dVGU9h+o0UkCVMYpKy3mKM9em5shayIMOYqi9ikIHliitJxWL4L4TUXrzzN1ESNPfBqPvwZF4D9eci5TI/X9QLmFdFyPrwIdRaByGZcKtlKJUMgZtICNiKDyyBbVBPeBCV5mEuOFcNBvEGL8RqBoOatZQWMTcCrnnARx0TR+qd4GeI6+GKyEvPNoTJXAQJad1r9Oc1OjkZT3b6CCprfdHYD/tLNHQW0/1CgaJfH0jmUrkHbmmhSSKiyVPeRp4pUI3x9r5G3L6IS/7E7dbmg9gK+RCxU1rldzNj8VaZP+BK8zmPiGkM7E+ritOft44E7W19YVx10HRUHGgtGyYIpLKycgAiVioGyGkcFFfmCouO1NygPQK2ClF076eHTTCQzaR33Hm+v0OB7nsUoCPyVfxraJIDqJKfN0fUfq5FzhzeCssVXGsiOdojhJ7KYyXAd6kKJlLBPfQy7Hmxeek9uz7GxNJ2S2iZeU0f5dt0VjgQhncyV5AopN7qIRDZIQJW7US4dSe4hbKD0Dl7yy1eyV9ik7J0ljX2O0putHBsbi4ypJvMCskKkxOSggcBoE7KjMaU1CtT5044Nrek5KsyJ2kwgzX2t5tbX9TaZSywcOiyOGGiRlKBeoa8nh9G4rPZFIrl0d51AxlxEpmHROh2STw7xPncvKOTIBVoqGx1oD+LtnFkN0hjkbXSnqlsRn3Z8dp2WqWr6e0C0ucJmeAozkn0VFclv+0BYipCEDeijSYGLAr3qvlD62UnC/10XtgcdCLZ7kyC/lKgk55Did4Iy3frFy240nCBCBTuMJMHWip5Q6Lz4dtWgQVHO8iwpkhnpVTkVn7Nw2o+HNTgsdLPGLEbcLQQY7At/FDeGna7GKAn/S+Hm+yOMWeDq972z5GiLPqwR1x2F6uLFJFpxKTq6ZmD/efuTcgANPlEwHXoAoriglJ0t8AHFGoQCh5EOb0hqv2URM46mlpJVtxr8amDqWvpoQsy3xN5DTJbViQh0VhiRRMh5+Li+aADT5X6lFcmGDMdWmzBV90CmYaUJj6XMKlixtvHlMYLwqi0rRwigIqQVI6/SxrXvdF2tJNyw5AtfbbuISCpcL9gqVNJ/eKSgMo16wcHNV2mARSIjTYTmVOMOTdxVdtRXPMZb2pjEX3i837QAXm562TlNKKtLLjSRqp2g8JBoL5ut+/HPHlqugjqIc6TS5rr3vF0slxvpUfoNf5y9CqQhQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46550492-2dfb-46cb-929e-08daa31fbc34 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:09:52.4003 (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: WnupCx4Mhr8wKubPB01M6/6J/rTJ8mHG/dECvGPB9N5WZyHWb1LH8ULOKudx2TdAMw8YOKwU3XjfRATb83PjLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_131004_050011_A517795A X-CRM114-Status: GOOD ( 23.65 ) 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 Fri Sep 30 20:09:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995958 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 723EEC433F5 for ; Fri, 30 Sep 2022 20:11:46 +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=dTZC6i2mPEwf79D1HBd4aX+AaiKLTkr29bf28w0Kfzs=; b=XV1cMgzED+Yi7X lNol8ncgXe/c9e944T/8tCej4DsFh/c3RvHSq/pqdJi2bEZlgcHwJl4kfskUD7p2QPGBQVTVzGug6 083UV3WeFf+cvXUcmhHXt8Lqf7q+1xuQPsbuYsZ0pYRN5K98+OwYdGLYwTAutHlMRCZCkCb1GIl2q 1ufEfgpHuMoh+ISMIxF3JgGro0VCqwMTuxYsuhNKhIOWFESnWsp1a8UHCYCucHi/31w/ouDLtxdce 96mNtc6p0Ks9nvkCYYJcHaagCPUoNEf5WZluWrUD4je1X0ZeBjoBuDlyMdx8WN4mR8EREIhrsPKl+ 1gv13rJqHWeaVyGZlS9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeML5-00BKC4-SQ; Fri, 30 Sep 2022 20:10:28 +0000 Received: from mail-dbaeur03on2073.outbound.protection.outlook.com ([40.107.104.73] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKf-00BK1P-BT for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:10:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iUCWzUskeuvxNtCX9IxpZumyjNqZvURWAnW4HTjXuLWtwcLiVQnvakSgY+fd9Z2yUwAb3RScLtwL8AvkUmPKrXmhFMTYibA064IOoSZPpYnSN+mq6Pv5ZPiBdOFHm3r1iwCoN7+4xdMZSkriYfIqu4aJtj+yyTqFMfPoHd3U7ulGxamx0mdkxw2c8dLSpcpNwNRZvdycG56SueOcYBAF+9T6o38+JcyUs/m2ue/z5YV2mQmf7/HWTYSsj0/+RKrUNoideE65FVMyGTi7+WJDu4iw5I4aBSUYSevtxC3gOL+Gt7fcfThk0jKjjSfH2k36FJknLfIg92wD+a7ZwIFZag== 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=ppbX7gkdSbkxfHgc6D5Y+h9NkpsO2d0pVIeXPyTOAWM=; b=Wo0Lk/l8Lcru/CEOhfENQCDnTZdb9tbqvhNA3a03jz23XGMwaUyZ/LTlIgAnZvHZLL3gSEervmcft5o6Ngo0FQEOqCfwzOJmAScL0Dwhm5TDSDX28MJcNEwWmy6ZRHPES8FvsMDT33MEXmLsD08hq3Y/fc9+r61bSGcFxTKMNrlZRe7M0Pjvs2G9zY1UNbddfDeIn7Q0aoMowJ5cHh4/lyJpdrHx6KiSH+v1v298f5HkrLQOUHAS3Jgyl9Rs2ekwG2k0/or6XJPK5nV+MKnsgCKejg+aKMFn9pEyEsdSgY3I4TDs1p59iv6wfN8xhhNdcJ3dy/ZkbVZGWz1clgS3pw== 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=ppbX7gkdSbkxfHgc6D5Y+h9NkpsO2d0pVIeXPyTOAWM=; b=nLkNaLq5fJFddyPc+wgtlWlNgpxqgvbFHaIOb9yvacWb/IeFfqqPvv3ncNFio3L1+ruRwPY54FHTbFGPHQNXrLqigcBeDiWuYBirWzipj1gzUWnZIWTCoMn4e+hC2ud4fl/ApNEI+rdjC9leG+SS81YPR0NX1r0IZwOgMoHjkKWQsi6lJ9SN6WMLeKeNzwL8I++dPJ6Jdk9yNvcLiqHbfkLl15BMi4j0syO8bKZeX2v66v9zL0swJ8zPuObJyP2HqZY6lG7LOZNSAP84YqX4PT0y8eZgNxl9xCiBDoBRZEi8Ai2D4f9gsvFtLh6QuuxR+jb3llwqVvsFMLA38Y9v6w== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:09:53 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:09:53 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson Subject: [PATCH net-next v6 4/9] net: fman: memac: Add serdes support Date: Fri, 30 Sep 2022 16:09:28 -0400 Message-Id: <20220930200933.4111249-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: 40db64cf-c497-451f-fbb9-08daa31fbd03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gvb1L68JNvrxi8xxy4PAUlb451shNQ2il+yuWnof9yjWMBaH1+Z6r67W4Kf+5XwLe4Xy7T8yKqhYjJRaEOWg+MRJSArDXWmDkBz7zEzTmCH17BBeu4QVu2zw0RQHNZYjCOivTfodUlU5XOgrHEHNg+n0OJrBqUFgo7t2viZ6bB+jWvu+A0AqRNiX+2mkBfcDLiavuPJahvcI5kT2L5oNSifZeQqxyy7JEowaOr0fYaprbYrUsbqoj2wHQMA4zKPrJIREpfaas6YoA8aICBTF+vVrypwlLvE5pURO5RLbJ3VSig9JDxdjV3AJwxWVnNWZxIzw6U3gQpPRSavTTyk7ZDWlpO4seK4xbUtA8rajnzRBsL4+4GnbKhpv8VbYY9NtO4lI7lUcDQrEp3ZhGaP+LB6sVsgVeYkcsmu07VFQmVg45DWza8a1GC6oDRwohtZI8lHAZoSEctEOs7+G7UJblux7eWE91SvakeIR0DR0FFbvd495lw7/8U7oE0gYIFO7I9sVcVL4GGU2Z1nrM9pWOpifW857D+bP9jtkWV2bFF+5TEBD0OR/CEGHpEcnTcS5Ka/i/P3SBmU/FsMgqpU1FTr304NS1Xxbg1vTIlvWnu/1wde8PI4+zD2R3Lhndm1vWOFS92VJcMzSUcRPGLZ3vmQP5tnDFYMEtuBKwSuxHiuTvFncmh4dXwe+P3YAZppJK9w+GIYHZ+eUf0T+RP9RD9z82JYtpzGCsNYhcZf03NxINoM6BjKY+cSRZiIfJo9L9qtGvb2XJl7nITuQ9S1cXQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(83380400001)(41300700001)(36756003)(6486002)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(107886003)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I0tIzu8gISFjV0mdaOgVoaEeB5SU3QlEhIWQ2vHKn9+iIusS6UW+dL5cgcS0TuE6VHko4nt+HKzzYx6Q/fIF58ia7IvfzRgodRgy3UXk4ChU0mkYALLanufZbL81kA59gQbvQM1f/6tI8ZCJEYAfm41VzdGhpIvHm3Sl+hFiTgSyzKozD41162fdf+6MOVIshTjqbFoN706H73gs8UykaFL+7FY1+iZVytbGr3iPUYvXhvbWcsefcN0FGNU1jnQoVvD1BRpykEvuji+3lRXkYUGa/CO9Y2OG7G9I9jCLxJmgue1TlAu91dqSoSEOtQAbEfTkqfVzlm8lXW7kObCVu6x1N7AgSKZ/NsZDXcjeENfqEXyHhxq6Qd6YXc/4e7pckbjtNV5okTVYqdYvTp2BLnvZBXE0rhRzr8qFZRcVAA77/WFEi0a8EHeBoT4f6UnyGgX/6PRvILnPFaHXTZ74wo+0IheuV88ALJ0SbEO2E3D5VEY5b5UIQfsfGdv4KfsWf+tyL6Tf6WSuAIxgJAw6+RQrZ3nbLMnxXLAd7LVmlq5CAXhTbIOsasHrsxNgsR+cwIpFBesS7E+aCSDCWiHbay0FyaZ3tsFz8qYO04v5PkIjEyXH1pstrXC4l8DhYTaYc1+TbdhbxxNpO1S0OE6/MtMm7YVOZCh51RlgZ2aPSUUP3T+Lhx6cx4UF9p6b0c1pNdvHzfQYlDKG1DRHuk5d4ggUUeCLiEYovL/ulxg+YiEEwhc1iKdZavibcOtVnJA/yti1eu2t3moJJPG/k3t3XRebYqomt4CxnBohKVDn6sMS3Do2qwEOB5eExvHIlTlVnRtfCm2XEvd40/ISshB25plgCUsCHKXhhcSIyhNFbYxTXRmXbz6LmLQOd0zXtbEK6vkdBvYjpAzPgen94djjrqgZm5zN4XfcjBA7tknz6Bumf0aqk6xUd0w//dMRygoFqkr/YFwySrukgwWEa33Xoplj/7kEY7VexPE+wypitdghdKBE9iQZuPUS55g9WcK98HZaCbln3cUr/exKMAsai7qu/PCQCPOGOCGEMIy3bucYtj6p93/oCJpqBLIDh4ycUd3qAnkTPrF7g0rMhfgHKFLtrs4AYIpHh45akDxmobF0REkufjAZuFn7LAufdaVFhCl1NOjiAPeKaRPM2y9nUxQ/RsYTYynlBpOxik6TcuVZHiE9l7HvWuEZc2ScViIsilg499Yz4TpIp+G3ajkQPLHLvCNO/42NTfMmeh/IRj10qAOQW8MVbYl2l7YhlnTcPswnONznXiLMYXU7oEwIy6VzIh/ZuBJIvU0bey2jrPJ6DVc5CuPWh/1aSXmOoFT03Egyv37MhKLUF+MwoUUwvqECeu09RxVzbzSyrtkkRZklkgKtngmqaUX+BF3zbGWxp0f8zskSBi4pvgiMX/k6Y+X7lwh/iZNlnIx9YXDgQG18qxMDoZiQ+8mqnMDPfFN4pOnxkkYNVLrGUqiPMVPqtmIvgb5tmoBtIhonTD5GG52IfIYT+2b70SJEA3miJ/Gdgnb6+6oPPpglG/3qxUIIfQ6MEw5ea1FoMmP7WOtd/5+rdU9PmGxRghZB+tACHN/RV65dBndw0Gs05RH+zynjSw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40db64cf-c497-451f-fbb9-08daa31fbd03 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:09:53.7596 (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: 5a2HND06pznLZl6QmRp7lBI663o9UedeHEO3F73rovUWUTy+lN6RqPqmw13CCZvJZpTg79z4Hf42+hU2W0JcQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_131001_418626_0E1B3EB4 X-CRM114-Status: GOOD ( 17.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 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 --- (no changes since v4) 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 32d26cf17843..56a29f505590 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 Fri Sep 30 20:09:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995960 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 3F201C433FE for ; Fri, 30 Sep 2022 20:11:56 +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=dhEIgTjLQaWSptf/xoFerpNSUeDcjLpb2uUu/G/z6n8=; b=29n49x+XVXiZ5N aR3yhJqFOk3QWZvZlxWGqv352zhyIwtF9/Ha2yoe0iphCzWfsoRcE1NBL0tBBdPhv5lpSRPfDMxLC uukYp/qPNbBWRQoTYbhSVRW4h6u2E/JyOr4qKMd7fMft8SEbdCTJoOBwoc3BKfZnohqzx1LOSPpLC bHcRjDxX8jSLrBYbPMqqr1yqTRmOA/DnMN3fCgv7Bst7pqGEaJHjtL3SGBvnTzy3F4TP+ushh/x/s 5V6AOitZtbjfqhOYdqwLFAnsSyWPKKPfASBE/Vtkiz15ZkMJAxashT11Bteo90lnT7yD+QgCrABzJ CaPBegORORTKjgHQBWww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMLK-00BKHb-4a; Fri, 30 Sep 2022 20:10:42 +0000 Received: from mail-dbaeur03on2073.outbound.protection.outlook.com ([40.107.104.73] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKh-00BK1P-3b for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:10:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L6OStW+XmFx66IT3YbN+Xm2OnXjUEtwutEBS6riCJTEaWU7QsRza8Xqx1AyAQB5LNmnSEUZjtLom55PimbXznFUi3IGMNyG49Vfm0xCtqc01ApICFcOkVdHyfOfUuMjZmtEvSMdEwKvEopUDv5xFYyaeW1g1enALV8T7twzhCA18vQuqiMU4QPIS5566FDq3tCj7Plc45uRJW51d+d3ZHk0m4e/5pOdUlOgiXCVlfLB8pf1bKFm9t443YNKjJZjYiZ0Q4MAQFoskcC/3UjQgQwDQiIiBEx9FqlaVzUnbQVEvy1piKNCG60/ROClEtn4wu5yoTuiMAY34a3GcJQFQNg== 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=GpcRSaTRyMDrfNxWyWDNnuM6Ik1YXSUjdwexaPXKA/Y=; b=gzbHBrikQiRRctwtcbbA/JJzQPmqUwDZzpLvxcdWq9L9dIUQDK2JtjjI1ZI3NxwIGV8edjLVxtQ7LU9YcXBhBg0VyhshVIEoR+TslFuQnSWvPPk2icuIhE99KHKuklT49kt6QbUWZTtrFxaHh8qTLOQw9IRAdXAhlOPJ5gMAiCquTCi06le03ZxQ5fQz+06COMV+6YgXAVVfHRB5xBeK27/KUB71pjTynrzWYmcZ77ImDAOtTfugmROGYn7Z1AMcHK27HkCpURPB3h7OBXhePddxLQGeuly8vsPG1OFZOnvMxtTjeyc7JJNmtKBi1bAEc+glbLeTBW4Z5hJT82FNBw== 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=GpcRSaTRyMDrfNxWyWDNnuM6Ik1YXSUjdwexaPXKA/Y=; b=kqbs8G25MaaOF4vT5h53n7I/3/3+9chD9n/vZIG9Vu2pAdtJm9s/W2UKYsbn1PSrKmMkHiZ3xmLgSLH/64yxcQ4/6DDm43EFCTuhwYRZ5MdKcYZXmPPBq5KX9QVNruuaMV5MgaAmbW/lXzspxFYcA5Nz0sCWvYQASp+kwi88WxXI/iNJWqkbRaUadT9mLbZXAbxGJC9vqejIgSjpgNdlzteMHvMG1cC3AJCS5PWY5Vj+WIa9y+MDCHIVRupvAWZcvmDz1cUrzxzdabY3YGn0Ww8odtHwu+Ol4YJ9CoDZFrMWTc8qn0X1OR2bqGim28e5uWw/qdXwAnn6s1XXbGgLMg== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:09:55 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:09:55 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson Subject: [PATCH net-next v6 5/9] net: fman: memac: Use lynx pcs driver Date: Fri, 30 Sep 2022 16:09:29 -0400 Message-Id: <20220930200933.4111249-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: 93a583d2-0a08-41eb-a014-08daa31fbdce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kUfX6l7Wx1EVsJ6pb0Rf3Jj+3iq5SxNN33VazHXXp1NOOmJYhbVyw/WZ/dZagIrdqOsW3nxsvr2ixDNUKN+fe/GIMpahc1g2FqZBGxS4DCK0mFOz2KrMVoliCFusWTceqU4bg94mP9ijwNqB0VkOW5W5cYIrEnejQituXgvQK8k1d4Ysf5eHCRP77RBVyqWaWPGCKISulIZqp7Vl8MIvY/D8NxLx6TyUGG3OOcMHHbtP0M5w+QTjFTvn4QLiinuHvPjvzVGj/DBdGdkLUpcIN1XuVk9DuT49ttdml7PNgh6vNyZq0iKnge6lHDoO8Mrywjsi06nNC2FbSAAwxDRtf7Xvd8k/qbHds6KzccBk8v9QR6kjtn3e7OoVHn1ISss6bVkFq+x5mO2PH/cxkagazql3Khpocq5YDDzhwsCP0XLksAIKMU9sxB9L7FZyDH0ooOiFKb5qVKCyuKzxu9djIpUfn8041gGdz6qJh0R+vf929HLyMlY6FuYvOlY2R5aq8HhoHsyC2edymZUZr/fbtgvTcx1WkmN4bjlVaS4SzDDOs0OTrkbMgTIwFj/Mf4d2IMt6GiRE6zLi1I8dfWRg/2iWcy7gYjlcVsz1Xtx4tNDi03yfrhLYkLxCtsvH6Zl5nSTKlaH3sBh0pxTrShqMVIi6NXOXZ1bIk8vGN/6LUzyQjQseQ+PYPSc0ynBevKnGF9g3DB5yclILJKlEBcOqC6Te08D1/2jPryoXXxbRknK3hY3pzEMXm5o4IzWafGvOBJBysYRQ9bJZjQemh3fMoA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(83380400001)(41300700001)(36756003)(6486002)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(107886003)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LEWfsncpotwdfAzjQ+YnGYjsdRRCpx5dw+71cyX5uKp00CqH5jVqFA3U9yCHiwS7maDhSV/Tnu0hYbh20eL/XM6YJwbBdAor03gj9HWsPuJ2UNXLuwDv6IeuU+Sf09TCsgNvoILVxgfxuh8NzkVraQZQsLVoAIj6pPWbhNEgW7klYzbQdJ1Zo+Z9l4fi8y9p7GpdYStqeD48QYyhZbPgoYNd+8Bg/tJbvf9/inu8a9lpatWtI9/BRt4UNHv8Zsg/wZ2yhUPLUTSB0LGI+Ry9wkhOFF4eM6QRk/2wr9Pa1soGjUT54ToHoe2Yf+AOMeaWAvIOKbj+XVlhgIZHwc0UyViWARRji2M2ycChIkIHv71QvslPIZTh6XDTRFVQWdArtjCnDCMRPSinpEuox83t1/JHJHc3HMm2tNISzPmEMGr/wvCp92xozsHw+/x+WveVrHlIVyBFMBIQDt6jR7lI06UFLgIMvxMrj8RcFOs0N8Q69QQ0pM0UF4JH6xTTxSbQxuySS5JnKrsBfynDasUO3OS5RTplSVuQ2TNjgxSxFtbzmStd3Juq1P+eBmXCBhsdJ70ig3MwoRYaXbD9XdaVGKUltV8vjf9+aI/fyXoqsOoz9kUH6c9v00FV/Rw4SJAXav/WFha0yQheWcqX4rZBBMZ5Ycay5a8zOJoUVGVFlSAH/PWFhdIWzOdey7OeLQEJRNRBgltbeSbooXkyxV533Qh9RYMv0sPFxyQv3+oE2nG/qlI01NrzM+HUKOfK1+dcUFRe3R+s2KpiWEnw6pN88dhl0jxOcsjlUrywMoBXBxpPeUZ0d1RK+wEuL99K1DVS7IoqC7850t6JcmyopkEg88qJGPlyh9w/7WddX6SYDojdlRHzIqngICtHW8PeeX9no0cVkY/LFcgbB1rxwGBfgb5/4OkTO0O0pCS1JCcxZ+6yBJTY9o38QiNqtOgpnNTDE3rMmvCIxUDCIxhPICEwpkDvAyX83IKHi5MF2wXWj6xdbgdvnhJhJAusDPlEONk762dWMCRItbzLJW6uk0X0fBvxN90eGCmfr+R6a00urG3V/7pRj18pnXf0/1+40Tia3F+N67D3oKfM63IP2ORjSNwAcIrI4+kShsQF2zn1elF8GevAMm0Vd2IORyuIyb5KQM9Q/AYk+eVGp9H6bIGNaj3GtRuK12xoOMdU3rkoz0qiPbDwCmkuLxRVDYg2zjvDa5nv4Dp9ORR75yRkiKrpFWiaf3hVg4qX/nPNKDuAmpbknQyLyNqylYoz/AAA1kGmGwPFYnbPjstJt29QKRnqyDuJ1HXAooXvZthwlAtigmAt8LmyUUsteN7vA+nBb+pA9bYi2nWBnJjpvaHTddkQyUZx5mCTlGv9AB8NCzZwRyqES+C2KC2fUCFgqxIWkJ5q0OxNjokHt6L8u+n+lZ/6xYig2R3lFM9xHz0nsm4b7MP/lDMC9x7ecxonbMGmfaGT4OQMJ5pyOJS894acP197/ZypE1RnmpjVXw0b6LugU5qsIJhAYyGrOopRBNee5rUAFhXtJ987IyVYGGkhCv5oUxG3T1T77jnqc3t2OMSgpWW2QFwxkhdDfboMeM5X3f0+vYbhSjFV1dKsfpSlRiACvA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93a583d2-0a08-41eb-a014-08daa31fbdce X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:09:55.1657 (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: RhcSIiFq6lMk1zh3jXF1yW/PmWv09od0EiIMMbZv01l2UDW8Mkew8cWNDn5NQqRL0ivEqWf40VmuNvRqKigVAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_131003_197650_00E434EE X-CRM114-Status: GOOD ( 23.57 ) 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 --- Changes in v6: - Fix 81-character line 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 | 258 +++++++----------- 2 files changed, 105 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 56a29f505590..eeb71352603b 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 = NULL; @@ -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,58 @@ 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 Fri Sep 30 20:09:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995965 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 928CBC433FE for ; Fri, 30 Sep 2022 20:14:14 +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=nMsCSDJPexWR/WUthsO0yjqpx2DyEmyNJDiH6wu5Hy8=; b=huAmg85jLCFvyW NYa5Tbzz5pIl+htTo584CF8J0rGvqOA7e2XpTrYSsggMfH0wCawGKsZ5nK/HT9oWxJ+VKnI8+RdY0 7F83Sk5+e1aMLQP8o3qU6kIzG5OYLOH8bJ13oqFMxxM12/d/8ToGFt+v6FZ8jb/HgWVdFBwOBmSCJ i2gYyfNhZpWGECx+oDYy4S8R8SEtx7+5K/W/wTGE/lcdSPcCy04IEkapPAyFxa3yTvuZgWCZFXZ+6 Off4dam+7nZkX4+AYlPDgH47Oh86RyVQG+7UHTBJCEmhMMG+tWqDzM6q1NdA8dT3gi5lfi32n2Xvn E29Rmc9ZnyniRPu0vtYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMNG-00BLHd-G2; Fri, 30 Sep 2022 20:12:42 +0000 Received: from mail-dbaeur03on2073.outbound.protection.outlook.com ([40.107.104.73] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKj-00BK1P-K1 for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:10:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D+D8Rvru0Tcpu2ThuInTYLfBrZOj3hKFvTinD/xXUnXaRMIuohnPYkY7hvvs1gAEdlX0Kk2a77cEFZH6SPch3NZ2Uao5i75gxyU2K7Xcy6IwffZrLJrcBDHASjuHYGWo20njLMxTvlVlK5CXuqqg5QBSYWcEUJWNh4sE/LFV3X98j79V8wsQWyTJDQY5n3OS2O4gmewCmKWAXSg93rFzbUtZ91IkwLzNLoUtBB7t5udpQkusIKkIhzbObPy84F4mZ+DZZtjmbMk0xBBNSX9GS3Rbz2KF/V+iFcKJBy+FXIc87tikjPi9AFFdSY4Xl0HqFIa+Xb8/HNHSQ07kqmZaeg== 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=xmQsjObiNuMT9JVXm1ldafhygn9JV9PQPfuejs4UpBM=; b=NHbe6qZkZUHv1a0GLtymVTS96LVtF48xwObcaDfKqSk8EZj81a6sKwmWlmeIvQQV9/+orGgj3aUw2nvN45EdDYpoFO4VY8T2ZX97KVFGV0isJIQP9BVdP6DenGpVy6lSuwm+rmx+aN3yrrRIMlHaydQBhKDUDLoD6Gk9tOMUIRkfr5H21Q6//YY2NZEY7NCr8kda9p3VI+FiNdXHQAx0gsPJeT/2RW7Ml0ey7BUjWAtyx3i17PGBj0OGozLIGL8+FQHSDrr4rKk7Z/Vs9nP4J8gIAiLLVWg9jJEr2PV7p99i4R0T0QB59MFjABAoUMAy011tLEcbbK8e+Jtw99V0HQ== 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=xmQsjObiNuMT9JVXm1ldafhygn9JV9PQPfuejs4UpBM=; b=bjXgPZA2rYbSm5M8bYt5OxadSZuurJkgwVP03pmd3hI7wZCs5MGpmphyPHQI7Ywy9qTYBaHuSPoBTmgnwOQdEKUh9DoZvgN7tpC2z8Ymi07GKVuXUcK2NnVIcOypvJ3A+aw/v1h7WHNDRBQEcIODhNpj6EscKM56Ja5sWHtyYUgq6PwIp+hLKIGHzWlyQtyzxKcUyKwSn0lKivkl0Oocwwo7J++BY58WTjAM4kyI+XLBfSuL0wpZoUyxqFkdp0NIoXFj/62fVbY8UoO/N3KVFJ/OODbHcnCyqSlrX/4RpA3kMNDvCXLArtzhVzzj5rAdMrGw0wsWeedEIGL+af3Wlw== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:09:56 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:09:56 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson Subject: [PATCH net-next v6 6/9] net: dpaa: Convert to phylink Date: Fri, 30 Sep 2022 16:09:30 -0400 Message-Id: <20220930200933.4111249-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: c315a9c0-96dd-4462-925a-08daa31fbea7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0wcnZseLF0clDD3AQm+qM4tV6iRikvDj/59TBzHodpqF1WqCDkogda+mOJQBVoP3O9g7JNIFzwwylgofF6U+IZbzjJWeWH82nVmzYzNz1poDUPPczBtjzharz2RpNXSeJuDKKFTU6c4CvYVoVK1Mi2H0rgd/Yg6R7HggpOp2jiC6uCMbn+CEqujCHz29DJeOoFkwpOw4lQjEwjPka0rgAGTRKm20wnN0Gv6bCQW0foRzuEnb7bxKQHG3cSLpCiYXmdr6AwZMgns6MrHUatIDdFIag5IJVp+mnhTOl2rzW9SmQALXJjRw+90cFP+t1FuR570o4QbaxWqTCpsjJ3PntPznIjKm7ZtiCF+Ef0h/YTmUoFQyKMy/ic5J80OvKDpCnlItNzFk/nXLZa9n54cBLdzuPC1a6BafJaf8SDZB31wvB0bPCJNMSo2GF90VfYLi4mOKIH7FDhtg78NsjTKJAXMuZrk+YkOVOwWvd3KjKeS5iC7IROJH45pP8fXh7wVQnfYnUCMmh0LoRsyfRqeMfTR93uylhRfKqs50Q5YJ9s8VvnGQ4sMUeAdqaBZAVVZtzN44vYNc1u4mDxfPYxhaGVih7+1MPCYwOBi2L6VF4DilJmVjfe/29fjjBfwqil95v1stdrVxKJBkjP+8badz1dTNWGN/2vjNZ05parLIZxK+RNOBUn+lUhdxkNdjLhS2BVUjCYxVtyD0Czhm58uibPtb2TLON/AxYNjX7Kz5ygROuyik2UAiipRQbYsWEXc9IMELQuRU3zb3XK6bSEKfv5NitOF6De6L7BMzLH6t3qU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(83380400001)(41300700001)(36756003)(6486002)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(107886003)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002)(30864003)(559001)(579004)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jyV+INoST0La2QCeg7/RwC3aXP11TZz5tCiAuT6Gw9vvkZnUrmeNFnyUPerJZr4f8nZrHJE9Xkw7C1jbIv6BBPFvvPfB6gjlXtEJv2ii2xzklkIXNb7dCxOcaoDT156COjw+SM3y69S+rbFS6xNh96GOJ8cnekwvbOaihTd+Ybsp6v8iBcTcipDlSjO5oesEjkvzcxogqxToLOT70L+YyX+pHY2mOsgPaXfENylfy532I8jCEMc4yI7mhm7KSQjVhddnLVIOUSU3g/5ERrkoiHyy0A6MZLbD5kBn/fSzX6wcUHGzPK638zybJtuN431S5mshlOur0S28HzZCFrh61W5m9mgvAktBD1cRKjScb7vjytVPHTjRmGg0kktrbIWWlaVKpEgxFyu9WXwzf93C9bMKp1Q81lsP6Ow2zt7/D/H8EX3/bHFDHJNelvihGwmJ+6fKu01gTH4ruZx97qkyR1vRdu2vi6kVovvRA1XDchCRemxNu2LYf5jm2J38tD2scdBZAU0mGIYwQQ3ulc1b405r6HzBbdFxi9ODkv7Im281r2lMJEhZMpBR42w2eMg2DewQmvvcgCdvlRF1A36/lsVozYAPEw2iL2cplKFihEco/rC2iTyxy0vgOBLzhKNoRJRP2wXKYEIF/kkfbdQ6wigu6PSQDrVui96NvSEb80zVsB6lia/m+i4dPaGqOo6wDZxle3v3zYRpRxHjslFhn80ruK3lMDBjIeSUDpoUa4u5TERpgq56jPtYNbTVE1szwHnHn4f6kp/FzLXOeE6jgS81VqN2ByDMdte/YrXQ3BfbqMxHwDUDoRs7KHz7xFWKNvAvpR5PVDF4RDQFXQJ4Du/7av/DDh2GGc5mcGvWR/MiG3/URF3fRwMgaLD0vZnWfLWQETPe9GHSkTvy0zIDR5Oiocob7Fi4EVNEJfsmprEMhihBHuaMyr7L1NUtVoaJwNXCfVjO2yRbm1coBeaQY1NrAijzhLNPWfKGiVbDvRil3TLnXAD2p07WdiGtThuI6KMO/pAJQnDegJSaWVhFPysCFKvRErCl7f+a2f3Yj2z8OP1yQhNwrsOsyxkbORrLl/XS5U4WR5oFtackUhfrjqADUHcqwk5McG5b6g70FgW0j2G038DPIRXUkIrBFKkbn6CbT/szg3JoOY3Y29rIyt4AVnP5vBfG7rd0K31vAav0+nmXTcz5WsXHDe/tUmJFhB0ClqkLYQoQls3idsXoYrS7lMUQG7xN6WcS/z/gkyTmTjZQ14PKVTgkqowNJWrdCONJaoResJwQXwQEQ3xgP8nAfjSum2aBCoIiEc0hd7ej1dxC0R+t+em2YEMsPXkeupCjoNj7+14LIuOQqeiFCTi5U7itQrzwDYgba5473TtlNDDCTmGlR1oOtWOLPrXQ5lgKOW/gB3LkLi7Awe5DKWRrsRWnwQnSHzJaFJhrLzh5chdwfz79zgnN62hea+77ZUBX+SXCCFiVv62h87HNrxycXPnKij7l0TKr++sKg9EywN/VPb+KCoOTimSKlGk9pG68dCPZj4uRYAApIybNAKB3F3XumSoXZV9iGdiyRPM+fJAPgPEjSsn8GT4ULBW2EqRUWP+HvJOQsSJMpNbj7w== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: c315a9c0-96dd-4462-925a-08daa31fbea7 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:09:56.6188 (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: e0XcnE4vTl4JzRTvolmT7BHs+KB02DQ7X8Uq/I8XpTjpdLiP62Q3PuPpptT8CtEBIMCwlZ6hKQyfA1Bs2j535A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_131005_885323_FAA08A63 X-CRM114-Status: GOOD ( 29.52 ) 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. Changes in v6: - Fix uninitialized variable in dtsec_mac_config 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 | 460 +++++++------- .../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, 630 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 31cfa121333d..021ba999d86d 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) @@ -3551,6 +3513,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 769e936a263c..9c71cbbb13d8 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..3c87820ca202 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,125 @@ 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)); + return; + } + + 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 +1019,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 +1078,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 +1094,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 +1122,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 +1185,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 +1206,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 +1261,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 +1278,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 +1335,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 +1365,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 +1387,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 +1405,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 +1431,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 eeb71352603b..410909188b0d 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 = NULL; 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)) { @@ -1125,25 +1129,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) @@ -1159,84 +1163,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 5a4be54ad459..c265b7f19a4d 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"); @@ -753,7 +730,6 @@ static struct fman_mac *tgec_config(struct mac_device *mac_dev, 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 | @@ -788,17 +764,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; @@ -808,6 +782,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 Fri Sep 30 20:09:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995963 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 62858C433F5 for ; Fri, 30 Sep 2022 20:12:56 +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=GbOdhJY/iQEfHJrqZMRH5daNbYHT/oLR8Q5Q6YgtWNE=; b=rEk2ZFFP2Tpn0Q GWYygVHVpYmJNkCu1EGYXwjgo+Odq/utpkliUFb1+QMbg+pwTt1B6uZruKSgN4a93cc/aqf9n/ppZ Xby5AW4ncTxxEIkhgWneDiIdxST7TIgQwV7YEED7OdX0U+CTly13rYeEqWGqHIar389i4NCZHwe6L +BIrJH+f6x2IFh7Hf953rRkG1IkkdSY2YQxQpSxttTBy8q5j0UhvF66mAAsbqLexGl9rLaSh2lP1Q rF0Gm/sA9Vq6AN4Xf7dg7Z7c6INEif9G/zt/Ez0GeGKbLwrv1g4BAYp7j8a9IXtxRfxHno11R0uPB q6MfDxHisTL3uXMbrjtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMMH-00BKiG-3v; Fri, 30 Sep 2022 20:11:41 +0000 Received: from mail-dbaeur03on2046.outbound.protection.outlook.com ([40.107.104.46] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKk-00BK2x-0A for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:10:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e9D8TuDAYrtBtheNv2wAJVCTMFummK1pmD/O0p0uuMvbTDfsRaFQT0w7jhgKAcLkr+4XqnIehv4vpx2v9fs+tXrlDZFTWRNzcCNJ9Y0PZ5Xcq43fV3sxhLVH3hs2qQAEv4Vdsvwj8ScGMftbI+8KiBqH6mvhgKBTQJhsBYGT11Zp2qG0gbZFJh93ib+gR8HIDH4hb7B2YC7wleKEjurHA8WuZq5dAj9dC7+cVXj1mDnXRGTwChbkrcuSuHGh3SEwB1xMjuClMGkO70mnJl+A/rNzCCcZTq1Mpej7w2ZYT1r6dkPskPvvnBnCRtY6m8qvMh8BHdYhU1SVRasLdETXSg== 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=EsdQEjx1Q6EFZ03LnTaNDwQemvWxkp4ZfpwjAwz4KCo=; b=JH87ZaO96/UwvMikxzj9qaHx3ktT2JubN4v0GvY5g27WLBaiHe4xIZ4PkKge6XYHMjTYR2dloadZPBNcftrNJAlmd6+ELIlsmIP8l1od1F+iSidq+SV1WM4DjExSJHC1qM3br7gUtYsUhH9ifo4g6zRTaQ+AFQJ1P6DemUF/5fH5+qhdIqK00yOEAFVapC7sYluEoqqWfjLsynUkGETn/20gK/QqorBRIw0qX83KlJV0Cuao3DEMVSXEbJOdb6DEHpxPNWw5b5BLqoPOPzn0j1zrh4X/K7vUmwHSw/6s32Y5pjTVzm1Oi8CK89KhQXX+6eRSnlJw1GIAXKOcPROpsw== 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=EsdQEjx1Q6EFZ03LnTaNDwQemvWxkp4ZfpwjAwz4KCo=; b=ZGxaBrbR3vkk/Z3Ycv/3ay/y76tKbTfXsQI//eUknJf3/jJxY5q/GwKt3VFW3ryKv+mq/e88Rwj5leBut7w64npVyXOvO3yRJwU2bThH78L41v0nnJrVlcM2DEmo+xQ5hQ6sRSn63qaZzIrXJ0bKK6eoYHL/Ms5JI6x8KEWn18cf0+oeAHBx2na2T7UVXi2ksmLZT6VyOq585uiVDIJGzQp7mDwO6x4eQ9G+moosvofAcq3iFcGTbAtBWoB2/R/YQv34XNYrawywPwqKttJ1zIkCNYue+rJebuTLD5y2FL2NaO4wMPUEsyGBmbTxguJJvnkI5aT1U6u7pMOWF6a3Tw== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:09:58 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:09:58 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson , Benjamin Herrenschmidt , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v6 7/9] powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G Date: Fri, 30 Sep 2022 16:09:31 -0400 Message-Id: <20220930200933.4111249-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a8b79d6-beca-4957-e11d-08daa31fbfdf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cn0AzZh3uYJruMJeFp/9rJTLW/DfVkuxluazXsYdWZZ0Ct95KIbUxZhntICmkOL+L8GEy78L4T0tXhv8/yl3C/IUMEKYWeFxMlKTc6sEUdBktC280Dzvb03+FaNxJhzMkEI+FzAHEV2dS2qBIbgRthdsPwdNf1NHVrrfL/XjP17CMmK8LFW/myI6wR6OXite5EykN/qtEnmja68ji2s/vIuknxkvoBTw1NKwlVBqOkZcCVsweFvZlT1vDl1BnzFEvoFE6khwkx5+XDx84Wwf4ytQ70nxHo8yPqLIr4JiTb6MPwpDUZbhUcQsYlAXnJ1LRWte18cWg3w2n0qs8olRXsR1nt6D8awLGh5kBplh5f0wbmMr+iH9ZUVxHrGtJ49kRPvQQPcunW1xkALx05zQSYFtdXH/IOmS3jJYME/f9/nVVPI3jHZgMqJDCj9aIgMKS1kq+IKS6upho/rKCBQvwqAYS+ij6FQEejZNf7gFmU7j8ssfiHSf7534Hg2NmxANmXTfb7wR88VxlJMS4YrbnnRcUMqADZqg3xnPKUe/Fy2UPjiD0a6sbqHgBFGygu8aUW+eHvGwVQz6L07CAV0tjN5dofI+/DPfPDZoWB50oExAWzLAIazg7x51Rw3drwe034/7jC8YSOJ1xzG2ODaSiq3we9BbomlZpzOOr8KanHcc5RL4QpiKVuJirgj/arRzH3uOO8Uk8jNWXmCcIB2+Mlk9KnKibAYE6evpuCyS4hq3NyIZBlZ/2/oMMAqm84nung1qOLkzyaUbGgXOaZUjKg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(83380400001)(41300700001)(36756003)(6486002)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j3aojaxRKeI0mcCk8vLMldJFpzxQ822xvvIbqnIK4xTbnmpGuvAecg5gWWqheaIyFJKYN5IT3tTeZRSQfuTSNREi8Ef7L0dXw/hr8GbO/+o12NlIx1SU/rLSaiSk+qZiZplHP/9NYF04YZh+lreMjywwz2FkkNEmZPWW+8lTDX5kNRyQr9tC5R1xKx2lq7jJHgfVDsnOWSHYwm2uDU4P8qq2uSn1sKc1y6iBht2bGDs1op+81aFdAlMz0gfzIso39i6+4p651jKOSlXT8wNOFxj5Rb3m7wC5/ZM/fE36LPfpEmnQ3B77xB+Mg6gmxBR4E3oA8gizgo10+002szq9P6GL/IpyUA1GpHMQ69hYlOB+GwVD1i+IC/OmliNhpPKf6ozVSPMU87GcJYhhLcQbYCpShvhKdZNC4cCQ2kqFQx5TmvsCIP9vuMYz+6au99LEor8kY4AZeVuiuzSmjWoJN8BZvPVrIH6nfudQHAsemyFtxKt9Cg/9FF9hc4h1V0sSKKx9+Slr1KLLk8xQLWRF9tPZK9U1r6L/N+xRi0k1BNWVV1eO571IiNwYWwEUyhrlXqVu1EjVgzO/zEymfTotIIGjbApt4NJ0zefErRawIbquIwqdknKUUMS9ZyE6cYwWoFVkNvZQ30AzNeuwoJoLU2pvqLowUbpCwgwKjgS64FsVrlEEyMnLx3DxiO1/uyvO+OAMWzNccOSo7CAEDzJuQDUD74ioEr5zFIqA8KCOfg5FOy/yrHtesGwizcoSkO68CLd5K3vxDcNvdI5e/4bpYd2KgQ9etTTWtZ1wA+yyTLwjxq64tkxzH2EX1BDWnTo5zVPLYWRKZg8C96d5rxZ1c0XUMFWQsoebwfsPcOL0JXGN5D0Wx/jVcaZV7nSiK0SneDt84IgEaQHHfO/eB99i6cnDZTn81mNzQdoW6qpq67bR6Cj7veP1lxn4B89QXGyDLOgEuEHbgaSNOHTi6xGFYWY9KqxmeoYNKHsj+FnSsAHZRMIo6qgO5NdVu1ZyCotIUHIB/dAb8Q5Gv3Ip7th9/KKmpf6cI+5Wo+WRIB5JLZtXMxpQ+ZsGnuHK2G5dekGeZpke7Lx5Dtq06nqMJhUUamf+4K87Gv/FFI2Yqbni8eH3SkYHSWVD4LKKbE/wY4HcngByh5DcBt4xo7d05RgC58KifEgDgUr8wrxZVr9R6wuScjJpiyiWSmTYsafccxGQi1l0UH2+Ge5z7iks6QHNJhGBaH+qwj+4Z99wJQQD0GNTK3OL87Oy0qjUh6oVB6Yg8nOdNxUmJ/yvhSw4nSE6e9cLJMrVWuXgpyxV/1bJKkcVdHHhf8grVua4WlqRCK8t0QDmUctcHCqPgOo3QRTw3oH+N5YDQUYmf7J3mb8RH57Bg3yQkJmI5lEn7wm6e/KydqWs3Me5HBzgvR/ng5inqk1fOr1T+Ws+H/vFv/1pmLrirY1VZcMYrViorGEZR4w+94XwdbVSs1wI7j2wz53n7mc1t241JnSAvbF2gaUQtc217fgAQAIbT3dT+PlRIzGSLE+1zaolhOEwg1FZognsC7SmIWQ+Rq/sJCBA8fUkOXlMAD1kfWqIXwH4rFuV1IySCeHG4bMK9jDA/VDJG3GrYA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a8b79d6-beca-4957-e11d-08daa31fbfdf X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:09:58.6499 (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: FIRKc+m7iWdx47p/NG0KYI7oE9aE8T2kxo/Wbxxyl/PSwptAoISvhiP+orMJwPQ25MZseMcrV37PCPwPbwIJ5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_131006_068038_1EF3EA32 X-CRM114-Status: GOOD ( 16.08 ) 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 --- (no changes since v4) 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 Fri Sep 30 20:09:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995964 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 1A636C433FE for ; Fri, 30 Sep 2022 20:13:24 +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=sZpoLPNgUtBGzoTHN1rIZp+n7F3g1ApL/JXqXwx3OFY=; b=pe1XQ09897kYbE ZhCCvKpxoKtieMS/iZ9wySYXxIfdAcUrysc/NXzgNzeC2VF5WI8F/JgHDAYqS1oXPTPaUx36sCd4u mDq/RsAGYYzKTsXq4kK6VhQsACpf8wlJBdSbwMEn/olAz78XQmuGMc9naudVqxmr+onpPedAuGEP5 cOSNMzFTvm9kD4rnShtmzHCWZpJjZfduQ7a7na9fNeIGMJFakHSWv5QAnHoGBDwslntd7hRDq2W9N UtpHtzhn1pswxZv0KoRKfQPRixm5JByX/mXvAne8MwLO4sFYmsrUNVm5U7NgFajFOhMUItHnya68Q lLNHVw2ySpOFo3S/f6iA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMMk-00BKz9-7N; Fri, 30 Sep 2022 20:12:10 +0000 Received: from mail-dbaeur03on2046.outbound.protection.outlook.com ([40.107.104.46] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKl-00BK2x-Tc for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:10:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TsEl3tfE0X3XsxdewoIb3sDBPcwqiRJKVPC9LV+flqOVYc497KYrqzDGMFtyoiFKinAlWp09pxILlLwWmieLVxJv4YPkYXJL9WqioeybD4OZtQHDTUGpzxIoxjhfu5TD8ibz5nU3++Bk1UsBCplZhBRV6uRJwmH2ME3rSjx1z2qE69OgyJgTv+kSYlBirmFk8EU7/RBu0JfapBx+tV2IJljXqyEItcFCReMpkalTxZLtsyGIQ8EK6TUNArhqt+Psr2ImK9vvK1qVW/hktBkDNs5LSlmAlNbj0rgnWqPgkQ39yzmRd2fE/jvBvtgpCXRGMLHVxfO7tHX/xBQgmBNLtQ== 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=1LpBZZ/E0MzZ0ssr0uah78Z2jasHTDuQGEPDYfnFsYI=; b=XXEfDKLOGsbPl4a9eHk4VwZgpQmhag1pSpBs9Gq/4VtaAXo9VTv0c3A8zimusjJlccsxNBg0nP3RAMDN+9pKorUk/uCikzwviVB/XzEC1kBadb3mz/W8JV9srqOKSywkhpb/ozGUyhN54+7JHucTantvBWYCnmPIOhs6l/B1P0MRUjIJMJJvQ2FpI9ZqZOVd88tZRcIqa3Ksa2ltVENxPPCmSiAcSqjz5JdZxTqvZj1QEQZdb+4LTzgqHOT4XpPzPZJi2tpimOlSzM9wXa3QyXjleDIyJK8XsNlG6YyWtM5a47l50wzaxOeJNJX8RpdyfJn+p2PrwbOAv72zulVjaA== 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=1LpBZZ/E0MzZ0ssr0uah78Z2jasHTDuQGEPDYfnFsYI=; b=E93AcAMMjl//kWLkxXKK02Vl4OvtnQqx9cUCEEOAVa/wmmaWHft4owGOtNWLRGBopncH8CtlaRtOQVlX0ACWUKs0OS4+46Azx9PTvgidPlqYnkof65ptEWiv5IxXKFd4gIlZ3Dma09AmylsEQsiC8IQD6SWkQiG9XRWDLz76NII5QPESPYm3We/BPz886yvNxxyDzGcBk2yT/+/6yDJ87TW5rRdAwJOq/BFU9zGZhdJnqenb/8OtkX/KBgAI3HC7sXYIavCf3DZ2POupKkehnUZe1HDzWGevlpMM4MAf960Lia/8JN8U44kNlN9s3BQGgiL7fY3MnLdq4EBamEJDKA== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:10:00 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:10:00 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson , Benjamin Herrenschmidt , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH net-next v6 8/9] powerpc: dts: qoriq: Add nodes for QSGMII PCSs Date: Fri, 30 Sep 2022 16:09:32 -0400 Message-Id: <20220930200933.4111249-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: aa372049-6ef4-4933-b905-08daa31fc121 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EzadVuOKl0sJJGfeuobrUi3SjghAzMFguY3P7nWM+dse9mfXhs8mfI4HCKjTRhdAtEOu+dRYXA9FdsXep6j3TKG1QV9VLoooa57K/7hYRHXH1PqvxQEoJdM6dzG+GSJ+j8MAJKkhD1CuOABhZMQDoV/dgZhCkUUMlGW0zQen1FtEJWCH6qK4w2CyPbGFsf/dHaxWxCXHendnx0jQeqJbOh3T2+0eFVbpfIevzAkPylMJkcgwwfHAx6GIKCWYmawyK0ofBgjcqxKog9qZw09Kbvb28OVyMPgu2hrYicbYB6lJ6ve5TXieJJSabc4+ryoMtT3VMsQdMoZHmupdMnzMd4euWbwtksoI5I/UGCij/9XGOpTVeKR8reQtA0hlNHXMcGUI+KwyHBVUewnjsbW9S1Ofj5UqeE+n8hv2+yg0oTZw29DaitFrYPTp1IIq0d7TBn62k/CIlrkT88q2PdFU6FXCO+lqYXoEKm6V8mEwGh/UHwvW/ziETtLuhbelC/tHmJM04egbbMOYwLXhQ57moLONBDm2EsyDpPDmlFXwpMs1arxStApzzY2QoIhFZCGrF1BftFC+mCOHNa6QSes+AS+smkAYdck6Fnqyo6WYl4/c2Tx/+Wnbv3LNZPw/6CtWmmeZfClS4CLeQ4HfR1/1S4kYlxHIRhbDm3CP4bpj9SohndUC6rUqtJk986MZWqf2+ufWwvW0X5dcMoHqDQUVTbZioxJtpzotY1wRheW8+5UkjUtwX+6TRFV73SV8ZkGGXdeUl8ndhHF5m1G9ni8aeA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(83380400001)(41300700001)(36756003)(6486002)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +An1k7CutCtPnIrRDnHSJHau0B4ZErEE5QyP3lDpcvCuX6uZRkxpCjbBFAFt6cNWBFvPxJfnVzHkMj/d8C9gY9VaudNVdwaxajddcpO/HHcOxaJjsWXFMSbgH04bSNjcH2JlJa5adeHWgar7AlXdb3sgmQwajL8F5FV1jwX77HzY5GoYUK0UXMzEeyefj1LwRMLTmcQ6o+RremkfhjPLuLVzVjHmx8SXWW8KZbOiuxU+FjTuB+oB0ZSSlLXYytsaIksU0doi+Qs27SpW1VryAmThURQJu23maq2RTSoGpkPjg0qwX9FCvg4V84eB0goKpW4QF6Jel/WTXDkvrXQfBallVnbXLcn9G0IDunGopPHHK8lTqNgBayVc9sTFIe6pMh2b28KArdvxIqnwld3SaaDJ0MvSV5h7DZF2TuO0bdo7SDXgFv9ymXvDYc7jvQJp2npuaek8Dieq5pNltrUTtSCETc7TJKOTBYdlN4AKr2P0guaRx9dkhgCWvbiMfFIkOTbmb88pywcuzCGGHhdB0xGPVhJT3TY0Y4HKbdo8Abgd3eSHKJ14eVtGtZ8mtTF8gv+Tws49T41F3OcWFVua6+aUO9TrD56Hg2ewrsSi92AdqM94N29ygANqw7ZN/XpLcLd1MsQoB2uh+d6h1jOiol3Z0loBh7bTcRcM8EkMn4MDA0Z8sp+Vsi6sglVdbNVinLUtvUGpt0DRVB7ornmOTXED/CRij1SYoDqMUFWH+4kHfphFxYeUMf9TVsq45umEtLQwcYB2mcaSCbEmaCb32q4DDWyJU2mzrq1e/jMHobC+wveNXotHOrliLz+RWN6hAr+2sbdJU7r+qui1MhSqyV/bkcytTVnY50PNvUikoLc/FzSKB+wNBJUXin1l4mlaeuB0pazbLGo54HklTzORbgHvZXKK6/E8mLa8xHTLD/MIec8y9ljZSu5SdyBIYNKTUUOsPGClYb0ZO0CZsdwwbWFfBMpIX30HueYJqLBCXkzQwPpl9nIqclPpLmkkVz1YVdywQ0mw4FR8+OOeusSKAhoZgLHkwUG84yLL6mJtBUO2GOXComlxSTfckpvObzVPlQHN0vBMRHy1FftPTsuc35CEqjaJtN/h1WUkLgXpa4Jh8IFIsgtvdSgV/SJt/INmkVy7a5/UndowS0XLTVO4UsQjh4YfwcRmO/fOhPhbnrkF7W3xaPLNHWESlrQjCzg5a359awtCVTxrIieCis83slb1XqzgwjVkrK/eSyImK3YIwFq15fOa/OYruup1RvNnP8NAGGu+yJWPqbjhDO9LQp7l1kHxStKUGtXlJlILtzXsI0MNAnvJ5xNb7kcoFKuyIXGJDmNWb6RJpSElBphuyXBo1oI3fDiseMqNOVlx2qGnmj7E9Fed0lglpiuLIw6WodRQKBKisAIqazkoHWCRhoAT2R7Z+SYfSQEvb937TPgAqBQwy66kQp+QXwtoAC2Ypi0GbqgOyEVUieF/9yN7RiWkmADbj5WTAkmXuaRnQTCRvFNfrGMLRkq07B4ZNGwT+YCcb4hbsrvAd5rkNEsJMi38sjCI9VBoo4V9iSpXNqxdzqNEnv36nKsMfBF/W8fAhHFuqEPzjaQTm8cuAV3Sxg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa372049-6ef4-4933-b905-08daa31fc121 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:10:00.6810 (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: qc+nR+WA2pBTl4cBzsxL/pZQM+PBLF2BbJu+hsKhjHys+vwk7gsLtfVsgfRN/EMT4ixlMfjRf9v9cuQHOmMplQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_131007_987325_3DEE329D X-CRM114-Status: GOOD ( 12.46 ) 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 --- (no changes since v4) 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 Fri Sep 30 20:09:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12995966 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 273ABC433F5 for ; Fri, 30 Sep 2022 20:14:33 +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=JrU3BkJBBalaJO HCcTo6ZWy4RapGfXKKPIQKx9/HB87Fv7gtZIju9XTN8u5TMav2kN4xgErwUnn3jSJS6/t1MthHAJT /LWk5bsqM3yS4YdLbbC3G+CA9mrGuG1blRmmNU8VAn/KvDUghtXSWORE/k8Avd5F4xe+gIBUftJVD eezsYyLGKsKZo0zCaFsCP4I3MTLv+3f2WDrSFtKcBvmFBrn4gTPb36tEdAUNvtgX4sLH97zK8vA5T /m6WPsBcPU1sDY03EGak8dVF9pN+cGrL8Dqi3305hRDPRxiPf8czPVqhtGW3zfk1cpTfZXdI5hfBD U9ORvqUCzhYLe+SDM3Ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMNj-00BLUn-M2; Fri, 30 Sep 2022 20:13:12 +0000 Received: from mail-dbaeur03on2046.outbound.protection.outlook.com ([40.107.104.46] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeMKo-00BK2x-KM for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 20:10:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D54kJBmksJCZfK2FoPO9Zoz9RYt+1EmQT2iALyYkQHNXERPZvPF49G1F+zG+vaoKk8qya54QYH3n9Ubf45O56xofPsQ2Kk84+yw9SO0BbYmbjUmFeVNgY+7dpSpEZew8OOJcx1z4Sz7IbA7d0mKJuHZDNnksVNMo4xoyKzyrvV3wLuAyWQj2XKbK+TNdSHWQgIsVTV9XnJ6+4VA+wXGpphV/yi1cbI60quCEvZp6aYw/E6wocBqnb2Qt5iyFBvW48eB8NmEGU7piD/rNnK/KlfUh4Azhl4wejbCM7J7do7noKpVXX0j154FBWPZhm4BNORBhH1MRyudlASRwEWJzEA== 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=Bwn/YCqR05i7DFzvotfL58doGVzJXI/AUmtpqeryjryXtXgATWrVcRC35mESS5HYhiQlITrIeCxGY1D10Y7PeSCob9UMmQKbM4PyWjH+hqst0GeGHFUwedtUVvtErdrb8mWFT95JJu6CGzk0luMxcvH8olmWn2SCqXlxSaaBKN3/t73x7IE1MQ1R3xL1AsiUrFoJeObOjRGmtz+51Ys7Xz5FrS22GP3M4Dt0F9J5W0iGUUaTWc9t7/hUAGIljo1Irig4o0ax94uEOvMSN21s6RMk0SqpOM51YWWC4Eyeo8gfzAbhZnD5AFo5xNQy7ef8bPBFFE1svScVCfXdtKGd4A== 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=IiGxYQa7CSxAhymfJM1+6kbvCnQD8AYpH6ldsRc5anVzVeoFEArZN2YNqQ/tW+1739dY2D5qFaLb43Pb4zD1ucrw7ovBulhYW7cBGXgmMw9V+EA8dfInBMK682uBUpmE9X9R0HhqTAEkNJznS3GX8nLENaIShnva/fmKBm9iN5FOcEx7nBDDZ1uNmrYNOrpkAlmZlW9j/6JMJIrNv0JvbAw0TGPnZeemagiAodJ1XKwZo7suLi/onHjdvo1UwDeNLWgZbUvh7+HcbUUJvlLXwwvq0JSuRcebP4dIYqOSa7dvryafSAonvjRQm/R1zweR79cabz6od9e+nDDzwgvYEw== 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 AS8PR03MB7749.eurprd03.prod.outlook.com (2603:10a6:20b:404::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 30 Sep 2022 20:10:02 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5676.023; Fri, 30 Sep 2022 20:10:02 +0000 From: Sean Anderson To: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Camelia Alexandra Groza , netdev@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paolo Abeni , Eric Dumazet , "linuxppc-dev @ lists . ozlabs . org" , Sean Anderson , Benjamin Herrenschmidt , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , Shawn Guo , devicetree@vger.kernel.org Subject: [PATCH net-next v6 9/9] arm64: dts: layerscape: Add nodes for QSGMII PCSs Date: Fri, 30 Sep 2022 16:09:33 -0400 Message-Id: <20220930200933.4111249-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220930200933.4111249-1-sean.anderson@seco.com> References: <20220930200933.4111249-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0144.namprd13.prod.outlook.com (2603:10b6:208:2bb::29) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|AS8PR03MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: b9996548-7008-4857-b9e5-08daa31fc24b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UGacYtLl/7+x2ybBfyqs4qfyjGhp7ZIeQk29E4XGlOLgOLO7tEV7TUcv19F6AewEFiSpi74ZEPbuxf/RGLuLs+cacxXDqeM3f2MZBkulq0C/mztW/zISXoFmILP3LbKS3m947XMn2KyBH/h7UcItcwWbIQ3g61WWkhAoTpZ/Cl+XYH31fvIlKyNMyMrMRLwQOcTkZdLpxm5ya6UNkmgOCrVzOVUX+tjjV5hC16XdKZVy7c0nczR667UiwdlBtCmmj+XOADY9/vPul9hhNhC9GexDS9fd0Eswn365zrXa0IcH1ZUQ56LaADZJjUhlZ6nz39G1Dxh/E7WOqS+j1UrOETz+ERQaq0eUAq3j376VvyXJSEuJYwpGv4Wff2MNTpe++zNklLjFq+xi/GJkpiX1ez24Ficwbfs50Kulq6lkQirpPwN/SzdlC5EKpaJt79PyU4jRDi6KdnqEYY7EikAmrniu4yc2ZbGqpYoomyTtrUZHsIPnHkTwBCK0/LWHJjNUvGUSrDfQbPR89IyMNCHZ57M2g7iqkcxjMVTVP/SNXpCOf23sXSC82BdLPAZe5dsSLDqjzH3pPTa4IDfiVFD70hlMVGMV8roTjLc2BWnqxgHx3AYbo2sNZIa+u9x8/eOn41yNqKquBUxAJpu06Al7YUt0C12qBLH5g1xmz1KaLmQ2m2kY6NLcu8mNlJ8zmlYjOlFIV0pe0mlUVoddPd4zi7QPte7ancCfRD0EBubO2vzzOM54yqcUYL7qoPTY3KMR5OcpTJUus3j9caukxvyC+A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(396003)(346002)(39850400004)(451199015)(66946007)(2906002)(6666004)(38350700002)(38100700002)(8676002)(66476007)(66556008)(4326008)(41300700001)(36756003)(6486002)(6512007)(478600001)(6506007)(52116002)(26005)(110136005)(316002)(54906003)(186003)(1076003)(2616005)(86362001)(8936002)(7416002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x9zRaGiVwyCIK6IFd+AufyqoCF7wDdzZ8BQ+MVjzTrcurFCc/cqwUue3Y5YoGwRx0kO3f0jyJUdYwA9Wzw7uX7e7WGXNd2iMONONC2IKVbkrraHitem77NXmwMP64vYqQo8Fu4zgbtlE6YHuqsa/g4TMKSY0RV6QtyU4Kt7Pm0AuWSoUczP2ESPY5GUSAEpLto8FdFCkd+5nyffz7u4fbKXg9RJfOwoz8eaFQXdHlkkeAQCX2TAJZxigfC+eJ6tRMHlCWaNjIIbxI5t+bMSbJpjVjNrq0Nw06uUFvlkDrB1NVMmqexDhYL4rmDdemS0FyU11yoT9jiuVUXHNinROrPROstvoEv96Rd+kTQTM2wSTEwWaxevWy1h7hCcb9NHw6JCXh7PWbgAe+ee90PyCE2DsUHoETRd6ySsUwKa4a4XKvEWkrNbtPQSL4i4+1y8DLCApXBGxOAIwjVvquhxyhyAfec1tKa7Os0ObkTcqg3e5eTVq/eBQO3Mij4DfgBrcoWx72tE/hxyUT6oImZD0UDItIFm3jj/7yzIX/VM2tIIGgexiiTYHsU3Y+vJZtFnM866+4XtGPUCySNq71px7St3m3NlVrL6oOEET3zB359XGP41feKlB0d9HSFa69klKS5BrGYcNlLki8H6SV0rwqFj79hfCeWDOWI1vzagwq8FhSOrl63i0tQyiLNyPvqEg5EmLx28b0b4jZMPb2n2H9gkoBGAOHboiujwhvGUfm5+4wTNH51LePCU9zU5trpAvGIFhhBARRPDej7aclvOJPwu66Mh8MqdJwbPBtAAzICX40cld/hivqzOrzhnGB0IHBpBhZpNbGEqIrkOwlzMAT9/G5VWWvT4V8k/vkEddXYVQY3Vu4gDEbnx7xRNnIlciKvR1igTfPHhAZ0pu5zx6ixC9I5kwUo4J8zKwq+/d2pJbFbGtglfX3jWVUaic6Yz4KGSbaS+24lJPti/PzvqZwIoK9VjFAgTtpN8BVH0gnfW14jQ69W2oxpMCMg+8Nw9SkrhnYonATbxrKevC4d7oEuXhbGw7JDK8NArBOKdyZgJR/b+4+qod90r2qyMw4DImmQjE83iGnTkAeqayb/sMlwafP3k3TWzy9AtZIzQUGEvlZFAM9TVRfcaD0Q73uTBqN6o89EzqaUzeGptWI9w7DZvAH12RQm6WgJRp/IYFEw73sgj8Lz0iszo5TqUkMSrCtYkDqthVY6DA5tHVab2Bin7LO8nFP4y/KS1QfzKHQyGKx5M/kMxr47e1iUuljVQNa+b+JPY+FboLRXI+JA8nsUiASG2wwoh6XjHFz75CEpr/5CS20Hr4zT+wAJG9B4fke8B5VHiSFl27aTKDFUo9hszN7vmg6F8evlfgUso1H1TXsJVzMl0gljQJ185LpIVTe7QnIfz0eiGAVeSeYrvDTfLYGJ8BHJu6yYOie+3XOf98niExjAPG6WmFuoTxKA/j3oQTDX85JpfqB03MQS7NE7ee63PMqxvts8iDWy5hvY31kKlnnFQ7GBzuRBCz0zMLNPZMHFwpkfWzBV2xj32BscyuCrvwqMDXZcdOaXpzZFAGZNY208TFA60UYGWuHE+fCt+P8n3F8RuHIF7wXSajTA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9996548-7008-4857-b9e5-08daa31fc24b X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2022 20:10:02.6496 (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: 8h04EDgrngAUFTvAbRWnFWxVdQuyRB2sh1T6/VMBM/OrHQT2ixkJaOcxPCfWM+lkeyKrolc+HXdswNoGfV8z2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7749 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_131010_697997_5F5A6A43 X-CRM114-Status: GOOD ( 13.20 ) 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>; + }; }; };