From nobody Mon Nov 25 03:33:41 2024 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2057.outbound.protection.outlook.com [40.107.249.57]) (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 6AE9A1E32BC; Wed, 30 Oct 2024 09:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282092; cv=fail; b=TYOv0/VYpRdhmnXXPu9CZHQ0JKveYkUAE5wHQdVO762H7Hi8VcIF0x2PvUg2NHyCC0IucIEnQB0v0dC9QGX/uSvoJvxXKnNFY07D+KhIH2yRAiBRsYRNXJGH5Z/NWOrSv4Giec8o7hrh8YYD6yVdnt8iGzyyhXKT+mm8p4Gy9gQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282092; c=relaxed/simple; bh=rniyf7Yxw4BAxWUJO1iwBwhqrfYWWXkxrT34rzz4Pss=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=sC1oRDAo4XHTYt+3PdnvxPCa4yryXpJsYjUnTCk548erHGPomCcwe1YrJclM6rSqyLEYA8Aj7RjLWE25yfZ4HnXPgSJ1SMdONZDalJudwjK13sYjk682gGXpTDCohHd8qgRa8jtX1mMoNaPp8QXhAoGBU0bPPosu8zHEh4LnMgY= 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=RDpS0Wvo; arc=fail smtp.client-ip=40.107.249.57 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="RDpS0Wvo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=W9BCAiCGR8gOIV5m78kZ6himyldx2RtlhIXJ8hjNCyocTQc0uXh0HHZXzq4BiLV5alGVlDHm3xMapoB9yOJkZgKxkrTz6dfxIAJcmsGOY3NGUwVLK2JuRV43vyUEk74hBgxx5TU1IsLWtEM67YBvMeEdqSrJqlbWgvDzOy7DhuZHH6f8xQksJRxx0L6Y87Y0avccdhQBuj8Q34cenRoKFTlEkYyNXFmxhhRMGemeFZH/hd1wRWTR5A7batVARUa47czBwvs/MGwHcWZyblB6aRQX6/wCXpfvekmulrsXBxoROb/k2OBd47C9d/3y+clZlVehSeTKeBaz0/3Zk3MH2A== 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=JUK0l6Utl+GYdHNvpbsSBEXzn6QKesyFiji3dKJO70U=; b=Q3qNqkX4Ti1l3D5/latyRGRcfbOW17H8Z2LNQ81UxUfcWORd4BmSV3JvYYD+URJA6muqGYJKhKKYOhJSPfrpoZWznx4RonSwOaN8c0VZxqUqgAhPEs0bc64aN+yPpCBqnwteXoeKdoiRE2hgLSLu7ZmCCQPlctTVziGifMzXLW6GFdvk5Nggqc9LR2VPplq6R63B2PX+f76c1yHPkvj9L1BTCoPNTAlXwVzzPHpVJr9ydIBbYP1NHv5Jh+GQehDf2Y1QBuMRBxX7ammPolE/jEnoNifyPulEstllcB1sYSSUrDvmdeQpyr7Ilp149/zGTAjH57u9mRzvuAuaCwUQPQ== 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=JUK0l6Utl+GYdHNvpbsSBEXzn6QKesyFiji3dKJO70U=; b=RDpS0WvoNoTes/tU3+mjSnWU3MM2sM77GvvDQz3ajGgazSzVlcmoNWkIBCqs2kLwnuy+C08zAt9TpOIs7EtXwDgrTAbhBqxdICBAnOXAcOhfcb0FiyNKlNTTQOoUNclmut3HQp4xXcMVCF1fxdNYF5JaYJbxd0kwBDYHr4NJfMd91XmW6WdGhV97d1ECSiwdJBn1D9NyHE+DkLZL1gP5QbpbmpSwj2v3RgOiZzRpnWJCEgNK6qCFhPjvKTRLfvruvwDf7QWyNyTPQg2m9nnrM3WnPRLPnHlR/YqxxTu8go56nGeFB9SCe9Ek+WclevZZELQhiKNP4ahienQetc/zMQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:54:47 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:54:47 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 01/12] dt-bindings: net: add compatible string for i.MX95 EMDIO Date: Wed, 30 Oct 2024 17:39:12 +0800 Message-Id: <20241030093924.1251343-2-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 74f13a44-acd5-404d-b064-08dcf8c8e387 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Eh/mBw7axHg6+By1STQlyqkIL9djSGs28D6v7qzxMHz0oI4ttXhRxNCCmuSB?= =?us-ascii?Q?jVhIjMW5gUqs37Rdz6m1mjFKzNFmkiFHBMl6CWTvqHU6lT+RTTcJd1atZVX8?= =?us-ascii?Q?3qEGTpT1qsqrGJ8A5y4Dt6rRYFUU5uOmgJadGQrWRU5XmW+e3GY1Y4JGNuQi?= =?us-ascii?Q?ahkxzj8ujNlWvAV6xwl9fRrXQjQitmxU+Mp0ya1ouJYilVflfpE5wdkawTwJ?= =?us-ascii?Q?ff+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W4H7ovvdyzz?= =?us-ascii?Q?4vurlcFKgIirPAkkfZKMn4v6uTvsKftlWT9TCTXwfs66Exxs9a01G0HaP1Hg?= =?us-ascii?Q?PTCv4oLQGx472T9vrkMfcr0jrESlTQ8n04GoT+m16QtSGGH2Mbq8TiI4JqiZ?= =?us-ascii?Q?vMc8F6Xh3n8UVR6tIvIINhIV8MTwbkQsy0RbjM3FbImhNT2YM2zN6AAA8uzn?= =?us-ascii?Q?bSdBG52Z8gtDSkLBA4wz3089X+UsLjm5ah2pghjcoVKS/EbDXai0ple89xSC?= =?us-ascii?Q?6ClQJm8Voj/3C5CL/tpVvNkrFw9/?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8zuPFWa+1PPk4DyO8Bb2gpTplazF7tcUZkaMANVCPk/3cEEWrak9IDwM3Fb5?= =?us-ascii?Q?ARPBDUCPohMlLPuAmIUAAe5Vfn73BK0kgzsEKR5qOlnVnJOfpBqV3rc2PTB0?= =?us-ascii?Q?9dEkQ38Mhv+FihEgYlex8Cgrkk/hmslRD8UYakabRLtTaKzTL51qmFHEmtBx?= =?us-ascii?Q?uDOWmwFAyso+9BElQ3+dBkuqXEj1UytVkSKtkf45u+dv5jSy87T03exoF/NC?= =?us-ascii?Q?Oac+jbyI6tueokD5ULThy3NPeDzTtAZ04hD64omC4e8sYU584fj0R4/3CrW4?= =?us-ascii?Q?0aBG1zusObw5NHJV8cs689jZl4X6b7bjjpO8JHCnOjmkmpUvdfs59WKsObTI?= =?us-ascii?Q?FAsvfGKEVzUfIj1WxvWgINCjDFUHrBnGvJac6BkfRFfZZ78K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Qq1yHibGneitbW2sAwDqCbg9tKvBXntce4mg/cN8Ir14cWzqa?= =?us-ascii?Q?nd/ffebtqMAQfKPHcPssCGZl3ApZ6m9rmFhNKNL/u21eo845cfC76KU2bc4n?= =?us-ascii?Q?eCi6AFe0WGynzzq2EJBIhYmthspK0q2V6cg+o/Zjxg0pGKS85iEJC8HF6Mo6?= =?us-ascii?Q?WeoGc5xLM0z2cMS5wS+x6+8RXypTgvp8lVU42MMu/V7icvpsCcj8aF+9ISBq?= =?us-ascii?Q?d+ASmYcaYUUEPK3tjGDLIwQbYp/SSyBfDIgKxlzvWzfxYsscTSRBw4q+NWPC?= =?us-ascii?Q?VWJh3ssz7LXrhzD6dkTgtrmFiT0apX72J9dKnUpc?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74f13a44-acd5-404d-b064-08dcf8c8e387 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:54:47.7504 (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: /FXoAQvW6v8nZmqzfbz+rJTEmCTYsElmFZr61LoxI7/MZSBlAxAuONj2U6UpVJ7cVQ+4AqLfR5h2tOUzXIIErA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Content-Type: text/plain; charset="utf-8" The EMDIO of i.MX95 has been upgraded to revision 4.1, and the vendor ID and device ID have also changed, so add the new compatible strings for i.MX95 EMDIO. Signed-off-by: Wei Fang Reviewed-by: Frank Li Reviewed-by: Vladimir Oltean Reviewed-by: Rob Herring (Arm) --- v6: no changes --- .../devicetree/bindings/net/fsl,enetc-mdio.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,enetc-mdio.yaml b/Do= cumentation/devicetree/bindings/net/fsl,enetc-mdio.yaml index c1dd6aa04321..71c43ece8295 100644 --- a/Documentation/devicetree/bindings/net/fsl,enetc-mdio.yaml +++ b/Documentation/devicetree/bindings/net/fsl,enetc-mdio.yaml @@ -20,10 +20,13 @@ maintainers: =20 properties: compatible: - items: - - enum: - - pci1957,ee01 - - const: fsl,enetc-mdio + oneOf: + - items: + - enum: + - pci1957,ee01 + - const: fsl,enetc-mdio + - items: + - const: pci1131,ee00 =20 reg: maxItems: 1 --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2044.outbound.protection.outlook.com [40.107.249.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 9F6871E231C; Wed, 30 Oct 2024 09:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282099; cv=fail; b=GBFy01K23ElYU4B78lQDiaBtTuP0n6n1jQ1xe9TjzsDxL2cXWOTQwvjF4InfGlqRBqMbGLDCrLPVqk3/W/Pzvm9uIns3VBYr7vEJTvCHXCmyHeuNFXZWbZi4og59tZOkcHZKDwSmaRnXPeRYmtTBceGUy07mf4mjnrGm/eLnBaA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282099; c=relaxed/simple; bh=ljN9ZHauh4wygTQilaxfPPWuIIcZHUE1isT9KuEFctM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=hNTo+gv63NhHQSnS/zQWiG951HG+CffMc7Qt9MunZB/rGoTLkjGqGLISuAg8M8Jc2wd4BmiYectp1zPLENDmeHATv0b5pYfJUyiEYPvLO3EM//qZrp60sDHLaXASd/KgjVS8Lpwrrh3wHRDfIjcaLYLwv8Blo/Cl3u6Cga0uCWE= 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=b8Q+eYiU; arc=fail smtp.client-ip=40.107.249.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="b8Q+eYiU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EtBR2F2YYVtDUH08ygQ3jg4Fl825wOoFn8BFpJcqtZNzjrr2jx2IShyewSMOXtxwi23dVMJFEm4Qa0PP8Hyhufjv96qYOUcFChW1JWet2kaYKRTl1jKEQ+UJuDvLSMHqKX4ZP2DuH9X4eDqsecplGWslh9EB5+gg1j+E6DJBAbDG/ZJWuAIrEKEBywDjYL5WJbqjYc/DltGwMlKsA8Yht2gD5VZZh/xAHVfHE+zNfPE0M5ipYvbfnmuj0NIGxB4vjnD6wXOFdDjIPYPRM1B1sZB9+b39cULTb6Vib1zZLO4kcMdM9lKSoXJTdWcHneN1wbxITNBLl/jCsSnHHZawHw== 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=jPKZ5H/nfdjETseUZ6lGYMeiOrIqJfyaut+UoWtHqes=; b=sJHufIkCmlq/CLFzcgqFXI0R3iIwpUf0qh+MONHT0RV/0WG7XM29VWpxQy96eN+xAc6dF18yJJZFFk61RsdH1Eu3+lvU+xhSThjHm6Vl28SVRwEdrawDBabp9kgu1Y9hPS3ftiEsmKE0ErYzb91E1vTQfNDnhW2ANCM2Sjw9HUQ5YSLNDthNRr4s9UnMSyZ8i1q6npaUp910k7226nTgOQjUQU9vf/Yg7bsMafMYJHQSZJSHbMSs8c5SdWfMcUjZa5nW/1tZ7AIg/BbIOwoYO8nqD4AqPnSSr/Xizim05oqcQ/31HwzTWx20fLrOLGMG/rkKvwa+hJRdnhqgeJ6eng== 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=jPKZ5H/nfdjETseUZ6lGYMeiOrIqJfyaut+UoWtHqes=; b=b8Q+eYiU0FSdNqcHqYrNcnrpRCC944f9HhiKdewaPbQfDzAMXBTsRjXlD7urz1uto+Z0MvGJBaqthU1b1zUmBZocZGoGVvwzW9xPhRYEI4GcNQH+1vMw2AFzKfjLffYX8DTe0Aio6EX8SKHJK6Jn95xUeEdInfngSAjYx6Yd+7JVXp65Tx0+jhSuP/zl3VTYs1aQqCxl2UIeH6hlEv9dIdtugqXgaHDLaB0nlBc9ekC5FU9D+E0xC1/JbvaGA1CCPsFtDe8msYLf79ApQAGLLQKsCZw1v5lreMthenjHb7xKaqjCHVAXmAk5s0SRx3kybYBHdecOgAEKDu7/ayCrjQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:54:54 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:54:54 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 02/12] dt-bindings: net: add i.MX95 ENETC support Date: Wed, 30 Oct 2024 17:39:13 +0800 Message-Id: <20241030093924.1251343-3-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 14cff7dd-bd0e-47ad-371d-08dcf8c8e77c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1ZQMkH8BOYNxUnxZT9DvO+0I39QaNCKNpyPNpWEAS8l8qWVxIqEYSy8RZIFe?= =?us-ascii?Q?vOlXT+WqmSxgMDRrsyy+kI+5HGhcUUbFwKJ7suV1ohDAS82+ZpMa72+NDibr?= =?us-ascii?Q?BtE1c8iF86yhulFeu24d5RaUWS7ETI7VW+8q1M66JXhPKbZv2k+kalrrUq0f?= =?us-ascii?Q?fdlUvt+la02B6Lj2i0fmktsdXjMbJeMrLrR3lWvCOI2Qc053bC1ErvcfTWTz?= =?us-ascii?Q?fRa0mxdTS0Ui+hbIysrgQCsN4mvfge3llFfmzJpg9AIKQgW/Q64+4pz5EROn?= =?us-ascii?Q?qCIgBBhr5KMWi5OvdirkMi77s4lDdTrhBLVIqW9NEOlgUC2xMv1+Ya3Galsx?= =?us-ascii?Q?BviGDBq4/NFqb3EWhmry4S2BrNuBaZVZajIks9boVFYxLLfa8zBMPU9k8EwM?= =?us-ascii?Q?axb6z1tn0I4/snUxHPBvJ7CnQR0cKD5dW9P/kLnODCgq8m3a/yNDhofI7B/L?= =?us-ascii?Q?GkzWE8YIN7KCfsM/8KxuWOyWPAzXfwF2VfD/8xvBmS8Dq+AVK0SwNnEAJzLP?= =?us-ascii?Q?UFrdNPm0tdo/Lq0RURDwy0xzEaGgJahbJ+aC/n0yLV+TnByvcUNeOHOEs5S4?= =?us-ascii?Q?wPS1tduqL68GoeJb1Qydvj1iwfQ8CJXFt9mHiEsbKStgQjKPOlezj5SzK0yD?= =?us-ascii?Q?vT2rBhDcIJ2MSrkN6HM7m3k+6cGIfUF0/POweZRMEgmlKqStqZgzemjCgreP?= =?us-ascii?Q?sHsZUIfmoRr8GwxhZSOf4BUs/EZ0cac1DKfC0AWraVeAj2x+CtyRUNZA/BWu?= =?us-ascii?Q?Mz3xEpV+2bTMyTYpxMbyrzuvhxYs6ICJmc16BfVhj2qwYEwe10+8/qFUrfI8?= =?us-ascii?Q?8yIGhvHMU+F2naWfaLMsfZkwRixY9JCI1i2vKY3uAvhoIGmteG2fZsTcd4gb?= =?us-ascii?Q?ewLtu9MUjT2EkkfytUZMcXqprwTpI4NH1BUZBxoe83B3EAufSyZHUi6L4ALk?= =?us-ascii?Q?d7XQGGSwTZxd8ri7B7UL/cekqn+yXIzFbO5iZNzLrUMaNwvhYIJp3Vp7S+12?= =?us-ascii?Q?xEBtJAgr/Ho3XO8CBN+jsJB4dsMZUbP3LWpLbF4kuVhf2TxaemaE5dpJwQ7X?= =?us-ascii?Q?+R6rzOPJmGybxINKY2Lns1sjasOXGw0zkJ+WOc0Dv290w9XHr1UCj/ZeJ9hq?= =?us-ascii?Q?DLoP/JxMZDpPOl8W848cuk92g1JXH6w7u3qntvhIxqGZVbClfD3/OPztTCuA?= =?us-ascii?Q?YC1bPdA3af5i4sjVMQ7C4g3aNreFLyrkkfdk+aeEvQbIwbRak/JMmEHMiyli?= =?us-ascii?Q?Gfmy0PP9/5zVoBFVS9/6QL63lxQc9uWEGpIOm0bKTsWn1r6WC1g6Wx+iJ9bp?= =?us-ascii?Q?PJp9UwPN6k3gj/c1lDtLbpwKpntnf55jh8MdL/WhP9Yx8lwgpwvDbTqKaqu/?= =?us-ascii?Q?NfZR7agjf6I5TfLj5YAuEBI6bbix?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QozYOwyQu736+tENSPGnskOhvqSd17j8axrr0DSitpItVWxHsLpHjTpnW0O9?= =?us-ascii?Q?jZbplXeyaC2xYJLDXqnHyYvDQD6G5hhdGwp14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x0ywp3u6mAwalYx4C3kniuMlo2R5BXPq7RajRa7Lo6O3tH+sXc7th?= =?us-ascii?Q?9RXcYfvaig7zMSEP2QY0jmFSbQ8J8YGEOCydWVTFgj4PwXB/wB5qC5BLUmaR?= =?us-ascii?Q?L6rfnE93TpkK51OqYJrOeliJEKSxvke0chNklq5VRryqtaGPj6fn1psDDH1y?= =?us-ascii?Q?l5wotKvqtoZQqVdp9Ta1OIwEeVh0fe7Mj2JKesE6am/HEgskDtMGqYeckvRQ?= =?us-ascii?Q?SspfAVHF9EtK4RNvUl9JEZtKbAv+XFLSmQ9NXnVecoN2bvmph4tlLij/BI4a?= =?us-ascii?Q?O4PsoDPKfghqW2nUK49Vg4DeTlKcF8BUc8j20Vqi208BfKQJotxvyJj11oGh?= =?us-ascii?Q?P2wHM4l1uO0VmuXq0eACaQOysPexEp8jm7qCzPltbAxH7yz5f+Ls2vfR9nhq?= =?us-ascii?Q?oQ/qrt1gXwZH82KV6L71DnCkS0UV6rrKysoeJ0qyMXteRuBvgw1L+CPqTlqF?= =?us-ascii?Q?OV8k2AkTVkLgP/57a58QPe5uAWEvymJPoDY8IomN7pIYXJHB7eC+3y8igzZY?= =?us-ascii?Q?w7F/C4fhk2blzBgGKWCttf9VoMQFsglpoTPPc8aFF/O4PfWaVq59jM4Yg3dh?= =?us-ascii?Q?nVDTXYDjKrirnBoYxd0PJl1PfQWh9h7rgWpID6bB?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14cff7dd-bd0e-47ad-371d-08dcf8c8e77c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:54:54.2991 (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: RTEZ2ctU+I8C4zWjGras2r2OZoir01suqvmC+1zszQVbFDAKsvr4naDeHhOGAr1dHNiiqo0/lKOg7tRoXvWaZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Content-Type: text/plain; charset="utf-8" The ENETC of i.MX95 has been upgraded to revision 4.1, and the vendor ID and device ID have also changed, so add the new compatible strings for i.MX95 ENETC. In addition, i.MX95 supports configuration of RGMII or RMII reference clock. Signed-off-by: Wei Fang Reviewed-by: Frank Li Reviewed-by: Rob Herring (Arm) --- v2: Remove "nxp,imx95-enetc" compatible string. v3: 1. Add restriction to "clcoks" and "clock-names" properties and rename the clock, also remove the items from these two properties. 2. Remove unnecessary items for "pci1131,e101" compatible string. v4: Move clocks and clock-names to top level. v5: Add items to clocks and clock-names v6: 1. use negate the 'if' schema (not: contains: ...) --- .../devicetree/bindings/net/fsl,enetc.yaml | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,enetc.yaml b/Documen= tation/devicetree/bindings/net/fsl,enetc.yaml index e152c93998fe..ca70f0050171 100644 --- a/Documentation/devicetree/bindings/net/fsl,enetc.yaml +++ b/Documentation/devicetree/bindings/net/fsl,enetc.yaml @@ -20,14 +20,25 @@ maintainers: =20 properties: compatible: - items: + oneOf: + - items: + - enum: + - pci1957,e100 + - const: fsl,enetc - enum: - - pci1957,e100 - - const: fsl,enetc + - pci1131,e101 =20 reg: maxItems: 1 =20 + clocks: + items: + - description: MAC transmit/receive reference clock + + clock-names: + items: + - const: ref + mdio: $ref: mdio.yaml unevaluatedProperties: false @@ -40,6 +51,17 @@ required: allOf: - $ref: /schemas/pci/pci-device.yaml - $ref: ethernet-controller.yaml + - if: + not: + properties: + compatible: + contains: + enum: + - pci1131,e101 + then: + properties: + clocks: false + clock-names: false =20 unevaluatedProperties: false =20 --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2055.outbound.protection.outlook.com [40.107.247.55]) (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 321921E47BF; Wed, 30 Oct 2024 09:55:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282105; cv=fail; b=fyhb/+CsYKQpOeVHAQ4i2SWeHvrfon5VK1Q91tVpOnLtCR0RVM+OPKQnFypAQMJLmgBLx9jp9qkpU1ue0T71PQYBcy5+qImarCMd9tFOBa9AdySqZn7ZWOogs6a3U0FxA3J+4Ju+9bwpWN+EKJ+CmP5iqlH12tsIT3JiL7ne0po= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282105; c=relaxed/simple; bh=N27vAl0VQkmk/pthLh7J4jKGbNZqaHwAFvpq/UlPCt8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Lvvnv7I2HJIOiydxx23KWdQ/dQaszGsVDXQuBRbuppzyUeVGZNqFhDo/lkAMRBSXx8UMovJ4F9Lu9tiQdto9re59qcxw4QuxM0OtvQun1OB8n1+BSv+IGG4VQ7i8BjE2aiNoj6mEPcQPjA1qgKgkUqDntsmDNLb/Ix1d5Rnj69U= 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=PEOhniym; arc=fail smtp.client-ip=40.107.247.55 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="PEOhniym" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wPYfF/A49DlOVSiiLqPv7WfdbMx+Kxlpmf92onLa5CULqjgtROln3Ukz0q9+Hg2IpqgIDqB7I9Ka4aq8iwZKWgmMcGm9WcpUkbufHiU40VR5GxfXmXYbRy7BkCXTVLrbj343Ve9vjSRp5TYrS3G2l8y6E9vuvlNu2YRpMgE/02/H6WJVoajd4aWPhFqTIObi0mqirJDH60YMmHV2JLnhpFmbcjPObXx84GMInMlKxhi7UriP+WYJVOF+EkQPjrL90ThO+QW/CcMZNENrqtc0QUFThmBBoVwPUGh8f4tdVWSVNGNS3JAvx1YDRTUU7eQ5wmcnLJNqE8J24n50E86qrw== 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=f3gtJW+qT2QgAKXpLuB/j4jIp2NDFcfKLtK+lYc/el0=; b=avw1iYnkbswcbh1+V1aDtBPGGNv5mYhNFRSjv3+nMzOulj5NgaqL8vioPpIaTsovlUHN9QQRKvZv8TvwGQ7NLcwxSA38ruUv3TYgJ+jEpFpHUYpf+wQTFVTdlAa2NC1eS2AhQJZyp/PvGzMSTyElQRvatYiwVsEln7u3aUgpEayQ0jiwBp9Xl7QswRNiHHDp36exQWveEFxQiCQTb1AlLgUGPW4Bsm+d+i3nuGLDLjFQWnmcuYmGoU3G6nnO/RjaziO39sEO/oLm1cu1WmyW99QwMzMtWXNExAOQnTT+ZwRfwj6Tumi5cSnIosnj6X6frmT2ePtxUBOCu1pflWOtEA== 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=f3gtJW+qT2QgAKXpLuB/j4jIp2NDFcfKLtK+lYc/el0=; b=PEOhniymQHEeJbPBgnESvdd8fRTEzdb/LNLtWdFEgfPJhxIlXYla0XqIrRVHQ9oHfSNrFayJUpClpPS74Zgvw5diWpBp4ixCgGbduzV9FQVWshDkNxaY0YSwdhJpkMrJE1Yz6DQuvLpMl6/ohlc43hIjiZn0xLoLuk3V9Xgvo2W/9GAT7DEOBk8tO/Xxiiyh2ZtMJGXLSof4Xh7rD4lPUwy8fhD3wnO3ZxgiaOqSvWaUBRBFnyKCFi/B4pQTsZnTaejyA/RLgrYz3d8giN3DHnA/qqJ7kYEI6wTYqPzOML5ZofOmqNuEA+lKCnolBZq+DcowGgML3T+kOHDFkP8ICQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:00 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:00 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 03/12] dt-bindings: net: add bindings for NETC blocks control Date: Wed, 30 Oct 2024 17:39:14 +0800 Message-Id: <20241030093924.1251343-4-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c0f6698-595f-400d-2f14-08dcf8c8eb38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?D7bJjb3xQIyZon1ZjC85oo9Df2hDJFEdQHfofatILyWsy3STfm/41pM4sABR?= =?us-ascii?Q?eA+tYuz2Q5EQjXW5tasrJzgCewplOYIBzXQERduIo626uRTAUV/8Yf8ZGddw?= =?us-ascii?Q?xYHYvCPLq+yMiEuyDRAF5HEK0V1nW4Wmoh5wBcVFaEYwBJj3hCA0WOSwWwRl?= =?us-ascii?Q?vpi1j40tbNCQhBCYOOHsTsqWM1ccB48KN1NwN3cuxgHagusAUTAqPDmUT+VU?= =?us-ascii?Q?Gcs7xyChjtljRktHFd0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q?yCx8njqT9A/8v+KD0ppEmCaYovQWX8McGnlT90PpPsdzwkKs57Fv75gvJy3D?= =?us-ascii?Q?qwpi7epbrnZkpbJ7UaJPou9mfxiGP4dnZYbqWFyEk5peErB8YMhNJHgJ/PXq?= =?us-ascii?Q?f7IVHJGglcjQeQvi1LDulAQXYWTAMlpTV0k9zi5W/WMCFvGksOL1GbDBcdSO?= =?us-ascii?Q?Ekko1ZMtbVItnq2T8RUOSd7lcrWGeQJ7u9KlFIIr3DOYaQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?D8MlbnQmyruiGqN4d/+1e6iHzlHlhCVgOAM7rrpreiktYSm0P15HCEy9LDkN?= =?us-ascii?Q?gj28gwnrIYNJv5DsGJNWaYf9e6cHMehYQZ/4Jd39+4VvmAG0ny9F9ZZcsIsS?= =?us-ascii?Q?w7MS7NCNC8zPCZYs7N6elVUiiwJPSyeUajsblm0Ba7VlMgx6rIKOGLLlnuVO?= =?us-ascii?Q?xyU3hHd0cKTFKR6PEOpOmY177oyaOUjfY65mg6MYE3+vLgbik07l7agqhlfX?= =?us-ascii?Q?TfQN0aHAn8MYoQb6tDCkXlpFVuzRvnIh4zqAbScw0bDa7WSeJPvgWRhNM8lT?= =?us-ascii?Q?eOK72nEGG3NVWgxOM/V5dNVpa5tFXYXmhxZwC7X+cPL361GWQ0ex71o3dstu?= =?us-ascii?Q?ucgHtmCuHeFTEjgnW/8BWh8mCpwxg0pcmUMreT0/W7RekbulaCbJL+WQ6nKg?= =?us-ascii?Q?Hun8RKFGj/2tq/bdTTtlNs0QHjBif6aBL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V2uYgfr3azOhdFAnS9xJp/RLY3V62n4RTZkpuWgyprz7QV4vV/on?= =?us-ascii?Q?kmh+iCRDckUWlZ6AHkKzv2I8nKTY8xaUtUcn6+AaUJRveFoLIAmdUpVhGg0J?= =?us-ascii?Q?o1hGbNDiwp/+W8xNE8IONb5J7Dgev5Y0p9kX8zsevDffTlul91MngADNLgyA?= =?us-ascii?Q?Y/1/FmqkdguBMP8+aXbU7OWpK95fY4c589YMODUq2avuwY06dnRQLbpU1cHb?= =?us-ascii?Q?YTkGDg8wFaK96uzgJ/G1BOZ1gt0TM2MNDlBq/Lez?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c0f6698-595f-400d-2f14-08dcf8c8eb38 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:00.5315 (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: aUGR9GWs6C76YUXPb185sMdOREoWCGpxYlGsL8p57yekqWlUAM3L5+6k3Hz8h04N2PzTmWTjJ3rsvYdCzFTx4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Content-Type: text/plain; charset="utf-8" Add bindings for NXP NETC blocks control. Usually, NETC has 2 blocks of 64KB registers, integrated endpoint register block (IERB) and privileged register block (PRB). IERB is used for pre-boot initialization for all NETC devices, such as ENETC, Timer, EMDIO and so on. And PRB controls global reset and global error handling for NETC. Moreover, for the i.MX platform, there is also a NETCMIX block for link configuration, such as MII protocol, PCS protocol, etc. Signed-off-by: Wei Fang Reviewed-by: Rob Herring (Arm) --- v6: no changes --- .../bindings/net/nxp,netc-blk-ctrl.yaml | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl= .yaml diff --git a/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml b= /Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml new file mode 100644 index 000000000000..97389fd5dbbf --- /dev/null +++ b/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml @@ -0,0 +1,104 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/nxp,netc-blk-ctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NETC Blocks Control + +description: + Usually, NETC has 2 blocks of 64KB registers, integrated endpoint regist= er + block (IERB) and privileged register block (PRB). IERB is used for pre-b= oot + initialization for all NETC devices, such as ENETC, Timer, EMIDO and so = on. + And PRB controls global reset and global error handling for NETC. Moreov= er, + for the i.MX platform, there is also a NETCMIX block for link configurat= ion, + such as MII protocol, PCS protocol, etc. + +maintainers: + - Wei Fang + - Clark Wang + +properties: + compatible: + enum: + - nxp,imx95-netc-blk-ctrl + + reg: + maxItems: 3 + + reg-names: + items: + - const: ierb + - const: prb + - const: netcmix + + "#address-cells": + const: 2 + + "#size-cells": + const: 2 + + ranges: true + + clocks: + maxItems: 1 + + clock-names: + items: + - const: ipg + + power-domains: + maxItems: 1 + +patternProperties: + "^pcie@[0-9a-f]+$": + $ref: /schemas/pci/host-generic-pci.yaml# + +required: + - compatible + - reg + - reg-names + - "#address-cells" + - "#size-cells" + - ranges + +additionalProperties: false + +examples: + - | + bus { + #address-cells =3D <2>; + #size-cells =3D <2>; + + system-controller@4cde0000 { + compatible =3D "nxp,imx95-netc-blk-ctrl"; + reg =3D <0x0 0x4cde0000 0x0 0x10000>, + <0x0 0x4cdf0000 0x0 0x10000>, + <0x0 0x4c81000c 0x0 0x18>; + reg-names =3D "ierb", "prb", "netcmix"; + #address-cells =3D <2>; + #size-cells =3D <2>; + ranges; + clocks =3D <&scmi_clk 98>; + clock-names =3D "ipg"; + power-domains =3D <&scmi_devpd 18>; + + pcie@4cb00000 { + compatible =3D "pci-host-ecam-generic"; + reg =3D <0x0 0x4cb00000 0x0 0x100000>; + #address-cells =3D <3>; + #size-cells =3D <2>; + device_type =3D "pci"; + bus-range =3D <0x1 0x1>; + ranges =3D <0x82000000 0x0 0x4cce0000 0x0 0x4cce0000 0x0= 0x20000 + 0xc2000000 0x0 0x4cd10000 0x0 0x4cd10000 0x0 0= x10000>; + + mdio@0,0 { + compatible =3D "pci1131,ee00"; + reg =3D <0x010000 0 0 0 0>; + #address-cells =3D <1>; + #size-cells =3D <0>; + }; + }; + }; + }; --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2053.outbound.protection.outlook.com [40.107.247.53]) (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 9DFE81E5016; Wed, 30 Oct 2024 09:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282113; cv=fail; b=e71457GN/sLEXp+xpUC3/KrVVM4Ybci+j80vtKSAM3Nv2h/eUl/GdyUuei2mCWkLNM+Q75a1qEH1lNCq3h7Y6SODVg+28BwRpxp8P0I96VCfCordaJlkYJmsXpQ47YHRFqpfiFdxhNL+Gt9WLYp0fQFqPWI3MT2asCFDMIEvsLw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282113; c=relaxed/simple; bh=wrv+kqkkPSZ6cvh0Xend1dn0/bI7PplICNknS9E+fQ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=aBiks3nKnWvtadHaesKGOCQeYL4PHzmKc4tJNMzfMGllVP++unk90xA7B1S4lz16O4zgDrdllo353z7CNZfitbnRGlWmAIw1vwzi/zL2ZZmK0YI79/WS1bEIDbXHeoxlBPXiNXzzfYKPY+JY09M3/go3Azl9nyCuOfiWoUMMqyE= 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=ZHmvG5Ek; arc=fail smtp.client-ip=40.107.247.53 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="ZHmvG5Ek" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MKvnybDrIl26jxRDOxHx+ubdHz0bkMs/YLlvuYN4olo7LZN4gGxq9qRRxt8KRBL1HDPQKym8Jzpc7GmHOOnAsVF8BKZzcERngFfKEmGrUwcZgYdzySyXepMMPinLKYCHqgtGgpiZZ9nctjW4bVkzewG55O9Og+353qA0fZNhHst2Lwp18Xbq8bJ51t6Mnr0GhUQ1uW6/jsTqZqOV42t3tiEo+7XkmdHzGsWZ58GAtIJxeJjej+x8RXRj2S7iVoJiHnveoXkskjLX0LDyvJBQuIlIoqeSaUvfpJdT1dmYCpvoovKETVs+JUbXVWuNcZoOHfG+3MtwVctB0BvgAMIaMg== 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=ARbD14h42wKT+hoa9jYlex8DCEdlnracvHxWNYQo0Vc=; b=zRaaqvOhp/ffI/9NBjM5fO4qQis9dDiuPlTZ38Zg8pVVAbsKHg1Vdx3uTjmzKfkNXynZuJApTAtuPOaT7b3/ZrRed5C6w01+sGQpp8aiOU/UV3vQ82qWmB6oD4F5Vv3K0zV33vQmVd6AvJz29OUtv6dMmGl6VDeNgeibw/U/sV2dZh4nN2smmcvowahw4VyJF8C5ZWbpuCaM3OF07dPbivoK8LlkZx5EF2OWV2DE8bVtiprYJoRmtP2cs0WGqYkoT9d1qMh0D0ZNtAv7inXVf1Haaq0p24zhKos9qae/m/nBjGlLwC+B6KhzR2DL4SyRpYO07Fjh6yS2/Nk/ld8Cng== 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=ARbD14h42wKT+hoa9jYlex8DCEdlnracvHxWNYQo0Vc=; b=ZHmvG5Ek5eNtu8xIJ+ufor5lbwCxdxuxA9HUM75KyvtMDhDy0vdNzyamjEokr9LqqXwsvVn+zq3XlPPWgWn3E8ntp/6CU3bDNh5QwkYZo11peSbMlx9gnjVDiad7Xyr+MbmdEROPysoZPNozTbUZJsCA0Qfgpw4HkAl5HodLvyJK1BNTdsOajMZU3eFKVCCwR933VZON7yvnM8r/iK0IvT9Qkf6pzUedV9AGihnI7YYJvJUzypsoXX9i3X7eQshsFVUT90Ka6A3n4WOq+nvx39pFW87UOty19WPpe7DBSS48GH1VdmVovg0FdsPL9WVWosFlNmAu2LOn2f1SlFvfeA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:06 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:06 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 04/12] net: enetc: add initial netc-blk-ctrl driver support Date: Wed, 30 Oct 2024 17:39:15 +0800 Message-Id: <20241030093924.1251343-5-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 97f6be59-d8e3-4c04-b90e-08dcf8c8eed2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?y72Eqvoixa9EY6UCPONxyaiDuMKMBl7HTGVTOGItea7ZO1BGzqjDzf6E5cGx?= =?us-ascii?Q?myxGM5kUAOyWgqQ60M3DJZ5hEsRrDf2DEWykNYfXA8ViNRxmFrSyKFRLW6w4?= =?us-ascii?Q?/6Li9vsAH+GnJ+ehjy78wx1rYxNFmqRTGkhvu6yxDdkjhWWpPFlxIQ7vMo2k?= =?us-ascii?Q?FkBUDERVznzrvn3DtMbRNDnPFvUtEgrjln7av4SXmo2kz3hEsZVtIPdwMfwb?= =?us-ascii?Q?0bHdfAzTYduSrp+C6ZsUEkqhfv2Ixs1yngg/Gdmv0THr8a72Mlsxfz5Qna/d?= =?us-ascii?Q?+HcXdvxIZxKMXdebz4+LgKGAo7a2px7jUX0iK6tKrrxVmdmgWaDKdiN47IGe?= =?us-ascii?Q?I7WdtonomgUCMKPkgZF1c5/c1wSg7HnW3Mj76lgg4wkoeKrSdxtt41vy+Pj7?= =?us-ascii?Q?z5uGD9a4ms76DKwoyLBAIj2vLGB9XcOIFkfwVxukHyokqR4Z/+3DTXQRXpib?= =?us-ascii?Q?bSsz/6CNb4D+fuH/7bHRJqisewFfNt7fpzlV3IcM6ihhPMofiE6IEPj9NI1b?= =?us-ascii?Q?qrSq866wPyV59lxtBQmM6PUmQi81timwruNUjnP+oLNzh0x9TnM0IE8FPHQ6?= =?us-ascii?Q?ZxopEjAEvbz5k1Es18IouZNOAhiVvygW9jNftzccF3t/dbUbEem3Q1+avWgG?= =?us-ascii?Q?dPIlw/SCt4Gn/r94NXPdDdFQTtOz6IFRIP6wpjzLZ6YjGQvAKhOqOfpfGmam?= =?us-ascii?Q?bwWjylKz27uMASEVSwac6Akx0+iWhr6fh6qwn0OuZNI6gWFAzvt4W00rbZXl?= =?us-ascii?Q?iKaAncElJPPWb+Spr65JVVw3WN6m7MkkU4xdk/8ghQI9u/SvIQFMOjMgQHV9?= =?us-ascii?Q?OzupHd/AtRMABzneSXqto751jcc2scJZvmGh4QyET8QhkkUcYNkO/svVp0Nl?= =?us-ascii?Q?yRrm7ZCZ6Q35E4yu7P/mNRUyVxNKl3852RQCZPvtDdXtcIerydxXI5OIXchC?= =?us-ascii?Q?8YmKytHxY/NzsZBcYLXw62vX7kQ0wxwfER7d/PvS2URmR4twgjJ7S7QG3H2B?= =?us-ascii?Q?3jXC8qQfd9dLNU8du5oEHOFdgQpcF4KSbGccdT5Yn9IGb2G3Ev01JuSlNWXB?= =?us-ascii?Q?hXz6BvY/XDWyZdMZZWa11zRujkrnZUEo4alE5i1bKwfgxtm98sSh/tM6IAGX?= =?us-ascii?Q?5WxtWTDoSdrfBVmoPDR5n4IXccKhmtgfku0CDrA8/DdUDbQ4fVujzhkkkaSO?= =?us-ascii?Q?Uf1yn05QXs103O46nYe7ztoEv+Bxvaud+JnHqjlx2WC4Y/DSZT4TRT/eUcCV?= =?us-ascii?Q?xZXg8R1AScIGi7BE+K03T/noWIsJjxHUV/J//WKVNa8wf35YPko8C3OCJi+d?= =?us-ascii?Q?A3Pgco8wvvFeuivt60eHVOoMzzbCaw+EJThZ1wFHnMUKz8wbW9Qg/w/xSgNO?= =?us-ascii?Q?po3c5FSEvOa00SMJHoOZrOG/Gk1d?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vy6Umd4q3DNXAJRIT0pfwpEM23xQfVLgPF3PtU400nSqCxtYxSRilsA1c4DO?= =?us-ascii?Q?g0GFRjeSYYSNM77ui3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=?us-ascii?Q?PD+yuzoJPTiEKS9sHLBcMDmf98jVm3euWTGrd6mwC2wDPCRWGxZKFchFYSs5?= =?us-ascii?Q?sX8It8wA5W+xpNRn23B6/gh8TRLkXGEhvbnPk27r+6xFQeHNRacIXIVxvkrD?= =?us-ascii?Q?SJUdWtz6yrx8PWLjhdtDgxJygoV1SwNlekarDgQdIKB3h5Ed9O7pYPK2Z8Ci?= =?us-ascii?Q?ev7LyQPWTvfvstxWLHkt/rSnWcObM6VJIh+V0huqXs4/dXqsciP8jRu9Pupx?= =?us-ascii?Q?fGM4WKKewZjYz6WygGuCCzTTy2si4ujiAfh+pSO2a0ymdLlNhoPoIEZR3Q4c?= =?us-ascii?Q?OOyT2vMzIIvZrwP/MYGvwWe6tVffL0CR1GH5KIZhFRxFQIy7rro/QPOeQf6L?= =?us-ascii?Q?8ACa+anKVQ+OCnQYVi8+iYHi6HrgaqVT8mfLGxY9z0jSUWZBXVWCbE0Twdq4?= =?us-ascii?Q?TKZdBFTU5ETWWBDPBbe1/mE2bXb0ovp6mdCDKPOwT8/5n3Ps6jFMD2VBE3GL?= =?us-ascii?Q?n63TJ0hhSNZ8qDQWBNEKj/KA4v9DXHLayivuuW/cLaTP3TOEip1VOtXaYlEF?= =?us-ascii?Q?Mq3aPmQig3LtfY98CVdA+pLknZC8jUKmeZnZF2xMioDu1VEGQpimuPAT1yKI?= =?us-ascii?Q?pUBielf/JWozQ+AwAAu8mLDJhfS0je3vZS29nGZq?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97f6be59-d8e3-4c04-b90e-08dcf8c8eed2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:06.6619 (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: iOJim/FYDjGT4hKw85SJnK6cKwTr1UNIF/oNC7jHnFtDqswGZVPywSx7wLctqP1eOxMj1D5pd2xsbKswmoh44w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Content-Type: text/plain; charset="utf-8" The netc-blk-ctrl driver is used to configure Integrated Endpoint Register Block (IERB) and Privileged Register Block (PRB) of NETC. For i.MX platforms, it is also used to configure the NETCMIX block. The IERB contains registers that are used for pre-boot initialization, debug, and non-customer configuration. The PRB controls global reset and global error handling for NETC. The NETCMIX block is mainly used to set MII protocol and PCS protocol of the links, it also contains settings for some other functions. Note the IERB configuration registers can only be written after being unlocked by PRB, otherwise, all write operations are inhibited. A warm reset is performed when the IERB is unlocked, and it results in an FLR to all NETC devices. Therefore, all NETC device drivers must be probed or initialized after the warm reset is finished. Signed-off-by: Wei Fang Reviewed-by: Frank Li --- v6: only add some opening comments at the beginning of netc_blk_ctrl.c --- drivers/net/ethernet/freescale/enetc/Kconfig | 14 + drivers/net/ethernet/freescale/enetc/Makefile | 3 + .../ethernet/freescale/enetc/netc_blk_ctrl.c | 445 ++++++++++++++++++ include/linux/fsl/netc_global.h | 19 + 4 files changed, 481 insertions(+) create mode 100644 drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c create mode 100644 include/linux/fsl/netc_global.h diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/eth= ernet/freescale/enetc/Kconfig index 4d75e6807e92..51d80ea959d4 100644 --- a/drivers/net/ethernet/freescale/enetc/Kconfig +++ b/drivers/net/ethernet/freescale/enetc/Kconfig @@ -75,3 +75,17 @@ config FSL_ENETC_QOS enable/disable from user space via Qos commands(tc). In the kernel side, it can be loaded by Qos driver. Currently, it is only support taprio(802.1Qbv) and Credit Based Shaper(802.1Qbu). + +config NXP_NETC_BLK_CTRL + tristate "NETC blocks control driver" + help + This driver configures Integrated Endpoint Register Block (IERB) and + Privileged Register Block (PRB) of NETC. For i.MX platforms, it also + includes the configuration of NETCMIX block. + The IERB contains registers that are used for pre-boot initialization, + debug, and non-customer configuration. The PRB controls global reset + and global error handling for NETC. The NETCMIX block is mainly used + to set MII protocol and PCS protocol of the links, it also contains + settings for some other functions. + + If compiled as module (M), the module name is nxp-netc-blk-ctrl. diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/et= hernet/freescale/enetc/Makefile index b13cbbabb2ea..737c32f83ea5 100644 --- a/drivers/net/ethernet/freescale/enetc/Makefile +++ b/drivers/net/ethernet/freescale/enetc/Makefile @@ -19,3 +19,6 @@ fsl-enetc-mdio-y :=3D enetc_pci_mdio.o enetc_mdio.o =20 obj-$(CONFIG_FSL_ENETC_PTP_CLOCK) +=3D fsl-enetc-ptp.o fsl-enetc-ptp-y :=3D enetc_ptp.o + +obj-$(CONFIG_NXP_NETC_BLK_CTRL) +=3D nxp-netc-blk-ctrl.o +nxp-netc-blk-ctrl-y :=3D netc_blk_ctrl.o diff --git a/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c b/drivers= /net/ethernet/freescale/enetc/netc_blk_ctrl.c new file mode 100644 index 000000000000..bcb8eefeb93c --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c @@ -0,0 +1,445 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * NXP NETC Blocks Control Driver + * + * Copyright 2024 NXP + * + * This driver is used for pre-initialization of NETC, such as PCS and MII + * protocols, LDID, warm reset, etc. Therefore, all NETC device drivers can + * only be probed after the netc-blk-crtl driver has completed initializat= ion. + * In addition, when the system enters suspend mode, IERB, PRB, and NETCMIX + * will be powered off, except for WOL. Therefore, when the system resumes, + * these blocks need to be reinitialized. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* NETCMIX registers */ +#define IMX95_CFG_LINK_IO_VAR 0x0 +#define IO_VAR_16FF_16G_SERDES 0x1 +#define IO_VAR(port, var) (((var) & 0xf) << ((port) << 2)) + +#define IMX95_CFG_LINK_MII_PROT 0x4 +#define CFG_LINK_MII_PORT_0 GENMASK(3, 0) +#define CFG_LINK_MII_PORT_1 GENMASK(7, 4) +#define MII_PROT_MII 0x0 +#define MII_PROT_RMII 0x1 +#define MII_PROT_RGMII 0x2 +#define MII_PROT_SERIAL 0x3 +#define MII_PROT(port, prot) (((prot) & 0xf) << ((port) << 2)) + +#define IMX95_CFG_LINK_PCS_PROT(a) (0x8 + (a) * 4) +#define PCS_PROT_1G_SGMII BIT(0) +#define PCS_PROT_2500M_SGMII BIT(1) +#define PCS_PROT_XFI BIT(3) +#define PCS_PROT_SFI BIT(4) +#define PCS_PROT_10G_SXGMII BIT(6) + +/* NETC privileged register block register */ +#define PRB_NETCRR 0x100 +#define NETCRR_SR BIT(0) +#define NETCRR_LOCK BIT(1) + +#define PRB_NETCSR 0x104 +#define NETCSR_ERROR BIT(0) +#define NETCSR_STATE BIT(1) + +/* NETC integrated endpoint register block register */ +#define IERB_EMDIOFAUXR 0x344 +#define IERB_T0FAUXR 0x444 +#define IERB_EFAUXR(a) (0x3044 + 0x100 * (a)) +#define IERB_VFAUXR(a) (0x4004 + 0x40 * (a)) +#define FAUXR_LDID GENMASK(3, 0) + +/* Platform information */ +#define IMX95_ENETC0_BUS_DEVFN 0x0 +#define IMX95_ENETC1_BUS_DEVFN 0x40 +#define IMX95_ENETC2_BUS_DEVFN 0x80 + +/* Flags for different platforms */ +#define NETC_HAS_NETCMIX BIT(0) + +struct netc_devinfo { + u32 flags; + int (*netcmix_init)(struct platform_device *pdev); + int (*ierb_init)(struct platform_device *pdev); +}; + +struct netc_blk_ctrl { + void __iomem *prb; + void __iomem *ierb; + void __iomem *netcmix; + + const struct netc_devinfo *devinfo; + struct platform_device *pdev; + struct dentry *debugfs_root; +}; + +static void netc_reg_write(void __iomem *base, u32 offset, u32 val) +{ + netc_write(base + offset, val); +} + +static u32 netc_reg_read(void __iomem *base, u32 offset) +{ + return netc_read(base + offset); +} + +static int netc_of_pci_get_bus_devfn(struct device_node *np) +{ + u32 reg[5]; + int error; + + error =3D of_property_read_u32_array(np, "reg", reg, ARRAY_SIZE(reg)); + if (error) + return error; + + return (reg[0] >> 8) & 0xffff; +} + +static int netc_get_link_mii_protocol(phy_interface_t interface) +{ + switch (interface) { + case PHY_INTERFACE_MODE_MII: + return MII_PROT_MII; + case PHY_INTERFACE_MODE_RMII: + return MII_PROT_RMII; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + return MII_PROT_RGMII; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_2500BASEX: + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_USXGMII: + return MII_PROT_SERIAL; + default: + return -EINVAL; + } +} + +static int imx95_netcmix_init(struct platform_device *pdev) +{ + struct netc_blk_ctrl *priv =3D platform_get_drvdata(pdev); + struct device_node *np =3D pdev->dev.of_node; + phy_interface_t interface; + int bus_devfn, mii_proto; + u32 val; + int err; + + /* Default setting of MII protocol */ + val =3D MII_PROT(0, MII_PROT_RGMII) | MII_PROT(1, MII_PROT_RGMII) | + MII_PROT(2, MII_PROT_SERIAL); + + /* Update the link MII protocol through parsing phy-mode */ + for_each_available_child_of_node_scoped(np, child) { + for_each_available_child_of_node_scoped(child, gchild) { + if (!of_device_is_compatible(gchild, "pci1131,e101")) + continue; + + bus_devfn =3D netc_of_pci_get_bus_devfn(gchild); + if (bus_devfn < 0) + return -EINVAL; + + if (bus_devfn =3D=3D IMX95_ENETC2_BUS_DEVFN) + continue; + + err =3D of_get_phy_mode(gchild, &interface); + if (err) + continue; + + mii_proto =3D netc_get_link_mii_protocol(interface); + if (mii_proto < 0) + return -EINVAL; + + switch (bus_devfn) { + case IMX95_ENETC0_BUS_DEVFN: + val =3D u32_replace_bits(val, mii_proto, + CFG_LINK_MII_PORT_0); + break; + case IMX95_ENETC1_BUS_DEVFN: + val =3D u32_replace_bits(val, mii_proto, + CFG_LINK_MII_PORT_1); + break; + default: + return -EINVAL; + } + } + } + + /* Configure Link I/O variant */ + netc_reg_write(priv->netcmix, IMX95_CFG_LINK_IO_VAR, + IO_VAR(2, IO_VAR_16FF_16G_SERDES)); + /* Configure Link 2 PCS protocol */ + netc_reg_write(priv->netcmix, IMX95_CFG_LINK_PCS_PROT(2), + PCS_PROT_10G_SXGMII); + netc_reg_write(priv->netcmix, IMX95_CFG_LINK_MII_PROT, val); + + return 0; +} + +static bool netc_ierb_is_locked(struct netc_blk_ctrl *priv) +{ + return !!(netc_reg_read(priv->prb, PRB_NETCRR) & NETCRR_LOCK); +} + +static int netc_lock_ierb(struct netc_blk_ctrl *priv) +{ + u32 val; + + netc_reg_write(priv->prb, PRB_NETCRR, NETCRR_LOCK); + + return read_poll_timeout(netc_reg_read, val, !(val & NETCSR_STATE), + 100, 2000, false, priv->prb, PRB_NETCSR); +} + +static int netc_unlock_ierb_with_warm_reset(struct netc_blk_ctrl *priv) +{ + u32 val; + + netc_reg_write(priv->prb, PRB_NETCRR, 0); + + return read_poll_timeout(netc_reg_read, val, !(val & NETCRR_LOCK), + 1000, 100000, true, priv->prb, PRB_NETCRR); +} + +static int imx95_ierb_init(struct platform_device *pdev) +{ + struct netc_blk_ctrl *priv =3D platform_get_drvdata(pdev); + + /* EMDIO : No MSI-X intterupt */ + netc_reg_write(priv->ierb, IERB_EMDIOFAUXR, 0); + /* ENETC0 PF */ + netc_reg_write(priv->ierb, IERB_EFAUXR(0), 0); + /* ENETC0 VF0 */ + netc_reg_write(priv->ierb, IERB_VFAUXR(0), 1); + /* ENETC0 VF1 */ + netc_reg_write(priv->ierb, IERB_VFAUXR(1), 2); + /* ENETC1 PF */ + netc_reg_write(priv->ierb, IERB_EFAUXR(1), 3); + /* ENETC1 VF0 */ + netc_reg_write(priv->ierb, IERB_VFAUXR(2), 5); + /* ENETC1 VF1 */ + netc_reg_write(priv->ierb, IERB_VFAUXR(3), 6); + /* ENETC2 PF */ + netc_reg_write(priv->ierb, IERB_EFAUXR(2), 4); + /* ENETC2 VF0 */ + netc_reg_write(priv->ierb, IERB_VFAUXR(4), 5); + /* ENETC2 VF1 */ + netc_reg_write(priv->ierb, IERB_VFAUXR(5), 6); + /* NETC TIMER */ + netc_reg_write(priv->ierb, IERB_T0FAUXR, 7); + + return 0; +} + +static int netc_ierb_init(struct platform_device *pdev) +{ + struct netc_blk_ctrl *priv =3D platform_get_drvdata(pdev); + const struct netc_devinfo *devinfo =3D priv->devinfo; + int err; + + if (netc_ierb_is_locked(priv)) { + err =3D netc_unlock_ierb_with_warm_reset(priv); + if (err) { + dev_err(&pdev->dev, "Unlock IERB failed.\n"); + return err; + } + } + + if (devinfo->ierb_init) { + err =3D devinfo->ierb_init(pdev); + if (err) + return err; + } + + err =3D netc_lock_ierb(priv); + if (err) { + dev_err(&pdev->dev, "Lock IERB failed.\n"); + return err; + } + + return 0; +} + +#if IS_ENABLED(CONFIG_DEBUG_FS) +static int netc_prb_show(struct seq_file *s, void *data) +{ + struct netc_blk_ctrl *priv =3D s->private; + u32 val; + + val =3D netc_reg_read(priv->prb, PRB_NETCRR); + seq_printf(s, "[PRB NETCRR] Lock:%d SR:%d\n", + (val & NETCRR_LOCK) ? 1 : 0, + (val & NETCRR_SR) ? 1 : 0); + + val =3D netc_reg_read(priv->prb, PRB_NETCSR); + seq_printf(s, "[PRB NETCSR] State:%d Error:%d\n", + (val & NETCSR_STATE) ? 1 : 0, + (val & NETCSR_ERROR) ? 1 : 0); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(netc_prb); + +static void netc_blk_ctrl_create_debugfs(struct netc_blk_ctrl *priv) +{ + struct dentry *root; + + root =3D debugfs_create_dir("netc_blk_ctrl", NULL); + if (IS_ERR(root)) + return; + + priv->debugfs_root =3D root; + + debugfs_create_file("prb", 0444, root, priv, &netc_prb_fops); +} + +static void netc_blk_ctrl_remove_debugfs(struct netc_blk_ctrl *priv) +{ + debugfs_remove_recursive(priv->debugfs_root); + priv->debugfs_root =3D NULL; +} + +#else + +static void netc_blk_ctrl_create_debugfs(struct netc_blk_ctrl *priv) +{ +} + +static void netc_blk_ctrl_remove_debugfs(struct netc_blk_ctrl *priv) +{ +} +#endif + +static int netc_prb_check_error(struct netc_blk_ctrl *priv) +{ + if (netc_reg_read(priv->prb, PRB_NETCSR) & NETCSR_ERROR) + return -1; + + return 0; +} + +static const struct netc_devinfo imx95_devinfo =3D { + .flags =3D NETC_HAS_NETCMIX, + .netcmix_init =3D imx95_netcmix_init, + .ierb_init =3D imx95_ierb_init, +}; + +static const struct of_device_id netc_blk_ctrl_match[] =3D { + { .compatible =3D "nxp,imx95-netc-blk-ctrl", .data =3D &imx95_devinfo }, + {}, +}; +MODULE_DEVICE_TABLE(of, netc_blk_ctrl_match); + +static int netc_blk_ctrl_probe(struct platform_device *pdev) +{ + struct device_node *node =3D pdev->dev.of_node; + const struct netc_devinfo *devinfo; + struct device *dev =3D &pdev->dev; + const struct of_device_id *id; + struct netc_blk_ctrl *priv; + struct clk *ipg_clk; + void __iomem *regs; + int err; + + priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->pdev =3D pdev; + ipg_clk =3D devm_clk_get_optional_enabled(dev, "ipg"); + if (IS_ERR(ipg_clk)) + return dev_err_probe(dev, PTR_ERR(ipg_clk), + "Set ipg clock failed\n"); + + id =3D of_match_device(netc_blk_ctrl_match, dev); + if (!id) + return dev_err_probe(dev, -EINVAL, "Cannot match device\n"); + + devinfo =3D (struct netc_devinfo *)id->data; + if (!devinfo) + return dev_err_probe(dev, -EINVAL, "No device information\n"); + + priv->devinfo =3D devinfo; + regs =3D devm_platform_ioremap_resource_byname(pdev, "ierb"); + if (IS_ERR(regs)) + return dev_err_probe(dev, PTR_ERR(regs), + "Missing IERB resource\n"); + + priv->ierb =3D regs; + regs =3D devm_platform_ioremap_resource_byname(pdev, "prb"); + if (IS_ERR(regs)) + return dev_err_probe(dev, PTR_ERR(regs), + "Missing PRB resource\n"); + + priv->prb =3D regs; + if (devinfo->flags & NETC_HAS_NETCMIX) { + regs =3D devm_platform_ioremap_resource_byname(pdev, "netcmix"); + if (IS_ERR(regs)) + return dev_err_probe(dev, PTR_ERR(regs), + "Missing NETCMIX resource\n"); + priv->netcmix =3D regs; + } + + platform_set_drvdata(pdev, priv); + if (devinfo->netcmix_init) { + err =3D devinfo->netcmix_init(pdev); + if (err) + return dev_err_probe(dev, err, + "Initializing NETCMIX failed\n"); + } + + err =3D netc_ierb_init(pdev); + if (err) + return dev_err_probe(dev, err, "Initializing IERB failed\n"); + + if (netc_prb_check_error(priv) < 0) + dev_warn(dev, "The current IERB configuration is invalid\n"); + + netc_blk_ctrl_create_debugfs(priv); + + err =3D of_platform_populate(node, NULL, NULL, dev); + if (err) { + netc_blk_ctrl_remove_debugfs(priv); + return dev_err_probe(dev, err, "of_platform_populate failed\n"); + } + + return 0; +} + +static void netc_blk_ctrl_remove(struct platform_device *pdev) +{ + struct netc_blk_ctrl *priv =3D platform_get_drvdata(pdev); + + of_platform_depopulate(&pdev->dev); + netc_blk_ctrl_remove_debugfs(priv); +} + +static struct platform_driver netc_blk_ctrl_driver =3D { + .driver =3D { + .name =3D "nxp-netc-blk-ctrl", + .of_match_table =3D netc_blk_ctrl_match, + }, + .probe =3D netc_blk_ctrl_probe, + .remove =3D netc_blk_ctrl_remove, +}; + +module_platform_driver(netc_blk_ctrl_driver); + +MODULE_DESCRIPTION("NXP NETC Blocks Control Driver"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/include/linux/fsl/netc_global.h b/include/linux/fsl/netc_globa= l.h new file mode 100644 index 000000000000..fdecca8c90f0 --- /dev/null +++ b/include/linux/fsl/netc_global.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* Copyright 2024 NXP + */ +#ifndef __NETC_GLOBAL_H +#define __NETC_GLOBAL_H + +#include + +static inline u32 netc_read(void __iomem *reg) +{ + return ioread32(reg); +} + +static inline void netc_write(void __iomem *reg, u32 val) +{ + iowrite32(val, reg); +} + +#endif --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2089.outbound.protection.outlook.com [40.107.247.89]) (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 9930A1E572F; Wed, 30 Oct 2024 09:55:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282119; cv=fail; b=i18cT5ca52vewybYa1FiyPyf520sIsPZPz270tPKS82s4TrfkfzrsE1p42gKXpOW8HmSf2s7wNqqRBvo0abOlEIHpWroTUxGrCNkLwp3untIXsnsKK7Iz98GlaEQ9yE4vBt6OeCyMhxjwUQPGt3U6U+T+zqsx6cE8VxrSrS0qWc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282119; c=relaxed/simple; bh=NDR7LnrQ5T15luvLkGYarvUzp0hF1MlcF1z9FzpC34w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=MjCKas4on0riHluJg+KcdQpsPHTsWwdgxJgVqTxNyCQKu+pO2g6hWtr5xdmSd7qGJat37xfON6A+OfEwvY/5oUEouIUVUpJOLAeAkQoc522YjmM7Zc9FebcgTHorqPmRR28/nM1+K/uUmwxN7QGb0e7Yl1+/gzIIEFFw1dCfxJ0= 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=m8SjvAgK; arc=fail smtp.client-ip=40.107.247.89 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="m8SjvAgK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MWycTAxpPFCfCAxVZHnKeyVuT7wYwNgmtfKcXD0hInxbQEb7NgWe2L5Ji9WyMj/9nYpAeDCjm2/HPRXfJK5zxohjtwRBcBtZ2c7mKdWCgUyRs7bBwtCilZBh4qAfJsTEoshdq2unRTLHVoGISwii5fLzFZdROJ5zsuzgbPahRCblJPCoEPVVQdZGdLfDsYhVBF5aNVgV6BndyHspNPWRwYXZ+OIULIukXs6uchpuCFYDwXdQ97qI6sLKqNacYb85vuWYwkh1vYzGHLBISKakyObUDJ5D6sH8JOpQik0irFbhCpFC+evm+p2H7U6WEfJUItlbZZlNeQ43V4Alv5UPLw== 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=dzEAYbuzQq7kWIaCobdlMT1UGL+EjI3oUibzL60t2iM=; b=L+43dDgcaiE5HnZ2nkwDA7iNm0U3DgiAah3Q4b6bmbEBF+uwfOTgS2aLAwfig55MXVKb9+rcdUzmB8Ow9NJDECJuXZSqdRajiczin2BtIFRS7vlQ3RwDGEISHNooKstzb1JnT1LDtHyw90kyxThtFDicy5U0jTfQQtGRfYV17mhD6boPvSzOkX/H0R1MVjAriN1bfX4mBU6TNln4QyoBwaRSWW5ZYGquOloBlnbddP/+8rBw9dQ7ppGDb4k6h4Gfherr8aUDG2gv6bPMid9DDYhz8ULy39hoFsDN8WnJPMBE8VCzm9W4f+UpN98O4GqfwitcxrpaBedCZsZ8q1bmBg== 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=dzEAYbuzQq7kWIaCobdlMT1UGL+EjI3oUibzL60t2iM=; b=m8SjvAgKP8CmTIb2CqaDKMIlXg+FDHv23XOnuqVECODjLmzB9utvReQ8T6pCJXbOCTl3niCDdod6bkCvCN+chxUaUMRv7WF2Kmsx+GoTOPhuI6FdEaoPDSOk8GmgvjVfDej8NWDSwYftZ0+FVPMnrIwFZBQVVJsQzrvb2zhdiXyj9pQ1Jrn0RXCdQ+JtegLA1jvkO0w5ngBrFF6qj7RB+TQdl7VNEhOxF0GJHPfssNbb79DZyuH3lnfBbCOKzlwuwaQCQay2S06tqVECzgOnMeFJbZruSdk2vdBCj4/HDpxvOVftHT6uJUv60XAThvBG+jJAZ7zxe3SojQMfzIOl0w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:12 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:12 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 05/12] net: enetc: extract common ENETC PF parts for LS1028A and i.MX95 platforms Date: Wed, 30 Oct 2024 17:39:16 +0800 Message-Id: <20241030093924.1251343-6-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 2880330b-7bc8-4160-9ce5-08dcf8c8f275 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?OtgKcFTaPn/9XfFE+Hol3PVLubkADjJb6AXNzWoE3Pyh5EAZZedI4uD4zRiE?= =?us-ascii?Q?JKhw8PUQf8VPNHX2a5D60/D/m9QUvmM+e2/YcTB32JRoK1lg1bMk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2tbsudMVu66OhhOptFRJvHRFPYtUVtCWUU/14V?= =?us-ascii?Q?/OhRoKCv9eUdFlEsbhmM8F/9OiAFSe4AdLOEXPzv49i/8ty0dLzYDY3XjtLb?= =?us-ascii?Q?XODiL7Jn7EhjPQ6rLCqMYPI4UmwoMIV9PAefyensKgFytlnwSmKeywi5RS02?= =?us-ascii?Q?2LDTGwcO5ehbIuWPsPWn6w4W5XBcGQF8+hh9rbGha9qCtj5sUi+lO+6KvEjC?= =?us-ascii?Q?vV+PFNoy7Qrpj0cuRCAqfhKeoaJeNUxZaYa0D5JXnWtze/qKc7MTMZqo9845?= =?us-ascii?Q?Xbv1NmCMfj/cuz+GGMCMJzgFE6TVmoKOnhsT+RW6GpJ9oglICcY40dBh8iMg?= =?us-ascii?Q?pXdmCYIuZWaJG7ve0gPXvzSFs5v25AhJH3JXfenX12CNC/fe/kS4dh05RfK4?= =?us-ascii?Q?TcsQgFVH4cMcBE7hj0pxiw1X+R1f?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7Vt2ZTa2dM2h7I/wBKEV6FheJPxbyt14DBZyVfmYaE/JlAiT4IxSLS/UKzKC?= =?us-ascii?Q?5betKfJ+PFtQItN9NmtytakIO+VPX/bqoJggeAKvgBAERffco0Un+68JAE0D?= =?us-ascii?Q?IxnVBW+oW/I1A1cbJuo1iR3LsdRtMGORvsSHzA+4pPIkHQVZro5FU78JsV1o?= =?us-ascii?Q?aHxZBzAZwbxOwhauVs4E9C/TKUy1QQptYh55TimVGrb5FWD1r1LCVx8LLH2r?= =?us-ascii?Q?YZwKnzreI6CHnYI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HdJO/Uela4RI?= =?us-ascii?Q?VckPewKuaEX+Xn4xdVSmPL9EvgEq98Eqj2SK+5Xhixn1LlxZr0Cn+Em9sdB+?= =?us-ascii?Q?XOPxV9+/lqThGJqojYpMpXhWJ1VhXYgdzjIukiGTLqfb34jygL0W5JmzWP18?= =?us-ascii?Q?yxWBdKB7IlG0EugfLm3MWQSdc/J5gZqCDEG+UjnL/rClP6tfFPx3oixURvZc?= =?us-ascii?Q?gdCah5PVhOH6AWYF/qDl+jyHweV2XQDI/hb5Yn62CH+gUTVml7z2GkTrTT0z?= =?us-ascii?Q?kbJZhbiYLnmbjrYMOw1X06iGRWaN0TZMCrbd8KtuPo/T0R0NfqDyhMSIfCaf?= =?us-ascii?Q?vsianTjSJo7BqVJ5eLBpONKkE0wq/lCeIhIvvDVrU0Mf6edZnHOlfqgb8TYe?= =?us-ascii?Q?f0fLVqluwWuU+aZvxy8SruzLT2+yz0NOvGloBA3Sy3j+htkwjQkJNZ0zxBUR?= =?us-ascii?Q?kcISzfQcLzwm/B7qpVVlU5ZdWWOCnBxJYkUp6mwU?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2880330b-7bc8-4160-9ce5-08dcf8c8f275 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:12.7514 (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: jPt8zz2uTZvviF4/MqRxMmCssXh0iJschePCRN0/cNfPGFDA0GWc9sgnfIqGpoG3txohdhOL92GRDAdATVJ/hg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Content-Type: text/plain; charset="utf-8" The ENETC PF driver of LS1028A (rev 1.0) is incompatible with the version used on the i.MX95 platform (rev 4.1), except for the station interface (SI) part. To reduce code redundancy and prepare for a new driver for rev 4.1 and later, extract shared interfaces from enetc_pf.c and move them to enetc_pf_common.c. This refactoring lays the groundwork for compiling enetc_pf_common.c into a shared driver for both platforms' PF drivers. Signed-off-by: Wei Fang --- v6:=20 1. add enetc_pf_common.h and put the prototypes of functions exported by enetc_pf_common.c into enetc_pf_common.h 2. add linux/of.h to enetc_pf.c due to undeclared function 'of_device_is_available' --- drivers/net/ethernet/freescale/enetc/Makefile | 2 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 300 +----------------- .../freescale/enetc/enetc_pf_common.c | 295 +++++++++++++++++ .../freescale/enetc/enetc_pf_common.h | 17 + 4 files changed, 319 insertions(+), 295 deletions(-) create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_pf_common.c create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_pf_common.h diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/et= hernet/freescale/enetc/Makefile index 737c32f83ea5..8f4d8e9c37a0 100644 --- a/drivers/net/ethernet/freescale/enetc/Makefile +++ b/drivers/net/ethernet/freescale/enetc/Makefile @@ -4,7 +4,7 @@ obj-$(CONFIG_FSL_ENETC_CORE) +=3D fsl-enetc-core.o fsl-enetc-core-y :=3D enetc.o enetc_cbdr.o enetc_ethtool.o =20 obj-$(CONFIG_FSL_ENETC) +=3D fsl-enetc.o -fsl-enetc-y :=3D enetc_pf.o +fsl-enetc-y :=3D enetc_pf.o enetc_pf_common.o fsl-enetc-$(CONFIG_PCI_IOV) +=3D enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) +=3D enetc_qos.o =20 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/= ethernet/freescale/enetc/enetc_pf.c index 8f6b0bf48139..36fc93725309 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -2,19 +2,17 @@ /* Copyright 2017-2019 NXP */ =20 #include -#include #include -#include +#include #include -#include #include #include #include "enetc_ierb.h" -#include "enetc_pf.h" +#include "enetc_pf_common.h" =20 #define ENETC_DRV_NAME_STR "ENETC PF driver" =20 -static void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 = *addr) +void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) { u32 upper =3D __raw_readl(hw->port + ENETC_PSIPMAR0(si)); u16 lower =3D __raw_readw(hw->port + ENETC_PSIPMAR1(si)); @@ -23,8 +21,8 @@ static void enetc_pf_get_primary_mac_addr(struct enetc_hw= *hw, int si, u8 *addr) put_unaligned_le16(lower, addr + 4); } =20 -static void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, - const u8 *addr) +void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, + const u8 *addr) { u32 upper =3D get_unaligned_le32(addr); u16 lower =3D get_unaligned_le16(addr + 4); @@ -33,20 +31,6 @@ static void enetc_pf_set_primary_mac_addr(struct enetc_h= w *hw, int si, __raw_writew(lower, hw->port + ENETC_PSIPMAR1(si)); } =20 -static int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) -{ - struct enetc_ndev_priv *priv =3D netdev_priv(ndev); - struct sockaddr *saddr =3D addr; - - if (!is_valid_ether_addr(saddr->sa_data)) - return -EADDRNOTAVAIL; - - eth_hw_addr_set(ndev, saddr->sa_data); - enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data); - - return 0; -} - static void enetc_set_vlan_promisc(struct enetc_hw *hw, char si_map) { u32 val =3D enetc_port_rd(hw, ENETC_PSIPVMR); @@ -393,56 +377,6 @@ static int enetc_pf_set_vf_spoofchk(struct net_device = *ndev, int vf, bool en) return 0; } =20 -static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf= *pf, - int si) -{ - struct device *dev =3D &pf->si->pdev->dev; - struct enetc_hw *hw =3D &pf->si->hw; - u8 mac_addr[ETH_ALEN] =3D { 0 }; - int err; - - /* (1) try to get the MAC address from the device tree */ - if (np) { - err =3D of_get_mac_address(np, mac_addr); - if (err =3D=3D -EPROBE_DEFER) - return err; - } - - /* (2) bootloader supplied MAC address */ - if (is_zero_ether_addr(mac_addr)) - enetc_pf_get_primary_mac_addr(hw, si, mac_addr); - - /* (3) choose a random one */ - if (is_zero_ether_addr(mac_addr)) { - eth_random_addr(mac_addr); - dev_info(dev, "no MAC address specified for SI%d, using %pM\n", - si, mac_addr); - } - - enetc_pf_set_primary_mac_addr(hw, si, mac_addr); - - return 0; -} - -static int enetc_setup_mac_addresses(struct device_node *np, - struct enetc_pf *pf) -{ - int err, i; - - /* The PF might take its MAC from the device tree */ - err =3D enetc_setup_mac_address(np, pf, 0); - if (err) - return err; - - for (i =3D 0; i < pf->total_vfs; i++) { - err =3D enetc_setup_mac_address(NULL, pf, i + 1); - if (err) - return err; - } - - return 0; -} - static void enetc_port_assign_rfs_entries(struct enetc_si *si) { struct enetc_pf *pf =3D enetc_si_priv(si); @@ -775,187 +709,6 @@ static const struct net_device_ops enetc_ndev_ops =3D= { .ndo_xdp_xmit =3D enetc_xdp_xmit, }; =20 -static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *= ndev, - const struct net_device_ops *ndev_ops) -{ - struct enetc_ndev_priv *priv =3D netdev_priv(ndev); - - SET_NETDEV_DEV(ndev, &si->pdev->dev); - priv->ndev =3D ndev; - priv->si =3D si; - priv->dev =3D &si->pdev->dev; - si->ndev =3D ndev; - - priv->msg_enable =3D (NETIF_MSG_WOL << 1) - 1; - ndev->netdev_ops =3D ndev_ops; - enetc_set_ethtool_ops(ndev); - ndev->watchdog_timeo =3D 5 * HZ; - ndev->max_mtu =3D ENETC_MAX_MTU; - - ndev->hw_features =3D NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK | - NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; - ndev->features =3D NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; - ndev->vlan_features =3D NETIF_F_SG | NETIF_F_HW_CSUM | - NETIF_F_TSO | NETIF_F_TSO6; - - if (si->num_rss) - ndev->hw_features |=3D NETIF_F_RXHASH; - - ndev->priv_flags |=3D IFF_UNICAST_FLT; - ndev->xdp_features =3D NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | - NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | - NETDEV_XDP_ACT_NDO_XMIT_SG; - - if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { - priv->active_offloads |=3D ENETC_F_QCI; - ndev->features |=3D NETIF_F_HW_TC; - ndev->hw_features |=3D NETIF_F_HW_TC; - } - - /* pick up primary MAC address from SI */ - enetc_load_primary_mac_addr(&si->hw, ndev); -} - -static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np) -{ - struct device *dev =3D &pf->si->pdev->dev; - struct enetc_mdio_priv *mdio_priv; - struct mii_bus *bus; - int err; - - bus =3D devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); - if (!bus) - return -ENOMEM; - - bus->name =3D "Freescale ENETC MDIO Bus"; - bus->read =3D enetc_mdio_read_c22; - bus->write =3D enetc_mdio_write_c22; - bus->read_c45 =3D enetc_mdio_read_c45; - bus->write_c45 =3D enetc_mdio_write_c45; - bus->parent =3D dev; - mdio_priv =3D bus->priv; - mdio_priv->hw =3D &pf->si->hw; - mdio_priv->mdio_base =3D ENETC_EMDIO_BASE; - snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev)); - - err =3D of_mdiobus_register(bus, np); - if (err) - return dev_err_probe(dev, err, "cannot register MDIO bus\n"); - - pf->mdio =3D bus; - - return 0; -} - -static void enetc_mdio_remove(struct enetc_pf *pf) -{ - if (pf->mdio) - mdiobus_unregister(pf->mdio); -} - -static int enetc_imdio_create(struct enetc_pf *pf) -{ - struct device *dev =3D &pf->si->pdev->dev; - struct enetc_mdio_priv *mdio_priv; - struct phylink_pcs *phylink_pcs; - struct mii_bus *bus; - int err; - - bus =3D mdiobus_alloc_size(sizeof(*mdio_priv)); - if (!bus) - return -ENOMEM; - - bus->name =3D "Freescale ENETC internal MDIO Bus"; - bus->read =3D enetc_mdio_read_c22; - bus->write =3D enetc_mdio_write_c22; - bus->read_c45 =3D enetc_mdio_read_c45; - bus->write_c45 =3D enetc_mdio_write_c45; - bus->parent =3D dev; - bus->phy_mask =3D ~0; - mdio_priv =3D bus->priv; - mdio_priv->hw =3D &pf->si->hw; - mdio_priv->mdio_base =3D ENETC_PM_IMDIO_BASE; - snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); - - err =3D mdiobus_register(bus); - if (err) { - dev_err(dev, "cannot register internal MDIO bus (%d)\n", err); - goto free_mdio_bus; - } - - phylink_pcs =3D lynx_pcs_create_mdiodev(bus, 0); - if (IS_ERR(phylink_pcs)) { - err =3D PTR_ERR(phylink_pcs); - dev_err(dev, "cannot create lynx pcs (%d)\n", err); - goto unregister_mdiobus; - } - - pf->imdio =3D bus; - pf->pcs =3D phylink_pcs; - - return 0; - -unregister_mdiobus: - mdiobus_unregister(bus); -free_mdio_bus: - mdiobus_free(bus); - return err; -} - -static void enetc_imdio_remove(struct enetc_pf *pf) -{ - if (pf->pcs) - lynx_pcs_destroy(pf->pcs); - if (pf->imdio) { - mdiobus_unregister(pf->imdio); - mdiobus_free(pf->imdio); - } -} - -static bool enetc_port_has_pcs(struct enetc_pf *pf) -{ - return (pf->if_mode =3D=3D PHY_INTERFACE_MODE_SGMII || - pf->if_mode =3D=3D PHY_INTERFACE_MODE_1000BASEX || - pf->if_mode =3D=3D PHY_INTERFACE_MODE_2500BASEX || - pf->if_mode =3D=3D PHY_INTERFACE_MODE_USXGMII); -} - -static int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *n= ode) -{ - struct device_node *mdio_np; - int err; - - mdio_np =3D of_get_child_by_name(node, "mdio"); - if (mdio_np) { - err =3D enetc_mdio_probe(pf, mdio_np); - - of_node_put(mdio_np); - if (err) - return err; - } - - if (enetc_port_has_pcs(pf)) { - err =3D enetc_imdio_create(pf); - if (err) { - enetc_mdio_remove(pf); - return err; - } - } - - return 0; -} - -static void enetc_mdiobus_destroy(struct enetc_pf *pf) -{ - enetc_mdio_remove(pf); - enetc_imdio_remove(pf); -} - static struct phylink_pcs * enetc_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t ifa= ce) { @@ -1101,47 +854,6 @@ static const struct phylink_mac_ops enetc_mac_phylink= _ops =3D { .mac_link_down =3D enetc_pl_mac_link_down, }; =20 -static int enetc_phylink_create(struct enetc_ndev_priv *priv, - struct device_node *node) -{ - struct enetc_pf *pf =3D enetc_si_priv(priv->si); - struct phylink *phylink; - int err; - - pf->phylink_config.dev =3D &priv->ndev->dev; - pf->phylink_config.type =3D PHYLINK_NETDEV; - pf->phylink_config.mac_capabilities =3D MAC_ASYM_PAUSE | MAC_SYM_PAUSE | - MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD; - - __set_bit(PHY_INTERFACE_MODE_INTERNAL, - pf->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_SGMII, - pf->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_1000BASEX, - pf->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_2500BASEX, - pf->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_USXGMII, - pf->phylink_config.supported_interfaces); - phy_interface_set_rgmii(pf->phylink_config.supported_interfaces); - - phylink =3D phylink_create(&pf->phylink_config, of_fwnode_handle(node), - pf->if_mode, &enetc_mac_phylink_ops); - if (IS_ERR(phylink)) { - err =3D PTR_ERR(phylink); - return err; - } - - priv->phylink =3D phylink; - - return 0; -} - -static void enetc_phylink_destroy(struct enetc_ndev_priv *priv) -{ - phylink_destroy(priv->phylink); -} - /* Initialize the entire shared memory for the flow steering entries * of this port (PF + VFs) */ @@ -1338,7 +1050,7 @@ static int enetc_pf_probe(struct pci_dev *pdev, if (err) goto err_mdiobus_create; =20 - err =3D enetc_phylink_create(priv, node); + err =3D enetc_phylink_create(priv, node, &enetc_mac_phylink_ops); if (err) goto err_phylink_create; =20 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drive= rs/net/ethernet/freescale/enetc/enetc_pf_common.c new file mode 100644 index 000000000000..925011b16563 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -0,0 +1,295 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2024 NXP */ + +#include +#include +#include +#include + +#include "enetc_pf_common.h" + +int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) +{ + struct enetc_ndev_priv *priv =3D netdev_priv(ndev); + struct sockaddr *saddr =3D addr; + + if (!is_valid_ether_addr(saddr->sa_data)) + return -EADDRNOTAVAIL; + + eth_hw_addr_set(ndev, saddr->sa_data); + enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data); + + return 0; +} + +static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf= *pf, + int si) +{ + struct device *dev =3D &pf->si->pdev->dev; + struct enetc_hw *hw =3D &pf->si->hw; + u8 mac_addr[ETH_ALEN] =3D { 0 }; + int err; + + /* (1) try to get the MAC address from the device tree */ + if (np) { + err =3D of_get_mac_address(np, mac_addr); + if (err =3D=3D -EPROBE_DEFER) + return err; + } + + /* (2) bootloader supplied MAC address */ + if (is_zero_ether_addr(mac_addr)) + enetc_pf_get_primary_mac_addr(hw, si, mac_addr); + + /* (3) choose a random one */ + if (is_zero_ether_addr(mac_addr)) { + eth_random_addr(mac_addr); + dev_info(dev, "no MAC address specified for SI%d, using %pM\n", + si, mac_addr); + } + + enetc_pf_set_primary_mac_addr(hw, si, mac_addr); + + return 0; +} + +int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf) +{ + int err, i; + + /* The PF might take its MAC from the device tree */ + err =3D enetc_setup_mac_address(np, pf, 0); + if (err) + return err; + + for (i =3D 0; i < pf->total_vfs; i++) { + err =3D enetc_setup_mac_address(NULL, pf, i + 1); + if (err) + return err; + } + + return 0; +} + +void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, + const struct net_device_ops *ndev_ops) +{ + struct enetc_ndev_priv *priv =3D netdev_priv(ndev); + + SET_NETDEV_DEV(ndev, &si->pdev->dev); + priv->ndev =3D ndev; + priv->si =3D si; + priv->dev =3D &si->pdev->dev; + si->ndev =3D ndev; + + priv->msg_enable =3D (NETIF_MSG_WOL << 1) - 1; + ndev->netdev_ops =3D ndev_ops; + enetc_set_ethtool_ops(ndev); + ndev->watchdog_timeo =3D 5 * HZ; + ndev->max_mtu =3D ENETC_MAX_MTU; + + ndev->hw_features =3D NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK | + NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; + ndev->features =3D NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; + ndev->vlan_features =3D NETIF_F_SG | NETIF_F_HW_CSUM | + NETIF_F_TSO | NETIF_F_TSO6; + + if (si->num_rss) + ndev->hw_features |=3D NETIF_F_RXHASH; + + ndev->priv_flags |=3D IFF_UNICAST_FLT; + ndev->xdp_features =3D NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | + NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | + NETDEV_XDP_ACT_NDO_XMIT_SG; + + if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { + priv->active_offloads |=3D ENETC_F_QCI; + ndev->features |=3D NETIF_F_HW_TC; + ndev->hw_features |=3D NETIF_F_HW_TC; + } + + /* pick up primary MAC address from SI */ + enetc_load_primary_mac_addr(&si->hw, ndev); +} + +static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np) +{ + struct device *dev =3D &pf->si->pdev->dev; + struct enetc_mdio_priv *mdio_priv; + struct mii_bus *bus; + int err; + + bus =3D devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); + if (!bus) + return -ENOMEM; + + bus->name =3D "Freescale ENETC MDIO Bus"; + bus->read =3D enetc_mdio_read_c22; + bus->write =3D enetc_mdio_write_c22; + bus->read_c45 =3D enetc_mdio_read_c45; + bus->write_c45 =3D enetc_mdio_write_c45; + bus->parent =3D dev; + mdio_priv =3D bus->priv; + mdio_priv->hw =3D &pf->si->hw; + mdio_priv->mdio_base =3D ENETC_EMDIO_BASE; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev)); + + err =3D of_mdiobus_register(bus, np); + if (err) + return dev_err_probe(dev, err, "cannot register MDIO bus\n"); + + pf->mdio =3D bus; + + return 0; +} + +static void enetc_mdio_remove(struct enetc_pf *pf) +{ + if (pf->mdio) + mdiobus_unregister(pf->mdio); +} + +static int enetc_imdio_create(struct enetc_pf *pf) +{ + struct device *dev =3D &pf->si->pdev->dev; + struct enetc_mdio_priv *mdio_priv; + struct phylink_pcs *phylink_pcs; + struct mii_bus *bus; + int err; + + bus =3D mdiobus_alloc_size(sizeof(*mdio_priv)); + if (!bus) + return -ENOMEM; + + bus->name =3D "Freescale ENETC internal MDIO Bus"; + bus->read =3D enetc_mdio_read_c22; + bus->write =3D enetc_mdio_write_c22; + bus->read_c45 =3D enetc_mdio_read_c45; + bus->write_c45 =3D enetc_mdio_write_c45; + bus->parent =3D dev; + bus->phy_mask =3D ~0; + mdio_priv =3D bus->priv; + mdio_priv->hw =3D &pf->si->hw; + mdio_priv->mdio_base =3D ENETC_PM_IMDIO_BASE; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); + + err =3D mdiobus_register(bus); + if (err) { + dev_err(dev, "cannot register internal MDIO bus (%d)\n", err); + goto free_mdio_bus; + } + + phylink_pcs =3D lynx_pcs_create_mdiodev(bus, 0); + if (IS_ERR(phylink_pcs)) { + err =3D PTR_ERR(phylink_pcs); + dev_err(dev, "cannot create lynx pcs (%d)\n", err); + goto unregister_mdiobus; + } + + pf->imdio =3D bus; + pf->pcs =3D phylink_pcs; + + return 0; + +unregister_mdiobus: + mdiobus_unregister(bus); +free_mdio_bus: + mdiobus_free(bus); + return err; +} + +static void enetc_imdio_remove(struct enetc_pf *pf) +{ + if (pf->pcs) + lynx_pcs_destroy(pf->pcs); + + if (pf->imdio) { + mdiobus_unregister(pf->imdio); + mdiobus_free(pf->imdio); + } +} + +static bool enetc_port_has_pcs(struct enetc_pf *pf) +{ + return (pf->if_mode =3D=3D PHY_INTERFACE_MODE_SGMII || + pf->if_mode =3D=3D PHY_INTERFACE_MODE_1000BASEX || + pf->if_mode =3D=3D PHY_INTERFACE_MODE_2500BASEX || + pf->if_mode =3D=3D PHY_INTERFACE_MODE_USXGMII); +} + +int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node) +{ + struct device_node *mdio_np; + int err; + + mdio_np =3D of_get_child_by_name(node, "mdio"); + if (mdio_np) { + err =3D enetc_mdio_probe(pf, mdio_np); + + of_node_put(mdio_np); + if (err) + return err; + } + + if (enetc_port_has_pcs(pf)) { + err =3D enetc_imdio_create(pf); + if (err) { + enetc_mdio_remove(pf); + return err; + } + } + + return 0; +} + +void enetc_mdiobus_destroy(struct enetc_pf *pf) +{ + enetc_mdio_remove(pf); + enetc_imdio_remove(pf); +} + +int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node = *node, + const struct phylink_mac_ops *ops) +{ + struct enetc_pf *pf =3D enetc_si_priv(priv->si); + struct phylink *phylink; + int err; + + pf->phylink_config.dev =3D &priv->ndev->dev; + pf->phylink_config.type =3D PHYLINK_NETDEV; + pf->phylink_config.mac_capabilities =3D MAC_ASYM_PAUSE | MAC_SYM_PAUSE | + MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD; + + __set_bit(PHY_INTERFACE_MODE_INTERNAL, + pf->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, + pf->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + pf->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, + pf->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_USXGMII, + pf->phylink_config.supported_interfaces); + phy_interface_set_rgmii(pf->phylink_config.supported_interfaces); + + phylink =3D phylink_create(&pf->phylink_config, of_fwnode_handle(node), + pf->if_mode, ops); + if (IS_ERR(phylink)) { + err =3D PTR_ERR(phylink); + return err; + } + + priv->phylink =3D phylink; + + return 0; +} + +void enetc_phylink_destroy(struct enetc_ndev_priv *priv) +{ + phylink_destroy(priv->phylink); +} diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h b/drive= rs/net/ethernet/freescale/enetc/enetc_pf_common.h new file mode 100644 index 000000000000..2ae9c87c8c8a --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* Copyright 2024 NXP */ + +#include "enetc_pf.h" + +void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr); +void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, + const u8 *addr); +int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr); +int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf); +void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, + const struct net_device_ops *ndev_ops); +int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node); +void enetc_mdiobus_destroy(struct enetc_pf *pf); +int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node = *node, + const struct phylink_mac_ops *ops); +void enetc_phylink_destroy(struct enetc_ndev_priv *priv); --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2084.outbound.protection.outlook.com [40.107.249.84]) (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 579361E5016; Wed, 30 Oct 2024 09:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282125; cv=fail; b=dlXBNOzPV7vFE+EdzYyAWNXS8BFeYNMu1QXmpkCjgjCTfc/lnCSt4s7BB2oP3xPiSJl5rsYf35jmyIPNtDHg8HU+N+uVL2n0cduf3ZtoaJ6oKmOOu/2plooGHhfqPG/MswryTDOuyZCEC4xwbX5U/zUcxmI8cN7a5hWPNliqT+8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282125; c=relaxed/simple; bh=YS2XdplDiXW/5w49ve1q91uIog8nXZXg8WS0hMduREY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=mRYL5WCw7tUBMq97I1o8HmeTyeN/G3QFzyfQ525cUySVaDN3Ya/sGwYNzcMmhpbv8gQWdh3UZT8oStYwtvgGVJW3aaudVq7I59FmWAWi5ab5hMUqyCcoypqeVAKFxkaaihqnXzVoFXUGyJt2sqtCNcA0WL8s6/xwR3aGli2N89M= 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=M4fYGNtl; arc=fail smtp.client-ip=40.107.249.84 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="M4fYGNtl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kb5nZVpqg7ZrbaH71v3MGU9iOyD+n2lqOkisEtqZa3nwB+zA+3qk99ULB6mQoXKsGTPEOVbQlRdkLQhk9cAnmC5bFN82cuZ6apfMeQVRYBur6qwLOMzxztKeZN7UmziV4+sOx92YTSBPNhoWCm/051fHxUeK0fbDiVwur94Z0BvVbBHLMXGO+VnCkkyK8BkOCteWuBMl7aqFnCr1JoCBoYs7pKjJv0fngcXbArMvZ9rraW2R6yNfz1Yj6qb/xMgqUBrLoh40f+TV5GjmrztOVRuZ0UZXaCqjabMrFHZgk9XchQIZZy3ouyGapKjXKrSmSxFWC+/s+lF60LWmsVwK5Q== 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=mJZ2mRnHJXen3PuDRZoqky66nAAg2vjUnvzzmEgF6Nk=; b=D9njqXFKps5WWBCAutitdCXFB2MWILghe0LtUeTGwYXEhKlSLEj60eDPRowwZNi3mSgmstIkHfLVQN41pwYMHLRISGkPdKz2JFnvadXcSaW5x4JToowdVWGgqstpthTvuA6uQvy6FM/aN1eP4kRgcBNlvx0//zDeW8viSjv1FSUCzXUToiHiiKUIbNNYxoGvLLYibZLiBnbniW3FI1J0v2+b71Q8Zpo8iuDrjxo+b0omEvrG+5t9Y3knw4ZtbV97qxbE2XD6Da0i3u1DjkWP7CbsJ3vjgBmxqI9WyX21IV7wr++p87DMDJ1sOZDmo1TKwhWZb9y5zuUjelF7QaXfMw== 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=mJZ2mRnHJXen3PuDRZoqky66nAAg2vjUnvzzmEgF6Nk=; b=M4fYGNtl+VkdBAw7Rv7MvU0TIHEOIBCvjegaOLjfrh/gBLwADAaILoy+KfyrL+lNh2N0L6sggJwkypYSceCnQExJzN0o9Heje9VkqCXKSrccFG/1cstwg6Ney1nBC3rMPXDL+09bVsfQxGULfkiUx2Xgyn1Xbjjoa09BHaivfUian2L0Z2bLDwhwH+ZBPYWdpl2jFqVOv8HS5TC6fLU66S357OSI0yEYJqwjSAhNNNOf/6zRZNTK5sfRWdmz41d7KezmPOQrCcdYQnWcW8yaL5AX3OMk+OJjK8K7Om5WhsjYzQKn4X3thiqWjGWrHKMlGZsBnszskbqryxGEXiaZbQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:19 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:19 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 06/12] net: enetc: build enetc_pf_common.c as a separate module Date: Wed, 30 Oct 2024 17:39:17 +0800 Message-Id: <20241030093924.1251343-7-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 8108af12-f642-4581-c48c-08dcf8c8f677 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?l/Wux0CLfAVPuNDUZvokCVAlzwaH1dq9AQW7rVwHJtVtEW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Q8O1O8R3iVIW8jxi+db2vqMhLwtQwbbBxcMWlxNlRIm05Ft1U8D?= =?us-ascii?Q?YA2ZSDx2tMtIV/7Tjco1zmddU7jU9ZbvXC0y1OL+TszgoiNAS3Tr+V1IOkgY?= =?us-ascii?Q?FUhpMFelmyYow1FYkV997upmBp/iiddlslKnPPIVK3f2VusrW33ujqWMP+HX?= =?us-ascii?Q?wjiHFtDbgYyTeG6bFkOnAoxgv4OZDx8Zm+Z+sBZ4OGVo4EBMnm+ZVJIqEJ9e?= =?us-ascii?Q?KZ0yWPrFkqM8rOmUHYZfR1Np+efzUNWQTMkIqwxawX+LYLOjmGQgFqXRSWIC?= =?us-ascii?Q?UWbWatqSttEzkkKHjDPiZLGWCdLRolQ1Rj5Taj4ycAr98yjooH22ttwHlh2i?= =?us-ascii?Q?nfUrSr2kuPzahFpYqvn03RRRiQuw/GTazr6b6QvVv2eVo/txNrf4uQZc8EuY?= =?us-ascii?Q?7Zc5yO9pmZA87Ir7DCrZT+qjGVyA4OsF0tLuYHRLzsTqpRgoBQrJ4/a0Blp5?= =?us-ascii?Q?mMCl7bf3IMQ25vfFh2I2oQ2NQUdx?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NjOBQEbHLtJ41uDyAR1bRFvCxO31M8yEF1jWiBVhQVDGaGNXY3LKm6MGdoCb?= =?us-ascii?Q?iW8F/6W3TPOxvRqcwDKdN2Gig31bve3j/55YCdo3GiIGQT1FJ8czsJHxAsoM?= =?us-ascii?Q?pQjueXEe9Eq8WPGGeRgXgWMndv57TIT/KzKjnvrpDh6kF1Bwia86Zwf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5bQ5j7VBZQgkLaHornb7x9rR5Y0y4T5OI5/OH/45PGbYooNCU?= =?us-ascii?Q?1GGoDCCa6IrcvVeFPAK5qQEYBVFvEJW6Z1JO9XCgt5GJF9xBoVx0wkGPVBDt?= =?us-ascii?Q?jl3nb/JHWLKCXbfxM+R4xQgFU8EoxcvLwHEeCoe/TccfxDc65TpalDxvOCmG?= =?us-ascii?Q?TjMDb+q1Q6gLIsYeJTuolo7OQCcg9//PqBIxckNOtdeJpQ4fg5/1w5myUuN3?= =?us-ascii?Q?f10nf33oN5vJjTFQrHeZ/YoboLkB+UCEwr+qivaOLc/i8HyUogD9taGrvjY2?= =?us-ascii?Q?DP4Pzhqql9z6xfa/awL8LSedxpbQubvgytGtFZCCAXBAjSF6atY5zmEqygHz?= =?us-ascii?Q?OiTruVKbSXy68pK8DQN5ZjM3TzB6N7sz9eKarPh9jmYuEuF8hpiA9DwagjL0?= =?us-ascii?Q?mQXtRnKZtXrNAADXhISM5MLsj+78K4F70G2Xrmw7rgeqZ+JWqUOmDOjZqQzF?= =?us-ascii?Q?pkDXTyRp2+oIHmsB7KG6HyROapbnIoLLBmJ5JuC8BwEkHIxp4IT1WywJk/oc?= =?us-ascii?Q?6WQDNJ6QucaDRYtBnhiTLbwcSP/ThixVpdEtyCIj?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8108af12-f642-4581-c48c-08dcf8c8f677 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:19.4867 (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: V1lXNS+ETTV50gISGmv7qGA1bf4vsTJanTBRF+JZTqFUTCQ5GUgNZARl6mzXqqyPP419A+EaVVhvVTP3HX9RPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Content-Type: text/plain; charset="utf-8" Compile enetc_pf_common.c as a standalone module to allow shared usage between ENETC v1 and v4 PF drivers. Add struct enetc_pf_ops to register different hardware operation interfaces for both ENETC v1 and v4 PF drivers. Signed-off-by: Wei Fang --- v6: 1. remove enetc_pf_ops_register() 2. do not check enetc_pf_ops::set_si_primary_mac() and enetc_pf_ops::get_si_primary_mac(), because both enetc v1 and v4 drivers supports them 3. add enetc_get_si_hw_addr() 4. add dev_err() message if pf->ops->create_pcs() is NULL --- drivers/net/ethernet/freescale/enetc/Kconfig | 9 ++++ drivers/net/ethernet/freescale/enetc/Makefile | 5 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 26 ++++++++-- .../net/ethernet/freescale/enetc/enetc_pf.h | 12 +++++ .../freescale/enetc/enetc_pf_common.c | 50 +++++++++++++++---- .../freescale/enetc/enetc_pf_common.h | 3 -- 6 files changed, 89 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/eth= ernet/freescale/enetc/Kconfig index 51d80ea959d4..e1b151a98b41 100644 --- a/drivers/net/ethernet/freescale/enetc/Kconfig +++ b/drivers/net/ethernet/freescale/enetc/Kconfig @@ -7,6 +7,14 @@ config FSL_ENETC_CORE =20 If compiled as module (M), the module name is fsl-enetc-core. =20 +config NXP_ENETC_PF_COMMON + tristate + help + This module supports common functionality between drivers of + different versions of NXP ENETC PF controllers. + + If compiled as module (M), the module name is nxp-enetc-pf-common. + config FSL_ENETC tristate "ENETC PF driver" depends on PCI_MSI @@ -14,6 +22,7 @@ config FSL_ENETC select FSL_ENETC_CORE select FSL_ENETC_IERB select FSL_ENETC_MDIO + select NXP_ENETC_PF_COMMON select PHYLINK select PCS_LYNX select DIMLIB diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/et= hernet/freescale/enetc/Makefile index 8f4d8e9c37a0..ebe232673ed4 100644 --- a/drivers/net/ethernet/freescale/enetc/Makefile +++ b/drivers/net/ethernet/freescale/enetc/Makefile @@ -3,8 +3,11 @@ obj-$(CONFIG_FSL_ENETC_CORE) +=3D fsl-enetc-core.o fsl-enetc-core-y :=3D enetc.o enetc_cbdr.o enetc_ethtool.o =20 +obj-$(CONFIG_NXP_ENETC_PF_COMMON) +=3D nxp-enetc-pf-common.o +nxp-enetc-pf-common-y :=3D enetc_pf_common.o + obj-$(CONFIG_FSL_ENETC) +=3D fsl-enetc.o -fsl-enetc-y :=3D enetc_pf.o enetc_pf_common.o +fsl-enetc-y :=3D enetc_pf.o fsl-enetc-$(CONFIG_PCI_IOV) +=3D enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) +=3D enetc_qos.o =20 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/= ethernet/freescale/enetc/enetc_pf.c index 36fc93725309..1ff9a7a3386c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -12,7 +12,7 @@ =20 #define ENETC_DRV_NAME_STR "ENETC PF driver" =20 -void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) +static void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 = *addr) { u32 upper =3D __raw_readl(hw->port + ENETC_PSIPMAR0(si)); u16 lower =3D __raw_readw(hw->port + ENETC_PSIPMAR1(si)); @@ -21,8 +21,8 @@ void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, i= nt si, u8 *addr) put_unaligned_le16(lower, addr + 4); } =20 -void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, - const u8 *addr) +static void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, + const u8 *addr) { u32 upper =3D get_unaligned_le32(addr); u16 lower =3D get_unaligned_le16(addr + 4); @@ -31,6 +31,17 @@ void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, = int si, __raw_writew(lower, hw->port + ENETC_PSIPMAR1(si)); } =20 +static struct phylink_pcs *enetc_pf_create_pcs(struct enetc_pf *pf, + struct mii_bus *bus) +{ + return lynx_pcs_create_mdiodev(bus, 0); +} + +static void enetc_pf_destroy_pcs(struct phylink_pcs *pcs) +{ + lynx_pcs_destroy(pcs); +} + static void enetc_set_vlan_promisc(struct enetc_hw *hw, char si_map) { u32 val =3D enetc_port_rd(hw, ENETC_PSIPVMR); @@ -971,6 +982,14 @@ static void enetc_psi_destroy(struct pci_dev *pdev) enetc_pci_remove(pdev); } =20 +static const struct enetc_pf_ops enetc_pf_ops =3D { + .set_si_primary_mac =3D enetc_pf_set_primary_mac_addr, + .get_si_primary_mac =3D enetc_pf_get_primary_mac_addr, + .create_pcs =3D enetc_pf_create_pcs, + .destroy_pcs =3D enetc_pf_destroy_pcs, + .enable_psfp =3D enetc_psfp_enable, +}; + static int enetc_pf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -998,6 +1017,7 @@ static int enetc_pf_probe(struct pci_dev *pdev, pf =3D enetc_si_priv(si); pf->si =3D si; pf->total_vfs =3D pci_sriov_get_totalvfs(pdev); + pf->ops =3D &enetc_pf_ops; =20 err =3D enetc_setup_mac_addresses(node, pf); if (err) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/= ethernet/freescale/enetc/enetc_pf.h index c26bd66e4597..53d20752aacf 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -28,6 +28,16 @@ struct enetc_vf_state { enum enetc_vf_flags flags; }; =20 +struct enetc_pf; + +struct enetc_pf_ops { + void (*set_si_primary_mac)(struct enetc_hw *hw, int si, const u8 *addr); + void (*get_si_primary_mac)(struct enetc_hw *hw, int si, u8 *addr); + struct phylink_pcs *(*create_pcs)(struct enetc_pf *pf, struct mii_bus *bu= s); + void (*destroy_pcs)(struct phylink_pcs *pcs); + int (*enable_psfp)(struct enetc_ndev_priv *priv); +}; + struct enetc_pf { struct enetc_si *si; int num_vfs; /* number of active VFs, after sriov_init */ @@ -50,6 +60,8 @@ struct enetc_pf { =20 phy_interface_t if_mode; struct phylink_config phylink_config; + + const struct enetc_pf_ops *ops; }; =20 #define phylink_to_enetc_pf(config) \ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drive= rs/net/ethernet/freescale/enetc/enetc_pf_common.c index 925011b16563..e95252e898ae 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -4,29 +4,44 @@ #include #include #include -#include =20 #include "enetc_pf_common.h" =20 +static void enetc_set_si_hw_addr(struct enetc_pf *pf, int si, + const u8 *mac_addr) +{ + struct enetc_hw *hw =3D &pf->si->hw; + + pf->ops->set_si_primary_mac(hw, si, mac_addr); +} + +static void enetc_get_si_hw_addr(struct enetc_pf *pf, int si, u8 *mac_addr) +{ + struct enetc_hw *hw =3D &pf->si->hw; + + pf->ops->get_si_primary_mac(hw, si, mac_addr); +} + int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) { struct enetc_ndev_priv *priv =3D netdev_priv(ndev); + struct enetc_pf *pf =3D enetc_si_priv(priv->si); struct sockaddr *saddr =3D addr; =20 if (!is_valid_ether_addr(saddr->sa_data)) return -EADDRNOTAVAIL; =20 eth_hw_addr_set(ndev, saddr->sa_data); - enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data); + enetc_set_si_hw_addr(pf, 0, saddr->sa_data); =20 return 0; } +EXPORT_SYMBOL_GPL(enetc_pf_set_mac_addr); =20 static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf= *pf, int si) { struct device *dev =3D &pf->si->pdev->dev; - struct enetc_hw *hw =3D &pf->si->hw; u8 mac_addr[ETH_ALEN] =3D { 0 }; int err; =20 @@ -39,7 +54,7 @@ static int enetc_setup_mac_address(struct device_node *np= , struct enetc_pf *pf, =20 /* (2) bootloader supplied MAC address */ if (is_zero_ether_addr(mac_addr)) - enetc_pf_get_primary_mac_addr(hw, si, mac_addr); + enetc_get_si_hw_addr(pf, si, mac_addr); =20 /* (3) choose a random one */ if (is_zero_ether_addr(mac_addr)) { @@ -48,7 +63,7 @@ static int enetc_setup_mac_address(struct device_node *np= , struct enetc_pf *pf, si, mac_addr); } =20 - enetc_pf_set_primary_mac_addr(hw, si, mac_addr); + enetc_set_si_hw_addr(pf, si, mac_addr); =20 return 0; } @@ -70,11 +85,13 @@ int enetc_setup_mac_addresses(struct device_node *np, s= truct enetc_pf *pf) =20 return 0; } +EXPORT_SYMBOL_GPL(enetc_setup_mac_addresses); =20 void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, const struct net_device_ops *ndev_ops) { struct enetc_ndev_priv *priv =3D netdev_priv(ndev); + struct enetc_pf *pf =3D enetc_si_priv(si); =20 SET_NETDEV_DEV(ndev, &si->pdev->dev); priv->ndev =3D ndev; @@ -107,7 +124,8 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct = net_device *ndev, NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | NETDEV_XDP_ACT_NDO_XMIT_SG; =20 - if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { + if (si->hw_features & ENETC_SI_F_PSFP && pf->ops->enable_psfp && + !pf->ops->enable_psfp(priv)) { priv->active_offloads |=3D ENETC_F_QCI; ndev->features |=3D NETIF_F_HW_TC; ndev->hw_features |=3D NETIF_F_HW_TC; @@ -116,6 +134,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct = net_device *ndev, /* pick up primary MAC address from SI */ enetc_load_primary_mac_addr(&si->hw, ndev); } +EXPORT_SYMBOL_GPL(enetc_pf_netdev_setup); =20 static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np) { @@ -162,6 +181,12 @@ static int enetc_imdio_create(struct enetc_pf *pf) struct mii_bus *bus; int err; =20 + if (!pf->ops->create_pcs) { + dev_err(dev, "Creating PCS is not supported\n"); + + return -EOPNOTSUPP; + } + bus =3D mdiobus_alloc_size(sizeof(*mdio_priv)); if (!bus) return -ENOMEM; @@ -184,7 +209,7 @@ static int enetc_imdio_create(struct enetc_pf *pf) goto free_mdio_bus; } =20 - phylink_pcs =3D lynx_pcs_create_mdiodev(bus, 0); + phylink_pcs =3D pf->ops->create_pcs(pf, bus); if (IS_ERR(phylink_pcs)) { err =3D PTR_ERR(phylink_pcs); dev_err(dev, "cannot create lynx pcs (%d)\n", err); @@ -205,8 +230,8 @@ static int enetc_imdio_create(struct enetc_pf *pf) =20 static void enetc_imdio_remove(struct enetc_pf *pf) { - if (pf->pcs) - lynx_pcs_destroy(pf->pcs); + if (pf->pcs && pf->ops->destroy_pcs) + pf->ops->destroy_pcs(pf->pcs); =20 if (pf->imdio) { mdiobus_unregister(pf->imdio); @@ -246,12 +271,14 @@ int enetc_mdiobus_create(struct enetc_pf *pf, struct = device_node *node) =20 return 0; } +EXPORT_SYMBOL_GPL(enetc_mdiobus_create); =20 void enetc_mdiobus_destroy(struct enetc_pf *pf) { enetc_mdio_remove(pf); enetc_imdio_remove(pf); } +EXPORT_SYMBOL_GPL(enetc_mdiobus_destroy); =20 int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node = *node, const struct phylink_mac_ops *ops) @@ -288,8 +315,13 @@ int enetc_phylink_create(struct enetc_ndev_priv *priv,= struct device_node *node, =20 return 0; } +EXPORT_SYMBOL_GPL(enetc_phylink_create); =20 void enetc_phylink_destroy(struct enetc_ndev_priv *priv) { phylink_destroy(priv->phylink); } +EXPORT_SYMBOL_GPL(enetc_phylink_destroy); + +MODULE_DESCRIPTION("NXP ENETC PF common functionality driver"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h b/drive= rs/net/ethernet/freescale/enetc/enetc_pf_common.h index 2ae9c87c8c8a..964d4f53806b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h @@ -3,9 +3,6 @@ =20 #include "enetc_pf.h" =20 -void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr); -void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, - const u8 *addr); int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr); int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf); void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2047.outbound.protection.outlook.com [40.107.247.47]) (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 644FF1E882E; Wed, 30 Oct 2024 09:55:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282131; cv=fail; b=QOP0936F4bFkAHnxzkF2MAmOFafTChmdtW3wBfvIwd+pnzglua94Hq8XT/vfdb4XENaCsgBbN1HE4syE0pfObf9GYKVo3H81MfjVG/VwsaX+vIMSYK7vmsoo905xA2mRBoghJfsoyjcBBkoossVzDFX3apgxvr3xaErO6Ie8bUY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282131; c=relaxed/simple; bh=LoUsaxQvi5J2FenkG0OgttwaDu0kjbKp1DRV2sJvJZc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=aIek+B4Cq6oHoBFHd0ufL/Ov1+XYsI82yK2TzHAcrKf9jk3AbzxLudidct/4mk2GdzTlpHFG5PhjujlnFV6OW9gsECG3MQ7eq9E4xLulI/cZ8n7Pa/MReGkm6MEep5aOjkH5dNqu4hykPdYiJgnueh3KZx31Ne7xf7IwPwyNtaU= 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=mFbldHw+; arc=fail smtp.client-ip=40.107.247.47 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="mFbldHw+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pk6yQc1NHW2Ru+6OCKtXxN4o4jeDefvcBoQkNmF3r0Zhg7f4do213cY1Dbe+fF6xwdO3YGlkBMnWv+xpGPk0dkwd82vh0xyTJIaLw8LAd9mbfadid/iM60A75rjtYs20srQrBleu0BTPw/SqDiSpIFU3vx5Qolx8YT0yQWhZuO5C0QnedYP+mIAaCn6tgWmDOBUMKteNk+viystBVRXQ+2lHB1p9qy/khQgEymK73MnGCYsDXfZ9sPH+9zOjTBvXwoF3qYiO7N2Yn+pvNGnVXrynGdlnE0bjxosCYYVz5F43K3a2VuU+9CL7CpB6TWypu34N7eu/ZCwt6cFEE8DCdw== 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=6qGdonxkWsA0PHrlZn2YAzdO0pw9VKF0Ky5FzaXdeNQ=; b=fF6IxnIghux+x1nVfyQzLGtRPTFWUPRAx5cImSzTCsOr8aWkqSXwxITFrNZxEvHwWJo9VF1zZ1GIA0G6RLNsYKJpPpDQgb2LJY4tlXQlVWJZKy1cj5zrnCrwUEVp4gHvo5p9kDyRr2gjl06Ev0Zb5YRdgUIP2jKuFxdQrqrAYeRA/l+BO/VpdemATE9xysLzptvrGLBXYS2VIvbqidZxs5KZw3BLqXrLCSF9VZbb2Kpp9USvgbOnOZxSYquy+mSMmjSrDmxK7Exx03Pe8DOsHNtTtoLF0EDgbz6Mwwj5g3DTWy3Lbzwm5vmR96UEMbX7zHbzUPkCdCcgB2X3tpM51Q== 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=6qGdonxkWsA0PHrlZn2YAzdO0pw9VKF0Ky5FzaXdeNQ=; b=mFbldHw+tYgVSjEO2XNoBx959OxQ9jKXKgL2Fu6wqNuNwYpATIJZwbCmeyBKWgM8PQq8fGErqtCWiEep+ZKiMyey9DLMxEhK5jKUnsEwwOTNSPYnROysnP88Aomec8LnZfn2NQhGfxZ1W7m5cYYCjwLtnOzBPmLF6jbTmoyp8I2yJxSSnhog5dbPlJWb89kFx3dmpz81PZT4XKEk00YGM71FuzA1e9fArvreJ4j27/fWcry12YL/suqjpZqMu8RAUPUNSHQwJVbodYyAH+qRK5tNvJSMzVuBi1lgl0CltBuBwp6FwagWyoIeoAkk3AGD2w4l80C2SpmDj3e7ELtnOw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:25 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:25 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 07/12] net: enetc: remove ERR050089 workaround for i.MX95 Date: Wed, 30 Oct 2024 17:39:18 +0800 Message-Id: <20241030093924.1251343-8-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: d03f02bc-2390-4b65-b173-08dcf8c8fa4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?l7kwhRFcLU6xc0clJHUHSG6vsoc3BoKxlYQavQgnedJXwWG/Q6roq80qRvlf?= =?us-ascii?Q?7oJ1SGe1flS2f/uxGcNdl5IatP8e2VMv/xnG8+8EHDkUo2kPezd+pB7paBtC?= =?us-ascii?Q?6H6BMKu37eEw9A6h9maj45ezR7pPpAiUj9u3TsjdW4qihmHseyxdqYs9Nq4G?= =?us-ascii?Q?KxTACwnubOWLhenZ/ZNaJu/bqkUxNS1zNDjrKmS4iglSdQZttcANR1eIqbJk?= =?us-ascii?Q?QkRfOX4pssMPymb3KEBQDR0Q3p9G9b4zHwn4XqV35LHUsBE4mfgMmh9wKH0k?= =?us-ascii?Q?D9PnpEiiY7GxhHFhpVj6qszwUN0aWZI2Ju2j6LV7Xz+upn3pjfKBAjln3i1j?= =?us-ascii?Q?oy5RzA4SdjxHacuXko1wJk7rU7OknUyXX3FKT51+fcjNnGZgOGgBu0DWpRlD?= =?us-ascii?Q?hzmNCXAjoWbKGHVD7+hUj/H1Mly5a8BoBbzz5tELexn8GyJd/e7DkIuY9Myw?= =?us-ascii?Q?UaNRIVZ/RyWNVFDd4nnjRSH3sU9R2jMSYlaFcqnzmRzaOSd21nTJI9B+kwxS?= =?us-ascii?Q?Iss1aPeOAh/NpKCeQtvn+EshzhpoTZErqyNkWUrOU95LTG8axm1l3hPbwj1F?= =?us-ascii?Q?F3ivE9s/+hTsKkrliQig6E4AxCBHOQWgcBz2YI+ni3vGrSyBfObUP6d4HNty?= =?us-ascii?Q?z3XceZpzeSk+c+YcL55ZhWqniN2e9uNyXsp5BE6LnpMFwNyVnoGjHigd0yYL?= =?us-ascii?Q?nmsjgtVU0t3xHP7c8azL3aZLM/KmO6h9cNP2pi0yQMevjGcSLwZ/yW4C3d6B?= =?us-ascii?Q?dV2lpmF1BPhcBqEKfKAtihfdR6t5DncWh9b49QQ0uEQ46IFJG/dhHr2PR0M6?= =?us-ascii?Q?JozVinDonCSISf0hlST3ZrT4ql/DUJOk7RdGX669CVy72o10NSrS2RyedCir?= =?us-ascii?Q?95Vupzoa51ND/W4bGBmYzWAHqhL1+HVA/E1dqcBfy7Fb3XTKlB6DDgdaxExT?= =?us-ascii?Q?LxNpaNUn1d9/SsPG+gmsVsMMlxdlwvXLCzus2rmKS3wuMzsB9ai4tM2gmCs0?= =?us-ascii?Q?rxsx9TmPaHRHWQGgvi7c0Kuy1buFXGh6rYxT+SLFTKPvWapO0NB7AAVTHr68?= =?us-ascii?Q?cewQZfIGeKWFS5ly8JzXCtsRsRgY+XnZBaCGZVPHbtxIbH09tmqYV4rSSTYY?= =?us-ascii?Q?czZMrELSZx4U0zCDmPEZ9kQOnoHNQpkso0HmXMmIdeMe3gR5VFbDyZdAgJli?= =?us-ascii?Q?BaRvGg3C0/TV+I3yW+IgSwNDBrZ6HfV9NZc0G0lhuEitZAMra4XZ8idw/udw?= =?us-ascii?Q?Sju5UCqpDwwkY1iMaoQubWNVxUsMFmFX4rbKTOnul2L54jtI/NEh+koIPO5K?= =?us-ascii?Q?jmZHIwk38pWTPwHup4q9FioJG+My0MET9idJ/NAxPkklvLIWuVwDQFDHMSoJ?= =?us-ascii?Q?UDIzlmBCADUb6xvlm3mb5VlE6x1J?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1NHb9UVewLxIq2lHqtfr80ZI7xZT8lISNXDKcdr4MsjuRTpDlxXo0lQ5O+Qz?= =?us-ascii?Q?1aZqeDPM3JO0MF4G2AaAN9zDZRO3QjMikvfScE5FBBc5qqUk2AFb3KfACaCo?= =?us-ascii?Q?qsUFHc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us-ascii?Q?kXjnaxekHpA0ENs1GKE0LQj9FaBsCtOhCAxkBu8TRuR64nepJQlTsfvCnVoz?= =?us-ascii?Q?KpRlyFfobzw0jR2B8jzjzUPWJI3ON1l2e4KNbX+6DQz0byCq3Ssz+CRMc4wP?= =?us-ascii?Q?P3FAEnmWO6oNqarCKeE4Z9AT4Nov+z9tbd3n/O8MXLxaecdwFp+CGTCte9Ys?= =?us-ascii?Q?7O8zTiq+qTXrKmHPUgDybQkbrYSOEQrevkqd0BLJahSWN+9vM6PMd7/Q7khM?= =?us-ascii?Q?LkJ3+AlRr73rlW6+G7rxXHe+HH1ZlOQ+qpd9qeL58wRLhHuV3GVxWeeFiKaD?= =?us-ascii?Q?h6dPbtLf361F2s50w04juZiK2PMTHOCEnwWdoNItKbpcWUWdtKmgTXqMAoL9?= =?us-ascii?Q?dDvZygBAgRWcweStMz6j6z4ZLmwj6whi+qOu5h3a8wU/5eIsr9CDJMhQlNsw?= =?us-ascii?Q?4EQ+UQ31HbE2pMyL8HnDO8PwTeIrJOD35AR0FDDNGk17t59Vbyr70Y5FvzkU?= =?us-ascii?Q?hHpd1EXJ83Vlpr8v4Mt0dHKnvSeNcr73i7H673rPk8Nguw0r6Ds+beABzLS8?= =?us-ascii?Q?G4pQNiHL+X8Qc5/pt8Pq8GgEKoCNs4vbjB2aQueD?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d03f02bc-2390-4b65-b173-08dcf8c8fa4b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:25.8169 (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: ZY0pv/rcJkCUpXLCIRPIUE7aAHwK0l8Zx6Itch/t84HYCU8IfpupXaUzPLfMzumELsRrAbokkYmuOlz0aaT/zA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean The ERR050089 workaround causes performance degradation and potential functional issues (e.g., RCU stalls) under certain workloads. Since new SoCs like i.MX95 do not require this workaround, use a static key to compile out enetc_lock_mdio() and enetc_unlock_mdio() at runtime, improving performance and avoiding unnecessary logic. Signed-off-by: Vladimir Oltean Signed-off-by: Wei Fang --- v6: 1. add helper functions to enable/disable the static key 2. disable the static key if of_mdiobus_register() returns error --- .../net/ethernet/freescale/enetc/enetc_hw.h | 34 +++++++++++++------ .../ethernet/freescale/enetc/enetc_pci_mdio.c | 28 +++++++++++++++ 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/= ethernet/freescale/enetc/enetc_hw.h index 1619943fb263..6a7b9b75d660 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -396,18 +396,22 @@ struct enetc_hw { */ extern rwlock_t enetc_mdio_lock; =20 +DECLARE_STATIC_KEY_FALSE(enetc_has_err050089); + /* use this locking primitive only on the fast datapath to * group together multiple non-MDIO register accesses to * minimize the overhead of the lock */ static inline void enetc_lock_mdio(void) { - read_lock(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + read_lock(&enetc_mdio_lock); } =20 static inline void enetc_unlock_mdio(void) { - read_unlock(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + read_unlock(&enetc_mdio_lock); } =20 /* use these accessors only on the fast datapath under @@ -416,14 +420,16 @@ static inline void enetc_unlock_mdio(void) */ static inline u32 enetc_rd_reg_hot(void __iomem *reg) { - lockdep_assert_held(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + lockdep_assert_held(&enetc_mdio_lock); =20 return ioread32(reg); } =20 static inline void enetc_wr_reg_hot(void __iomem *reg, u32 val) { - lockdep_assert_held(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + lockdep_assert_held(&enetc_mdio_lock); =20 iowrite32(val, reg); } @@ -452,9 +458,13 @@ static inline u32 _enetc_rd_mdio_reg_wa(void __iomem *= reg) unsigned long flags; u32 val; =20 - write_lock_irqsave(&enetc_mdio_lock, flags); - val =3D ioread32(reg); - write_unlock_irqrestore(&enetc_mdio_lock, flags); + if (static_branch_unlikely(&enetc_has_err050089)) { + write_lock_irqsave(&enetc_mdio_lock, flags); + val =3D ioread32(reg); + write_unlock_irqrestore(&enetc_mdio_lock, flags); + } else { + val =3D ioread32(reg); + } =20 return val; } @@ -463,9 +473,13 @@ static inline void _enetc_wr_mdio_reg_wa(void __iomem = *reg, u32 val) { unsigned long flags; =20 - write_lock_irqsave(&enetc_mdio_lock, flags); - iowrite32(val, reg); - write_unlock_irqrestore(&enetc_mdio_lock, flags); + if (static_branch_unlikely(&enetc_has_err050089)) { + write_lock_irqsave(&enetc_mdio_lock, flags); + iowrite32(val, reg); + write_unlock_irqrestore(&enetc_mdio_lock, flags); + } else { + iowrite32(val, reg); + } } =20 #ifdef ioread64 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/driver= s/net/ethernet/freescale/enetc/enetc_pci_mdio.c index a1b595bd7993..e178cd9375a1 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c @@ -9,6 +9,28 @@ #define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus" #define ENETC_MDIO_DRV_NAME ENETC_MDIO_DEV_NAME " driver" =20 +DEFINE_STATIC_KEY_FALSE(enetc_has_err050089); +EXPORT_SYMBOL_GPL(enetc_has_err050089); + +static void enetc_emdio_enable_err050089(struct pci_dev *pdev) +{ + if (pdev->vendor =3D=3D PCI_VENDOR_ID_FREESCALE && + pdev->device =3D=3D ENETC_MDIO_DEV_ID) { + static_branch_inc(&enetc_has_err050089); + dev_info(&pdev->dev, "Enabled ERR050089 workaround\n"); + } +} + +static void enetc_emdio_disable_err050089(struct pci_dev *pdev) +{ + if (pdev->vendor =3D=3D PCI_VENDOR_ID_FREESCALE && + pdev->device =3D=3D ENETC_MDIO_DEV_ID) { + static_branch_dec(&enetc_has_err050089); + if (!static_key_enabled(&enetc_has_err050089.key)) + dev_info(&pdev->dev, "Disabled ERR050089 workaround\n"); + } +} + static int enetc_pci_mdio_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -62,6 +84,8 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, goto err_pci_mem_reg; } =20 + enetc_emdio_enable_err050089(pdev); + err =3D of_mdiobus_register(bus, dev->of_node); if (err) goto err_mdiobus_reg; @@ -71,6 +95,7 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, return 0; =20 err_mdiobus_reg: + enetc_emdio_disable_err050089(pdev); pci_release_region(pdev, 0); err_pci_mem_reg: pci_disable_device(pdev); @@ -88,6 +113,9 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev) struct enetc_mdio_priv *mdio_priv; =20 mdiobus_unregister(bus); + + enetc_emdio_disable_err050089(pdev); + mdio_priv =3D bus->priv; iounmap(mdio_priv->hw->port); pci_release_region(pdev, 0); --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012060.outbound.protection.outlook.com [52.101.66.60]) (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 8D8381E3784; Wed, 30 Oct 2024 09:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282136; cv=fail; b=FKj/GlokuBrhzN8ajVQEuQNbT9WlknzggcQTD5/YYfBXqW3gVSUd7wdMLoMBXLQ7cW26gsiyJJNtkZIAQXGAXX5Dbshp8MqurW6WGnxl5+4P1PDOTVDuP57unoW4VZfSaOPLtGjLw3f/X/W+ECrsw5aUSk2gJ0Dbz3YJ4unCvJA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282136; c=relaxed/simple; bh=hyRnsl5jU+Vel0B3sgQD+sox0n8z29Fr7D20Gkk2bo8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=epUCGutTXE97Kr22lsdDe5lMy0FfXj8RV7X0mNSRv+cWxwmA7b1GpeKa2Ce6O9zcGmPzIuVbRcr9Ch/RvMpK4vg0LpK1YFLXv/V6nXQqW3tRJ9f2C1GVFv1GTQ4eEZW10XV6fgRM0P3TD6luPO+6H6sKsu5Wuvyd6dfn6XKkvSg= 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=BX4DNuP+; arc=fail smtp.client-ip=52.101.66.60 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="BX4DNuP+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BuEALesVyPVByAptHgUdZUYoiCLDWVsavIb8cQkwDfaj9UjQBA68WdKfeZ9VzzY+fmTPvSrS1Cpi7EywOvBQuZVsxwwDfrSIhoJSFI+zzY3FKMZZO1ODahanIW3xGCgR1K5xJ1qX1BLUdjGL7tmf8bQqW2NIBxhJ2t9oeFjSuAN4usTqtmbLzjFIpKo3DeSRH9le+u2mdZx30EjZl8PHQy6vAGH5BMF4fIuy219Z0G0Wg116qPLQ96d3tlOStWiDl2DIdb9TYABGXUIIKK7EkJBIL3dlwU5tNHx5vDc2O7h/uDAtMoKmhntwxBkXzU28vtQOFF+iF2s0V/irkfipDQ== 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=tXmqI8W+fc/2sSZVXMJE0OeFFECeCOvicnTTeb8H7f4=; b=WNh4XrIMNKiBqytGHzsSvChnRTi8qQ3nH4mJN3i8cHmAGWxm0QydQc+cuYoG/7sUvtSvIAKcn3B7zocA8VjlLEQx7O9CMSGjZ3qTrOCt9xgomcCjRnrn6Nwk4NGUIPv2udVTDSoSp4VBYr+dpfKh+km5//xJKt78Vu9yxGCYL65qs/ieovpVkHAjJDKIK40ThL63BZDbO9oL+MUx58skmBjV2XLHd2dLhg8/JXO0AxJBL0i1q8+fYUY1JN/GkaYNq49FPEiZztevYGcVLn1DU1/WAq1044SIO7nFcgDxTlm7vdIJFCtpubw70gXY6zSyQfE1+DxIHgzs65b9Bp6fHQ== 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=tXmqI8W+fc/2sSZVXMJE0OeFFECeCOvicnTTeb8H7f4=; b=BX4DNuP+r5Bzy1luA+OHhT1Y3icVnLQp54gPUIGu3EhI8RtTzfandj/ExWRkZJRHhcMEPhVB/oLIDoAUdf0M9heD7xO6G06//8d+jD7LXfkoIVyJvRGYQf7Sh162wihkMsvaZ2RPV6Mn/d9IJQxt89+mvYyDllulNTYdonK8duo5p79u8r2tUGGc5R4b5vUHBRBXwX5KrfP649BzmOjOLFXjtiKGIdK8Oz8Y+/CqVi9/i7POrwBaZA77CWpnCIQjVCgtD+KjoBtVCcmvDCnPL4yxB9AIEgnOKhdQZ+XTh6xUMBUhotfsOTbIwyqDyAhmDpVCtdrqPRu34NeO8NMkWA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:32 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:32 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 08/12] net: enetc: add i.MX95 EMDIO support Date: Wed, 30 Oct 2024 17:39:19 +0800 Message-Id: <20241030093924.1251343-9-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a55ea36-ed0f-44d9-0914-08dcf8c8fde2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?C+y89e1ZHn6IiFbTreQOobKz9zOWhd76lKCLrVLDAb2YgwyFT3hKyHFJVUEo?= =?us-ascii?Q?Furt7SGb2GfkWe2qR0gqw8nwfVbNt4D5a6XV+LGBrTYuUwY+W1CAx8oppqBh?= =?us-ascii?Q?jpwIuc0xJ3PfWQrE1d+UGGWr8GKGYc+Hg1J1uL9IEEmdmNS5fw3BjaJz2pnB?= =?us-ascii?Q?1g7OxtxHPnPg2Bts8FQX4BBiZD3qSfLN9O1mLIsE19oayYQnki1psRJIsFX/?= =?us-ascii?Q?AxOEmqy44LaShb3QLwkRtZilXg+r43MBM5owRCCnrKCOMwRwx5/Xxq4t2yYX?= =?us-ascii?Q?ZaYKbK5D3u7dI09/1UmZMv1UrWD/9sYaRZSPpJzys4gEWzleqAlJwlL/g83O?= =?us-ascii?Q?DenVYuUL8n7ER1XfGxg3F8pPc6+c/SNb2YeIKJQEf5g88z/C8a/B7IXkFe7Z?= =?us-ascii?Q?Hyv1JHt6E9jh2Pw1GtJ+0vZRQSO6TRVooMzg1096VHOY88sk4mWyTmClyfj3?= =?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LZJMdpk+bR7fVGjBJARVTQVCJzA?= =?us-ascii?Q?JAAMD7iTA6zZH9mGOAClZDFF0z2Z?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?un8noA9x51zekHXC/d2v41HWgl70KkMIBOUIRNL+xCtwtIZrLnshT7abYeDd?= =?us-ascii?Q?wGw6vXKls/Bl4Lip/1VAeXF22wQkQxR05F88PRJUuDhyZW4jnRw+5HKPE4Xs?= =?us-ascii?Q?N/tfasj4Powh3YRCmTbvBqOJavz4+3tpVsyyT6QiktP6sVZ05ET6F1Yb5Mgp?= =?us-ascii?Q?7KpGlafC+LBCTFoyL2VjxH2vfhwX6tQ+a6iyAi3t9RNuGjc02BREIxqV6TPH?= =?us-ascii?Q?kOLkb0vvygLD6SdtWqO5dsCs5AgwFMSeS6FO1UO+ZzqfClj1/Nm5eGNAoqOD?= =?us-ascii?Q?NjUmD16WmcsieNTJfkj78qR7YWFTyZYQkNRQPmYtBgzPUNck2Pph+6BbMFyD?= =?us-ascii?Q?WA0azmJE0dytLKeTn6cH327AFXR8e2WGPJbP6o6gpmrdzuBGf4JQoy65w+dm?= =?us-ascii?Q?FMjcvXAcsmTIPZc6akkhGiEU/RxoJIlK9ylkYZXBbqUDimXMEp3KgSz+F/NQ?= =?us-ascii?Q?e/t205DygEMEelSTb9ZVo923czuJ/RtDUwllw3aBtSg4HLqmzmvY2kmFSb/1?= =?us-ascii?Q?7XTYmXQScmJnn+GlBmJ6T9hO8mWLlzEqkyL/eMqzm3bCS2vI2AHC1L0jqcuI?= =?us-ascii?Q?DrAUZzLNlSzQxAFqSdT8p06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6VNw/?= =?us-ascii?Q?iw9Yq4mHG+NJC+r/X8gwP/7jHwjeix1bLA4ZXyqsjWYGOD79sODNmhLrrINr?= =?us-ascii?Q?2YI2nVGSJ/o8VGLOOMwi0iYXVOJVwoemKqwwoB9f?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a55ea36-ed0f-44d9-0914-08dcf8c8fde2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:32.0001 (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: LpI6cPAmQZqrir5P0Yc56/oFWuZfTJQ6NHU2+PavifNOvXXT4USDgN1y1nNOFMpXzvtfUCpfm6LlmJ4SWixcKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 Content-Type: text/plain; charset="utf-8" The verdor ID and device ID of i.MX95 EMDIO are different from LS1028A EMDIO, so add new vendor ID and device ID to pci_device_id table to support i.MX95 EMDIO. Signed-off-by: Wei Fang --- v6: 1. remove pinctrl_pm_select_default_state() 2. Add macros to define the vendor ID and device ID of EMDIO. --- drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/driver= s/net/ethernet/freescale/enetc/enetc_pci_mdio.c index e178cd9375a1..e108cac8288d 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c @@ -4,6 +4,8 @@ #include #include "enetc_pf.h" =20 +#define NETC_EMDIO_VEN_ID 0x1131 +#define NETC_EMDIO_DEV_ID 0xee00 #define ENETC_MDIO_DEV_ID 0xee01 #define ENETC_MDIO_DEV_NAME "FSL PCIe IE Central MDIO" #define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus" @@ -124,6 +126,7 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev) =20 static const struct pci_device_id enetc_pci_mdio_id_table[] =3D { { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_MDIO_DEV_ID) }, + { PCI_DEVICE(NETC_EMDIO_VEN_ID, NETC_EMDIO_DEV_ID) }, { 0, } /* End of table. */ }; MODULE_DEVICE_TABLE(pci, enetc_pci_mdio_id_table); --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011058.outbound.protection.outlook.com [52.101.65.58]) (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 2E0CD1E3784; Wed, 30 Oct 2024 09:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282144; cv=fail; b=GdwCnTxBniUiGuOssB/onD8s6WnbICv0q7KmGbGGyOniB8IMund/+6L13HIxiDt0HyimraT6xsmbdXKLFAxm9mZT8dsdOfQCXsZzWCH6YHltmEpgx0S3etBzYcjpaoRK6krdxiQL2FT9pzcCVM2p4FkZcAIp7Y+SzowZJPE28a8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282144; c=relaxed/simple; bh=dLlg/2utw/KVdtGSn44OntDeTHoruscl/LecP9o+yaQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=a/mRz8TAeW04Bnq2O6Qsn0Y2UlCP7hzUOEorz9orGOmjZgMvdPJIOUVuKWwSEb6hZB6YijOcVNNgtMf+omZ3D2entVon/OjpZxDsvyJNSglafBxY8TYPcqhTtJecPMysOzskXhHotMq4cWbX0MdWgIzxIrIkj0WY41Kg3+KLMHs= 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=eWf1EqE/; arc=fail smtp.client-ip=52.101.65.58 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="eWf1EqE/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kmz0ZG1Og5tNputNrpiK6X6nlqQlznMQ5pw3mfF3kImZ3jWotOzQj2O78B51M1PtjHeqxzdGS6mSeqcZOxLMBpIs+Xv8qmWOuiOu9SnUN5knf+fM4QABadATChpakUSUegEDjEMtQ6BiE9gGNnY9TKGEssEaVm/bXjMejyIDWlv3qxgEotuDn8/YsHLYMbJVx3pObLvXqU4HR6P3wBOGMPGY5ffvlcxaGQjUmaf2ImgQascr2BElhNHLXCKAb3FfiYnEdGMbFX8Hqx2FpKcpOfJBpkSisRdd5MujfXUQFyTGe7WngstnejhW8RUsIaBiR05svpk4c+VR5bGaFwHc3g== 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=GZuOxz8yzyturV6RHu8PVydjVmO/8OC8k5rAVJeKBnY=; b=OeJgitG7CKAwOLlDwuBzBs+p8lJgqqM+/rwoUzmt3A/Kq4u7j4euE0xagYpVGHw3WcoBT5FoFiCk4W6BQ9m5JH0TkNHyTVMpLzwU+KjDyyfVa2xfq1AFXz1zpC8n+JOR4R7UK/DD7Q64/kmpqCAXsf3Zsn7Qn/ldMvyKnnTI6VLrKJyCzaWMvWqdcTTmwDceVZpXtPGeRWoQ6EeOjJ+onF7SI078HLPmbKg36gCGlFVtphJv6cqAhlZAsxSwKhpUXEHAl7mlK20MLHyjj24lpmXqMdYm/UngQ07EVHw0fgs+0RY67Uyb6Wv3YSMcnK4TLtOwz5rLFBl7v87L8cZIBA== 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=GZuOxz8yzyturV6RHu8PVydjVmO/8OC8k5rAVJeKBnY=; b=eWf1EqE/k+Lyy3LftNTWVpX7Dd+H75JRzVY0hyex9Z2Wef/iJJXNc+qN2rXFpuME8pw4uGw+CWLf7M8SPhnB2R4jJguQzmyDGhVxcCkK+EAUHrcvnPhM98Z7ytf8N3ywvD5qjcyUrN98MSUU+KPNjuqtw5tcXkO/3AAF6/MBRsIpBawyZHJR8vX1GS5T3YI2ow3Ny9stpnrh+26YueFJ51/lib7v7wV0HA53g0wYr/eSLkVDRr6whqWQ9SQJdaxeD3nsievh+5WSGEQDCJLN2f4tV6QTHm4MHRv57V6RJ/ska6XBVcp9hF14Pf7ObVAf8s81qRm0pM/DIKNmt1ru2w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:38 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:38 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 09/12] net: enetc: extract enetc_int_vector_init/destroy() from enetc_alloc_msix() Date: Wed, 30 Oct 2024 17:39:20 +0800 Message-Id: <20241030093924.1251343-10-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: cb03506d-67f7-4445-13f0-08dcf8c901fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/9TS3Bm6Gz13tN4r1J/T7JW49JDdJnvJQ+4E78snrabMefGrPqBIN1BQ/APS?= =?us-ascii?Q?b4hwPBdVVZxXG7Iu8gq0LuEY3Na7uQ6RZYtl9dxNtd6m8rtAkwbiN9gX0hLP?= =?us-ascii?Q?vzIrlj0E7ufG6btCFG4guyuSV0hwN6xCBxtwmaOI/fi9NsCDYD65KmJ26zY2?= =?us-ascii?Q?Jp5PAGAd8weQUS2kXDQ9rKJDfqhEx+5gksd4/46k05ppHA/1O1meIsJMHnYW?= =?us-ascii?Q?B47G8hnPr4VFh69IuFWWuKkIKrRLY1K0qmmFJvu9oPRABX+Rv3TorZym5/XM?= =?us-ascii?Q?8fwrTGLIuSUZ/4nC2c+jlejOYlpGw+DzWTVcaKeXam7573IF/Z37J73HeRwu?= =?us-ascii?Q?SYIkYOgqZCXbOOlw7pC3IO53k8kumJHqNF42dVF4iNWOkd4FsSJKsauzv5i1?= =?us-ascii?Q?/yMpr10rfJxRV6tIeunMr/4XRPAl1C0zaLeUJOLl7Kip8Bdas/B04Lq6HQTO?= =?us-ascii?Q?BBmIOvNZo+PO4YF3CR7SRx+3/+eP2Jvp8ldfXe+vMqjZy+VPr8+IoaGZUagN?= =?us-ascii?Q?U/aItG85l6dEuu49IlhxOZqbNkqNlYgh/fjWd6sk+257MK7R+ZzXgKjc6w07?= =?us-ascii?Q?Zt2UYLSbkEOoqHQNm9HFv3rkqwCXgOUlxlcavrOz4pOfw3MItH6q/TdCySBX?= =?us-ascii?Q?pJmRYYJiA7wViwE7/JfouDRmL6CtotOAqiAHB/pbCQAh3x6LSWbPs+ihyPKc?= =?us-ascii?Q?mDA9CM/evI3gE+f8zrH88l8gYfDwOc2dLWTr9FGf/PKAkqaBWx2tXlLq73sK?= =?us-ascii?Q?GReEAukRYNNWSkxyuAKcO8xYq5Swd8LQH+A6h7TqkN56afUuBQy2sbb3W5Sw?= =?us-ascii?Q?dFccMObt1t/bi3ZydBooxXsJXDrpOuNQmgD17DqQyJnu/LmsuGCiZ7DXokRq?= =?us-ascii?Q?wqZ573W7neqUG0D9s1mwtXsqKivyPI0zTaMWdgugbyBpE/HaROas/SiQbR7k?= =?us-ascii?Q?4o1PX8jH6X42A5/9tDkMlvTsCWyp989+fWpYTuGOzj5QA5OfYNaOv1/JEsRY?= =?us-ascii?Q?eFlsrmhw2jpaCnc6TwHITXYhmwb0aOZlNC5bewYWwj4q0azBst0NRXWCNC+4?= =?us-ascii?Q?COxoFSWr3m5QQemsTgDyeBk4YSeLtoiTR+w9jkFXDofOFL0dALmJRG6hKrem?= =?us-ascii?Q?FueBPWxko7WnKULHQTJ7mt9+jNDV3d92GJTB9efLopw9ctnmCvypNY9RylaQ?= =?us-ascii?Q?kOfIw0E3v32/tD3AL23+3cUtPXLiguze6pnrvNImtrl7Vf3/Io7UVz9ATjDe?= =?us-ascii?Q?aogd70yUoPdPz66szhy00JNwA+GPFkBqxJ6lCOgzNhXq1F90CVES+pANssjM?= =?us-ascii?Q?o8E5XJ3+0abN32TspmWZ1F/pjipsHJlAHon37ly7ICffJSqya3YDCtj21O6m?= =?us-ascii?Q?XyBginsabgRy92UAJgM3J2R1iCSk?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KWuxzeYPr/ckBjF873SsPPCVwG1b/WYOt7HHLxNHecrZm2z8YrKAgwsNiS+X?= =?us-ascii?Q?6B/KcXujQ5Zo+0aD0b0A95c70mZF6hjbcrqVEK60V4ya/sLlZoFPP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nS8WTKvedsjUZUrmaQnNsdXcEo4XUjU7YdMCN7/JN/P4?= =?us-ascii?Q?wURvvOmTnAbtdtBJtTfmJ41vAp1KRtneBRR5G+W2We8AlOBf0gGa5Mj0LYXs?= =?us-ascii?Q?jG7NbxdozHwgKXPtO518ESUapuBrlcklNixCkzSTKiOA3ko4xpNQBBPFk0J7?= =?us-ascii?Q?5AVcz6c8me0X+NKAbr5uKpTrxCUUBf3+k+Eyqr70o9zHVvbA7frAoodh8gW3?= =?us-ascii?Q?Q8NbkCy8xFxBpDViZrrxRBGzpZrRWvMZJAzn+MqlUsCHgbT7YjjYtTmN5+2R?= =?us-ascii?Q?TjrDUspoel9dgxwyPxORJyGJGHLlM4QyjAAiLogIaKhCXj1BrIcTQTqZHJBe?= =?us-ascii?Q?ANwrjqtqSZKgv1MBV3CtPNCDFjwdafcrwySb6gReo9/x7UFL/guDSTw12m+/?= =?us-ascii?Q?19GxgkhCe3I4+r0BfSUWZ4QiHR2TfXnx9XI2XvXXEMORoaQYlIE5mfQfHLu2?= =?us-ascii?Q?f+Jn5a2HHrkm/Cli5fv5+GNhxp1R4tAkfmyJLW8+logUBWJRpHb7t0wtxcXJ?= =?us-ascii?Q?KsX2xczzhX5BMBzROWJ42nPjNhikm2rOmJMYmYiXueHXHfJvR8a4ZP3fn9wy?= =?us-ascii?Q?QKx9M/NQrdSd4hsHIwPsnTSCqgk+J9Oax6Ebr4iC?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb03506d-67f7-4445-13f0-08dcf8c901fe X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:38.8476 (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: lHV4ZU0eb99GYEU+2ToanTPtN8NkCQVbI4rHyaXacmzouTMheTxRN2Y87DLpmry2ypuXxOrfzqBTU7PU0nDiMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 Content-Type: text/plain; charset="utf-8" From: Clark Wang Extract enetc_int_vector_init() and enetc_int_vector_destroy() from enetc_alloc_msix() so that the code is more concise and readable. Signed-off-by: Clark Wang Signed-off-by: Wei Fang --- v6: 1. remove the cleanup helper functions --- drivers/net/ethernet/freescale/enetc/enetc.c | 177 ++++++++++--------- 1 file changed, 92 insertions(+), 85 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/eth= ernet/freescale/enetc/enetc.c index c09370eab319..f292c5ef27b7 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2995,6 +2995,92 @@ int enetc_ioctl(struct net_device *ndev, struct ifre= q *rq, int cmd) } EXPORT_SYMBOL_GPL(enetc_ioctl); =20 +static int enetc_int_vector_init(struct enetc_ndev_priv *priv, int i, + int v_tx_rings) +{ + struct enetc_int_vector *v; + struct enetc_bdr *bdr; + int j, err; + + v =3D kzalloc(struct_size(v, tx_ring, v_tx_rings), GFP_KERNEL); + if (!v) + return -ENOMEM; + + priv->int_vector[i] =3D v; + bdr =3D &v->rx_ring; + bdr->index =3D i; + bdr->ndev =3D priv->ndev; + bdr->dev =3D priv->dev; + bdr->bd_count =3D priv->rx_bd_count; + bdr->buffer_offset =3D ENETC_RXB_PAD; + priv->rx_ring[i] =3D bdr; + + err =3D xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0); + if (err) + goto free_vector; + + err =3D xdp_rxq_info_reg_mem_model(&bdr->xdp.rxq, MEM_TYPE_PAGE_SHARED, + NULL); + if (err) { + xdp_rxq_info_unreg(&bdr->xdp.rxq); + goto free_vector; + } + + /* init defaults for adaptive IC */ + if (priv->ic_mode & ENETC_IC_RX_ADAPTIVE) { + v->rx_ictt =3D 0x1; + v->rx_dim_en =3D true; + } + + INIT_WORK(&v->rx_dim.work, enetc_rx_dim_work); + netif_napi_add(priv->ndev, &v->napi, enetc_poll); + v->count_tx_rings =3D v_tx_rings; + + for (j =3D 0; j < v_tx_rings; j++) { + int idx; + + /* default tx ring mapping policy */ + idx =3D priv->bdr_int_num * j + i; + __set_bit(idx, &v->tx_rings_map); + bdr =3D &v->tx_ring[j]; + bdr->index =3D idx; + bdr->ndev =3D priv->ndev; + bdr->dev =3D priv->dev; + bdr->bd_count =3D priv->tx_bd_count; + priv->tx_ring[idx] =3D bdr; + } + + return 0; + +free_vector: + priv->rx_ring[i] =3D NULL; + priv->int_vector[i] =3D NULL; + kfree(v); + + return err; +} + +static void enetc_int_vector_destroy(struct enetc_ndev_priv *priv, int i) +{ + struct enetc_int_vector *v =3D priv->int_vector[i]; + struct enetc_bdr *rx_ring =3D &v->rx_ring; + int j, tx_ring_index; + + xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); + xdp_rxq_info_unreg(&rx_ring->xdp.rxq); + netif_napi_del(&v->napi); + cancel_work_sync(&v->rx_dim.work); + + for (j =3D 0; j < v->count_tx_rings; j++) { + tx_ring_index =3D priv->bdr_int_num * j + i; + priv->tx_ring[tx_ring_index] =3D NULL; + } + + priv->rx_ring[i] =3D NULL; + priv->int_vector[i] =3D NULL; + kfree(v); +} + int enetc_alloc_msix(struct enetc_ndev_priv *priv) { struct pci_dev *pdev =3D priv->si->pdev; @@ -3017,62 +3103,9 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) v_tx_rings =3D priv->num_tx_rings / priv->bdr_int_num; =20 for (i =3D 0; i < priv->bdr_int_num; i++) { - struct enetc_int_vector *v; - struct enetc_bdr *bdr; - int j; - - v =3D kzalloc(struct_size(v, tx_ring, v_tx_rings), GFP_KERNEL); - if (!v) { - err =3D -ENOMEM; - goto fail; - } - - priv->int_vector[i] =3D v; - - bdr =3D &v->rx_ring; - bdr->index =3D i; - bdr->ndev =3D priv->ndev; - bdr->dev =3D priv->dev; - bdr->bd_count =3D priv->rx_bd_count; - bdr->buffer_offset =3D ENETC_RXB_PAD; - priv->rx_ring[i] =3D bdr; - - err =3D xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0); - if (err) { - kfree(v); - goto fail; - } - - err =3D xdp_rxq_info_reg_mem_model(&bdr->xdp.rxq, - MEM_TYPE_PAGE_SHARED, NULL); - if (err) { - xdp_rxq_info_unreg(&bdr->xdp.rxq); - kfree(v); + err =3D enetc_int_vector_init(priv, i, v_tx_rings); + if (err) goto fail; - } - - /* init defaults for adaptive IC */ - if (priv->ic_mode & ENETC_IC_RX_ADAPTIVE) { - v->rx_ictt =3D 0x1; - v->rx_dim_en =3D true; - } - INIT_WORK(&v->rx_dim.work, enetc_rx_dim_work); - netif_napi_add(priv->ndev, &v->napi, enetc_poll); - v->count_tx_rings =3D v_tx_rings; - - for (j =3D 0; j < v_tx_rings; j++) { - int idx; - - /* default tx ring mapping policy */ - idx =3D priv->bdr_int_num * j + i; - __set_bit(idx, &v->tx_rings_map); - bdr =3D &v->tx_ring[j]; - bdr->index =3D idx; - bdr->ndev =3D priv->ndev; - bdr->dev =3D priv->dev; - bdr->bd_count =3D priv->tx_bd_count; - priv->tx_ring[idx] =3D bdr; - } } =20 num_stack_tx_queues =3D enetc_num_stack_tx_queues(priv); @@ -3092,16 +3125,8 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) return 0; =20 fail: - while (i--) { - struct enetc_int_vector *v =3D priv->int_vector[i]; - struct enetc_bdr *rx_ring =3D &v->rx_ring; - - xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); - xdp_rxq_info_unreg(&rx_ring->xdp.rxq); - netif_napi_del(&v->napi); - cancel_work_sync(&v->rx_dim.work); - kfree(v); - } + while (i--) + enetc_int_vector_destroy(priv, i); =20 pci_free_irq_vectors(pdev); =20 @@ -3113,26 +3138,8 @@ void enetc_free_msix(struct enetc_ndev_priv *priv) { int i; =20 - for (i =3D 0; i < priv->bdr_int_num; i++) { - struct enetc_int_vector *v =3D priv->int_vector[i]; - struct enetc_bdr *rx_ring =3D &v->rx_ring; - - xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); - xdp_rxq_info_unreg(&rx_ring->xdp.rxq); - netif_napi_del(&v->napi); - cancel_work_sync(&v->rx_dim.work); - } - - for (i =3D 0; i < priv->num_rx_rings; i++) - priv->rx_ring[i] =3D NULL; - - for (i =3D 0; i < priv->num_tx_rings; i++) - priv->tx_ring[i] =3D NULL; - - for (i =3D 0; i < priv->bdr_int_num; i++) { - kfree(priv->int_vector[i]); - priv->int_vector[i] =3D NULL; - } + for (i =3D 0; i < priv->bdr_int_num; i++) + enetc_int_vector_destroy(priv, i); =20 /* disable all MSIX for this device */ pci_free_irq_vectors(priv->si->pdev); --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011046.outbound.protection.outlook.com [52.101.65.46]) (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 C083F1EABDC; Wed, 30 Oct 2024 09:55:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282150; cv=fail; b=ICIJf9PI8hWhlLIUxJl0+/QxFO96UYUGDWSyif49O+ms8yCINa8ngaZHjjTw7OuPBIeN9SLMKFPH4VJRlx0XI/murKLWxx3J1oVP5e4xps8KNIvw+NaUI5pW5MzL/vZpPKsKg47FyMiCrwT+LqjgYZ2imRuBI3NOaWgN3PYA6AQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282150; c=relaxed/simple; bh=HoBm1EzDooAKHys1FjB6qVsFv9CMTg4Qgxw1LVvF0Z4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Y+ZbgrO/7jgJD47ACw/yC4rv/uzutfBuwstGWbEX/yDD0bL5bF2CWQHOxzW6rCiuLUZ3EwHABhf8v34aZc8WfHRk6zEFDLip70cqCzGO3CzgI6fBOJUZimNw9FeTiOPS9p/CJln4MRNgP1haaUcv1ezlGOvfL0oBJJJXZrr5kwQ= 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=cWKdImBI; arc=fail smtp.client-ip=52.101.65.46 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="cWKdImBI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tQPm+ZDXwhKAA/WLv0GnYyWWhxuYqGJ9iaF4hXS4t+vxOtz3J53UoyuYA1W7/BUnKnwfgyK/HfA3Co8hXQEHlrAkiTMkOmGaq3WDJ556adqkPW8P3iU2mBjKMnudDOfIpHAvGDmNBU2wrGXc4cGJ6BE7XdsEV6PVoij7Js+gE55fvKvFaeGmX6wlz2ZJnBlPmlPJv3njNFYRzW2tQMWi/D/pmZ+qZf64zAG3y/8UALnhQPvbc9RTqdQT+oNLb9dFGr3CavSLHpUnCScQR5jHjqGzR5gHjXhzFD3syEVhEts9RYKiVCAxsKnfPscvyPGcRVkHvSEhK5PxzK2hBuRFMA== 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=ZCq20NAtgk0hyXkMNIIn0r67H4ms8Djwh3AFS5QawQs=; b=bHgrvUkcO/VRTS72lp/UfideXnOA9aznPXsBbdQQyFTw58b/P/HbFGSFmqPslhCEyiF5hCsBi0NUiWDpC7bqcIQJHY3fbFeRKeU/90dC66r3AIyLJDmjYvMz/bDPbBD2pNCTTA0kZ4RBzkdptfavA4o+qWxrYLh6UOawRjcRKUqFqjwTt3K9aJrTJrK9vS/dVHt/VYZipFqu4lHGcEW/rMt59TwLnoN4VrdDC/88fwnWjPiEdUaqP8pmAnrF129NAcJxuLnFm+PXlUEcpE2au0gNOHqmOIwzef1M/efwas/NHuekIr/SKNGmWFtZfk3OjLSjCJ/EiWyLfiK+ATm0pw== 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=ZCq20NAtgk0hyXkMNIIn0r67H4ms8Djwh3AFS5QawQs=; b=cWKdImBIgJM13nCoUfYSs55GnngHVPPe4cyRtm8cL4F1Q2ljSPGKL7Gi2atZNh6N12z1maNFQ2OKqPD+YL2JHabAaPKmlZXnV1Iv3sMIJ4TrF/OLR15KbQ0vOvJUu8g5rxvLGyKurhMfTfL//SLvtgnUGNN8y2NZ/mkknOWPa4j7BMJQpl2rue82SGbTb9gO118eBmjdYE8t7eBLgWwoJeMM9J//ZnRqdJ3/t4o3bj9OUuVyVd2gvf9pFHkfBz14RuxaJBR4THwvJyYRkDOGlh9Juf/VeB1CleInIAHiZU/RvG3N26sj4wQAabfSD7ZVLooLAvXLQfrji4kYh7XPbw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:44 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:44 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 10/12] net: enetc: optimize the allocation of tx_bdr Date: Wed, 30 Oct 2024 17:39:21 +0800 Message-Id: <20241030093924.1251343-11-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: b3c2dcc4-7e37-4a04-d197-08dcf8c90595 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?lYinEs4DKPoMnmXmWcKdqEfUeTEcOBACqFtS+uVyX2kodH/gZ+di5pNrrbg5?= =?us-ascii?Q?AsxgSGtK0vT3tYEQAzX8fDXSnJKjj9dgJAzpxuHVEfCRzniFp0GY8EIGusyp?= =?us-ascii?Q?+aQ7rVlbT/xqazCEGB/YH6C0ZX6Ft6hvph99cLUSO3iBXCvJVU1dqHFSWAuX?= =?us-ascii?Q?THB3luHFfrMLlT0Aqj4+11I5ZlYMncgXI0K07udK110GHWR48O8Mz210UdE4?= =?us-ascii?Q?rMLfN3rQU++AOMKmeRRMqx3XfVgzqUH9vav9L/kVF3g4XOqIxa+OqbPrzB74?= =?us-ascii?Q?daCe7mOju7AffNIvT6fUV+sRnnRSs9blNcU0ca6DWUSKgjCAiwOlT4xOGF+/?= =?us-ascii?Q?PgIQ3qd8ACYithEOoPZcKMWVM2VVWQCEZ/L3E3H534c4eAyV+CzvmlU4L/J6?= =?us-ascii?Q?f0C5yPPk/CqXuJgNMFNTEjql7FbM/Ln/dITbmFfqVYMvJ3KkREMDI5Dx272H?= =?us-ascii?Q?v6R2Jtc4N6udj7XuLZa8VIeqWLDi0mkGd0yBjCdN08YGtJvktPR7WgQ++JLG?= =?us-ascii?Q?oWyw5BmNSY1A50eIvpgTcapWh4brnE2JEAMAEmq6aHCj9tUgcAM/dTd7YZh7?= =?us-ascii?Q?JV36tclXBO1jq3JEfwcQX4IHYgfbZ98aUypTHtA1oX7Sat+ISLHcO0x011kj?= =?us-ascii?Q?EdqodXCk3swRYege8hTaOMpyzFA8vMCDpVtPm4hXHNVDU+ViOmSjwTLupaXL?= =?us-ascii?Q?E9/QjYWfYCL/x+krVLR53b/vyUQtgqtFGm2mSnSYqVsiHHHGV4/CWEWopjce?= =?us-ascii?Q?Fjgt81fKH9ipgy/BUiJOTbAW1/AqAXD77NS8/gJti4MHukPZP4NaA5F4gWfQ?= =?us-ascii?Q?7hrkmuB6ftmW7/YhpVhOekxxdcX88KqyDCry47U9nMLvsFQBLC2VPVyTBn99?= =?us-ascii?Q?KH8lT4HeqsCYMzDufVId5MRP8fljdrSgRGh96VoYqfPrJX701aPYRGiOz4fO?= =?us-ascii?Q?4okzvJ7t8h3Bd7JZ8kyIEXwviha0JYf5v/0fze6+MOL+FDOtRGyb99wWv6Iv?= =?us-ascii?Q?Qdmjl6pEBHK2sWkej8bZPZh5zYSAk2rlTql2C+MpthPB8ODinI3c0nUAl490?= =?us-ascii?Q?aBKVrXt3k0tHvL1GPSnTvXXnkay8V/uxNnFy9rHU1vy4pO9RVNmBUSnpTMT0?= =?us-ascii?Q?HMF88wvFyLHovvlNKz8tbuHH9h3A4EK13B318MHY9hjz3p2yZ/EiyhKUtNgr?= =?us-ascii?Q?h+m32nWhUfTMizhkN/Pf7aq6Y3oCZFgD16i4s0bwxgPM8+uoZ37m72MGzbJW?= =?us-ascii?Q?p4SYbCnu8n44P+kpWOiUEHrgUgqiQfv2zKLANK07UfrtNBlnCdC2zrbIdwzR?= =?us-ascii?Q?cFOTmLZSAphG71onrj8yohpdVru1Cfw2DXqVjwz6JMDiP5m9Y+P/EQ4cIz84?= =?us-ascii?Q?OJtK7Sa2IvXM6R7dEIz+w56VcAPA?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xC3mkSs7xLfBQif7vfS2d1jRCOyaapXDOn7YM1HzOnp9fyzR3F7+Knx9nH3n?= =?us-ascii?Q?MB/9tctV33Ex8QYBhRz3R9Dz2N+7B2UFnOZyC2gGEk2x2VvP0C0ngVmqSbcu?= =?us-ascii?Q?EOHVYX3uxFkxxAPOdJ5U8/nYdbezfWF0/cpvcBB7KSCm99DIeCuWNCrePbld?= =?us-ascii?Q?BsajRuHzd+K08jzS57G20u1lGYdMVwRTwalDySTfCDXo58i+tPEcq2iDTKpP?= =?us-ascii?Q?RilY2Ol4ioqHJ+eMCqbcH3Hs99iKgURKPXDMAqbSlY2xaUZdSNC6ll04Vu0A?= =?us-ascii?Q?P7imvFdnZwRuNUo63zygaKPgRU15OzuSJUxXZPtmV2QAy/0hYnTl/bKw9r7a?= =?us-ascii?Q?2Zy/owmntte16830dNiRltWpM+LTCx/gg7ZZR18YE32bsPA72geWYS4F7SfF?= =?us-ascii?Q?0L9O5TWpRihmN8c79XwGrRI5G37wWXCKVJJCqJiQq8+ujL06KqFok0UVawj3?= =?us-ascii?Q?uk1Rgq/YHS6HfAlpdsCkS6empC52Tg7ojzur7aaborTy61bTIvucvddiPhKv?= =?us-ascii?Q?U8FoZwreDMLuM1PESz+goVR2gvkqKDrPEEjJs4dnkOA9dniknH6m1BwzmGl/?= =?us-ascii?Q?URIcjb9YKEChbBAppat8zchURZx3GQhc10YOOfu1kTTjS9/5gNBqVFNBMs2N?= =?us-ascii?Q?QnzWkCykHcmKUyrFqiQsChU17F3WSBkTJMDrmBtzcjx7noXZ9E/ESPZEOrsY?= =?us-ascii?Q?sHcAwCSuUVXct8yb0Tmb0x5g4rzU4+eeP2v/ebVPHw2fmjohrmYF3u/PJBXT?= =?us-ascii?Q?hz44ehZIDg49hsgd2uQiGbMFEEONEF0rXmGD6Xk0Y2hkv1xs2HIJJ3qwOKA8?= =?us-ascii?Q?MKGOiNykhlUcp/kMUpetfZlMiq9dMBb+YFXQ1hfGZvAXY7MmGILuZ6nRt88w?= =?us-ascii?Q?/D4rLmNv79mJFfT4WwfDowCcoVKIMn1Gsq6VJaRtpKESDwXCkOkiHDRAWt9Y?= =?us-ascii?Q?D7IX7+X/6IzmisLcwzf4M5gv/6Z921v8OjU+JlEhuQHmy8zcEvLbLmyen8IS?= =?us-ascii?Q?ZWUN9y7Im/rEO6xwspVJZXSWyDHDzAY6P8ttvtHXBsXtBpwxzm0YGkb7wIEO?= =?us-ascii?Q?VFoD/0kyqFIiafwDD468H36hb/vR+5mUnN/4YieY1jjGq3aS1UYXGXhWTmc+?= =?us-ascii?Q?G2/ZeY5yohp9d1JANNRSrdP1ZM+ePB7qmqkXOxE92WbccXiTm1kaJcCwt3yK?= =?us-ascii?Q?lwFU8jaJN0LbdBy4tsgrG6M4400NmxEVcM5S6J41UrFj5eWAjqiIRrpHMw0Z?= =?us-ascii?Q?WIsTJiKDK4Dm0EF0+bGhr8o0KQjWelLMLAqNf8m+PCGqHx7BneNMBhiI94oG?= =?us-ascii?Q?H8h6u2bYfzt92Bih9ojClYA/hWBi4hlbaycBWEnhDYT9tJybb7jXXWZcAp8O?= =?us-ascii?Q?qOqiWm9u4boiBx4HwwdVomfkRA0J10wUB5D0s94JksAfUTLr188CVtG/xFoW?= =?us-ascii?Q?ma466nZ3XSf+Md/yrKPai4Ko+LeViLJXbsjkshuaQnIi2Juhzyt3vZ2MWlWL?= =?us-ascii?Q?H7AH6hTuXLr6PTwQ7qKaDTJuKL3wK90ZyVlzquEuj7EfJYBZKZddV0Ec2Dp5?= =?us-ascii?Q?CC+7qxuXnDO/zICF4w3psqEd6hUj/zPBqfcO5SeP?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3c2dcc4-7e37-4a04-d197-08dcf8c90595 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:44.7699 (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: Pzvj64BcERSAWlYkr1qA93pCJgzY5i1tvAJIXlAcrdXgZG2xyjhYeyyYbFK4SZwKGIf0CZmcswbBYSqb2RftKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 Content-Type: text/plain; charset="utf-8" From: Clark Wang There is a situation where num_tx_rings cannot be divided by bdr_int_num. For example, num_tx_rings is 8 and bdr_int_num is 3. According to the previous logic, this results in two tx_bdr corresponding memories not being allocated, so when sending packets to tx ring 6 or 7, wild pointers will be accessed. Of course, this issue doesn't exist on LS1028A, because its num_tx_rings is 8, and bdr_int_num is either 1 or 2. However, there is a risk for the upcoming i.MX95. Therefore, it is necessary to ensure that each tx_bdr can be allocated to the corresponding memory. Signed-off-by: Clark Wang Signed-off-by: Wei Fang Reviewed-by: Claudiu Manoil Reviewed-by: Frank Li --- v6: only add a opening comment in the code --- drivers/net/ethernet/freescale/enetc/enetc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/eth= ernet/freescale/enetc/enetc.c index f292c5ef27b7..89d919c713df 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -3084,10 +3084,10 @@ static void enetc_int_vector_destroy(struct enetc_n= dev_priv *priv, int i) int enetc_alloc_msix(struct enetc_ndev_priv *priv) { struct pci_dev *pdev =3D priv->si->pdev; + int v_tx_rings, v_remainder; int num_stack_tx_queues; int first_xdp_tx_ring; int i, n, err, nvec; - int v_tx_rings; =20 nvec =3D ENETC_BDR_INT_BASE_IDX + priv->bdr_int_num; /* allocate MSIX for both messaging and Rx/Tx interrupts */ @@ -3101,9 +3101,15 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) =20 /* # of tx rings per int vector */ v_tx_rings =3D priv->num_tx_rings / priv->bdr_int_num; + v_remainder =3D priv->num_tx_rings % priv->bdr_int_num; =20 for (i =3D 0; i < priv->bdr_int_num; i++) { - err =3D enetc_int_vector_init(priv, i, v_tx_rings); + /* Distribute the remaining TX rings to the first v_remainder + * interrupt vectors + */ + int num_tx_rings =3D i < v_remainder ? v_tx_rings + 1 : v_tx_rings; + + err =3D enetc_int_vector_init(priv, i, num_tx_rings); if (err) goto fail; } --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011005.outbound.protection.outlook.com [52.101.65.5]) (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 401C51E3DF0; Wed, 30 Oct 2024 09:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282161; cv=fail; b=hhGJFY2H77u2O/xXAMyFR52gMTU+HgTiD1XZetr+OJu0QYejJ4jTqC0JorhPcNP54QX/ZRHNXBJNnsQPSWiIXTgdbqJudNoOvkPNDg46ve6hky3YdV07y7UR1kqjBahDSWMamGYzkYPc2ZtwQVuqEVc86KeLBmBHILr/RRIuJkQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282161; c=relaxed/simple; bh=INVeBupvy2cGxoXb75qDtjwyGRZT4IU8RJxMIn66mWg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=CneDF1ffToOAEQ+7r1IIPjC/UeAFhZ97Vr9ZKJbv/Ad47iwid2Hi/YbruUBnv/LM8nYBj0nQoPeciASFC8ygiAe0uKD22Td0DgeEXVKBYUw+D73PiDBdxPYPJhhpjvPioLMetKwPaYPR+2B1o7yN1ajof4X0lyyvrmAw5B3dywo= 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=Tv2ii15t; arc=fail smtp.client-ip=52.101.65.5 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="Tv2ii15t" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y4x34l0eZ/qBVrvh4Qzwte8PKZAr52BbGbJnDSJe9+E0YaHsZ6yU09evc8KGau3Mnb+mh62qgQlfCqAoiLUtoywlnbAFFxSScDhLUoZ6kJ31Jnx5aVJtPGaoE1No4ePcaCyUmjRKEbQZiY3iVZCjG1YEFY/LU67yE32Y86x2lKlaooyfa9SVphMp7qrEEg1aeoUG1s2hVi55cWVZmCGQrGjsrowdCZyvJYhN1Q4cH3+OZQ+1vD3H96DgfYPrh5iH+HYySlPyVQD6a16n5Gh4z2btWKwDJX+ne738YM5RA+WTAca7/m4LoLIhEB+VnKcHaEutukW9rfIIHtPJydx/tA== 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=K6zcPzxzKup2kBuony84RRVBCouQ1NZX9F8Tw/hVJOk=; b=e++np/VouDnH0LlMPMG0ZvpJqEEA1PAzTPBSV/5W9FeGhkG38MF2PXoInKAGFHqeFx239fzSRJrpI2XCASHClXWqwhr9gQXNNSxXjozuOGgEn1H+uw3GpI6D4CZjZLJZmn2WOb4/rxX1IHaaQfcnaIQbrGBT4FD2Q7X2bwxRrKPx1NMqRqRwKDaclTWHHfR3GTUcmJrg97bzqvaWkzq8FvsGbiYh41uVwtqpV1E89Zx6zRUPBiqGtvpoCLeRW3q8p7eEi/R2miHqI9Z/fpFJ8f62llLtxQsEF675rKtqkMZ5T7bZNVF8RzOMtvrOk613WV6i4gGmJ+cYi9MZ2c09kw== 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=K6zcPzxzKup2kBuony84RRVBCouQ1NZX9F8Tw/hVJOk=; b=Tv2ii15toUJwljlIK4hrCScJtEesdY+jX0FFlbXTZn+dbd5GzV7SSRoDx/kxc6A2BisQ91lgYdCu94x4e8Ebbcax2Wqw0yPW5Nc82q+nWDrtOwtvvl3Fr9jUvDUHOYmGMZ3t/pBniHSE0zagTBTQ0mcux/QthvRYLccPFPk8ZICid8f9DVHYT3F2lU5vh/DJjdEvFhxzywpS92QpFoiZwABMm+r+70wkmZRl7MyL+DXQm6SqEfODkJaMMhGkY8GkxQ6ata0qJ+X/1iePGAdPEEtaL8rriYLPGVEb+KIeDkvFMk/yJ5tyIgr6xjP9LOLWsh9Cf+fGQveemZpCVpcrbQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:52 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:52 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 11/12] net: enetc: add preliminary support for i.MX95 ENETC PF Date: Wed, 30 Oct 2024 17:39:22 +0800 Message-Id: <20241030093924.1251343-12-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: 17ccb9bd-c400-4845-adc6-08dcf8c90950 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350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ascii?Q?Tcdn/jNREyo91oF7dfVLrphYXFMcw4EKs40AP4Vbi+/vzoyLQtZxG4w+Rh6v?= =?us-ascii?Q?aDjQ7RlVb1HoT1WZ4aVALItEhb3lCOSbZ3517fmGOG/iAvRP65p1KuMiEaF5?= =?us-ascii?Q?pTyfikl+3GgTfNQH9ckoqUpqbpFku3lMAxi4S+uI2FGrETvm9NR42JZpmxsO?= =?us-ascii?Q?0B8+UspqRvBa0SYykcqFs+MR0ByV10/jvykgUgPytV3IBphsSAEQiW7zk47o?= =?us-ascii?Q?srRt6ksb5M9W+GXYRfBQOkuX0etdruVAWy70vA/wc+9UEXCC6ZA0tjgAN55C?= =?us-ascii?Q?spJtsCDLQeDdsZZE91vuh1lTEr5R7mvNXBa6FzJ9irao3I/nc0JKT02qB31i?= =?us-ascii?Q?XWfx3GU3eVFNLEEl64l48n1lc4Li47pw2s5U4kJWC5dDmUgQXd1Iay8tI5xV?= =?us-ascii?Q?im0jPXNQUk4ZJ9FWnEa9ZlWthe6M5IeatAxe4zyWMW9X5tN6D6cNSGaJiEiv?= =?us-ascii?Q?ob4FENWD/TsOQTtUIsTqnj10dMsCXVElhsbeIB1gmjIhnl27h/FJLWD6pciQ?= =?us-ascii?Q?zWTBpE5Qz49wfRmc8W9qnelF8nU+?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3nj75KhiNhOYolKLV9gST+QyZ9Ryqg1OS9LRVg6KcylrW8RBleFB7T8LXLK9?= =?us-ascii?Q?8gHuryZ9dQVGRQAenUYJMhjfnMcEn7pbxKXNdo1sdsK2Pj6in5u0+bSZmM7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OnZ42HDqW1jkyX055Lj6HONsMJ3?= =?us-ascii?Q?nGVCyhwO1pnZI09r/vtB0juxD3A1bphALp1pKkvq+Od+PjPaBdsqv2st5lUp?= =?us-ascii?Q?n8CnZpWI7v1CZv87l8ywqiPlqiMzx1LI1wJCLDdSO8HptgsJw0Myzzu4yaLN?= =?us-ascii?Q?7vmyvJU99q9HfXENK2AJ3A+E9x0IGILjIta/lJ3BdV4cgx09qwm+0bUf6gzC?= =?us-ascii?Q?WWcKJGP7O0aqd+8Sq+ug7Wy/6tIXweA3CrNIyQ6dRq72lhFOfofs8N2Fgrxo?= =?us-ascii?Q?CWN4f17h5FKRWyAfdBmgCx6zvQ1bD3FzD7BVIQkN5CKYwlI87ClgB4sfRM/r?= =?us-ascii?Q?3OtXicw/2bQhv3hnbDEXt73f2yp0PEPs9SgU6PW4lPab83PeB3B1hpND1XNa?= =?us-ascii?Q?+RQ4wcrdWgsiXYXzO6XUK2dmMRiwUhrqjyLBrODslrAq0tuSK7wc5bkxVu8F?= =?us-ascii?Q?P7hX8UVit/4MAQHSISfZ0yK+pEcZ4gskPr2Qbk1VXRtx4/j12Fhx/+AU2uJj?= =?us-ascii?Q?sEZzUD+4y1X5GFABPW0sxZEv7vlGYBEMkWYxFSO0rWK2azBSRfy0zCFkF0zi?= =?us-ascii?Q?Hk4k+BURv/k0gY/u07S2Z5Xw6LNOVXx88COF5p/g?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17ccb9bd-c400-4845-adc6-08dcf8c90950 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:51.9672 (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: DNJp6U5V9iYkIwZG9jak5qDVXQ5Wfal+LuqfD6GO0ECfCWNmbP4OHFD0zNLcmbuCXWMw40ruD47wbkGz5n6SWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 Content-Type: text/plain; charset="utf-8" The i.MX95 ENETC has been upgraded to revision 4.1, which is different from the LS1028A ENETC (revision 1.0) except for the SI part. Therefore, the fsl-enetc driver is incompatible with i.MX95 ENETC PF. So add new nxp-enetc4 driver to support i.MX95 ENETC PF, and this driver will be used to support the ENETC PF with major revision 4 for other SoCs in the future. Currently, the nxp-enetc4 driver only supports basic transmission feature for i.MX95 ENETC PF, the more basic and advanced features will be added in the subsequent patches. In addition, PCS support has not been added yet, so 10G ENETC (ENETC instance 2) is not supported now. Signed-off-by: Wei Fang Reviewed-by: Frank Li --- v6: 1. remove pinctrl_pm_select_default_state() 2. add macros to define the vendor ID and device ID of ENETC PF --- drivers/net/ethernet/freescale/enetc/Kconfig | 17 + drivers/net/ethernet/freescale/enetc/Makefile | 3 + drivers/net/ethernet/freescale/enetc/enetc.c | 86 +- drivers/net/ethernet/freescale/enetc/enetc.h | 30 +- .../net/ethernet/freescale/enetc/enetc4_hw.h | 155 ++++ .../net/ethernet/freescale/enetc/enetc4_pf.c | 756 ++++++++++++++++++ .../ethernet/freescale/enetc/enetc_ethtool.c | 35 +- .../net/ethernet/freescale/enetc/enetc_hw.h | 19 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 7 + .../net/ethernet/freescale/enetc/enetc_pf.h | 9 + .../freescale/enetc/enetc_pf_common.c | 11 +- .../freescale/enetc/enetc_pf_common.h | 5 + .../net/ethernet/freescale/enetc/enetc_qos.c | 2 +- .../net/ethernet/freescale/enetc/enetc_vf.c | 6 + 14 files changed, 1113 insertions(+), 28 deletions(-) create mode 100644 drivers/net/ethernet/freescale/enetc/enetc4_hw.h create mode 100644 drivers/net/ethernet/freescale/enetc/enetc4_pf.c diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/eth= ernet/freescale/enetc/Kconfig index e1b151a98b41..6c2779047dcd 100644 --- a/drivers/net/ethernet/freescale/enetc/Kconfig +++ b/drivers/net/ethernet/freescale/enetc/Kconfig @@ -33,6 +33,23 @@ config FSL_ENETC =20 If compiled as module (M), the module name is fsl-enetc. =20 +config NXP_ENETC4 + tristate "ENETC4 PF driver" + depends on PCI_MSI + select MDIO_DEVRES + select FSL_ENETC_CORE + select FSL_ENETC_MDIO + select NXP_ENETC_PF_COMMON + select PHYLINK + select DIMLIB + help + This driver supports NXP ENETC devices with major revision 4. ENETC is + as the NIC functionality in NETC, it supports virtualization/isolation + based on PCIe Single Root IO Virtualization (SR-IOV) and a full range + of TSN standards and NIC offload capabilities. + + If compiled as module (M), the module name is nxp-enetc4. + config FSL_ENETC_VF tristate "ENETC VF driver" depends on PCI_MSI diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/et= hernet/freescale/enetc/Makefile index ebe232673ed4..6fd27ee4fcd1 100644 --- a/drivers/net/ethernet/freescale/enetc/Makefile +++ b/drivers/net/ethernet/freescale/enetc/Makefile @@ -11,6 +11,9 @@ fsl-enetc-y :=3D enetc_pf.o fsl-enetc-$(CONFIG_PCI_IOV) +=3D enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) +=3D enetc_qos.o =20 +obj-$(CONFIG_NXP_ENETC4) +=3D nxp-enetc4.o +nxp-enetc4-y :=3D enetc4_pf.o + obj-$(CONFIG_FSL_ENETC_VF) +=3D fsl-enetc-vf.o fsl-enetc-vf-y :=3D enetc_vf.o =20 diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/eth= ernet/freescale/enetc/enetc.c index 89d919c713df..4be7c767d1e9 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -3,6 +3,7 @@ =20 #include "enetc.h" #include +#include #include #include #include @@ -21,7 +22,7 @@ void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 = val) { enetc_port_wr(&si->hw, reg, val); if (si->hw_features & ENETC_SI_F_QBU) - enetc_port_wr(&si->hw, reg + ENETC_PMAC_OFFSET, val); + enetc_port_wr(&si->hw, reg + si->drvdata->pmac_offset, val); } EXPORT_SYMBOL_GPL(enetc_port_mac_wr); =20 @@ -700,8 +701,9 @@ static void enetc_rx_dim_work(struct work_struct *w) net_dim_get_rx_moderation(dim->mode, dim->profile_ix); struct enetc_int_vector *v =3D container_of(dim, struct enetc_int_vector, rx_dim); + struct enetc_ndev_priv *priv =3D netdev_priv(v->rx_ring.ndev); =20 - v->rx_ictt =3D enetc_usecs_to_cycles(moder.usec); + v->rx_ictt =3D enetc_usecs_to_cycles(moder.usec, priv->sysclk_freq); dim->state =3D DIM_START_MEASURE; } =20 @@ -1736,9 +1738,15 @@ void enetc_get_si_caps(struct enetc_si *si) si->num_rx_rings =3D (val >> 16) & 0xff; si->num_tx_rings =3D val & 0xff; =20 - val =3D enetc_rd(hw, ENETC_SIRFSCAPR); - si->num_fs_entries =3D ENETC_SIRFSCAPR_GET_NUM_RFS(val); - si->num_fs_entries =3D min(si->num_fs_entries, ENETC_MAX_RFS_SIZE); + val =3D enetc_rd(hw, ENETC_SIPCAPR0); + if (val & ENETC_SIPCAPR0_RFS) { + val =3D enetc_rd(hw, ENETC_SIRFSCAPR); + si->num_fs_entries =3D ENETC_SIRFSCAPR_GET_NUM_RFS(val); + si->num_fs_entries =3D min(si->num_fs_entries, ENETC_MAX_RFS_SIZE); + } else { + /* ENETC which not supports RFS */ + si->num_fs_entries =3D 0; + } =20 si->num_rss =3D 0; val =3D enetc_rd(hw, ENETC_SIPCAPR0); @@ -2066,7 +2074,10 @@ int enetc_configure_si(struct enetc_ndev_priv *priv) /* enable SI */ enetc_wr(hw, ENETC_SIMR, ENETC_SIMR_EN); =20 - if (si->num_rss) { + /* TODO: RSS support for i.MX95 will be supported later, and the + * is_enetc_rev1() condition will be removed + */ + if (si->num_rss && is_enetc_rev1(si)) { err =3D enetc_setup_default_rss_table(si, priv->num_rx_rings); if (err) return err; @@ -2090,9 +2101,9 @@ void enetc_init_si_rings_params(struct enetc_ndev_pri= v *priv) */ priv->num_rx_rings =3D min_t(int, cpus, si->num_rx_rings); priv->num_tx_rings =3D si->num_tx_rings; - priv->bdr_int_num =3D cpus; + priv->bdr_int_num =3D priv->num_rx_rings; priv->ic_mode =3D ENETC_IC_RX_ADAPTIVE | ENETC_IC_TX_MANUAL; - priv->tx_ictt =3D ENETC_TXIC_TIMETHR; + priv->tx_ictt =3D enetc_usecs_to_cycles(600, priv->sysclk_freq); } EXPORT_SYMBOL_GPL(enetc_init_si_rings_params); =20 @@ -2501,10 +2512,14 @@ int enetc_open(struct net_device *ndev) =20 extended =3D !!(priv->active_offloads & ENETC_F_RX_TSTAMP); =20 - err =3D enetc_setup_irqs(priv); + err =3D clk_prepare_enable(priv->ref_clk); if (err) return err; =20 + err =3D enetc_setup_irqs(priv); + if (err) + goto err_setup_irqs; + err =3D enetc_phylink_connect(ndev); if (err) goto err_phy_connect; @@ -2536,6 +2551,8 @@ int enetc_open(struct net_device *ndev) phylink_disconnect_phy(priv->phylink); err_phy_connect: enetc_free_irqs(priv); +err_setup_irqs: + clk_disable_unprepare(priv->ref_clk); =20 return err; } @@ -2589,6 +2606,7 @@ int enetc_close(struct net_device *ndev) enetc_assign_tx_resources(priv, NULL); =20 enetc_free_irqs(priv); + clk_disable_unprepare(priv->ref_clk); =20 return 0; } @@ -3254,5 +3272,55 @@ void enetc_pci_remove(struct pci_dev *pdev) } EXPORT_SYMBOL_GPL(enetc_pci_remove); =20 +static const struct enetc_drvdata enetc_pf_data =3D { + .sysclk_freq =3D ENETC_CLK_400M, + .pmac_offset =3D ENETC_PMAC_OFFSET, + .eth_ops =3D &enetc_pf_ethtool_ops, +}; + +static const struct enetc_drvdata enetc4_pf_data =3D { + .sysclk_freq =3D ENETC_CLK_333M, + .pmac_offset =3D ENETC4_PMAC_OFFSET, + .eth_ops =3D &enetc4_pf_ethtool_ops, +}; + +static const struct enetc_drvdata enetc_vf_data =3D { + .sysclk_freq =3D ENETC_CLK_400M, + .eth_ops =3D &enetc_vf_ethtool_ops, +}; + +static const struct enetc_platform_info enetc_info[] =3D { + { .revision =3D ENETC_REV_1_0, + .dev_id =3D ENETC_DEV_ID_PF, + .data =3D &enetc_pf_data, + }, + { .revision =3D ENETC_REV_4_1, + .dev_id =3D NXP_ENETC_PF_DEV_ID, + .data =3D &enetc4_pf_data, + }, + { .revision =3D ENETC_REV_1_0, + .dev_id =3D ENETC_DEV_ID_VF, + .data =3D &enetc_vf_data, + }, +}; + +int enetc_get_driver_data(struct enetc_si *si) +{ + u16 dev_id =3D si->pdev->device; + int i; + + for (i =3D 0; i < ARRAY_SIZE(enetc_info); i++) { + if (si->revision =3D=3D enetc_info[i].revision && + dev_id =3D=3D enetc_info[i].dev_id) { + si->drvdata =3D enetc_info[i].data; + + return 0; + } + } + + return -ERANGE; +} +EXPORT_SYMBOL_GPL(enetc_get_driver_data); + MODULE_DESCRIPTION("NXP ENETC Ethernet driver"); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/eth= ernet/freescale/enetc/enetc.h index fb7d98d57783..72fa03dbc2dd 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -14,6 +14,7 @@ #include =20 #include "enetc_hw.h" +#include "enetc4_hw.h" =20 #define ENETC_MAC_MAXFRM_SIZE 9600 #define ENETC_MAX_MTU (ENETC_MAC_MAXFRM_SIZE - \ @@ -231,6 +232,18 @@ enum enetc_errata { #define ENETC_SI_F_QBV BIT(1) #define ENETC_SI_F_QBU BIT(2) =20 +struct enetc_drvdata { + u32 pmac_offset; /* Only valid for PSI which supports 802.1Qbu */ + u64 sysclk_freq; + const struct ethtool_ops *eth_ops; +}; + +struct enetc_platform_info { + u16 revision; + u16 dev_id; + const struct enetc_drvdata *data; +}; + /* PCI IEP device data */ struct enetc_si { struct pci_dev *pdev; @@ -246,11 +259,18 @@ struct enetc_si { int num_fs_entries; int num_rss; /* number of RSS buckets */ unsigned short pad; + u16 revision; int hw_features; + const struct enetc_drvdata *drvdata; }; =20 #define ENETC_SI_ALIGN 32 =20 +static inline bool is_enetc_rev1(struct enetc_si *si) +{ + return si->pdev->revision =3D=3D ENETC_REV1; +} + static inline void *enetc_si_priv(const struct enetc_si *si) { return (char *)si + ALIGN(sizeof(struct enetc_si), ENETC_SI_ALIGN); @@ -302,7 +322,7 @@ struct enetc_cls_rule { int used; }; =20 -#define ENETC_MAX_BDR_INT 2 /* fixed to max # of available cpus */ +#define ENETC_MAX_BDR_INT 6 /* fixed to max # of available cpus */ struct psfp_cap { u32 max_streamid; u32 max_psfp_filter; @@ -341,7 +361,6 @@ enum enetc_ic_mode { =20 #define ENETC_RXIC_PKTTHR min_t(u32, 256, ENETC_RX_RING_DEFAULT_SIZE / 2) #define ENETC_TXIC_PKTTHR min_t(u32, 128, ENETC_TX_RING_DEFAULT_SIZE / 2) -#define ENETC_TXIC_TIMETHR enetc_usecs_to_cycles(600) =20 struct enetc_ndev_priv { struct net_device *ndev; @@ -389,6 +408,9 @@ struct enetc_ndev_priv { * and link state updates */ struct mutex mm_lock; + + struct clk *ref_clk; /* RGMII/RMII reference clock */ + u64 sysclk_freq; /* NETC system clock frequency */ }; =20 /* Messaging */ @@ -418,6 +440,7 @@ void enetc_init_si_rings_params(struct enetc_ndev_priv = *priv); int enetc_alloc_si_resources(struct enetc_ndev_priv *priv); void enetc_free_si_resources(struct enetc_ndev_priv *priv); int enetc_configure_si(struct enetc_ndev_priv *priv); +int enetc_get_driver_data(struct enetc_si *si); =20 int enetc_open(struct net_device *ndev); int enetc_close(struct net_device *ndev); @@ -434,6 +457,9 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_fra= mes, struct xdp_frame **frames, u32 flags); =20 /* ethtool */ +extern const struct ethtool_ops enetc_pf_ethtool_ops; +extern const struct ethtool_ops enetc4_pf_ethtool_ops; +extern const struct ethtool_ops enetc_vf_ethtool_ops; void enetc_set_ethtool_ops(struct net_device *ndev); void enetc_mm_link_state_update(struct enetc_ndev_priv *priv, bool link); void enetc_mm_commit_preemptible_tcs(struct enetc_ndev_priv *priv); diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h b/drivers/net= /ethernet/freescale/enetc/enetc4_hw.h new file mode 100644 index 000000000000..26b220677448 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h @@ -0,0 +1,155 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* + * This header file defines the register offsets and bit fields + * of ENETC4 PF and VFs. Note that the same registers as ENETC + * version 1.0 are defined in the enetc_hw.h file. + * + * Copyright 2024 NXP + */ +#ifndef __ENETC4_HW_H_ +#define __ENETC4_HW_H_ + +#define NXP_ENETC_VENDOR_ID 0x1131 +#define NXP_ENETC_PF_DEV_ID 0xe101 + +/***************************ENETC port registers**************************/ +#define ENETC4_ECAPR0 0x0 +#define ECAPR0_RFS BIT(2) +#define ECAPR0_TSD BIT(5) +#define ECAPR0_RSS BIT(8) +#define ECAPR0_RSC BIT(9) +#define ECAPR0_LSO BIT(10) +#define ECAPR0_WO BIT(13) + +#define ENETC4_ECAPR1 0x4 +#define ECAPR1_NUM_TCS GENMASK(6, 4) +#define ECAPR1_NUM_MCH GENMASK(9, 8) +#define ECAPR1_NUM_UCH GENMASK(11, 10) +#define ECAPR1_NUM_MSIX GENMASK(22, 12) +#define ECAPR1_NUM_VSI GENMASK(27, 24) +#define ECAPR1_NUM_IPV BIT(31) + +#define ENETC4_ECAPR2 0x8 +#define ECAPR2_NUM_TX_BDR GENMASK(9, 0) +#define ECAPR2_NUM_RX_BDR GENMASK(25, 16) + +#define ENETC4_PMR 0x10 +#define PMR_SI_EN(a) BIT((16 + (a))) + +/* Port Pause ON/OFF threshold register */ +#define ENETC4_PPAUONTR 0x108 +#define ENETC4_PPAUOFFTR 0x10c + +/* Port Station interface promiscuous MAC mode register */ +#define ENETC4_PSIPMMR 0x200 +#define PSIPMMR_SI_MAC_UP(a) BIT(a) /* a =3D SI index */ +#define PSIPMMR_SI_MAC_MP(a) BIT((a) + 16) + +/* Port Station interface promiscuous VLAN mode register */ +#define ENETC4_PSIPVMR 0x204 + +/* Port RSS key register n. n =3D 0,1,2,...,9 */ +#define ENETC4_PRSSKR(n) ((n) * 0x4 + 0x250) + +/* Port station interface MAC address filtering capability register */ +#define ENETC4_PSIMAFCAPR 0x280 +#define PSIMAFCAPR_NUM_MAC_AFTE GENMASK(11, 0) + +/* Port station interface VLAN filtering capability register */ +#define ENETC4_PSIVLANFCAPR 0x2c0 +#define PSIVLANFCAPR_NUM_VLAN_FTE GENMASK(11, 0) + +/* Port station interface VLAN filtering mode register */ +#define ENETC4_PSIVLANFMR 0x2c4 +#define PSIVLANFMR_VS BIT(0) + +/* Port Station interface a primary MAC address registers */ +#define ENETC4_PSIPMAR0(a) ((a) * 0x80 + 0x2000) +#define ENETC4_PSIPMAR1(a) ((a) * 0x80 + 0x2004) + +/* Port station interface a configuration register 0/2 */ +#define ENETC4_PSICFGR0(a) ((a) * 0x80 + 0x2010) +#define PSICFGR0_VASE BIT(13) +#define PSICFGR0_ASE BIT(15) +#define PSICFGR0_ANTI_SPOOFING (PSICFGR0_VASE | PSICFGR0_ASE) + +#define ENETC4_PSICFGR2(a) ((a) * 0x80 + 0x2018) +#define PSICFGR2_NUM_MSIX GENMASK(5, 0) + +#define ENETC4_PMCAPR 0x4004 +#define PMCAPR_HD BIT(8) +#define PMCAPR_FP GENMASK(10, 9) + +/* Port configuration register */ +#define ENETC4_PCR 0x4010 +#define PCR_HDR_FMT BIT(0) +#define PCR_L2DOSE BIT(4) +#define PCR_TIMER_CS BIT(8) +#define PCR_PSPEED GENMASK(29, 16) +#define PCR_PSPEED_VAL(speed) (((speed) / 10 - 1) << 16) + +/* Port MAC address register 0/1 */ +#define ENETC4_PMAR0 0x4020 +#define ENETC4_PMAR1 0x4024 + +/* Port operational register */ +#define ENETC4_POR 0x4100 + +/* Port traffic class a transmit maximum SDU register */ +#define ENETC4_PTCTMSDUR(a) ((a) * 0x20 + 0x4208) +#define PTCTMSDUR_MAXSDU GENMASK(15, 0) +#define PTCTMSDUR_SDU_TYPE GENMASK(17, 16) +#define SDU_TYPE_PPDU 0 +#define SDU_TYPE_MPDU 1 +#define SDU_TYPE_MSDU 2 + +#define ENETC4_PMAC_OFFSET 0x400 +#define ENETC4_PM_CMD_CFG(mac) (0x5008 + (mac) * 0x400) +#define PM_CMD_CFG_TX_EN BIT(0) +#define PM_CMD_CFG_RX_EN BIT(1) +#define PM_CMD_CFG_PAUSE_FWD BIT(7) +#define PM_CMD_CFG_PAUSE_IGN BIT(8) +#define PM_CMD_CFG_TX_ADDR_INS BIT(9) +#define PM_CMD_CFG_LOOP_EN BIT(10) +#define PM_CMD_CFG_LPBK_MODE GENMASK(12, 11) +#define LPBCK_MODE_EXT_TX_CLK 0 +#define LPBCK_MODE_MAC_LEVEL 1 +#define LPBCK_MODE_INT_TX_CLK 2 +#define PM_CMD_CFG_CNT_FRM_EN BIT(13) +#define PM_CMD_CFG_TXP BIT(15) +#define PM_CMD_CFG_SEND_IDLE BIT(16) +#define PM_CMD_CFG_HD_FCEN BIT(18) +#define PM_CMD_CFG_SFD BIT(21) +#define PM_CMD_CFG_TX_FLUSH BIT(22) +#define PM_CMD_CFG_TX_LOWP_EN BIT(23) +#define PM_CMD_CFG_RX_LOWP_EMPTY BIT(24) +#define PM_CMD_CFG_SWR BIT(26) +#define PM_CMD_CFG_TS_MODE BIT(30) +#define PM_CMD_CFG_MG BIT(31) + +/* Port MAC 0/1 Maximum Frame Length Register */ +#define ENETC4_PM_MAXFRM(mac) (0x5014 + (mac) * 0x400) + +/* Port MAC 0/1 Pause Quanta Register */ +#define ENETC4_PM_PAUSE_QUANTA(mac) (0x5054 + (mac) * 0x400) + +/* Port MAC 0/1 Pause Quanta Threshold Register */ +#define ENETC4_PM_PAUSE_THRESH(mac) (0x5064 + (mac) * 0x400) + +/* Port MAC 0 Interface Mode Control Register */ +#define ENETC4_PM_IF_MODE(mac) (0x5300 + (mac) * 0x400) +#define PM_IF_MODE_IFMODE GENMASK(2, 0) +#define IFMODE_XGMII 0 +#define IFMODE_RMII 3 +#define IFMODE_RGMII 4 +#define IFMODE_SGMII 5 +#define PM_IF_MODE_REVMII BIT(3) +#define PM_IF_MODE_M10 BIT(4) +#define PM_IF_MODE_HD BIT(6) +#define PM_IF_MODE_SSP GENMASK(14, 13) +#define SSP_100M 0 +#define SSP_10M 1 +#define SSP_1G 2 +#define PM_IF_MODE_ENA BIT(15) + +#endif diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net= /ethernet/freescale/enetc/enetc4_pf.c new file mode 100644 index 000000000000..31dbe89dd3a9 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c @@ -0,0 +1,756 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2024 NXP */ + +#include +#include +#include +#include +#include + +#include "enetc_pf_common.h" + +#define ENETC_SI_MAX_RING_NUM 8 + +static void enetc4_get_port_caps(struct enetc_pf *pf) +{ + struct enetc_hw *hw =3D &pf->si->hw; + u32 val; + + val =3D enetc_port_rd(hw, ENETC4_ECAPR1); + pf->caps.num_vsi =3D (val & ECAPR1_NUM_VSI) >> 24; + pf->caps.num_msix =3D ((val & ECAPR1_NUM_MSIX) >> 12) + 1; + + val =3D enetc_port_rd(hw, ENETC4_ECAPR2); + pf->caps.num_rx_bdr =3D (val & ECAPR2_NUM_RX_BDR) >> 16; + pf->caps.num_tx_bdr =3D val & ECAPR2_NUM_TX_BDR; + + val =3D enetc_port_rd(hw, ENETC4_PMCAPR); + pf->caps.half_duplex =3D (val & PMCAPR_HD) ? 1 : 0; +} + +static void enetc4_pf_set_si_primary_mac(struct enetc_hw *hw, int si, + const u8 *addr) +{ + u16 lower =3D get_unaligned_le16(addr + 4); + u32 upper =3D get_unaligned_le32(addr); + + if (si !=3D 0) { + __raw_writel(upper, hw->port + ENETC4_PSIPMAR0(si)); + __raw_writew(lower, hw->port + ENETC4_PSIPMAR1(si)); + } else { + __raw_writel(upper, hw->port + ENETC4_PMAR0); + __raw_writew(lower, hw->port + ENETC4_PMAR1); + } +} + +static void enetc4_pf_get_si_primary_mac(struct enetc_hw *hw, int si, + u8 *addr) +{ + u32 upper; + u16 lower; + + upper =3D __raw_readl(hw->port + ENETC4_PSIPMAR0(si)); + lower =3D __raw_readw(hw->port + ENETC4_PSIPMAR1(si)); + + put_unaligned_le32(upper, addr); + put_unaligned_le16(lower, addr + 4); +} + +static const struct enetc_pf_ops enetc4_pf_ops =3D { + .set_si_primary_mac =3D enetc4_pf_set_si_primary_mac, + .get_si_primary_mac =3D enetc4_pf_get_si_primary_mac, +}; + +static int enetc4_pf_struct_init(struct enetc_si *si) +{ + struct enetc_pf *pf =3D enetc_si_priv(si); + + pf->si =3D si; + pf->total_vfs =3D pci_sriov_get_totalvfs(si->pdev); + pf->ops =3D &enetc4_pf_ops; + + enetc4_get_port_caps(pf); + + return 0; +} + +static u32 enetc4_psicfgr0_val_construct(bool is_vf, u32 num_tx_bdr, u32 n= um_rx_bdr) +{ + u32 val; + + val =3D ENETC_PSICFGR0_SET_TXBDR(num_tx_bdr); + val |=3D ENETC_PSICFGR0_SET_RXBDR(num_rx_bdr); + val |=3D ENETC_PSICFGR0_SIVC(ENETC_VLAN_TYPE_C | ENETC_VLAN_TYPE_S); + + if (is_vf) + val |=3D ENETC_PSICFGR0_VTE | ENETC_PSICFGR0_SIVIE; + + return val; +} + +static void enetc4_default_rings_allocation(struct enetc_pf *pf) +{ + struct enetc_hw *hw =3D &pf->si->hw; + u32 num_rx_bdr, num_tx_bdr, val; + u32 vf_tx_bdr, vf_rx_bdr; + int i, rx_rem, tx_rem; + + if (pf->caps.num_rx_bdr < ENETC_SI_MAX_RING_NUM + pf->caps.num_vsi) + num_rx_bdr =3D pf->caps.num_rx_bdr - pf->caps.num_vsi; + else + num_rx_bdr =3D ENETC_SI_MAX_RING_NUM; + + if (pf->caps.num_tx_bdr < ENETC_SI_MAX_RING_NUM + pf->caps.num_vsi) + num_tx_bdr =3D pf->caps.num_tx_bdr - pf->caps.num_vsi; + else + num_tx_bdr =3D ENETC_SI_MAX_RING_NUM; + + val =3D enetc4_psicfgr0_val_construct(false, num_tx_bdr, num_rx_bdr); + enetc_port_wr(hw, ENETC4_PSICFGR0(0), val); + + num_rx_bdr =3D pf->caps.num_rx_bdr - num_rx_bdr; + rx_rem =3D num_rx_bdr % pf->caps.num_vsi; + num_rx_bdr =3D num_rx_bdr / pf->caps.num_vsi; + + num_tx_bdr =3D pf->caps.num_tx_bdr - num_tx_bdr; + tx_rem =3D num_tx_bdr % pf->caps.num_vsi; + num_tx_bdr =3D num_tx_bdr / pf->caps.num_vsi; + + for (i =3D 0; i < pf->caps.num_vsi; i++) { + vf_tx_bdr =3D (i < tx_rem) ? num_tx_bdr + 1 : num_tx_bdr; + vf_rx_bdr =3D (i < rx_rem) ? num_rx_bdr + 1 : num_rx_bdr; + val =3D enetc4_psicfgr0_val_construct(true, vf_tx_bdr, vf_rx_bdr); + enetc_port_wr(hw, ENETC4_PSICFGR0(i + 1), val); + } +} + +static void enetc4_allocate_si_rings(struct enetc_pf *pf) +{ + enetc4_default_rings_allocation(pf); +} + +static void enetc4_pf_set_si_vlan_promisc(struct enetc_hw *hw, int si, boo= l en) +{ + u32 val =3D enetc_port_rd(hw, ENETC4_PSIPVMR); + + if (en) + val |=3D BIT(si); + else + val &=3D ~BIT(si); + + enetc_port_wr(hw, ENETC4_PSIPVMR, val); +} + +static void enetc4_set_default_si_vlan_promisc(struct enetc_pf *pf) +{ + struct enetc_hw *hw =3D &pf->si->hw; + int num_si =3D pf->caps.num_vsi + 1; + int i; + + /* enforce VLAN promiscuous mode for all SIs */ + for (i =3D 0; i < num_si; i++) + enetc4_pf_set_si_vlan_promisc(hw, i, true); +} + +/* Allocate the number of MSI-X vectors for per SI. */ +static void enetc4_set_si_msix_num(struct enetc_pf *pf) +{ + struct enetc_hw *hw =3D &pf->si->hw; + int i, num_msix, total_si; + u32 val; + + total_si =3D pf->caps.num_vsi + 1; + + num_msix =3D pf->caps.num_msix / total_si + + pf->caps.num_msix % total_si - 1; + val =3D num_msix & PSICFGR2_NUM_MSIX; + enetc_port_wr(hw, ENETC4_PSICFGR2(0), val); + + num_msix =3D pf->caps.num_msix / total_si - 1; + val =3D num_msix & PSICFGR2_NUM_MSIX; + for (i =3D 0; i < pf->caps.num_vsi; i++) + enetc_port_wr(hw, ENETC4_PSICFGR2(i + 1), val); +} + +static void enetc4_enable_all_si(struct enetc_pf *pf) +{ + struct enetc_hw *hw =3D &pf->si->hw; + int num_si =3D pf->caps.num_vsi + 1; + u32 si_bitmap =3D 0; + int i; + + /* Master enable for all SIs */ + for (i =3D 0; i < num_si; i++) + si_bitmap |=3D PMR_SI_EN(i); + + enetc_port_wr(hw, ENETC4_PMR, si_bitmap); +} + +static void enetc4_configure_port_si(struct enetc_pf *pf) +{ + struct enetc_hw *hw =3D &pf->si->hw; + + enetc4_allocate_si_rings(pf); + + /* Outer VLAN tag will be used for VLAN filtering */ + enetc_port_wr(hw, ENETC4_PSIVLANFMR, PSIVLANFMR_VS); + + enetc4_set_default_si_vlan_promisc(pf); + + /* Disable SI MAC multicast & unicast promiscuous */ + enetc_port_wr(hw, ENETC4_PSIPMMR, 0); + + enetc4_set_si_msix_num(pf); + + enetc4_enable_all_si(pf); +} + +static void enetc4_pf_reset_tc_msdu(struct enetc_hw *hw) +{ + u32 val =3D ENETC_MAC_MAXFRM_SIZE; + int tc; + + val =3D u32_replace_bits(val, SDU_TYPE_MPDU, PTCTMSDUR_SDU_TYPE); + + for (tc =3D 0; tc < ENETC_NUM_TC; tc++) + enetc_port_wr(hw, ENETC4_PTCTMSDUR(tc), val); +} + +static void enetc4_set_trx_frame_size(struct enetc_pf *pf) +{ + struct enetc_si *si =3D pf->si; + + enetc_port_mac_wr(si, ENETC4_PM_MAXFRM(0), + ENETC_SET_MAXFRM(ENETC_MAC_MAXFRM_SIZE)); + + enetc4_pf_reset_tc_msdu(&si->hw); +} + +static void enetc4_set_rss_key(struct enetc_hw *hw, const u8 *bytes) +{ + int i; + + for (i =3D 0; i < ENETC_RSSHASH_KEY_SIZE / 4; i++) + enetc_port_wr(hw, ENETC4_PRSSKR(i), ((u32 *)bytes)[i]); +} + +static void enetc4_set_default_rss_key(struct enetc_pf *pf) +{ + u8 hash_key[ENETC_RSSHASH_KEY_SIZE] =3D {0}; + struct enetc_hw *hw =3D &pf->si->hw; + + /* set up hash key */ + get_random_bytes(hash_key, ENETC_RSSHASH_KEY_SIZE); + enetc4_set_rss_key(hw, hash_key); +} + +static void enetc4_enable_trx(struct enetc_pf *pf) +{ + struct enetc_hw *hw =3D &pf->si->hw; + + /* Enable port transmit/receive */ + enetc_port_wr(hw, ENETC4_POR, 0); +} + +static void enetc4_configure_port(struct enetc_pf *pf) +{ + enetc4_configure_port_si(pf); + enetc4_set_trx_frame_size(pf); + enetc4_set_default_rss_key(pf); + enetc4_enable_trx(pf); +} + +static int enetc4_pf_init(struct enetc_pf *pf) +{ + struct device *dev =3D &pf->si->pdev->dev; + int err; + + /* Initialize the MAC address for PF and VFs */ + err =3D enetc_setup_mac_addresses(dev->of_node, pf); + if (err) { + dev_err(dev, "Failed to set MAC addresses\n"); + return err; + } + + enetc4_configure_port(pf); + + return 0; +} + +static const struct net_device_ops enetc4_ndev_ops =3D { + .ndo_open =3D enetc_open, + .ndo_stop =3D enetc_close, + .ndo_start_xmit =3D enetc_xmit, + .ndo_get_stats =3D enetc_get_stats, + .ndo_set_mac_address =3D enetc_pf_set_mac_addr, +}; + +static struct phylink_pcs * +enetc4_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t if= ace) +{ + struct enetc_pf *pf =3D phylink_to_enetc_pf(config); + + return pf->pcs; +} + +static void enetc4_mac_config(struct enetc_pf *pf, unsigned int mode, + phy_interface_t phy_mode) +{ + struct enetc_ndev_priv *priv =3D netdev_priv(pf->si->ndev); + struct enetc_si *si =3D pf->si; + u32 val; + + val =3D enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val &=3D ~(PM_IF_MODE_IFMODE | PM_IF_MODE_ENA); + + switch (phy_mode) { + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + val |=3D IFMODE_RGMII; + /* We need to enable auto-negotiation for the MAC + * if its RGMII interface support In-Band status. + */ + if (phylink_autoneg_inband(mode)) + val |=3D PM_IF_MODE_ENA; + break; + case PHY_INTERFACE_MODE_RMII: + val |=3D IFMODE_RMII; + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_2500BASEX: + val |=3D IFMODE_SGMII; + break; + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_USXGMII: + val |=3D IFMODE_XGMII; + break; + default: + dev_err(priv->dev, + "Unsupported PHY mode:%d\n", phy_mode); + return; + } + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_pl_mac_config(struct phylink_config *config, unsigned i= nt mode, + const struct phylink_link_state *state) +{ + struct enetc_pf *pf =3D phylink_to_enetc_pf(config); + + enetc4_mac_config(pf, mode, state->interface); +} + +static void enetc4_set_port_speed(struct enetc_ndev_priv *priv, int speed) +{ + u32 old_speed =3D priv->speed; + u32 val; + + if (speed =3D=3D old_speed) + return; + + val =3D enetc_port_rd(&priv->si->hw, ENETC4_PCR); + val &=3D ~PCR_PSPEED; + + switch (speed) { + case SPEED_100: + case SPEED_1000: + case SPEED_2500: + case SPEED_10000: + val |=3D (PCR_PSPEED & PCR_PSPEED_VAL(speed)); + break; + case SPEED_10: + default: + val |=3D (PCR_PSPEED & PCR_PSPEED_VAL(SPEED_10)); + } + + priv->speed =3D speed; + enetc_port_wr(&priv->si->hw, ENETC4_PCR, val); +} + +static void enetc4_set_rgmii_mac(struct enetc_pf *pf, int speed, int duple= x) +{ + struct enetc_si *si =3D pf->si; + u32 old_val, val; + + old_val =3D enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val =3D old_val & ~(PM_IF_MODE_ENA | PM_IF_MODE_M10 | PM_IF_MODE_REVMII); + + switch (speed) { + case SPEED_1000: + val =3D u32_replace_bits(val, SSP_1G, PM_IF_MODE_SSP); + break; + case SPEED_100: + val =3D u32_replace_bits(val, SSP_100M, PM_IF_MODE_SSP); + break; + case SPEED_10: + val =3D u32_replace_bits(val, SSP_10M, PM_IF_MODE_SSP); + } + + val =3D u32_replace_bits(val, duplex =3D=3D DUPLEX_FULL ? 0 : 1, + PM_IF_MODE_HD); + + if (val =3D=3D old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_set_rmii_mac(struct enetc_pf *pf, int speed, int duplex) +{ + struct enetc_si *si =3D pf->si; + u32 old_val, val; + + old_val =3D enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val =3D old_val & ~(PM_IF_MODE_ENA | PM_IF_MODE_SSP); + + switch (speed) { + case SPEED_100: + val &=3D ~PM_IF_MODE_M10; + break; + case SPEED_10: + val |=3D PM_IF_MODE_M10; + } + + val =3D u32_replace_bits(val, duplex =3D=3D DUPLEX_FULL ? 0 : 1, + PM_IF_MODE_HD); + + if (val =3D=3D old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_set_hd_flow_control(struct enetc_pf *pf, bool enable) +{ + struct enetc_si *si =3D pf->si; + u32 old_val, val; + + if (!pf->caps.half_duplex) + return; + + old_val =3D enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val =3D u32_replace_bits(old_val, enable ? 1 : 0, PM_CMD_CFG_HD_FCEN); + if (val =3D=3D old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_set_rx_pause(struct enetc_pf *pf, bool rx_pause) +{ + struct enetc_si *si =3D pf->si; + u32 old_val, val; + + old_val =3D enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val =3D u32_replace_bits(old_val, rx_pause ? 0 : 1, PM_CMD_CFG_PAUSE_IGN); + if (val =3D=3D old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_set_tx_pause(struct enetc_pf *pf, int num_rxbdr, bool t= x_pause) +{ + u32 pause_off_thresh =3D 0, pause_on_thresh =3D 0; + u32 init_quanta =3D 0, refresh_quanta =3D 0; + struct enetc_hw *hw =3D &pf->si->hw; + u32 rbmr, old_rbmr; + int i; + + for (i =3D 0; i < num_rxbdr; i++) { + old_rbmr =3D enetc_rxbdr_rd(hw, i, ENETC_RBMR); + rbmr =3D u32_replace_bits(old_rbmr, tx_pause ? 1 : 0, ENETC_RBMR_CM); + if (rbmr =3D=3D old_rbmr) + continue; + + enetc_rxbdr_wr(hw, i, ENETC_RBMR, rbmr); + } + + if (tx_pause) { + /* When the port first enters congestion, send a PAUSE request + * with the maximum number of quanta. When the port exits + * congestion, it will automatically send a PAUSE frame with + * zero quanta. + */ + init_quanta =3D 0xffff; + + /* Also, set up the refresh timer to send follow-up PAUSE + * frames at half the quanta value, in case the congestion + * condition persists. + */ + refresh_quanta =3D 0xffff / 2; + + /* Start emitting PAUSE frames when 3 large frames (or more + * smaller frames) have accumulated in the FIFO waiting to be + * DMAed to the RX ring. + */ + pause_on_thresh =3D 3 * ENETC_MAC_MAXFRM_SIZE; + pause_off_thresh =3D 1 * ENETC_MAC_MAXFRM_SIZE; + } + + enetc_port_mac_wr(pf->si, ENETC4_PM_PAUSE_QUANTA(0), init_quanta); + enetc_port_mac_wr(pf->si, ENETC4_PM_PAUSE_THRESH(0), refresh_quanta); + enetc_port_wr(hw, ENETC4_PPAUONTR, pause_on_thresh); + enetc_port_wr(hw, ENETC4_PPAUOFFTR, pause_off_thresh); +} + +static void enetc4_enable_mac(struct enetc_pf *pf, bool en) +{ + struct enetc_si *si =3D pf->si; + u32 val; + + val =3D enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val &=3D ~(PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN); + val |=3D en ? (PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN) : 0; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_pl_mac_link_up(struct phylink_config *config, + struct phy_device *phy, unsigned int mode, + phy_interface_t interface, int speed, + int duplex, bool tx_pause, bool rx_pause) +{ + struct enetc_pf *pf =3D phylink_to_enetc_pf(config); + struct enetc_si *si =3D pf->si; + struct enetc_ndev_priv *priv; + bool hd_fc =3D false; + + priv =3D netdev_priv(si->ndev); + enetc4_set_port_speed(priv, speed); + + if (!phylink_autoneg_inband(mode) && + phy_interface_mode_is_rgmii(interface)) + enetc4_set_rgmii_mac(pf, speed, duplex); + + if (interface =3D=3D PHY_INTERFACE_MODE_RMII) + enetc4_set_rmii_mac(pf, speed, duplex); + + if (duplex =3D=3D DUPLEX_FULL) { + /* When preemption is enabled, generation of PAUSE frames + * must be disabled, as stated in the IEEE 802.3 standard. + */ + if (priv->active_offloads & ENETC_F_QBU) + tx_pause =3D false; + } else { /* DUPLEX_HALF */ + if (tx_pause || rx_pause) + hd_fc =3D true; + + /* As per 802.3 annex 31B, PAUSE frames are only supported + * when the link is configured for full duplex operation. + */ + tx_pause =3D false; + rx_pause =3D false; + } + + enetc4_set_hd_flow_control(pf, hd_fc); + enetc4_set_tx_pause(pf, priv->num_rx_rings, tx_pause); + enetc4_set_rx_pause(pf, rx_pause); + enetc4_enable_mac(pf, true); +} + +static void enetc4_pl_mac_link_down(struct phylink_config *config, + unsigned int mode, + phy_interface_t interface) +{ + struct enetc_pf *pf =3D phylink_to_enetc_pf(config); + + enetc4_enable_mac(pf, false); +} + +static const struct phylink_mac_ops enetc_pl_mac_ops =3D { + .mac_select_pcs =3D enetc4_pl_mac_select_pcs, + .mac_config =3D enetc4_pl_mac_config, + .mac_link_up =3D enetc4_pl_mac_link_up, + .mac_link_down =3D enetc4_pl_mac_link_down, +}; + +static void enetc4_pci_remove(void *data) +{ + struct pci_dev *pdev =3D data; + + enetc_pci_remove(pdev); +} + +static int enetc4_link_init(struct enetc_ndev_priv *priv, + struct device_node *node) +{ + struct enetc_pf *pf =3D enetc_si_priv(priv->si); + struct device *dev =3D priv->dev; + int err; + + err =3D of_get_phy_mode(node, &pf->if_mode); + if (err) { + dev_err(dev, "Failed to get PHY mode\n"); + return err; + } + + err =3D enetc_mdiobus_create(pf, node); + if (err) { + dev_err(dev, "Failed to create MDIO bus\n"); + return err; + } + + err =3D enetc_phylink_create(priv, node, &enetc_pl_mac_ops); + if (err) { + dev_err(dev, "Failed to create phylink\n"); + goto err_phylink_create; + } + + return 0; + +err_phylink_create: + enetc_mdiobus_destroy(pf); + + return err; +} + +static void enetc4_link_deinit(struct enetc_ndev_priv *priv) +{ + struct enetc_pf *pf =3D enetc_si_priv(priv->si); + + enetc_phylink_destroy(priv); + enetc_mdiobus_destroy(pf); +} + +static int enetc4_pf_netdev_create(struct enetc_si *si) +{ + struct device *dev =3D &si->pdev->dev; + struct enetc_ndev_priv *priv; + struct net_device *ndev; + int err; + + ndev =3D alloc_etherdev_mqs(sizeof(struct enetc_ndev_priv), + si->num_tx_rings, si->num_rx_rings); + if (!ndev) + return -ENOMEM; + + priv =3D netdev_priv(ndev); + priv->ref_clk =3D devm_clk_get_optional(dev, "ref"); + if (IS_ERR(priv->ref_clk)) { + dev_err(dev, "Get referencce clock failed\n"); + err =3D PTR_ERR(priv->ref_clk); + goto err_clk_get; + } + + enetc_pf_netdev_setup(si, ndev, &enetc4_ndev_ops); + + enetc_init_si_rings_params(priv); + + err =3D enetc_configure_si(priv); + if (err) { + dev_err(dev, "Failed to configure SI\n"); + goto err_config_si; + } + + err =3D enetc_alloc_msix(priv); + if (err) { + dev_err(dev, "Failed to alloc MSI-X\n"); + goto err_alloc_msix; + } + + err =3D enetc4_link_init(priv, dev->of_node); + if (err) + goto err_link_init; + + err =3D register_netdev(ndev); + if (err) { + dev_err(dev, "Failed to register netdev\n"); + goto err_reg_netdev; + } + + return 0; + +err_reg_netdev: + enetc4_link_deinit(priv); +err_link_init: + enetc_free_msix(priv); +err_alloc_msix: +err_config_si: +err_clk_get: + mutex_destroy(&priv->mm_lock); + free_netdev(ndev); + + return err; +} + +static void enetc4_pf_netdev_destroy(struct enetc_si *si) +{ + struct enetc_ndev_priv *priv =3D netdev_priv(si->ndev); + struct net_device *ndev =3D si->ndev; + + unregister_netdev(ndev); + enetc_free_msix(priv); + free_netdev(ndev); +} + +static int enetc4_pf_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + struct device *dev =3D &pdev->dev; + struct enetc_si *si; + struct enetc_pf *pf; + int err; + + err =3D enetc_pci_probe(pdev, KBUILD_MODNAME, sizeof(*pf)); + if (err) + return dev_err_probe(dev, err, "PCIe probing failed\n"); + + err =3D devm_add_action_or_reset(dev, enetc4_pci_remove, pdev); + if (err) + return dev_err_probe(dev, err, + "Add enetc4_pci_remove() action failed\n"); + + /* si is the private data. */ + si =3D pci_get_drvdata(pdev); + if (!si->hw.port || !si->hw.global) + return dev_err_probe(dev, -ENODEV, + "Couldn't map PF only space\n"); + + si->revision =3D enetc_get_ip_revision(&si->hw); + err =3D enetc_get_driver_data(si); + if (err) + return dev_err_probe(dev, err, + "Could not get VF driver data\n"); + + err =3D enetc4_pf_struct_init(si); + if (err) + return err; + + pf =3D enetc_si_priv(si); + err =3D enetc4_pf_init(pf); + if (err) + return err; + + enetc_get_si_caps(si); + + return enetc4_pf_netdev_create(si); +} + +static void enetc4_pf_remove(struct pci_dev *pdev) +{ + struct enetc_si *si =3D pci_get_drvdata(pdev); + + enetc4_pf_netdev_destroy(si); +} + +static const struct pci_device_id enetc4_pf_id_table[] =3D { + { PCI_DEVICE(NXP_ENETC_VENDOR_ID, NXP_ENETC_PF_DEV_ID) }, + { 0, } /* End of table. */ +}; +MODULE_DEVICE_TABLE(pci, enetc4_pf_id_table); + +static struct pci_driver enetc4_pf_driver =3D { + .name =3D KBUILD_MODNAME, + .id_table =3D enetc4_pf_id_table, + .probe =3D enetc4_pf_probe, + .remove =3D enetc4_pf_remove, +}; +module_pci_driver(enetc4_pf_driver); + +MODULE_DESCRIPTION("ENETC4 PF Driver"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers= /net/ethernet/freescale/enetc/enetc_ethtool.c index 2563eb8ac7b6..4c223eb90c19 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -775,9 +775,10 @@ static int enetc_get_coalesce(struct net_device *ndev, { struct enetc_ndev_priv *priv =3D netdev_priv(ndev); struct enetc_int_vector *v =3D priv->int_vector[0]; + u64 clk_freq =3D priv->sysclk_freq; =20 - ic->tx_coalesce_usecs =3D enetc_cycles_to_usecs(priv->tx_ictt); - ic->rx_coalesce_usecs =3D enetc_cycles_to_usecs(v->rx_ictt); + ic->tx_coalesce_usecs =3D enetc_cycles_to_usecs(priv->tx_ictt, clk_freq); + ic->rx_coalesce_usecs =3D enetc_cycles_to_usecs(v->rx_ictt, clk_freq); =20 ic->tx_max_coalesced_frames =3D ENETC_TXIC_PKTTHR; ic->rx_max_coalesced_frames =3D ENETC_RXIC_PKTTHR; @@ -793,12 +794,13 @@ static int enetc_set_coalesce(struct net_device *ndev, struct netlink_ext_ack *extack) { struct enetc_ndev_priv *priv =3D netdev_priv(ndev); + u64 clk_freq =3D priv->sysclk_freq; u32 rx_ictt, tx_ictt; int i, ic_mode; bool changed; =20 - tx_ictt =3D enetc_usecs_to_cycles(ic->tx_coalesce_usecs); - rx_ictt =3D enetc_usecs_to_cycles(ic->rx_coalesce_usecs); + tx_ictt =3D enetc_usecs_to_cycles(ic->tx_coalesce_usecs, clk_freq); + rx_ictt =3D enetc_usecs_to_cycles(ic->rx_coalesce_usecs, clk_freq); =20 if (ic->rx_max_coalesced_frames !=3D ENETC_RXIC_PKTTHR) return -EOPNOTSUPP; @@ -1178,7 +1180,7 @@ void enetc_mm_link_state_update(struct enetc_ndev_pri= v *priv, bool link) } EXPORT_SYMBOL_GPL(enetc_mm_link_state_update); =20 -static const struct ethtool_ops enetc_pf_ethtool_ops =3D { +const struct ethtool_ops enetc_pf_ethtool_ops =3D { .supported_coalesce_params =3D ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, @@ -1213,7 +1215,7 @@ static const struct ethtool_ops enetc_pf_ethtool_ops = =3D { .get_mm_stats =3D enetc_get_mm_stats, }; =20 -static const struct ethtool_ops enetc_vf_ethtool_ops =3D { +const struct ethtool_ops enetc_vf_ethtool_ops =3D { .supported_coalesce_params =3D ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, @@ -1234,13 +1236,26 @@ static const struct ethtool_ops enetc_vf_ethtool_op= s =3D { .get_ts_info =3D enetc_get_ts_info, }; =20 +const struct ethtool_ops enetc4_pf_ethtool_ops =3D { + .supported_coalesce_params =3D ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES | + ETHTOOL_COALESCE_USE_ADAPTIVE_RX, + .get_ringparam =3D enetc_get_ringparam, + .get_coalesce =3D enetc_get_coalesce, + .set_coalesce =3D enetc_set_coalesce, + .get_link_ksettings =3D enetc_get_link_ksettings, + .set_link_ksettings =3D enetc_set_link_ksettings, + .get_link =3D ethtool_op_get_link, + .get_wol =3D enetc_get_wol, + .set_wol =3D enetc_set_wol, + .get_pauseparam =3D enetc_get_pauseparam, + .set_pauseparam =3D enetc_set_pauseparam, +}; + void enetc_set_ethtool_ops(struct net_device *ndev) { struct enetc_ndev_priv *priv =3D netdev_priv(ndev); =20 - if (enetc_si_is_pf(priv->si)) - ndev->ethtool_ops =3D &enetc_pf_ethtool_ops; - else - ndev->ethtool_ops =3D &enetc_vf_ethtool_ops; + ndev->ethtool_ops =3D priv->si->drvdata->eth_ops; } EXPORT_SYMBOL_GPL(enetc_set_ethtool_ops); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/= ethernet/freescale/enetc/enetc_hw.h index 6a7b9b75d660..7c3285584f8a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -6,6 +6,8 @@ #define ENETC_MM_VERIFY_SLEEP_US USEC_PER_MSEC #define ENETC_MM_VERIFY_RETRIES 3 =20 +#define ENETC_NUM_TC 8 + /* ENETC device IDs */ #define ENETC_DEV_ID_PF 0xe100 #define ENETC_DEV_ID_VF 0xef00 @@ -25,6 +27,7 @@ #define ENETC_SIPCAPR0_RSS BIT(8) #define ENETC_SIPCAPR0_QBV BIT(4) #define ENETC_SIPCAPR0_QBU BIT(3) +#define ENETC_SIPCAPR0_RFS BIT(2) #define ENETC_SIPCAPR1 0x24 #define ENETC_SITGTGR 0x30 #define ENETC_SIRBGCR 0x38 @@ -368,6 +371,10 @@ enum enetc_bdr_type {TX, RX}; /** Global regs, offset: 2_0000h */ #define ENETC_GLOBAL_BASE 0x20000 #define ENETC_G_EIPBRR0 0x0bf8 +#define EIPBRR0_REVISION GENMASK(15, 0) +#define ENETC_REV_1_0 0x0100 +#define ENETC_REV_4_1 0X0401 + #define ENETC_G_EIPBRR1 0x0bfc #define ENETC_G_EPFBLPR(n) (0xd00 + 4 * (n)) #define ENETC_G_EPFBLPR1_XGMII 0x80000000 @@ -971,15 +978,17 @@ struct enetc_cbd { u8 status_flags; }; =20 -#define ENETC_CLK 400000000ULL -static inline u32 enetc_cycles_to_usecs(u32 cycles) +#define ENETC_CLK_400M 400000000ULL +#define ENETC_CLK_333M 333000000ULL + +static inline u32 enetc_cycles_to_usecs(u32 cycles, u64 clk_freq) { - return (u32)div_u64(cycles * 1000000ULL, ENETC_CLK); + return (u32)div_u64(cycles * 1000000ULL, clk_freq); } =20 -static inline u32 enetc_usecs_to_cycles(u32 usecs) +static inline u32 enetc_usecs_to_cycles(u32 usecs, u64 clk_freq) { - return (u32)div_u64(usecs * ENETC_CLK, 1000000ULL); + return (u32)div_u64(usecs * clk_freq, 1000000ULL); } =20 /* Port traffic class frame preemption register */ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/= ethernet/freescale/enetc/enetc_pf.c index 1ff9a7a3386c..a76ce41eb197 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -947,6 +947,13 @@ static struct enetc_si *enetc_psi_create(struct pci_de= v *pdev) goto out_pci_remove; } =20 + si->revision =3D enetc_get_ip_revision(&si->hw); + err =3D enetc_get_driver_data(si); + if (err) { + dev_err(&pdev->dev, "Could not get PF driver data\n"); + goto out_pci_remove; + } + err =3D enetc_setup_cbdr(&pdev->dev, &si->hw, ENETC_CBDR_DEFAULT_SIZE, &si->cbd_ring); if (err) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/= ethernet/freescale/enetc/enetc_pf.h index 53d20752aacf..a26a12863855 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -28,6 +28,14 @@ struct enetc_vf_state { enum enetc_vf_flags flags; }; =20 +struct enetc_port_caps { + u32 half_duplex:1; + int num_vsi; + int num_msix; + int num_rx_bdr; + int num_tx_bdr; +}; + struct enetc_pf; =20 struct enetc_pf_ops { @@ -61,6 +69,7 @@ struct enetc_pf { phy_interface_t if_mode; struct phylink_config phylink_config; =20 + struct enetc_port_caps caps; const struct enetc_pf_ops *ops; }; =20 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drive= rs/net/ethernet/freescale/enetc/enetc_pf_common.c index e95252e898ae..0eecfc833164 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -100,6 +100,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct = net_device *ndev, si->ndev =3D ndev; =20 priv->msg_enable =3D (NETIF_MSG_WOL << 1) - 1; + priv->sysclk_freq =3D si->drvdata->sysclk_freq; ndev->netdev_ops =3D ndev_ops; enetc_set_ethtool_ops(ndev); ndev->watchdog_timeo =3D 5 * HZ; @@ -116,10 +117,17 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struc= t net_device *ndev, ndev->vlan_features =3D NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; =20 + ndev->priv_flags |=3D IFF_UNICAST_FLT; + + /* TODO: currently, i.MX95 ENETC driver does not support advanced feature= s */ + if (!is_enetc_rev1(si)) { + ndev->hw_features &=3D ~(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK); + goto end; + } + if (si->num_rss) ndev->hw_features |=3D NETIF_F_RXHASH; =20 - ndev->priv_flags |=3D IFF_UNICAST_FLT; ndev->xdp_features =3D NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | NETDEV_XDP_ACT_NDO_XMIT_SG; @@ -131,6 +139,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct = net_device *ndev, ndev->hw_features |=3D NETIF_F_HW_TC; } =20 +end: /* pick up primary MAC address from SI */ enetc_load_primary_mac_addr(&si->hw, ndev); } diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h b/drive= rs/net/ethernet/freescale/enetc/enetc_pf_common.h index 964d4f53806b..48f55ee743ad 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h @@ -12,3 +12,8 @@ void enetc_mdiobus_destroy(struct enetc_pf *pf); int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node = *node, const struct phylink_mac_ops *ops); void enetc_phylink_destroy(struct enetc_ndev_priv *priv); + +static inline u16 enetc_get_ip_revision(struct enetc_hw *hw) +{ + return enetc_global_rd(hw, ENETC_G_EIPBRR0) & EIPBRR0_REVISION; +} diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net= /ethernet/freescale/enetc/enetc_qos.c index b65da49dd926..ccf86651455c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -336,7 +336,7 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *t= ype_data) * * (enetClockFrequency / portTransmitRate) * 100 */ - hi_credit_reg =3D (u32)div_u64((ENETC_CLK * 100ULL) * hi_credit_bit, + hi_credit_reg =3D (u32)div_u64((priv->sysclk_freq * 100ULL) * hi_credit_b= it, port_transmit_rate * 1000000ULL); =20 enetc_port_wr(hw, ENETC_PTCCBSR1(tc), hi_credit_reg); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/= ethernet/freescale/enetc/enetc_vf.c index dfcaac302e24..31e630638090 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -128,6 +128,7 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, = struct net_device *ndev, si->ndev =3D ndev; =20 priv->msg_enable =3D (NETIF_MSG_IFUP << 1) - 1; + priv->sysclk_freq =3D si->drvdata->sysclk_freq; ndev->netdev_ops =3D ndev_ops; enetc_set_ethtool_ops(ndev); ndev->watchdog_timeo =3D 5 * HZ; @@ -164,6 +165,11 @@ static int enetc_vf_probe(struct pci_dev *pdev, return dev_err_probe(&pdev->dev, err, "PCI probing failed\n"); =20 si =3D pci_get_drvdata(pdev); + si->revision =3D ENETC_REV_1_0; + err =3D enetc_get_driver_data(si); + if (err) + return dev_err_probe(&pdev->dev, err, + "Could not get VF driver data\n"); =20 enetc_get_si_caps(si); =20 --=20 2.34.1 From nobody Mon Nov 25 03:33:41 2024 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011005.outbound.protection.outlook.com [52.101.65.5]) (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 866C41E9071; Wed, 30 Oct 2024 09:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282163; cv=fail; b=lI394bATeziktDmBUnOxoxP6V2EN1x0iZRENOoDgnmsmMumqyJlRJSzCNc5rOrgDAS0EO6vkCv+M0QlcuATPsAePyR/0R5JRgibbgoHM+i7zvZLJo9IU8q0whh837CNCWMJAfPkTQMGw89xno8ZmTDhM9HUHvdHoDb1p/GZAsj4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282163; c=relaxed/simple; bh=pHlT8jL2EyTWjidj+y7k0/9mI3y1CeEQQQSc8BjP0ck=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=omdhV8Nz8SEalpSe4ciKCfKda3rgZ1OmjWSVkAnCqWLR5PLAdYBahmhah2+/gKc+013pGYZBTCCmUeUFxQM8OZCL3RFfdQ1h2oT/ogk1qsg70RtBqE8cP5VKyRDo3RHqQR/gxZqnZZ682U9b+OIAx9ZbRSYZygoDy24re1AD/cY= 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=E14YCLMh; arc=fail smtp.client-ip=52.101.65.5 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="E14YCLMh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xyA/h//pnSPS22jIIbKC7DHy8/+o/J4bd5H2Qfo94N2FMxofWotuGXx2X6H/zP5aCvK4GiPnSLbEYdEkxnrIiw1HQq8VQimVRJxAHmclL+PRIrextcSA56PO7BT/1rDV7YIJoeP9cv+g155SzSa0BFBIdZwAK6w13Eh9A3yt1jaLbaH4vy9rNF0nos1d/p5Eebw7kFB+DrQyhttH7Hau9YapqmM7bNTCVXzEpxoe4Kj4wOIbeCxZnYCH2uy33rw17+McPIpUiHN9LTQ+KxmRZsv1Evx/CeYLBBpFH7AP4f7mcpGWPUkzWs4WZ752jMdxEWeCvlWlrbesBJsEvGLVcA== 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=7N44tyZPXUffv7eRlDVOVgDDUU4G9aDUtWTZGXJ5L9c=; b=pC/gn7yKlzB4sL5IAzvuziToPSKeZw2pg0JmzVfNpkRRF620WTH7oQoOLqBdKfAq4RXhgN4v46Lovtkd9NT9QVtJWlEEUfXEO612k/NxyT/SHal+Brg8nNDYhZ3S5qf0qvr4jlKMi6MqKuoCgh5whrFQgK3v8Y54ktW9+4sfXBPWY+qJPo+xv/QRZMsrgyUTqo0Zu1lrvODMO6uS7D3XZpSm7Tp/jwXZlVUBkOPSK3fRgB4t24zP1RDUBUCVmN3gby1HbP1pTocwLsqH+achLqpsER9apJgS8sQsVjF+Xl6XvjhQgbRjNxe805hrT+hr4lPoRxn1Ev+cHzXao7rPjw== 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=7N44tyZPXUffv7eRlDVOVgDDUU4G9aDUtWTZGXJ5L9c=; b=E14YCLMhE61EwRAqG/e/06Lsh87GVhrU696PEfY7eNM9tUAMkH/iWnzCPYSxVETd08pWubsaFyfDyD87Cdp5d1CUX5d36oAQJuWZUWA3SpiojIYo8sA+B3msIvrKp/FqnYXBl6+wggl55J1ptASjSE9HA578wmqjXUmhPi7aoJU7uEOvziwBOX+OouKfRnMUAcHY3/rfeat9uCNMO2Xlwy40NzvmVzXTxQZLZbyLdE0FtuarIFBG3V34mc+wDat2h3RAiv6t98KU/f1FIQsSP5gB2jevhWG1fM4vVbGRiKDs7BKDZTXZ3wbhVuSR+AcdqIEnFa4wYCVwWufuGV9SYw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:58 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:58 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 12/12] MAINTAINERS: update ENETC driver files and maintainers Date: Wed, 30 Oct 2024 17:39:23 +0800 Message-Id: <20241030093924.1251343-13-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) 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: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: 111cdbc1-55db-4fb6-9a78-08dcf8c90d92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?drK8iwBUfLoqCyKaa/yE7wjj4LbFvLaUinxWbuJ3OOtrMFC1Fyju1lwsB4FQ?= =?us-ascii?Q?6qHiFvWtYwaN7QfHc01pUU4TR5C4pYYK8+tCsSea5oQ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L9FycV3IIJ26YsD20clhPIWkjomokjMuQ5ULj/ysg0RIeOuo6CdPO+?= =?us-ascii?Q?2WR4/wK0Vb5wrAww6HD1vQNXvBhlGDVVuMTXPCHzr5tr98rfb3go4aqUIf9O?= =?us-ascii?Q?MomIvHnpEDKTBTlQd1EubwxcfOb5DAQfSPfZEcSnzBuS/QwenPxIu1cAmpND?= =?us-ascii?Q?IUj02HMrYgZeMhG94Seje7KGekhUeTevldV75FYUNVYiHlsrU/5NRF3/ZwGd?= =?us-ascii?Q?8j3dWFzFMPgXOQYZAbo/WTOSXqmA1y0YybkxahWgiDECH9ce9cA6QFK505DY?= =?us-ascii?Q?OPq8yzCOAcCT/nYZFISe/0Kc0mMJaqECKOnMSg778qaX0Zmreu1z3HujfNPr?= =?us-ascii?Q?tj1CwayEK5Qxecj9Gs1kXlecDhIYR8WSoOxL5RNcckuxmon2+RMdCyik246Q?= =?us-ascii?Q?E3wKKkabjcxJj2CQBBuZFLfXu+rY?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sF4R7J98vMw64bRtDEuJSV9Q7Fdcm3kJWebMIqHIElteOpEyOcjlbO1VjU0j?= =?us-ascii?Q?PQ7wQobJceOWO3SAwR5l/Mbf/ihyZTB8qARdYtZGCSY+jmwl/FAL7O8B054t?= =?us-ascii?Q?4gawd6HCz5k6laq0liqeyv+/O4pcv/xx8a+kDTzBSUQf87I0OQsJ4k98l7TY?= =?us-ascii?Q?kZ+0/mkaENZ/KEQXN1AuGamrG/vOSg7i7jRf18/uM2cGJpZenyE8qnNIB+5d?= =?us-ascii?Q?AvmLbOF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Mbv2nNX9PElzS2Dz?= =?us-ascii?Q?Sx+jj+vFlVcii5eeTZ4sbvzfF8Fy4rafr2xYeGVd7Z41pf4OWR9ZaYPAn8Lg?= =?us-ascii?Q?+O7Uz0eH9j0tQJI2PyO4BDwNRGkzKbv35VuMKR81CAusQ2TAbfbnmkZCkrdR?= =?us-ascii?Q?xmJjTmm4r9ftAf8jy28drBnDQQYN7NBa6MlnezYUtiZRwhUkEKUohEbbY0+e?= =?us-ascii?Q?EX71P578u3G/MjX69xsWmoVbhnS3nd2eANuKTG50I6ASiD+krnhpvFjxVsmu?= =?us-ascii?Q?p4qmxDm08TMFD2/jtQXE8FUH0iCgddLQqXRqkGS1uTrckzRSD9XJLorz+bKd?= =?us-ascii?Q?S5gKxmMX2LHSXlwq4OsKpQxEbpsxQEFOIX9pqzO2d089+YigW+X61wuj6gSN?= =?us-ascii?Q?K+ucuCZvM86sVCFKQrrv+VVFRGUglA1Q7n0x79l6Oe6Cz+/VRdgz3tsDn6it?= =?us-ascii?Q?sTpZmUx5X4PoOgM20Q359Cl+1fMbEX/+Bz0oBrOa?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 111cdbc1-55db-4fb6-9a78-08dcf8c90d92 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:58.3336 (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: wvTIpyK0DleQqTPyQcTHoAJtZjU4knFQALAFij96XvZPnlVMmlOEdXhlM2s/RgGBRerFDvxF18IBEkC/QEA7LA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 Content-Type: text/plain; charset="utf-8" Add related YAML documentation and header files. Also, add maintainers from the i.MX side as ENETC starts to be used on i.MX platforms. Signed-off-by: Wei Fang --- v6: no changes --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f39ab140710f..9ad6c9aa5941 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8996,9 +8996,16 @@ F: drivers/dma/fsl-edma*.* FREESCALE ENETC ETHERNET DRIVERS M: Claudiu Manoil M: Vladimir Oltean +M: Wei Fang +M: Clark Wang +L: imx@lists.linux.dev L: netdev@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/net/fsl,enetc*.yaml +F: Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml F: drivers/net/ethernet/freescale/enetc/ +F: include/linux/fsl/enetc_mdio.h +F: include/linux/fsl/netc_global.h =20 FREESCALE eTSEC ETHERNET DRIVER (GIANFAR) M: Claudiu Manoil --=20 2.34.1