From nobody Mon Feb 9 01:22:30 2026 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11012044.outbound.protection.outlook.com [52.101.66.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CAB92773DD for ; Fri, 26 Sep 2025 18:05:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758909930; cv=fail; b=XJLIl3rQ8efVSTyFO8He+4KctaGClSEkcCnhfqQxY139peWD2XWI1FzjyS9R4o1sxkGFljkJ0MpQyiwDqIUCiKTgX3rtq546uAXiWhMSzp7F9xPL8aRxzEdU+ghZNU+gGO836HuGrwTGQ/kNkmoeRXKDAuaMo23wwoiiJY1qA0k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758909930; c=relaxed/simple; bh=N670IwrnchDv+my6753rDH39NhddqtOc5YjXRzcrDmE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=oLR1vNp/7jMUivDacjpSZ0azivSAnLyp6iIYIvBwXU5ODtXpf3aCcSI7sGN35nqR52pLmVDXY8YRi5OklQfZJHFDfZn7hPKBfLg8cOIgR33KhdeErxMzf1LQIULWCxUGPLGOph/+Ouif9Fi9AxsNsS5RHRWZuLHuPNYzWdRFDok= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=VodPUDS9; arc=fail smtp.client-ip=52.101.66.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="VodPUDS9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YR9+G3hWU+MkcCh/EPmTMk9amTeVgB5RQx2p8Pitu0SNBQjFqI11xMwwEgN8Cqrb7q6Ht8CcUwAHGlM/9/kLnhWACJqWT/590+JsxOIIo2yTCtSZkh51WCIUHEhdNLo98P7MOFSF3CQ1ymnjLkEx05vIu8HNaiX1OZ2AItYsSDv7TG/7+E4b7YQ0Ih0DcnVNTbutMpPA+UpA7ojqN98HyGGB+tKaiS1b1dCZ/rihKk64pY7QOrDNG0gjnluQUKyPxdy/SLmL4RB+fKnJR2alG4ZTGbTO6VAL2Xavd2s8nufjHBayziGA4YYagmI+DKviCenQ1wBRiJzvwpVSHRmEEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=84f4+UPmGvQNglZzm3QF0O6pkYy0S5rwVv92EpSXsms=; b=MLkZ98cgr1UyK3kjhtDUeG6Vmk9Chah0dPasWdPaGhMWEpwISgjaglRK6gi2s2koBqbXNmnj8TgkPLKRwAyxu04u3ujg8VZJgRWOPO9hNseepjubHu31CfN10UYF3Ws5dDWOan1T0Ghix7tazNlZQrJmfX7w2rzXoJdvLNk3ZcBBtOocyIXyVeBP8hMyM0A7jN3AuC9JLa1yXMziPcyM4hguXgptEta1jSVLIoYgA9mEGt9P3kGkVBp3hLgo+ryL3mM1cyh+KhODk57NOY/mjHSLeXguGhsjv7DmX4S/aNVAcFosNPUd+Ci9DuiAwF+bKPA4dzHDmN2QWO4c5DT6+g== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=84f4+UPmGvQNglZzm3QF0O6pkYy0S5rwVv92EpSXsms=; b=VodPUDS9z1BB4vSh+iOW9ooJi1jy9xztPy4g1QyX1bMsn7s49fX9FxX0ksSUdCUMvCLEsThHbnVjvtHEWw8S6mTPgY7cQBgmHm8mNkpXSu7q3txQkVMQbYScsvI6M1pyvjck+KcaO9MIYVW23uO8w+0kplscXxBHFQeKlJgAZ2abu5eEJlrc/NiLMvufobaRc2+V4e8mgaLSBDXmgBwXDk4jwwWjJbZbQPxhBE4vVQLBZ9neiLveaiSd3H+VIIijZ+RwJ4EFOsQv15JHY346DnaH1m3AvuCZLWWpSdK6yeYH8rn0n+NBAWicW+JWA9iRfrv5YGQWmcD59mLq0z7Z8A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS8PR04MB7878.eurprd04.prod.outlook.com (2603:10a6:20b:2af::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9160.9; Fri, 26 Sep 2025 18:05:22 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::b067:7ceb:e3d7:6f93]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::b067:7ceb:e3d7:6f93%5]) with mapi id 15.20.9160.010; Fri, 26 Sep 2025 18:05:22 +0000 From: Vladimir Oltean To: linux-phy@lists.infradead.org Cc: Ioana Ciornei , Vinod Koul , Kishon Vijay Abraham I , Josua Mayer , linux-kernel@vger.kernel.org Subject: [PATCH v3 phy 01/17] phy: lynx-28g: remove LYNX_28G_ prefix from register names Date: Fri, 26 Sep 2025 21:04:49 +0300 Message-Id: <20250926180505.760089-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250926180505.760089-1-vladimir.oltean@nxp.com> References: <20250926180505.760089-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AS4P250CA0008.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5df::9) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS8PR04MB7878:EE_ X-MS-Office365-Filtering-Correlation-Id: 59402443-4642-4a16-aff2-08ddfd2742bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|19092799006|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?UrAAIIsfmA+kUYIjk4xLiwc0awJVJ4tRt5ymhkFHqfHd4nvZU0c4art0wdMd?= =?us-ascii?Q?/gqESZkeLa+1NdB70Afl38tdDD5bGxyoKVtCVuz0YeuFJx7yUsaM/IdGvrET?= =?us-ascii?Q?n9zxpij3NbdCdUF+NIwwXGbG0Wh/tpSfp0VfCBmnsIDT4fZUTrjgZy4PbFIv?= =?us-ascii?Q?nfFvF+wd2/NYaJp5+OAgyFsRkWApW5faG6olKSLBIRCh+QYPW1ywrpZWjSpa?= =?us-ascii?Q?fzXCktSp8trST8KSnNjLmsDKd0PBTo+ferIv7ssImKlqZmR+D6itjLgBufC5?= =?us-ascii?Q?UEZlLlD+kItPVo3CIbg1lm23mLahaBr7G7DROdLwBWksmygIWUz3U1zP/knp?= =?us-ascii?Q?ug0zq9VPTJveGszCYAG8OuvrEz+BockK8yDPRrUQzl9PRcCFMIf/025w/SO2?= =?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++Qx7HBLLXhl6+roJ0iQjZej6V2d3G?= =?us-ascii?Q?SbZP1AiHUM3ouAxWmBW9WeND+uqLYFjQU/oBDiNjYCm3KQVDbrmndV/JMyYD?= =?us-ascii?Q?bcmsSTSyPNLO5nP9rizEbC0+psijBSN4zAL4RPjEC87JoZfFabzKdUOSniJK?= =?us-ascii?Q?m08WbHQJQVFWN+25OszvVTQm+Bfs+uzDfEP+0j7UDHu6FcAIQiXsQBfVVyTV?= =?us-ascii?Q?ZBnN+wCjV/YxWSeBwF+DiWi0UQodJtA/J8vR?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(19092799006)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?E15WJCTt52Cia8n5vLHpTVnoR9/vSJjWlqR6lMu51DOD3jnFVYOqObC6RGJ8?= =?us-ascii?Q?E0W169H4VrN+tGyDn9GjTNmuZOxUzZzIKzI0w5dfx2HrC/M8JcBRKFUDCeXI?= =?us-ascii?Q?KClE9N3feqm86cNBEeXS5pFLrbUxZfdm4PhyUjip5aeQ51QhybKOTR92J9Jn?= =?us-ascii?Q?hy8NNBYf/UZn2li7l5EyZwBjbJYo52fe2bddK2jeIhUzTcB3et2/w9dR0c+J?= =?us-ascii?Q?+SFs+YuqDWS2k+b+Z9u0ip7PHSksdR0Ee6ID9vYaBIQJIp40wFMkVpknIX7t?= =?us-ascii?Q?W3RjzW7lrN1T9bh4T5M7LiJC1X+IuBoLtmAxz+dXYyOiFuwLBBh/4iLowVgH?= =?us-ascii?Q?bdLUYNywMQrauPuDa7DbYU/zxAp4gssWo6TPhf8sHKEvHmt841/IznhEmtg3?= =?us-ascii?Q?CnQHPmCiNXYACnw8o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nEx+7?= =?us-ascii?Q?H8thBQZSKvxmXF16TZ1HkDaRfxhr7tOmTLHq6sA49OvxJFfVCyTLexa1X+8e?= =?us-ascii?Q?UZVNW8lyNMwsx/bE7jkm18P2dODEoFgjtS2r9OCCaLv1p00i59F9anxsI/x6?= =?us-ascii?Q?hLLMtJDuledSBCFk/f4Q/Gij/1jqKrZ7X+d9UoN9hM5Z10H4mbEbg0t5BTJv?= =?us-ascii?Q?fSjFdoF12l+cbp9yPbMetstrjMhQspPe2ZV9QafC50VneG8t/rkqvatfPL1v?= =?us-ascii?Q?RiR5xX6e8ij+clh9YdEksMZKYEC1tYmQb3NWWAo/aOqCFslilfafGsk7cxWf?= =?us-ascii?Q?zw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59402443-4642-4a16-aff2-08ddfd2742bd X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2025 18:05:22.7835 (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: pEDFlGFZjAq66I0Ccgjz9PCaiT29yCSLF73cvraOYacboKDBbLOxSf1cYBsOtFBwpAis+CfLNCYC7t8aPIfPDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7878 Content-Type: text/plain; charset="utf-8" Currently, in macros such as lynx_28g_lane_rmw(), the driver has macros which concatenate the LYNX_28G_ prefix with the "val" and "mask" arguments. This is done to shorten function calls and not have to spell out LYNX_28G_ everywhere. But outside of lynx_28g_lane_rmw(), lynx_28g_lane_read() and lynx_28g_pll_read(), this is not done, leading to an inconsistency in the code. Also, the concatenation itself has the disadvantage that searching the arguments of these functions as full words (like N_RATE_QUARTER) leads us nowhere, since the real macro definition is LNaTGCR0_N_RATE_QUARTER. Some maintainers want register definitions in drivers to contain the driver name as a prefix, but here, this has the disadvantages listed above, so just remove that prefix. The only change made here is the removal of LYNX_28G_. Signed-off-by: Vladimir Oltean --- v1->v3: none drivers/phy/freescale/phy-fsl-lynx-28g.c | 248 +++++++++++------------ 1 file changed, 124 insertions(+), 124 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-lynx-28g.c b/drivers/phy/freesca= le/phy-fsl-lynx-28g.c index c20d2636c5e9..4e8d2c56d702 100644 --- a/drivers/phy/freescale/phy-fsl-lynx-28g.c +++ b/drivers/phy/freescale/phy-fsl-lynx-28g.c @@ -12,99 +12,99 @@ #define LYNX_28G_NUM_PLL 2 =20 /* General registers per SerDes block */ -#define LYNX_28G_PCC8 0x10a0 -#define LYNX_28G_PCC8_SGMII 0x1 -#define LYNX_28G_PCC8_SGMII_DIS 0x0 +#define PCC8 0x10a0 +#define PCC8_SGMII 0x1 +#define PCC8_SGMII_DIS 0x0 =20 -#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 PCCC 0x10b0 +#define PCCC_10GBASER 0x9 +#define PCCC_USXGMII 0x1 +#define PCCC_SXGMII_DIS 0x0 =20 -#define LYNX_28G_LNa_PCC_OFFSET(lane) (4 * (LYNX_28G_NUM_LANE - (lane->id= ) - 1)) +#define LNa_PCC_OFFSET(lane) (4 * (LYNX_28G_NUM_LANE - (lane->id) - 1)) =20 /* 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 +#define PLLnRSTCTL(pll) (0x400 + (pll) * 0x100 + 0x0) +#define PLLnRSTCTL_DIS(rstctl) (((rstctl) & BIT(24)) >> 24) +#define PLLnRSTCTL_LOCK(rstctl) (((rstctl) & BIT(23)) >> 23) + +#define PLLnCR0(pll) (0x400 + (pll) * 0x100 + 0x4) +#define PLLnCR0_REFCLK_SEL(cr0) (((cr0) & GENMASK(20, 16))) +#define PLLnCR0_REFCLK_SEL_100MHZ 0x0 +#define PLLnCR0_REFCLK_SEL_125MHZ 0x10000 +#define PLLnCR0_REFCLK_SEL_156MHZ 0x20000 +#define PLLnCR0_REFCLK_SEL_150MHZ 0x30000 +#define PLLnCR0_REFCLK_SEL_161MHZ 0x40000 + +#define PLLnCR1(pll) (0x400 + (pll) * 0x100 + 0x8) +#define PLLnCR1_FRATE_SEL(cr1) (((cr1) & GENMASK(28, 24))) +#define PLLnCR1_FRATE_5G_10GVCO 0x0 +#define PLLnCR1_FRATE_5G_25GVCO 0x10000000 +#define PLLnCR1_FRATE_10G_20GVCO 0x6000000 =20 /* 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 +#define LNaGCR0(lane) (0x800 + (lane) * 0x100 + 0x0) +#define LNaGCR0_PROTO_SEL_MSK GENMASK(7, 3) +#define LNaGCR0_PROTO_SEL_SGMII 0x8 +#define LNaGCR0_PROTO_SEL_XFI 0x50 +#define LNaGCR0_IF_WIDTH_MSK GENMASK(2, 0) +#define LNaGCR0_IF_WIDTH_10_BIT 0x0 +#define LNaGCR0_IF_WIDTH_20_BIT 0x2 =20 /* 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) +#define LNaTRSTCTL(lane) (0x800 + (lane) * 0x100 + 0x20) +#define LNaTRSTCTL_HLT_REQ BIT(27) +#define LNaTRSTCTL_RST_DONE BIT(30) +#define LNaTRSTCTL_RST_REQ BIT(31) =20 /* 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 LNaTGCR0(lane) (0x800 + (lane) * 0x100 + 0x24) +#define LNaTGCR0_USE_PLLF 0x0 +#define LNaTGCR0_USE_PLLS BIT(28) +#define LNaTGCR0_USE_PLL_MSK BIT(28) +#define LNaTGCR0_N_RATE_FULL 0x0 +#define LNaTGCR0_N_RATE_HALF 0x1000000 +#define LNaTGCR0_N_RATE_QUARTER 0x2000000 +#define LNaTGCR0_N_RATE_MSK GENMASK(26, 24) =20 -#define LYNX_28G_LNaTECR0(lane) (0x800 + (lane) * 0x100 + 0x30) +#define LNaTECR0(lane) (0x800 + (lane) * 0x100 + 0x30) =20 /* 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) +#define LNaRRSTCTL(lane) (0x800 + (lane) * 0x100 + 0x40) +#define LNaRRSTCTL_HLT_REQ BIT(27) +#define LNaRRSTCTL_RST_DONE BIT(30) +#define LNaRRSTCTL_RST_REQ BIT(31) +#define LNaRRSTCTL_CDR_LOCK BIT(12) =20 /* 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) +#define LNaRGCR0(lane) (0x800 + (lane) * 0x100 + 0x44) +#define LNaRGCR0_USE_PLLF 0x0 +#define LNaRGCR0_USE_PLLS BIT(28) +#define LNaRGCR0_USE_PLL_MSK BIT(28) +#define LNaRGCR0_N_RATE_MSK GENMASK(26, 24) +#define LNaRGCR0_N_RATE_FULL 0x0 +#define LNaRGCR0_N_RATE_HALF 0x1000000 +#define LNaRGCR0_N_RATE_QUARTER 0x2000000 +#define LNaRGCR0_N_RATE_MSK GENMASK(26, 24) + +#define LNaRGCR1(lane) (0x800 + (lane) * 0x100 + 0x48) + +#define LNaRECR0(lane) (0x800 + (lane) * 0x100 + 0x50) +#define LNaRECR1(lane) (0x800 + (lane) * 0x100 + 0x54) +#define LNaRECR2(lane) (0x800 + (lane) * 0x100 + 0x58) + +#define LNaRSCCR0(lane) (0x800 + (lane) * 0x100 + 0x74) + +#define LNaPSS(lane) (0x1000 + (lane) * 0x4) +#define LNaPSS_TYPE(pss) (((pss) & GENMASK(30, 24)) >> 24) +#define LNaPSS_TYPE_SGMII 0x4 +#define LNaPSS_TYPE_XFI 0x28 + +#define SGMIIaCR1(lane) (0x1804 + (lane) * 0x10) +#define SGMIIaCR1_SGPCS_EN BIT(11) +#define SGMIIaCR1_SGPCS_DIS 0x0 +#define SGMIIaCR1_SGPCS_MSK BIT(11) =20 struct lynx_28g_priv; =20 @@ -150,19 +150,19 @@ static void lynx_28g_rmw(struct lynx_28g_priv *priv, = unsigned long off, } =20 #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) + lynx_28g_rmw((lane)->priv, reg(lane->id), \ + reg##_##val, reg##_##mask) #define lynx_28g_lane_read(lane, reg) \ - ioread32((lane)->priv->base + LYNX_28G_##reg((lane)->id)) + ioread32((lane)->priv->base + reg((lane)->id)) #define lynx_28g_pll_read(pll, reg) \ - ioread32((pll)->priv->base + LYNX_28G_##reg((pll)->id)) + ioread32((pll)->priv->base + reg((pll)->id)) =20 static bool lynx_28g_supports_interface(struct lynx_28g_priv *priv, int in= tf) { int i; =20 for (i =3D 0; i < LYNX_28G_NUM_PLL; i++) { - if (LYNX_28G_PLLnRSTCTL_DIS(priv->pll[i].rstctl)) + if (PLLnRSTCTL_DIS(priv->pll[i].rstctl)) continue; =20 if (test_bit(intf, priv->pll[i].supported)) @@ -181,7 +181,7 @@ static struct lynx_28g_pll *lynx_28g_pll_get(struct lyn= x_28g_priv *priv, for (i =3D 0; i < LYNX_28G_NUM_PLL; i++) { pll =3D &priv->pll[i]; =20 - if (LYNX_28G_PLLnRSTCTL_DIS(pll->rstctl)) + if (PLLnRSTCTL_DIS(pll->rstctl)) continue; =20 if (test_bit(intf, pll->supported)) @@ -199,9 +199,9 @@ static void lynx_28g_lane_set_nrate(struct lynx_28g_lan= e *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 (PLLnCR1_FRATE_SEL(pll->cr1)) { + case PLLnCR1_FRATE_5G_10GVCO: + case PLLnCR1_FRATE_5G_25GVCO: switch (intf) { case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_1000BASEX: @@ -212,7 +212,7 @@ static void lynx_28g_lane_set_nrate(struct lynx_28g_lan= e *lane, break; } break; - case LYNX_28G_PLLnCR1_FRATE_10G_20GVCO: + case PLLnCR1_FRATE_10G_20GVCO: switch (intf) { case PHY_INTERFACE_MODE_10GBASER: case PHY_INTERFACE_MODE_USXGMII: @@ -242,20 +242,20 @@ static void lynx_28g_lane_set_pll(struct lynx_28g_lan= e *lane, =20 static void lynx_28g_cleanup_lane(struct lynx_28g_lane *lane) { - u32 lane_offset =3D LYNX_28G_LNa_PCC_OFFSET(lane); struct lynx_28g_priv *priv =3D lane->priv; + u32 lane_offset =3D LNa_PCC_OFFSET(lane); =20 /* 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, + lynx_28g_rmw(priv, PCCC, + 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, + lynx_28g_rmw(priv, PCC8, + PCC8_SGMII_DIS << lane_offset, GENMASK(3, 0) << lane_offset); break; default: @@ -265,15 +265,15 @@ static void lynx_28g_cleanup_lane(struct lynx_28g_lan= e *lane) =20 static void lynx_28g_lane_set_sgmii(struct lynx_28g_lane *lane) { - u32 lane_offset =3D LYNX_28G_LNa_PCC_OFFSET(lane); + u32 lane_offset =3D LNa_PCC_OFFSET(lane); struct lynx_28g_priv *priv =3D lane->priv; struct lynx_28g_pll *pll; =20 lynx_28g_cleanup_lane(lane); =20 /* Setup the lane to run in SGMII */ - lynx_28g_rmw(priv, LYNX_28G_PCC8, - LYNX_28G_PCC8_SGMII << lane_offset, + lynx_28g_rmw(priv, PCC8, + PCC8_SGMII << lane_offset, GENMASK(3, 0) << lane_offset); =20 /* Setup the protocol select and SerDes parallel interface width */ @@ -295,25 +295,25 @@ static void lynx_28g_lane_set_sgmii(struct lynx_28g_l= ane *lane) lynx_28g_lane_rmw(lane, SGMIIaCR1, SGPCS_EN, SGPCS_MSK); =20 /* 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)); + iowrite32(0x00808006, priv->base + LNaTECR0(lane->id)); + iowrite32(0x04310000, priv->base + LNaRGCR1(lane->id)); + iowrite32(0x9f800000, priv->base + LNaRECR0(lane->id)); + iowrite32(0x001f0000, priv->base + LNaRECR1(lane->id)); + iowrite32(0x00000000, priv->base + LNaRECR2(lane->id)); + iowrite32(0x00000000, priv->base + LNaRSCCR0(lane->id)); } =20 static void lynx_28g_lane_set_10gbaser(struct lynx_28g_lane *lane) { - u32 lane_offset =3D LYNX_28G_LNa_PCC_OFFSET(lane); struct lynx_28g_priv *priv =3D lane->priv; + u32 lane_offset =3D LNa_PCC_OFFSET(lane); struct lynx_28g_pll *pll; =20 lynx_28g_cleanup_lane(lane); =20 /* Enable the SXGMII lane */ - lynx_28g_rmw(priv, LYNX_28G_PCCC, - LYNX_28G_PCCC_10GBASER << lane_offset, + lynx_28g_rmw(priv, PCCC, + PCCC_10GBASER << lane_offset, GENMASK(3, 0) << lane_offset); =20 /* Setup the protocol select and SerDes parallel interface width */ @@ -335,12 +335,12 @@ static void lynx_28g_lane_set_10gbaser(struct lynx_28= g_lane *lane) lynx_28g_lane_rmw(lane, SGMIIaCR1, SGPCS_DIS, SGPCS_MSK); =20 /* 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)); + iowrite32(0x10808307, priv->base + LNaTECR0(lane->id)); + iowrite32(0x10000000, priv->base + LNaRGCR1(lane->id)); + iowrite32(0x00000000, priv->base + LNaRECR0(lane->id)); + iowrite32(0x001f0000, priv->base + LNaRECR1(lane->id)); + iowrite32(0x81000020, priv->base + LNaRECR2(lane->id)); + iowrite32(0x00002000, priv->base + LNaRSCCR0(lane->id)); } =20 static int lynx_28g_power_off(struct phy *phy) @@ -359,8 +359,8 @@ static int lynx_28g_power_off(struct phy *phy) do { trstctl =3D lynx_28g_lane_read(lane, LNaTRSTCTL); rrstctl =3D lynx_28g_lane_read(lane, LNaRRSTCTL); - } while ((trstctl & LYNX_28G_LNaTRSTCTL_HLT_REQ) || - (rrstctl & LYNX_28G_LNaRRSTCTL_HLT_REQ)); + } while ((trstctl & LNaTRSTCTL_HLT_REQ) || + (rrstctl & LNaRRSTCTL_HLT_REQ)); =20 lane->powered_up =3D false; =20 @@ -383,8 +383,8 @@ static int lynx_28g_power_on(struct phy *phy) do { trstctl =3D lynx_28g_lane_read(lane, LNaTRSTCTL); rrstctl =3D lynx_28g_lane_read(lane, LNaRRSTCTL); - } while (!(trstctl & LYNX_28G_LNaTRSTCTL_RST_DONE) || - !(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE)); + } while (!(trstctl & LNaTRSTCTL_RST_DONE) || + !(rrstctl & LNaRRSTCTL_RST_DONE)); =20 lane->powered_up =3D true; =20 @@ -495,17 +495,17 @@ static void lynx_28g_pll_read_configuration(struct ly= nx_28g_priv *priv) pll->cr0 =3D lynx_28g_pll_read(pll, PLLnCR0); pll->cr1 =3D lynx_28g_pll_read(pll, PLLnCR1); =20 - if (LYNX_28G_PLLnRSTCTL_DIS(pll->rstctl)) + if (PLLnRSTCTL_DIS(pll->rstctl)) continue; =20 - switch (LYNX_28G_PLLnCR1_FRATE_SEL(pll->cr1)) { - case LYNX_28G_PLLnCR1_FRATE_5G_10GVCO: - case LYNX_28G_PLLnCR1_FRATE_5G_25GVCO: + switch (PLLnCR1_FRATE_SEL(pll->cr1)) { + case PLLnCR1_FRATE_5G_10GVCO: + case 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: + case PLLnCR1_FRATE_10G_20GVCO: /* 10.3125GHz clock net */ __set_bit(PHY_INTERFACE_MODE_10GBASER, pll->supported); break; @@ -536,11 +536,11 @@ static void lynx_28g_cdr_lock_check(struct work_struc= t *work) } =20 rrstctl =3D lynx_28g_lane_read(lane, LNaRRSTCTL); - if (!(rrstctl & LYNX_28G_LNaRRSTCTL_CDR_LOCK)) { + if (!(rrstctl & LNaRRSTCTL_CDR_LOCK)) { lynx_28g_lane_rmw(lane, LNaRRSTCTL, RST_REQ, RST_REQ); do { rrstctl =3D lynx_28g_lane_read(lane, LNaRRSTCTL); - } while (!(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE)); + } while (!(rrstctl & LNaRRSTCTL_RST_DONE)); } =20 mutex_unlock(&lane->phy->mutex); @@ -554,12 +554,12 @@ static void lynx_28g_lane_read_configuration(struct l= ynx_28g_lane *lane) u32 pss, protocol; =20 pss =3D lynx_28g_lane_read(lane, LNaPSS); - protocol =3D LYNX_28G_LNaPSS_TYPE(pss); + protocol =3D LNaPSS_TYPE(pss); switch (protocol) { - case LYNX_28G_LNaPSS_TYPE_SGMII: + case LNaPSS_TYPE_SGMII: lane->interface =3D PHY_INTERFACE_MODE_SGMII; break; - case LYNX_28G_LNaPSS_TYPE_XFI: + case LNaPSS_TYPE_XFI: lane->interface =3D PHY_INTERFACE_MODE_10GBASER; break; default: --=20 2.34.1