From patchwork Thu Oct 24 06:53:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848412 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2063.outbound.protection.outlook.com [40.107.103.63]) (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 27CAC18B477; Thu, 24 Oct 2024 07:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753730; cv=fail; b=dPLUuNl9DP3P8qHwl7u3t0+Uf2bmFMj0yZqVzTbb189p0gTpQL7If+L7iVCwLK9DtTWZnD1YLLkygATqt+D8EGwVJQpV2Toh/qv6rWFiesNDdhNa7bMf9IWvWaEaHHlzrYWmxUasNzkVOq7m/FGEDkxpQl6UWpMoF3h3dolhWNw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753730; c=relaxed/simple; bh=2y0zDTC+mj3yIpX6OkVSaHe8ShPopq9CQGHyh6jzrj0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=AqKziCyCO+HrnVxqCSQthhO617wON7IoBTZobW5C7jzPMUUNbIM2JfqFy9pHHMDaPOVpBtuCxSfxtWBZYHsAP+uWdvXIdkt/qPP9XdcerlarqLXYD7bHalJ0ds0yUbneItqYWsRCbrOOWWyji6VAA1J2OUDMQIcvh+MWXeL8LxE= 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=CiZ+ALGr; arc=fail smtp.client-ip=40.107.103.63 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="CiZ+ALGr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q9Qv2kfQ1Q6H8IrHsvNLLKasiOpacs6HfylxZUX3GMTCHBTr2pE1yaVULxCucetQ1kfNhQINKknjSmArZx8p0M4NuWuSH2ipXJrtiO5c2gx+ujqimHK/tiqIrQAsUW8lGLEYRJSj4L9xRg+tE1omgSM7kzMFMoubgcI3Z03sAHLUawfnGJ2TEi8qCDpWgvyJoX3Mqd1NJCdYn+7c0Jtho8Ru4KEdPa8+8raby8YyNN0PItltFVjc5NGAvZMyu06JbWMpmh+rmETKmr+aN9kWbk6oZU0j5t1c/JiBns2NcoEfHThKCuRPImuEg6Q/+J7h9M1e+mPNb3L1VPicPj4CGQ== 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=O2AFcGOUub9RJ149gnjmcK1RNi4I+ZN6Rtac0LgyMME=; b=t/A/wxEbRucuPaLs1srBDlG2HmpwZ8dlQbTm3JEJSmPbuzQsrbrcB9UjE49Eq8QQvptKhZkfWm15jIgEcy2gTJeZEN/FadZ6G1vcFdKCt/C9bUvIVrnb9OxAJeh94aW4Pt9ATiuDeM1DymaNTPR6WlPxLJKI2F/Vf9BdqrkelB4GI2pIKD5k1oQ/gyBkep9M8KbgmDauO9CVfQBTECwG2QEofT6kk1htcQrQv5PR1l6CjuP8QlcSo2ln2+kf8NZGeuBvhwUXuwK3raPSIswmjsGqIR5ZRAqNtQ1e3xTSiYMWKu/Xh7a2UmL9LHjjCgL6EB+nNJxU3K5EyWy4ad9uFQ== 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=O2AFcGOUub9RJ149gnjmcK1RNi4I+ZN6Rtac0LgyMME=; b=CiZ+ALGrpAHp2gx2tjGuW2CCuePzGRRwnshU1lKp4abQIx4T+2IQ2jFLBonPRAMR46znTSCM4mysLPDuyI1wegXpFbL6y2baVlsD8ZeObsbBvr2nvBNhqbjeLGcArkAXfseUl8cD4KClayIm1jDHR/Mg/WkcfsHy3XnF/LXpAUnqsLsiKjHMhN2+6yZ4tafmHZT51gbgoNfHZDjS9CtShoZLQq1IG6GCbweCzYt4lU+NmCaLMXWLgEzlQzkxnnCrM3yNJ6FtKy8IyCyRAlnLwx11jtgZWeaSjr0k4D0JN7IzJc7Mm4MwjKaa7kXSknx+SleQHakY+dcIwTH23rpfZg== 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 PAXPR04MB9153.eurprd04.prod.outlook.com (2603:10a6:102:22b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 24 Oct 2024 07:08: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.8069.027; Thu, 24 Oct 2024 07:08: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, bhelgaas@google.com, 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 v5 net-next 01/13] dt-bindings: net: add compatible string for i.MX95 EMDIO Date: Thu, 24 Oct 2024 14:53:16 +0800 Message-Id: <20241024065328.521518-2-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fe8e16c-3aa7-4e91-a663-08dcf3fab21b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: kKsG/2tcH32LAjhKGffEPUCz8whtTG/wy3M0p0IuSPDWjRk9iRnWRZEa0o35jRDdOzRaGkQuvgEASH5G04uV0JozEZbjRvGTSjKz9nrSDJniorZwgsMW3TpCcHSFRCGYaOIempXseaXpfzb7Ku18xE0DEF0Uv5ToLfZpUQlPk71aIuMFgDDA2St914aW8NHURjqxu0hQRSmTEdizIfz8qO4LqmZaocIlgA4EgxD95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3zeeaS1CavzPdBsG7jUews+x67wMsNTjRCTPkpSVH6jwgjJoNVYeHDwxaoUsB3esCYJsX+Aryw4cO2fD0wX+z 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PHTA31StnMe2KAoFWTxCWIFIB0cg/vhTmZ2aaFi6cxbj0HqyQJ0MlWwQbQiO1b5ExcH//nT8QgdwjYH+Pa8zxAGFXzotj24xbyZ1fMxUntzHkej3B+TgXNQvsckKz5Bu/VplACV60UAoEZRMTNXEWVV+QDoP6gPWN4CqzTNoYuRMJiwJpMsR99WkvIvjLCeiG3G0YwlJlGRAyEYP8vIxVQF/HHIicPYns/hfY8RW6UN+N+O6CG9PWVB2Q45y19Oa1ZWzkHEjvpkTIODUSKZ4VV7xD3A/aXbZ9zSTGHygVa4BXuciUczrPAyYX6fRqFp4Fd6HBodvAs9G5u6BtsqrCbSo5zPSYF8+WfIRQUQ8bdPTjLt4rRvB8D5F/99XrPFl+DhTuSMhWC1PjkjHX767JjikUDWOgX38BrJ/JDk2bDgwy5kUui2MwCR8axF71jBJpy0udcVaRB0VLC/hM0O+gr1+k5y/GCuxmG6PQ5a6OP9ynyKb2mK0HqjIXkwNhXMFYRdWTkZORsgnM61WKXIuQ2GqcOdv/Hr/OxeTvHfxq90Wmx5jkF2ZZ1VisplbARxh7vcJr2rwNVU13t6YeXtgqyxqGEgQqZuFPVMPsEwdCY0nY/8QmmckaVA9vBwTispmXsQNHrJvl9fEiz3LeKaUC5B9aEsa70Sx/QszydPo4eNrKX1BNDFrGyI6rsQbfagmFd688aGEDPRzc2nf8nfgRx6Gx6uGZYfCySTF08XN+BXNFXIXR8zt8Swf9Wkx9b6e0o0+pUBs5mEFWGBGrpBO9ETr67eQrki/OkL7/SOvNBZoRuzsNvJDI5QR1j8sKtedcOvLs+knHoeE/8oYgJ0TFzk9zSkXHutWWiESPns5XLAthOhlOY6VBptK1Q/hIz2JHjLc46cbNOG+n1SfeKnl4RiNfbxZK8hGELIV/gJEYdSCb71SC6uRjGPXHN8zCsntFWNpESVo5JGuG3BlhIP/JY/jF1Ukpa2tpa6cRIxANvr+h8n+jwIT9kkanCVamIIvOTi+3JYmNWUcL326RizVo3LmvvTfnVBBazI2p/vZEFfKGmxJZFLeBWAqbEmIoFmoVs/3SXERuqFVqm8qNBYMMNAhqCJRBEQyqAHbPr6Anuj2WdyYj9VfvULg6dNCPmIyw3miNF+FwkgrTVfARB13GZgjbQ0YbZo20C5Ur3J+uGAKL3BXNNOb/woQ/Eiuw50XHL31I115cOFVfHcjewWeZF+CWeJwGOi3wgJLmCJWjrQfu0xlgx0ObG8Xk3dn2R6e7VZk+PGP0Ylw+q+g6NOunC3UxE8zcgkLH07SAbJf/oJQJ82TajqFeGyB3iVCRy6TqC1ukGAkRx327CxXGG7gHkch9JiJX3kCaISdqOK7x5a+vpCvCf65k6nCtkhNWhv4AOJhl1r8GzmeXudRpmWacQe9KVu5BCh5P6VLJYVQ2dLga8sUQDs3KA7x+u+oPSCjbZ96SxYrJZfeqnZlYwSVHBtXfQmzaH2GSdhEdZZpsg+r2vMWy7BDqsSOjMmq0ZxfVJbEGbE3fFho0rHT0h6KR/WTv+aqa7KDea18SisVnpxKrv6HilDbQ5BrqxIqdJCr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1fe8e16c-3aa7-4e91-a663-08dcf3fab21b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:08:44.0417 (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: GIx+J+DsBJX0GMtPJVXKjQIXCxD5JYndpeU/EKf+BsVfarn+LNBSTqwJzC483h6OnBvG4YmxAI3SYdIsCcpBUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9153 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: Rob Herring (Arm) --- v5: 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/Documentation/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: properties: compatible: - items: - - enum: - - pci1957,ee01 - - const: fsl,enetc-mdio + oneOf: + - items: + - enum: + - pci1957,ee01 + - const: fsl,enetc-mdio + - items: + - const: pci1131,ee00 reg: maxItems: 1 From patchwork Thu Oct 24 06:53:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848413 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2087.outbound.protection.outlook.com [40.107.22.87]) (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 2B1AC19D065; Thu, 24 Oct 2024 07:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753736; cv=fail; b=WrZyORDIOQQo0OZncv2W1USS1z79xBEeb19mxigtKbZoLhgYwpZd6awLhZ/N1BBsPSwfV7tOlRRUVcqXL/LfDpuouGRZz6cBOrXY99MHfGIHkpKQUQ9NRL/NLmH85VAQUd94dB4wCaYJqDzewYPAwkue1rs3uSwWnQNKoAObDnY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753736; c=relaxed/simple; bh=mePkwdqAkNlSYtpf314OfkDrdqJFxy9A9IR3aZ+GdLM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EcyL8saJxgI5QyoieBz32zF/C0qYmbgw0V8Vy5G+6nONStnuzC8zMODgA6FU5x4vCQl1qGpX3SLkczVCF4tSzdKMg8mZrjf/DPZBB/jDaX1acUcrPoFpTpuiq3Nvi77UZpFpGpLCZOF2s1qayIR2S4twNYCXXr4MmmdKlt+T+Uk= 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=Qq6LevBo; arc=fail smtp.client-ip=40.107.22.87 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="Qq6LevBo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZybC1NcNEo2T/tf8mOAkOgJvWg76S+nu0JaDKwIzwQQjnND8/t4ZXApKorq+wOuH4Sz5yHItmtlGENvWJ2LSqhBEs/1FQUe5NHfhDOeEZAo9176m0ETBzbAyNJEYBWyLQxAG6SdU165IHuhhh9nzmTzIupsLeENO0ZRkmuLyrHOMmZFEI5KEaMJAGixeJO91dKIKDW+fJaBCrgb1RU6Sdw/eU/q4A4ZD/u68XzJd78RWsjVouFObmkmetUv9hW4v7+9dIGP37o2wLs/Ej0pDMLPQo54GBGEIRHbJOvc5MnZeq+xO6/dWFNWF2dcEDAnO+9xVehECaTeUZjDcLptX1w== 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=bgJAyoAgCjGd9NIHYHQdV6kRh5/lgtyzhpXP0g0Lqug=; b=ByKRwDlYyB4x87OsOvqbKemGprDbYLkX9SJG0Xl6gfSC/5nphlyebE2opXlnr+QpRqe5XK2FPjD9WctIC8TkFmmwulV7gebzJOzxx3AkM8uQrlzFOBft+pWDxwNEXFbWlU256Zrw8JsD/ySpvOX+i4Mt6xHXBvC/vePsyV5YemeDz3B8MUJ+FpQkpUgoMveuxEjxUGk7NImoqgAmCEPX8wHFnS88Ag3i9tHCoDDUXs+3a4B7zLBVQyq9fv8DsDJUGC9K2srwUuYXdQ91NIMCkC2NLOFAeyr5M3e7qX3TQNRkDte00fQFAyVPciwsfUUhR5y6hLshYoWIVORfTYd7uQ== 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=bgJAyoAgCjGd9NIHYHQdV6kRh5/lgtyzhpXP0g0Lqug=; b=Qq6LevBo60i2iKQHM35ZGY7wyYtIjbql9B/KDKyMGw9MJEmop6+klo0kKjBZ5gKT7K2Nki2IoJHoKFH09YAzsKyxbd0gHu4RCeb6FZzunmeEhL484pjWI+w1Ef++WCb++mcaXdXUgdMC9tKcDSz07R1tYxYZmA8a7oj/BJPAerPqtiAhlGzJDMiX8Vomq6Ksom/qEjtvchLCkTN3IRSndgDDoZmRd8bb6NqP/IlA/Y1R1lopIKT+3/xdsDowtnLS5zYFX9fKVVxjwuN7Ew9Xp5x8l09mEZT2pvRhx5HaZ7yjEea3TCduoVRnCug7g7/dmXHLFs81XzWt0A1XJ+XZ+g== 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 PAXPR04MB9153.eurprd04.prod.outlook.com (2603:10a6:102:22b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 24 Oct 2024 07:08:50 +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.8069.027; Thu, 24 Oct 2024 07:08:50 +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, bhelgaas@google.com, 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 v5 net-next 02/13] dt-bindings: net: add i.MX95 ENETC support Date: Thu, 24 Oct 2024 14:53:17 +0800 Message-Id: <20241024065328.521518-3-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: 55d4eaf7-1650-411a-7839-08dcf3fab657 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: ddv6lxc0x1liESdCJhAgHxbl5Kf6WjSs1c3BG9cS4OhR5adgiJ3GYlrtq1gLpx3x2O6x79UUq+mW5yiqWLK5hLd6htY8VsDSw6ZgdSBg546nnNizFfJE++QXy+iLTpvM8u4fuPocsADHSykeVNlNVg0gV90bhtm5eRYmAOu9u/ia0kComia33pG8C5M8vy2v6sI/uqGPTBn+BuF7qhDQ6cKbwFPn138Gy+J6FaRkClW5d4SU5oKZX39CfGg2tFB3Bd33n0PnLQDgEpKnvCtnI5Z3mrKzgKbxllmSGOZHQMwQti148uTECT7m1pJZhtf8wRIvDhdBGa/ZYRmCcG8WT92xR1U0K66eNIWSoAGn4V4cYjumkDQxYchIlmMRaII8MAxLGEq/FLBPE12FTvjyd6Tws1o5fRXlThw9EcHMrsuAkiBnJibQXj3yH1HeBbVaLbJkCswM9IgcvYCPd4UsFIXXwMleWThQUfL4jVzRre1J+SoQTCIuIr3/47pZ2hiTKwd3zyGZxhEVs7kZOkJnrWJTL5pu67YVshZxsYrAnbta6RD1mPMt+X2zPv/vI3F80fejbWfvp10CQdbTj3N73u4NGhrbihWLPFci+kT0bP28tvO8VAi+HbcTt1ulZcKqHwKtbTij7kBBmdEKPYYoUIeyJP4hgOhXFDj49bRzrmAa1kMQ5KBbx0Le/qpefL6anbuGPcy99KBfuT8LjitQSIfwpcj0Nc76I3YsWW2/RAxBoTxbj6WlV8R3WwhuvhTUVXz8YzCdmaQWNkgGT2nC7PAXqj+mW1kxNNNE7oRZtHjaxV1gKpj2AgYfQ68Eg9TrehtgLKWyQVnREQpq+2vWLBUmCWbAh0LqTPj4ByWj0lRlgnT8L64d/xcxF77W0G02IvX/ALX3/t4x29EcQP7cnIGFqt0vy0x7giNJQoCLfA+Jtj2ahCFh/0Eg+uo1RiqD+ApQ/V8A9zq52OpkrVUllrESobae7Qvv8vTd3A3Y65sPa2Fc3BSu+DhCHT/2dE3jSDwMdxyi04Po9MQuuiQHsq23xwOTJ7koGZ+MRAf8MwkcGoUa+78lMsHuFGyxSVZtPDzpRYaW4BVYhZdEEIqtlL/rGpF+ThKDI1+OxqXmxNPgVnM0hlAKvLXG3tECP0mZEk7tfZydIAF2Y4+nZ0n784IMjOwBe8JFoKTJ7hhUSgFuQgRKN6dOzBilUzL+1k5XvyzjKNuISUNLRA4eD2jIEv2EvFHFnNDC7c61MAxwc+XzkoDh69Q7tF8ESvLeuEEyS9zNLzBgoikHunj9N5ZvtmWsTTTrosa6j0S+c0aDt/p5hjecAij2+G340YOVBI/AYlLVkEEjCUG4ZLxz5rmtn9I+S6b/YvsluWTrmyYhQSRkuhU17nh68PVIEL06HPUB 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData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jpyhrCBFALxzzbvJN/oXnReMrAQTzYoNfoZ5Vv+tgAeKX7tfextinMZpSaN1SC5YVRxaJy0buU9DfBOSpJG+S/muqYGEHllE7twJsp8mCXSLf7HSPAnXrjQETE9PFqNNAi+PterVZpWqHDHTDmBR6ZMwHctmxQVQlOTQD1anjeQlsrC+k8VxHGL/nBiExs2RMvl0DR6e95Hoe/vEF58pHaW6OWEliwp9FeGHWneUx3yMe7S6q3ZnQb31byVvwUZ3Q/a5IoXjgeQWNjsaFFe5bssVrJL0gQLs0CrQ4t2aQgUogJwKEICyJdz/CRcdM2/aCodkImh9sn1tJRX2MgSnO18XM93Xb3g537zIV59QaCZMDEjx5C6dPE5bt6z4ZSUI8rlffuRCjOt2CLOOut8BKyLhERKYik6qbQWZ32EJ49SrhDJTHipyvKZ6a0tTk/NYlxRA/asnSwJnFf55LQM+PN+GSV1foL2e/tSe5npp5kYxAbiDZDbUCdmI1ma5S2nc1toaGQDt X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55d4eaf7-1650-411a-7839-08dcf3fab657 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:08:50.8627 (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: P0R19FCmZnjXvq364LzTefitNZXEKH0Bb7CLQy+qeIJy8iw2wG56EZGZ0Hjxk/lHsEIvxyQD/dcR4m47pawFGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9153 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 --- 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 --- .../devicetree/bindings/net/fsl,enetc.yaml | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,enetc.yaml b/Documentation/devicetree/bindings/net/fsl,enetc.yaml index e152c93998fe..72d2d5d285cd 100644 --- a/Documentation/devicetree/bindings/net/fsl,enetc.yaml +++ b/Documentation/devicetree/bindings/net/fsl,enetc.yaml @@ -20,14 +20,23 @@ maintainers: properties: compatible: - items: + oneOf: + - items: + - enum: + - pci1957,e100 + - const: fsl,enetc - enum: - - pci1957,e100 - - const: fsl,enetc + - pci1131,e101 reg: maxItems: 1 + clocks: + maxItems: 1 + + clock-names: + maxItems: 1 + mdio: $ref: mdio.yaml unevaluatedProperties: false @@ -40,6 +49,25 @@ required: allOf: - $ref: /schemas/pci/pci-device.yaml - $ref: ethernet-controller.yaml + - if: + properties: + compatible: + contains: + enum: + - pci1131,e101 + then: + properties: + clocks: + items: + - description: MAC transmit/receiver reference clock + + clock-names: + items: + - const: ref + else: + properties: + clocks: false + clock-names: false unevaluatedProperties: false From patchwork Thu Oct 24 06:53:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848414 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2054.outbound.protection.outlook.com [40.107.22.54]) (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 78B4D1A76DD; Thu, 24 Oct 2024 07:09:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753743; cv=fail; b=UKAbg8c/HNWxSf7rtOPIIOH0IVFIcWWv61iSTm3VArusMrLP+Q+Sl0glHHnvB+aMVxsYsmhGqZk2WS0Go1T0aMAfGe3Zi2XM2JmcOgwlEDYrmgXgUYEG0v4ktK4a/HOciu3VMYknY0tzZ3o5PR9eY+nZtdUssC7/rzxQhyGdGo4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753743; c=relaxed/simple; bh=L6AvRQhlt4OHN8voqkHc5K3vgOP9V9znkwVrvSEa2cM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WSosxhX4UmmWLAvskWbij7LfM/ccHGXw5d9Tzz8w+pExq8RWyr0PJSPYf69Y9pIueAz6O2VXw8UkXCHF9lREOPCCFlFF9WXhFVrT7mQt3RRDnz5WJ9y2rispY9o9MkCK+ORmS7RAIVQitNmVTNZHEf1Mrff91mluI4SS2+FLDi8= 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=UpC8hV+I; arc=fail smtp.client-ip=40.107.22.54 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="UpC8hV+I" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iO2Rnbb9z0s/1Wuqe5xwWJE3m76L9hr5ImtGCSNJBoGQpIzqhAkXMZl+SrgumwSiI3enxeUF7/3jJRvmkWC0gKwVU3j2wPfvfSUbHyxfIg0Mdvhzxs//1P/ptaAe2kG5/JsPFari+DG8cxcm0mG9k9abKv207hqQ1jVK4XQXhMKaYZfGXGSG6rcl59UpW/ddnai486YZKktPQgrgvefjoPXT4RER9PPYTP3DXQxGy9EqVVgGhvQyC9YmqHjYpdUzU+Hv2+qHSe+IVSaAZMfDjVFoEuQ1ImLQnH+Xlco193GaS8hXG+7sD4EWmkyThXbIm7tGVnjJZzzCfjKZgKYG6w== 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=UKrh9kk9xSm0bZHZNQWQvwxoSP/BC5SLqXmCtoou8c4=; b=u+z7rdQKRdZbf9Phx147c7VpUtzwJ8WbW91Rg7GZzVbVHURUA7+ERl/fQ9X/cnoBLjB0SXM7ZQqQ4CsQgQHK+DlGX3xh7LgOXLwnHQxHAP8ACVSA6sqynIEoSp/VtxWm1ZBAJk4Lbqh2PuKuTz8QrUQlQV6GdG8oO3LWYzvBlLNbQzG/FJqCT98Lox0u+1T0SBaSZ/64z9aXOO7ywgkFoYpG5C6TXQvjgm2AY598GakMrdd99kGSd6ovky0zna7B5fBpVRquW4UAjo00dvppOgdFVKITSS/slkct3on4N6u0bdwPA6vWDsADs0tOn/99ZNbBpwH3LFKJAnv804p58w== 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=UKrh9kk9xSm0bZHZNQWQvwxoSP/BC5SLqXmCtoou8c4=; b=UpC8hV+IfR23gNaLtoF3rq2GNhWjwezNnBTifnBNwgzT+Di6TDRFLbIAB3+iczWfFFAo3lq0thqzfAhkevubfW16OLLCcY8b/J6g5CyetBSejHjsrcl64WOR2TRLLT0Cogd9simwdbvFKIG7scN/RsWwjH0VzzY2vs/FdqRKJzn+wB7nDQDPM/ArVmKMPAZXZ4QRsAlinTO/fyRVwPYdK23ikHIs+rfGbI3csHZF9NAonV3GH12LpaObFknGcopyAQeExkMwfGU2m6FB1eck/AnS9iXIIl2ZIaQ7IkfQo+dLBsyv7V0zDOEWGxQ7sFadm1UZQFOJ9f2ZjofHvLrW/Q== 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 PAXPR04MB9153.eurprd04.prod.outlook.com (2603:10a6:102:22b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 24 Oct 2024 07:08:57 +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.8069.027; Thu, 24 Oct 2024 07:08:57 +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, bhelgaas@google.com, 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 v5 net-next 03/13] dt-bindings: net: add bindings for NETC blocks control Date: Thu, 24 Oct 2024 14:53:18 +0800 Message-Id: <20241024065328.521518-4-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b7ab1a0-6f6f-4838-2de2-08dcf3faba01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: zjtJdjAFgVGJZ87wxTt7awc334Ew93twkixBHJ6/0c2s/pYR0FYlFdCw24CGk4BbkEy6ky1A3e7S/e15z4wgY8BjCRQ/rlbhJlabD589Nt1PYt0bAtwAna8pXcFFbYGA9llnijbtRtgmdjZZMMK9+OoG1fBPKox9bHJDIKoRdY0uYhzVjavVkVDMZGCQ3pJ8jB3eW4KOnmmfyKjIpL/qJjrBA5ziDfEK2ysTZ0BMe0A9kHs6Igr+FTDAKO4abfelNUpojqa+IXVcyBTYOBhsYQY69cdPIRL5EEEBeZltXoTIH2YEWvplqacsUkXcVZXJ/f3zUPE1ZYfpPvffuQ7VKTJj8UrMw8Mw9PmTcT0dwJIuFOVwdMUdgfEDvxT9xa79deVo1e/nZ9FtFpMW+UYRUkVQ1M8kgd6J4uBjQwgFXDMGuSKC+XcpCWue9w5dSANIULMLDV9VkldVKIkY4XSGxSVWTGLsNvHBL7NZQvMidz2s3ChuWZyqLVcATN+Q4tte2P+9xaFXjjpaC3UxtRk9V70A1Jiw8scnIYNZfHjkz3ZBbQKBiT9E763/BmvTGKxJyiY7PE0qArpSqMAEIYW78CKSYqS97j5tpUxKHqpII6oDxGf2Akk1V9YPdukoCFQuzVxBmVhP+A2ff0cYiCVFku/yeI916kJaBaANvBKrDY5H1VNE61D4Cmq7gxCyo+7nm/kAKdRD7zPpmCJNy5hyNYdCIat0TsDUSm/B5uxVkh4bIOA/hNOTmlLnK6bOx0uApp0axlJJxBav2MS3CG4jo7PsSU8zEvk09WRc8ljNrJyCZIgwoC20Hbidzb+VwgRXNbmYvh4/BboMnq7IGI8GDuFD4nZOfNWoawVGoLfdoAfHsCWF8IA8VQtsCb/vH34JDhwXHFS3XXP1YRf52wks51FiOWXKw3hskr/SwrNfXwwbyflVRR4+S/TaGr/dmqan1eYsL1E/aob//EdaY6eUX1c77y00GKeIn/Lt5SDbb0umJqo+LhQ9IyKs6ZHe5s2w7qN0F3+Iv04DqOXHIcKbrqPrYNtNKg6cSznBn+3HvA9w0iTKEcX6/CCpJZlWt0HMLQ9j3OhOisZIYUB8IFm6W7lrE2wHZzJOT0CJc2WpLK2SxaAWvKWXHck+z0nAEp8kbJLN8XUQIuXeR3Pcp2WuB0qLR09R4VSi8GSTNU6vSNMxgEXOkefiLfM209ZVI5FSIG7SirbkX9P87bZ0D1HGG7tyYZ04IhNAUq5QBA6mIfDQwP0RIvV+7LSQiLm19RAZDIBWPsBjqEP1p+UW1JofKrJvIsTUd1bfhTuLch1roFQcXOlR0cXjfL0ikQeP5vhSFzytRQipBTctwzhMCC9aBw== 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xVCy+jAnRy2KjM79hg2YKCjOP9gQGs9PsB0wM0G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XX9xVvy4/nUO9sRbeTsQViiWi5/jsxNf8wORxrLzR2CW1N6WLBhxaUZQG+lz7EKWv7QZ6fXrNGwqkE3r8RcxUIsz5MTBi6VHuvo1FtBmJJ3lDiyDfdSfkXkwCsS2fiOgnspZKfwmvgSvq3Pz42tpXJgjkFr5L2I+u4N7petEpg/fSVCWJxSBDmRLvZVzdp1GI3IKghFDgCO12KIt6lT0qNC6fJygvzR8AujZuBfqTm3dEtBJa7tu6V9zHkBQf6U5CVuh4nReb4wsFBrNbtM6J8Kty39sgDbqaGFcHN7QGvsLfW4cZqNqB1Z/URDJ6kOlF47KUGDLzHhCW7sPZ/U93jHqmp6BQw+VvOxRjpKRjaVnswkinlp3CDHL92vsnaYKLLxufCMmarN5gE8vGdGCwF7qM9DCojVDI0hYE9AcWnQcwjuQkVtEwXrlWmPOQsdOSesB37lqRmxK0TLopvHsOlB9eVDkYOL4TO3Ja3nos4+v1 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b7ab1a0-6f6f-4838-2de2-08dcf3faba01 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:08:56.9598 (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: ctHVwH0MNzYrBbuoAAIRp37RjzIXeevCVDlJA7nuXtOcZO7BjNG4KXYtwlJwZM73Z6Vv77KmcpNmmaip0JkRhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9153 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) --- v2 changes: 1. Rephrase the commit message. 2. Change unevaluatedProperties to additionalProperties. 3. Remove the useless lables from examples. v3 changes: 1. Remove the items from clocks and clock-names, add maxItems to clocks and rename the clock. v4 changes: 1. Reorder the required properties. 2. Add assigned-clocks, assigned-clock-parents and assigned-clock-rates. v5 changes: 1. Remove assigned-clocks, assigned-clock-parents and assigned-clock-rates 2. Remove minItems from reg and reg-names 3. Rename the node in the examples to be more general --- .../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 register + block (IERB) and privileged register block (PRB). IERB is used for pre-boot + initialization for all NETC devices, such as ENETC, Timer, EMIDO 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. + +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 = <2>; + #size-cells = <2>; + + system-controller@4cde0000 { + compatible = "nxp,imx95-netc-blk-ctrl"; + reg = <0x0 0x4cde0000 0x0 0x10000>, + <0x0 0x4cdf0000 0x0 0x10000>, + <0x0 0x4c81000c 0x0 0x18>; + reg-names = "ierb", "prb", "netcmix"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + clocks = <&scmi_clk 98>; + clock-names = "ipg"; + power-domains = <&scmi_devpd 18>; + + pcie@4cb00000 { + compatible = "pci-host-ecam-generic"; + reg = <0x0 0x4cb00000 0x0 0x100000>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x1 0x1>; + ranges = <0x82000000 0x0 0x4cce0000 0x0 0x4cce0000 0x0 0x20000 + 0xc2000000 0x0 0x4cd10000 0x0 0x4cd10000 0x0 0x10000>; + + mdio@0,0 { + compatible = "pci1131,ee00"; + reg = <0x010000 0 0 0 0>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + }; + }; From patchwork Thu Oct 24 06:53:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848415 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2062.outbound.protection.outlook.com [40.107.20.62]) (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 63CA21ADFFC; Thu, 24 Oct 2024 07:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753751; cv=fail; b=ZYpsYbjexQXwdoxyRBx89EVgaqmTd4NQ/T4a9tCXUufzpGCxTjChTRVf/+9iGsu3uUMzQMNBBypT5Jbb4yLMCaNU6WTDSQ0ioipv04z4qM48ViLg4PbJtqKsx1ghq0ti760IKSqGZWMFE7nHgM05rLri9uRaXCz7ViEOU8Z+AKc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753751; c=relaxed/simple; bh=yPuogsgYjFUeFfMhMX3jfqdxdBotPkQ2mDy4Th/p/pE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Li8XcNHtcA94u7Q3ToBSBcCFXwd0uWAs0c5ASNcLXwEHv2Jxa+LJNOZiBsIIPIVS3mjDGOBAorAYB6J0v7A222HWMAyVqVkLXeilac/iQZfw5XI/f6QClLZbY+1UHbaWvmfKZ1LdLr+7cwwrnsC2ULGVbNs2oeFwJ4Oa43qA1Kg= 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=hHrGS419; arc=fail smtp.client-ip=40.107.20.62 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="hHrGS419" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SbrUmx4uY2p0Sknol9pMsXmzpDCkrKVhvY5k+bcS1J6lvNfaRDnVv9YJO/pLbERLE+ScXQX2SgFrP8mEDC4+/wJr+LK4yn9XUpNJmEmjqiReygJtOVrVpPDSmLsFRIFtFXQv27p7NJB/BKR/lDlDAEEWJyUfNt8YZ9yJy/qIu+v7k4gI3NCr+JIhOt43S+uR39RKdpg9l0CYTT7G54DDsG1z8fr/v8QriVyA8KVvW/Yab7Iw4dNpSpbvtfcqPaphwLub5xjdm7tzQghBMA7HW4GebbFVFf81/8mBr7vWisfDsvHjtN9PmmFi0LLe7UXtouiJ7sx1wbQ+ojo+DpxwYQ== 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=2gfRmXiN/FyIvPibliGUJEADqq+hRkV6Yn7534qt+BA=; b=fZ4q6whj6fP+xHNWHouBPUyAam65HXIlucWfGobMreLZ+jp1wBodQ8bo3W1qS4ix9RRC4KNIb+CWlsQzlQgL7f32p/l0pg5o3X51mvtfPsKFcY9Qg9udYTBKH0f/hC60JhfYfmcaP5ZdQOT3owgfzu2LSmWHwTDbOC/VFmgok8aZFjD97Sdz/Be9nY17okZClh9E8t62hnaHicC3jIExVpEj+yOzxiEVcC+jrmB9ckL2lgAnDCOXx/Sn4yIlOxTTkgAR1ONPoHHRXYxcfj5TOLChjEllSaRj1v1xK+7CXYo4JZy8MYfkRQWO9qUh3RWW+5nWyIf1crqPu2fdxarKVg== 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=2gfRmXiN/FyIvPibliGUJEADqq+hRkV6Yn7534qt+BA=; b=hHrGS419IRbJousJ/4V7WnuQCP0TNhUkXgFWH6xGWlBZI/o98fEFCbHJS4hb/EvKKkoCwqTim3YAngndw3My97xBAJuo3doBJxUYCZWr4Cow9/KdIqD80h2wyUIjFUisR4LCJK4YoaXRXsvVoWPDKwxljk/jcRor8EG8fkATGmJrXiDJVWe3g5DsNQdyT5WAXLSqxbOfmzRNFxlWsA5pwyybtrJDOxdensD2Xe3C7b65non5VmZ3k8ZXLLVAnMjPcgfw/TGNyw1/Da7F0bOB7Xkc9dYIuA6+JqALHKj9ARq9VTE2sVp8GTKohi8Q3rWtnXaaxiBqAeb5Ji1NJb7CIg== 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 PAXPR04MB9153.eurprd04.prod.outlook.com (2603:10a6:102:22b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 24 Oct 2024 07:09:03 +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.8069.027; Thu, 24 Oct 2024 07:09:03 +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, bhelgaas@google.com, 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 v5 net-next 04/13] net: enetc: add initial netc-blk-ctrl driver support Date: Thu, 24 Oct 2024 14:53:19 +0800 Message-Id: <20241024065328.521518-5-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: 6197d6a8-bd23-4214-6ae9-08dcf3fabd88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: J5AgH6Oql61S3yocMzWVcPAV4nARDGQk/aHtn3EdXPqtF5P3eB5WzDiVxEXroziRq7NNxcpKydqm6gVud8Xw3zfcnMUdNwCepcD/Ig1olp3EmYn/FPbucwf8Rmb/o1HylDHtnfzr2P/v7dv0lkhOpTjjEXKRE5kQnfX+vdukWNkow3j/a50QgrZKRJeqYUHTUcL0hSTb3GeStUyP/v7A8qoQH/p3THZVpmjO+7CMX9iootVD6aTGEKRCU/X8sWuymP64UZ0Y2V7TvyA9Qje7Ucd0I7bDMH1VaymJo8tmHCl3qZXnPP3B473HAMid4XLjq6GUxDP3n4LpL3MghS7140FrNikBmsjBKJYkkuf0h/VKLIZo9sQFi+WZL86ow6Pb6ST/xM0HxGa1t2UOlzAmEkHgd9fqIxsSy3hiGkAcoE/cPh1RWBSPMX/2a23CYtSwDLrc2yGGbhzjZWiS4/0xA4cg4eTrUbLgpnbrnz7b1swAsDLtR0p7aQWZJmVTvOf4Xz6s8EzX/bBdRFOcfEOI+fnmVt2cDBgqPsf5YWgmbH2fvfqjc7cNorRSpkgIEqOPhFP5JkP8z+LfBPlB6cH8DaN8boiTCAPPClWE3+7gNItrzmWVfxobJTYc51oxAPbr4sW8m4HHT0nGYaWICI+bBwMrAK//4eJ3Ix/4LPBVXs3EMbSLeXtjAWezRndJ+kJBNFE2L+YFkwA446XddWv3c7eSYQrLkMgYpZcAgrooDsrqJtm0KXkzhLFeRqN0AwRICM0P/y4NRtwxOt6lxpVxkwpSleaatyFiDPhMOCSdInV4+Aohkb7J4d8fVJV7K6Z3nrTG8FtUZmSvORbTkgBrH7RLoaH3NXZkbHZMZpNYwzd+q2aFb6zmJUa2Rm8J/vuDCzziFaxkip4FKS/rBiYnFeubljFrvPrBCAD+ftYUOaDWnOyU04twz29MXXDewjsC/xto3OOBtD0C1eFVXpHeS14kRUobeB77GeFnA5FaqSWA1XSYELMrI2ydze0g7ws6nRHEcWEVlZUpBB2TUQoQp3GSEmDwNYtIQBlEYt5DcNaPRXUsNPP2pF7Q6qUUQNTc64ZiW5zzkwvJL/KESW0JghkbtZtnjSR2k3GcOGnPCZppHXKnwndlYRbre5fgICqYb9g9HqGaUgK7YMTUQXjA+5f/NrtRtMbZXrlu5zL304Z2TCb+KVM3UWZ/CnCrr4IGKHvhAX0xMcPxAxMgtSz+ibNhO5WBwyhoWOABBZxpnXP+DaallbDn+u6jIAkQsfF8ZV0pLvzibrD8yiNZTRVqBYD9VEjghXw+oT4cBX3oekZAyDKG9PdT819ZjFX8K2Q8f+Hutggdkf6Tza2s8M09YsIGe3bogMHJfZbldSvoq3SAAClPnB132zxv29M8gm5C 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cF4r2+GDAiGIl5d75aqFMBbyVy3rgozEpLATo9pw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Gv08MQAuMJT5cr8Bv1oCnlRUwwegx1M3YOklN8cLz63F/v20cbHBDLMZub/9eNYguqCSAhxAEy7NZMNV3ynq5AFgyzEVtsSA68wK7XyFLZxNc4qWSo9kBpZRNoXMeVDzjcTvf0ahYDKFK4Skgb88EDsGKWLBt+7YfZdNMqZwsmiNkziIw97pyffEeNAYoOr6qa8iErfmGpaZiMIs9WpfeqK9IB6GVTd5RdVRu03V4hblxqsj2VJC57yMnxEE+0j+DrUs1iysJu9cN+haX5VPrfb6wr8KOLPM3vbfTCB8v4EV/VS/KcQInKDosZBPD1I0veW+TXi/8HaQP/HVK3hUFH6E24CBmDkM2Y28QsgtBeuzfRD5yLq0I3dHdBjBw3IfAlTAHGl56znub3NC4WVvF5T9v3Pf5BB2hdz6e5Kk2aLCGxDvGhF2nn3ENo3N8mzh91IQY56jD/MfFwqwXnqGt+RSA5GBPMYFgwrd3zS2wVoh X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6197d6a8-bd23-4214-6ae9-08dcf3fabd88 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:02.9535 (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: 3IbNIsxJbm6dOSwGcNA14p882Wkoy8IaqEHrHL7LwxBf6/fmwgpsBDQ7V9uj0VLFgFq+Uknp82EKu6V3HhJX2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9153 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 --- v5: no changes --- drivers/net/ethernet/freescale/enetc/Kconfig | 14 + drivers/net/ethernet/freescale/enetc/Makefile | 3 + .../ethernet/freescale/enetc/netc_blk_ctrl.c | 438 ++++++++++++++++++ include/linux/fsl/netc_global.h | 19 + 4 files changed, 474 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/ethernet/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/ethernet/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 := enetc_pci_mdio.o enetc_mdio.o obj-$(CONFIG_FSL_ENETC_PTP_CLOCK) += fsl-enetc-ptp.o fsl-enetc-ptp-y := enetc_ptp.o + +obj-$(CONFIG_NXP_NETC_BLK_CTRL) += nxp-netc-blk-ctrl.o +nxp-netc-blk-ctrl-y := 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..9bdee15ef013 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c @@ -0,0 +1,438 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * NXP NETC Blocks Control Driver + * + * Copyright 2024 NXP + */ + +#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 = 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 = platform_get_drvdata(pdev); + struct device_node *np = pdev->dev.of_node; + phy_interface_t interface; + int bus_devfn, mii_proto; + u32 val; + int err; + + /* Default setting of MII protocol */ + val = 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 = netc_of_pci_get_bus_devfn(gchild); + if (bus_devfn < 0) + return -EINVAL; + + if (bus_devfn == IMX95_ENETC2_BUS_DEVFN) + continue; + + err = of_get_phy_mode(gchild, &interface); + if (err) + continue; + + mii_proto = netc_get_link_mii_protocol(interface); + if (mii_proto < 0) + return -EINVAL; + + switch (bus_devfn) { + case IMX95_ENETC0_BUS_DEVFN: + val = u32_replace_bits(val, mii_proto, + CFG_LINK_MII_PORT_0); + break; + case IMX95_ENETC1_BUS_DEVFN: + val = 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 = 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 = platform_get_drvdata(pdev); + const struct netc_devinfo *devinfo = priv->devinfo; + int err; + + if (netc_ierb_is_locked(priv)) { + err = netc_unlock_ierb_with_warm_reset(priv); + if (err) { + dev_err(&pdev->dev, "Unlock IERB failed.\n"); + return err; + } + } + + if (devinfo->ierb_init) { + err = devinfo->ierb_init(pdev); + if (err) + return err; + } + + err = 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 = s->private; + u32 val; + + val = 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 = 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 = debugfs_create_dir("netc_blk_ctrl", NULL); + if (IS_ERR(root)) + return; + + priv->debugfs_root = 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 = 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 = { + .flags = NETC_HAS_NETCMIX, + .netcmix_init = imx95_netcmix_init, + .ierb_init = imx95_ierb_init, +}; + +static const struct of_device_id netc_blk_ctrl_match[] = { + { .compatible = "nxp,imx95-netc-blk-ctrl", .data = &imx95_devinfo }, + {}, +}; +MODULE_DEVICE_TABLE(of, netc_blk_ctrl_match); + +static int netc_blk_ctrl_probe(struct platform_device *pdev) +{ + struct device_node *node = pdev->dev.of_node; + const struct netc_devinfo *devinfo; + struct device *dev = &pdev->dev; + const struct of_device_id *id; + struct netc_blk_ctrl *priv; + struct clk *ipg_clk; + void __iomem *regs; + int err; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->pdev = pdev; + ipg_clk = 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 = of_match_device(netc_blk_ctrl_match, dev); + if (!id) + return dev_err_probe(dev, -EINVAL, "Cannot match device\n"); + + devinfo = (struct netc_devinfo *)id->data; + if (!devinfo) + return dev_err_probe(dev, -EINVAL, "No device information\n"); + + priv->devinfo = devinfo; + regs = 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 = regs; + regs = 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 = regs; + if (devinfo->flags & NETC_HAS_NETCMIX) { + regs = 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 = regs; + } + + platform_set_drvdata(pdev, priv); + if (devinfo->netcmix_init) { + err = devinfo->netcmix_init(pdev); + if (err) + return dev_err_probe(dev, err, + "Initializing NETCMIX failed\n"); + } + + err = 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 = 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 = platform_get_drvdata(pdev); + + of_platform_depopulate(&pdev->dev); + netc_blk_ctrl_remove_debugfs(priv); +} + +static struct platform_driver netc_blk_ctrl_driver = { + .driver = { + .name = "nxp-netc-blk-ctrl", + .of_match_table = netc_blk_ctrl_match, + }, + .probe = netc_blk_ctrl_probe, + .remove = 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_global.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 From patchwork Thu Oct 24 06:53:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848416 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2062.outbound.protection.outlook.com [40.107.20.62]) (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 84E0A1AE863; Thu, 24 Oct 2024 07:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753755; cv=fail; b=s73Ee6PRgSH+cS0i1DC/mzMA7jLILOwa2PCKn5DSS9DFMrsv117iFl9f9m191DPs/2rq23TFQNhJdzPIMutFf9SDdRWBs7FbxPj37euGKlNwiho5rXKhAT/LiEDwv3mBvsH4+LVcEAuh5cjuk9HgKC7spgRjpLkYMQJFxqJcFKY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753755; c=relaxed/simple; bh=nO80/WMwWr1Cszc9e3EkeHOuOGz4sV/k21NhcKa/nt4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=JF5R22prouEEQfC80vl3pucorX4QJTDYQswr662+ozpz1HnhRCNCUBLwIAmM9kq5PKl8U9aWIQkkLl+thVxBxc4t0ser1zUzIHqp2KjRXuRR5oBR6r7occXoQSSlGyZvzmc9FdNIMlf0q6y2BPUxedg8CKO/G1U8ocQA5NMTCTg= 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=EcSswzuJ; arc=fail smtp.client-ip=40.107.20.62 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="EcSswzuJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eSd2A/2mKo4PqddXyC0npwYTqDG5AmCiO8D7Is3r+3i6GhLtv22J5hlgvJHk7sa4qV3+X3lnSUQ1gZfG4a1kTww0HCe5v8NAoXC5EPRtEE4SGckCysiBGcTVxLBKBeqGobmx4bBLhVUun76x/hoQyk5vWc4W44CQZmodFvP3lt38GhrSVTqmRW7QaUgLFQ+AQ1GEk1fnLq3RRhd1TAdLhrsnold25prsorTzFlyhq368M/nFfhX5fmDjCu4qP7K4UiT4ArbIhhYFyDP7uFhVC9XGzNEW2lc+B7/VrseVchufx8k/wInupSoDHWW3vl1sv4utTztKO5k2iXUoS7eMNw== 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=CmcZ+77nPZe9zy1ANHkgquOqGn/FRrjur6Msixgy2AQ=; b=lM8toMMF/GXwD8GugOmTSEc1GkFTc1CkNiDMHVwfdaVi7rUi/iip4OTtN5vKBEtgswHKEFivF2n9cPRBmRF/MBKLHxUfuAzeqUIT8LI/0Uo9BD5ex6Xk0yqfW1ZCyGdI6JWxGppfEbG03O7pdu6y2n8AeabQ0UROYkJSkHvUi7w+fOM+0VTeX3wHylftcEBOcbsqVnwEC9kA057Fuqa2vc9zIzzFGSieaiZttHR+7U9J23TND8veczjojBziVbtdemMq4cajlLTwnSOtmKxfq64vO2B2Sl2DmTowkx5oEnNh12vh0P39TU7XWHFmdHRcWDSEF/IdY+avfTLExKyb6w== 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=CmcZ+77nPZe9zy1ANHkgquOqGn/FRrjur6Msixgy2AQ=; b=EcSswzuJ/X4SjUUCOR4yzfajyuZbavayThzmIxs+Epyd4f35yvM1MGxzBcOpMxAlTqjuxy3UscA5wDZwC3ZZgQMSzBvqrlSccSJ4K8W9DbZB3mhhdhJsJjHYmHHII85VDQZ3Dmnh7gv90RijmWnBc18gHiQjDWaZZjLrsEPerfLV7cY74CPBIS49MqWTmSFenezdsk1CtcrMc5qJEfHl+9BB4uo5/9xDsTPJvzv80xxB742Nlak/jVECvVa6HS1z9G64Vgnkbj2F01gDCL/Yw+BZAtXrhoC8qkzCN3TtnDVBGTNvuUTdhUaIedzgdHQcfFMt7TZvW+QlaRa8jc5Axw== 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 PAXPR04MB9153.eurprd04.prod.outlook.com (2603:10a6:102:22b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 24 Oct 2024 07:09:08 +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.8069.027; Thu, 24 Oct 2024 07:09:08 +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, bhelgaas@google.com, 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 v5 net-next 05/13] net: enetc: extract common ENETC PF parts for LS1028A and i.MX95 platforms Date: Thu, 24 Oct 2024 14:53:20 +0800 Message-Id: <20241024065328.521518-6-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: 55644329-e929-4b05-2bca-08dcf3fac10e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: QN7KLb6mOdvEsY5qJnHjVu2y11dcg0awgUn+9Jv0TTyl5co1tTr9q88dd6ugDKdk1qRVXZ0L0ylHibw7RAaZp3ii3cjAagMwGg0emlW5GCPXAjzDix2ARse7/XpGKkB7HdKVMYrB+kOQSOQJ0Rb/t3mVe1JdQjaMn6VDslMOmD51k84qZ7HpFkMqLgczU6Qf1QQWTWHJKqWa6tbomTdd08nIcfIa/IgL3qwZgAKXReD48uaENpsS5+IIPPJG1ri+qdmlQCYGMmNeUozgI0jYfpiVW7im2Fej67i2KKdrrISL7MM9RGthJ4rikObP8vpnqIk8ksO+fi0Sh3oYh8/Nn62XDF6Lu9GG9Ldn68hAVmiLKLxpeZ0KVQSQUNx9PPacut3g/p2h8FLletvVIXQQcrGlS5gvmrdUF7aAikBiqb4qJypCYjWXVdFQRQZdlPkM3tDTDbONfmnnYYvEG1ICgo/HTPmNZqbY+zBMn731ediP/FewSo7PHVWRL6616R2kQo3rahPwSh5tQqFFu6ejiHYYVk8emdGOwwJpf/DPP/hd/nO1xMW/TwtYBPdV8NvW9ilzvlPBznfLxffPs/mx2FpImbdgqGnVLXHlXEifHmN3zQS/OUacNfSpU/7AiUdu7pAY8PwN1UO7wkITOWqquc/6l9rNOszUYtHSgviXBrW/9YuT3EqEbsNpAtKd5fyq0e4JH6jNkfxxzgar/3iU9vBSCyO5P7RRod9ugO7E0hRe7bOvuztZF8IIQg3P0qmCBju3KVRjI7faoNScpeeraeDDni6uyjEn2+0M2IyoN3YgobupJwjjREGDdkTT+dCbVzCDrBwmQGYxyrh9sRgv+4w4bv7P0eLKhxWZGYD7MbbDj1qvVe8jgPwaxeNi8ZSPbE2BZj0d0H/qrl8+nVOItAbkEPgStXmAvL/r9GeILdU9z3tRnxT+s0/ImpIoNmwdMBguR9gZ4Akvpq77vWUPlPQQ8bLQEMLt3k2JI5P7yiksV+XUxuFEcPIMi+pBUJnLBcYHDL2MQWt0w/OWHH1B2WtPlX1OzbvWOPhllBqFzb+KwKf4rCIlBxJU5wLzK0Rl2RUMR+BwSl4Vhe1+nSKTGk9/3Xtf1WxuGQFoRnonDdTMGHfCFKJIsLj2n4hCbNxc0+uOcQLt7ZI47jUEHLRGaPX8sNI2m8b+Fs50ZqQiQFbqfXeJIVNOdzjKf0D9BfLsQExmeazC94FdP/sjWuiC2nFion1AYCPIHCJqaMlB6u1o8BkK3A4k6bWxeCCrpobD4+x8qOfIRyeran6q7m0MEayn+rrDuXdJgLZpqaXFi1jfpyn2nUJecIEFmou1s1kHGgkQbF27iTIekIgrVxRpESm1L8ppvUnh4LWdnrphNjfDvhPT2Q6htVVv9xXI1F+f 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W89jyvZE+/PxCdSq+Rz9XHlE3WFr4a3wPHGoIm2CSzYghYPXbeMlU7WlLFhVmSEQ+xaxVioNRewmkTHHpfHo/nd/b8toYJeZQIjiLHXh+vsJmakkCizzgwPuqZAuT6U86XzgEx9xjUevb8evve0kZJFhm/e/UP5OzqKDw61SJtOB/cSAruHgR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/zaMiFr7IUfBQsbztCIuKWz8S//LyVZmQTtWuv2+w5Xr0k1FqC/nXigZdxfkpEgTrILJIuYKlip3/b3Frcm9j3bWsoquC8+Ay2f37Pa/V66CjfmLzOH1R833pXfdFnliQ5eDbzWks1pv73kiLQaP2gyDZleuvAT7C2z809fu/4FqQ/vA3pyJR02vTq9e/BBia01Hr1Z16HeznN0cde6V2y7v2lHzk5vQkCB5m6DlrTReIzp1qE3pMYkFQekwifT726DepmPjTp9NlAaPwYIoLLKPAgxoYiPJiJ9A1gSozyuBjlUBjd6qpuOUb3xM5WpUBqfSQj8NC0nP8sXJDpP8Xszc6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55644329-e929-4b05-2bca-08dcf3fac10e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:08.8524 (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: 20esvJ77umcruZ5lPlLjRl3Rqr804eUQBxPktzjATE3Op7veLVkgsJdaNBvRTCLxGAzMw7mB/MZlfSBkS1Tzxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9153 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 Reviewed-by: Frank Li Reviewed-by: Claudiu Manoil --- v5: no changes --- drivers/net/ethernet/freescale/enetc/Makefile | 2 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 297 +----------------- .../net/ethernet/freescale/enetc/enetc_pf.h | 13 + .../freescale/enetc/enetc_pf_common.c | 295 +++++++++++++++++ 4 files changed, 313 insertions(+), 294 deletions(-) create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_pf_common.c diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/ethernet/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) += fsl-enetc-core.o fsl-enetc-core-y := enetc.o enetc_cbdr.o enetc_ethtool.o obj-$(CONFIG_FSL_ENETC) += fsl-enetc.o -fsl-enetc-y := enetc_pf.o +fsl-enetc-y := enetc_pf.o enetc_pf_common.o fsl-enetc-$(CONFIG_PCI_IOV) += enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 8f6b0bf48139..3cdd149056f9 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -2,11 +2,8 @@ /* Copyright 2017-2019 NXP */ #include -#include #include -#include #include -#include #include #include #include "enetc_ierb.h" @@ -14,7 +11,7 @@ #define ENETC_DRV_NAME_STR "ENETC PF driver" -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 = __raw_readl(hw->port + ENETC_PSIPMAR0(si)); u16 lower = __raw_readw(hw->port + ENETC_PSIPMAR1(si)); @@ -23,8 +20,8 @@ static void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) put_unaligned_le16(lower, addr + 4); } -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 = get_unaligned_le32(addr); u16 lower = get_unaligned_le16(addr + 4); @@ -33,20 +30,6 @@ static void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, __raw_writew(lower, hw->port + ENETC_PSIPMAR1(si)); } -static int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) -{ - struct enetc_ndev_priv *priv = netdev_priv(ndev); - struct sockaddr *saddr = 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 = enetc_port_rd(hw, ENETC_PSIPVMR); @@ -393,56 +376,6 @@ static int enetc_pf_set_vf_spoofchk(struct net_device *ndev, int vf, bool en) return 0; } -static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, - int si) -{ - struct device *dev = &pf->si->pdev->dev; - struct enetc_hw *hw = &pf->si->hw; - u8 mac_addr[ETH_ALEN] = { 0 }; - int err; - - /* (1) try to get the MAC address from the device tree */ - if (np) { - err = of_get_mac_address(np, mac_addr); - if (err == -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 = enetc_setup_mac_address(np, pf, 0); - if (err) - return err; - - for (i = 0; i < pf->total_vfs; i++) { - err = 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 = enetc_si_priv(si); @@ -775,187 +708,6 @@ static const struct net_device_ops enetc_ndev_ops = { .ndo_xdp_xmit = enetc_xdp_xmit, }; -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 = netdev_priv(ndev); - - SET_NETDEV_DEV(ndev, &si->pdev->dev); - priv->ndev = ndev; - priv->si = si; - priv->dev = &si->pdev->dev; - si->ndev = ndev; - - priv->msg_enable = (NETIF_MSG_WOL << 1) - 1; - ndev->netdev_ops = ndev_ops; - enetc_set_ethtool_ops(ndev); - ndev->watchdog_timeo = 5 * HZ; - ndev->max_mtu = ENETC_MAX_MTU; - - ndev->hw_features = 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 = 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 = NETIF_F_SG | NETIF_F_HW_CSUM | - NETIF_F_TSO | NETIF_F_TSO6; - - if (si->num_rss) - ndev->hw_features |= NETIF_F_RXHASH; - - ndev->priv_flags |= IFF_UNICAST_FLT; - ndev->xdp_features = 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 |= ENETC_F_QCI; - ndev->features |= NETIF_F_HW_TC; - ndev->hw_features |= 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 = &pf->si->pdev->dev; - struct enetc_mdio_priv *mdio_priv; - struct mii_bus *bus; - int err; - - bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); - if (!bus) - return -ENOMEM; - - bus->name = "Freescale ENETC MDIO Bus"; - bus->read = enetc_mdio_read_c22; - bus->write = enetc_mdio_write_c22; - bus->read_c45 = enetc_mdio_read_c45; - bus->write_c45 = enetc_mdio_write_c45; - bus->parent = dev; - mdio_priv = bus->priv; - mdio_priv->hw = &pf->si->hw; - mdio_priv->mdio_base = ENETC_EMDIO_BASE; - snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev)); - - err = of_mdiobus_register(bus, np); - if (err) - return dev_err_probe(dev, err, "cannot register MDIO bus\n"); - - pf->mdio = 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 = &pf->si->pdev->dev; - struct enetc_mdio_priv *mdio_priv; - struct phylink_pcs *phylink_pcs; - struct mii_bus *bus; - int err; - - bus = mdiobus_alloc_size(sizeof(*mdio_priv)); - if (!bus) - return -ENOMEM; - - bus->name = "Freescale ENETC internal MDIO Bus"; - bus->read = enetc_mdio_read_c22; - bus->write = enetc_mdio_write_c22; - bus->read_c45 = enetc_mdio_read_c45; - bus->write_c45 = enetc_mdio_write_c45; - bus->parent = dev; - bus->phy_mask = ~0; - mdio_priv = bus->priv; - mdio_priv->hw = &pf->si->hw; - mdio_priv->mdio_base = ENETC_PM_IMDIO_BASE; - snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); - - err = mdiobus_register(bus); - if (err) { - dev_err(dev, "cannot register internal MDIO bus (%d)\n", err); - goto free_mdio_bus; - } - - phylink_pcs = lynx_pcs_create_mdiodev(bus, 0); - if (IS_ERR(phylink_pcs)) { - err = PTR_ERR(phylink_pcs); - dev_err(dev, "cannot create lynx pcs (%d)\n", err); - goto unregister_mdiobus; - } - - pf->imdio = bus; - pf->pcs = 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 == PHY_INTERFACE_MODE_SGMII || - pf->if_mode == PHY_INTERFACE_MODE_1000BASEX || - pf->if_mode == PHY_INTERFACE_MODE_2500BASEX || - pf->if_mode == PHY_INTERFACE_MODE_USXGMII); -} - -static int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node) -{ - struct device_node *mdio_np; - int err; - - mdio_np = of_get_child_by_name(node, "mdio"); - if (mdio_np) { - err = enetc_mdio_probe(pf, mdio_np); - - of_node_put(mdio_np); - if (err) - return err; - } - - if (enetc_port_has_pcs(pf)) { - err = 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 iface) { @@ -1101,47 +853,6 @@ static const struct phylink_mac_ops enetc_mac_phylink_ops = { .mac_link_down = enetc_pl_mac_link_down, }; -static int enetc_phylink_create(struct enetc_ndev_priv *priv, - struct device_node *node) -{ - struct enetc_pf *pf = enetc_si_priv(priv->si); - struct phylink *phylink; - int err; - - pf->phylink_config.dev = &priv->ndev->dev; - pf->phylink_config.type = PHYLINK_NETDEV; - pf->phylink_config.mac_capabilities = 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 = phylink_create(&pf->phylink_config, of_fwnode_handle(node), - pf->if_mode, &enetc_mac_phylink_ops); - if (IS_ERR(phylink)) { - err = PTR_ERR(phylink); - return err; - } - - priv->phylink = 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 +1049,7 @@ static int enetc_pf_probe(struct pci_dev *pdev, if (err) goto err_mdiobus_create; - err = enetc_phylink_create(priv, node); + err = enetc_phylink_create(priv, node, &enetc_mac_phylink_ops); if (err) goto err_phylink_create; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h index c26bd66e4597..92a26b09cf57 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -58,3 +58,16 @@ struct enetc_pf { int enetc_msg_psi_init(struct enetc_pf *pf); void enetc_msg_psi_free(struct enetc_pf *pf); void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int mbox_id, u16 *status); + +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); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c new file mode 100644 index 000000000000..bce81a4f6f88 --- /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.h" + +int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct sockaddr *saddr = 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 = &pf->si->pdev->dev; + struct enetc_hw *hw = &pf->si->hw; + u8 mac_addr[ETH_ALEN] = { 0 }; + int err; + + /* (1) try to get the MAC address from the device tree */ + if (np) { + err = of_get_mac_address(np, mac_addr); + if (err == -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 = enetc_setup_mac_address(np, pf, 0); + if (err) + return err; + + for (i = 0; i < pf->total_vfs; i++) { + err = 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 = netdev_priv(ndev); + + SET_NETDEV_DEV(ndev, &si->pdev->dev); + priv->ndev = ndev; + priv->si = si; + priv->dev = &si->pdev->dev; + si->ndev = ndev; + + priv->msg_enable = (NETIF_MSG_WOL << 1) - 1; + ndev->netdev_ops = ndev_ops; + enetc_set_ethtool_ops(ndev); + ndev->watchdog_timeo = 5 * HZ; + ndev->max_mtu = ENETC_MAX_MTU; + + ndev->hw_features = 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 = 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 = NETIF_F_SG | NETIF_F_HW_CSUM | + NETIF_F_TSO | NETIF_F_TSO6; + + if (si->num_rss) + ndev->hw_features |= NETIF_F_RXHASH; + + ndev->priv_flags |= IFF_UNICAST_FLT; + ndev->xdp_features = 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 |= ENETC_F_QCI; + ndev->features |= NETIF_F_HW_TC; + ndev->hw_features |= 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 = &pf->si->pdev->dev; + struct enetc_mdio_priv *mdio_priv; + struct mii_bus *bus; + int err; + + bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); + if (!bus) + return -ENOMEM; + + bus->name = "Freescale ENETC MDIO Bus"; + bus->read = enetc_mdio_read_c22; + bus->write = enetc_mdio_write_c22; + bus->read_c45 = enetc_mdio_read_c45; + bus->write_c45 = enetc_mdio_write_c45; + bus->parent = dev; + mdio_priv = bus->priv; + mdio_priv->hw = &pf->si->hw; + mdio_priv->mdio_base = ENETC_EMDIO_BASE; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev)); + + err = of_mdiobus_register(bus, np); + if (err) + return dev_err_probe(dev, err, "cannot register MDIO bus\n"); + + pf->mdio = 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 = &pf->si->pdev->dev; + struct enetc_mdio_priv *mdio_priv; + struct phylink_pcs *phylink_pcs; + struct mii_bus *bus; + int err; + + bus = mdiobus_alloc_size(sizeof(*mdio_priv)); + if (!bus) + return -ENOMEM; + + bus->name = "Freescale ENETC internal MDIO Bus"; + bus->read = enetc_mdio_read_c22; + bus->write = enetc_mdio_write_c22; + bus->read_c45 = enetc_mdio_read_c45; + bus->write_c45 = enetc_mdio_write_c45; + bus->parent = dev; + bus->phy_mask = ~0; + mdio_priv = bus->priv; + mdio_priv->hw = &pf->si->hw; + mdio_priv->mdio_base = ENETC_PM_IMDIO_BASE; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); + + err = mdiobus_register(bus); + if (err) { + dev_err(dev, "cannot register internal MDIO bus (%d)\n", err); + goto free_mdio_bus; + } + + phylink_pcs = lynx_pcs_create_mdiodev(bus, 0); + if (IS_ERR(phylink_pcs)) { + err = PTR_ERR(phylink_pcs); + dev_err(dev, "cannot create lynx pcs (%d)\n", err); + goto unregister_mdiobus; + } + + pf->imdio = bus; + pf->pcs = 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 == PHY_INTERFACE_MODE_SGMII || + pf->if_mode == PHY_INTERFACE_MODE_1000BASEX || + pf->if_mode == PHY_INTERFACE_MODE_2500BASEX || + pf->if_mode == 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 = of_get_child_by_name(node, "mdio"); + if (mdio_np) { + err = enetc_mdio_probe(pf, mdio_np); + + of_node_put(mdio_np); + if (err) + return err; + } + + if (enetc_port_has_pcs(pf)) { + err = 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 = enetc_si_priv(priv->si); + struct phylink *phylink; + int err; + + pf->phylink_config.dev = &priv->ndev->dev; + pf->phylink_config.type = PHYLINK_NETDEV; + pf->phylink_config.mac_capabilities = 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 = phylink_create(&pf->phylink_config, of_fwnode_handle(node), + pf->if_mode, ops); + if (IS_ERR(phylink)) { + err = PTR_ERR(phylink); + return err; + } + + priv->phylink = phylink; + + return 0; +} + +void enetc_phylink_destroy(struct enetc_ndev_priv *priv) +{ + phylink_destroy(priv->phylink); +} From patchwork Thu Oct 24 06:53:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848417 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2064.outbound.protection.outlook.com [40.107.21.64]) (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 0B48C18BC13; Thu, 24 Oct 2024 07:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753763; cv=fail; b=cA9G6MBavXbjBZjPZj6O788jhoR8wM5NoKN15Fgl5htK6/lk8bwb7GzpOEqDqA4nhJAT8lGm0Ou97Xmpx9ATb6Q8OPk+/VEGxWuYs5TglYn1c3IzzMpwwyxCV1pmBSNWUUwYnUlqBCWhhPQTzVDob2TESNwmIBHc+RLD+J0uw90= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753763; c=relaxed/simple; bh=pPfZArAtQg/u9KHB85Rs5lUaKbaXUgfwqV37y/lN6cU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=SxVT705m0O8bpk+OV6v9SrhL5EFtlk+sAG6OL3+MHPs6tC5/Kcg0uTm2/65ps00K+HTPHfvkQ/+wugiM2zbodnr/zYgIo5MKiFtHE2YlEKuQKiTM+W/SpgdAObT0Rx7J+Yrq/xeukzU2GrDGNQtl/OcuwYYFVNo5ZKvKm2nHo20= 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=HM9L1CR1; arc=fail smtp.client-ip=40.107.21.64 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="HM9L1CR1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C4r+yefAgkRDhbhYzwqf3NKB8DXOiDu0wI3OH/QAuJ2QXHwZWFD+hDfPf7tHB/0RCZHTF3iG0Xl4VhR+A033pncDUj7fUZmyMP20h3zQmYPN8Rdkqgy/N8KgR9mC7Yk65UDq2jgSaRtZtmTm8VkWobqxmunfXzQtxcIq7mZGED2qA5bObSjvLTprqmgeXPYI8BLsZm02f+BCDIp0KrpoZAZAbX5gX9RdQuI/SN85eqpHywNuxhWnEYqevbnMcJHhaNlK/d2EAMUwYZ+aZstZgQC2hzPQ6gscBikFCLDMBf01IYnYwQo9czKrWKHh3Sm4rN19sz7Z4IwNe4SIhmsttA== 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=GR9yd7tpAvdaQThHWnTfjjwcJxGvfNY7vaGzd8oJIqg=; b=BF/eILnu60vB76e7NlaM4PgbORpSpeYt4yUX/FgMM9rNVNpXaUNHMeF9DoKir4EEPjGzgTVmPUMPAgcV4/fWw93dpFhEDiyF1APvTAL0+e5BXr6+YPVjVY4Ww+EImXlyZ/75DTIZzwdSNrKV0Nhvq1pn6ypWe5cQXTJa//8xozc//oB3fQAe8PiBKgT7y5pf2dvCTWC3V0BjBoZunnTMd/WJO4bl5fdKVGAUn4fI/rV15kdMgPKvjCpQKptbyuYXBflsmMZKdld8J5X7e3/R1Yt4Cjrq2YPvbEWT7IExKYjY5+QuuZEQyOB/p/zf0eTWmOeaFVWgzDCJr7jYYIf+WA== 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=GR9yd7tpAvdaQThHWnTfjjwcJxGvfNY7vaGzd8oJIqg=; b=HM9L1CR1seOeyVUvH8TFJk8jdzUfo4MfAiYUJuSMPtA6LWWBYgCbSZLzYRDlNsc4JbjLiRNnTgxl3rKebdmjS5C2YSQfm1yvpfC0oS2iXKRK4gNOYqjmVBQyQNWdhVEnn5F4mgT4NFgIHYKDTFOSOP5Vr99I5MFDuz1Sqqmn2lVCU/KYaZx13bfnBnRCHHpCAOsEH0hEv9BMtzw2fVpoo2VMyc32oKe+L+0oEcY7q1lByh9Kb8bozkrVI3Loh819rtnswKlwTz1FOh0qkqpoaBzQ/XVEGF2z/iwUzGkkXusm6kOMS8F8JG3hg8PpCbH7DLQiBMAj5Ca4rRLlQgWmTA== 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 PAXPR04MB9153.eurprd04.prod.outlook.com (2603:10a6:102:22b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 24 Oct 2024 07:09:15 +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.8069.027; Thu, 24 Oct 2024 07:09:15 +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, bhelgaas@google.com, 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 v5 net-next 06/13] net: enetc: build enetc_pf_common.c as a separate module Date: Thu, 24 Oct 2024 14:53:21 +0800 Message-Id: <20241024065328.521518-7-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e1a120f-5911-4bbd-b186-08dcf3fac500 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: axCYEbOH5YVJbcuj0X2Zbn7zL3KAVdXmaxW3Ei+LCo0XvvRlDc7wGSYMM3jyR0jg5OoTaNMqDv78houOh9YgDLa8ikuAJDtEd/YADKkRVoO2MHziXr+ubZGzABaBfvgV3d+QjNlwc0ipi7UFjrpye5SRP7WCZM41KzoXcIz2lKRmecwlqzby4E2CWRaYh7PiaCcMtgrrJmEdHEjDQ6Otox3qUoVmKdVDXr5dXGbHa+2KpLRwvR13+1owN6+ffGmFI2EVp39pZKwEs1kvSdx06mNHowZiYpOm8YKQ6oovntvpCjXrFypAAEYYMxuovyZGFuy2nCJT6WA230q4VwyCSGKx/WgRjD6wFrRUan4yhzZKsoOx9PqCO2wzPMkzdndWZGPSeY1aWJMJ0m0/djRAQ1hua9g422pZ++obDijXaXJrEYz0ee4bRtQdJsy+1rbEpyEo0714GtsTJ6uW5m2Av/vZV57L+JJ+BgQm/po02I5WVdKRId6A4v3WZ9hgh+knwn6DOi9UQuTZJjJjTXPxp7TMT2Ko51Jm38NUKJ+uT4V3jZEOGo9/fWe8LscM4J5r/vDndCtvrE5z4twjcy9JApF9dzlObP6H7QC4xiVG2IjYDrcc6jlKpAVFfBt5qZfa/OeC4PZxKkfDa6X6KM/9PDAPNNf4qU3hT8jeGs8dUnomnSqGm5D660Y9jgiYLxvo/5w6Cpxp1oHNI8/crGRWxYTQrGgCzlW45oL8NMaud4fG4ATEcm20rnZ+pQrl8kpmcT0y3z2XrNXajpslH+s6owQDEiLXuhokrCBQyY/1gvwU0JpUBXKyxSYhwMfCOINJ0ENH5DekEjRQ0KUtxSbDY4vl2iwqxmrKVBPYt/FulH6KKS+6wZRdQW7JN0iGD9dJkXOLkMku7gssc12cBU5MAW0JSo0GOR6cvyohVLvgcU/C8FUNVjySyo6BMjjWoUouBgojfz+CXTfOXo2R7+BcomjadolJjUK7i5PZJuJk7pomHzvAmPRd2inHPX7lZOrJ/l3k/zEsK0mptKYmMbThs4ZXIZsAl5xDsS6XqCPqeaGt1nqppxKfSFCxd0BDnhfpEGE0FxnlbAhQoldn1fLRqr9yCu2MmbfXZMzEG/WXZskeZpJxkUaqrzXu3HggYB68ZyXAoZrrPkYj0d7kPTYzHfrATUCPfSAP8Wh1S5dm6bBR21aFAbNqOFll8WuWdMWQa0uJSxM5Q7Laz/1qBqT0FZAUBJ7MMR10qjCZG8dFSthVeB9XyigSc+03SPpBgzYqCdjPShg/NfLJCFWIhgC7rMUorQPAOzI4x/PtOovTM0c6UBvEkeXi+5JqXdztpcJbBMVrY6QMyDnDcmKF883x3IpRL1BaDBGDu/l/D5f8V/RUnmCkzZBChY0PbxhU72ut 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)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YxbGsTwuJcMFVSUDd2/D/Of25tg5+RsO3XbmLkJq5KQVSFo5qFmpuubV4Bi4UNHeaJCDM4NvtVF4je7ekAmuNar14/X0VXxrf8+xEEytaZ7WXXTQYIgN3YbmF4Xz6rZO5Ntab3u6P7hZ2zx9qIxEYHG9L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1LYegffWp2kCCq2k9mDxvtgiVZOhT26gOb+YrLlpsRMQfO5hARw6xtOrYzFnTHSpX+cRyMMGObFu3ItMkIr2Sd2UlAQOY+eRPHEZJ2YQZoT78SJpeskkyqe6CnnxI3EsFY8n+u1zjzojQGi+8tTy8/Uln1tXJU0FGSgip1ftjshOcvdUO2rcT2O+rUZXOfB63DIE8YrfFa+7jr8oh+AIdT59/HWG8ZMxQIwpMY3tDZKzBAs5pya8dG8tna6QjBwtK7haFkIl9oEk58eEF+l6A7pdXejoRdema17Ic+GmquMD+LuGhQp7eQUUoD6i/RPex2zmyEVBXIHV5F3Ee8pkDMtzHiIDikHhSo6O2heJQE/mMN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e1a120f-5911-4bbd-b186-08dcf3fac500 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:15.5104 (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: riMJ8jOPMMiAsyL3PRLKmzDd09S6zKRm6r8C8U0m/aWw6SEwmDR2jWIJP83cQjNb2YLg4XCvcl2mBvnrSn8dew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9153 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 Reviewed-by: Frank Li Reviewed-by: Claudiu Manoil --- v5: no changes --- 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 | 21 ++++++-- .../freescale/enetc/enetc_pf_common.c | 50 ++++++++++++++++--- 5 files changed, 96 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/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 If compiled as module (M), the module name is fsl-enetc-core. +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/ethernet/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) += fsl-enetc-core.o fsl-enetc-core-y := enetc.o enetc_cbdr.o enetc_ethtool.o +obj-$(CONFIG_NXP_ENETC_PF_COMMON) += nxp-enetc-pf-common.o +nxp-enetc-pf-common-y := enetc_pf_common.o + obj-$(CONFIG_FSL_ENETC) += fsl-enetc.o -fsl-enetc-y := enetc_pf.o enetc_pf_common.o +fsl-enetc-y := enetc_pf.o fsl-enetc-$(CONFIG_PCI_IOV) += enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 3cdd149056f9..7522316ddfea 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -11,7 +11,7 @@ #define ENETC_DRV_NAME_STR "ENETC PF driver" -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 = __raw_readl(hw->port + ENETC_PSIPMAR0(si)); u16 lower = __raw_readw(hw->port + ENETC_PSIPMAR1(si)); @@ -20,8 +20,8 @@ void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) put_unaligned_le16(lower, addr + 4); } -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 = get_unaligned_le32(addr); u16 lower = get_unaligned_le16(addr + 4); @@ -30,6 +30,17 @@ void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, __raw_writew(lower, hw->port + ENETC_PSIPMAR1(si)); } +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 = enetc_port_rd(hw, ENETC_PSIPVMR); @@ -970,6 +981,14 @@ static void enetc_psi_destroy(struct pci_dev *pdev) enetc_pci_remove(pdev); } +static const struct enetc_pf_ops enetc_pf_ops = { + .set_si_primary_mac = enetc_pf_set_primary_mac_addr, + .get_si_primary_mac = enetc_pf_get_primary_mac_addr, + .create_pcs = enetc_pf_create_pcs, + .destroy_pcs = enetc_pf_destroy_pcs, + .enable_psfp = enetc_psfp_enable, +}; + static int enetc_pf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -997,6 +1016,7 @@ static int enetc_pf_probe(struct pci_dev *pdev, pf = enetc_si_priv(si); pf->si = si; pf->total_vfs = pci_sriov_get_totalvfs(pdev); + enetc_pf_ops_register(pf, &enetc_pf_ops); err = 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 92a26b09cf57..39db9d5c2e50 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; }; +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 *bus); + 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 { phy_interface_t if_mode; struct phylink_config phylink_config; + + const struct enetc_pf_ops *ops; }; #define phylink_to_enetc_pf(config) \ @@ -59,9 +71,6 @@ int enetc_msg_psi_init(struct enetc_pf *pf); void enetc_msg_psi_free(struct enetc_pf *pf); void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int mbox_id, u16 *status); -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, @@ -71,3 +80,9 @@ 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 void enetc_pf_ops_register(struct enetc_pf *pf, + const struct enetc_pf_ops *ops) +{ + pf->ops = ops; +} diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c index bce81a4f6f88..94690ed92e3f 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -8,19 +8,37 @@ #include "enetc_pf.h" +static int enetc_set_si_hw_addr(struct enetc_pf *pf, int si, u8 *mac_addr) +{ + struct enetc_hw *hw = &pf->si->hw; + + if (pf->ops->set_si_primary_mac) + pf->ops->set_si_primary_mac(hw, si, mac_addr); + else + return -EOPNOTSUPP; + + return 0; +} + int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_pf *pf = enetc_si_priv(priv->si); struct sockaddr *saddr = addr; + int err; if (!is_valid_ether_addr(saddr->sa_data)) return -EADDRNOTAVAIL; + err = enetc_set_si_hw_addr(pf, 0, saddr->sa_data); + if (err) + return err; + eth_hw_addr_set(ndev, saddr->sa_data); - enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data); return 0; } +EXPORT_SYMBOL_GPL(enetc_pf_set_mac_addr); static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, int si) @@ -38,8 +56,8 @@ static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, } /* (2) bootloader supplied MAC address */ - if (is_zero_ether_addr(mac_addr)) - enetc_pf_get_primary_mac_addr(hw, si, mac_addr); + if (is_zero_ether_addr(mac_addr) && pf->ops->get_si_primary_mac) + pf->ops->get_si_primary_mac(hw, si, mac_addr); /* (3) choose a random one */ if (is_zero_ether_addr(mac_addr)) { @@ -48,7 +66,9 @@ static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, si, mac_addr); } - enetc_pf_set_primary_mac_addr(hw, si, mac_addr); + err = enetc_set_si_hw_addr(pf, si, mac_addr); + if (err) + return err; return 0; } @@ -70,11 +90,13 @@ int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf) return 0; } +EXPORT_SYMBOL_GPL(enetc_setup_mac_addresses); 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 = netdev_priv(ndev); + struct enetc_pf *pf = enetc_si_priv(si); SET_NETDEV_DEV(ndev, &si->pdev->dev); priv->ndev = ndev; @@ -107,7 +129,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; - 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 |= ENETC_F_QCI; ndev->features |= NETIF_F_HW_TC; ndev->hw_features |= NETIF_F_HW_TC; @@ -116,6 +139,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); static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np) { @@ -162,6 +186,9 @@ static int enetc_imdio_create(struct enetc_pf *pf) struct mii_bus *bus; int err; + if (!pf->ops->create_pcs) + return -EOPNOTSUPP; + bus = mdiobus_alloc_size(sizeof(*mdio_priv)); if (!bus) return -ENOMEM; @@ -184,7 +211,7 @@ static int enetc_imdio_create(struct enetc_pf *pf) goto free_mdio_bus; } - phylink_pcs = lynx_pcs_create_mdiodev(bus, 0); + phylink_pcs = pf->ops->create_pcs(pf, bus); if (IS_ERR(phylink_pcs)) { err = PTR_ERR(phylink_pcs); dev_err(dev, "cannot create lynx pcs (%d)\n", err); @@ -205,8 +232,8 @@ static int enetc_imdio_create(struct enetc_pf *pf) 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); if (pf->imdio) { mdiobus_unregister(pf->imdio); @@ -246,12 +273,14 @@ int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node) return 0; } +EXPORT_SYMBOL_GPL(enetc_mdiobus_create); void enetc_mdiobus_destroy(struct enetc_pf *pf) { enetc_mdio_remove(pf); enetc_imdio_remove(pf); } +EXPORT_SYMBOL_GPL(enetc_mdiobus_destroy); int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node, const struct phylink_mac_ops *ops) @@ -288,8 +317,13 @@ int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node, return 0; } +EXPORT_SYMBOL_GPL(enetc_phylink_create); 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"); From patchwork Thu Oct 24 06:53:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848418 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2064.outbound.protection.outlook.com [40.107.22.64]) (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 6CFF61B0F2A; Thu, 24 Oct 2024 07:09:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753766; cv=fail; b=DCmU9b6PEIfWSDerNMsXY+yQGndjuuyaKrj0/qA48Y/qo4pdlbeYXCeaXh/3J3Inm32QS/M5i/34LP5vb/+TOk2l/id2A/MTFErapPZ3V8n1QRdGlQ+p2auNgZsmGMsJ0XTomJ7Z8QZzG4JbbsjuOCjrs8WAJEcsG9cz0IlW/Rk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753766; c=relaxed/simple; bh=y/0sdgQbo0x3qjgBtUq1yDVfun3M5q+gXtLxJRAS584=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=mmSGzWnQyECx5TydgeeGfW2oMl1+uhuTFY7PdiKX7z0U6XlLgEWF3vasq3q31tt9UsOTopUhv+axFobbqvQeLYQ6pEnBwP9elj5p/3kajGafep1EW47a99snSOfzemOcnBeU0fYSAIOVlolgZeYb0gXE8Ln6U2wjDCzWvR4xQ/4= 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=Va1cqkU9; arc=fail smtp.client-ip=40.107.22.64 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="Va1cqkU9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i3ra0xwlTOIf8/oVRFNrbsSbwReyAqhFRgAfw24817vTEXm4QVpGWdxCCqXfTwiff7Rp8fI6iVqKQhRUf87HMdLsGyPn6zL5GYJpkEaI2Am7yEEzsalYqUato7/p8I3+iiTJwvhmp8pNCQsBxwBZpA68+C3sMwIyzFwvi72C5nzZWQS+Do69+CsK2C5i1oCWgcV2mWnRe0NcDO2A7YzyGBHqvd/vO3vAWGxprnZxCKFcvLh3RSDrrPbOjDO66r2sQviJV848WUxcaD4wrF6TbAxgwngBnuehBy2C53P56qh+9fBdIhaPcjNk+S7ITJbzZhLCm8jwBS17Cu9mSDEQkQ== 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=1E9e5YnqvNdgA+hdfo8BSFOUjWSVVhRH0rAwzu9wJvc=; b=cDliL5oUMJlpTkPQjIeftUwKNumi0nL1bvqOoajQKn0ixDuJeojLA8/rDOAOduqzGh1sqRkstuGrCK3WAfAUUSufgoHCITXu6hUY/vLHfl/HT/Bk8gz/k14F5ZR59m7NGODxibX7kMU1U/QEav2Dkziqb+6wiBqOmUsmiFrlCVU30j1auGtYBX3kEV72O2Tvk3Dte41BETDWaDd9QV+MW1kIvviPxlTNUFY3X0LGXMtU1ojEA5cO1rujPqUCESndSOg4HVkbh3l1LLoDChq/BtfQ/vVlQb8sDZPgmo5R/mAoOb8E50hDaUI2dwGdp7LuRQba+O4KI18Hn3984l7AAw== 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=1E9e5YnqvNdgA+hdfo8BSFOUjWSVVhRH0rAwzu9wJvc=; b=Va1cqkU9avvnfP+bmH/ylE0Xqo+BNTmoEWZ5na4NIo6ertTopQCHiAcgaGmI8IovHJEydf2k2zSYAwuLsuglBjEApMkEKNFZSuq6E8CK7ZLIe1lxsURlDsSSjC1M/izu0jswJ5bEWmz+XjO8OpH8J+uKUdwGAerWoUARgxJvhSJ08zcdPP8rR5kdT+IA6Qq/KkvIWHiNTjfsxZoa+YFw2EzKuOwbBmkbtwQI43LiRPk+B+gr7sCXwdzh15jt6tbCQy+bZboEvOoCL74sBBPt4XHazol6Zgr8qUv0nOTlVfSkDW+5u8DdKnuMmMb+KxCdfCDEHR3alK+3dGYcZ/7FzQ== 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 AS8PR04MB8627.eurprd04.prod.outlook.com (2603:10a6:20b:42a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 07:09:21 +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.8069.027; Thu, 24 Oct 2024 07:09:21 +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, bhelgaas@google.com, 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 v5 net-next 07/13] net: enetc: remove ERR050089 workaround for i.MX95 Date: Thu, 24 Oct 2024 14:53:22 +0800 Message-Id: <20241024065328.521518-8-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8627:EE_ X-MS-Office365-Filtering-Correlation-Id: a6cb4ff8-6f35-4d83-549d-08dcf3fac893 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|1800799024|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: 3BEaTsLDar9/0bkBLy2jkXHBc1FZ/QZ+xdAr1awQVy2dYah2k99FuEyXdwQeKByw37vEmpKHl2s6liG8aqXIvkL7EyJLH+9upeyMJPeC9mAjS5rOeugcMrU0FW/T3n1Xl6QdzXiYJelcUFJCOuvJpDhrq5DBVw9FWiUY61eNuJw8xm1NjDr6XprmhndqAyC3Tu9gb5GzQv0gfhHbF7Q0l1N4USw/bCNpGFxxOo2FfTb398GNqLqa5j2nT2+6BFzukOb9iP7iQewXFuxhsQW5wOCUy769qRm3fL8VqQ4QVjBIhZOTSKLe5of9KCJnWjNK8Rqk1IxdVzR2PIhR0pOqjgnMOCu/ZgS8jyTVwkJv3BOP8cIPj+DfkkxZ1PJnnC19ALL4BNgk8ClYMqHs3MEa49tqXCKCxm5ACDQh/BPwlGSg5+ycJCIXG7KXW7a8U47x55Tv21VEAVh7ZgJfa387uWw0sIgwzS2jZ+v4yKbw/A8yvM8gjgqnl+A9vtRHM4uCD773j2kpYA4zd5PKO3zr+64ChBrb4yq0qTd9dAaWrrIB2xQmjxjOt2HccEejc8ZYF0dVE2MdsUkNs6PrF5qPGFK8oLygVYCsIfBX0ZFQJ4nrhYcQ8zEudrdo50YHkTnhNKrOQs931hThGqaMYN1iRQP0X35I5Li0CnCNz5IIH8RMMXfatJNWEesEWe2e14vYXtyqd9rnTuRfpZReXNm3QDCttSfkdndMLt4GA93Auea5Knz6wq0JC2Pt20f7J5f1zlADpzZjHxHGqQF7do1NU3n2AwyueiToGWDMtOYlHm97lcDWQ0+sX0E9Xn5ONGXcedSmxmMLdckBVjAtoR6apxQ1mC3ujLXV/qs5JAOYlfygwErXbNooYapQt4eOINmVE2/LRa61rnqVJzX4gKef2VkzGOOuIlL7IaUs1W+u96vA98QPqcxpPeXU+YehxC8Sun75BB4D+pCCp+qspoBAWRqr7yINPbk8oyYDRZ6TsBHNAz2XcHsjo3iJQVfi46mdidTTXJQ5B2x9NJka2R95W9fKKLdKOmIMcbv0x3R1Obv910txSSAHcwFgHkmiM5cYfILP2ov2c5JB8DYngELhmet9IHsL3DhqMfs4LApLwiqsjsDASeIgAk9CYyIWbs2mzunIWkVw2XrXFLYliSiJ7EZJ0dpyDKcY+6EY++oAQzvXWuCZM4pVlnwIuOZV0NhNYsaE4j2FSz8ZguBUp0m4YNi6K7nX5t8b7+1HcRD4OUWF86QMAwnD11FsYyVzTyS+7HBF8MPkt3HNPpLWrpSbqnVO9tcNBEwuJwtiScjGOCixhgmSXxq3ZwLfBhO8A2qkv2Y50bNk9viZRZzcMcOZiiuNUwKL1m/v4QeiiWmZpshyxG3BnDyaBNDAGdJzAjHT 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)(7416014)(366016)(52116014)(1800799024)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gm9xT5D6WZdKKo5sQmUZz5ScKiG7/t27OZrA0J2W0r8igXFWB3Oo6xgb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kg3c2LR74kYEKvyN5vQn5ciiFAS7VrqSFLnUfHzxwCiZGHaZ2/sxPcUEd5bC8LjbvK17wIICJlhOR78d283lqXKUd8i6bEQF7/eQub4O8EkUnkRc9qcMgxg1lNiVIYseQ+X9BbBzME6UZA7f+meUIJ7C+0BiWCK/3YFP120RUiX71UT0rAInC01to83cZHm2424F0Ngoeb1bkmmCFGEBUh3XJ6JT1BuycTad6I10wo/KTQdRYlcBeGhM+Sf2fx8PurIeCu4b59x2efdHI4/bPR4AXQuddRojjB9/NfdsX4i3DLqTXrQiFWq0fB0gax+G8kQjwHMrU5OdXfc5OwzcJR2JJ2SNAObsJCAODIZIz2NFVJTGtZVg4uWVJJvmgkgrjHkk7wTUz9CGmJyyaDGHfvgpXFBHfwdnH8ekN4me4X8tzoe9m3hRlpt1Mr03gM1Rv7VM7qrZ0376+gQADDjAWJOQsTdLF+f+vkm/f X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6cb4ff8-6f35-4d83-549d-08dcf3fac893 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:21.4404 (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: LLeZSj4HgnP10p5SKav1I/9m4WB3Wj3Yr3k0x4BAcOK/+nxXSIMgkVvf84jgavvCvaIwjBkrLqdIv6VXYTUGKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8627 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 Reviewed-by: Frank Li --- v5: no changes --- .../net/ethernet/freescale/enetc/enetc_hw.h | 34 +++++++++++++------ .../ethernet/freescale/enetc/enetc_pci_mdio.c | 17 ++++++++++ 2 files changed, 41 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; +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); } static inline void enetc_unlock_mdio(void) { - read_unlock(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + read_unlock(&enetc_mdio_lock); } /* 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); return ioread32(reg); } 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); iowrite32(val, reg); } @@ -452,9 +458,13 @@ static inline u32 _enetc_rd_mdio_reg_wa(void __iomem *reg) unsigned long flags; u32 val; - write_lock_irqsave(&enetc_mdio_lock, flags); - val = ioread32(reg); - write_unlock_irqrestore(&enetc_mdio_lock, flags); + if (static_branch_unlikely(&enetc_has_err050089)) { + write_lock_irqsave(&enetc_mdio_lock, flags); + val = ioread32(reg); + write_unlock_irqrestore(&enetc_mdio_lock, flags); + } else { + val = ioread32(reg); + } return val; } @@ -463,9 +473,13 @@ static inline void _enetc_wr_mdio_reg_wa(void __iomem *reg, u32 val) { unsigned long flags; - 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); + } } #ifdef ioread64 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c index a1b595bd7993..2445e35a764a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c @@ -9,6 +9,9 @@ #define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus" #define ENETC_MDIO_DRV_NAME ENETC_MDIO_DEV_NAME " driver" +DEFINE_STATIC_KEY_FALSE(enetc_has_err050089); +EXPORT_SYMBOL_GPL(enetc_has_err050089); + static int enetc_pci_mdio_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -62,6 +65,12 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, goto err_pci_mem_reg; } + if (pdev->vendor == PCI_VENDOR_ID_FREESCALE && + pdev->device == ENETC_MDIO_DEV_ID) { + static_branch_inc(&enetc_has_err050089); + dev_info(&pdev->dev, "Enabled ERR050089 workaround\n"); + } + err = of_mdiobus_register(bus, dev->of_node); if (err) goto err_mdiobus_reg; @@ -88,6 +97,14 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev) struct enetc_mdio_priv *mdio_priv; mdiobus_unregister(bus); + + if (pdev->vendor == PCI_VENDOR_ID_FREESCALE && + pdev->device == 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"); + } + mdio_priv = bus->priv; iounmap(mdio_priv->hw->port); pci_release_region(pdev, 0); From patchwork Thu Oct 24 06:53:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848419 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2059.outbound.protection.outlook.com [40.107.22.59]) (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 D6E701B21A4; Thu, 24 Oct 2024 07:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753773; cv=fail; b=fj3qUhuQpW2zqHgA5L5gekwUtdZWB0Fg9N1+Nfq1KN6swjMN2KfoL8Hd/8YeO5ZMfBsjr9vog0h0qMqee7hNNcvFpdqKKgKexwMBtr54jMwwWI2FGqrH4DVNo9XUa8kTKIu583WXsKTAJoroUzM533vJ2AU1D2Fqe+Nfmq96R2g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753773; c=relaxed/simple; bh=dfiezfPnwfj8kZhHarcT9H1rmttJHrwAW+JAdA0ijjM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HtMGPVVyX2as2WsYvt/VAp76wrNPYitUFzOsMWKDDcyo5EdGx/g38ip29F3nXT1jtoMJCIMAC1HW1AEeCcvDpf44uy63kyuA+63M+SPcDUPmKj6MCL9VvVpMUw+iZAMQxOacbazjFPHFdDODL0aS7ECYTFDzgE4uXv0p9tKw1RU= 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=fH+FEFCk; arc=fail smtp.client-ip=40.107.22.59 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="fH+FEFCk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nPK9GjXIjhZNvXQpvOgZlSE0ekpZ8taqMMB28xQjcgJWCMTt5+Z7Q/xGkOxfXKf9Mttr/hN4U/z/gMzgXjd3Oq35f6Z7CNJEfzjfuKlhl2e7qFxXuxA+YRaur2nGP60SCyJ+1ahBTD2SuUd0rxnEd3GUnV53iwvCX3OfSnHnWVxiV5g4I1X631ZsqOqkJEOJB4780OU7sJskAb31JZ70+5+VjM/q+lyBeM8ONf+3DvpLfvxasRzWy2vkT2wvOvPIm6xudh/nGboYbuvM2tIVgQmgeuL4xuxek8SLofsQKzacUGyMEbhi1ZeCJpsT0inmdck8OMEAQE/KC2vZbznAPA== 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=kWfM/tVQ77rN+9LWuO2m6Xtk/LNlxj2H3IU+Zbxpv7Q=; b=IFahPUem5988cW0BDkjRPHlKLz2RsSYWR3o/mpeKSvfwNyt87AFErEIMqm1AQTb7u8vJgmcf9osgk0sNg2mCFRAWSd/5Q1maIv9oND41flJ8yPqdaS93OmJ5bOmC7fX9eaFWKh56TPKbnx1rSwNInW3S2fwzka88RbO+BttdOgdS6VoccVS6yWt4IM62oZBxBPzIC17EpoYfqDKUHtlhCkL9QZvrH/SFCIa/miUJ+B0Nio+YqI/yXbiRxP4L7cK9xl2XqI+JAlnfr+Qit/tcUjUGEr7LqiMTATi218Gz4AInkKVbr29DRFJtUy6L6hW35BmoAwomXWN0n2fUtrcOiQ== 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=kWfM/tVQ77rN+9LWuO2m6Xtk/LNlxj2H3IU+Zbxpv7Q=; b=fH+FEFCk6yuFO0CkAOqMhg6p37+hKykcFDI/7eAgF08VkFHNXbq1lM0jZDtbKzB5f6wNcY7BN5I3ZThFS+95UPIx/3P5WF4BnozgxZxByBYcUto8Z3Fi3BFpT9yP6PrEjNudkNxDTdsXHrsHpPhzoeIzRbGZvg2WF+SSgZs9nFYrANY620yal43k6yVn6Ej9QrmopkqYdxE5MAwywKhibarsgSDg253Hmcg+FQKMgvYD0PrrA4Ezm4flRbuLPYZluuJ7ILgKWG54jCjlMrMyuy2d7OuiMyUzzvpP5KWMMg5Bg3QZ4MxW8AGeCwgUD4VZRFdtqtrD7dgN6vexpiAeqg== 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 AS8PR04MB8627.eurprd04.prod.outlook.com (2603:10a6:20b:42a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 07:09:28 +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.8069.027; Thu, 24 Oct 2024 07:09:28 +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, bhelgaas@google.com, 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 v5 net-next 08/13] PCI: Add NXP NETC vendor ID and device IDs Date: Thu, 24 Oct 2024 14:53:23 +0800 Message-Id: <20241024065328.521518-9-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8627:EE_ X-MS-Office365-Filtering-Correlation-Id: d52f4834-196f-4b3c-633b-08dcf3facc79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|1800799024|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: ePzczA/qE1/PEtK9Oh5H15PgNa59fZwd16+CfUTmH7nkIB44cCVaedYSR4cx08yJxXRl1tzWkSOumlS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dQddsVzUwNr11IrxWryGrjRYdTYQksTfAOuma9tSycr4tTbFPUGTixVzu20g9dunl1uCuM6poma7YfuYdMxS1d1cr9mNNesTTi7bJ3r8wFBuOEHDIslRPYJeptAtKqDPP5gCB3B5HtRSOCnVB/oc5zuftYcCdCWbjaI2IlmkkDk1XJ2QZC0ZwHzb391IYN5v4PT8FLLN7ByQ4nKE74FBn/HiZQMekOKC1QMRQwHRGYdm3/xsmLCZ+j9I4davnzWdRn 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)(7416014)(366016)(52116014)(1800799024)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AleHlVW4VpRC2nvMJot23aVOu3a8TsWIccTShELDYFeQYM3/wXUeJrog02uX/l8+mC7zra691IUEeF9dKwMy8IBhrJTe8JMen+qBLRmosOSPI+mOAvcASitgIYxB4+MxnPdshWokaP9ltpj+9ouOLIucsoOM6m1D80rjDdZZehyh41sCezfb4INX7NdGcEgy/NW01FtSrnP3w0OBbce+fiwXoOrPlluPZbF6VE0RiunL6feNchxiCQRYPtI3+P9p2mmfgE4/u5WhdW8HYiGTi/7kAdq3J9bUGSdmf5SgZsZJfDVB0FgZaGSUwQaAeVcTCXvB8QB5WXWq9HaZ7LzYoe7tbBwxTE018+UwNm8pRrv6gAtYaZ5ezZqrvO3fWaEOqkmAwBseUNXu5mciRRtoU8ekPWkd4tEhzzxcist/YRIy/Z5Jwrnb0r1X3hWQVib9hi+G1lEAAgX87cf64lBEagoSzKA8N1ErhKq/OLCE0utFqPWf5HQ79lLhciCq4/p+qFfjO7lu2hgPnZwqQ3TpiFhquqSAbB6bz+OhaDwECGWqJkVh1tqIlNLyp4UPv/Htw9jaIZuhsMokDPOx4q5S7H7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S-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:28.0720 (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: L3g3NXX2ibrfZlpbdRRR2Uwd+aZmE+xm+xS/0e60t+Qn0sigFDIjak9OfGG1V7HC/Ea/OjbtqrrkUlqXRP84CA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8627 NXP NETC is a multi-function RCiEP and it contains multiple functions, such as EMDIO, PTP Timer, ENETC PF and VF. Therefore, add these device IDs to pci_ids.h. Below are the device IDs and corresponding drivers. PCI_DEVICE_ID_NXP2_ENETC_PF: nxp-enetc4 PCI_DEVICE_ID_NXP2_NETC_EMDIO: fsl-enetc-mdio PCI_DEVICE_ID_NXP2_NETC_TIMER: ptp_netc PCI_DEVICE_ID_NXP2_ENETC_VF: fsl-enetc-vf Signed-off-by: Wei Fang Acked-by: Bjorn Helgaas --- v5: no changes --- include/linux/pci_ids.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 4cf6aaed5f35..acd7ae774913 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1556,6 +1556,13 @@ #define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 #define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730 +/* NXP has two vendor IDs, the other one is 0x1957 */ +#define PCI_VENDOR_ID_NXP2 PCI_VENDOR_ID_PHILIPS +#define PCI_DEVICE_ID_NXP2_ENETC_PF 0xe101 +#define PCI_DEVICE_ID_NXP2_NETC_EMDIO 0xee00 +#define PCI_DEVICE_ID_NXP2_NETC_TIMER 0xee02 +#define PCI_DEVICE_ID_NXP2_ENETC_VF 0xef00 + #define PCI_VENDOR_ID_EICON 0x1133 #define PCI_DEVICE_ID_EICON_DIVA20 0xe002 #define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004 From patchwork Thu Oct 24 06:53:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848420 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2058.outbound.protection.outlook.com [40.107.21.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 0CED119E98B; Thu, 24 Oct 2024 07:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753781; cv=fail; b=qlCDpVX7eM4O9pGk0FVqJ46uRTorXGg2AtT0eAZ0q5wILPvpbs37UAxHXg5q3zCyAlzSEY36aXB2fcG+kKQ8Q3InnNAF3SSmFxlAi9wV+QekrrZnnXnwVjPNJgeu4vI0BLtrYOrQBRvwJt7Vb5z0eAT86SHNZKPb33Y0yITQjzU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753781; c=relaxed/simple; bh=zoJm6GbcQksWJwaUTUUpbnjWR60wyAH7rrE4AizlkX0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=todffSAIRxMZP/bbn5V+RWHEH/T4+2B5Ozif4QqnIM5y4wID/qDxulfiK6ol1JoSM2srVcR0VJq55lAtEh1ImPesSdMjfckyGkTfsBzXfwhCqigOPizzYGrpkGC/WIILrs1nW8r0wIC3yrwY10qTz9yR4/PkXG5uQFthBtIluR0= 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=HCqwHH7g; arc=fail smtp.client-ip=40.107.21.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="HCqwHH7g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mHbsIQzFPjqxyA8LvnHkEYiXBYp/U+V5+fvEntpRfxFUzETFJIvaanUWmWv1M7QBNR1piI5X3QwHfwjLZQ6eNZLHJOEVJ7VDzxhgfiBYkOeMCTxKwcS6gQ5IJlHvfyrml1ts50L4VoiQtu45jvJtamR130e9JOmxPkv2A/kMROxCaZ17y0TuBq7ZOzI/O2pXgkmE2csNKnFIn5BEb8tNWtIuFZRe3U9S7ZAu+LMfhhp++c8P2itm+UwKCthFgaTjaM1qZHp82lGn9LwT+UqFTq7dqF+RwOm5ad4ec2QO5fkVxboitcupY64r470fzVxhbmmRcpdPfP6B8AUzZSjJPA== 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=mPorPa/35+1G24FCRqRFp2H9a0H8Z7hpIQ0BAms4tPo=; b=jYQAkva0ASrEmQny4DwkiCqwpLY3vjO8blZKVCGS/ehsdTvDOxl2v5q+9On+RYVIrmpF1gzLBHHQs5RyeqJ19pTdJtgA2ZrLFB1INYFmFAx78NvggRVcr/Ha0lN50Q4eESzReMV0w6iU4UyfiTe1but+AjTNDH68UGq77+6/fCMsMs1ELnJncQ/mU0v2BXV49IHfyb6t6Bx85WdihDvNcvCZUvDCXSc7Hx58Bb9OszB9MTO19FLpB1wWZXTIW8CJ6kI/p7PUkBxFAhJzfKpc6gNdXFoz1QmROxcXjaql2gtIw1scdJJR3CZ5PnPZeInvTzaJ8Dt17UcNYXQ+GtOoLQ== 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=mPorPa/35+1G24FCRqRFp2H9a0H8Z7hpIQ0BAms4tPo=; b=HCqwHH7gRjNhJOA9rC2qU+CRP+C9G7MxBg7rjvb/IrDc5rhO6Yv02ViYXctLmKLHR73oNVeKt7bIHXmDEDs/IOpzcYq+HXjXtDoee4ynwIfI0/aoULIiSxSLVxmuPGRmVmVI5lZbFbsIJvxhX6sNf5etp9rM2yda7X18uD9L202Z3I97eVMIJycZxpelSuLELMZZY1jhiupm/1FFvLv0yWRZbIvZJZrRq7jOZ36EpdKhuMtIheCXt009ZvefCFRLcEHlwauXHzSA6/hn0TgUoSt1uh37YlovfKbq2jySsUNlvS1up0Fq5FoqdluHDCQpHgVSZwwKrMYkYsu5f8WdqQ== 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 AS8PR04MB8627.eurprd04.prod.outlook.com (2603:10a6:20b:42a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 07:09:35 +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.8069.027; Thu, 24 Oct 2024 07:09:35 +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, bhelgaas@google.com, 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 v5 net-next 09/13] net: enetc: add i.MX95 EMDIO support Date: Thu, 24 Oct 2024 14:53:24 +0800 Message-Id: <20241024065328.521518-10-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8627:EE_ X-MS-Office365-Filtering-Correlation-Id: 811a2245-b1ea-47ed-a6e4-08dcf3fad05f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|1800799024|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: j5ZvBQQ6rDTWoaY8swnygT0YdcJvAyv/IP8dNa8w5kxkRP66U3LUSKtsMk/2DTBj6KBRS3xQ/rY/n9ETYTfTJ3tkgqOHlUKmqL5fqcNPXe+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qFM7czB+pLqQESVfFIF+9Ra9EvCwqrdVjC7v/4nOBAsIqx6fKlZyWcqzVKabS23Kos+Qh/Wbl2yt7HK1Jb77ZmvcxzMm9LI1qh+HSwblft4nAx1gNdxgFGt0LOuz2id+YOmJKPMmpKWxpRh3gLQoU4PD+a/1GonETyXdesUK4JGzfHRlxMifFjkXc45JNboWZ9U4itQNvq5aK/W1g9fy3Q/QUbE73B 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)(7416014)(366016)(52116014)(1800799024)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: paXf2pIeC+1+k95Ok3W092KrGPX9dzxsex1z2YrNh7LA6G21GBrVxiA0eZrV/MeeEDOFpsCy2B4X6e+HCVZN4QNK8cof6Db9BBQ/TaQHsrf7ncr/9NohEBnU50VjY+ouh0UhtAw3KlJ1FMOLgxXhBcqhWkyZCp/q1DTIWKAIAOV9+UeKEcl4nYmBq3z7OeRiKf2WCTA+eoCFSSZH+2UOYnnI8+CPZpLn4AbJuoUu/QwvLUXGrAPlhWYYZYCcMUFAG9t9rgjCa5gRyOSF4YvT6cCQWX7kQ42FB6fAHzftfe9e7JTUMzvaAH+dJEe7xk1nUSiyDR5fsbHRRQRIHWA3cl6pDXAt+xTlfyDdtkOu3czRQgb4rjTrpYLSRD9t8MYHLbA+aC2+wjIGCyorL6xVXHUUaclSwDd+hXYbrX/rbQD2CEP+3G+NjoUaR5RUyGvCFmrzUzDFlFpSyS9Iu0iImb/RDuq7hEFq2Uv+lw65YpeNElAxiUmR4g7ew7wg2aPQlO8lgcCD84QU+TS5DoOS90V+ZWQYws4ayvKnki4CBeecCpCOBLrb6Z/QDCvmc5FTRnVdq0NDUNXD8Edo1bz7A6mtXRQ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cf3fad05f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:34.9953 (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: DODan/5zQ+aCxOtb/rICZ2puRM/iiADMhmTrrsEmpKAN7iRI+O6lThAQV6476KxN9K/RDQW2r6dAHA00DBNc2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8627 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. And the i.MX95 EMDIO has two pins that need to be controlled, namely MDC and MDIO. Signed-off-by: Wei Fang Reviewed-by: Frank Li --- v5: no changes --- drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c index 2445e35a764a..9968a1e9b5ef 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c @@ -2,6 +2,7 @@ /* Copyright 2019 NXP */ #include #include +#include #include "enetc_pf.h" #define ENETC_MDIO_DEV_ID 0xee01 @@ -71,6 +72,8 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "Enabled ERR050089 workaround\n"); } + pinctrl_pm_select_default_state(dev); + err = of_mdiobus_register(bus, dev->of_node); if (err) goto err_mdiobus_reg; @@ -113,6 +116,7 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev) static const struct pci_device_id enetc_pci_mdio_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_MDIO_DEV_ID) }, + { PCI_DEVICE(PCI_VENDOR_ID_NXP2, PCI_DEVICE_ID_NXP2_NETC_EMDIO) }, { 0, } /* End of table. */ }; MODULE_DEVICE_TABLE(pci, enetc_pci_mdio_id_table); From patchwork Thu Oct 24 06:53:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848421 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2079.outbound.protection.outlook.com [40.107.21.79]) (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 6792F1AF0DD; Thu, 24 Oct 2024 07:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753788; cv=fail; b=RDQebvxTtcUSjeF4ng2bFLZHteKcSEC2r9KYUDzOuDYLiZ2hdgVIjn7vDEYe3/9UaO2aOckABKNtzUIpu97sNGwYe48gtKXT3eltvaebmUEXXzyZnjvXGoSJ8RsWAQhlM5lA/Br11QMNq1dmTTnBCdYgehUWOTqPsT38qXucJ8Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753788; c=relaxed/simple; bh=431VT20+X17/zmdPhcZ6WHGqJ/lklitOzX41+aUF3Tg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=FlzBux0YkzW//87uPE3gTdqePSt8av48I5TkfmtR5CB8i/oLm4UwhnXNktaUv60XzZHnR82WBd1/u052XMNPB37AyHA+tUwKQlelP9t/r8iV0ospZUNwHkaKnjM68b0exBUx4GAb4Wgt/3zw1dEtWvZyfnbwcTwO9sfH+9UVBqc= 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=YtZ/Tlvc; arc=fail smtp.client-ip=40.107.21.79 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="YtZ/Tlvc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gcyJKgjKZQt0/jKQ2sGoeZqleXDgtBJXlruI3sklETDLtCBlOAahhnktHhDuezgP39yyqRaJnL02SUo6jhKLZm3g51lX9dfhQPS1CWvvIw4UXGkEvI32nK1jVOsVPkcC3H9zGnciAZmSqClay99tN49+Td+s6/1CkDNJC5J+FefntMMqlCDvL+P0U7kXbZ3z8QHxRftVc9c9XqLuhNOXo8UEGaLgcWno5taKUhID8SwWRIzJOlW7E8AcSjZ0HaJ2GLl4mtwgPF7lI6cNEInmGO1h4sqXIgTqPnKw0AK2dwpXMguAxvG2K3aeVr1zgMVupHKLBEo6oRRH6TdsepUZJg== 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=0DdV5S42GfQOzPvrP2P3a4IPZxI3/IMya1aiLmSIYg8=; b=rPvjaqujNge5+s0i49p3HC7PcxdyecPc/jYwwqHnYvCZoYs0c5OLk4cAgqECO0ASRLB0DBe5SrkfilJ9Kv//lFQo1MmbTsIi/X8aYvtpLiammIOasJE9Ah9cWHuh9r5d5MkhaCtm+JY7fbhn2QPvK9zX8KD0zpwxzZFX7Tk9sPwpaMVq8j2E+nWR3P42dvsA9ETT2XZL2qtlfC8lCMAiHlISuTBqY7mE3ds3lTEkCg6/w2LcL9nB6DJh9tO4+7tb0ADkLhGFbI/1DYwEXGn8fO7gKLq9bhA0+6AyBxigoVWGafRTQ72fKCRmJXsNGkrxSQz78rwNp/rkTRaAYeCW8Q== 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=0DdV5S42GfQOzPvrP2P3a4IPZxI3/IMya1aiLmSIYg8=; b=YtZ/TlvcI6SmTROlHRLLChifB6cVl8adHoPDZAhdOLfyLDpp3FUa6cfHfNbkqaKIZfh5qxQ40kO4BLI8mZOGDsjWRA38mX6R2jcZw5FYzAg8qEywgfjI2r0cdqRDML6z18FiRfqdKDeLCyVcyKJCaEdsc9SsHrBNQaL2F4JBG9EFJE60XBuHKE8EM0OnkMQccPwsaEIHBgYObn7vjTVKwhZQw8zrTZXNtoanstwZI6Qp6k5R3l25Ou4kS7/JQDNOUSSc/AZjQ6U570yYU12pUgo1GMWgm3SaKPXKGLAsmBqFqLgOTWaUZB5csAiuHK7ZoLMozMdEkRnZYvAfRQeiVw== 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 AS8PR04MB8627.eurprd04.prod.outlook.com (2603:10a6:20b:42a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 07:09:42 +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.8069.027; Thu, 24 Oct 2024 07:09:42 +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, bhelgaas@google.com, 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 v5 net-next 10/13] net: enetc: extract enetc_int_vector_init/destroy() from enetc_alloc_msix() Date: Thu, 24 Oct 2024 14:53:25 +0800 Message-Id: <20241024065328.521518-11-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8627:EE_ X-MS-Office365-Filtering-Correlation-Id: b07793c0-553f-4ebe-774f-08dcf3fad4a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|1800799024|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: NS2lb7ERP2g8T3w6yd4AkjQBywR9NfKxJ2CVf3OtOWwJ6Z19SrvrOh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/lVIXRbHYPIMXXHxrg+j3/X68T/lLjY4vIM7WUYSMmdUKcMjsQlWxKaUL1a6yNNqvby/Cx+Zucw8aOb+WG/us2zP+pg+SmQ9HcpcayQkj+ASnhhDKHiOFznS+k2s8ktCmWPYB3yVFe2U4dfS+np+kYGVA0RmVzzXThs/1gOz5DmiUOkDJCTfKX5Hts02wdDAkzt2WbFm6puyQRGk8i3xxZwcbT/azqUhOxYBB0gulLUIBEaOtPGobvv2oXZqjq6RkphZARXpD8VjAGxZd8acx3wvuVug+tPMAh3x 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)(7416014)(366016)(52116014)(1800799024)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5F9ciE7Ob8sYT14HyYeGqGeGjcrwb1t3R6lHEB7rar0SXxIqjA8t/+wPlErHWXkOHc2g+6WSNM2t6CqySaHaLMHQ73Exqgy9b2lMr1nZPkqz/qcFkdhVcFdLOMryLq7PgaSMQQG20NoqEeYsXCJN6a+c0KqGC0W4/O/j7L+GyUZquVEgfnBMmFetut/rh4l4SFgmEgMFsuc90glWUc2vDO3gZzJnYi+64VNFREYHWg/5tcO4Q2AQ4JB+cvqMeL04J6MdY5hElyWH4+QwF4qs9rXc5pwCroAX/xD61sls7tsuZ09Pie85nQwP9/FO1MNDoCsC29KzdvuuNqzZPcfNsYD588JI5Vt3OsaVGc03E9toV5YJY/UmtLFlYFHz2uVQvCb8oZ9AT58+kxTTby3hagCKA6R5aGM4VrR35T4s8r75R1d1CXUe/pWKbmGr9KWFROCMqMvDiROstZnJAdRPXRz/cb8yFJIrqGI0vZVPk0Zh635jKw4SP2J0RizeuJA9BEfhH4WV2qdjorN3ZrE7A5GyfGww2ko4hqOtXDvEw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enant-Network-Message-Id: b07793c0-553f-4ebe-774f-08dcf3fad4a7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:42.3155 (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: v26q2McaZTVKuJRLEjPfyJZDF6RQbudY53JhGPVHtei/poQgR2aanzErIl1/Plqxh10ZItlNmyhqcpZGzoxmcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8627 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. In addition, slightly different from before, the cleanup helper function is used to manage dynamically allocated memory resources. Signed-off-by: Clark Wang Signed-off-by: Wei Fang Reviewed-by: Frank Li Reviewed-by: Claudiu Manoil --- v5: no changes --- drivers/net/ethernet/freescale/enetc/enetc.c | 172 ++++++++++--------- 1 file changed, 87 insertions(+), 85 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 032d8eadd003..bd725561b8a2 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2965,6 +2965,87 @@ int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) } EXPORT_SYMBOL_GPL(enetc_ioctl); +static int enetc_int_vector_init(struct enetc_ndev_priv *priv, int i, + int v_tx_rings) +{ + struct enetc_int_vector *v __free(kfree); + struct enetc_bdr *bdr; + int j, err; + + v = kzalloc(struct_size(v, tx_ring, v_tx_rings), GFP_KERNEL); + if (!v) + return -ENOMEM; + + bdr = &v->rx_ring; + bdr->index = i; + bdr->ndev = priv->ndev; + bdr->dev = priv->dev; + bdr->bd_count = priv->rx_bd_count; + bdr->buffer_offset = ENETC_RXB_PAD; + priv->rx_ring[i] = bdr; + + err = xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0); + if (err) + return err; + + err = xdp_rxq_info_reg_mem_model(&bdr->xdp.rxq, + MEM_TYPE_PAGE_SHARED, NULL); + if (err) { + xdp_rxq_info_unreg(&bdr->xdp.rxq); + return err; + } + + /* init defaults for adaptive IC */ + if (priv->ic_mode & ENETC_IC_RX_ADAPTIVE) { + v->rx_ictt = 0x1; + v->rx_dim_en = true; + } + + INIT_WORK(&v->rx_dim.work, enetc_rx_dim_work); + netif_napi_add(priv->ndev, &v->napi, enetc_poll); + v->count_tx_rings = v_tx_rings; + + for (j = 0; j < v_tx_rings; j++) { + int idx; + + /* default tx ring mapping policy */ + idx = priv->bdr_int_num * j + i; + __set_bit(idx, &v->tx_rings_map); + bdr = &v->tx_ring[j]; + bdr->index = idx; + bdr->ndev = priv->ndev; + bdr->dev = priv->dev; + bdr->bd_count = priv->tx_bd_count; + priv->tx_ring[idx] = bdr; + } + + priv->int_vector[i] = no_free_ptr(v); + + return 0; +} + +static void enetc_int_vector_destroy(struct enetc_ndev_priv *priv, int i) +{ + struct enetc_int_vector *v = priv->int_vector[i]; + struct enetc_bdr *rx_ring = &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); + + priv->rx_ring[i] = NULL; + + for (j = 0; j < v->count_tx_rings; j++) { + tx_ring_index = priv->bdr_int_num * j + i; + priv->tx_ring[tx_ring_index] = NULL; + } + + kfree(v); + priv->int_vector[i] = NULL; +} + int enetc_alloc_msix(struct enetc_ndev_priv *priv) { struct pci_dev *pdev = priv->si->pdev; @@ -2987,62 +3068,9 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) v_tx_rings = priv->num_tx_rings / priv->bdr_int_num; for (i = 0; i < priv->bdr_int_num; i++) { - struct enetc_int_vector *v; - struct enetc_bdr *bdr; - int j; - - v = kzalloc(struct_size(v, tx_ring, v_tx_rings), GFP_KERNEL); - if (!v) { - err = -ENOMEM; - goto fail; - } - - priv->int_vector[i] = v; - - bdr = &v->rx_ring; - bdr->index = i; - bdr->ndev = priv->ndev; - bdr->dev = priv->dev; - bdr->bd_count = priv->rx_bd_count; - bdr->buffer_offset = ENETC_RXB_PAD; - priv->rx_ring[i] = bdr; - - err = xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0); - if (err) { - kfree(v); - goto fail; - } - - err = 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 = 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 = 0x1; - v->rx_dim_en = true; - } - INIT_WORK(&v->rx_dim.work, enetc_rx_dim_work); - netif_napi_add(priv->ndev, &v->napi, enetc_poll); - v->count_tx_rings = v_tx_rings; - - for (j = 0; j < v_tx_rings; j++) { - int idx; - - /* default tx ring mapping policy */ - idx = priv->bdr_int_num * j + i; - __set_bit(idx, &v->tx_rings_map); - bdr = &v->tx_ring[j]; - bdr->index = idx; - bdr->ndev = priv->ndev; - bdr->dev = priv->dev; - bdr->bd_count = priv->tx_bd_count; - priv->tx_ring[idx] = bdr; - } } num_stack_tx_queues = enetc_num_stack_tx_queues(priv); @@ -3062,16 +3090,8 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) return 0; fail: - while (i--) { - struct enetc_int_vector *v = priv->int_vector[i]; - struct enetc_bdr *rx_ring = &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); pci_free_irq_vectors(pdev); @@ -3083,26 +3103,8 @@ void enetc_free_msix(struct enetc_ndev_priv *priv) { int i; - for (i = 0; i < priv->bdr_int_num; i++) { - struct enetc_int_vector *v = priv->int_vector[i]; - struct enetc_bdr *rx_ring = &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 = 0; i < priv->num_rx_rings; i++) - priv->rx_ring[i] = NULL; - - for (i = 0; i < priv->num_tx_rings; i++) - priv->tx_ring[i] = NULL; - - for (i = 0; i < priv->bdr_int_num; i++) { - kfree(priv->int_vector[i]); - priv->int_vector[i] = NULL; - } + for (i = 0; i < priv->bdr_int_num; i++) + enetc_int_vector_destroy(priv, i); /* disable all MSIX for this device */ pci_free_irq_vectors(priv->si->pdev); From patchwork Thu Oct 24 06:53:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848422 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) (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 E34571A725F; Thu, 24 Oct 2024 07:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753794; cv=fail; b=Lom5C3J9Uqgqss+jzRGyOiINNezL48vSJXHJxUnHyNb+zp44HY0DQkAFF34IWrWLJnoU7v1GsTvdLBG10uleF/4TSkJbP/QgmNbJ2NLSQbTvct+rGZkhkxCR1OFqmocX90dPiHtKamVJeDUkFtXVvhhTdO6yB+YFHBThrE9MrnM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753794; c=relaxed/simple; bh=aXV5z6KSHKTfg+dTWQF+CUh6kvUVILy602ZJ85vUsfs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=DmWNXAed0ILI8Jr1xstHrhsoRNo7ya0FnflVfeDB3Y8OksvoHw37Dwcjgwl2ZqX9TC5Hyytir5g0gRiqCy7UUTvdg/y3zCyFxKbvMGlNiWcoxGgo4latyMoPM/styq/cPMtp5tyYkkQMgo3K1hj8mnpDuSM2WnmvsQMNiQ8Hgng= 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=VSzR5312; arc=fail smtp.client-ip=40.107.22.45 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="VSzR5312" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BfSqqhj3m6GQMCaJcIPQmQ3F3Tx3NqUaUHb6kDzYZozlG6PZUv0CEiMRpX/mq2P0ied+D56mLF5YzLUSEgB82IBPPKIcB5EY1+spl4c6QyoQEfxNwldqK06NDE12k4yMAd882d7cB7NwzV/8/FRj3yGcH6R9Gbr1lSv0D9eMtTH5mikDxtjJ6cfxA0Egrv0F2NEnFCXOmgnfngNYhCA46SYfmwl93QRV2KBllXS89A3gu8D/lVUMi6CQoUwgrrY4mOZ4cj/JDaZFJpF7rI9wv9nVO3BMIVtmcMcWsOWmYZyf2eRjOMDvQJfmu3IkmdR6sE+fLDvp7qognPPgMy+P8A== 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=M2CXxVsS2zWpvHDKaFjiJLClkM0z4iHhBVRbyo+drvY=; b=H0wrp8OfCCmhISRkNJB2ZpGiTwdaei9VDM0HOCLlVezYG6IE7dBQzi4dxOJMDat86+IGHxtUXlehmsAtG9c570U1fuHhE6WTUjgqxx/JgPf0RWwnQsRRTi3EjtktsVGVB1i4A6Ltz4QF3yHYvqyL7pG1IF9LBIeYDj65FIvgFez3U19/84rIBvdwF5oZOrJJN6bKGnIt+D/w+5QEnEDLz1MUNC6g+S8l6L7FhYA84+gG27SEnr5POESbAm+7Iv3TUKYN4u82Q24X19KKa9rYQm2oCtEAImBFiHm0QzE4IOvRBRjz1RtTO6BSEdDI0RCBcG4beqJT5r0yCqFMW/v9iA== 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=M2CXxVsS2zWpvHDKaFjiJLClkM0z4iHhBVRbyo+drvY=; b=VSzR5312PZfG1Iqsm9Js8pPTY7hESdH8SoYRt/i/UbMlAtR1tg+5+ki3K8yQmcLkpHqB+KsJP9HPgZ2CgABgHu8EZ9WbBPdAoJouZZ6Jr5lv0Rfvc/8M57JAx5TXfzTc/H6uD52vQ7A6MaCvgNjYzBKv2OzOswBqRGsPBQ4xWnLmdGCZoA9qOtdMaY1mNvg3L+w65IQqniJXzBiMVWdZqfIwDUiaYrg4ykoHIrTnlbyc9i/rIM70/5GoxNjOnsWNC67K1zsilanCeM4g63161QtiOQk3EbTpD2Onm9amSUCTeefda3eV0EPlO1LUTZTIbC1kDg3Nk7vqa/XHY+UOwA== 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 AS8PR04MB8627.eurprd04.prod.outlook.com (2603:10a6:20b:42a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 07:09:49 +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.8069.027; Thu, 24 Oct 2024 07:09:49 +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, bhelgaas@google.com, 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 v5 net-next 11/13] net: enetc: optimize the allocation of tx_bdr Date: Thu, 24 Oct 2024 14:53:26 +0800 Message-Id: <20241024065328.521518-12-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8627:EE_ X-MS-Office365-Filtering-Correlation-Id: e52f1248-33cd-4d6d-bbd6-08dcf3fad8bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|1800799024|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: epXpoz4CTojD03bwJ7/T7jbj1mrLU/hG2BDvce3WLvlJep+a5FiV0tVgA0Gg/aARoTOucaAA1LvS9+iSF1Ifz1lY6gtC9kXd+/szXQ6Blcw+EzXrqOvQwvg2Kxb944QAEmNXGZEA0JSeXo+UfrFeS6ZSB+gePy033Q0E5zFI4A+tVSaOp3//Nzn8UC9r0+RkWqm6ipOACsgmoJ3GTHpLoeB0nnwIztRCkPcdXAKOxJqBkEfyQyJzmEr0h6zZMLAjIfGAOH6kod2VdM86qdb37s1lD7NiNV8J3KgIlXJk3yBeMErOVPBUNVmqeV6p+TUg3T/PbSiW5P59TyCzQXDfu/RyfCTBlaZfmuR570+bqFL6lGZLsWQFVPxPePzcC9OkTHi/tkgi/Ckpt9vxNZn8UwVoRP+dFo6najJEOTd/CBY+bI4Fuj00doQDas0OWhlspPbDzEsAvDiyl7asQAOHJNgEmmga7tiLdZaFHQh7nodMDzaOTJGOU6CA+wca4VqaIO/rj1i7D37tLf9WOqq9/HPjkeAItlzAfuLDG5JpMJQ5SZu3dJPHAUougYal0HgCDbUpK/Chwe/8bpJOivxjTMCrxxZKJa7twDjEfiDwfwI3N2pjMu+g6PEngPpQ/HVxDJm2S2veTt0GW8/lA4V8KVVOIcAoEmuT4MXZ0oYvbTmRaC5pslj+9/Q8R+L1D9IkriRsYP9lWOV3PRr3bcBtWb2qQS6DBe9SfgMmOf0QoYWhV17rweFK+0AkGgaoHjBMCjWXKLArPkeeENfQ+IZVwySn7RtryWJp4ltEZEOHlK7La3XXfi0vnHmDpSVZih+4Oo+jrcx0zeetmPCB5ZM+aEOgDJhCSKduTrq1NvDVtR0hmzQOo/dNhLurjIgMFFhgMpZy/N/pMG2fa0atnv9rs0uJvyMbzWdZquhzBnhEV6GkM4z2JwSgyQgKU5s336GHkWJSPErp0VxfCFhRqYIPr9AYMlPFmwBzKsiqBo8TpayEw5miGmQLr+1fqbP02KmrZow2skhQW8hkJ4tdPOd64vjykdP/xuHS9QGhPB7LQWl0QKQxoIsR10JqQOVIKlB/3jtIObGmangNeZamkps26Naf8TltbhhOWVpi4cJ5mgVltg9gMButUY43nyMhGEubdSCthc+iWFkoe1P0YOZFCbKlud9cTvH9oFIO/tBNuJTZ7/wj8BTLwVfF39n0Z89NZ3+jPjKr81UP0NWxKaILFaO/vFfcMYp8wIHsCod5foOOXT0FaCkd+FaxZ7g8VhbtOoSfmYybEjhsF1sfaroMNdxt6rR30inBd3GhDiCrDTvnwmkAjkr+rbCLOHVKHX5GbBOUWCGOF7g6tNbDpqVFlOLiHMv9dvP1vUc/4/RXP8JVvwfN5ra+l44+AqVZCv7E 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)(7416014)(366016)(52116014)(1800799024)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ODWjTCG0xxSTEhKGzIvQEuW1BmTj6Ix1H68am3KtEpqWrc8v+3wkh1SbgSnRV2+K3EVDcCz4Pff2PA01P1n6c2NsjDP6NW/M5kxcxzciKyKa1SO1gPJJNg1RBUsR+ZsSU6adCdwpgYVzphKsPoQC4gXiLGzeRbzJJ8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rI1hYdCwlltpC0IBNA8GdshdgjwlErPoqJpAEWjUXtPWwaur3EZjkMIPnPLO+4KNCVtx3yKNcTxP/uinac6kvOR0CGLCfG8zHEUZC2wMkKAm4FMXz/8mquo98SC0nWA24LZPIOihXNPmjv9v1bvmQykPlQw6FiQqh5UnHwCDTXBigUlnVEq4LCFIku9ZyEK+QPvG+DwWm4W9De4EHvKLqt1jEg7RHC9QEc7AwJ2q/Om/SaiwrTRBpwiELeNB3UwRAM+sMbc5MyT48USiMM8REkN9n0FOcKiKK0bS7RKxsUfWbFR0E1JgQR6SCDVzdbAG+SfW84v9PyydYFpcs1+oekI5pkiihBq2GWQn/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e52f1248-33cd-4d6d-bbd6-08dcf3fad8bf X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:49.1884 (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: BOUVz46ttoq8k26lzmfWVbw+wSeH3Okhcdc+bpbP6FCygi79G4CTchZJ3jgxhCqsLjggJ13xeYctPDL19l5pPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8627 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 --- v5: no changes --- drivers/net/ethernet/freescale/enetc/enetc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index bd725561b8a2..bccbeb1f355c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -3049,10 +3049,10 @@ static void enetc_int_vector_destroy(struct enetc_ndev_priv *priv, int i) int enetc_alloc_msix(struct enetc_ndev_priv *priv) { struct pci_dev *pdev = 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; nvec = ENETC_BDR_INT_BASE_IDX + priv->bdr_int_num; /* allocate MSIX for both messaging and Rx/Tx interrupts */ @@ -3066,9 +3066,12 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) /* # of tx rings per int vector */ v_tx_rings = priv->num_tx_rings / priv->bdr_int_num; + v_remainder = priv->num_tx_rings % priv->bdr_int_num; for (i = 0; i < priv->bdr_int_num; i++) { - err = enetc_int_vector_init(priv, i, v_tx_rings); + int num_tx_rings = i < v_remainder ? v_tx_rings + 1 : v_tx_rings; + + err = enetc_int_vector_init(priv, i, num_tx_rings); if (err) goto fail; } From patchwork Thu Oct 24 06:53:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848423 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2044.outbound.protection.outlook.com [40.107.21.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 6FE8B18A6DE; Thu, 24 Oct 2024 07:10:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753806; cv=fail; b=cuJIfQTCTcoh+gLkAzL5K5LGiW6UAQzhhFDbGv+vDc3rE0gV3WEWr2dzlXuv156VI4NSWXg2Fk4M5y/lM4jZ5aTn0N+mGjibwIc3JN2FBwM5Ydx4I9WrQ5BuoBXs6g4F9i9dYf0Fd295oQG5B09OyoD39PFO7Y50lXxiyj5QU+g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753806; c=relaxed/simple; bh=1l4K+fo5Zlc0heRFgdJ1spbFTNdwAW1UK9Qt7aO8psA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jViI+zdpy2no7bGG5I4VKGw6EqjJFQliCJlPaI6h8E/H6D3a+DBt4UTCBcbYBjycCVpIFlSCZO6IxSQs0yVQlEJhvoxu7NVOA2k+t5qTIZzDUZu73QTy5S6mGWx5d6LUhJ0sR6AK7jscmD9d81z0Mc7OJXwN1rx/O9VTu3tSrwo= 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=KKSg/swe; arc=fail smtp.client-ip=40.107.21.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="KKSg/swe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dQf0ccosXTYH/BcAjWYTMF6CAHFRDjnRWDQtq+LXFi7QjLOyAlf3o7FLP4yPZ31KG9Ir3lIXtS6TnqwtgoTgi8zUyKlK63VlILwcjCdbY6CM1zlqBkGDl53sDa6K55OapILX0D2/UNjO+FUacR7wQWejMUuQ8PVcqt/BW4B05s3ZNiT9is2VN7CNab3V8WCOYon4n3aDAuVB0vz6xMKklgyOrfJzXVQO8U3FmkiqgLsiC3pAljRCSebdk8qLzPdIFnKtDbT8DGQdhmAlQiQwDDn8Dou3W6R59DzquzV8RAIqi+A0jCZ7WRDU1m03NCdo9YOwxsBRxrjUQQgftITpOA== 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=HcgQOtK9R1c05Y2dn56/6ONbHmb6A1Q8WHiIurovHdA=; b=dtw49kPbyjTmcSARaevbiKJIuGlrvNKaCJHB1o4ypghLWaoZ0wlljljI/zAvOdo0cvFvSBwKNarXHgctmro8hIwj8+rZOLW2nLzYtAF0oBRDi5kqH80W1VTRYfC4QPU9yGM6pZur+bz1wDzHqiiyk9EhBKxHORracmt+YWX1OnARK3iozc7vv2IcWReFGv+Pzed8s9Y3WAGdyDhFQyqNmseOIZIQ3X91guOqO+G2gtD0icMS29txMP6NItwyVo0Rf4mOSyAiNAharMUl8ivz7yLfduLXB/gddfnPZBCsrHuTT1X0fsjW6ZJYCcezzHd3T0zE/GE1lzwynv0S46ZpPg== 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=HcgQOtK9R1c05Y2dn56/6ONbHmb6A1Q8WHiIurovHdA=; b=KKSg/swelFpHjzifz0nL8V+zQtHFK5tYRxngSwBVxrvLIAuDvs/E5hOH1rErkaqRYBmx1bRBSXpSFZZlcOvmZp7Pbsflrkf/KoBQYBnTpGAXSIOk2mU6QC9ImO5Cw4/GMVgoVt5rlFtOxCcRqvp1xz2n9QWXS+tRQqnrZobWjdbcSNc6tZkn0scGS9VjaPNdzg80KeNDzE6jKRokcTGOm/a9Vb0TMZiwGZ2QnQm4jW4HXoI8E8SZYtu4vlD9sfzQJrNZjmzptQVFmYU+4lP3k+naJl8pNZYeK18jt9tx48bhwAmdlIsebXiHm5UeHeHU7n7E4BX74fUNV4NWsyTpig== 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 AS8PR04MB8627.eurprd04.prod.outlook.com (2603:10a6:20b:42a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 07:09:56 +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.8069.027; Thu, 24 Oct 2024 07:09:56 +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, bhelgaas@google.com, 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 v5 net-next 12/13] net: enetc: add preliminary support for i.MX95 ENETC PF Date: Thu, 24 Oct 2024 14:53:27 +0800 Message-Id: <20241024065328.521518-13-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8627:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ef45c2e-11c0-4c48-b02e-08dcf3fadd2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|1800799024|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: XpIK/JPtuWG6KA1md1sxSFHL071DXcyX7SaCzbAYg0fdjMeY8urVSHPEyw3I6v81H4wBoS/Hz9sOirp0+yBHta+kR9mcu1niVM92ezRwVTXnsWlnhDmvUgmSG3Z9nM4NLf15Wc1lwspIRaJUUPJAarWpOcirqb4ODP0XHXeCyyJFo5lamENq2h3pcY+PpubIVwMI0ePWnjDjH7+5tJzyFyN0d40HwOMsoAHCuxMRcZaAqP4tL4IdSckl4jK5dv1WqO0tzYAYzyd8d2qV4oz6k0HGwk1ZEkEfgJaZ4LfPkHAMBCdN/onAWqayXzPjHqnvtqtC9t2S4PurkYDmjFGG2tSNr75SYgCxkC57d5YU+erRTV9vf6TaflM5HQnOFj3Wxh3KIJ8J5fT5xwMfuhK5HiNosuMkgT/fkDdZlHRTZIWIhfyHuy+Kmy5yQtDlzL4IQsfm0HJBkwNqixxLGJKeMxXnNd19Ig6lyfYpQSL8eLYSyV7EhJbQaGYp40NfPr4HcaA0mm7gS+SHm2t//qubJOKdYl2bAHq4HaFYx+aGDdiLW33PS8g2xRf5ZbBxpPF0eS6nQ0uEju+nEeDruarItfvhmx+NY5kvWVW9aBQbKx6kc6MH+6bCiEBhXn/VZLdy3JtXOMFcLDqnP4zCI9s0CIKbquT4+iZgCqRXsxrzDS23Tm1MYFWV0liiXs/5FT88y8emzFJe7UI4Hd1tYqIg8VtlFxr6Ren8TLhXM7barFEXse20DMMzzodZNoM6bOAtQoocMaKAZJ9n2pdQRYB6fwAcFF3kkMzWgRNkwGb87dnHGcrsWjUoAo4WuE/sE+4dNxR/bJBrI8aBUrUYIe+Lzt0sysfrogX23weZIDcCWqOjNO6x4Jm10tQqtFjxRMOV/o0Pe2KH9vS8g5DjRca9vMuS0nU/L45ccbWSy8rfX0k91fT++WoZdIqK5F7PVVG0hynPQqYEJbyUymvVKs7WaplTq+Hy5fUWptzNOdXiNJo8mgJ+DUgRLHXvVPjRccYdAnDoJ8SuS8XpkONyivGnGbTS7C1G1MXfSYEFl/Cp/MjrwpaajTRioQuJptWQmtjbWDEu5j+3cXIhyKY0/cxRWDv/mZBAAm94AHeB4JApry140HrOUTjAyJBKmqoaST2zZ2Ha5cIF8l2zG2DSy77OiMFE6P27pDjDfLp7E99Hyhcq9rGAwqVW7/6ilxfhsoxf44iqPd7mdRJ1uGZjzhzzS9I2npbmgbjPR5lVFi5BLMVrvCzCqb0idb7hHugDD7O9TyB5yfjvGTP++TMiBpI2lTgZmBMEweUBhWYpUxNHpRoWnd481QwBdlYHFxJxN5khmCnQqlwp3gU3vRTh7f3q566H3Qpc6E/rzxmgHY5pCmGsbMm9YAJ359NOnKvHmuAj 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)(7416014)(366016)(52116014)(1800799024)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1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0PgHnAj6ggm2pR/hdKIZBG/NV2pmC1U6i1cBH1NSsOq++Le2MEGtWMdKFM2aL7xEooDRi/NPdmn9itzU/BaCnC2bc+KlTDzVxXnSViLgYRkFncQhaU8NKyjV+vo8e4KTS6GwDpUk/G5LD7lgONb+6O32yiZ0RvDk/OK7wotpG4BsJckczqViP+Ntm/EKLeoyw8RqkxhqNwAugVYCJOvPPZYoSgaQKTUUmRM44vIyzWKtr+DNlXppzQ6/qEzhXp2CAALWP4e67Y1wSgUabH+0q6dK/yIq8vumXTL5RbL9dtP78w0CMqRnv7ePo6xOGaTbTdb/nB+VDC/McHD/9Oh2FFo3QM4Igiccq6iAcHk+xYRK/9oCyZQ7C127u2QGrTgu67ZNwBOH2E/bdVZ+RqO/8u9GUzb87oXbXdqn/G7tYOwP0OpNth1SESVDtBi4J490+1UVL+HJ1X1VE2nFDOlQZF16hZ+4cNi7rFwHnsyI2joHl/FxSoer72rnUuK+3xsGaBUArMe0S71dCzP0Ocknfav+x X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ef45c2e-11c0-4c48-b02e-08dcf3fadd2a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:09:56.6919 (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: xXun7dA2xVD80QDygur/ETU4JHAZVxVFVa6aQ5rkF5AwxA5F7AfDxTWJamZLeUp7KH8GP0wK+J4ZQehQGec8IQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8627 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. Signed-off-by: Wei Fang --- v2 changes: 1. Refine the commit message. 2. Sort the header files. 3. Use dev_err_probe() in enetc4_pf_probe(). 4. Remove unused variable 'pf' from enetc4_pf_remove(). v3 changes: 1. Remove is_enetc_rev1() from enetc_init_si_rings_params(). 2. Use devm_add_action_or_reset() in enetc4_pf_probe(). 3. Directly return dev_err_probe() in enetc4_pf_probe(). v4 changes: 1. Move clk_freq from enect_si to enetc_ndev_priv. 2. Remove is_enetc_rev4(). 3. Add enetc4_pf_ethtool_ops for i.MX95 ENETC PF. v5 changes: 1. Add driver data support, some information such as system clock frequency, pMAC offset and so on are defined in driver data. 2. Add some macros to replace numbers in the driver --- 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 | 152 ++++ .../net/ethernet/freescale/enetc/enetc4_pf.c | 759 ++++++++++++++++++ .../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 | 14 + .../freescale/enetc/enetc_pf_common.c | 11 +- .../net/ethernet/freescale/enetc/enetc_qos.c | 2 +- .../net/ethernet/freescale/enetc/enetc_vf.c | 6 + 13 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/ethernet/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 If compiled as module (M), the module name is fsl-enetc. +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/ethernet/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 := enetc_pf.o fsl-enetc-$(CONFIG_PCI_IOV) += enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o +obj-$(CONFIG_NXP_ENETC4) += nxp-enetc4.o +nxp-enetc4-y := enetc4_pf.o + obj-$(CONFIG_FSL_ENETC_VF) += fsl-enetc-vf.o fsl-enetc-vf-y := enetc_vf.o diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index bccbeb1f355c..34b2f06b34c9 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -3,6 +3,7 @@ #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); @@ -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 = container_of(dim, struct enetc_int_vector, rx_dim); + struct enetc_ndev_priv *priv = netdev_priv(v->rx_ring.ndev); - v->rx_ictt = enetc_usecs_to_cycles(moder.usec); + v->rx_ictt = enetc_usecs_to_cycles(moder.usec, priv->sysclk_freq); dim->state = DIM_START_MEASURE; } @@ -1726,9 +1728,15 @@ void enetc_get_si_caps(struct enetc_si *si) si->num_rx_rings = (val >> 16) & 0xff; si->num_tx_rings = val & 0xff; - val = enetc_rd(hw, ENETC_SIRFSCAPR); - si->num_fs_entries = ENETC_SIRFSCAPR_GET_NUM_RFS(val); - si->num_fs_entries = min(si->num_fs_entries, ENETC_MAX_RFS_SIZE); + val = enetc_rd(hw, ENETC_SIPCAPR0); + if (val & ENETC_SIPCAPR0_RFS) { + val = enetc_rd(hw, ENETC_SIRFSCAPR); + si->num_fs_entries = ENETC_SIRFSCAPR_GET_NUM_RFS(val); + si->num_fs_entries = min(si->num_fs_entries, ENETC_MAX_RFS_SIZE); + } else { + /* ENETC which not supports RFS */ + si->num_fs_entries = 0; + } si->num_rss = 0; val = enetc_rd(hw, ENETC_SIPCAPR0); @@ -2056,7 +2064,10 @@ int enetc_configure_si(struct enetc_ndev_priv *priv) /* enable SI */ enetc_wr(hw, ENETC_SIMR, ENETC_SIMR_EN); - 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 = enetc_setup_default_rss_table(si, priv->num_rx_rings); if (err) return err; @@ -2080,9 +2091,9 @@ void enetc_init_si_rings_params(struct enetc_ndev_priv *priv) */ priv->num_rx_rings = min_t(int, cpus, si->num_rx_rings); priv->num_tx_rings = si->num_tx_rings; - priv->bdr_int_num = cpus; + priv->bdr_int_num = priv->num_rx_rings; priv->ic_mode = ENETC_IC_RX_ADAPTIVE | ENETC_IC_TX_MANUAL; - priv->tx_ictt = ENETC_TXIC_TIMETHR; + priv->tx_ictt = enetc_usecs_to_cycles(600, priv->sysclk_freq); } EXPORT_SYMBOL_GPL(enetc_init_si_rings_params); @@ -2475,10 +2486,14 @@ int enetc_open(struct net_device *ndev) extended = !!(priv->active_offloads & ENETC_F_RX_TSTAMP); - err = enetc_setup_irqs(priv); + err = clk_prepare_enable(priv->ref_clk); if (err) return err; + err = enetc_setup_irqs(priv); + if (err) + goto err_setup_irqs; + err = enetc_phylink_connect(ndev); if (err) goto err_phy_connect; @@ -2510,6 +2525,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); return err; } @@ -2559,6 +2576,7 @@ int enetc_close(struct net_device *ndev) enetc_assign_tx_resources(priv, NULL); enetc_free_irqs(priv); + clk_disable_unprepare(priv->ref_clk); return 0; } @@ -3216,5 +3234,55 @@ void enetc_pci_remove(struct pci_dev *pdev) } EXPORT_SYMBOL_GPL(enetc_pci_remove); +static const struct enetc_drvdata enetc_pf_data = { + .sysclk_freq = ENETC_CLK_400M, + .pmac_offset = ENETC_PMAC_OFFSET, + .eth_ops = &enetc_pf_ethtool_ops, +}; + +static const struct enetc_drvdata enetc4_pf_data = { + .sysclk_freq = ENETC_CLK_333M, + .pmac_offset = ENETC4_PMAC_OFFSET, + .eth_ops = &enetc4_pf_ethtool_ops, +}; + +static const struct enetc_drvdata enetc_vf_data = { + .sysclk_freq = ENETC_CLK_400M, + .eth_ops = &enetc_vf_ethtool_ops, +}; + +static const struct enetc_platform_info enetc_info[] = { + { .revision = ENETC_REV_1_0, + .dev_id = ENETC_DEV_ID_PF, + .data = &enetc_pf_data, + }, + { .revision = ENETC_REV_4_1, + .dev_id = PCI_DEVICE_ID_NXP2_ENETC_PF, + .data = &enetc4_pf_data, + }, + { .revision = ENETC_REV_1_0, + .dev_id = ENETC_DEV_ID_VF, + .data = &enetc_vf_data, + }, +}; + +int enetc_get_driver_data(struct enetc_si *si) +{ + u16 dev_id = si->pdev->device; + int i; + + for (i = 0; i < ARRAY_SIZE(enetc_info); i++) { + if (si->revision == enetc_info[i].revision && + dev_id == enetc_info[i].dev_id) { + si->drvdata = 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/ethernet/freescale/enetc/enetc.h index 97524dfa234c..3d7d49dcdbf4 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -14,6 +14,7 @@ #include #include "enetc_hw.h" +#include "enetc4_hw.h" #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) +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; }; #define ENETC_SI_ALIGN 32 +static inline bool is_enetc_rev1(struct enetc_si *si) +{ + return si->pdev->revision == 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; }; -#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; @@ -340,7 +360,6 @@ enum enetc_ic_mode { #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) struct enetc_ndev_priv { struct net_device *ndev; @@ -388,6 +407,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 */ }; /* Messaging */ @@ -417,6 +439,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); int enetc_open(struct net_device *ndev); int enetc_close(struct net_device *ndev); @@ -433,6 +456,9 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames, struct xdp_frame **frames, u32 flags); /* 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..acaa51c6b891 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h @@ -0,0 +1,152 @@ +/* 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_ + +/***************************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 = 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 = 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..9562caba59b1 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c @@ -0,0 +1,759 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2024 NXP */ + +#include +#include +#include +#include +#include +#include +#include + +#include "enetc_pf.h" + +#define ENETC_SI_MAX_RING_NUM 8 + +static void enetc4_get_port_caps(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + u32 val; + + val = enetc_port_rd(hw, ENETC4_ECAPR1); + pf->caps.num_vsi = (val & ECAPR1_NUM_VSI) >> 24; + pf->caps.num_msix = ((val & ECAPR1_NUM_MSIX) >> 12) + 1; + + val = enetc_port_rd(hw, ENETC4_ECAPR2); + pf->caps.num_rx_bdr = (val & ECAPR2_NUM_RX_BDR) >> 16; + pf->caps.num_tx_bdr = val & ECAPR2_NUM_TX_BDR; + + val = enetc_port_rd(hw, ENETC4_PMCAPR); + pf->caps.half_duplex = (val & PMCAPR_HD) ? 1 : 0; +} + +static void enetc4_pf_set_si_primary_mac(struct enetc_hw *hw, int si, + const u8 *addr) +{ + u16 lower = get_unaligned_le16(addr + 4); + u32 upper = get_unaligned_le32(addr); + + if (si != 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 = __raw_readl(hw->port + ENETC4_PSIPMAR0(si)); + lower = __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 = { + .set_si_primary_mac = enetc4_pf_set_si_primary_mac, + .get_si_primary_mac = enetc4_pf_get_si_primary_mac, +}; + +static int enetc4_pf_struct_init(struct enetc_si *si) +{ + struct enetc_pf *pf = enetc_si_priv(si); + + pf->si = si; + pf->total_vfs = pci_sriov_get_totalvfs(si->pdev); + + enetc4_get_port_caps(pf); + enetc_pf_ops_register(pf, &enetc4_pf_ops); + + return 0; +} + +static u32 enetc4_psicfgr0_val_construct(bool is_vf, u32 num_tx_bdr, u32 num_rx_bdr) +{ + u32 val; + + val = ENETC_PSICFGR0_SET_TXBDR(num_tx_bdr); + val |= ENETC_PSICFGR0_SET_RXBDR(num_rx_bdr); + val |= ENETC_PSICFGR0_SIVC(ENETC_VLAN_TYPE_C | ENETC_VLAN_TYPE_S); + + if (is_vf) + val |= ENETC_PSICFGR0_VTE | ENETC_PSICFGR0_SIVIE; + + return val; +} + +static void enetc4_default_rings_allocation(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &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 = pf->caps.num_rx_bdr - pf->caps.num_vsi; + else + num_rx_bdr = ENETC_SI_MAX_RING_NUM; + + if (pf->caps.num_tx_bdr < ENETC_SI_MAX_RING_NUM + pf->caps.num_vsi) + num_tx_bdr = pf->caps.num_tx_bdr - pf->caps.num_vsi; + else + num_tx_bdr = ENETC_SI_MAX_RING_NUM; + + val = enetc4_psicfgr0_val_construct(false, num_tx_bdr, num_rx_bdr); + enetc_port_wr(hw, ENETC4_PSICFGR0(0), val); + + num_rx_bdr = pf->caps.num_rx_bdr - num_rx_bdr; + rx_rem = num_rx_bdr % pf->caps.num_vsi; + num_rx_bdr = num_rx_bdr / pf->caps.num_vsi; + + num_tx_bdr = pf->caps.num_tx_bdr - num_tx_bdr; + tx_rem = num_tx_bdr % pf->caps.num_vsi; + num_tx_bdr = num_tx_bdr / pf->caps.num_vsi; + + for (i = 0; i < pf->caps.num_vsi; i++) { + vf_tx_bdr = (i < tx_rem) ? num_tx_bdr + 1 : num_tx_bdr; + vf_rx_bdr = (i < rx_rem) ? num_rx_bdr + 1 : num_rx_bdr; + val = 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, bool en) +{ + u32 val = enetc_port_rd(hw, ENETC4_PSIPVMR); + + if (en) + val |= BIT(si); + else + val &= ~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 = &pf->si->hw; + int num_si = pf->caps.num_vsi + 1; + int i; + + /* enforce VLAN promisc mode for all SIs */ + for (i = 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 = &pf->si->hw; + int i, num_msix, total_si; + u32 val; + + total_si = pf->caps.num_vsi + 1; + + num_msix = pf->caps.num_msix / total_si + + pf->caps.num_msix % total_si - 1; + val = num_msix & PSICFGR2_NUM_MSIX; + enetc_port_wr(hw, ENETC4_PSICFGR2(0), val); + + num_msix = pf->caps.num_msix / total_si - 1; + val = num_msix & PSICFGR2_NUM_MSIX; + for (i = 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 = &pf->si->hw; + int num_si = pf->caps.num_vsi + 1; + u32 si_bitmap = 0; + int i; + + /* Master enable for all SIs */ + for (i = 0; i < num_si; i++) + si_bitmap |= 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 = &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 = ENETC_MAC_MAXFRM_SIZE; + int tc; + + val = u32_replace_bits(val, SDU_TYPE_MPDU, PTCTMSDUR_SDU_TYPE); + + for (tc = 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 = 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 = 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] = {0}; + struct enetc_hw *hw = &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 = &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 = &pf->si->pdev->dev; + int err; + + /* Initialize the MAC address for PF and VFs */ + err = 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 = { + .ndo_open = enetc_open, + .ndo_stop = enetc_close, + .ndo_start_xmit = enetc_xmit, + .ndo_get_stats = enetc_get_stats, + .ndo_set_mac_address = enetc_pf_set_mac_addr, +}; + +static struct phylink_pcs * +enetc4_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t iface) +{ + struct enetc_pf *pf = 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 = netdev_priv(pf->si->ndev); + struct enetc_si *si = pf->si; + u32 val; + + val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val &= ~(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 |= 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 |= PM_IF_MODE_ENA; + break; + case PHY_INTERFACE_MODE_RMII: + val |= IFMODE_RMII; + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_2500BASEX: + val |= IFMODE_SGMII; + break; + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_USXGMII: + val |= 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 int mode, + const struct phylink_link_state *state) +{ + struct enetc_pf *pf = 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 = priv->speed; + u32 val; + + if (speed == old_speed) + return; + + val = enetc_port_rd(&priv->si->hw, ENETC4_PCR); + val &= ~PCR_PSPEED; + + switch (speed) { + case SPEED_100: + case SPEED_1000: + case SPEED_2500: + case SPEED_10000: + val |= (PCR_PSPEED & PCR_PSPEED_VAL(speed)); + break; + case SPEED_10: + default: + val |= (PCR_PSPEED & PCR_PSPEED_VAL(SPEED_10)); + } + + priv->speed = speed; + enetc_port_wr(&priv->si->hw, ENETC4_PCR, val); +} + +static void enetc4_set_rgmii_mac(struct enetc_pf *pf, int speed, int duplex) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val = old_val & ~(PM_IF_MODE_ENA | PM_IF_MODE_M10 | PM_IF_MODE_REVMII); + + switch (speed) { + case SPEED_1000: + val = u32_replace_bits(val, SSP_1G, PM_IF_MODE_SSP); + break; + case SPEED_100: + val = u32_replace_bits(val, SSP_100M, PM_IF_MODE_SSP); + break; + case SPEED_10: + val = u32_replace_bits(val, SSP_10M, PM_IF_MODE_SSP); + } + + val = u32_replace_bits(val, duplex == DUPLEX_FULL ? 0 : 1, + PM_IF_MODE_HD); + + if (val == 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 = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val = old_val & ~(PM_IF_MODE_ENA | PM_IF_MODE_SSP); + + switch (speed) { + case SPEED_100: + val &= ~PM_IF_MODE_M10; + break; + case SPEED_10: + val |= PM_IF_MODE_M10; + } + + val = u32_replace_bits(val, duplex == DUPLEX_FULL ? 0 : 1, + PM_IF_MODE_HD); + + if (val == 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 = pf->si; + u32 old_val, val; + + if (!pf->caps.half_duplex) + return; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val = u32_replace_bits(old_val, enable ? 1 : 0, PM_CMD_CFG_HD_FCEN); + if (val == 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 = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val = u32_replace_bits(old_val, rx_pause ? 0 : 1, PM_CMD_CFG_PAUSE_IGN); + if (val == 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 tx_pause) +{ + u32 pause_off_thresh = 0, pause_on_thresh = 0; + u32 init_quanta = 0, refresh_quanta = 0; + struct enetc_hw *hw = &pf->si->hw; + u32 rbmr, old_rbmr; + int i; + + for (i = 0; i < num_rxbdr; i++) { + old_rbmr = enetc_rxbdr_rd(hw, i, ENETC_RBMR); + rbmr = u32_replace_bits(old_rbmr, tx_pause ? 1 : 0, ENETC_RBMR_CM); + if (rbmr == 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 = 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 = 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 = 3 * ENETC_MAC_MAXFRM_SIZE; + pause_off_thresh = 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 = pf->si; + u32 val; + + val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val &= ~(PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN); + val |= 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 = phylink_to_enetc_pf(config); + struct enetc_si *si = pf->si; + struct enetc_ndev_priv *priv; + bool hd_fc = false; + + priv = 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 == PHY_INTERFACE_MODE_RMII) + enetc4_set_rmii_mac(pf, speed, duplex); + + if (duplex == 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 = false; + } else { /* DUPLEX_HALF */ + if (tx_pause || rx_pause) + hd_fc = true; + + /* As per 802.3 annex 31B, PAUSE frames are only supported + * when the link is configured for full duplex operation. + */ + tx_pause = false; + rx_pause = 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 = phylink_to_enetc_pf(config); + + enetc4_enable_mac(pf, false); +} + +static const struct phylink_mac_ops enetc_pl_mac_ops = { + .mac_select_pcs = enetc4_pl_mac_select_pcs, + .mac_config = enetc4_pl_mac_config, + .mac_link_up = enetc4_pl_mac_link_up, + .mac_link_down = enetc4_pl_mac_link_down, +}; + +static void enetc4_pci_remove(void *data) +{ + struct pci_dev *pdev = data; + + enetc_pci_remove(pdev); +} + +static int enetc4_link_init(struct enetc_ndev_priv *priv, + struct device_node *node) +{ + struct enetc_pf *pf = enetc_si_priv(priv->si); + struct device *dev = priv->dev; + int err; + + err = of_get_phy_mode(node, &pf->if_mode); + if (err) { + dev_err(dev, "Failed to get PHY mode\n"); + return err; + } + + err = enetc_mdiobus_create(pf, node); + if (err) { + dev_err(dev, "Failed to create MDIO bus\n"); + return err; + } + + err = 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 = 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 = &si->pdev->dev; + struct enetc_ndev_priv *priv; + struct net_device *ndev; + int err; + + ndev = alloc_etherdev_mqs(sizeof(struct enetc_ndev_priv), + si->num_tx_rings, si->num_rx_rings); + if (!ndev) + return -ENOMEM; + + priv = netdev_priv(ndev); + priv->ref_clk = devm_clk_get_optional(dev, "ref"); + if (IS_ERR(priv->ref_clk)) { + dev_err(dev, "Get referencce clock failed\n"); + err = 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 = enetc_configure_si(priv); + if (err) { + dev_err(dev, "Failed to configure SI\n"); + goto err_config_si; + } + + err = enetc_alloc_msix(priv); + if (err) { + dev_err(dev, "Failed to alloc MSI-X\n"); + goto err_alloc_msix; + } + + err = enetc4_link_init(priv, dev->of_node); + if (err) + goto err_link_init; + + err = 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 = netdev_priv(si->ndev); + struct net_device *ndev = 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 = &pdev->dev; + struct enetc_si *si; + struct enetc_pf *pf; + int err; + + err = enetc_pci_probe(pdev, KBUILD_MODNAME, sizeof(*pf)); + if (err) + return dev_err_probe(dev, err, "PCIe probing failed\n"); + + err = 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 = 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 = enetc_get_ip_revision(&si->hw); + err = enetc_get_driver_data(si); + if (err) + return dev_err_probe(dev, err, + "Could not get VF driver data\n"); + + err = enetc4_pf_struct_init(si); + if (err) + return err; + + pf = enetc_si_priv(si); + err = enetc4_pf_init(pf); + if (err) + return err; + + pinctrl_pm_select_default_state(dev); + enetc_get_si_caps(si); + + return enetc4_pf_netdev_create(si); +} + +static void enetc4_pf_remove(struct pci_dev *pdev) +{ + struct enetc_si *si = pci_get_drvdata(pdev); + + enetc4_pf_netdev_destroy(si); +} + +static const struct pci_device_id enetc4_pf_id_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_NXP2, PCI_DEVICE_ID_NXP2_ENETC_PF) }, + { 0, } /* End of table. */ +}; +MODULE_DEVICE_TABLE(pci, enetc4_pf_id_table); + +static struct pci_driver enetc4_pf_driver = { + .name = KBUILD_MODNAME, + .id_table = enetc4_pf_id_table, + .probe = enetc4_pf_probe, + .remove = 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 = netdev_priv(ndev); struct enetc_int_vector *v = priv->int_vector[0]; + u64 clk_freq = priv->sysclk_freq; - ic->tx_coalesce_usecs = enetc_cycles_to_usecs(priv->tx_ictt); - ic->rx_coalesce_usecs = enetc_cycles_to_usecs(v->rx_ictt); + ic->tx_coalesce_usecs = enetc_cycles_to_usecs(priv->tx_ictt, clk_freq); + ic->rx_coalesce_usecs = enetc_cycles_to_usecs(v->rx_ictt, clk_freq); ic->tx_max_coalesced_frames = ENETC_TXIC_PKTTHR; ic->rx_max_coalesced_frames = 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 = netdev_priv(ndev); + u64 clk_freq = priv->sysclk_freq; u32 rx_ictt, tx_ictt; int i, ic_mode; bool changed; - tx_ictt = enetc_usecs_to_cycles(ic->tx_coalesce_usecs); - rx_ictt = enetc_usecs_to_cycles(ic->rx_coalesce_usecs); + tx_ictt = enetc_usecs_to_cycles(ic->tx_coalesce_usecs, clk_freq); + rx_ictt = enetc_usecs_to_cycles(ic->rx_coalesce_usecs, clk_freq); if (ic->rx_max_coalesced_frames != ENETC_RXIC_PKTTHR) return -EOPNOTSUPP; @@ -1178,7 +1180,7 @@ void enetc_mm_link_state_update(struct enetc_ndev_priv *priv, bool link) } EXPORT_SYMBOL_GPL(enetc_mm_link_state_update); -static const struct ethtool_ops enetc_pf_ethtool_ops = { +const struct ethtool_ops enetc_pf_ethtool_ops = { .supported_coalesce_params = 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 = { .get_mm_stats = enetc_get_mm_stats, }; -static const struct ethtool_ops enetc_vf_ethtool_ops = { +const struct ethtool_ops enetc_vf_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, @@ -1234,13 +1236,26 @@ static const struct ethtool_ops enetc_vf_ethtool_ops = { .get_ts_info = enetc_get_ts_info, }; +const struct ethtool_ops enetc4_pf_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES | + ETHTOOL_COALESCE_USE_ADAPTIVE_RX, + .get_ringparam = enetc_get_ringparam, + .get_coalesce = enetc_get_coalesce, + .set_coalesce = enetc_set_coalesce, + .get_link_ksettings = enetc_get_link_ksettings, + .set_link_ksettings = enetc_set_link_ksettings, + .get_link = ethtool_op_get_link, + .get_wol = enetc_get_wol, + .set_wol = enetc_set_wol, + .get_pauseparam = enetc_get_pauseparam, + .set_pauseparam = enetc_set_pauseparam, +}; + void enetc_set_ethtool_ops(struct net_device *ndev) { struct enetc_ndev_priv *priv = netdev_priv(ndev); - if (enetc_si_is_pf(priv->si)) - ndev->ethtool_ops = &enetc_pf_ethtool_ops; - else - ndev->ethtool_ops = &enetc_vf_ethtool_ops; + ndev->ethtool_ops = 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 +#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; }; -#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); } -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); } /* 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 7522316ddfea..527b317ddc11 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -946,6 +946,13 @@ static struct enetc_si *enetc_psi_create(struct pci_dev *pdev) goto out_pci_remove; } + si->revision = enetc_get_ip_revision(&si->hw); + err = enetc_get_driver_data(si); + if (err) { + dev_err(&pdev->dev, "Could not get PF driver data\n"); + goto out_pci_remove; + } + err = 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 39db9d5c2e50..19bf206438cd 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; }; +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; struct enetc_pf_ops { @@ -61,6 +69,7 @@ struct enetc_pf { phy_interface_t if_mode; struct phylink_config phylink_config; + struct enetc_port_caps caps; const struct enetc_pf_ops *ops; }; @@ -81,6 +90,11 @@ 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; +} + static inline void enetc_pf_ops_register(struct enetc_pf *pf, const struct enetc_pf_ops *ops) { diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c index 94690ed92e3f..6d6059eac536 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -105,6 +105,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, si->ndev = ndev; priv->msg_enable = (NETIF_MSG_WOL << 1) - 1; + priv->sysclk_freq = si->drvdata->sysclk_freq; ndev->netdev_ops = ndev_ops; enetc_set_ethtool_ops(ndev); ndev->watchdog_timeo = 5 * HZ; @@ -121,10 +122,17 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->vlan_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; + ndev->priv_flags |= IFF_UNICAST_FLT; + + /* TODO: currently, i.MX95 ENETC driver does not support advanced features */ + if (!is_enetc_rev1(si)) { + ndev->hw_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK); + goto end; + } + if (si->num_rss) ndev->hw_features |= NETIF_F_RXHASH; - ndev->priv_flags |= IFF_UNICAST_FLT; ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | NETDEV_XDP_ACT_NDO_XMIT_SG; @@ -136,6 +144,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->hw_features |= NETIF_F_HW_TC; } +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_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 *type_data) * * (enetClockFrequency / portTransmitRate) * 100 */ - hi_credit_reg = (u32)div_u64((ENETC_CLK * 100ULL) * hi_credit_bit, + hi_credit_reg = (u32)div_u64((priv->sysclk_freq * 100ULL) * hi_credit_bit, port_transmit_rate * 1000000ULL); 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 = ndev; priv->msg_enable = (NETIF_MSG_IFUP << 1) - 1; + priv->sysclk_freq = si->drvdata->sysclk_freq; ndev->netdev_ops = ndev_ops; enetc_set_ethtool_ops(ndev); ndev->watchdog_timeo = 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"); si = pci_get_drvdata(pdev); + si->revision = ENETC_REV_1_0; + err = enetc_get_driver_data(si); + if (err) + return dev_err_probe(&pdev->dev, err, + "Could not get VF driver data\n"); enetc_get_si_caps(si); From patchwork Thu Oct 24 06:53:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13848424 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2044.outbound.protection.outlook.com [40.107.21.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 5B70B1B85FA; Thu, 24 Oct 2024 07:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753810; cv=fail; b=J+SZGz6826iRBAfdY008p4EDZDAsyuYmWzOlB3x75YlnpMVmTVBIdXD9nebT666oy78/zwLAdp+FfB+8x6TQdNnboNn5lbsxdjPDLQh2s5GbxXEhu0YHrtoR88tQFy02mbZE+lEymSgnfmp0MO0OIz9iJDbCt9KmlRrlytPJiLo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729753810; c=relaxed/simple; bh=dr9qt+8CLLI5xDCsLLrrWqJCcS32nP8ar1cVbB9DmaE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tkDhCdt7502OJ/qGBLNf5sbPrRdcdouX8IoFXbcxkPg02u25Aaq6VL6+gAFECzZYDsmk+g0NCBrmL6FBvtr2Ri/1saMmOIDUN+fkmxSBP0O+hwwh03eTkIWUEy7HkzF27NzD6FpOVa//B/dTavOStxJPKUQ2qovHvwBxLz2Dd74= 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=KQ/+hgnX; arc=fail smtp.client-ip=40.107.21.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="KQ/+hgnX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yxnwZggDEP7B2yL9w6kXvt1Xt5T3nxNzVa0JwPkmcukM1YaL79A73cEQO3Ml7tWD9DSrCRqDNxUXStzVXG67cVr6NJemLr3N2LEsaJdDAcosYFoLYBLVcNXO9as1gAarj2bmr6NTIuBBwyX9ZSspukzOdcT4AfYkwSSw3NQYT6fhlQ3ooqZQeNBia4nVFP61R0KKwXAjzDVCwsoA0r61eFwXjBcki2MZUnqDsS49PJgJ2xc53MsEy6qzlqTvMebv0votmjFsdWLr5jGU5Bxdmpb/486vVXh8yTPA/FwgUvn+fCbjGW7lDeYjh6DWKdxrhRHvbwQ1NE9OF//zMLOQeA== 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=KegM9MJzzmghgX6XdsNK37mZZaPEB0COgnQ9VHSsX38=; b=bMs1rtGqwCVEAKLqVyUe8GttqI6hSvpKKL6rcJeGyFE7iHSmAvT0EeisLuRvx2VZi9XQL4KTTZodOdKAXNbBEt1yknvtt6KKVcr+tWh20UeV3L9zTTijUjDTliXjVtdc1Kg91jSKfKXwX6mtlqOn4PvWk3q/5Q4S6A9MKBl4Z4kl0d5XOMl+VisnCwpE2fwqrWGHLZh6lzE6E+Kle8tF4jU5uBmqsEqZBUpqA3vE0pzTxdoUzn/Y7jUoGn7qa3gS9tmUlx6G4fqnRbDo5EKW8RjL8/XupfIta/jLXQR/r9DqZ7QacUt4rHdhgA0zgi2ZiAt1crSGi4RXqTXlU0IvdA== 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=KegM9MJzzmghgX6XdsNK37mZZaPEB0COgnQ9VHSsX38=; b=KQ/+hgnXmKTsVyUCxulCe1/u0eK6uQ1PD7kLCkr3hcOEWUOzd3b0sqsC7/vx4qA4ALpjzjt3dGmst40yrHEqszQOQnP5ocgStNu3C4cmTTYxkJapWp0dnVozE/DNLHI6SSFmi/8/x1K4h/HVJ2PRdDeh/ItQ1LNVhsbPqgGlKeALOSBl/gyYOVJ0/sVdj6nJLFgRSb720pDU0JmG2q8y/JIvHr2u02tgcVy1ULtMbLxqC+NUr2BcTnPs+mwXK7/oy4qMtSYpeifAwKh/Gpxss4NURJnGfM2BusvtGIdgblQIdA6be1oxzpyDtizN2WIXaeCBuWWH6jnmzH0KAyOR+w== 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 AS8PR04MB8627.eurprd04.prod.outlook.com (2603:10a6:20b:42a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 07:10:03 +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.8069.027; Thu, 24 Oct 2024 07:10:03 +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, bhelgaas@google.com, 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 v5 net-next 13/13] MAINTAINERS: update ENETC driver files and maintainers Date: Thu, 24 Oct 2024 14:53:28 +0800 Message-Id: <20241024065328.521518-14-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024065328.521518-1-wei.fang@nxp.com> References: <20241024065328.521518-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8627:EE_ X-MS-Office365-Filtering-Correlation-Id: 250971d6-7967-423b-004e-08dcf3fae15a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|52116014|1800799024|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: xqwHiyE74G5g7ST6HJfB5TsVrXPjeqOD+lcIclcgd6S9SgHUm/nE1/fZHCjyqVhvvyYJmkIRDw7rNQnTDLGBs0XJe0jHWqKVLJutWrJazZuGhyvF8zQ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nYcp9F7zPZcji5oVT158mmjnxeXegXPtHiOZQVyNXD/i/6t1yske+a1dXNY65h3sN3+CslcTIW3tN8x0yjGmC2yv2WAt87wV2Oce9uAEhbuwTf8U1UcnVpiXoDmh6dcaWKXehdROc01x5oWNff36RQ3klTyF0PQzwYLZ31GUkrgihieCUQkQ/KPTt+VUR/xLv4hQPeXBkQOHU4WcQkAOC2OHw 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)(7416014)(366016)(52116014)(1800799024)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ijrsBoi1fJaZ9yTZXkxm9dy7eTySJ2FDaFF/uCTAW2RrI6CsgyC3ErBioahF8optk+Q2baOlG55Fl4LqyUJrno5k/zHR258VFzuqGFTGETKJjGOMDzfnSjB3Oed3/lSn/TzgNsZkWmOg29WvDikJeuwxhQavGauXUR/S7Gx4nfQwbWI7kNJchdx0arZ759coHepK4QYzLATKLxlXylfXpvrB+r0D+VwMrU+0RWK+Geuofki4Ic4Arni2bS0mv1lfQEIP81s22w3LCoTGCQ2FwOO3CYbfTorg3QdPUIeEvz8sb+AgfeXJmVP9qOldUKluEjqvyzy6zi9W7JF/b2t2XrBXLDXlb8peTEm/i/17x6heCTN5OFCC1JBVCAn6au6TL5nysMA0qntP8/CaEAyiBZbkWgHeapOEhx4ExTT6JkgDpUKPm7wv/WIwiRQQkVaYg9lfW7zDODSns1YIbA4PVQtqJVMFjW9vLwCB4ZzvwAe11RheFQyv947LyW4S6HU7Kv2EMl5n/TSQglFx+SXzjRi+d24MR53Z/6VqVmfxgd10u8jx0zSHgJWCW0/l1GKe0DVrRoipCKLiAUKTfYx/i9b8+d99Z1W+fu0xtj4KaKC2J6+ydnq9OVJiMjRBUJSUsFBtY0QFD5sJQEJFU2AjGCDIoyCl3MMcvvMqKtTdq5DZE2yHzLl2Ppc8V7SAg5TZwIuRNIaAdHX0sv08737xKxGytxKvxIIp1a0cgtRkH372a3PaGaKdQuUWP4Nu4Nv8cFNJh0aKdmo4SNfLINKBuNUbtUEeWNce6jRNcuvqgdxMT6xqV33pW3fuRgdnWFB13Kz7KkPRruXssHkb/TTn8cXVRO+WSGIz5f4/mhacFJOgqRAS1MNvASwB2WH6QCdOthx0MTSFxQh8KAunkp8IeQ7wNFBav/qZN18z43nb0iaZWuUjn8FrqxmPyME3lZ80Zhktr1MZNfbU6rFJZ3dyho/uEY2jRw3E1bqCK4N6VzDK1B21F8EIDLvLQFORVb9J14MuihA/wI/3drz40cMMPqeXp2HuLcFEoUkW/Gc+obcelCZ76/0o/6hd7YVk4wXZSMMMakYKMKJXoWZtuDFVlKMN5i0VahV4pAi1+BdDoecZzL7Z6UN04BI8HSgKiU5S4OpNoZRGuPNHTYf5WHMxtvqvPJzFz1b0no0uYwcwZr8osE64R6Lh6IG3tlFCmm03ay76DGJbF8v8XSww4nU1eHls16Iz0mqXFRY3H2U4nWeZbSiy1XhXrhmGXISE2zrYPUVRyUgSMD1QZQnKW2m6BsXkM+W4PVP/8Joq6LLbSV1JzgVrRTsIgN5OMQINVyK4liYY4Z98HMMVFmR8ShgcsiDCoaXtvA40yC4eTeOyIRXqgg+5UMLVxBYqbKBF6p9upA9VQ5TgLOZ4vqsR2RZHlngWd+66idaBqZHrCxfjWywLK8d3i2MZr4EfYToRW8s9zEqsnACiMhtmXCCpvtE9GIhdCclcPlZzjiQMl8GhnRBAJMf0AAWoynq4N7bPWg5NFZNUIHn6xWfBRa51zg052iwB4Hap7ul9n0haOrK6b2LTfresjECReF/+kcHKrMzz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 250971d6-7967-423b-004e-08dcf3fae15a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 07:10:03.6605 (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: TUA6Mz69pyk+By6cN9vXzj9mIW82tAaJ48EWhTXT+NRFSBHTSuq8j1ZpQbXpvIDlKnYYvXpIUu6VKxuVyZZpEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8627 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 --- v5: no changes --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 560a65b85297..cf442fcb9b49 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9018,9 +9018,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 FREESCALE eTSEC ETHERNET DRIVER (GIANFAR) M: Claudiu Manoil