From patchwork Thu Mar 10 14:51:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776532 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 51681C433EF for ; Thu, 10 Mar 2022 15:00:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245173AbiCJPBu (ORCPT ); Thu, 10 Mar 2022 10:01:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343806AbiCJO6i (ORCPT ); Thu, 10 Mar 2022 09:58:38 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2047.outbound.protection.outlook.com [40.107.20.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D62533A2; Thu, 10 Mar 2022 06:52:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iWZOv94TxAfSUAZFxyhZLRcIe1ACZPpY6I6prTlvKj/uYW3ug7Lf4Eo6e9jQlQqOuJxqnVjZPlTL+7NxdLFxE40Q6NT3/uB9EOPVO0sPfsrhE4YPhr5zkhlaLh26P7XVmPURkBl4juF2Uw9FHl9+e3irgdVVPI8pHRJ6AompcieUaJIk/86L2U9epWaOsALQbcoA4Qiau6d8C3wljirVmOviwbApjjXrHMC8MAGmwwwSk2QO21vXFSvvZWYEzECkWOMTxuliNdPvyRh1dioeMVn1dXs8IgK2K8lnQ+s1AwP7diO9ZBtqNC/8qFII9UuRR2TFfCu9QZ7GPoM2nlAc7w== 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=cLf61XFmPIkE2wMfF0pI6QxnBe6ivmdH5MRZVDwsmrY=; b=OQAn9N1KGSFhtsZIDroiSg8EM+5wWUKfNQuN+VFP+VilEZZQZASGVV3Zk8imrPMpsi0HFdiOlV4os8QurPMhIRQOWU3+oBb6ODoVQp58B79vZXv3RaGBeL2V06KRUAEJ+ODQgXn9WHm1d8k1ByvZvdVC0NwjxQ5zM6GlCKEgVm+5Fsdw6wYtHSfpLMbE9/jS9osJVu4v4D9Z97J9UTCVo8hQrFG0Qo9tnfoqXXLc0mThyisLEHJMGt5ARezXZs+Wm9B5q0Y4LLHLqaiIu+/r3xY0fTUTQvyDu3qSjsjcph2AF6Vm2cg1QG8kElkmranpzt3s8AA8RrQO7qGkQBNLaQ== 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=cLf61XFmPIkE2wMfF0pI6QxnBe6ivmdH5MRZVDwsmrY=; b=Uh1FX9Qt38qrjK8dnMi6fJljpi/iu8viCmQKwzAhIPtPTMUhtn7VpUSzlD+tGzLKzwG0rvgZdSGxPTwc7Ap2KgbSTahv5SqbLD/nrtUvVgX0MnY6I4fiimnqOhZb4VoGv3KDltLxaba04h33WLgjvbbY5EiNyhAYlzeqw3EtrjE= 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 AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:23 +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; Thu, 10 Mar 2022 14:52:23 +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 v3 1/8] phy: add support for the Layerscape SerDes 28G Date: Thu, 10 Mar 2022 16:51:53 +0200 Message-Id: <20220310145200.3645763-2-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) 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: aa1a7521-c649-454e-2604-08da02a59581 X-MS-TrafficTypeDiagnostic: AM8PR04MB7281: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: GclDpHET229uPe6Ev+D6th3oagxyBXXhOKElrD1DboyAQUv2jK2rJ/fiI0QD5Gd80gp96c6s1w1MdtcCOG17Y+cDhoyEYSewM52CpQ8zKm4yofQYjKaESghqy8azovnKoGzp32f2045KSH3u0b9uL9y0WMffVmo+NITxQibDaoVCx8Bwr0zk9eSLSexPQ7dfE4QvgGiTr3jkdyUqIHcYNX7BWGVOeBPsFEC2HsJC2FSmIJcY9w+1ZPyHkAAXHAjY2Sb4WxOqiD83ZktTUsEeJE77lOCpcSG56btRMYRNugSnRHrIT1tnARe4oz1gxxxp1/qDsD7QfxhtR1eAN+1Oqpxnz4QPsbm7fZGE1WvCldsQuwBmhxjMx86MpS0IaWq4K1Xr8PALpvbsbTkWaQ8izdyZZgHXzt4G/TNghDZxKiN9BhTeTFpTK7mi2Q1zVh/UvSrop+x3+OsReIRthoD9LaFuPJodsgg0fJZvFEUzRWT/JT2Yz2R5bflohy57VECCFaEDdHl1COmlIfLdpvg2xfgL8hAHP9Vxs9peUWu3QUBXPOrz/FbvoTUZaM/O4fONGGzL5m4v2b7rswjkGrsYupIsgnMpjI00JGaWK+FvjZEjk/OGrXArN78OVWHGDbJkk2IbsrH98OczRNvGvKG1H0V6XfkSO4qxMt74qpM/JduzJ2iFTpkvSXwuoCDrG/66HBeGoo5QDSlagx3R0VRAuPy0cBJH/WoffYG/g0odcD5E+odfXoecfWD5WpjRPbeeA+U2LCTPyDDbHeZ9R3NoXRyrIgS70hL1B3Cf6/3XZbU= 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)(1076003)(316002)(66556008)(6486002)(966005)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(30864003)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(83380400001)(7416002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8cgK8FNXQDWJ1bHC7q68MYYHxoHqfgIrWcpVl//Pj1SX8eWasnzL2kajfNLiB10CR5dt2vl2PfRt2HLk0THj88Em6DgzqjTHNqY9yzByCUfH73QwnlnEuoRk16ogXCH1HGJB60EQCuXTqztKh51wJSxhnWNjrYIaabAfLCayGpzEG4hoijGjvviEwDMohB28ngaDNJv6ZJUIV6JqvH5fE5HL3gkuYt3b5LJAivHis6GdV3YyyS2aeHMn39WquDpxJLxUY3PzJPOlJSctjziG774TN2NDeMNN7cLi5xTNaNtevJyUAl5YtzfNhqMPF8mSLULobYq7LsxADN/zYOhdSlK7s4biA23a84DkBMN8I4lDv1++oRDkbMC4V+ymkwKIerOy7CtOadIemIvRWidmaRrB8gnIK5tm5mxoVjs1r47aErHhKNtaGiduoD0Phqd28YpRLs8/skAnKJENb4KnM+WT+Hi7bXSiH2h4ZMFngGZ9eFOiZ+9+Y9ilX7/H0HCBZuzj5GvaYetBY/7veXooNDR9TdzfMdhK8QBnE4PRlmjf+2710/MPpVm2k0yTaJK0GFoO2wYS4MHVGjcy067Hg9sUJuLjmQVxnCDpd+xxkKv9FuODMu3UnAPkdua4u53CnNlibEWqbm4azC33Thjn0MJa5f3YKaQyIVfERfNH4cHt6iIaBzCVyGjWyGpywfjW1xnFeC6oL8JWs/jnnxan8zHkfqXZAZZiYrlidVK/35IBt+hme7NfB4OdcP6Vm+RsQ0DmbIITdAnnsa+facL1a8hTyaLrIiUOFkXodEsDjVovpEQ4ToUg5bLFVKJC1UfDiLp19uxpKWuxnWr+jhE4dZeKCXt2lesM+EaVui+y1yVfABJNQfQLsDIbFNNMitQIOKsRuwYQhT73DEwA1khdNsaNtZBmqtJBRmg5J+6m3xymZbEETSp6DRuCBVWcxwT6a+6ikzc0GgUduoYGKvOuk/ohEDdI6KtIKGmO5DGbcMyovAYCNe0fqHPb7xYvLxo1s7iVOXsUkvhq3VcNhxWWvMvMcIIyB3OIF8j+1j/sSP3iNfNwCkBojWkmSSSwG5rhoH5noAFm/yMXSdJMN7jeOD6ZA87jmFfSTgJoTMUz18Vd9L9VMtGjMPO6+NioZoeBQZoeVL3FeYw0xLRyFBXSMPFV+JCHbeyiQpNd/5IM0SJtxtMkLcygv3zGlv5uwS6ifSz+1wTWuHCEwdGjKoPMz2OWll9rbyPZKNR4Tu0Glx193nU/DX2VrD+fJ5i2589ftQa6dU8V8wNaYlasClVtgJdMjp8oN1L1T1ctKSY1qebwQgs7xOEaKWAiE2PnnMYA3PUSDrzyzXYHhz5VxcL1DlBZ64LSWh4r+iU5fTedfm0VHg+6jvGZj2zudSQ6YNAcu2NVNNLCn1l840tN6Y+PTFBDLOmiwIRJD4hU9wGJ6e3fTfT1P6cVlkcqjl3gGeOTnIduNFlwSX8LSXPfQHk+2+ObPAa/PsDz7wksBYbWgndtc9SYcLKtOqa+2bXTS618x3C/s2mVpt0dx/ep/oGhBxqYW8pJUIMCb1D7wskC7wIVK+AKY9KPNgAjqvqtYGCyJ/MdW/f+1bwtKo0Ek92qmVjFhoR9tehmMXlCg4SJnEA= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa1a7521-c649-454e-2604-08da02a59581 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:23.0911 (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: 6fzU5SrwA9QdxAkdnqJx5PCKkw5JW8RA0PVZ6/DQF5sTkQtKHLHMT78Ht0LeQ73KFOSLyi9IdbNfyjvvjeKEkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 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: - 1/8: add MODULE_LICENSE Changes in v3: - none 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 9c439a10b02f..383c4754096e 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 Thu Mar 10 14:51:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776535 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 4E5EBC433F5 for ; Thu, 10 Mar 2022 15:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245452AbiCJPBz (ORCPT ); Thu, 10 Mar 2022 10:01:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343823AbiCJO6l (ORCPT ); Thu, 10 Mar 2022 09:58:41 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2042.outbound.protection.outlook.com [40.107.20.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AFE096805; Thu, 10 Mar 2022 06:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bpEev455qHMSDDCWecLpwjgeOcm0JiC6u3edK9i7mS9vZqzi2SQ+bceM165RBXHJuYbNaQVAbxKxuICcqolQFndxMwxS5Z4pFHkrcKaRblWpUl5/JTE/XjP+El2hZMrhw4ZVbUb6+RuAqZishs+/GeG/g2L+p58H51r35TJ+oPpc0kzzJqCv+thhm33kqMCAIrnxbUYBlRY5P4+8iJNEvls24rtmwhTttF3sfwNeEp0BYUAFc9gC1r/DpfCeQrwvqWAwTcEIdSDss09/nIJauWmBeIvYHRa/pdYFJiWoRERJFSx42eivW4OWzkkOO6cuJI2mIV2g+bBCrgm22P3New== 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=hJ8c32OgR01WllKOwSrObJuplCpzsU4NwnbyPJ+yDQY=; b=A0w/HWN5K9seZxrvQpeKQHaP8hLHEDJ5pE21E3DPPwOirYHyzYoTvrllgzoVMeQV6zdjWeH2pv+e9LonixYmFOBUVUttfEeKoE+1EeWUBo/kutlqeE9lg68JLdD+Xzc4BKNeVgVCI0SdrgFlVH5LELv2qG1d3MeQandaTlVVDXgcfyn3l3e6YzUoIp3hwfXhdP27jGAT659G1yFtVZs3mpB7629/zxAUrlTKDtIgKPkYycOsSiHrcw6CWkN/cg9B/J5NMNHEijxMTSB5VcMFxClwUtz2pjS4Tob1v6M9ufde9bTKA/3BBlocAv7d+/3RWBHXRUeXnODEmZiwk0NFbA== 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=hJ8c32OgR01WllKOwSrObJuplCpzsU4NwnbyPJ+yDQY=; b=VUIKbSbcB46VAJKQWaL4XHSoP/s/AwVjt/ILqRZxI46V6DqU6VuaObJ4rYWUQQp4wwLpOGhshRlsFVu5lHqI+Kwq6tx5gpE3hLc6XwZbSt9+TZfLSpk7uH//gLB7whHN2vY0zvug9XELv1saUsr5HllhUozIpC+LYNyET3coh3c= 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 AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:24 +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; Thu, 10 Mar 2022 14:52:24 +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 v3 2/8] dt-bindings: phy: add the "fsl,lynx-28g" compatible Date: Thu, 10 Mar 2022 16:51:54 +0200 Message-Id: <20220310145200.3645763-3-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) 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: b3a80f98-ab32-417f-11a0-08da02a5965a X-MS-TrafficTypeDiagnostic: AM8PR04MB7281: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: O0hIIyx6U6U4FuYOicTnFlsg3YTb+Dx6NwlZtS3Y6o1foI9JLHBAfOfyKtaklSBTSlnKA3gW5KmXtdBkc8ZaMNflyku5cW6vTWlewVLCDPxJ02PGGnq9Hp6bXTPFmMT7SowIbmpo2826MqPhHPM6ushYc64lFN8rRB/92pJL1X8Fr8UZ5ffiJUZs3mIMg+8eGbi2vaZ8E6+tle7h86f0yPq1tLwrcVbDiQzOmO8MMtcSE8x6driB3qG9VkPi/RxFh1bH49AWplRnHPbt9cszdWTa6uiymTJwF121lJp1Rn7zBctwvbWDMTS4mvbB4HikO0/D56Ev5sxKO8rWsXVElcgVrkIK0fjuZnxVRCK7KJDFUFnvLUfSvJWYgt4iHQfVitEP0uQW7aO28vNRRBK4MX70tskRfTbjNJabIVHhQ4Llb4Gxg6HRijofcyQlW7DgrktfhvKJNAE/6GRCtKuTqwqvbZoK6VwrIFyvmRbydspCqGMSMdrsX3D1mQ3sjVhiBQAmZjL7DIqVNUsP8EwRPHvNi1lUK4d+pkFowlBuVKnV0y5iT2ITVBVxxqPKCH6Ly9NyvRM24IOG730EFqMdmVLEmApqW9kHLFsMrR+/EXTJHpVnh5w7a+F9SYyqn/qiK0k+mrLacQitkCEj5CmYC+qmOvGqVLPoxEqaBfdUG4kxzYzJW8FrGl6VuoBg0yJWsUBcrXu2LbINdO18ZOHdu99XvlHnA2N2/azWPkgFZzS9EPFg3FaAD0e7CDJNxMhBq+8K2nUHcMt1b0iYPawxZbUa9nsmyu5M49y6h9WNz88KL0oOjVTHcbwZFSgS5azrcfK1gEqhBG7Xi7bRKTzRKQ== 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)(1076003)(316002)(66556008)(6486002)(966005)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(7416002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qUMUPxJn/Qa9VAzwLCGGBN1TrB7gfOUG9gONH9zL2YEM3wIhjJuNHKu/yv8n/G8V14/TVreHfs4rZKxxds/Az226KxD18aDu4ZuLKGfVTASpmYYazWk+zGJ1RVDthm8RJCna6d18fzxa40rvTiHn1E5UaYY+GlbA0GxTrNpgV1FW1Q6BODIxycHueuZoFDeV7msFqAfEN+vs+3SXap1UJ02DuhdQldy7yX8zhyjq/utmVg5IY0LDTk5gL4E5fW2cuf/RziOIgRMvu6TtcqLKXEp+YVk0ORQOXGSpr9EYqZ6x924gqufBH51k/93fcltblxEwELehY7DIVj0OV/Cm68pdps8IdWIt1zUaiKsMiJ4MrUg5Af7HdzkzPoj9y8KydtHOzX2lTAxjNkMMp5M/Faari50qxXNqHrBiQzm7T3L3Gq6116VHmGxoMlkuhnoqVZsqlScujvbyLV4+9xhKeKneDmCz3k01YKQ978HPfLiP+Gr6Ko8oIUgh29OwSDdKWDX3Bz9lLL3ERWiRxTFgprwB02hP9lB3JTrhDsPi6CJZdKUbiqY6TGVx3qeIAzeQ5VNkx2V8Wibdl3+IJaqIu7fAR77ldhOP4eoKWOHia3Pvz6QzVCfUWWgFoPHKtRAXr0QLKQcST4BH+MbWoiant1dWHHdJ2v8MVeb5SBW+CmZnw3uXY5aX8TlzXSGTR+cmdOvNPsgBJ3Wp8kAjWifbhlQBsVb3fthlCXGXXtW6a6G9+kEpLJLDOCGCBe+wPfzIsAaMufqzax7qEl/nPYL5DtJpdv0IpG9kLYn+ZM03CWOIwhEcWJO3WQMfvoTu3Spuj+00ibbNdCnDMhBIHNIzJocG8yOxYx9PPQFdk1H1FD7hWNLsmRz1Bm2QshiS7ErvK1fr7XT7UKLr9S2JsAjfzvAwd/z3xc7Cw9VUSuikWxCeTeXMDlp86hg0sBDF+DODLaliEv21c0kdukYYPU5uv5hzTOOzE/YM7/b1T54g/3nYsccN3K9fnVFIe8RWj8hY96hDP+lsz3/SeMLCaelyMZ92SIzhbFj7Vwo5KOdK6QL3POC2ImHkVVEl8cE7XQbrGL7//OLgIJTI0CIuMrA2t4Silsf7Tk8CMFqGRFtMd0Vkw9LVAuUTXwAkJU8psXYd3ql/C8c42agokFY/j32c+HDWM3fxY3Tzd9M+MJ4FMtfXV2sdz3L3bcBxncA3UPSZh3iO7XhmFDqzjkR5BZfC74uoudsBYKSdrfr7wsQyN9seg8U3KIX0nH+gEZVfddJtnzhhR5PwZyy9J75upsyD879mWyJ7UO3guR4Wm7AHQQSirszU3IUW2ncFP1gCg/eVEYmye9wXfm5yt6/lbdvxh4g5udPfpqrY296w2gPaPsY6jBv2sOIuYzRwMYdHqHrCtkmZYm6f+F+Ay5vPv1KjcgqKKF3F8XDE0jgfBjZEtzBDoAeowCIEhL+13swsGBh4Tz4WB2nKMCpbaMFBpuykZl2wTlLY9PfcWe2SpMtHE4J6V7liHT9IznJNqZZSmxXqI2p0QZ+C5FaZqo4FRDHlXAlbUMqKMbxyDRbxM1iTgYXmWRLI/staUCAwGadQMzCDQsYO/s89ssBw9KNfFIWLy7q9Vx6SbLmwshNmYL8zfMs= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3a80f98-ab32-417f-11a0-08da02a5965a X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:24.3231 (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: 6RHqRS/zurPKxypljJZJ4AyBZGZ5SHzl1h1qW0GRflPwhpmcAVekxpNGVOrlAD61bv1QrLd8mDe8bl5to4NFvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 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 Changes in v3: - 2/8: fix 'make dt_binding_check' errors .../devicetree/bindings/phy/fsl,lynx-28g.yaml | 98 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 99 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..e98339ec83a7 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml @@ -0,0 +1,98 @@ +# 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: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +required: + - compatible + - reg + - "#phy-cells" + - "#address-cells" + - "#size-cells" + +patternProperties: + '^phy@[0-9a-f]$': + type: object + properties: + reg: + description: + Number of the SerDes lane. + minimum: 0 + maximum: 7 + + "#phy-cells": + const: 0 + + additionalProperties: false + +additionalProperties: false + +examples: + - | + soc { + #address-cells = <2>; + #size-cells = <2>; + serdes_1: serdes_phy@1ea0000 { + compatible = "fsl,lynx-28g"; + reg = <0x0 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 383c4754096e..15670690527b 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 Thu Mar 10 14:51:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776536 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 ABABFC433EF for ; Thu, 10 Mar 2022 15:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245473AbiCJPB4 (ORCPT ); Thu, 10 Mar 2022 10:01:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344011AbiCJO66 (ORCPT ); Thu, 10 Mar 2022 09:58:58 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2047.outbound.protection.outlook.com [40.107.20.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC19D17DB87; Thu, 10 Mar 2022 06:52:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KiBkXeINnxGkWlz2bN046TbwafMKit55BBrWP9n39wpgym3ErztldH0oWOcgnHZz7ruaK4ANPMjwmsamhiCahdFS1vfrICXx9mC0GxRakotemAjqXBVhgA9ik2p8ATGaXvoCIJ6CyVsFu87sDc+JOAgtmr+Gsru7+Isqlu2iKQriMXvA5zIzK0P+cTapeLWIhEFBaqcFtXC0k1P3iaKRcqtuPauAjz7VhoVsF2JnhwVxzuiNaa9j7pUmPWGaiy+kjVbIxe4xdfBb+bkEEbLBP/TLf3vbI3S/ZHQgmYTJwZParOd5+yPSRDl0NUOANuLYJer95O5JpaRwdcLH/FvOyw== 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=Pv3gocVvvixSMvX0GbbeV+Q3zExO4FJ3EbUOi3Qh7MQ=; b=IsUR1IGkdErcsWlksSEV5ABRpiRU5YtVtJEPVZOtDeeI/9Xq9fmM0ki5SkOsxHytGMOOqNJrNa61rNvwxE0boZlLFoD9eVS8UQtEvHbQS3M8sBIZEHl8oplsL/EIdB41Ixkjoq1EivbCeTVey6Nic+b7bfM1iex8FewaMWMaT2BjRvQT5ezTi4GJjtM2lE9UBbSv/btNU5GpCiav3ldxLBcsnFG8kgZO+Hr7Ggp7xiWVay6RFnEaMwZHj/CKJL4CT7aIuRpC+KFVD8D6vf+hNw2KY4cweQ/0k4PzkDu/9MPrptrgXSfBxYQFy2AXhOEB38JO3FCHZtFE/Z2sQEdC+Q== 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=Pv3gocVvvixSMvX0GbbeV+Q3zExO4FJ3EbUOi3Qh7MQ=; b=RLWvBCudY7WHxsCcB5HaImvjdn46KbAx+mgC4rE5f2Y68M53vqnk+gmLehGuWwaGTu29eupcpsrhisTBTKCINsd4uq900/URl57x+s5iuQuejKjoPjDDLx7biNmnQxieRAVtxy+orpJp/uD+lpadT1u6lZCNySJTb+2ApTG2wBo= 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 AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:25 +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; Thu, 10 Mar 2022 14:52:25 +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 v3 3/8] dpaa2-mac: add the MC API for retrieving the version Date: Thu, 10 Mar 2022 16:51:55 +0200 Message-Id: <20220310145200.3645763-4-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) 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: 8d9c2968-805f-4015-25b4-08da02a596e9 X-MS-TrafficTypeDiagnostic: AM8PR04MB7281: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: BmmCDpJxy8WH38OBfDbmgOxLRvzQCN9XvHCV/oVSJSSc2QdPTdtXO2GgY5Dlx2po3gAm1AxfrfQ0s8UOvRJLyNUQnmezFb6jIg04+PfmLIdOjvyWaNpP4y866U/uO1RKZE76zZojiha8tP7wDc3QrSVKqqkTbcLowdEyhJDRu1mUmRIZVIxkhaK4RM37iQORNTGNlk5q+8pE3wZdwKgM4EuIPJjKkBwwD4BT4fHIksZwRksnsj+DnsOUJF6ZdoxF4ZDHt273MbwXWh8yr7K+MB52bDM5hm4j48xXurUZPcg2Rcw86XuJ67skZK1LFJG/xpPtkzWgDugzul+4mAmFAUbLD3N2Kj0XrFCOgli98lNBsjhHIQFQWh+pVuNz09M55j9ZR5fR1/JCMWpkOy8qoiQ3aLVK8ETRLxSwFsO2H9NhvbL+ok3HcDnwwVUULVvG0HYTZm8YaJTEFiwfnA3Ewbn30ANYfr9dlrg+gWh+c4AmG3mI1AzrsUBhCeZn9fmfTJVZd7aVtH3VEnrrXBfKwB1qDrEl4WmpAd3isWgIqIRSYzPDI9Kh/MsqGMQpZ4GkX9mEAShSioevAAwe9E3m1nVOqyAo7r32UtvkrRH5nng49fS4hGzpEMXMmMN8iHrBwTt2brNF7woTdLOYl5of5stF8xoeT00c2HAf1gtCCYR7BWfIHGJt9Wd5Hg/QnCAT+EdGR7wqCi+6zBjsbWM5dQ== 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)(1076003)(316002)(66556008)(6486002)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(83380400001)(7416002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1UJafzpLbLhfQBiEsw4YNADFrTc7d3mUMaAlPFGgKqJtAynz7cXmeJHuFjKgtXBHjjCi/OAqnW3VRlFZ91GAwVUjj9d5GUY1tDqokAqxkqwqM32OHHMoNc3uo972lFkuyrfWomp2mvt9xeyUcvHUit11kGP88ko9FpBQEbykqW+8QoiB3GXTrjJUSdw+bkUruzRrrOiIMLFKJRj0ji+XFNzf9X1PhhLHHLXOEbC7j1aC1lY4P07qKr+KNVBH27gsizOvg6hbAfp23HYWe5vMh5m19K3kp0xLqBCE5qM4AslNhpZ1RoiTFHgqeRC7kNTmhR9KbKvMU4qCaYZiBdCe1GWWA/EQ0BQX9qsM+gUaUPA0E3C22q6WYAy8C2L+DAU1tDdPvHXTFqKAe1VErZOFLQMPEMdP43psJbCZUHZwQom1rla6bESNHiDK7M5V2p/O3IfZJiovUvo9KGeJ0tTPY1PnFv5ddOnidIuiY0EdY+u0VGrfJuEaM/uiJC9bqDwd2gRuwZ44mrJRNJgdMA5+t+osd9cyUA9GwbtTX3VVmaEzmBEsLMW2j+RXlbI6BnspuZam4hfUK1fW/RNGsfMss7ZfvKia9GZwP3xGlLSmHJqHKf7el0OaMEZnni/12br538ygqndvbLKjfZCK0tZko+tWRNoLwZbLgN3qHegaz4YPW7BVDBFGCazZ87kS1gjr+CQ0ylcbBND+DGigGQq5ZYqeuHOTRrBZrpR+EZW+84HqlPeeiz3dvCGzbqX0WahlYILaV/vEMMvBdZZRGpY2S2mpyn005zQTd/fMkDDkvac/KFkUL1OTIRzQbed0e1Ia+bNSnQmRFzPFVRuRVBTlhkLP5wUePrXV6PQgIrJHZ1Ac+CpK3F/KjRrvb/cwnY0hYrAm5oDvPamqkaDjiitM2mDuKNjjNfG9nSxgu9mKUYecSV5TFiVbrptZUvD3oVjOroxLPSFcEnYJb4QqnuFwlxeTg6TACBLAJL96td6khzJsUHMdD+uYj94fToSqWYTnxBsaiSV9YaMTl6JR0xx4s93RJLmjFYnqMPvLzDyeBFf4dHjQL/ti84wKiW1XZt+xcOaB0MKQgEfqtgU3hKZA/JvkwA3u87gZGtF+uxf3XE9IRaiLqsagTYBSc2ZA6bAJFSjQqx5rvSkCypnf1Ir0Jcx1m8Utc9ReThJc4gsgaz5k4WWLB2bw+8ZZEcL5oTiLpiy/Ljamd/w9Eti8e8Wg6/tYkxiBMpMQ3cSiZo22ZDe1DnPbQqYkejrdLPrH3rct5kPwm4nF8lmrhf6Ou0MWrx128wirn1D6vEeMMsqmqkiTpv2uwx+HQe6BzV/MPu6EceEbhso8QOMptskArPjZFyiMiM4YK6jxssaihntt1zaQlmo/LGz09l/18Oo6fpDBw5YPEZKj+wBLwiKCJBfrHmFd5bE8kkBInmR1cgv5FK3aQcwE0LdlyqBbkO1Bv7IbFWE86dIRMUnYcdMsSvlxMvUrtiWMpHEb8JAwcAnwUIqmu4YMlrMOluBARRziXvcYZuUaMI298SJAHtQxnZ4fOwDhTuOPm1pBj1/LTPFOykFQdA89232cuOr1/LU7uDq/azzC4wV7YWXOrDLns8BmgqU05jyvzuOuPG61FfPndfI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d9c2968-805f-4015-25b4-08da02a596e9 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:25.2630 (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: qMIMPIP7M3EszXb7uOx6TPvaieVMEo8UNA4tERauyvgYSFpd9aGPu40dJKAEAqRKWM8R+QSOJxq6i+bSPx1e/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 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 Changes in v3: - 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 Thu Mar 10 14:51:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776528 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 32C67C433FE for ; Thu, 10 Mar 2022 15:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244598AbiCJPBm (ORCPT ); Thu, 10 Mar 2022 10:01:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344079AbiCJO7P (ORCPT ); Thu, 10 Mar 2022 09:59:15 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2042.outbound.protection.outlook.com [40.107.20.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E68170D4E; Thu, 10 Mar 2022 06:52:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZz15AwR2KkCmTcn9J5CxLfjV6lBahYIFDCfHA+D0ctoLqTAueHeSV9FevvdnW9gbcwN+kVi2vgnhl85zj3zZsYy6dpqHC9HYroop9mxvrlFOXNJlR0fWfd21nrzgTdkjfJdeFM3JP175jN+CcqjMsv0nWeqd1ZhC4vwd25eAKDPZn0751qpvkBKW8p4mHwu0RzuSG++Mihta+fOiOCq/+wifMJFaoTVAioVP4ZqIcVp5vyh1TdgvUq4hNrMUpz/CNfcCSmzOiklhndwIE+WpaALzGpEvoaLAiMqsneyVjmQRtDR7/MTKKgmZYzFj36eEB18u6RjPHDBj9xiMLgL6Q== 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=/fBIJvHMWv4r9AMpMsxzoKC4fiaQUORo0wrCWFuU60A=; b=Zvqen0DzyFxhlrSxLFNshR0mrs4d5BQygJVzkC4L8m21Sv6PPn3/R3zvxcwY8NiugJFZZg3O6vO9f8d+znEkhzHznZ2ncld5pD7pMrkc83Dljm77zaqZwwM/EoShPumWbg6VufzvR/Aa0pbORkURN6K3XN6ZH+r/p+UEiCevO2JGwNpFGfFIpy+LGEAXNDYDdfULItYRkFNAPp9RQDkqyVhCRkE+KDKAkfoUqq/AWtZccRSg7MooMogXH/dbx7VFtFbGXvrlLnIqyCiAcxUVY57eZx7BTkBGZdHk3UzsMi8jfCSTzv5oJ2Kz0jfRHhxJujWspR08VCV9wIFFXB/RRA== 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=/fBIJvHMWv4r9AMpMsxzoKC4fiaQUORo0wrCWFuU60A=; b=YSf8hjuJBVstMDGHku5XVaB5MOuUiwnJ0WSHm5EhCU2gcI4/8DKD/tkjF1FM5tOnakQNycSA9VeXX4oKU87YrlupAh4uvTbstsPZm9Jb7xeDC2BfVC8wqHOQul5rxy2VTK/D9EN8wtGxVlrLt/0yLy05O5LMRzPgc/YLpt7mg1o= 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 AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:26 +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; Thu, 10 Mar 2022 14:52:26 +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 v3 4/8] dpaa2-mac: add the MC API for reconfiguring the protocol Date: Thu, 10 Mar 2022 16:51:56 +0200 Message-Id: <20220310145200.3645763-5-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) 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: f2bbc2e1-4dae-4fa1-7680-08da02a597a5 X-MS-TrafficTypeDiagnostic: AM8PR04MB7281: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: ILXEwS7Ms3FppEgwPjOrdgzJ24ifBqv9llO9647VJrLfpo7YFl829gRuhzhy1oHR01xQt7ZAxgjTrDSVWvnR1uCLMp7JOcPDAhHEu9NUCH1jY2fU94n6tqcEdoisB/3Rj6bEP5tbFtTqH9w+BoDmHv0Dn+TM3NV4S+mTmTeaaXapJX/xwg6kKr70wtTOVpdxQkD3ugOGFUE1PwpfE0GnWkHeaWrLeVsUn7oJsHewIFiBPJjLUOgh/leZYE3Zr5SSms+kyZYQJyI5Dw5uccjfyC1VxJ/Gzu5kYej2QCBuC6b83fhbVKZJSFEmnMXA2Hj2dP+W9o0FfGuzLQDzDiAcRRDJocXpyCuu0en2EzeDwIqJP+yTTMaHHod3T7WLnYNlyAPiv3UUx0WFZ77cCbqcbT+gDmVWjM0azAB58lREP07t4pVZy7hI0bHYYvsdeoSp8WgX//HuNwYavs2N46Z/pYiXXIkko261LoPaB84Zh8mL39zs6iby2+oNPzHixxj/XeodIsFTrPUwGhjaE42sPISfyhP61uXRDTE046wyy3BA+hvS5WMmA2yYt//RTK5ldQB9zGUmeE5sZ9+PMfUF75bBeuBTP8RoCWj4KyH8/+L5ZbBO2AUkERp7vvosoAfbmz8X3jvw+62NO7yXfNUOmMnQsn4I+qJe/9qEeocYgcCowGGNe18DNz6punVX9e/IzHJJuvhePC7gR0JI0jWdNg== 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)(1076003)(316002)(66556008)(6486002)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(83380400001)(7416002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: udsZFuCqIuKPvIK+RQUET2Iuzwim/juwRiTeTk9ruSPazyMjQKHzAVGEADrfoCcvla0VLaTAT1KxdtRxGK9Kbo+rvehfsZIa39KS+PH4otVTzJG17O4xVW5HNVzKNL7FJwPI5sobZZ2spXWe1K+OPVnIPnBgEnmwyhKxcj/TRVWJh+T227Yt5kvg/oylVQfjM4s8JN8SkYwbz6BNx1jqv/vhYyFr+Kih1drpN6psQ7jGMna5r8UY+FIxfQT1nEDJtXQgRisIXMLjBrgO2ypUN09tFYfA+AOcJz+RfqnNGmLnOjWl9dzfOmx0ArSaqKMt0zFG1zzSzMT0i+ILGF4pFPzOqfOoHBHG/efNLNguEnnCyU+z8LDuC7e2qtcodtgCW9pSAkAemkVI1whTrrmllmNyBMAtUIdFPQOp4hxc7VwKPDx5eLeQ7LSrrcj94pBL++Sbx5LlucI/hSTv+h7vjxk+DLa+BGvi6xF0UbptCfYTXW9aI1jp0ZSUmi9xAGK9d51DrfFl+p5js2x8xAyuF0B3JD49oY/5J2Z3njcJPenC5WQrm2Xal+2uuck4YXVEdMxg9pcMu9xpXp43YIV3AptzfhDpovOg5D0HbXI7Jh3rl3UZlSpP8u9UF31KCa8VSuugesAZ5iFeDCSHvOERCzDSFv/vFwzt+1nyu04fPAnVy1X6rmAMSDJzYM18ZZRerIBd5fPedSkzZGCNKzNG6jITEc8FguAQbh/tXV37pUkmf59QgAl65N1RUgyhoy0PffXnqNRNQMVxnbHXrhlmoKtwxowmZI9DZrc3tKILY8kMZcapvRI8TVgwiTNcL96sj5ey3VDkjELYUFJNvxrCQBJCxXQVIZ2ETrT+vr4Db94PvmL0IoTpS9Gb2MK760KdKvxeKkt3BpMRG2yjkVBVsFZrSkc4c5LI5lNmJLc/ivATHryqAPiQbbUPDZ/GFh6T5lsN8gZev4DZaKxepf/Wu50f7YWi4e1taACjTrHZe24aXfd8D2HX3yrVNMIwPjyoRuCZibHYKzge0/cK8UKwuBHTjCzAGm3LQtEny54OLePfP8D3ANMQ25rQez5mv+Nc3FwpFU/dTxPWObPRP1UfxjEPsgfveT3M4rzAdsJ1Q0gdkia15hbUEUambzL8whLhOwyrr+w7EGHuAzDeHAtD7GkcZrNq1iEDi2S4D5bN1519Hu0LGqdLyiR5UpVav/fd5lty1YqqQcoI1IDe087FukJ2omArWsI4uUT84SoSWVPHVadynD0/82N8Po0bAsjl035jgiEt20U+Tt7lOowszbzS1+2kP5cBQNBJLTf7w1BG9b4R2l1qnddUb+0iWpvUdPi1vlWfSUdWB2Ytbi9QR/HbfKvpw1MsgMM+ZjPt3DE9kquQ4bFdPiig1OCYNkDI1eXkTPNnlZTR5IG8qKcogngGmCY5noirniYSnEC3neI52k1EvotUlVCg3WlkUDd8pHG6gflsnxkdN8Urq5tAcUJ0UPB5DlrbgfqexNj+0ts+q/fpyGARZ+QZ1NI4dFtshvX73Wvtp8T78Qb/FTIgQpsfEniGWdObeNLJiLq+iJB0qN7/ZKCtXDBen1pxmnFZTVDASGNY6d/hblTfC1PhjjBgioyvz5VfSvnVaU7wm9I= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2bbc2e1-4dae-4fa1-7680-08da02a597a5 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:26.4828 (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: aFsbPxw5DOU6DlnOF9C7jsVkiP4U7dDG4SOMww46BHDtz1aFHQJqwoHCYPTuLKgPt2dGF1JyctcjGeh9nU1f6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 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 Changes in v3: - 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 Thu Mar 10 14:51:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776531 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 39104C433FE for ; Thu, 10 Mar 2022 15:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242349AbiCJPBr (ORCPT ); Thu, 10 Mar 2022 10:01:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344165AbiCJO73 (ORCPT ); Thu, 10 Mar 2022 09:59:29 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2047.outbound.protection.outlook.com [40.107.20.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F311418A79E; Thu, 10 Mar 2022 06:52:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gEcN8gPHU/T+6nROK9GDKU4DcsJNZhWl23gS7ikZTKVbjbh5wcONoc7U6AUX/v01zhcLLH23pF/KP+rggcINZokmVAFrmE0ugS0a5ML6BjA1l99OYdy2LwY/77O4znbpocToSp25m/1rSIBTZ0z+uysIKI+lO3GeO+gj+EwP7TsHQ7ha0kzfh/kQDvnZfNqVSDTAq33ugVuZKkk+tHdYnuT1DnLzIcjl6SSiUyrUdKrzLxCAACnBE+Y3iIszBJ0jtTHhRUibfmraDSAxW0H8lBbA4G+FhOcFL7dSoSsGnAh0cnEWGQkSnmtuH3qOM63t7+tcZJUniLGX50rCUN/7Ow== 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=v/kuhjtUjH2ZO4JOH3JCNYaNvISinxJ0qkoklccG6Ow=; b=EJpb8dUMU6CdvxP0IQaXjWiPtzsrALSgfnE/WDbaaNS1IdaxCATHoWgAwPOAUXvq4JIEHm4TsxF6YvSoUo8lYaXFCW0oYzWq44zCgPO7WFFN6nfODXQnuQGHqYVIK804xyRFuKnklGEwiSIampn9y1NTDBD/ZdsG9WF0mU71lYWxy1BBeQv1WoX5oU1pvdBpIfNfneU4Odcjyh33hr9lp4oBmEVhsf9kYw19EZmlFtNg7g2buMsMV3nK2SXjKNoj1TOf1opqkDfantodxqjZtTMohX/kuXAHPOk+m2tvwQeIQIikSEUscAdTVPAy/Tb+4/uWIfr2CY+TW5M8KWs1CA== 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=v/kuhjtUjH2ZO4JOH3JCNYaNvISinxJ0qkoklccG6Ow=; b=B7dJToPYRy6f+27EcVqwmdyKnz7bQXfvfYncLqH45yriCQO7kqTJkM5pOzYxST02EqU1GlrHo3oZym6B17Hrvl36WwqwAwEIA9THgUl7nu826TxzZ+mAstg0/x5voLLzFAatLOFaMF+8zSxvFo2/v6A0vzFH1suCrEe/7smKDVI= 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 AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:28 +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; Thu, 10 Mar 2022 14:52:28 +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 v3 5/8] dpaa2-mac: retrieve API version and detect features Date: Thu, 10 Mar 2022 16:51:57 +0200 Message-Id: <20220310145200.3645763-6-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) 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: e27233b6-1c4c-4b28-fb52-08da02a59861 X-MS-TrafficTypeDiagnostic: AM8PR04MB7281: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: vVrzzZyvz2IxBTzTDrzUoYGFYV3N6FFzrBGn8LnS2VST192zUL1t78WkSU5pvfaIu6Td5unvWjdFUiRzhyKevJugD9GAjZ4qHpDC/bhKxao9x7DlKo3OGKEPVlQq9Rt6RI3sNLc253f+XrXmL+RTixiD/qusQmKMaEkF3SCSzM7rieen+mxpddZ+GQtxNjw9dkaU5FKueqTjdU4PyY3MTAwrEadvwFnXMqI9R8VuYwbM8CGe24SYS1V1lPOtTyWFmUP2jVO6bHkU2bfSE9kRJHh427xAdqrnBgh7yzHE/HRZxI3Dq+1rKTmG/4Ta2ob7bVfq9PPlwA3FQv3TWsXM8VaNXA+d2GieajzsoLTqlqKGHdiOaJ1RkcDSxNY0+O+wDK0Ms8MvLXhKMppNm1e1U0YwTR6163X3BCwu0pJ9Y1xk9dGRP6kiVRIgAo4es9pIO8eUqLINhtYAC0iEUvevPSLU/tex2n4vFCqm/injeG5+KMIKvcoB7ts/YflY97BU4uyxd67cxbFF7ewmL2YnSeZFS4W8VPrA9Hvp0KkeSMYj1QfuO9SPRadsVS9QuIdY/IwULFxzSz9ipi36VMkXlJ7cCUKRQk62Ej/P5Rs2asOuoXwc/GyxMS/tId+WZ6b9bKURDpTBzekpGBOXJq8zKRsE5Qhi7eXYEYy7HAkLQyESIgVoMb/P5uFKdttoCsNXnKbmGkdDwaCF01SbnUTDZA== 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)(1076003)(316002)(66556008)(6486002)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(83380400001)(7416002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FIX0vCHWZFprexf7nItfpKzEaW67fQ/ciU3uVuk1LFZd2bMvBObhDQ7AUTmRbkORKL33fUEr2Sv6XzaJDFWKs1zBPx2bVXuQNyCiL5CtoCWk4kUeijG2DfDDXVUz7S9ZvTG5al/IZc3GA+jYQoM3r/HUhIpVzx2Jg5QBazdfByQ0MZTCmIRCeM3p3gQ69MPdKaIZO7dYrKiEomqI3RPkDyF4UcfUBzdCK0p7q5YF6sRt//nwHzqxV8RzbkInqSPDtUUTr62d7P9uM3/QAUGqQ5eXQefbQtyJYKgQemSxRZzBDJVmAquWPc4w9e99uYZ4sWEks39njT3yTjRaQkmbUPTKAPeew6ttguu1lezLWQMlvbBVkdwvGGL1ozq5/9NrzqaL9OTaGFn6gV7SuiH3nJexqCVOIoC67lWHeu3x+Dfwk+hTkAhz+SxzmnkCYZPCIPrNmv3WPS/rGqSM1OJFcZJ+9aTwFpKP9EUyzAiiyCkbQjDjRaIPT03Ea9mq3nUECvo+4Y0udHiX6cB3byd1P5xlmzbNwbbtv0JzC4Vkm5nyCTcP7v/IZZS1oGNNO2qaWNNfBaB/phs6ukxGNOCWvSU3zpmhMe5YXThvSPh2Pv7hGY+gfle0FqSyYqmMXT6eoG7jFf0fSQqkSefqmw9f1BPJrJQ2rKsQyDtULBagaoT08FtC0ekB71rzGY2KqHEwUTG0ZDtgchs+0HhUZLkR4kHVb1DgHpVAhcrFkAx7a1V6Z4cp7B862+fgefE6tFc8ddhgpAzrbzG+tJFPuTmT98m83BYQRi6QUoZT3r8zHbrlN0wyjIKmLO0ecPSD8PhfQwhW8EzvTkw1C4TS/fWwWdGbjODKjGFg8bpJ4+1G/1r0wvWcCqp6nqxH1xqy52ZbD0IsdwbzeovXT729JaUxsLzJm13Kx+lo1B9cgR8pgJpkE1PEk4DEBlFP00IXIB4jTabecRh62amebjoFxO0PcqSAawiht/06WJa1BW62m8TxKYvTMW/uF16WJzt3iH0KjERSZr5nXamR4HKNy4Bm9h3kZ8RYqGQ7AM9VBaM50eDPUQxuwbiNt9ycGbjMbrtJ+fZX6LKzR2HDvAXvau+QwLDZoR2LQC+k0j9chUwlq2XUAZTUZJS+QJ3M4s3fJUJqfDQtKf0kp+7uwi83Me7zjJR9CjsA3FfzCA4cSZUawpGPMAdM7OvZmGoDUyqupJz+IDDQ4lxwxl1Y+EAgThpfs48O6SFpbIolzNET/rQhrX47btE08Vvi3n8VHvtOR3+QDk89lIXKcmU0DhtA+j27zxV/VYjp24RhS+Th22NNO9c0K7H743cF4KTh9JlndPu8pYunqxi/vBFl0wx/ZQYk0MOux09po82t3nTw1lM5Lp+HxYU641JVPht05FXa7+tKC4AWdCsp30biEOrM4ruI31ldYF47tN194fSqD04dyj4Xc8yJSqpEgqpmqE3OM3Ni42wJ58kCnxtu9nG3ahzcym7PAK/WnaBmEm8A0Cw7bETHtARhduSRhlwO6F8qQzeTHPTV6VcjAPf3Vwzibzd7JZSdoMbrfr7D5E7auv0FBgFZL7FkTwA3WEi7umEtgFIba+m7tJwHLkOYeQ2GVMVZrnEgaVUb4WWxZvFsah54Qxo= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e27233b6-1c4c-4b28-fb52-08da02a59861 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:28.0138 (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: z4vB7idOX+OS6FdraaZgBMefG7qaTTYTvOgsSlXa+Boqms7arCGKD2r+npy3jorTYX6Hvyy/0X0+YdIBiO7KUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 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 Changes in v3: - 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 Thu Mar 10 14:51:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776534 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 6C807C433EF for ; Thu, 10 Mar 2022 15:00:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245416AbiCJPBx (ORCPT ); Thu, 10 Mar 2022 10:01:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344272AbiCJO7v (ORCPT ); Thu, 10 Mar 2022 09:59:51 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2042.outbound.protection.outlook.com [40.107.20.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9410518C7AA; Thu, 10 Mar 2022 06:53:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xin5XIt51uSxTznh8RxW+XXYZMqiav8KpVWWVr9bf808K7lFVt0J5h2uajZsNfZ2i+wXpV54Sk18FmVZ0LQF+QmHxzcmCtl1nDJrl004NpOnAVxedoa5/+RFKXqPT/PTxGWbtqsrL9N0cbgJghlo0DYzSf+B6xfVj87MjMGkmQCBdTIOk09HwnWsoVJHHH7zNpAx8AKfGBbU3CR6ijmTzdEAVP5XmuVVR9ylqAl+xBG3hUExDPJRiMKSwESDiBgV3xdgv0mEjR1kvCGQZXPMV7w8bnp6K1f8f+twZz091BkU5dWtbl3jnLEdU0Bgm1p2vq8/jTILafk2hmz9V8aQbQ== 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=CZvJ8NS+z0fnddGHLhik/zOI4Em+fe5A5hGRXXFQCvQ=; b=joqTxncoi9Sp16vs1Tffb7s8Mj+y/XzZrfXVsFSJYhAQIhMyEOdMmUECu4Si3LuKp4v2dIZ2zIb/Tti9WIxN0GYppfXoWso3VUuw3xwFRL87sHhAbfbAjWFcOOlZAJrKEIYN4YsKDD0kkT+Y7krFoK4IFzBxJ43CwFviCyYG1yllRsmHFFkl3dPNM9WNt9M/WZ6KkdIsZ8ZVHQzhUYxpUNssbk6l1Y1zpH+417SKwfqjHfChO0IPSRLUoz2O7x96NaWkoG5W9PTmIwovvfop1fSb1/GlMK0bsaL0PZuFRD6bwjh1mACG6s9vqdnwvg3SPdqiwMmZKtftj3yji56Zjw== 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=CZvJ8NS+z0fnddGHLhik/zOI4Em+fe5A5hGRXXFQCvQ=; b=YaHqiR8oZcaDYDQvQkgHOwUPUdL3mjGOmtHVVYxzzlCpakQba7GJnW+sf44b10LYzh8AqNAVMo1gaGWHpdJHk8z02PoyMDrlcrXGIo+5dFQA8RBCQ86gw6LlBR2TfRNItaTWUQi5edXB723zwCHnGu1eVRLhcXwdIwLwqHQ38Z0= 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 AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:29 +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; Thu, 10 Mar 2022 14:52:29 +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 v3 6/8] dpaa2-mac: move setting up supported_interfaces into a function Date: Thu, 10 Mar 2022 16:51:58 +0200 Message-Id: <20220310145200.3645763-7-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) 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: 92c1e1f5-2a04-4d8a-290c-08da02a5994e X-MS-TrafficTypeDiagnostic: AM8PR04MB7281: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: JeIEkVrotiBQjntYsuuGoRMkMaGMWW4y2cjMo2IuzpV61zJBb/f8NHBAAogA4s2wesLBfCkC21kpQPaSSg7xTlKDuqCBTc8vP5GOduBbxfVpRcpHVhpgsRTukf8vxXI1UuOPBrCVlFO1oIh6/wKbKk/O6JUSck4VPUm72HUYd/svYWUPn1kMZrkt9oG/rbPGs9NE/u5hnKO7ggH7gO9jR4pXNOOJssBkEDd4b/3mwzZp/XrhGEJxblptOubp/YOQ9Tj373dJxFnUJhysTTL1GJRgtc8/HT6ZWI/esA8fcqcz+9WbszR7y5qi6kjBpnctT6vAuxRcHG9DR1PxxK1WyQW0h9xw+lLmErD9NEGE6ORHpGAb9PJDxbosVWnEz1gfIgikccZqdIZ5tGazQoXkBCsOfokVS6iQJ9p/e/8p2ArPHoWh0T0gYIxfq8odp1ST4v+B4Ckm/lQiMmvCtxu+2oGoIiug4aueiJXaDooxWF4ec2ub/B5w7Y2PGSanLJzWMaeUwXyVcm9Zpp3XJ7/q7JpV1CGODDa1q5QXeEdJNx9bXZh1riHciYnYe1UdGu41Q+MwbId1vxfA5f6q5tES2GY9+8YU90YAPujyfu47PhPXTfAGBtC9fgbAfZE36y3JlfX00UeYc8EMtVGEJ7vnaMNXsklKeccLcadJVZFsy4eglJU0QNriKWz56vNOTSJokbRMEZzuY8AP2LTEb2fRqg== 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)(1076003)(316002)(66556008)(6486002)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(83380400001)(7416002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5cmmRjpAxOcOzxcK7wF4bvvHbI5LiljHRG8QL5H5AFYmnqCLhnwQSiqcrZGT5wJDUPLTZh8pqMOTuvsA30WHhbp2HVvduevqGxTJ01/THozLMb4IoDB5AwOpCm98xFn/ug4uO4LWWgWicZvbAlstI2Icv6o+pIAHNn2rKu3W+BJpB6zOJrm09X1+awAebB8fFrRDhhc+qgq+InjjjEuaeef7Qjc4r/UiXUh4GmkTxKTk4UdLA3aMrqr0BRMfT1K/NS8rKsMw8bbTARj+sGHpGJZivVhDsqHG6mYGHCyWUCewwY9fxe2bAek1xFvUyy4LCTU6LxpgKUWn2eDCNLM0T6V+FrbotdCvK9GoAhBngst4GOgM2d1m2AJxTgE3cHSnxKZ/o0u2Vr4krgEjXzK7/ykrHJ3bD0IGYqUaSw/S5VtmjbTmS5g6xFPMFv+sd6uqJl4LGOEjKuKiUcsbgs3IsR3n1sxn7hDp+KPc+sdAbU44JIMqTYaoMsGVrGrshx9l+4JNE5vYXhISbFrtaveRd++7yKTIziJffDt7IoDM7gBVY6i7y0y24DD+OLnC1G9JGlSg4CHv+/WsgBrX5d2llVJ/VmOXhoRYZ1FBi7px7sWJrlbo6QEGGXkJplveDng11bqkBaWaKrp9SSVfwBecXCERzUBrdxRNqDxhux/QPYsq0eOyPlq00pme7VsLvgvzn+Z1g5gRBUGarRXmfwtz9Z14pvJIp8SR8IHdjyAq8NFf+C5m+3nA9CD99L8BifG1PRuaKV2mGcSttIyFUc1HvxlMkGKdWRtgbF0peKmWHxJNG62YGwpzAhF/bnbcsImDlGNB53+JrqulHeiEhohPlgWehw3ZWSYt5ZCJT8QsAilMzavBeNBiE/zF0pwLVBdm+mko5ThdixgNMLJLxajOKOEiudSw15BZz64e0nBseIPbOyBw9rREjDEqcnkIh7lUh0jR1XUxi0Oj18LFu3AQOt3yfSq6HlV8dU8pLy9BtynW3NT1SI/39AVWePgNAMb7Mx5iUCH68ShkP46B62PYA/EEwpUaNLjnnwzcR2DXcjgtUbDJexh9+YZihIqaxvK10V1eo+Uyl9km8s5jCd8XC3oiSgs3sAHB0kYZQ4juTgASjjh+F7x6FXvRY5f7ey74O4rFL/nm7reCy5n+D2PmloZm11SicTsCTjOyJB24zZ2xghh2Qoiwv8FewDzX2esJbse5ldtRrHZvL+ZUiT3/JPIHt2MH+sM7En7o1Wwuj3Q8ET0+vYO9g6FddAIvqsitO0de8NmMIWXe1M94xqaPR83d9CW1qKn4881P+aGwnnQaqAe0wzMPnA8mMnx8MIgLGCiqkhpIWUdSwg95eIdD7g/prLwZ/1cEaeo+OpD+cd89DaaEL4LuETHE7dgCuveteJjPlbc6RsGGt6mvcsSouzetht+O+gUXNRwJSq96BjfUjlCftwybiHDyMpTDnwF+1il9Cr7lUQ7D+QFSP0goNbM916147BAlz1aEtU33cZe8LWhxZrmYB7ZHoFLntLm4Fs7EF+LBFkuZyaEtWe5kOxlfOBeY/JuuMmwt1ZXCoI/wCZYCur3OkUcIk5NDQAfwOouatMleiPUu3AaK2PZKmJP401r61fqMDhBfJnXhFpw= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92c1e1f5-2a04-4d8a-290c-08da02a5994e X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:29.2557 (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: 5TtAPpNWvO44OtsRC9zqU95FXeaP/W0IDe8F0Fl+N3RFiWP3b65pJo+b25G5VtuFIqSb7oEH2KbkTHnXnWblfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 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 Changes in v3: - 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 Thu Mar 10 14:51:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776530 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 714C5C4167D for ; Thu, 10 Mar 2022 15:00:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244824AbiCJPBo (ORCPT ); Thu, 10 Mar 2022 10:01:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344423AbiCJPAS (ORCPT ); Thu, 10 Mar 2022 10:00:18 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2047.outbound.protection.outlook.com [40.107.20.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7523318CC21; Thu, 10 Mar 2022 06:53:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hIMqhczNNNZEhZ3e0WArjCd5zNDSmQZ8Oj04mXTSRe1Ot3SLmsoC9Y7KWYs6t1IZajJzEGaM08vkw9ZHVBvynEa85TrRvxk9ySLZB9l0ccTd+czE1gJKxovoS3xhnit6qKFsdiMgEDGyh+smAwfaeUoOugWeQGpm9DBQkXTxkktK448ex38QM5TjCGK/ddMq73ZQFcJCC+ro3kBbepgWtzVbUpPiGsCKNtvAHewiunrsRHZjzM42Ea8uvq11ZmDr8zHAgauL1nFRVKuGuKimIQ6uErD/vJ46X1u6vMvwgm8oRFfHoGsbPc+8891wgxF3PWDYWC5J3SFToUnrKD5RsA== 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=CF0t4DQv5a+nnrW3MteMGCewrDv32SSZJApR379xOCI=; b=Dp0jyutOHHNCybjpaS3v3QLVkfnFNuMtP6v9GsomxdB/YH8TMPxB0rkS6NCUgq+819T35Gy8zAeo3vybXuTheMcO/u4YIdYn8tq+BQessH2/uO7nGS+yX36etR+qLhZp4y2nod+IuUzzR3BCcSQncJeuTDuvaejVEGp0vgVE85EF7ILLbPkUxGdmVuAre6oFYPnx8QRDVPPpPMQQhzLLm9lWo/iY5OAjqjeL/kDBaPltu2JrhBrS7QvAYtuOXJU6h2zRlV/aV+IKp1Mya73PNhMbK4+uFJLjl8UtW7seH9kwSFhY76aF+IrmYoCRmkljpbwf1tKoBU7BtaupJzZevA== 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=CF0t4DQv5a+nnrW3MteMGCewrDv32SSZJApR379xOCI=; b=Nko7+11wb1mATY53Ggyl+XUjo8E1QkhA9nRTSaljS5/4ojFUmnhMxjHj42t/AzPBIKd4kvvPgQfeP0CGRK6HtPpf5MyCPOdRWw7mRHjuLx416ajulDwhdEp/WAFWZMnhR3WR8irb+i+9qlH1WxzzRCAKpfwLJmgpoY/4BB7pdQk= 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 AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:30 +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; Thu, 10 Mar 2022 14:52:30 +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 v3 7/8] dpaa2-mac: configure the SerDes phy on a protocol change Date: Thu, 10 Mar 2022 16:51:59 +0200 Message-Id: <20220310145200.3645763-8-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) 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: 141c0e8f-58fd-4337-6708-08da02a59a05 X-MS-TrafficTypeDiagnostic: AM8PR04MB7281: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: tGFbitAO5OmupBU78qnwuQI14Zh0vJUCp2nbb3WwWGHYpPalgw7VZI4vcvP3/Iwf0DliJUBTeb8MF+rXiUOwV67Cv9s5+QluLWfwstmG3R6QDRZIQIVsBQAmzeFmdTBEsLriQWrVHyTMBlSOfgkdGrAy1eT03UklNtRu25sTDf7AqMWDdq5bsFVnUS59yiIsw+hCHoEqWLEnuKaZlIzfeU+iE2FpnGDEddNrnMO0cGBPTKWcAaI8PzBFhRoJJjxjSy2F9gxnmxawcqO9RQksW7nnzWgvpvvPy/a6FpbiIU/OZ71CuBcsT0YpC3bbM6tdmrtAF0L4kt4Km/LAs05n4+lqjlNSL9HkShzth7zhDABLKtE1ApGRLY+puxwn8sMizHBMa8nCdO1WoGIXctsgvTDIH8MEvAO7ybo1Ra7iykkQ9J1cz5hg0N3YGSLUSBCqmb7Gn8JPqEEh+doWUJ4IBdwA3OSjndBU7IY7xUlQfY8Z/pHEDNABeLVFw9Y+vQLcmzWNjSTSLaiXCG+f73qG0OrbMgG4h0IE4tG/zmcomJlDGIX6Qtr+2h09AOxA+uLbxNFknjVyKVKKAgxxi17plbWf2mTx00Qjb0ElZD7ssFCHto3HA51Ptp3zP91PNxELOFZQJ9JmNgf6D5cH0mZe1weYLitRySNC93aZNTQbAM170uxjnNUBLC/p4aRZypVSbYm10/iwN1lnpID0Sxk1ug== 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)(1076003)(316002)(66556008)(6486002)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(83380400001)(7416002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JOd/rHRxrQ0H5DRxce+OxqR853H2DgOjS2BR/nNQaGPW+slFDYylSIqAJ3FcNQDEqLyYA97zWLyR/6UhMEVX0I4YTabLOvc00cTeiABmJuWMl03Vj+0QRAmVDg6tiiKzh+CdmCEhKRRzVdk3S4LSkD7wkaM/p84GRJ1bGa5lQhT1qVSDhRiwxyybAHunOi4MDGfMyX4THUmVAwj98UgpcZUZSJ+xujNHKaqRFLmh+XwVA0Xt5sK0TmJ1sj8aqYEkzdMNf+VdBFlQ5b/yn4/LJmfbA2b/bqf0LUN59A2LIhBtPl8VikKOVVipcOh6vPMvdM9Qk2Sa/sUcdU6kQC/TlZZvMe2YQ3LokE4UOrLQgngC4lnKZ4G7QJQB5NkBXrlYlIwZ8v43iCej9K7nFOmeyBW0ApGSJjJ0VloHWzNa9Jkl+EK1E24EM10boGsJr8ST3gfRzp1q6j8nhRUEOGH+QNsP82GL2/OewjRnBGaAoFE1/gi3srGj1scJdl4HNkaaNhqrvXOhjhgf6VKVf9j8u9liHO4TsaFyLqg4t5EKbBAylyQZpeMUGGyCbkOmD8+v7GnQEGXSwPgJZo6nB++Jw5ZjY+cNKuup6rlnCTnJOKg9Lo7t13Z+ALo7cknQsE7XIe9cY478teQF3o1dlf6CWyANbgQm4xrEzUaPPF3M64f/XjeCO2xqJFkYJblBhCFVAhu/3kjdB5CcLzbl/AEthuDBK8/qacq3FTgnT12OKTkh79SYMr0UzsOW4873xtuHNCnN1JgzGr3RkmeqgoNSvKx8QuCQ0ubh0Ys9lHTMzcvPnUtpkewxW6gXX2euIBMOj9fyjLZfe1qjy4CD2ZNKae1yeuMFttYJ82oVgbMjEHgVu4UwFZCu/OP9D4l8MtBo1hPYnQHa8eyK6iid+XCmfStZwdtTNZsI4l+J7nY+wxnkqN4cF3NvpKe7RkUygL9oTv8VZ8Z8zG2upSxP7wrMOh8qp8LHPE4W1KSi7IufkxPcZHo/bAQdedczhuYVAOt0FRR/4mwDoFKamHMp5mh66ZgEZpF8dn2YS+yOmxSxO2LPzf+D3Q5MtNg9/MObngzM/of74w38B6NLPankAmNQS1czc4o6tF457iUdz+k62MHi/PzVGp/jDbCXlqhOBdZXMBXQJwwPD8MIh2Dmbi/j7zBRXQj6aPVUClpz5wpo22vMJmxpjMs0JU1zVVfsQBOvoapaipVYOu/0lakd2BHYNBS2AzAm81avJGC2fB0ifMEl8HuA7EJvOjqBSMo4xPFpVPD1Kc/I6fHmBVNhMfLb1dIyxESQeKEN3volRj9EMYF7s7/PF9xsr/ipK6vO+Z/S9jmZmg8yC+f3IxRc7nIKqIJK7caKoteOp7o+1KEahFKb/eNKTMhGb748LCNLj8MhGYX1RUHT8TMxgY76qtil0J8oxkLTmSWWTVJSlQpZvnj3N0eSlOLJvcJU3Ka4KdKyomlvtNnSXWn8WwVvy8zkf8K4PtzGNHdec/zZEYFligzyecWjDwXanG/WxCI5YQFE362hD+5zDHM4PrOqOL195a/4g/OMTjePKkJ2yC07/XppL4+j5+ajv5ts9v8e0MPJZkLWAdaBgAGB0Nv9TnsThD1lTldr04AE49CTVMTFIrg= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 141c0e8f-58fd-4337-6708-08da02a59a05 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:30.4344 (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: SwCr0yp8AALE9b4QKj+/S6XF9aNPehtyCVM+Le8I4f426WYzhVOOJDwDaT0dRbtpj1jhRNl8v9rl3mPpMP3rdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 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 Changes in v3: - 7/8: reverse order of dpaa2_mac_start() and phylink_start() - 7/8: treat all RGMII variants in dpmac_eth_if_mode - 7/8: remove the .mac_prepare callback - 7/8: ignore PHY_INTERFACE_MODE_NA in validate .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 5 +- .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 88 +++++++++++++++++++ .../net/ethernet/freescale/dpaa2/dpaa2-mac.h | 6 ++ .../ethernet/freescale/dpaa2/dpaa2-switch.c | 5 +- 4 files changed, 102 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..4b047255d928 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)) { + dpaa2_mac_start(priv->mac); phylink_start(priv->mac->phylink); + } 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..0a5430bae3fb 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,29 @@ 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: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + 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 +171,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, @@ -259,6 +296,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 +317,43 @@ 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++) { + if (intf == PHY_INTERFACE_MODE_NA) + continue; + + 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 +370,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 +449,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..e507e9065214 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)) { + dpaa2_mac_start(port_priv->mac); phylink_start(port_priv->mac->phylink); + } 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 Thu Mar 10 14:52:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776533 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 38EEFC4332F for ; Thu, 10 Mar 2022 15:00:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245403AbiCJPBv (ORCPT ); Thu, 10 Mar 2022 10:01:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344521AbiCJPAX (ORCPT ); Thu, 10 Mar 2022 10:00:23 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2042.outbound.protection.outlook.com [40.107.20.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0CF718CC42; Thu, 10 Mar 2022 06:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g9ohQmyvdGKpxP2VpTTIw2uyVVS5i3jund3gMAaz4I207GtVp4D4SXGnQhcPVs29aQ2pV8X83m1IozL0+Y3u/Vm8Kr8gkTITZBsYnoV6dr/JHY+AoUJzjhN41mgr0GNKB9YsGpEIPTyFI1Xgl5ik4dkrvu3fQarHgfOb4jDlS0/2JyhL63HiodbR6XEC5dMosctCZkjo6sGL0/Nmf0qd5Zj8H7oZ0eHQxgsGvgFHPUlRbrBmH6fVgExHmqz56eFj4gp3tCvfe+/hN97D9yycmVM4is3PHbgWv2RaFzGg+/CecOLV5353LJzNgnUHgdnQiRJDgAuYwhRfXLMRHL2DVA== 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=BGY7Ol/aUUeOiUHJoTneOAN8f3TZuA5CSk8d6GWhUV4=; b=MweQpvX9StZGgu0/KJF0VEwPLIsdECivi3vP5OeDSIfvOGIPPkXUkrf5QRYOzTPTucX+Z84t7n8U5by+603Gg4EOoGxPerp1SfUAMnlxHlXxsXJ7/Ys2qKJTyuTiQ/1PfsqLjM7/2keEPItjZjX+EeFztmSPW/ahD7Qt46vqmIeN8pGikey1zb6GgHIi5thWAh1yZydvbuKxwT1bPtCiB+ZbKYq0SYlAtc6fZR/+AT/3dbMVqT/rT1mximTRFLUrmjGHDDuoHpWoYtscZ5aGCGxaiCZi6z4bjWhw38hBMKJrC3lnTJTk/mOuNVLEFmkGnruauEcI9AzuEckgks0YMw== 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=BGY7Ol/aUUeOiUHJoTneOAN8f3TZuA5CSk8d6GWhUV4=; b=MwWd2runvpQPKFZljH9Xu6kGXZznoAjnjBgK6jxJ6LsaeuqIZYflIo7gHn7JAIs7PqSinTpbvvU7jBvECkNP536TPpFo/uC+CxpUVrW/BcA+j5Dd52lsay06wXA87XLMFVxRSLVBYp/qCoIq2G1jKP8r1joWBPnyfRKrR0og6m0= 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 AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:31 +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; Thu, 10 Mar 2022 14:52:31 +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 v3 8/8] arch: arm64: dts: lx2160a: describe the SerDes block #1 Date: Thu, 10 Mar 2022 16:52:00 +0200 Message-Id: <20220310145200.3645763-9-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) 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: 688160e5-7743-4bef-e6e2-08da02a59ac1 X-MS-TrafficTypeDiagnostic: AM8PR04MB7281: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: srjT4un0okAh00YC1rhCfNpLt8UMVVeKrITnHpsPID8gg/4mAPztdrH/COsj845OfSSCwpvjA6xC8sN51JRqkZq3FB1HXLa8zxDQ23WFu3UPYgNP1w3F22NNAVDQNBU3r0pw5qH0FRFoUSplNKVb6DbCtm1rYiQHYSc7zm5dvLNhgG4btPSMtmNXj+JFYnghzo/jTyJRS9xzb8b6NijdjAfcjElu5jIy4nwSJ0YYFQRQRMOOVj905wZjktK5msDxlKT7Kcnh3Dk5e0fh5Yh6Sjl2mNb9zmEa6ykYp1CihBJVHjHQw9YWRGTPX14KAJaCAkLMMb+uOS1CosOkFJgJnxqYFRUDOC0k2XSaXHiN5T3E3PnhTiG/cCiumn3GlgRBEXuMt/cAVPNg8VAUL4ceP9o8brHkq07rA7VS1rRlO/1sLpLGe6Gfj9aJeVOizuZVLx523lSLYr+PUwIIe80evDYMoMASylGoklBHG3O7V+zXMLpPzA+cqrtdcZ43i8XPXfvtp3rAPD/dBoo4D0RjdWVBGsLbwNCWSMqdLxiTNYpxL/rbCUL9epFOFrKkoT/9WLjBFCnliJnPHH9BUnyXO6QE2ROlojl7EoVHjnADLlpMI+fOknlgQBgIU6WsKpyhNqRzvFeocIPNz4T3YcjaAP8erJwoSkI845yo4l3nEHsO31Y8A4GQWBDw/eLIEsFhOJIgw6ZM++WQfTSgKjQD8zgCuOipnmi2CDqg/xTdCeY= 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)(1076003)(316002)(66556008)(6486002)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(83380400001)(7416002)(6512007)(17413003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kYJXuWjrPZhNmCrjawlcET29w/LFFgfjZkeDvD74ZSSADcO7Skzd8ApHVPcxAuI7uR8NiikIFydzB/r0rb7MKrfoulfeDslhPSMjQnhWfVny7nQFmm0CWbuWYf6EHULjfdUuFQgGCbX5KpEbLDXwW9b7lKJHSmDplDyOkD2j+RtDXz0kDzz8jP7aVlOmMhbp081Zl3xscFlRcmtDtGMWdMKqWUT62bd/jPYrwyN2Kxfy2ITkBEW7NgFzMvQvfyr6LeOsrWQ6JsAgVR9XGhnOO8SgQ1YF2YiJrycipOuThwuCDy1WFVtl6xQNCxGqM/nm6rnJrwhwqn2t3bIEqoa+63CSYb8ZZk5pZhVpE8d5wUH6uF/zP4VwJRnNEqWxQilIkdCo5zcSHYOrI0Xmg25zd20xVcU5fWBXON89E316rmf6SAOt+XKMFVpcts2A/BuH/jH3R1bNG8wuvkTtIP6yo9fRXsQbTyuEsW91L2pOrlrUxMRXSAwNjlVK+Xu+/YC67R5/+qg48akWbrZSAwMyqcpJ2sMnvAIizm7d8qtxlw6pV6ZJmUUQoIJBxkPx0Qs5vfKl32oVWFImBZ40PGT47rWpzEXVPAMkHkVzZPKrK+7byURqynm9ezAqSFqExJspvMHKm5tI8FLXBV4+/TeaRM92cby43d1BgEe02fLNtN7pXY2+jDrzTDN0xFJ9EDO1nbTKZPClxD+1dMfMV9dAgaVuXuFs2/ssVIZ7u1pN5oQn53JgQh0k9ic+DTu32xUpgmkrAjPgyPSq2BTTOixdHGwV/WIlm0Dc3MlT/RaAAIq028pUgNUTLvykRt/15sXnuQjkmXOEqo/+L8XHPbLiY6LPZCq2A3btf/8fCO6QnQ1K3VE70jHxFJ6MP51yUeXHBAZVI/FijUSDaoNfj1aOwzTIBTB2cL90RJFhQdnJs/etIHv5RVov82Qg05WBkyMseugR8fjXNQ4+2hpAkhSWJpIJ/zCLwz26ABBkINRd5NzmHq2+CaDbeDbFV0cMDWtKQ5tnHtBmlvAO1BsVvOD9ou4Es4Oz1w7aFCyTA7+O40VR+lpqzX88A8Quxwl6OXyPVy+XbkYcHlwv+6M33gLV7JibrbH2v3AIEuOKd/xc/gXQokFHkWEkDRkW8XyoG/SbRTMO4X/TnULKfFE4D2FtRyUCBS9AJPVsL8wrAHX/7/rQq5kgZmIdOcetqKEnzuzHEo+/tTGY9ZQ8d4iJopH0WvMF46KbwABMNX3BSvrwJj09GQO4W5f88nh86rhk4xQm3qmls3Et7btfQ5ylCq/qwjWsDVeooyvBoRgqq1GnW24pWooSzM1UPs5iDHkKdElQgmFvMPuhuvg+Bsemr/F7pMo9wfDdsNPUVIY0P9a4gGGDGu7NnKE+oZoNsS0DJvXMQ3jhjiQX7Le6lwFi5kJkL2EhzUHCoQzVWvPbeO6DEWf17dAU+gW75H9I02NQ4zhZ4rlvMzR3SFB5cqsLfpEBbk/yGLkHxQK84J8cPYSwXsGAzTqPXe8fSNaIgxXjxHEZ9XVSnVWqRFD9pXKttBZdo4cdyqEK1Xb/ZWn+OdL+wp5SIF5j1Mb3IL0nWcznPoIDVqX/h5N90AbA28wMJBy0VkwZInId2PDf3JsmB81bA7s= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 688160e5-7743-4bef-e6e2-08da02a59ac1 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:31.6854 (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: 9LfTyn0dP/wc8c0xBQHoANTBGKXRcYEb2EOM5KkqgGXXRp7yY5YJ/ZCE0thM2GqxKxZLV7paYuJKjDtw/XPsTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 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 Changes in v3: - 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..afdbc0dbd47b 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 = <0x0 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>;