From patchwork Wed Mar 9 17:27:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775352 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A6FC43219 for ; Wed, 9 Mar 2022 17:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237139AbiCIR3R (ORCPT ); Wed, 9 Mar 2022 12:29:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235077AbiCIR3O (ORCPT ); Wed, 9 Mar 2022 12:29:14 -0500 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10078.outbound.protection.outlook.com [40.107.1.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 170B48594D; Wed, 9 Mar 2022 09:28:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BbzB7fbI/dWwoSzmlyHQ7GXM7xnQcIA3M74UWo6cYWBEjUyAg/Mjc0uUTpj6qNFpaAzTpyL1rmJZr4DbcCMHfWkWymxKy9Dmj7jdlRyj7Wt3xhDHUT+Rsfb5h/kTXMAcVa60BYu4jrPyL3JbkJOgtDlsoA0HniydPoR8x+gMKgyaSiObBS+idO/wGnF5HQIg7+QkDZKrY6wur11jwL1Ss8/CzFtAyLunz6eBQRXdg/xlmb/DuqHkqC7ndZofX9CdmMJZgrUIrJkzfuU5/F8ezQckF+rf0Vd1t508eslnS3bhGx1iIvsUff6PWGJRwmya8b0DvJZZkU/dBGEeOGtdHQ== 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=pg39giArKmljMdgu17iABAbOgEbqTGpw113oWQEBxzw=; b=OZef4UZWsr2eCdmcC5dFsvoiYccsM/4ki0M3pIxwOzK0roFHeZPa2bryzsEEQL1bGDjbeD0q60rp1aMc7jYLXR/jkG+5DnqhIa0SI3Cr8UfGJKw0GE1FryaXYcarYPJXdCnlcpEq4ev7Xsd6KeY5kVsj1eUVxjdQI/3fQ+aLnXJxz8wx5JvvBLfSHXPRImtorFYLXvV6E1gHRibyr4QprBjNk5AOkYPnfrTc479UUs9X4ziNM8ZIbS3nKLA4ZKVZ2awEOyo7HxX1LlSXo95tZwQ/OGRxxfljkbbnY6rp+FAgTmEJF9xEbN+FBiQEIrqfR7+5dDZOO70VwtH9mbtoSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pg39giArKmljMdgu17iABAbOgEbqTGpw113oWQEBxzw=; b=oYybEDovmnE2Vhb5RHs81MWFNL7VdtVzNT+uQ2K0gamB7a7IhiEsfWmMWWk6EHp6B1k/cUKmaXS9MH1U2RwO5ml4zTGXand/lWx83NQ0x+qS6nNcWL0RILfYSkcmDoH2EFXE6XX1QOh89V1HkmsK1rGLZ4mJnFxkrjogyOmzml4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by PAXPR04MB9422.eurprd04.prod.outlook.com (2603:10a6:102:2b4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.19; Wed, 9 Mar 2022 17:28:07 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:07 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 1/8] phy: add support for the Layerscape SerDes 28G Date: Wed, 9 Mar 2022 19:27:41 +0200 Message-Id: <20220309172748.3460862-2-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 89034eef-2e2a-4340-e7a5-08da01f22c8b X-MS-TrafficTypeDiagnostic: PAXPR04MB9422:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GRgAhyi3bSoWsiR0XQ5tusmENAxI/wTyAENntDzlE2QmpMFbNr6phPAcYNuul8+455F4MLBVMLO6kuUrx5sXtWxB7CM7iGqdpUgntyqt4uLv5FXemaYmfiSjM+1MD+pUJH0yd+V3iZz7VPE2hvQyyPXwZQg00bSBM2O1VzOSO/Q5c0A2zb6SWHxppM5VFt9PzZK3YpIMjaTfIt+KKAMnHy6Inc4XgqSRm9yYVclzYu7MLOztci1tfmKCF7Myxso93SvBN89EcQdW4Qhho2RuNSoIgveN2WaYBwdAguFAW2OPlh6nKdro8pRioGzMcpMj+yom/4uyVolWPRJP7ahIvvXy5RxB110YmU+LJp1uvs8Evvf5UTXZqy4gZNqXw45eIs87PCpFu5K5cuys2XTBht3ULO0oJk2pm4KZkA6fqAPPbZchOBT0Knhiqit/h7ZAMRpdiRDDRWUKNV8L5BDvJd9tA09sJmTRs4plCVOPCorG+k3bfYT46NE+BUaJ2NLK8z2r0Jhpn9//d2AYMa3jX8XkwCPWSv1J9M4MJ/6IBsrFPhGOBUrA/44IHOCfif5BGkfPlU6uv/cqrprRgawuSOD5RuBOJY/M9C2H0pZ5j49b9Tou1aXXtkL/I2CISOHrkgMF/HycPOzAHjIrUmm7R7U0vJAEHX0m3SCHUAcBxj90jBJuJqH/3NvwxEfahJh5zj0+mh0jkcNPGwAYYSwgfzyVrIioNfUHIztNCGnhH+N5H77q9L6C1YTpuYzrpU1Cv7nORO+A1dKYxxFHVUabD6MVAym6kAiI69nohdxxkmo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6486002)(8936002)(52116002)(2616005)(966005)(6666004)(6512007)(498600001)(6506007)(5660300002)(66946007)(7416002)(36756003)(86362001)(38350700002)(38100700002)(2906002)(1076003)(44832011)(66476007)(66556008)(4326008)(83380400001)(8676002)(30864003)(186003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yzlMJFa+4MfC2D7dYLf7HNM22lw2HGPSqZGJfex77HM79PQYaychO5RT9KowykncOdkejvcGcdVR8tWEyvd13h5RpVK61kREk3ITBaGdIe0F2m7T4B6LQJgfan+k9OHiwhiircAfIvBWZUQddqXSTEucZ/kx/55SJcEPtvXHMBOLdLR4Bb/hHpcHWOS6BwsoQDAzedyljN37a0ztQJrfY1WtXoDgGnytFMOqQz2jiRdA60Y4RHjj1jbKEOY+ytsuGc5BYuYEUha685+1kS8YF4CBniwXhXRkQaDOgyUS8l8m9AzKxeHH/itb3XKzAZeXS3hQMC+kIGNNaQW/YEhzD7RRHdYGyx7RG01i1oKI/UVh7t1zILrFK3MKfED1G745y77zBOlzyDGi0pQeLAKbZhyY+hyP6KjV75rwGKrqKe1OEOat23u0RoVLNkC9n7QEmAHWYtuQMr/UqD8mmegReADP6/9uY3VNt1kIpk9tj3Vd3XJdKtIgMHRyjBorZKOQwwYLI2x8M9lPUOmYz1a51L1G4pYh9tS8ooBwfWUlub01HtHJ0xw1u7QyRfxv9X7A9oPNIxtlIYrtBYYUAFpJz8X8BJoHpUVfyB6aqJBMRf6ghtBbmr3JXu/G/xdqLc+o0LSBzShaU95Z8joUzEn0U2oq5oAl/zFaX3spunyivuRvXMLi/oI+/ts4Tk6uLsM2pBSyjMJ/+ZimUjoQoWpD53AmnrbEVhISpeuTcrkU/Qj2fAwgQsLbLPdvEHxb8YcGCNoUnWACC0AsRAswy+RKZ6LyS/12EOGGKZbGOhuSXgrE4VBOd4/nilg1PleTBNAr96w0y6JzuoeLNJH7Tj6FIXGmJm3KV4pgmiYZ0DGwENCx6ASOgP52xsfQwJ6F6KnfttpV+eAAiCFRfb40AlW6AQ3M1spJ+3zfRjMGrmUAK/iL9dyve0H5HpFPhAnvRHYT8aLqhIyM+oVTwiXFgzyvGAVN7FQ/KBcgt1YE6HkKJ8ZEssWS45L1XMhydMSks3zx6E0G3DRLg7IV8ZRTsobe2+cTTKHPAYn62FRsj5N0eEU7zKQjrl7QFjTeKPOvPLZfX6mkUzjJ5DjpHdHek1wYbitEFoKCrjeh3BzhLJFNDv7V1I5ChhxiZ4CrxtB5Y02aU6imQ4fHuS4liZJBOQcLOIAUs1YwoFaMXI2uLWQio9/ia1VhB3hbhcJYFFuTqEYStoCt/0gQW287LSQKAu5Pvg95ulw1Wpl9wKXf7AXLHoWKTlCge4x7v3oZqapEWsvu5i1blQZdMJpLsh26ezqsqDCOhoHuFlOhxWPZxz4ACjZJPgptW30MLtHNpQaPYsQhxAKo1mDPPiIYXwkEAFjSJvEWVM25Y1jTHgJ7LvfR8IG14iz445wSxTNVad/sQhkwAbpYliXP0Vcrb6jsqQcIoHCXVDei5pIWuRxEu9ystyBwvvRxVMKbo8bMIx6IR8lU3wncNde1iYaDqd3Rh6v1/DpPR59IpiqJAmRVlS+jAPqw1648nldZPdhmD6cPYRReMiaUUtimjwOBdzSMX1jEb6wCZ+1cvMwA5KD221dh3oY7Y638KG0n41LH+GCAa7ZW8vJPSW2tlOceGV6sPcPTH6yt5deq59+AlOLOXlQiqqM= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89034eef-2e2a-4340-e7a5-08da01f22c8b X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:07.2830 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +qvenWTxKH1u1skv0vvL5guyD4pKivtBfEwktDdF2Hnh8axTgNWTZJe9Fa14q/OD6P53px04XS2HghBji7elsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9422 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This patch adds a new generic PHY driver to support the Lynx 28G SerDes block found on some of the Layerscape SoCs such as LX2160A. At the moment, only the following Ethernet protocols are supported: SGMII/1000Base-X and 10GBaseR. SerDes lanes which are not running an Ethernet protocol or a currently supported Ethenet protocol will be left as it was configured through the RCW (Reset Configuration Word) at boot time. At probe time, the platform driver will read the current configuration of both PLLs found on a SerDes block and will determine what protocols are supported using that PLL. For example, if a PLL is configured to generate a clock net (frate) of 5GHz the only protocols sustained by that PLL are SGMII/1000Base-X (using a quarter of the full clock rate) and QSGMII using the full clock net frequency on the lane. On the .set_mode() callback, the PHY driver will first check if the requested operating mode (protocol) is even supported by the current PLL configuration and will error out if not. Then, the lane is reconfigured to run on the requested protocol. Signed-off-by: Ioana Ciornei --- Changes in v2: - add MODULE_LICENSE MAINTAINERS | 6 + drivers/phy/freescale/Kconfig | 10 + drivers/phy/freescale/Makefile | 1 + drivers/phy/freescale/phy-fsl-lynx-28g.c | 630 +++++++++++++++++++++++ 4 files changed, 647 insertions(+) create mode 100644 drivers/phy/freescale/phy-fsl-lynx-28g.c diff --git a/MAINTAINERS b/MAINTAINERS index cb75c5d6d78b..dd42305b050c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11336,6 +11336,12 @@ S: Maintained W: http://linux-test-project.github.io/ T: git git://github.com/linux-test-project/ltp.git +LYNX 28G SERDES PHY DRIVER +M: Ioana Ciornei +L: netdev@vger.kernel.org +S: Supported +F: drivers/phy/freescale/phy-fsl-lynx-28g.c + LYNX PCS MODULE M: Ioana Ciornei L: netdev@vger.kernel.org diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index c3669c28ea9f..0e91cd99c36b 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -22,3 +22,13 @@ config PHY_FSL_IMX8M_PCIE help Enable this to add support for the PCIE PHY as found on i.MX8M family of SOCs. + +config PHY_FSL_LYNX_28G + tristate "Freescale Layerscape Lynx 28G SerDes PHY support" + depends on OF + select GENERIC_PHY + help + Enable this to add support for the Lynx SerDes 28G PHY as + found on NXP's Layerscape platforms such as LX2160A. + Used to change the protocol running on SerDes lanes at runtime. + Only useful for a restricted set of Ethernet protocols. diff --git a/drivers/phy/freescale/Makefile b/drivers/phy/freescale/Makefile index 55d07c742ab0..3518d5dbe8a7 100644 --- a/drivers/phy/freescale/Makefile +++ b/drivers/phy/freescale/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_PHY_FSL_IMX8MQ_USB) += phy-fsl-imx8mq-usb.o obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY) += phy-fsl-imx8-mipi-dphy.o obj-$(CONFIG_PHY_FSL_IMX8M_PCIE) += phy-fsl-imx8m-pcie.o +obj-$(CONFIG_PHY_FSL_LYNX_28G) += phy-fsl-lynx-28g.o diff --git a/drivers/phy/freescale/phy-fsl-lynx-28g.c b/drivers/phy/freescale/phy-fsl-lynx-28g.c new file mode 100644 index 000000000000..015194c67ffc --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-28g.c @@ -0,0 +1,630 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (c) 2021-2022 NXP. */ + +#include +#include +#include +#include +#include +#include + +#define LYNX_28G_NUM_LANE 8 +#define LYNX_28G_NUM_PLL 2 + +/* General registers per SerDes block */ +#define LYNX_28G_PCC8 0x10a0 +#define LYNX_28G_PCC8_SGMII 0x1 +#define LYNX_28G_PCC8_SGMII_DIS 0x0 + +#define LYNX_28G_PCCC 0x10b0 +#define LYNX_28G_PCCC_10GBASER 0x9 +#define LYNX_28G_PCCC_USXGMII 0x1 +#define LYNX_28G_PCCC_SXGMII_DIS 0x0 + +#define LYNX_28G_LNa_PCC_OFFSET(lane) (4 * (LYNX_28G_NUM_LANE - (lane->id) - 1)) + +/* Per PLL registers */ +#define LYNX_28G_PLLnRSTCTL(pll) (0x400 + (pll) * 0x100 + 0x0) +#define LYNX_28G_PLLnRSTCTL_DIS(rstctl) (((rstctl) & BIT(24)) >> 24) +#define LYNX_28G_PLLnRSTCTL_LOCK(rstctl) (((rstctl) & BIT(23)) >> 23) + +#define LYNX_28G_PLLnCR0(pll) (0x400 + (pll) * 0x100 + 0x4) +#define LYNX_28G_PLLnCR0_REFCLK_SEL(cr0) (((cr0) & GENMASK(20, 16))) +#define LYNX_28G_PLLnCR0_REFCLK_SEL_100MHZ 0x0 +#define LYNX_28G_PLLnCR0_REFCLK_SEL_125MHZ 0x10000 +#define LYNX_28G_PLLnCR0_REFCLK_SEL_156MHZ 0x20000 +#define LYNX_28G_PLLnCR0_REFCLK_SEL_150MHZ 0x30000 +#define LYNX_28G_PLLnCR0_REFCLK_SEL_161MHZ 0x40000 + +#define LYNX_28G_PLLnCR1(pll) (0x400 + (pll) * 0x100 + 0x8) +#define LYNX_28G_PLLnCR1_FRATE_SEL(cr1) (((cr1) & GENMASK(28, 24))) +#define LYNX_28G_PLLnCR1_FRATE_5G_10GVCO 0x0 +#define LYNX_28G_PLLnCR1_FRATE_5G_25GVCO 0x10000000 +#define LYNX_28G_PLLnCR1_FRATE_10G_20GVCO 0x6000000 + +/* Per SerDes lane registers */ +/* Lane a General Control Register */ +#define LYNX_28G_LNaGCR0(lane) (0x800 + (lane) * 0x100 + 0x0) +#define LYNX_28G_LNaGCR0_PROTO_SEL_MSK GENMASK(7, 3) +#define LYNX_28G_LNaGCR0_PROTO_SEL_SGMII 0x8 +#define LYNX_28G_LNaGCR0_PROTO_SEL_XFI 0x50 +#define LYNX_28G_LNaGCR0_IF_WIDTH_MSK GENMASK(2, 0) +#define LYNX_28G_LNaGCR0_IF_WIDTH_10_BIT 0x0 +#define LYNX_28G_LNaGCR0_IF_WIDTH_20_BIT 0x2 + +/* Lane a Tx Reset Control Register */ +#define LYNX_28G_LNaTRSTCTL(lane) (0x800 + (lane) * 0x100 + 0x20) +#define LYNX_28G_LNaTRSTCTL_HLT_REQ BIT(27) +#define LYNX_28G_LNaTRSTCTL_RST_DONE BIT(30) +#define LYNX_28G_LNaTRSTCTL_RST_REQ BIT(31) + +/* Lane a Tx General Control Register */ +#define LYNX_28G_LNaTGCR0(lane) (0x800 + (lane) * 0x100 + 0x24) +#define LYNX_28G_LNaTGCR0_USE_PLLF 0x0 +#define LYNX_28G_LNaTGCR0_USE_PLLS BIT(28) +#define LYNX_28G_LNaTGCR0_USE_PLL_MSK BIT(28) +#define LYNX_28G_LNaTGCR0_N_RATE_FULL 0x0 +#define LYNX_28G_LNaTGCR0_N_RATE_HALF 0x1000000 +#define LYNX_28G_LNaTGCR0_N_RATE_QUARTER 0x2000000 +#define LYNX_28G_LNaTGCR0_N_RATE_MSK GENMASK(26, 24) + +#define LYNX_28G_LNaTECR0(lane) (0x800 + (lane) * 0x100 + 0x30) + +/* Lane a Rx Reset Control Register */ +#define LYNX_28G_LNaRRSTCTL(lane) (0x800 + (lane) * 0x100 + 0x40) +#define LYNX_28G_LNaRRSTCTL_HLT_REQ BIT(27) +#define LYNX_28G_LNaRRSTCTL_RST_DONE BIT(30) +#define LYNX_28G_LNaRRSTCTL_RST_REQ BIT(31) +#define LYNX_28G_LNaRRSTCTL_CDR_LOCK BIT(12) + +/* Lane a Rx General Control Register */ +#define LYNX_28G_LNaRGCR0(lane) (0x800 + (lane) * 0x100 + 0x44) +#define LYNX_28G_LNaRGCR0_USE_PLLF 0x0 +#define LYNX_28G_LNaRGCR0_USE_PLLS BIT(28) +#define LYNX_28G_LNaRGCR0_USE_PLL_MSK BIT(28) +#define LYNX_28G_LNaRGCR0_N_RATE_MSK GENMASK(26, 24) +#define LYNX_28G_LNaRGCR0_N_RATE_FULL 0x0 +#define LYNX_28G_LNaRGCR0_N_RATE_HALF 0x1000000 +#define LYNX_28G_LNaRGCR0_N_RATE_QUARTER 0x2000000 +#define LYNX_28G_LNaRGCR0_N_RATE_MSK GENMASK(26, 24) + +#define LYNX_28G_LNaRGCR1(lane) (0x800 + (lane) * 0x100 + 0x48) + +#define LYNX_28G_LNaRECR0(lane) (0x800 + (lane) * 0x100 + 0x50) +#define LYNX_28G_LNaRECR1(lane) (0x800 + (lane) * 0x100 + 0x54) +#define LYNX_28G_LNaRECR2(lane) (0x800 + (lane) * 0x100 + 0x58) + +#define LYNX_28G_LNaRSCCR0(lane) (0x800 + (lane) * 0x100 + 0x74) + +#define LYNX_28G_LNaPSS(lane) (0x1000 + (lane) * 0x4) +#define LYNX_28G_LNaPSS_TYPE(pss) (((pss) & GENMASK(30, 24)) >> 24) +#define LYNX_28G_LNaPSS_TYPE_SGMII 0x4 +#define LYNX_28G_LNaPSS_TYPE_XFI 0x28 + +#define LYNX_28G_SGMIIaCR1(lane) (0x1804 + (lane) * 0x10) +#define LYNX_28G_SGMIIaCR1_SGPCS_EN BIT(11) +#define LYNX_28G_SGMIIaCR1_SGPCS_DIS 0x0 +#define LYNX_28G_SGMIIaCR1_SGPCS_MSK BIT(11) + +struct lynx_28g_priv; + +struct lynx_28g_pll { + struct lynx_28g_priv *priv; + u32 rstctl, cr0, cr1; + int id; + DECLARE_PHY_INTERFACE_MASK(supported); +}; + +struct lynx_28g_lane { + struct lynx_28g_priv *priv; + bool powered_up; + bool init; + unsigned int id; + phy_interface_t interface; +}; + +struct lynx_28g_priv { + void __iomem *base; + struct device *dev; + struct lynx_28g_pll pll[LYNX_28G_NUM_PLL]; + + int num_lanes; + struct lynx_28g_lane lane[LYNX_28G_NUM_LANE]; + + struct delayed_work cdr_check; +}; + +static void lynx_28g_rmw(struct lynx_28g_priv *priv, unsigned long off, + u32 val, u32 mask) +{ + void __iomem *reg = priv->base + off; + u32 orig, tmp; + + orig = ioread32(reg); + tmp = orig & ~mask; + tmp |= val; + iowrite32(tmp, reg); +} + +#define lynx_28g_lane_rmw(lane, reg, val, mask) \ + lynx_28g_rmw((lane)->priv, LYNX_28G_##reg(lane->id), \ + LYNX_28G_##reg##_##val, LYNX_28G_##reg##_##mask) +#define lynx_28g_lane_read(lane, reg) \ + ioread32((lane)->priv->base + LYNX_28G_##reg((lane)->id)) +#define lynx_28g_pll_read(pll, reg) \ + ioread32((pll)->priv->base + LYNX_28G_##reg((pll)->id)) + +static bool lynx_28g_supports_interface(struct lynx_28g_priv *priv, int intf) +{ + int i; + + for (i = 0; i < LYNX_28G_NUM_PLL; i++) { + if (LYNX_28G_PLLnRSTCTL_DIS(priv->pll[i].rstctl)) + continue; + + if (test_bit(intf, priv->pll[i].supported)) + return true; + } + + return false; +} + +static struct lynx_28g_pll *lynx_28g_pll_get(struct lynx_28g_priv *priv, + phy_interface_t intf) +{ + struct lynx_28g_pll *pll; + int i; + + for (i = 0; i < LYNX_28G_NUM_PLL; i++) { + pll = &priv->pll[i]; + + if (LYNX_28G_PLLnRSTCTL_DIS(pll->rstctl)) + continue; + + if (test_bit(intf, pll->supported)) + return pll; + } + + return NULL; +} + +static void lynx_28g_lane_set_nrate(struct lynx_28g_lane *lane, + struct lynx_28g_pll *pll, + phy_interface_t intf) +{ + switch (LYNX_28G_PLLnCR1_FRATE_SEL(pll->cr1)) { + case LYNX_28G_PLLnCR1_FRATE_5G_10GVCO: + case LYNX_28G_PLLnCR1_FRATE_5G_25GVCO: + switch (intf) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + lynx_28g_lane_rmw(lane, LNaTGCR0, N_RATE_QUARTER, N_RATE_MSK); + lynx_28g_lane_rmw(lane, LNaRGCR0, N_RATE_QUARTER, N_RATE_MSK); + break; + default: + break; + } + break; + case LYNX_28G_PLLnCR1_FRATE_10G_20GVCO: + switch (intf) { + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_USXGMII: + lynx_28g_lane_rmw(lane, LNaTGCR0, N_RATE_FULL, N_RATE_MSK); + lynx_28g_lane_rmw(lane, LNaRGCR0, N_RATE_FULL, N_RATE_MSK); + break; + default: + break; + } + break; + default: + break; + } +} + +static void lynx_28g_lane_set_pll(struct lynx_28g_lane *lane, + struct lynx_28g_pll *pll) +{ + if (pll->id == 0) { + lynx_28g_lane_rmw(lane, LNaTGCR0, USE_PLLF, USE_PLL_MSK); + lynx_28g_lane_rmw(lane, LNaRGCR0, USE_PLLF, USE_PLL_MSK); + } else { + lynx_28g_lane_rmw(lane, LNaTGCR0, USE_PLLS, USE_PLL_MSK); + lynx_28g_lane_rmw(lane, LNaRGCR0, USE_PLLS, USE_PLL_MSK); + } +} + +static void lynx_28g_cleanup_lane(struct lynx_28g_lane *lane) +{ + u32 lane_offset = LYNX_28G_LNa_PCC_OFFSET(lane); + struct lynx_28g_priv *priv = lane->priv; + + /* Cleanup the protocol configuration registers of the current protocol */ + switch (lane->interface) { + case PHY_INTERFACE_MODE_10GBASER: + lynx_28g_rmw(priv, LYNX_28G_PCCC, + LYNX_28G_PCCC_SXGMII_DIS << lane_offset, + GENMASK(3, 0) << lane_offset); + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + lynx_28g_rmw(priv, LYNX_28G_PCC8, + LYNX_28G_PCC8_SGMII_DIS << lane_offset, + GENMASK(3, 0) << lane_offset); + break; + default: + break; + } +} + +static void lynx_28g_lane_set_sgmii(struct lynx_28g_lane *lane) +{ + u32 lane_offset = LYNX_28G_LNa_PCC_OFFSET(lane); + struct lynx_28g_priv *priv = lane->priv; + struct lynx_28g_pll *pll; + + lynx_28g_cleanup_lane(lane); + + /* Setup the lane to run in SGMII */ + lynx_28g_rmw(priv, LYNX_28G_PCC8, + LYNX_28G_PCC8_SGMII << lane_offset, + GENMASK(3, 0) << lane_offset); + + /* Setup the protocol select and SerDes parallel interface width */ + lynx_28g_lane_rmw(lane, LNaGCR0, PROTO_SEL_SGMII, PROTO_SEL_MSK); + lynx_28g_lane_rmw(lane, LNaGCR0, IF_WIDTH_10_BIT, IF_WIDTH_MSK); + + /* Switch to the PLL that works with this interface type */ + pll = lynx_28g_pll_get(priv, PHY_INTERFACE_MODE_SGMII); + lynx_28g_lane_set_pll(lane, pll); + + /* Choose the portion of clock net to be used on this lane */ + lynx_28g_lane_set_nrate(lane, pll, PHY_INTERFACE_MODE_SGMII); + + /* Enable the SGMII PCS */ + lynx_28g_lane_rmw(lane, SGMIIaCR1, SGPCS_EN, SGPCS_MSK); + + /* Configure the appropriate equalization parameters for the protocol */ + iowrite32(0x00808006, priv->base + LYNX_28G_LNaTECR0(lane->id)); + iowrite32(0x04310000, priv->base + LYNX_28G_LNaRGCR1(lane->id)); + iowrite32(0x9f800000, priv->base + LYNX_28G_LNaRECR0(lane->id)); + iowrite32(0x001f0000, priv->base + LYNX_28G_LNaRECR1(lane->id)); + iowrite32(0x00000000, priv->base + LYNX_28G_LNaRECR2(lane->id)); + iowrite32(0x00000000, priv->base + LYNX_28G_LNaRSCCR0(lane->id)); +} + +static void lynx_28g_lane_set_10gbaser(struct lynx_28g_lane *lane) +{ + u32 lane_offset = LYNX_28G_LNa_PCC_OFFSET(lane); + struct lynx_28g_priv *priv = lane->priv; + struct lynx_28g_pll *pll; + + lynx_28g_cleanup_lane(lane); + + /* Enable the SXGMII lane */ + lynx_28g_rmw(priv, LYNX_28G_PCCC, + LYNX_28G_PCCC_10GBASER << lane_offset, + GENMASK(3, 0) << lane_offset); + + /* Setup the protocol select and SerDes parallel interface width */ + lynx_28g_lane_rmw(lane, LNaGCR0, PROTO_SEL_XFI, PROTO_SEL_MSK); + lynx_28g_lane_rmw(lane, LNaGCR0, IF_WIDTH_20_BIT, IF_WIDTH_MSK); + + /* Switch to the PLL that works with this interface type */ + pll = lynx_28g_pll_get(priv, PHY_INTERFACE_MODE_10GBASER); + lynx_28g_lane_set_pll(lane, pll); + + /* Choose the portion of clock net to be used on this lane */ + lynx_28g_lane_set_nrate(lane, pll, PHY_INTERFACE_MODE_10GBASER); + + /* Disable the SGMII PCS */ + lynx_28g_lane_rmw(lane, SGMIIaCR1, SGPCS_DIS, SGPCS_MSK); + + /* Configure the appropriate equalization parameters for the protocol */ + iowrite32(0x10808307, priv->base + LYNX_28G_LNaTECR0(lane->id)); + iowrite32(0x10000000, priv->base + LYNX_28G_LNaRGCR1(lane->id)); + iowrite32(0x00000000, priv->base + LYNX_28G_LNaRECR0(lane->id)); + iowrite32(0x001f0000, priv->base + LYNX_28G_LNaRECR1(lane->id)); + iowrite32(0x81000020, priv->base + LYNX_28G_LNaRECR2(lane->id)); + iowrite32(0x00002000, priv->base + LYNX_28G_LNaRSCCR0(lane->id)); +} + +static int lynx_28g_power_off(struct phy *phy) +{ + struct lynx_28g_lane *lane = phy_get_drvdata(phy); + u32 trstctl, rrstctl; + + if (!lane->powered_up) + return 0; + + /* Issue a halt request */ + lynx_28g_lane_rmw(lane, LNaTRSTCTL, HLT_REQ, HLT_REQ); + lynx_28g_lane_rmw(lane, LNaRRSTCTL, HLT_REQ, HLT_REQ); + + /* Wait until the halting process is complete */ + do { + trstctl = lynx_28g_lane_read(lane, LNaTRSTCTL); + rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); + } while ((trstctl & LYNX_28G_LNaTRSTCTL_HLT_REQ) || + (rrstctl & LYNX_28G_LNaRRSTCTL_HLT_REQ)); + + lane->powered_up = false; + + return 0; +} + +static int lynx_28g_power_on(struct phy *phy) +{ + struct lynx_28g_lane *lane = phy_get_drvdata(phy); + u32 trstctl, rrstctl; + + if (lane->powered_up) + return 0; + + /* Issue a reset request on the lane */ + lynx_28g_lane_rmw(lane, LNaTRSTCTL, RST_REQ, RST_REQ); + lynx_28g_lane_rmw(lane, LNaRRSTCTL, RST_REQ, RST_REQ); + + /* Wait until the reset sequence is completed */ + do { + trstctl = lynx_28g_lane_read(lane, LNaTRSTCTL); + rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); + } while (!(trstctl & LYNX_28G_LNaTRSTCTL_RST_DONE) || + !(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE)); + + lane->powered_up = true; + + return 0; +} + +static int lynx_28g_set_mode(struct phy *phy, enum phy_mode mode, int submode) +{ + struct lynx_28g_lane *lane = phy_get_drvdata(phy); + struct lynx_28g_priv *priv = lane->priv; + int powered_up = lane->powered_up; + int err = 0; + + if (mode != PHY_MODE_ETHERNET) + return -EOPNOTSUPP; + + if (lane->interface == PHY_INTERFACE_MODE_NA) + return -EOPNOTSUPP; + + if (!lynx_28g_supports_interface(priv, submode)) + return -EOPNOTSUPP; + + /* If the lane is powered up, put the lane into the halt state while + * the reconfiguration is being done. + */ + if (powered_up) + lynx_28g_power_off(phy); + + switch (submode) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + lynx_28g_lane_set_sgmii(lane); + break; + case PHY_INTERFACE_MODE_10GBASER: + lynx_28g_lane_set_10gbaser(lane); + break; + default: + err = -EOPNOTSUPP; + goto out; + } + + lane->interface = submode; + +out: + /* Power up the lane if necessary */ + if (powered_up) + lynx_28g_power_on(phy); + + return err; +} + +static int lynx_28g_validate(struct phy *phy, enum phy_mode mode, int submode, + union phy_configure_opts *opts __always_unused) +{ + struct lynx_28g_lane *lane = phy_get_drvdata(phy); + struct lynx_28g_priv *priv = lane->priv; + + if (mode != PHY_MODE_ETHERNET) + return -EOPNOTSUPP; + + if (!lynx_28g_supports_interface(priv, submode)) + return -EOPNOTSUPP; + + return 0; +} + +static int lynx_28g_init(struct phy *phy) +{ + struct lynx_28g_lane *lane = phy_get_drvdata(phy); + + /* Mark the fact that the lane was init */ + lane->init = true; + + /* SerDes lanes are powered on at boot time. Any lane that is managed + * by this driver will get powered down at init time aka at dpaa2-eth + * probe time. + */ + lane->powered_up = true; + lynx_28g_power_off(phy); + + return 0; +} + +static const struct phy_ops lynx_28g_ops = { + .init = lynx_28g_init, + .power_on = lynx_28g_power_on, + .power_off = lynx_28g_power_off, + .set_mode = lynx_28g_set_mode, + .validate = lynx_28g_validate, + .owner = THIS_MODULE, +}; + +static void lynx_28g_pll_read_configuration(struct lynx_28g_priv *priv) +{ + struct lynx_28g_pll *pll; + int i; + + for (i = 0; i < LYNX_28G_NUM_PLL; i++) { + pll = &priv->pll[i]; + pll->priv = priv; + pll->id = i; + + pll->rstctl = lynx_28g_pll_read(pll, PLLnRSTCTL); + pll->cr0 = lynx_28g_pll_read(pll, PLLnCR0); + pll->cr1 = lynx_28g_pll_read(pll, PLLnCR1); + + if (LYNX_28G_PLLnRSTCTL_DIS(pll->rstctl)) + continue; + + switch (LYNX_28G_PLLnCR1_FRATE_SEL(pll->cr1)) { + case LYNX_28G_PLLnCR1_FRATE_5G_10GVCO: + case LYNX_28G_PLLnCR1_FRATE_5G_25GVCO: + /* 5GHz clock net */ + __set_bit(PHY_INTERFACE_MODE_1000BASEX, pll->supported); + __set_bit(PHY_INTERFACE_MODE_SGMII, pll->supported); + break; + case LYNX_28G_PLLnCR1_FRATE_10G_20GVCO: + /* 10.3125GHz clock net */ + __set_bit(PHY_INTERFACE_MODE_10GBASER, pll->supported); + break; + default: + /* 6GHz, 12.890625GHz, 8GHz */ + break; + } + } +} + +#define work_to_lynx(w) container_of((w), struct lynx_28g_priv, cdr_check.work) + +static void lynx_28g_cdr_lock_check(struct work_struct *work) +{ + struct lynx_28g_priv *priv = work_to_lynx(work); + struct lynx_28g_lane *lane; + u32 rrstctl; + int i; + + for (i = 0; i < priv->num_lanes; i++) { + lane = &priv->lane[i]; + + if (!lane->init) + continue; + + if (!lane->powered_up) + continue; + + rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); + if (!(rrstctl & LYNX_28G_LNaRRSTCTL_CDR_LOCK)) { + lynx_28g_lane_rmw(lane, LNaRRSTCTL, RST_REQ, RST_REQ); + do { + rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); + } while (!(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE)); + } + } + queue_delayed_work(system_power_efficient_wq, &priv->cdr_check, + msecs_to_jiffies(1000)); +} + +static void lynx_28g_lane_read_configuration(struct lynx_28g_lane *lane) +{ + u32 pss, protocol; + + pss = lynx_28g_lane_read(lane, LNaPSS); + protocol = LYNX_28G_LNaPSS_TYPE(pss); + switch (protocol) { + case LYNX_28G_LNaPSS_TYPE_SGMII: + lane->interface = PHY_INTERFACE_MODE_SGMII; + break; + case LYNX_28G_LNaPSS_TYPE_XFI: + lane->interface = PHY_INTERFACE_MODE_10GBASER; + break; + default: + lane->interface = PHY_INTERFACE_MODE_NA; + } +} + +static int lynx_28g_probe(struct platform_device *pdev) +{ + struct phy_provider *provider; + struct lynx_28g_priv *priv; + struct device_node *child; + int err, i = 0; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + priv->dev = &pdev->dev; + + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + lynx_28g_pll_read_configuration(priv); + + for_each_available_child_of_node(pdev->dev.of_node, child) { + struct lynx_28g_lane *lane; + struct phy *phy; + u32 val; + + err = of_property_read_u32(child, "reg", &val); + if (err < 0) { + dev_err(&pdev->dev, "missing 'reg' property (%d)\n", err); + continue; + } + + if (val >= LYNX_28G_NUM_LANE) { + dev_err(&pdev->dev, "invalid 'reg' property\n"); + continue; + } + + lane = &priv->lane[i]; + memset(lane, 0, sizeof(*lane)); + + phy = devm_phy_create(&pdev->dev, child, &lynx_28g_ops); + if (IS_ERR(phy)) { + of_node_put(child); + return PTR_ERR(phy); + } + + lane->priv = priv; + lane->id = val; + phy_set_drvdata(phy, lane); + i++; + + lynx_28g_lane_read_configuration(lane); + } + + priv->num_lanes = i; + + INIT_DELAYED_WORK(&priv->cdr_check, lynx_28g_cdr_lock_check); + + queue_delayed_work(system_power_efficient_wq, &priv->cdr_check, + msecs_to_jiffies(1000)); + + dev_set_drvdata(&pdev->dev, priv); + provider = devm_of_phy_provider_register(&pdev->dev, + of_phy_simple_xlate); + + return PTR_ERR_OR_ZERO(provider); +} + +static const struct of_device_id lynx_28g_of_match_table[] = { + { .compatible = "fsl,lynx-28g" }, + { }, +}; +MODULE_DEVICE_TABLE(of, lynx_28g_of_match_table); + +static struct platform_driver lynx_28g_driver = { + .probe = lynx_28g_probe, + .driver = { + .name = "lynx-28g", + .of_match_table = lynx_28g_of_match_table, + }, +}; +module_platform_driver(lynx_28g_driver); + +MODULE_AUTHOR("Ioana Ciornei "); +MODULE_DESCRIPTION("Lynx 28G SerDes PHY driver for Layerscape SoCs"); +MODULE_LICENSE("GPL v2"); From patchwork Wed Mar 9 17:27:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775354 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97FB6C433EF for ; Wed, 9 Mar 2022 17:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237160AbiCIR30 (ORCPT ); Wed, 9 Mar 2022 12:29:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237115AbiCIR3P (ORCPT ); Wed, 9 Mar 2022 12:29:15 -0500 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10078.outbound.protection.outlook.com [40.107.1.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C52385677; Wed, 9 Mar 2022 09:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ibPECsVUCTr/kXi9Y6I1IGfmVpikg7+ARDCIqVIhJ2RXTGNuH9tBoOiw4Js8Ura+ilRm9KyxbG4xF1tAEl/5rgU0S1UIy314Ky+PkMR0JKvMOQ+y10tGAnB34oHlugE+yi9uXXqX1rpmcVfkt2qtBOpMaImh9AV9M1rZdFa0PXoZ3HHWDwBDH1n6URL57ghlAfyeDEEmX3Z4BtoFbjDjPwCNKe+ktz2jiG8Zo6xQs7OW/bIHI5gT8DbMJ2vjCwxATq7QbCj52FNOcEU3KwE4FOdnacs6NaCeviKJUtjhD2yvT9qm81otRyxmluj9RgEtGUrMtxMNEmziPOByWN6epg== 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=FucX9JaTRUg9FLv9x1Deve101OdcvTTWCjSRueZfDTQ=; b=FCssuogeOLH/sKNpVbcvOzVCNXM2OEAYhpKjzgFFa0zAsM1FDlQA3fp2Yq8Tv1ZzN9FHVpHbEO0xEjCbyeU+q098Fxf0RYfhcF/JZaasclaRJqQTOpiIQxq671uFXT1afFar5JXADBd8cBJMdzjoMIm48VcfnbX8qNgCIDiEh6eZUDvuUUs3TvJBXzFeKvCqHxnxtEZRpruuS44+69rj4BfJH4aibOMB1MxpL3tgRz06fTu73nhXHm23BdCaWbQ1CqC908YFU0nBBzCPLaYM2Yj5BswLNgd4yKMo6Fa0NLl/T/Fri2U53jKWxPvaWFj7Syx6gieURYBmM8YremGsIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FucX9JaTRUg9FLv9x1Deve101OdcvTTWCjSRueZfDTQ=; b=gJSnbuGOjovjNT+UPXPCDg6KcEER/Rfbzuyb88+JQTAIcULvBWiGBgrUeJZrjtZOaoWm/MC4s2R5SnZkHpVCodP1PWQoYpTQFcGoP5GjIcpoPj1q1QNwl9ab3riUUEop+WWZrL6Vjm6rbhdhSGm2rt9YVdoHSaTcKX2mfBQQZlQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by PAXPR04MB9422.eurprd04.prod.outlook.com (2603:10a6:102:2b4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.19; Wed, 9 Mar 2022 17:28:08 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:08 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 2/8] dt-bindings: phy: add the "fsl,lynx-28g" compatible Date: Wed, 9 Mar 2022 19:27:42 +0200 Message-Id: <20220309172748.3460862-3-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c935750-eace-4061-3cb0-08da01f22d85 X-MS-TrafficTypeDiagnostic: PAXPR04MB9422:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0fvu32VT0HmqRQGvoJ24r/ARdQqV8psybu+7Zn5WGvcavRS023FxsxbyisFNrmNG7aQL9JiFjUu3Nmj2gJI4E/MMVd8NAdvaqgiBUNc2E6DCdeR583dpexkd2vgg6nd0ThQRhrlQe7la2kQSIypiSIVb2W2WRKm3b3tKKZdWVOT5iKzhbfSZM9YiP9vDW2KSb+1lMO0y/WcfsEp6XPMzl4wVo1qWAxSX7DZ+yZ+sZuGn8R6YjJ6Bn3O+30ZGr6Mmd5UXjWxp0f4j6rUIbhnD9JC+h7eH0t4ZeQPCHN29soiFOtZ0BqPYksLRREJgz+8l+4+i+xvMdq/CwjncFoU9V9I0sEdQ27rwTXNBLfwP1Z18ZeV41Ceza4XizzfBBWxqashEki1aJcHnbN0GYVAp6lY80++Qxkp8UgtmLGD+aDM1IYwTXiliUkTCrZUEP0vhtcjiWqjiKUeNdjj9UbcBaZoDRGMun8cOiuokWe+ytp3ET66mY1nrZ1Oedvab5zGz7tHE62l5RjvzxTgjHREbsivo7D+8ARKP2UnwNY6uwdSV3DqpUWGSxvYf4FEhmMT87TZisg5rS7i8WvIdnSYlajmJuHz8KEl0H/QpqxFzsSxg/NJ3f1lHW8wLBVF4a2cEDI5IIi0NO1MTCPu3wLyuwEQ5Bz4PMpt2EkMsI2gwlw0O9jlSitiUi1FXRBCtLOtOfSyBF/eS52erabxkNs6WFIhR+OP031Vrxlx+5xOFeaRycEZqWG9eIHvyDdLh21goHBQGJpuqmc0bsXox3aMgqbq23kHiRJXG7mY1ahx/igTMDfm2wRHecdmjW24SmxOqxEb2scWlmRRTjUlTZiodrw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6486002)(8936002)(52116002)(2616005)(966005)(6666004)(6512007)(498600001)(6506007)(5660300002)(66946007)(7416002)(36756003)(86362001)(38350700002)(38100700002)(2906002)(1076003)(44832011)(66476007)(66556008)(4326008)(8676002)(186003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rzh86WKoqczlG9PJKg2z1CRFQPWuiVe39OfXrg890mXpekDIhIVhxVW4MZCjYd+0UE38/+n6tPSrnTV960ImFtLyCmazIDDvgGEo5WsLF0l2tx2Hoe8YdBepUlnZU+Wh0kJfmoO91ciaksfAmUzJDCiUWpHZOaRvSx19xjFf9PO7klDeIY7JN6jJBY8o8E9daBgitGS7bH+93ln5mFfJbmH4RSY1TD6fGdG8MSpvG409DRxi4VwOOmH6xY9nGqT7btkj/mQGXmwZxjKL/CjqGT0og/9wIcjDbaFvIQFFkqXsOE4Dv3T0G1dwbyp6zrdKw5V/W+KdkvuH0rq6xufOYqKCwHzDL95j8oTKthCB0Yx7X3ERHyYShLAsfy87C22ZXKggW2sk3Nf64GlFY9VvqB4nm6KntXQpKbcTvCK64e5C1X6GqMFWVZ9Znk1Ac0oD0DVmk2GEb43smcJcxmPqJIkHEidYY0CnUB/3uhEotGFlYu1tpNQL6eKzuBMylr8l44w0SWhtumOVpes5QmHB/XOlvLdJijp1/XEmT+fTStmUN2wNKWWi2rQo/uVfiVKflo/c3BKq7OwcziCcQ/M0b32a0BKBSkfXes+hYlKjh+/hknYbE5W/tDA9Jyu68rMpq1TcL3zLTQRWKzhYaz/saSsUEkZBUrflP762mVU6w9s+V6pXS2NNG6c8O1mfABsidV+anrRRwGhx76RcsZrgWe82ylLMLd1iSeYw/opljoYrIq8VtSEXo59BTA/UJbd0awrhNapMeV4b95EIXBr2uuEuGgHh5kXf+ueMV1Mip9i0Trb8nDZPbeiKkgoYj+5wz/vmIJE0B+3516CHsNCFIPDOr99zAuq4kz9+BJdG9Zqa5VP53BwzKoti8fgUtZNw19+uvQWvzlNsD85HlQ7UpTsNzU+QjVolPDtLyCS7JiMEsRezV2L0VXaD91ypeo21gQjFePDmL9bBBe72mMsH6MVWQh7l2DE9GikQM0+4pe/7QDMj7eElw/oYkNLdPMUoTIMPwYvZKxv0GieBIqfqf6We4MqzMNHZxwzFDh8ix5E0zGDCbMdqLHGXobyK4FDI2K3lXDOfUX0bSQrHDHeA7L+YQ/5A8w26DVgnBaH2DEsQ4+HAnxhAMqpi0H6I4TIBg2dEKxg9y1Cb3N0nF5X9pMMitNKnhy6JJsnQHZ3zme1NQ0jn5XZ6DxdyOK2Gix9n2F9WrPiSe4PbUlRX0UlAAIWQb8Sj1JNFYPFagkgTYKKg3TcsAV6RBjoDKEAQyp1mlvfF8u2N624VHgWY0LejIA8cwQkSQuT/J3YH4/kEPpsJKsFCU8ggJgvXKfuDWMPoGhvH9AVyUVg5uOkN7+rvsCLgANwp2nI/39hC2T6rZ00fbYvMqTlNBVYjEDEOtv6IyvpU4z1fqJRujbxfMn6PanQjMglzWKuHYkhE/ATeWGoHFaibPQZ3LsP8vWCzPJrY7mDxN2uTQfYg7pQNMtyeHMdqkCoEXUh3Qpn8eTVJ1PYSt/0z323B3fGdXTpMPV/owCdiIvazqrdJGMJ6j9eFSH2J5f+ZyQwf0CeqKKNZUgyG7ItQc1Kc3fT9W7Poht1aoBgDQGcDfWUp/O0dDHLyGfW70oOQfJcYwTCuqVfmQ4I= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c935750-eace-4061-3cb0-08da01f22d85 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:08.5641 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tDJduhZ5lI3lImqoQtuR5enT4V9L355y2s4arg/OanOUyGjgsBLImRDoi55V3N62ERYeVnhnAXeIHdJ1VqKgEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9422 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Describe the "fsl,lynx-28g" compatible used by the Lynx 28G SerDes PHY driver on Layerscape based SoCs. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../devicetree/bindings/phy/fsl,lynx-28g.yaml | 71 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 72 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml diff --git a/Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml b/Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml new file mode 100644 index 000000000000..03e7ba99301f --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/fsl,lynx-28g.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale Lynx 28G SerDes PHY binding + +maintainers: + - Ioana Ciornei + +properties: + compatible: + enum: + - fsl,lynx-28g + + reg: + maxItems: 1 + + "#phy-cells": + const: 0 + +required: + - compatible + - reg + - "#phy-cells" + +additionalProperties: false + +examples: + - | + serdes_1: serdes_phy@1ea0000 { + compatible = "fsl,lynx-28g"; + reg = <0x00 0x1ea0000 0x0 0x1e30>; + #address-cells = <1>; + #size-cells = <0>; + #phy-cells = <1>; + + serdes1_lane_a: phy@0 { + reg = <0>; + #phy-cells = <0>; + }; + serdes1_lane_b: phy@1 { + reg = <1>; + #phy-cells = <0>; + }; + serdes1_lane_c: phy@2 { + reg = <2>; + #phy-cells = <0>; + }; + serdes1_lane_d: phy@3 { + reg = <3>; + #phy-cells = <0>; + }; + serdes1_lane_e: phy@4 { + reg = <4>; + #phy-cells = <0>; + }; + serdes1_lane_f: phy@5 { + reg = <5>; + #phy-cells = <0>; + }; + serdes1_lane_g: phy@6 { + reg = <6>; + #phy-cells = <0>; + }; + serdes1_lane_h: phy@7 { + reg = <7>; + #phy-cells = <0>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index dd42305b050c..888d07ddc128 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11340,6 +11340,7 @@ LYNX 28G SERDES PHY DRIVER M: Ioana Ciornei L: netdev@vger.kernel.org S: Supported +F: Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml F: drivers/phy/freescale/phy-fsl-lynx-28g.c LYNX PCS MODULE From patchwork Wed Mar 9 17:27:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775356 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCB80C433FE for ; Wed, 9 Mar 2022 17:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237165AbiCIR33 (ORCPT ); Wed, 9 Mar 2022 12:29:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237132AbiCIR3Q (ORCPT ); Wed, 9 Mar 2022 12:29:16 -0500 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10078.outbound.protection.outlook.com [40.107.1.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B8258594D; Wed, 9 Mar 2022 09:28:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VHAJSW1KlsprbJ4SoacPdzWrTupZuhoAuxwPLg/iZxDEJS7kIAblc28zRaYPN8lAC9JlxoUd2yklHqrtjLPc1FAsA/b9uZu4avCKiiOfnCs97iaOAre/BUh1W7anHkuIka1yDJuWMaE0qpwp+vt+atyU8rpHVCqW7gNaEfTuh/VPODi1/seSz3MQLgaUCACDG8sJzftdjisqlJWMPMwK/DRsQJOHdO8Vh5ulTJoQE/8PJQm55B2WHXuN0HyFTvJJ1Lu0OFk17UO671MNRi+ohWHcsFh2O9AV4mwwLeXcG2lY0OoqP1AzxNouSWlt+kV4FxWoW7B1r2EZigE01gtg8Q== 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=HNo7HTEsBVeuHUdmrNNv958T41ND7Bi9O6w3SiauMI8=; b=El/jbq8RsKkf3vENQZM7e7rZ8Fsmn8aF3z19hfOoRnqiJJE7RXNR5Igzl5+ZMFifV/pezWq6bnMjYyTHDOVDUAm0WU+MkWC6LCiyDcAIL8MxpBgc93w4sj/VOGVZLBr4y+1Capy3cU3v38eE40MgrOkL4DFJaISaHFgGIK19tzHFDT1jMQA4R5yHd8gxRBh6LOYiOpbdb9sb6lNNb8NO3HTHdjVe4W7GZIuo34lTB4sSwPhRKGZWkM3iQuj7YncEaPfLrtLlNK0psXYgLU4pxnLX5OhVCD3I5vD2hDZMkfaMwSvV8biQOWQWSy9GyFbLfBAZmsOtgVzyfYi4lnCcAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HNo7HTEsBVeuHUdmrNNv958T41ND7Bi9O6w3SiauMI8=; b=TEsvtd7RLOB+3SLSojl1uczA+HHKNDXvY/QlmvSC/0q9Sq5EhzvD7Y5C6tsJw42uU2KRXu7Avp3KZ+Pz269IeLZK42hSBtEFLAp8eJHsYr49NZvdY3ftDd8FdRxqFDmFB0LBuMLxhHxNrvFaOIQeZUUDoRMKHJH/moYOJBGQ8L4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by PAXPR04MB9422.eurprd04.prod.outlook.com (2603:10a6:102:2b4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.19; Wed, 9 Mar 2022 17:28:09 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:09 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 3/8] dpaa2-mac: add the MC API for retrieving the version Date: Wed, 9 Mar 2022 19:27:43 +0200 Message-Id: <20220309172748.3460862-4-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d294568-9af8-4d3b-2b68-08da01f22e3f X-MS-TrafficTypeDiagnostic: PAXPR04MB9422:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7hlO3KJdc+4R7CkOV/I8MFTJTGn1dqZGWRwOtEWZbA6E8wfpEQ+fJFMmtkYNXRCluc1tsnrz4ZUNwdhG6uWDLHhouMV6538Jqpc4SxANP+noYZNsrJkOlEyFIjOeIZCxc3BYbVDerUH32OsKwIMdm8arY1OUwBWyT8RpobcQ66uMnJi8AVNtkpEYBuC6th2EKALjzan5o8O568SWi2uPJu7Uh+YkzJZLY2qUlii2KOAPea/4NkaHiHFhvQqUe99+FjSgRxzxtN1T2jTaDjp45Ut73X/nkhZ4+YBO1LD5V16lg30KNk9L7AuxdJucXkCQPWW4NBuXJkzsWCvsXaCsLJJuBA4C6AS/u9s261zoRNGnWJqNGUK7IknxXna+0KmLJALzFnHm5ytT5FhWdWsJ+WapmRBXyhDoVdDp6yNvAQK0ZetlF9XKd7foKG+cpmhOWjz5am90p9sacROPu9HvME//2WanYeIfV4ewaveMUDoCVX+btb61yHVfFtgpTYQqOEBp8MBWCHs78x7Hryf1BJwrkrMldU5hQnsYwihIDRQRWk3A35R4+19EW7DgY3jVx14hRtJMm73C9ikXWpB7VeFwTflhKzoCdDneTGPs9zq6Yek4m95uSluQqDcDdhyG9iJ9b/Fz7ghPcN9NfrIaNXzWDj9OMIF9iIyr6PAALmrDNlF1iu8TAShwxI0hWwh8VgBVrfcT1ZAV3s2uTVTGEA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6486002)(8936002)(52116002)(2616005)(6666004)(6512007)(498600001)(6506007)(5660300002)(66946007)(7416002)(36756003)(86362001)(38350700002)(38100700002)(2906002)(1076003)(44832011)(66476007)(66556008)(4326008)(83380400001)(8676002)(186003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k9NlAnEurJ2VDamacx2XTQSnzTbsSosz+m5xzCw+EbSDIjLBwzEO74wqu1XaSVukP3LC+P5j4IXpTL8HvahL7ze6qO1rr/sxuKA6NVNJkKn8GfzuiK81ZWwh4s2P9p1o+OypFFUIJssWjsjB1OK9Si7IyFH/z1djkcggm1/7+UxTpNViSVGOQHlvUohf+I7O9jLdHv6R7OVhidSdBNGjBqCTW3Re3HtQFan+f0kiymTCOE4rA3lXzCz+IYJedjK4yScW1oSV0KNA/WectJioBTTnPPMWaXg8vHZA49Kg9up4QuvFQqKwfP/S9d07i5x8W6RL3t6f3mzDJjSbAufBPrQWXmkayphyTm00MMI6qiEGFmQKxP0se4CXT448e3YnzYs1HPBblH+jsmRsH8+c+tsIomkGRloDi6WNmkudXUIWUv5jvygK3ba4ljxTAT/7Im9ZFpl7DdaNncrvwJP3LXZbF5v01QnrWzJtb7Jpqnu1x9pUgKOKM1aSNNwKdlgnHT4A9h+M/P8AgNFvUx51u46tzciUIVgmrOEV3NhZ2NB+U+CDdQ0Q7hIpnHDZaBV2WBZCh6d9QOitSnsjXhv7Mhd8sLNW4HiKjqTeHGM+1LWWTP6Wh0lxe0T9+baIU/5hDr89OkuL69ohS6kb/0OuImjKye2Zj76Hfa4QDTY70QiROckISN23k+K9cf9+oR4SZKK5lsybvLDV695DLnZhvIWcZ8DMmyLgdTDGNPZM39wuWDCxPrAFiS26x2Toq75kihU7y+s/WPp2t7QypSyVKg0iCaTzb34/08YkfFIY8AplnwAENjUSYosgJkjs2yePSt98T8VipZeRIPzkzOoeJuBza0/+ZNDzpE5jKFTLSsgqRxQY1FGhZ+LdnVnQL6vl21pWOa8R+Yr5BV4qJBDmmhOTmdRBaKTEKTXbcYLu7XssOZ6duLWARyRjvDxEbA7cdUt7nfqq5YZt52SUvk4YKgDy+WBOuN3Gp5QNvy1J5wJ1PzHAgdMTMx2Yse3iQsns5pQdd68VQmn7fOMs140fPK5vPPsRK4jNZeLblqXngMJRxO7iOraucb+aP1GypH2PN+kR3BwtjnHP4m5Yq4OtMx/hnjfwplNNyWxRVQwmW2nOoZfrmgUqKVs6Hx1CcgDDFr7NsBTleLFNf2KOHEB3FILEM7D1bto14dGhYBCxaiB7CrjYmr6kbQjpbLU5AlkA8eQe7M0goAXzDcNG0FZeDigPB08VVL/FXz+VF17bhz2b+n2rdalk3hI316Uw/cmqMZ5AUS7qIs3r0YoC+6yG+c2DbbHkheTDKIS6ltm3vhVyEeSq8KGnP9axuUsr4Oo2doNvk5OgalQ2zCWN4nM/weZd2FCYH09dgOCKCdsa1vVlSRqdocgqoHW6oehHFbsFpFGAfmdZwoXffHqr0bdqVys7Ui5yiPBTDrWQNl6VkDnZ25OlcnT++35RKvvW4Zr5RqS7yIVwo265aOgzljMN/bnfBTEOTcqTHRhCL9Sz/SVegTO3f4kcsgp6qczkNS763GkJXa+yJJDsBvSQ9sF7WewvbIfM6PQoECHHWST2FgrJ9HplF9/4n3AcMqXh6GaqYeBQ9xGET60oso7z1RLZZsHT0M6fIXIruInxq/gy1Kk= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d294568-9af8-4d3b-2b68-08da01f22e3f X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:09.7201 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9DsyZ0h7RDZxfvP3tkdQQD2IGhY2Tn1LVmZu5xPhYpa2Hq06SaPB4hzp3jNSOdXKhuPth0ARCXC7Vd6ZqpJiaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9422 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The dpmac_get_api_version command will be used in the next patches to determine if the current firmware is capable or not to change the Ethernet protocol running on the MAC. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpmac-cmd.h | 7 +++++ drivers/net/ethernet/freescale/dpaa2/dpmac.c | 31 +++++++++++++++++++ drivers/net/ethernet/freescale/dpaa2/dpmac.h | 2 ++ 3 files changed, 40 insertions(+) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h b/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h index a24b20f76938..e1e06b21110d 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h @@ -19,6 +19,8 @@ #define DPMAC_CMDID_CLOSE DPMAC_CMD(0x800) #define DPMAC_CMDID_OPEN DPMAC_CMD(0x80c) +#define DPMAC_CMDID_GET_API_VERSION DPMAC_CMD(0xa0c) + #define DPMAC_CMDID_GET_ATTR DPMAC_CMD(0x004) #define DPMAC_CMDID_SET_LINK_STATE DPMAC_CMD_V2(0x0c3) @@ -70,4 +72,9 @@ struct dpmac_rsp_get_counter { __le64 counter; }; +struct dpmac_rsp_get_api_version { + __le16 major; + __le16 minor; +}; + #endif /* _FSL_DPMAC_CMD_H */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac.c b/drivers/net/ethernet/freescale/dpaa2/dpmac.c index d5997b654562..d348a7567d87 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac.c @@ -181,3 +181,34 @@ int dpmac_get_counter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, return 0; } + +/** + * dpmac_get_api_version() - Get Data Path MAC version + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @major_ver: Major version of data path mac API + * @minor_ver: Minor version of data path mac API + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmac_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, + u16 *major_ver, u16 *minor_ver) +{ + struct dpmac_rsp_get_api_version *rsp_params; + struct fsl_mc_command cmd = { 0 }; + int err; + + cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_API_VERSION, + cmd_flags, + 0); + + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + rsp_params = (struct dpmac_rsp_get_api_version *)cmd.params; + *major_ver = le16_to_cpu(rsp_params->major); + *minor_ver = le16_to_cpu(rsp_params->minor); + + return 0; +} diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac.h b/drivers/net/ethernet/freescale/dpaa2/dpmac.h index 8f7ceb731282..b580fb4164b5 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac.h @@ -205,4 +205,6 @@ enum dpmac_counter_id { int dpmac_get_counter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpmac_counter_id id, u64 *value); +int dpmac_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, + u16 *major_ver, u16 *minor_ver); #endif /* __FSL_DPMAC_H */ From patchwork Wed Mar 9 17:27:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775351 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14F88C4332F for ; Wed, 9 Mar 2022 17:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237109AbiCIR3O (ORCPT ); Wed, 9 Mar 2022 12:29:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237071AbiCIR3O (ORCPT ); Wed, 9 Mar 2022 12:29:14 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2054.outbound.protection.outlook.com [40.107.21.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E0E888F7; Wed, 9 Mar 2022 09:28:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xb5+w0gmKgbWt6ykmcjcbJi/LkmAhrroMxKcBAOn3nVWJ4MxkbhiebOq1hAjQJbCxR1058XqlhVPlErgkVSEB5yQEm4HtZeUniesxJE42relzZLcrAkz7ZEUNg2k8MeMg3I0v7Bo17InFWMhVewrswRHlB1FIQHrgpwKgVcKWQshNtmsYKBEFPFawTQwc2vgrXLZpARDpPQ4ytHeO5nsCjDgPH9aOjX9Xcewa78rV5St/QGDoosr335K3KgbiJn6alRdj+UwB7W0oYvTGGrA564IaLbG3PWkypCfiZ5j5sakSuoRt13RMZDO3nvQRuXreF4wcEXE/MJPlusJuiUGCQ== 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=Iw3Ycsma/+sJBmXhQFSTxXI/+6xRXp42ASo7U6HEBVo=; b=iK80OesHo/uxPHA8aK+9F8MM77SxYIQypHkkulobOHPT3AyjxCDot7Yr5kjTaGGXE053+uFitQkvTqp76YQM1ORdqmbD85JRYHhtTLg31i5O7Epie4AjJr4zFzwT0QPMWY8kAsMmPMrvCU1sjxh5fPsV+GvR8fw3aBVj2JPhK5sGSdiWweRuuPIaLsG3gbEP3z6CwoQYmpgslsK0Menep3lsvruLFApSe+QlNJQTz8ibBEEE7OFHkBIsrC21+mPnVGQHGGQKHIeSW1Szvx5GT8FI1+3sRsjvmU2+H18/QzE91GstsO8LtYx1W+EjgnmtK98+6vkrCt99aHogYCquBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Iw3Ycsma/+sJBmXhQFSTxXI/+6xRXp42ASo7U6HEBVo=; b=fvLJ7NLHJY1FBE6g4txRd3np8VGBPP9vvnPV/lC8krK5ERxmHXOl2RwizZVV4hRvE4BX3Gib1U9S6jIvICFe5H5d7knvAu7JXdHSFhFiPa7W0/gxjgthYCNHGvUZ6mpBGmqmDaOyse/Eqo/tHbw9oj5LMx1i6HzgX45/WupEFzk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by GV1PR04MB9101.eurprd04.prod.outlook.com (2603:10a6:150:20::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.25; Wed, 9 Mar 2022 17:28:11 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:11 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 4/8] dpaa2-mac: add the MC API for reconfiguring the protocol Date: Wed, 9 Mar 2022 19:27:44 +0200 Message-Id: <20220309172748.3460862-5-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7812c74-0139-480b-2519-08da01f22ef2 X-MS-TrafficTypeDiagnostic: GV1PR04MB9101:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DvTdfCbA52HEFF7Oxviey9AW85F6k7bq4HjqX4Dug1EYziDR6ZGCi0UMqIb2bvxg16zGu6I37cgTiLUnfm0OXUG4h1pKX4YszbPJEAKXyPn2UDwKbHjh0emZQjo6rxfVie2bgt4Hp8+XfURdx6Hmc17Ricss57M6YBblAbT58aUWMrt5qPmZsM6Ig3Jk8QtKF5FeGt8wzHW2vPlcle1rXwW0yz9ujErIBMFV1cBasm7TbrRVmBNa441sSwtglweKZv086+fpfymtb5QpgR+X9pHO4HGcp7UBus9OgxxmyyzvN3HfXmnFnFVvEph6jZjqUYM5pTtZ2BDy3qDObnm/JpblBSD1tF1nXt6gW5NWTObnQBVJSIDNFmTlVu4jQAdVEnX2Lpm+s+G6BfCSVjZHlXC3qTP7+powjkQ+SVCm5/+9Bv+l6Jc/5KGbQ8KayNjVaZt/LxsnB3Bd8ag+H5r3rsz+hUw3EzS5rDsh8X4AWFEF+28t6ty6zPTzjgnVnuLuBmgjLsFFHJLCFtrn9kgK377F4ciV/vb4NjM8sXYetpOuP4jiv3yg+uma9P3x/DKLiulvNsW+oS8gjlnILCtKyZjF9GQVcNVoqzzG5lbiLI2mGRZuQr3uvbYBW5T76BAHWdjBZzhS7GZmPgAdcfDIxslvBpxtymQ3Fbo1Ff9YXQcQITh3U9NpMQt73+BKtODKiL1VfJzZyE+wGtx0WoT8vQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6506007)(5660300002)(36756003)(6512007)(52116002)(8936002)(498600001)(83380400001)(44832011)(2906002)(6486002)(7416002)(38350700002)(38100700002)(1076003)(4326008)(66556008)(8676002)(26005)(66476007)(186003)(2616005)(6666004)(86362001)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HbIBGgbn4MqqJiUD+u+fG9hxxdqtjeXf+Rayj+wvH0GRRmePjPptBnXDsWV0oZ57HYM3W+2Dgz+cOD/PipjVHrCGlAM4/l8xXyvc+/C5/SUlFL9r75pClcw0jIq8qQg5GxJ1/dF3Y/pushQzUleR/fxuAAJCje7DVG41UFE1z7QY6cigxPJxDYOaZvQxlfXxLs+HEvcSIwj4g8S6YF0SGuwksx9vA5f/mpSzycWD7UE9fJnu2KVa2DaBSuXI0Eq2nupTz3rIzaAKX8G/Pa8XYyxLsdbbE3oKJXC/Qs7wME2Wfcb3ntmuK7dZw7NCYiaOhV5GutFY7W6Z2Q4Ccw5q13F0kWUwVu1LPUTuUPv1yoec0P+8SPeNVHyNPGjYg/hRuLgsOPAAZ2oxQW+uGbYOP50PBOLJELfXMB3yh82NrQzPYSXi+Q8GnHdDR3Rr1sCbycnSwfTnIxHy9J6jZ74XCQCTYqN6dmwz5B/RpJxCPArwQklXa1ut+PFfH6Tf+TluZIgjmg0WdrSB5anpTal7XloQL6zF6VuGFPW6IBSNi7XTWXZZyVhuqM5jewUF/iSFw3TJnezXU3FIgeEZOCbvTbnn5kb18I/XhYGB0CKhd2vxfxxCcL7Moz1a1WSvr9dKIolwX6YfSU+ddJaVt1HnNnSJSVGyv0Usg6v3YwUhDZVrRHTwYBK1/yiVEdTN9f+2F1z4K548ISiMPjm65JBovFJL1bkjX6nuUbcgLRYFzZqka9di/X2KRpXgOW+BLQIdVhOE/GMc+MxIRK0nTWYNt8B7yP/iNdkf/B1O0iOs18ufkdoC//Xz/JU9VvSRC6D+SgBQiOup5G874kDNI7lfxArIGiz2UbkXueYEhKdArQ/YwA+Hzeoy6feogUusPMluu/i4YuUTk3VRxSPS7x2l9coX1LsvMKb08gSgC32aNfh9Y1p4cagLOFVaroHbkgkqNHxr2nMD+QuaHpb3AXYD/BoDAhTqPOvbevMszvtV856ZOEUbzT5MN7PsMpG5RcL/u7K/4eKEn7qauGOPHnV4h89/lLoFoCStcAbj/hQEL860609ftUmYxly5SB/4DHoCm+RlnYbv6T9MJjmj3zDdShOShwLNs0RoDcWs0+O1ej907GAjf+3D3LA4vLn4MOzjVR2Th2+ItDqmJEshxHR6EMlga4WoCnG2WcXBXVPrtZfJ0VvAlTL7TSCPG5+5i3oi6zBKxzIE82134uSQPIEaC1JADN0OVKQ6Ex6fZ5CyKtqIb1SDVPssT5diqb6Ywn/yLP5JgCPAl/NyjnkdgUBibQzCtexaT2YcYuvZG8tC1miE2K95tivXiUcgBM5k5mNRRIcDRswBteERR8t/H7E1JekEtprdEUEAK8IyJFurBiOd5kqHzVxWHrPdKWXLnjAaRuBJOHEDT2s5xaq2YTEbzEPIjR9vD60Q7eGOTmYmd9nEK3x6gfXZOf7FVMoWC3yY7b5+XKkNIaYQP+h3Rn/ortHZkXHD5FRwH/zwEJqBFUYQh6wEQhDXmD1tgE5UP4zl35gpJyErk0Ve7LgIWPhPgZAbCR+WRwlaN6qZdITFXDWOineK2FeHNL3K9LWWUcnAzZqnt9gWTzx7LUSI1Y/sdAq4cEInYkk0I4+yLX8CygE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7812c74-0139-480b-2519-08da01f22ef2 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:11.2055 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2v2mP5gMogmNg4OaewRwh/Q9YbS9W1sopZxL1ac5saFua4ncbpGoBtOUk8g8b/d2SWwUf+o/u0uEFtFE6PfP2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9101 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The MC firmware gained recently a new command which can reconfigure the running protocol on the underlying MAC. Add this new command which will be used in the next patches in order to do a major reconfig on the interface. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpmac-cmd.h | 5 ++++ drivers/net/ethernet/freescale/dpaa2/dpmac.c | 23 +++++++++++++++++++ drivers/net/ethernet/freescale/dpaa2/dpmac.h | 3 +++ 3 files changed, 31 insertions(+) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h b/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h index e1e06b21110d..e9ac2ecef3be 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h @@ -26,6 +26,8 @@ #define DPMAC_CMDID_GET_COUNTER DPMAC_CMD(0x0c4) +#define DPMAC_CMDID_SET_PROTOCOL DPMAC_CMD(0x0c7) + /* Macros for accessing command fields smaller than 1byte */ #define DPMAC_MASK(field) \ GENMASK(DPMAC_##field##_SHIFT + DPMAC_##field##_SIZE - 1, \ @@ -77,4 +79,7 @@ struct dpmac_rsp_get_api_version { __le16 minor; }; +struct dpmac_cmd_set_protocol { + u8 eth_if; +}; #endif /* _FSL_DPMAC_CMD_H */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac.c b/drivers/net/ethernet/freescale/dpaa2/dpmac.c index d348a7567d87..f440a4c3b70c 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac.c @@ -212,3 +212,26 @@ int dpmac_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, return 0; } + +/** + * dpmac_set_protocol() - Reconfigure the DPMAC protocol + * @mc_io: Pointer to opaque I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPMAC object + * @protocol: New protocol for the DPMAC to be reconfigured in. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmac_set_protocol(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, + enum dpmac_eth_if protocol) +{ + struct dpmac_cmd_set_protocol *cmd_params; + struct fsl_mc_command cmd = { 0 }; + + cmd.header = mc_encode_cmd_header(DPMAC_CMDID_SET_PROTOCOL, + cmd_flags, token); + cmd_params = (struct dpmac_cmd_set_protocol *)cmd.params; + cmd_params->eth_if = protocol; + + return mc_send_command(mc_io, &cmd); +} diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac.h b/drivers/net/ethernet/freescale/dpaa2/dpmac.h index b580fb4164b5..17488819ef68 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac.h @@ -207,4 +207,7 @@ int dpmac_get_counter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int dpmac_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 *major_ver, u16 *minor_ver); + +int dpmac_set_protocol(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, + enum dpmac_eth_if protocol); #endif /* __FSL_DPMAC_H */ From patchwork Wed Mar 9 17:27:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775353 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBA2BC43219 for ; Wed, 9 Mar 2022 17:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237115AbiCIR31 (ORCPT ); Wed, 9 Mar 2022 12:29:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237119AbiCIR3P (ORCPT ); Wed, 9 Mar 2022 12:29:15 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2054.outbound.protection.outlook.com [40.107.21.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D3968933D; Wed, 9 Mar 2022 09:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BUxR30WEs6d1pBWipjvJ2rO2TnAyatt0CVFr8kjGSOwvdM0B/iltGsl+JpQR/3bmcPuPFfuHXoGOvfrufuNMcGvrqMnnJgaX3EAta/EqtnDPmyWyWMJ+72Kb3nN8fPrewgdQtEPrOPTnHJ0XMDannw73Pvz4pXPgoQ44HphNbhEqH34KCwjKz3pSFhmyeKMBwN5JIGcVsm5xGc04H168s+QHGfEpnWFZRFV5kLCbwKkzWS8hsEBSnaXHgLpPg4dQt2slS+pe4CCXj7boOTE8FPbLiHNkFQPFkiDt5ukzvX8GjogYqQqOCPY/oWdCrGOmlAY/ig+08SoBizdAeWkqIA== 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=6iw6H1oq8NBU1T86z6PJXqDg4QgGdGR3GK7d3DGjptc=; b=OuQCdzspZJ2qZwACXYPAhQx3TwDi2qt+ynAkgclKJyOvEeXr8xvu9T7pVTCkvRRRG5Uk6XU2oohahCD2RP23A6abgMylI7hq016wHNdF8nFAPKHseq/3hxSTfJrhNhy3K+7sO298M1Ch3cnljIhdIg5cUcWkkLjsbzU8RFZG5P2LgXxTxOVu+huiKNS31p2lvI5QTPwB1nhhWrGQhnwMj9SKgwJvXVQy1KnRPlgDNqB6oGuo25r+NArSjOICJm5lhUsOFNBylEnmXMQeZWKk4jb59VZUEQts+u8v+3NQKwENwDHRfirA/B4FIjwLAFd+S80kqOnsdM0jeWxE/7lYQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6iw6H1oq8NBU1T86z6PJXqDg4QgGdGR3GK7d3DGjptc=; b=GjTrUGqLp32nfWLwihHI7buNRLrvn8gC6fx4gB2faBfgLOxM0u6mG3KwmCbIviu3aeAoEY0VdhF4yvwTfNs9UvCWf5TISyh/z5INld4GddyyDQBbHc/9xf0acZMd82eVHq94h3i7W2DeDnrX/sge/QvKWQdbVv/FhsLxhenyejI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by GV1PR04MB9101.eurprd04.prod.outlook.com (2603:10a6:150:20::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.25; Wed, 9 Mar 2022 17:28:12 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:12 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 5/8] dpaa2-mac: retrieve API version and detect features Date: Wed, 9 Mar 2022 19:27:45 +0200 Message-Id: <20220309172748.3460862-6-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f551cb7f-b39e-42f3-4951-08da01f22fe5 X-MS-TrafficTypeDiagnostic: GV1PR04MB9101:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OQWrtwdwaIGrrrXZljC8DjeJ5s3IEBDjzGM3CVPA4ZSW4PoJNmLSHIrHa4rZ3OBQfDPQRJdzeFRLYV4PyCco356yChG1EtrHuhKgf1nnZ6DWZ1Qjve7h7gNBxIY/DPUhywuGHiCH1+NiHIGFOTRYp95KJhcgrZhxxLyIgwExZOuxdA/V6mIQoSLU4DT3mJUQPQyWKbABv4C8vIynoZrGRr4XiFXhRZWiv0oUFFNEOHM/BQ7lskkMJerdnls878+3nE4IS8GIgYQx6OVVafshBFsIcUpBW6Nn2CqXOWMTCVLAKBp8onen+hgpdFi2wnXYFDzac8koccgtzVqFBYlHN5YN9o1qXT3dMZgUTOsXVpQi+qgSm0STNTq8QEG5gaE9g99Wqn800WFtrsebAo0hhqQ1e3cov3nJbnRpNBttksXrntYxPdySmzEE/QPSk/wid8ySvIBpL/XzwJb7skXrfC6ZqYa+C7j7K+nwia10a4GxTtf9ZWJODwsnwAdz4pYc/5UgvmbSd2G5pDCKAMWmxV56WFFRZ7tS19tRD+3pz0br8VUo5nAaHnulUMZLuUH1Izz/OHFhjhPPq5Sb33eKwGxiFxdyoH789VtZfWI+K5BmrfWOAbksr8hDEom+4+09KORZvdMJ27ChE7vIeAjX0yyULb0beQzzFc25p/PJaw/ezMr4HcbYIkvrpJ2ILuZSB2y9ASsHTYhAyKzV71w4+A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6506007)(5660300002)(36756003)(6512007)(52116002)(8936002)(498600001)(83380400001)(44832011)(2906002)(6486002)(7416002)(38350700002)(38100700002)(1076003)(4326008)(66556008)(8676002)(26005)(66476007)(186003)(2616005)(6666004)(86362001)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Etd6F8Nn0wBxlyQOiAenFn/0Y7p2VyiBrrlvpJVJNjNZ0PQ3Vh7eGSqu9F+sC7ZOoVSksebRrUhCwKiRF3SV3lIIKjsgw7zeJNWrQvbIJOR1kLIKLzU88LdxvMgRBa4SdO3bMBbzLpcusWDMm0yEYXAuhlaNipDwksAnbBD3yO/982CHfaEgqGQPyZYemlYzE55nRLsSscRBUb5ZelHB8QoTJaokLJwk13oB1A9mCpmlooLc8agQ5Lz5GfMLeXv2HRWk5iFxrlWGVhKx35b3ZxxzxRp29Rp7JytGaPrA8/MsfCQwjY56xEbNzk2sSbeTBtwUXrxy9zxsUQf/v9uL6SCGMZYlkU3EorYHmhtTml/R5crmTPJ5VDii+k/tXRCC02byrmkgdNPWNbuEiKeMBrsjyI/IX4OIxnnFOYiyA3ipAzMaZyBOKp5iSrWxpWz4rdOix1whcVzd0DEwA80NYiuZeLPIEqTGqHAyJmr9awlVW5kX625YyYZ0u9wzrePn+BfKXxL+AIhjaW+beiaamUVgm5n9ApPqdSXv9LEAgltW2HEy9PVcZ3fknoUSWAEp7kh+VSd1sW4fYjvMdT2EY1kn5GqA5+RSqqEDJFIvDkuQurGGovhCFQvGfo60GG8un/GGWe9H3Irh6cJ4W/p73XwRPDmHRHzm6rE+hKvR4vmVBgSFhCA3cGFKZ3h1RE/3+xuaCuVvAGEab+PQx7bP5YDMKOmZPYOTjzaPjp6J9J5ChcKxRT4qNBLaDBclu/yYT/DGuyO+J6L7FV//rAyUmKdZNpAYqt1ywOQnD68/CHZVIreuhiUcfnR64c70mBLlh9CWAirvO5FQYDkNlcmmszhZNTGJE4TseuTDTAqALrNUg3DUeu80203NXm3qedGgT3WiSfx2bwcw/Z0kWOODJrQFtiObUPGu+eyydOXhAE3b44NLVkM45Xc3AoGeyTJiTJFqNTYn6QCuNkFqalVeIb8xsjC2IURvMX3twvy924+wOgDNz2Wh3kmOSry5zNgTLRyufUpw6uT9ks8+oEhxv2mmVsnyg5RTu964Nsq1MicLMecVAzcEg0pRtooZ5CI1IBlNUWjhtUW8MKzECmZisrBhNcuhQr725PIpfeNTue7JgMu07yeHX6PwnQBFcv/dJYe/h2wxssaqZ/GD3iPz7/05e0QdXVT9mRUc2Pt/2xsY0gZkLAIZXq9cKWeWj3ZkMy2a92JbE2zguIAA0vcMn4V/N2ratMWUOSLoPDHqgE/Q/8YTJDCTmZaq8QBlo7FtY4wk+kJdaSZwkxKG1mMFDMxY8OdS8/H4KEb9n+SMtgYfuoafPh9TUYiW5Ref2Le2ZquUp3OVZRola558fUyasRavrpt/ja6YEkCiec+cSjrKgRztok3jLatYh6l9BYz5Vok52G65dCjEazwnAK6RHoZ1RkBSKCmK7i773xfvgJwyKw2L141IVnqPruvN1KoCtaYb82f05iD4CwRjvRHdQfS9klQ4X2o1dTsjfstzZkRZt4KAj8wlmjV98kpkx43c5PTlTw8+BTxtrdfzwBvFsE7ykyErjaeriTKRtwASLWlTIQtyQ8dK03C/vUzTCCrfAbMU3/MWcpYumtwUAbwswP0lwpzlV5GnfiUAc9qGPZg= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f551cb7f-b39e-42f3-4951-08da01f22fe5 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:12.4865 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /D9zuNYQN+zbBQ6jjX/7jnXQfRFZy2+evp4EDwxBfOcAkaG8DDzuQ0LmMc8Mh8y5Kz279VTAbVw5USE+BwBMYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9101 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Retrieve the API version running on the firmware and based on it detect which features are available for usage. The first one to be listed is the capability to change the MAC protocol at runtime. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 30 +++++++++++++++++++ .../net/ethernet/freescale/dpaa2/dpaa2-mac.h | 2 ++ 2 files changed, 32 insertions(+) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c index 521f036d1c00..c4a49bf10156 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c @@ -11,6 +11,28 @@ #define phylink_to_dpaa2_mac(config) \ container_of((config), struct dpaa2_mac, phylink_config) +#define DPMAC_PROTOCOL_CHANGE_VER_MAJOR 4 +#define DPMAC_PROTOCOL_CHANGE_VER_MINOR 8 + +#define DPAA2_MAC_FEATURE_PROTOCOL_CHANGE BIT(0) + +static int dpaa2_mac_cmp_ver(struct dpaa2_mac *mac, + u16 ver_major, u16 ver_minor) +{ + if (mac->ver_major == ver_major) + return mac->ver_minor - ver_minor; + return mac->ver_major - ver_major; +} + +static void dpaa2_mac_detect_features(struct dpaa2_mac *mac) +{ + mac->features = 0; + + if (dpaa2_mac_cmp_ver(mac, DPMAC_PROTOCOL_CHANGE_VER_MAJOR, + DPMAC_PROTOCOL_CHANGE_VER_MINOR) >= 0) + mac->features |= DPAA2_MAC_FEATURE_PROTOCOL_CHANGE; +} + static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode) { *if_mode = PHY_INTERFACE_MODE_NA; @@ -359,6 +381,14 @@ int dpaa2_mac_open(struct dpaa2_mac *mac) goto err_close_dpmac; } + err = dpmac_get_api_version(mac->mc_io, 0, &mac->ver_major, &mac->ver_minor); + if (err) { + netdev_err(net_dev, "dpmac_get_api_version() = %d\n", err); + goto err_close_dpmac; + } + + dpaa2_mac_detect_features(mac); + /* Find the device node representing the MAC device and link the device * behind the associated netdev to it. */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h index 1331a8477fe4..d2e51d21c80c 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h @@ -17,6 +17,8 @@ struct dpaa2_mac { struct net_device *net_dev; struct fsl_mc_io *mc_io; struct dpmac_attr attr; + u16 ver_major, ver_minor; + unsigned long features; struct phylink_config phylink_config; struct phylink *phylink; From patchwork Wed Mar 9 17:27:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775355 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB154C4321E for ; Wed, 9 Mar 2022 17:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237147AbiCIR32 (ORCPT ); Wed, 9 Mar 2022 12:29:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237140AbiCIR30 (ORCPT ); Wed, 9 Mar 2022 12:29:26 -0500 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10078.outbound.protection.outlook.com [40.107.1.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C0B18BF69; Wed, 9 Mar 2022 09:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eko9n25adjvGxGegNeSxz1kxLZArUD0CWw8zL2r5JKuzTmwPYJ/1H8Eva0eiXICbXEdJ5dVaRflnSqjk1hwKlj7lATl/JIsoaGuTmojYu/V/Vn5zdhIODwj+nt9K6r9rn5e/aC+cGOXXEZoGIlG1XWhmnZ2Jbb88PTyf40C3DH+wanMGhQ/1K6XcV3J0db8X1msfKnWffknLuz9ucpYMLs97iPZX1G/g8y9pA4yseFsqND8juq3RgllW87xXi5T+q19uZhZBFE8+QxipdeUnBPUcAsMqWuzOWuuvxnMAfhFx6Lecj42wikfcngi6a7PK3FaO0Wwgdnd3N5865rddBA== 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=CjzYIQLdKTdgyHM+oE25auI3Au1YkRyHQ8i+TqxPTRU=; b=ViHwxvw6a/LW9oV3qtopshWqrLp3Y2OXudg6gfpF1ATVcy+aTl6BHp3seEd6mxnb6lXENC+kb8gw4e8NRmdWXAi14pe64ig6WHbgJOpE1j1BGEarWHldBTIh0NmESkUTdPxRo4FixzxOfnHnTN2qrhZg/LUKhSXd3X6bXcpPfn/NCBjEWnSb5zte6VpqxaRiMQvMKYKWMQ4sKMXUtdmKicZ9DUqyHXLKEXWfGNCVFzwUPs8Fc2r4OEmeoyKPjcGdQ5HTiMF690rSxni4bLBmXT9vDc23ijdh0Gj64JFhq/2MWSHNDi/5+DmswOOSQmTgbOaLPjK16Kmy4O68xWEZ5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CjzYIQLdKTdgyHM+oE25auI3Au1YkRyHQ8i+TqxPTRU=; b=awHXOf7lIHUeQaNsdIY2jC9EsHKD0VP8cTVCHx6oHr2gOugRJTX38TnbI4V6R2DYmR3oUmNnafXcygAaS7MVd9wjw78Jfn+Et2neWQwZnScbvVGuKa6ZFusepg7YHbUMlu3r2dmZaFCj+Eg7Im3o8Nj5Oyz+FIoqwyfmJXHUXiA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by PAXPR04MB9422.eurprd04.prod.outlook.com (2603:10a6:102:2b4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.19; Wed, 9 Mar 2022 17:28:13 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:13 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 6/8] dpaa2-mac: move setting up supported_interfaces into a function Date: Wed, 9 Mar 2022 19:27:46 +0200 Message-Id: <20220309172748.3460862-7-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eea7f833-a1cc-4073-3953-08da01f230a4 X-MS-TrafficTypeDiagnostic: PAXPR04MB9422:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SYL7gz/j9N6KsiA/COt1Q+nAWl6YO9kqPxVrfLBmN0pn8rtH+e5LWk/Pm26CF4a5sXbUpXpc8Gn2hsJJFgVqRIELWw6AlsxbHwwXCGGH8ABm45F5rGqF6OGgI06G8w5GLZnJwE55g2UlO0o+jwL3hilg8Z7EFP1i69M78D2ReYqasxcBTnmypdZvH+CWC94P/lH4I5FWnQQ1RFZFG3oCl2OZDV79EhO3gBC+qLAni+tkfCJbRCKuW/iGoM3KN0yO23zD8D57YrQ31BWirSO+cYm/rItnTkt4bbXaDX6ygsf+RmEhCL9z8Jx36bSN9BDK+zIY8cm90VJVeNV/ro7F5HBEZSPWhCGkfK5lHR7hJ7ND1kaiO1Y6s95/wx0tbtJ467ggiyeyCAviQb5cZmIGqiNJzZRW9vye3SYR619vLgG5RbR7z3RknuTqcga93mFkam4JqS1toBaVKTkBvlwkaeW4pXPpBwusXRIWl1iRkAovZRoWsNE0reBPkyicQ4mpzhWtQ4qexVjUk3KVAniQE5UU6ZlEnPcC7sCZpw0yDxDIuoxJw1LK6OGzXan5fGzLogB6eVMia9tX87o2+sMJMY3NsTN37XadhSIBGFjLwJlLIgfxnbDnYkdKCUVbjtCe+l37Z6jUqx2u8wXF/VsCfW+hUAywzFvsIMkLBDInDwnAj3RJUePjieb14IJVJcibTYa2LkLNCAAgIbEe2lY2/g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6486002)(8936002)(52116002)(2616005)(6666004)(6512007)(498600001)(6506007)(5660300002)(66946007)(7416002)(36756003)(86362001)(38350700002)(38100700002)(2906002)(1076003)(44832011)(66476007)(66556008)(4326008)(83380400001)(8676002)(186003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sBN2jM6/1srNL7zhS0OhVO8CKOtQkLZ+S4buU/KiO1XT6rG3Jv6TaJ8MFXgtQTZpQ7I0BA8Fza6qUsC/W2hvUfZk+xXGGkdseIusW9Y1eXvwngL5qSIhmn4Tb5zfVYGMwNH3HRfHBRpZlsvIeX8V7KAtAa5tZCPaK0veUuU3M7SnRyHSS5kRRkpDc3GPJhdzn/eiM3uNer+Vj+nCvgnDJjaS4n3/g80RQvFLdANKAzjOVoD6fId+8BTDc4ouhmCGvc0kPB5fa7eCWNhAtBX3Tje28/iDk2iYHFH3bwDBrAuQEegQaKO3dsd0xcqsmr6DFtbWFwWw6suWQpUaTcpazKPQFKU8HFfkCLuOKCWf19dQ8eNpM661OnyA8fmfpG7+HiXeqjwinx0ikWdRO4MDvJNQ9FYUPGuN5thEBZ4kDHVTCaIkyVjo7Q424UYs5J4e3JDOU/6PB2EUn7SvrMg69f39ID67YWNOCgpbIQXSHPmRyrMoEXg0KUrrOqApwZhK/uwDyoxTIGdnJjcRedoaP5D+ibN0NLYApgkZ2LFNHTLjNDqvLdQYmsOtD3EreVbnwsZPm1MeHdWNClFqOsiTIzGV79TU4xvdkw8qUpPCmAi7eLMY3jUfVjUBIvRhlUHkuZtwU0F4eqT9loj6KSrY6VPSmzwU20pQ88SEpU3TdfArHwgfhFqUv7CiL4ESks223Jf5Km8PsYvs6p52vh4d6wDc1yITW9B7/65q9TwZY26Alm4yG5o3z7FUhiMeYmZCbbUTDqgSRotl6ZFJHTf0+igJxuB2CvqZnawncoy9kRBo0G8KBgXNRCoF13Op7/X3xUfd74jjNxmXpFksAj0UGBHCpkTXk7mDLuC0JTRK0z9z31V0fU03/Eg7D3J0vy2J46Q9qCFPgmAYRoPzXu++Pyha7ZPjAmEor6mpSbgAhjXWJQj2J2hKTUjft2PRNpDg81zhg7k6OxZ9hzMIdqwcNq8oDEH9cGOi+75Oev3KtXHDu2InETsQdYETL4cWQa/HnMrHwLDOdj9UAX6XzH4EQlounObkvPgw4k6octoDhfzcx23p56POwD9Z2eDZJhUunnMt+CT5T0z7CqyFPtyU026dxjRMhJrqWt5QupItVwrS2fbiH4ODA2yT2yDgkateB3FpUZQZAriSS8Qk1k/PTQL8OkvYKc91gOzijfHU/7k44J1ohMjbGtbk9BcL4CwA5pUi9l+dYRlQTasNCeTtoL0oLgNRdXZX2ylGzs6WvN0szCtZPWu6LMkdyQB0XevPlQ2mHu1XQRtcLb7b/UF8ZFRbxZy6t4+8rGrWg4neFi4j+paHK+DDFBwRao2SomJoxCmlMMaeDlC6Gg3JI86XDVYyp/1q3z/IRPx00RftLBL4Wc18i0HwREBYpYOx6E6qo+uBOPCZA8JY4sjEZogkKqtyN6dxIfOuFtzFrnXW887fn4SVMx1UCb0N9gj+2ZA2bV9ny+tuvV502XAtzHyldQJu8OlzMMiWADjDj5bsENTQfXNaBk9u0uvfxaIJZUB01Qa/eAW6WUJbrPXm1ph2H8r2XSo2wXgZBSPUJ2WzB4XZZ0i8ODVjzKfqXbA6OhPOtGwxPJv+JG+94sFFwUuztXOO75RaKV3chEUluA6JYTo= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eea7f833-a1cc-4073-3953-08da01f230a4 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:13.7391 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ta01wLUu1fHK1CmHekj9jsxz0+bRIcYV/d9AYLGVmQUYy338uG8xA3txvdG1YCk7taZO5aZnDJMbZjoREQBcEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9422 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The logic to setup the supported interfaces will get annotated based on what the configuration of the SerDes PLLs supports. Move the current setup into a separate function just to try to keep it clean. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c index c4a49bf10156..e6e758eaafea 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c @@ -257,6 +257,29 @@ static void dpaa2_pcs_destroy(struct dpaa2_mac *mac) } } +static void dpaa2_mac_set_supported_interfaces(struct dpaa2_mac *mac) +{ + /* We support the current interface mode, and if we have a PCS + * similar interface modes that do not require the SerDes lane to be + * reconfigured. + */ + __set_bit(mac->if_mode, mac->phylink_config.supported_interfaces); + if (mac->pcs) { + switch (mac->if_mode) { + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_SGMII: + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + mac->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, + mac->phylink_config.supported_interfaces); + break; + + default: + break; + } + } +} + int dpaa2_mac_connect(struct dpaa2_mac *mac) { struct net_device *net_dev = mac->net_dev; @@ -305,25 +328,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) MAC_10FD | MAC_100FD | MAC_1000FD | MAC_2500FD | MAC_5000FD | MAC_10000FD; - /* We support the current interface mode, and if we have a PCS - * similar interface modes that do not require the PLLs to be - * reconfigured. - */ - __set_bit(mac->if_mode, mac->phylink_config.supported_interfaces); - if (mac->pcs) { - switch (mac->if_mode) { - case PHY_INTERFACE_MODE_1000BASEX: - case PHY_INTERFACE_MODE_SGMII: - __set_bit(PHY_INTERFACE_MODE_1000BASEX, - mac->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_SGMII, - mac->phylink_config.supported_interfaces); - break; - - default: - break; - } - } + dpaa2_mac_set_supported_interfaces(mac); phylink = phylink_create(&mac->phylink_config, dpmac_node, mac->if_mode, From patchwork Wed Mar 9 17:27:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775357 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6FC9C433F5 for ; Wed, 9 Mar 2022 17:28:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233374AbiCIR3b (ORCPT ); Wed, 9 Mar 2022 12:29:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237145AbiCIR30 (ORCPT ); Wed, 9 Mar 2022 12:29:26 -0500 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10078.outbound.protection.outlook.com [40.107.1.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA82F8D686; Wed, 9 Mar 2022 09:28:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LjEQ2WsYgmCgi7zVI6ocANBXNM45gbci1AiuTZ2FzhsZqXi0Kfgh7JCvzJ5WYeadyIXMC/4l6+V5O5hNY30Qf5PBQipL7no/GWaXjuxQnGEknO6Wi7HFU5/f/qoQz093suYGO8lf7HbPZCzDkEWMtlRFVYGpQNvg/FxgRpmdqoceW7ZCWcg+FUuNWevQuUraMPzeeexusFsC2fgQ8lBcB3mgoUMuo1+wfd/NQOwmr2A0MSP6cLWtxa4GmOyNl7Uf0pLyhOB8VMOzRhv5CfKJqPZ9CAaiSxmZEBVgcIbSApPdFa4mia6YCmttQ4GeknuMabJgrkFkQxVUslBfchlvBg== 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=Ih2CxV3JM80cHwJ1F2PADtx8v6tK/2R7JJLjD5unI5U=; b=cn3DQVCo9EyHa/iakhtysy79oS7xzTiG0Zdbw5e7+fy74gFtltwnS/m36ADBq+zwnvqtJv1EbQOPNz2RhuZFvlzzsQm+qSWiAWLzrPELVJ16sbDznhSmW4EM4IhLqfuIFIZDI6jd+YJWCB25ouKBu9o9wUEcQgvWOR9MwjeClrlUHHdxFazVdwCH9VAyzEaQC+7GIQgewKpzTvVNrhhgqI0XiO7uIUnU4L6XJPXHvJ5v4YR9anAa7LbCADX5Z3jWG+BZ/G1VbJkZyuBUbsEcFUIrCT/X6jefqSPBg6fXnFWdhXgHO2PyDHDPxdjIfJFq2BLUqTgBm3ndszk0UgjG0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ih2CxV3JM80cHwJ1F2PADtx8v6tK/2R7JJLjD5unI5U=; b=Kg9cay4dkToBgd8g9h0aG0cjfV+zbXhIbJ6s6AJ73IP5uicn8eghyb5T/sgLu4otm7nVnAYr59V1S4jrK2AvEM1r8T552XO52prsy+Q3Y2ixD45yR/SK7bFofC/bq8VlXkrDhPFMRdnxCQbS4J5TmumJ+6bvCx+tgxwRP1iIJDg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by PAXPR04MB9422.eurprd04.prod.outlook.com (2603:10a6:102:2b4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.19; Wed, 9 Mar 2022 17:28:15 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:15 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 7/8] dpaa2-mac: configure the SerDes phy on a protocol change Date: Wed, 9 Mar 2022 19:27:47 +0200 Message-Id: <20220309172748.3460862-8-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a8b5b00-65b5-46f1-583c-08da01f2315e X-MS-TrafficTypeDiagnostic: PAXPR04MB9422:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U9AH86yzIN5OEhE3DayIkEUsqxrUSFX0ptKPWNq/Mqd0+juQpAy9wrXKeCO11TsFw08fbchwWQ1crpstN3DOzfqY5PDUCTOllU5dDnRbCKN2f1MoMGC42H2ljDSVronTjikpU/nbXJxlRuMmhkRU25SZi36leVFB69+AZdKjRXTWrojufanHNgreGCjf7RW/OcNiqUWje1qMbaMtCZPb1aU1IdxcEStwDkZ1Be3q7TI2TlgtC7qp7EpxUV7BHEbf2cKgtoU3B1FdbQQi/jdCOEj/HfpNSDv2U3xJFXTGascCx2Zp80pWAh7lc5mDo4OWkCbYYetB8/pWFkW0JGGPbInRsznWMykgUHv0TQymY18lx2wf5Cc3lzYmSr+53nzB6mWvf0aHTEgHYjS1zm80ctafiy97lavQL0PccFUYaBe3H9QRgXifFGdfXzfx5I6eNw2WMtBBkbIfVGmgIQsGw9ImgrOIhht2WEI6vD+ZyhYXhQnylHRUb82XD/vdKt/NFoMN4N3noCiQdUM5uo4d/pyBCRUfSvCeywV2xaFn3oqaj9yz9j1UIb6yuPaeYi3m2T9PQBfI6fy4dHMac1IYZipMbGYH/h8HA8OesLpFyXxemMlTREUMHaNTAQMf6/se8C2OgXJDgfoI1nB4WqjdJWRvBMsxOFghcvwFpZy4oJp6yLEvy/LSAhkoWAydY+uJqMFcojm0PDhU6ZJt7P9w6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6486002)(8936002)(52116002)(2616005)(6666004)(6512007)(498600001)(6506007)(5660300002)(66946007)(7416002)(36756003)(86362001)(38350700002)(38100700002)(2906002)(1076003)(44832011)(66476007)(66556008)(4326008)(83380400001)(8676002)(186003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ePLj+rl6ceOd/O3akbNPDHuSqTTtWKi2rIqkDvTAZy5LAqudRUW7wdLjiU4ni4tyKbRhf3yzQUScHGh1aEWOYb5/EUK05nXqCDJbjA277Sx1Et44OpWD8LHHUhLVUrmUzj1YMmkmgc7ILZDkcUmN7SHOEA8Lf2B3Nt8okTnlM/YbDAfydbSmpP8q6fVLWk+TFvllsZWThPqoOSfrHw9Zxt0KL3ZyXR2/ws65EGj/21dIor4HnPmETUDtKIsAuCyIwCfy+80G8GBP373xn46FIR3K3H66KObn+NvbcEUQmwCjK3BCu0u3gkdwIELtk+qTFrNnORmsU6zCXw6L1hpST96l4UByC7CYW5HHaMEeCI4VH4XBiQ00Dyi7nM8KXkCqRaAwG1X+7NWy3dKNnWCLeTlMKZ3CWPxqqXjKFfH9I7vLzGD20ycq2PmcgTTQ2OpxgVVe4vxLlxSazHbPh+Bu5t7iRyTJqf8+Z4jUAUlLkyQsb7Ndfg//Z+h28TaPez6+ZtUsQChwlrer4PAb5VSSeVvVvpDUrFwnS3Oz8KBkRhK3e1pg6kaaYCuw2EDVRVaL1UDW6BSBgihv8wXpaEtIlW2zPvINq2txZdL4A/tHJQaUPFE+p9xvzJQhJ3BlcFmYD7KnX0fUN5jtjpT+084Agbh2lUGKm33DSLjYl24P53L1HzkqQPqqE/H7wbLiyfxMMnNPzT6ONw1jM1TGgvvMmQMy6Z6QYiZJVjvIaZP6Ij4+/9V/gg5RYEuvRY53XS3NdpVdTg75h0BCuXD7l0hIBpcHkCw2c2NT+Sx1zw/OBbH8Ma/oT2DXbCfiyTWORf9COXY//MpIv8UW4d6N0E5Juq+JVKTj6HSC74RC4YjuQR/TljnImltTe6ZjI4Y0oOQ5DszaBKf9+GJyQzpmi3OoRxCHCj2PCoX7IE87xoE2Ahnc3bCubMywZIn3qKb6iPsMkfBDUa+L/23aV3dE+1WSt13g/1c9YE3uYh+lYwjHvlwjay5waCTZEPCfshoIA0Ogexs2T5pWcvjZYqjWg1O6QzMLKigeV0j9mTpRabJBEMcjsi0B8/stkFaZI4nx2nxOBR2e00T5e3p6/1RtTLRJHW1mbiMXiQR1/u443u47hqtIO1a4oQY5zGBBZqBlpq6w1QwumWPBbAPwYrGCLMXdNwGLGD2k4rvpHZviYzs+eEcfH0KuqVKl2j5JEG2bkg6hZFKHfYtdzzA9y5sGxs5e/ekpHD99BHVE6gW3tMgoTZgf1qI/I4nC1KWeTdFlWPTm2kTFnZROuhLPfaFwuzJJuM0AmDd4vTy9ykewKss9B7UbIsrfX5d4U3aNDJer/f9cwMLrbMDVeAw7YS1sAUwQlusyeB8hLj7P+9HZaZ0lzS49XhJO+FXhlINwNZkL25Y8NnLPQOmvjKOBzSB3ddo1uV3oD4+z2P2EDueYUP/YM9Y89z70gsXugYcVN02FtDapQ3/FJV89XFSYZRnp4DFX462Z0ycpM8gj95Fb3nYD9yPG+9zfsrTjAMxD2YMilFtQxVh85LqpRCqdQBwUY/ZXePsSEg5ll8UVJHdaCXZmJEDmEDfbVSUgwuho0wvtoK5m62wUdY0szAT6DvYZODh+AL2EhqorCtDSEsGea7gmFQE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a8b5b00-65b5-46f1-583c-08da01f2315e X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:14.9420 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eL2Pe109YDgCxsC8RZIgptt51koZTd2EDAkJAbxczmePdidNinFsD7/x4W9vG4mN4NMLL3I3oh3jIpyZ8Ig6cQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9422 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This patch integrates the dpaa2-eth driver with the generic PHY infrastructure in order to search, find and reconfigure the SerDes lanes in case of a protocol change. On the .mac_config() callback, the phy_set_mode_ext() API is called so that the Lynx 28G SerDes PHY driver can change the lane's configuration. In the same phylink callback the MC firmware is called so that it reconfigures the MAC side to run using the new protocol. The consumer drivers - dpaa2-eth and dpaa2-switch - are updated to call the dpaa2_mac_start/stop functions newly added which will power_on/power_off the associated SerDes lane. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 5 +- .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 91 +++++++++++++++++++ .../net/ethernet/freescale/dpaa2/dpaa2-mac.h | 6 ++ .../ethernet/freescale/dpaa2/dpaa2-switch.c | 5 +- 4 files changed, 105 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 939fa9db6a2e..b87369f0605f 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -2077,8 +2077,10 @@ static int dpaa2_eth_open(struct net_device *net_dev) goto enable_err; } - if (dpaa2_eth_is_type_phy(priv)) + if (dpaa2_eth_is_type_phy(priv)) { phylink_start(priv->mac->phylink); + dpaa2_mac_start(priv->mac); + } return 0; @@ -2153,6 +2155,7 @@ static int dpaa2_eth_stop(struct net_device *net_dev) if (dpaa2_eth_is_type_phy(priv)) { phylink_stop(priv->mac->phylink); + dpaa2_mac_stop(priv->mac); } else { netif_tx_stop_all_queues(net_dev); netif_carrier_off(net_dev); diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c index e6e758eaafea..bd90acc49cdb 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c @@ -3,6 +3,7 @@ #include #include +#include #include #include "dpaa2-eth.h" @@ -60,6 +61,26 @@ static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode) return 0; } +static enum dpmac_eth_if dpmac_eth_if_mode(phy_interface_t if_mode) +{ + switch (if_mode) { + case PHY_INTERFACE_MODE_RGMII: + return DPMAC_ETH_IF_RGMII; + case PHY_INTERFACE_MODE_USXGMII: + return DPMAC_ETH_IF_USXGMII; + case PHY_INTERFACE_MODE_QSGMII: + return DPMAC_ETH_IF_QSGMII; + case PHY_INTERFACE_MODE_SGMII: + return DPMAC_ETH_IF_SGMII; + case PHY_INTERFACE_MODE_10GBASER: + return DPMAC_ETH_IF_XFI; + case PHY_INTERFACE_MODE_1000BASEX: + return DPMAC_ETH_IF_1000BASEX; + default: + return DPMAC_ETH_IF_MII; + } +} + static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev, u16 dpmac_id) { @@ -147,6 +168,19 @@ static void dpaa2_mac_config(struct phylink_config *config, unsigned int mode, if (err) netdev_err(mac->net_dev, "%s: dpmac_set_link_state() = %d\n", __func__, err); + + if (!mac->serdes_phy) + return; + + /* This happens only if we support changing of protocol at runtime */ + err = dpmac_set_protocol(mac->mc_io, 0, mac->mc_dev->mc_handle, + dpmac_eth_if_mode(state->interface)); + if (err) + netdev_err(mac->net_dev, "dpmac_set_protocol() = %d\n", err); + + err = phy_set_mode_ext(mac->serdes_phy, PHY_MODE_ETHERNET, state->interface); + if (err) + netdev_err(mac->net_dev, "phy_set_mode_ext() = %d\n", err); } static void dpaa2_mac_link_up(struct phylink_config *config, @@ -200,12 +234,21 @@ static void dpaa2_mac_link_down(struct phylink_config *config, netdev_err(mac->net_dev, "dpmac_set_link_state() = %d\n", err); } +static int dpaa2_mac_prepare(struct phylink_config *config, unsigned int mode, + phy_interface_t interface) +{ + dpaa2_mac_link_down(config, mode, interface); + + return 0; +} + static const struct phylink_mac_ops dpaa2_mac_phylink_ops = { .validate = phylink_generic_validate, .mac_select_pcs = dpaa2_mac_select_pcs, .mac_config = dpaa2_mac_config, .mac_link_up = dpaa2_mac_link_up, .mac_link_down = dpaa2_mac_link_down, + .mac_prepare = dpaa2_mac_prepare, }; static int dpaa2_pcs_create(struct dpaa2_mac *mac, @@ -259,6 +302,8 @@ static void dpaa2_pcs_destroy(struct dpaa2_mac *mac) static void dpaa2_mac_set_supported_interfaces(struct dpaa2_mac *mac) { + int intf, err; + /* We support the current interface mode, and if we have a PCS * similar interface modes that do not require the SerDes lane to be * reconfigured. @@ -278,12 +323,40 @@ static void dpaa2_mac_set_supported_interfaces(struct dpaa2_mac *mac) break; } } + + if (!mac->serdes_phy) + return; + + /* In case we have access to the SerDes phy/lane, then ask the SerDes + * driver what interfaces are supported based on the current PLL + * configuration. + */ + for (intf = 0; intf < PHY_INTERFACE_MODE_MAX; intf++) { + err = phy_validate(mac->serdes_phy, PHY_MODE_ETHERNET, intf, NULL); + if (err) + continue; + + __set_bit(intf, mac->phylink_config.supported_interfaces); + } +} + +void dpaa2_mac_start(struct dpaa2_mac *mac) +{ + if (mac->serdes_phy) + phy_power_on(mac->serdes_phy); +} + +void dpaa2_mac_stop(struct dpaa2_mac *mac) +{ + if (mac->serdes_phy) + phy_power_off(mac->serdes_phy); } int dpaa2_mac_connect(struct dpaa2_mac *mac) { struct net_device *net_dev = mac->net_dev; struct fwnode_handle *dpmac_node; + struct phy *serdes_phy = NULL; struct phylink *phylink; int err; @@ -300,6 +373,22 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) return -EINVAL; mac->if_mode = err; + if (mac->features & DPAA2_MAC_FEATURE_PROTOCOL_CHANGE && + !phy_interface_mode_is_rgmii(mac->if_mode) && + is_of_node(dpmac_node)) { + serdes_phy = of_phy_get(to_of_node(dpmac_node), NULL); + + if (IS_ERR(serdes_phy)) { + if (PTR_ERR(serdes_phy) == -ENODEV) + serdes_phy = NULL; + else + return PTR_ERR(serdes_phy); + } else { + phy_init(serdes_phy); + } + } + mac->serdes_phy = serdes_phy; + /* The MAC does not have the capability to add RGMII delays so * error out if the interface mode requests them and there is no PHY * to act upon them @@ -363,6 +452,8 @@ void dpaa2_mac_disconnect(struct dpaa2_mac *mac) phylink_disconnect_phy(mac->phylink); phylink_destroy(mac->phylink); dpaa2_pcs_destroy(mac); + of_phy_put(mac->serdes_phy); + mac->serdes_phy = NULL; } int dpaa2_mac_open(struct dpaa2_mac *mac) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h index d2e51d21c80c..a58cab188a99 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h @@ -26,6 +26,8 @@ struct dpaa2_mac { enum dpmac_link_type if_link_type; struct phylink_pcs *pcs; struct fwnode_handle *fw_node; + + struct phy *serdes_phy; }; bool dpaa2_mac_is_type_fixed(struct fsl_mc_device *dpmac_dev, @@ -45,4 +47,8 @@ void dpaa2_mac_get_strings(u8 *data); void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac, u64 *data); +void dpaa2_mac_start(struct dpaa2_mac *mac); + +void dpaa2_mac_stop(struct dpaa2_mac *mac); + #endif /* DPAA2_MAC_H */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 9a561072aa4a..e4f8f927e223 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -703,8 +703,10 @@ static int dpaa2_switch_port_open(struct net_device *netdev) dpaa2_switch_enable_ctrl_if_napi(ethsw); - if (dpaa2_switch_port_is_type_phy(port_priv)) + if (dpaa2_switch_port_is_type_phy(port_priv)) { phylink_start(port_priv->mac->phylink); + dpaa2_mac_start(port_priv->mac); + } return 0; } @@ -717,6 +719,7 @@ static int dpaa2_switch_port_stop(struct net_device *netdev) if (dpaa2_switch_port_is_type_phy(port_priv)) { phylink_stop(port_priv->mac->phylink); + dpaa2_mac_stop(port_priv->mac); } else { netif_tx_stop_all_queues(netdev); netif_carrier_off(netdev); From patchwork Wed Mar 9 17:27:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12775358 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45E95C433FE for ; Wed, 9 Mar 2022 17:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237135AbiCIR3c (ORCPT ); Wed, 9 Mar 2022 12:29:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237172AbiCIR30 (ORCPT ); Wed, 9 Mar 2022 12:29:26 -0500 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10078.outbound.protection.outlook.com [40.107.1.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17AAB8EB7A; Wed, 9 Mar 2022 09:28:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BBnmYvjyKIsF2f9ao28pPiJIB3hI0xv5LQKlVeTDxp9FFgRgsP1dXbCR6SSJlqzuSq9sVwO2gUFO7yallOyt7pgJ+yL/nANcxH+SQB7a6YOwikIFoh88nZ3o2EdNTzfwGrSBnIHnQcgJuEX4swDl2S8I/dhLBNvFT7VpbhRU1fwpvUBAcD4uS/NSz2yNEudA/A4LMq2fl5agY2bKKio4o69srL/Ubx7Hhf40BPYUf266YeJrVIsUToS9LRSMqxRwJN1bnpfNtN0qbL3iR9ScoAbxGtCudcSPqkFoepRzGpnVnJq9L81K1Kqj6UEptyuCYXyd2SdDQjhpodsMNL8srA== 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=MXX8DLTYy+heR8x5i7HHBQNGgaeAs/W7i31nc5oL6T8=; b=E2VQjgDwoQJLr2i1z8WT3jEu+bcnjMUidFRCaNFJN0ngARvaXhYoz/QKdr4LBBbp41Vp7/iwKz56YlmQZaK2/Ciq9YBCRuUydxHANQjxx/Mou4QYQANh5MGM3dzpZhhcTP3skX8/I+7+ss4U5srKFeZWnNZmKCZE8u3N5WCDpa3QrTHBWK23IPfWJN/f5sPdseD3ZupuVr2ftCUc7uXZHLujm8j4sPmsdDqvnv90Gkaw6q/+nrvQh9xvj4OSKxab8rZOm+3ZEw2mt/7Ts/4IFWxvG05rrxHfSbFMxnqZtlnf4bO/3G8+lZbHJSvaHO/Y2o0cBa54K+bPBBN+7hz35A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MXX8DLTYy+heR8x5i7HHBQNGgaeAs/W7i31nc5oL6T8=; b=hzd5YY/exrVr177409GOzYeqrbOyFWPbUO8OTtIIdzKhLZH+k5yg5g+cOejJvkz9Hs3ZAP9mUIS8sBul/XtWLI6KxK2Ycgn7gaFKpSNxhr9iIgGXtJUjL0/zWD8/EsL1qtw2PIRnCWTpSoseRFf6lyhJuvAvvTcdXxb1HA/4sYk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by PAXPR04MB9422.eurprd04.prod.outlook.com (2603:10a6:102:2b4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.19; Wed, 9 Mar 2022 17:28:16 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 17:28:16 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v2 8/8] arch: arm64: dts: lx2160a: describe the SerDes block #1 Date: Wed, 9 Mar 2022 19:27:48 +0200 Message-Id: <20220309172748.3460862-9-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220309172748.3460862-1-ioana.ciornei@nxp.com> References: <20220309172748.3460862-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM4PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:205:1::27) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d20dfdeb-0280-42a7-46c1-08da01f23218 X-MS-TrafficTypeDiagnostic: PAXPR04MB9422:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vq6evTEMLDuFN8qMzq4PuKJIAVpvFINcuKyQ8JmphfAQKjvRaa/wGAZzcAQ5DYwpYp79TDlJXhVM7WugQ3gDbkuE8kU9w2yh9FWaDvC5Y1nz3erDAA47Dzfh9viGUeOCNb9LBY10aDOEWOoajvBVIJWhLdATBlMI/NIn+oXMz1um6/EZsdZwWR1VHs9s4guLuOrTa6GFq+VzqV5lnqb0QArJuOk6Kd3WpWbADjsFcUxA5R9sWR8VfHLbFBdfCmP/qBWAhjYfo+GA7vdFg0g1qO6HitY2hHxAYjm3UfIg5p1SUej0bPBuDMOBv4R2DxfW8kWvc6SO2lX2tjLHICQFTiBWxr1Cb+mrBxLXqx3ZnbPWiS90RJJWH4cAcpyNq69WhsA+RfCD/X8xpPTd7I4O4oscltNqRoRWf9kNGLwYdXH07EkRQy9pX57d526fDAN+OmAfRNF+J45ESDJIEwzg6N38RQ3ua7fAJW31S5u6sEeYoumCi15tg5X3HYh3ZyugFksNVtH4vKm6kz8gEtS4s4JEuIqXIG9EdXCnOxKzS53uU1jNWmzUteyY280S5MVWFj8MGp3XWvjt1+/jmXbS+eWpkv597ipVtuBOFYcGp+JZWB9WAjLJsaxQXy59xFNIjpooEAhAEl5LVHk/DnfH6RSNGePFcQnz/Q6ZjVFz4/U0HmyJcipDTvI0vOcwsY5HVsADjyVOfn1lsW0ufSBbvMfAgmKTLBudwZZbQkvA9SU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6486002)(8936002)(52116002)(2616005)(6666004)(6512007)(498600001)(6506007)(5660300002)(66946007)(7416002)(36756003)(86362001)(38350700002)(38100700002)(2906002)(1076003)(44832011)(66476007)(66556008)(4326008)(83380400001)(8676002)(186003)(26005)(17413003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Mzc7um0+BZkx4qeB+/Ota3SU8zYpLQDUWMPRHhhrMCbULalYltSKdvrXYjK1UAmldO4ymVRqi5/wplOYL/0eiP6w9At5HstczJVRkr+BIrZ355uVH804aami/yhATMro+bUTbqvuOTR5j1Z+htjy++e8N/CBmHge87a2CmD8EwUkzKzBl/5k1VVZtQmU0vdK9bCSIfR+AYvib9fNnpbapW9x7Fh+gnG79wtU6CnZAOhvciEofFeto9xkKeEtPh1X38bzWE1b10saS7B8xUhdJ3rzDYOUwkf0OzS/sWTRbBUPEGgV1W1i0AqFotdY7M2HeWFxo5eXOaJ+Xiq3Wt3+WjWHcjHbYskr82p4iKRsHtpxY1FuJeLU2YniMr7i2+mlli52S3uQUdXhQnnDQnFvzk19XP/0j3xi9jxALa0AeY4stFtsL5R495HNXg6OcEteZuGOH5a7xqZSWhirf7aErucMGYYKJ7PVODhtxlMgvNdIIys5cXRevaNZdoOq3ThRSUBu1kAlLu6t7jwkerTJqMX13G9h27YvvAs8UCDMtiHi0SjsGoW+C5OsIp/F+P5LWj6s2xR/kAWXeVO5SJiZKJXDyOKMDG6rNJbFd5mdht3i6SkZLqdOHF5805+ib7n+aj7y0loBi9rFKEC0K1wJW6oojOJV/rNb91J5lwomyOtKR/OWMAqqCki4b073r7rY04FFOQZI1zPQIHA83JOBSjwbDyfKVEe20z+W3E4TsH8WyQy7lxfwJ9E91K3E4/qbTpy/7S63riIrQ9pQm1dbri55Yl6bnMPvJapr9igEKLgLrVn0kPOHu2SqiYWCgr0Rlwlxd4uWdhih5iP4PkWJQKC+ZaDnO0OogYUIlaTHBXsGubS/JMp7KIqMkR8Pepl8LEQy2+P+5ASZZfmcppwEMJrFQLidQp5Okbq0LUf1g+jvk8S9uedAaP0oNJEope0Cao1ZNTy9ZrVGYwxDbcut/+sHNedICyPLGOEY2QOwekFON3wIg0HMeBV0hu+CuB6B4FOC9gsWfii1a6NOX/Z5Q5Xifct3PCIBjtqKe0/U6nuXbiKLYPkLEFzcvViqtjFUlDtX5xLtIoBhbHYw4K4TPjGDTdzqXYjZVZB65y9PNWRm2xAovsbrto/RxPFZt0PhJHjGG1ZjBzAPeLQ3KxdfaH5Rmm6Ru5lI5jrS2nHjiX28LTkcfkA7Cu93Uc08F3vbqDXNLDcbqPFJnHcZWs/cQvuW+BcI52ULbI8Xb9Y6jqEFFKRWWLAUnVsB+PV98aPi/gkj4lQK9OCMQhCllrc4ybA1TSP72phn66YP2A8aqwziB+uADN0USyTBV7eLBQxpxl3f8J6Zw7twxPAwOwcz6oCq5DqRmX+nLnwRlVbsvfODf/lDvEwRRNVheb3UQfrbx789cEYh9tIT1LcHhOkQShOXPzOEIkRykiROzNjaCFhr7QjHnevTPTkTigbtYcnSNYzPqv9Fr84SYh5qpKvEpRdL+w+cVD+tFAV/D5Pj6Z+kw4bDZf8EQ/MEqDIbycRZXPFL7xIKEwnKDmD7Ki+vSCHa55viIGeBjm4urTJMSAoQRq5VMOAaPi5X0UHFyy98Zakk4dZy3Y5uaUyutXu0UMDPAUV4lzl7BDFIiyDPYd0= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d20dfdeb-0280-42a7-46c1-08da01f23218 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 17:28:16.2074 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Kls2c83sULA/12wEcpFlAo4G9mixCq8q3tSg4q+HBTThSbtzUDqdKGoyl2fODob8y5Zhjy9nEOMxrKmRkYZRIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9422 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Describe the SerDes block #1 using the generic phys infrastructure. This way, the ethernet nodes can each reference their serdes lanes individually using the 'phys' dts property. Signed-off-by: Ioana Ciornei --- Changes in v2: - none .../freescale/fsl-lx2160a-clearfog-itx.dtsi | 4 ++ .../arm64/boot/dts/freescale/fsl-lx2160a.dtsi | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-itx.dtsi b/arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-itx.dtsi index 17f8e733972a..14a6334adff2 100644 --- a/arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-itx.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-itx.dtsi @@ -63,21 +63,25 @@ sfp3: sfp-3 { &dpmac7 { sfp = <&sfp0>; managed = "in-band-status"; + phys = <&serdes1_lane_d>; }; &dpmac8 { sfp = <&sfp1>; managed = "in-band-status"; + phys = <&serdes1_lane_c>; }; &dpmac9 { sfp = <&sfp2>; managed = "in-band-status"; + phys = <&serdes1_lane_b>; }; &dpmac10 { sfp = <&sfp3>; managed = "in-band-status"; + phys = <&serdes1_lane_a>; }; &emdio2 { diff --git a/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi b/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi index 7032505f5ef3..04f29c086512 100644 --- a/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi @@ -612,6 +612,47 @@ soc { ranges; dma-ranges = <0x0 0x0 0x0 0x0 0x10000 0x00000000>; + serdes_1: serdes_phy@1ea0000 { + compatible = "fsl,lynx-28g"; + reg = <0x00 0x1ea0000 0x0 0x1e30>; + #address-cells = <1>; + #size-cells = <0>; + #phy-cells = <1>; + + serdes1_lane_a: phy@0 { + reg = <0>; + #phy-cells = <0>; + }; + serdes1_lane_b: phy@1 { + reg = <1>; + #phy-cells = <0>; + }; + serdes1_lane_c: phy@2 { + reg = <2>; + #phy-cells = <0>; + }; + serdes1_lane_d: phy@3 { + reg = <3>; + #phy-cells = <0>; + }; + serdes1_lane_e: phy@4 { + reg = <4>; + #phy-cells = <0>; + }; + serdes1_lane_f: phy@5 { + reg = <5>; + #phy-cells = <0>; + }; + serdes1_lane_g: phy@6 { + reg = <6>; + #phy-cells = <0>; + }; + serdes1_lane_h: phy@7 { + reg = <7>; + #phy-cells = <0>; + }; + }; + crypto: crypto@8000000 { compatible = "fsl,sec-v5.0", "fsl,sec-v4.0"; fsl,sec-era = <10>;