From patchwork Tue Oct 22 05:52:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13845160 X-Patchwork-Delegate: kuba@kernel.org Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011028.outbound.protection.outlook.com [52.101.70.28]) (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 E8434142E78; Tue, 22 Oct 2024 06:07:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.28 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577255; cv=fail; b=GiUP3TUcuAO4RNm8hITv0RmYrHS1YRe7kowPgMfdUmzX47ifVU6u/N/l3sS4PXene3+VJa+9R9VdqMSuR1RqwFPSRn45lBvxQ50Jg7L6fADV73X3hTXCIpsojYli+f2+hku1Ve4lFNqaE4NwjDFdSnzhqA+P2nchUTSPkvauZJ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577255; c=relaxed/simple; bh=NjcsmyI4iNjcEFNKTgjGOdEyxWy5GhSuKKlKrbu1cf4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UumXh4iRGFgdoAou2JN06YMpphQJGx/5B7VhVljyMQ6AnaG+vEMBllM2ajBO/ccxNazswfYG584AgsG+L+wLnmbrUhHx7dkEaqXEtdZehhPU8Wt5cuHrN/Je4z+qti5OqwAdCxQNf1ngS+9a0+j0UvMDrJVLjqkmL4l+yr7qpks= 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=g6RXMaeL; arc=fail smtp.client-ip=52.101.70.28 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="g6RXMaeL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kt02+ocqSHSka4QZY4j2+Niaj98yTzNKJ8fnoxJ2Nqm+lO6AAivFoKFo67I6RClb7pk+91Kb2iwC/0EJGv7Njn1W8nM2JbXCPgvFHp4GoprLwn6ev7Pe/JrfSD/AWhk2oqT43JxvddDoAuwE09j5NmnNLhZxIGYM1ry/N2oTYP9GF+t9sJMKlHNTkUgol6p3qTnzJxje2Is8RjNDFTlXiAaBIWnUKhhJqXDRvFt3NDU+UD/LH/mrYvXBzThe75PwLvpVAbA/c4TbRVjwZWZ4qi2OCkA1wonvPlmGvL/DO2ZfiwX51zsgpYLGyrhaTd+5VpG1zO47HZ47iBv05BJE2A== 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=krMfbsyqfzmwD40cpsm9L6FvHz1xL/UYF2o4Gwb90ec=; b=ylE+tE0NCHi2EXLfkUN2j0rwt2NL+dlG3vWt3sdESUnOFvXM5bD5XYnoIONNC/j+VsWA7iIxK56R3Ze291FDwFW+BJu/iHVXEpERqBU7S1bdtl7tWN6w8eMM1oR3zHOTQQ0NJvWhJDdCXu0uwSqJD4ymjDvcF9C5aIGIU3k2eTBAa6PjNlUE0fMzkuiLMQfWKPi0EfYP6h1ITiOSd5Hk9TW9YIDbVrtcH87RONBvU2UdnbutjP+7Cbj8S72785oWjqrjBmllGEvVSC+lXhVQyEuZJPxeQf4LxIi1AlHkkHjS9fYoUdiGikod7GX2HfYb/W2jboeToR5AZiAeUTPfJA== 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=krMfbsyqfzmwD40cpsm9L6FvHz1xL/UYF2o4Gwb90ec=; b=g6RXMaeLemyyJv/c6XTQB4Jod8rgI/7aQLX0kW22wjCjX4JZ6RZnk41Wjhv91dYMYpn0pVR++tbAEmUDxYZd5HlpvIB5+Kk15q4N6FgeW6/N7U6qElthhDOAoib+E0xQltUEPXZ/xAbk0eLTwM+yF9O2jXn94XraQH9FD3yk7rVnnPGODg29pgh5S59OWfCjxFHFNaRdGtcpPHETeZhoBBsX/caDwxE+XkF4pLDU0Re2hZVTdet2OKOsh505QpcPO8+ioSLUL9+HLfvfrn+X1pWmYJIE+CTi9HNFL+UubMtcDUE8NjA6MJMBcQw/UB57ZInPGobp0nkljqBAqoufig== 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 VI0PR04MB10209.eurprd04.prod.outlook.com (2603:10a6:800:244::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:07:31 +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; Tue, 22 Oct 2024 06:07:31 +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 v4 net-next 01/13] dt-bindings: net: add compatible string for i.MX95 EMDIO Date: Tue, 22 Oct 2024 13:52:11 +0800 Message-Id: <20241022055223.382277-2-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|VI0PR04MB10209:EE_ X-MS-Office365-Filtering-Correlation-Id: b4a3eda1-a227-464a-ae7c-08dcf25fd006 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: Y0fGfU9uqZBcOM3LTe9jHV0btKmWO54ckHFomABOj5+vGv5yZLzRIm/TlQ7umHHPAHhKXslSjmeZFiom1PvR/2U4YLfdR4dqsQm5pCOmw+l44HYbfU+LsTWl0MC9LV1hQqwMpmzg/vE1QTBPcI5aeDMnCYoBd+gGu0Y+1UmTNsLtUhf6nLtSBb471tVrj3T4M0t60Lg4PPHsVJofpGB+Qx4zxFK2yZGNNoEcKH9LUBMnzoJKo/UU90IJIYBq/QWNZPzsbvjMttgC+KtvFOxRSjcVQCc063XMaTBFPIUsctanvUoh4vNtpR6q0lNFlkgq5nBqMaEesxsxyn9TptfciR6INyz9OLsdmM/sHmhvx78qugvPHQyCD0k0d5r4pLHZwuXc6X1wmfJbw7yxuI62MExjbRY9rnJcJyQmH3FwefEbt5YeeOfLP5J8yMvnPcyJw6D6aTdvwNy8JCu+wfvIKjCDJEz6RvKZREYc/3iIuIzjAB0J72BifAw2InkjhOgZ+OYLla+jj+0Q9FCP9MkcpBbX9btKyWFk5etBzB/DE0DCUejirKkAXxSZ/FCBjcOhTl4CKM4o1IP2IuvDHvdBG/qVE9BId23r7YEwLxauzOBRXp1nedtTpuMw02JNCOb40WkEHsdy6IilxupkhCSG2muox0f4/QvIZsU5aO5c1vUDY/WjGdTGtzBcwUJuRI0nXomr5w9CAL+iflyjzyJmw5jR93Yp3gCQ7Jw4tTCqVGrthom2FiDz6r15qNpSs/ng7BlpfRf0tgUCEhjr4U2k4QZ81Ay3ts/XgtYx8Ds3TQujq29xzb94cQ9IoT1ywX8NeK1Um+je086g+R0TXBhFiuFQy/QkPsnF2tBtAx6PJw4DCy3tOl17GI6/+VKhcjtZLM5Ju+r+VAMzs3MnRTirmlyWh993PTNrwcN74IdtT3ryyyjXIg9R7QhbEuKuyPnKYgLI1z1GGxJNBJxoSjKawUR9IKzZswT9A67wpG1ycWNTF2Ra+oIodhV5Qcf4dyJcE2KzOQ+9fNepye4kAHs6Vp1KIaYfhpVdgn7HxNobebB5TOaU8Eo+NmVWsAFXHYfCrlTNRZ7XOAQHvcGOzseYgpLrmgoMSKFvKMZM4dfQNQx1ndErkvj+7tStQp9w2RPL/zUKYyhXvoB1kzH+bLn1XZhDHQHUiW1+JRVzZhZDhVSajm3Mi5l5PH/MPkMCt1MYWWDTfg4piWeRzwfhRfH49taYi22YynN5sZCrQbryN8j6hrF8BPsUCmakEKuMDAZ5W8MdqadcQ7p/xCwoe67lZ1LObtnYWV9SidtGgrOa3GjDa9rdqob2q+aKBHONICVuBlIoj7yet4WbtloMIkdF0fk60Uz2SAEx3XJHATYVcmizdKDztBJ7mQ8LvDTF4bud 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)(376014)(7416014)(52116014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kTIMiM84smhJABfGPYpUwNDW1cYvXxCO6J/GjRFi52LGTUxJ17d8WI1b/C8Fj6s/TybZTKd/+6NlKHjDEkV+WnDW1F3dPbHgmi3f7JEnA1w5Lg2En8BcF3iVWS1EG6yCo3urWLnpbEQf/chm+4ztiHyiAckwqJvKoejDOLpQsFsG4lmxza+XbMJi6jtycPpQ2ollw9JmHEjPsO40g7DdQxg9gt+84lzgTT9kY7xg8jMEUKtL0OkHaP1WULmcqponZ16lsj6WgtMJ+cMfnS2QdjLtSlQRHqTUS9fn3bo/KEfCPp5JXfqPrzsos4hUpFBa8NX1teXQDD7wBLtZUr4ZkZOo6Wf6IcL5QYR/hEtyN2uMQ/g6FrB7fZ3g6na2iA88qIcbn95CKtePJCzAilBvCxXWozVcNt26Hdu+lFkipNkBVnnfRHodkQslsZGdUF/Qe45MAzEru3r88NrMslbCyuMtn6ru5Wd2PVbysdYQbX70eAyYR3zjSMTyJVRiA1wteyu12k1qFF9XWY8FeBKCl9dIMyq3B4VdJWt9V4r7ob/4yMDqZx0MnfuyAloDDQrweWmgaKUTV2Awb0SgpXZQV+yUVNQZqOENafvmb2YaioxxFgEwMkIxE4kxZ/X2FEGt+M4iSm/6jkLmJgsxhhH/P2svBsKuUPdd4JtQZosarkUKFMD9jojMNnWknBhBkYORQBQ5HJU+Nalz0usL5WOyGQ8AKohmfnxvWl0+seoOFWN8PE6a/YD5x9Ay5AoUAt2gjObAVWk38B0OPPSz2j/ugZ2pr5c0q0YcOtwwVdHUbcn1x3oocSBqP0su/dwt80KDTKrHayqamQKX2msMue76Ac9QYCMcgvtOnlfIIPmOLh4C48IGB4C7z9V6iKQA0iImGvSjr2R72v00wfGItUWdXdJk5PIJJi46Mnpq7W71rt0yeTZ31RohBO2PxgMZrF8uAqN82kdrKvDTmfO4M+uBz753g7gTaC2/MxR20eb/PUjR6LWlXP5xGvmHVQpJQmyx198u6mWoPoQTSLzyobr4SUbwRuBMeWSAVbovp8wiAQjsarUjZ9+svdTvXd68AURkn9OCpqYxwZs0El2YfD9nf4Vogfc5sb2LlA6ioAGIOuR4DEL3hPlpr0SmpqE8HHElfUvLEMZ9BlQ/HHfaMlREpr7xy9Cn24K5bAaimgQJW0sKT8lErrMS6WtB7OipuBtb3ErEo+yQ4skIf5BkkrFyxD2ohYuJ4CTWDKXjTOKTnGOBl6bJ8EYw23ZOaW6hzpuxLIGwHaPPulwjezHRH8wW19NMnd7fYEnYdjUHey25Atxk9HVk4UZQZhLHrq4hjo2ROESmE3fwE8piFMJ9Hww9eJvNuJ+2gtZ/udYiKHU7F6IypzrP0ZAUrA7FPy7qhe+r4GPY6Lk0+KPTb3jbfnX8aL3Sp7QorYG+Uzld59SjrMFBQ8Nn9p4AArwfxBujawpHky+9ZvryWdGzz9GGc9T/71x3JonXHiQnOFoIWCAEvcsxl14lKn5kHcHSgUZYWB35tVz5IERNsNXcXqAr4zwQVpryRSBEcikUZlwJ95bCtRr03BGythE9x14aU5DixPzU X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4a3eda1-a227-464a-ae7c-08dcf25fd006 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:07:31.0453 (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: 2ChWt8FKbAdcomvxMrxcKM8Cj8nueGVlBuRtUAbVendmPQfHBkLS4r4S825QtFiA+tCZGFdn1kLGYqtApHDf+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10209 X-Patchwork-Delegate: kuba@kernel.org 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) Reviewed-by: Vladimir Oltean --- v2: remove "nxp,netc-emdio" compatible string. v3: no changes v4: 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 Tue Oct 22 05:52:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13845161 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2052.outbound.protection.outlook.com [40.107.20.52]) (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 9E082142E78; Tue, 22 Oct 2024 06:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577262; cv=fail; b=HJE33MyB+ej+7T5mEeI2/u/LW/JTiUk3K2GPwKEhrhn6PZ6+SA8kA8TdE/T5vJ02b7dUFmvSlIRssKBH/61hZnDAFynYIPuWqc+gGRZlwOROUntk/qWvHpHYdxpYgRZytSES0N54G0vW7XW2xIvsXHeKFNNx+30OubDHT5qZ12I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577262; c=relaxed/simple; bh=i/YgLaTmsl+HLl9o60+gf4S9RynLC9oiNCimM8aYscw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Zy7oZD9vVEM/gaxRSaoBBYdNA6ztSlfm7Qxkl3WxVyCo0wMfCDgFyrRGMFsUkMJ9xEBjgMmBBgse1jnZ32GWhINfjjE7XpKJOi8WDCehcUkjXUqsRUXGvRw8UfZRbWVoMjoF6hixvgtom+vSnw4+AWHYGHswHE82dzpSmBOxO1g= 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=VDRQ54ou; arc=fail smtp.client-ip=40.107.20.52 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="VDRQ54ou" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LM7OvTLROvwGa9UA30vmu5/DC449r3SqTxbROb7zrmCtKJwo7O7CCU/xh02vJmixd05KxjDFzosy1jZPeNvTba3uxXCVrhgndgX3+0FjtArAPEeoNnQ85any1uz8+SJ/pdFl+D11igtJd0Qa/3XpTOpsa0OD8pzgSeGVZXRz/bKA2oxkTwPXSjAQEYzLKj9hsxOakwzttAfUKozIajQGsV6hANx/mAE9Ve4BRFU4mLLW9T6HeaDz8pc2sNoYOtOdu7uA5r5OTLoVgRdqu6YCDqjPfu/IxIRN3C9ZC4upmpFQbUWNDzelXdpWnayzVhsfG5K/fktct5GjnEW2BYI6Rw== 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=/HrA+T8SnhCutcgYSJfi3ADIAYH0w0vO1kYedt1Rukg=; b=TMS4mgCZV48yH0GMiT8poDtWeaTIE3Dd6od/VEMLdsTb41NEh2jrHOzISlQv2giJVRCfK+IYhScL/59ycQbfoLXQgocEDVN6u+swOGIQPdcWB48pCwnf+7VznC4iQvHi4QUGkcFsq0LnCKJrSSSjWL+JOrDkY0Sp3HI2DwqJcmiPi+5VrBpWn78roUHmH+3LUrF37uLKNSfsXvxofu6TZ/h54uW7+0Bmptas1vce5UrUawrBhOzLmuEH58+JrQmLtLvT61mQpXilkNkKaQ7cV5s+oGFxT6MBAn9c6sm+lUwjKExNAHFoltrJaNO50sNzXIT1TzyZtwewEZ/mNzHMYQ== 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=/HrA+T8SnhCutcgYSJfi3ADIAYH0w0vO1kYedt1Rukg=; b=VDRQ54ouzOvvPri9TNS74tSAuKJi5K1dDifBIcCYS7aYbhNT4qjJHR/HRD4ivmb9mJQapROi6Xhc9XLjZ4OAhJ3otrcNorYrxg3sfL7x1urfSlmhTVEJrkMH9LzzOTc39a+s3XOylbAtjgUmTf54Wly7JOeBLu3vfP8eHDfW/koFW7ebxeQMD9zMke091RLqRCSDTxaB0ReyWplIweVyQdTraD7cN1OpCLM1ZYQozM7rgnBtsIYsdPfxWXSgcY27Ns2A2tt614naj8qF2bVsnAbvrsjt9t1FMxfNrwiTCpUwjzvDXcioKfrJH6kMPTUxvCRUSIgJPstD4d+k+D30PA== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:07:38 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8069.027; Tue, 22 Oct 2024 06:07:38 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, 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 v4 net-next 02/13] dt-bindings: net: add i.MX95 ENETC support Date: Tue, 22 Oct 2024 13:52:12 +0800 Message-Id: <20241022055223.382277-3-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: ff2f18f5-e723-41aa-e8c8-08dcf25fd427 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: yyjtjQWylNt9ysK/wK+Zr/nQId7QByL0JHhYU9fT00L/yZevrgXm4MC2A6aPUo7Wah/zUMVej4EFpn2LzlZYuuju/wYUJ368+B9dJQkCNfAJAzoNuoH4IuEnyiFtCaboeo//nlUjqKEmCQNOpGDZ0A4iAldCoSqIG4uOJNYC2R+LElIAWqdZ/OCdzbj2GmAjiyYou8lA6BwdbkLB2f7vrsl4V0Jw8/A3riJ+c/mNnJ+P+0geE0MZb71+cCGWnyj+i1YASOTwQk1VEmqOtP7JEIhmTItoONTYBreoXgv2VbDS6yTeXBABm0DqBuPjJks42zkO25WbmaZr3Mk2LmD4FJ8Lw3mBClDb4nLAIozo+YIWmWzL9HVe3J7tUCe3WUhsp4AYdobctYTamEjfd1Ldnw1d0K7mK6rt2oB9adlL2c7zlntYjkS0HSuasRmIseboS7uNGaUs8+s3YLtZ2OrCd8ZuC1Ajwueb7d9NsU5DIh5CWI9aq58nBdym3SWvRz7IjM7srfmT1hb7x06mZAiSziiIOUBN1niUeJlgDVEefgQLeYFn8NuqHLVYHEQDrUUnc4tX7JfbXf8fDFIToC/tUKz7z3stRmDgpLi/vQdC9xdPXenVG3hSuWq8GOOgqJYFaYZuzmxPwL+ur4DQqtssdC4smzsT5+qJyMbPJkcPBC9+4p+qVJsqh65QjVZLKO/uJUnjpRkpQ5JYp84b6gfgZC0vr5YydBnc3YMO2vnP64brrEGM+rXvOaaDcAqyQcqVGezPbLIyNa5qMenabfvsVKZIRWbJjnY2/d4tVnQL9AJFO+q9Hm6k6IqQUyxQFdQOdW301xDMQj4/zLd6D5w5GTrAYjPmc7+NLAUrl8rItlUJ4OdKfqmxACNoJ/hziIquAmsRMd967f2+qujLC24EbFF4BSc3L0S63l+G0oLCDpBK5HUyXlh0eSoYjgq17h0IANpH6kqoXOlUvt8WaeWgxTnZQjr8mpgd+N/25+FEYVY3m4DXHTuN4fvT/s2zlZ09Uamiu/9WTYTNvqWPkBXYlRenO4A9Z/OVELD9nQO5VIMo66EfU5VNc7caB5jD3LGurZDO6lheMVFMoouSm3ypBif9pdHFv4/q0EucqfNGReYf7/cIxX61ZG/tBP2XNUvWMGlR/mSoJ2f1Aea/kt9ezpfAMAJO9WquGS3QRm31hXceixyp/IsRJJB1o01D8RnMROY441sNhRnk2F+R3890HpxnODzWcwIoFkHXGc1Matt63AJ4Lv+odk8x6hbE/Cx88YvBmTKEWGu4SqR86G2WK3Kj0os6CN3ZzfmxiJ/yXQ+2CF2RUS35nlyaLOAQJYzYxRuVChQIhRbrZxAFpmXODOvNu2Txr1m8KRzlp1TJe2qZsFfBgEFU08Yfz22R07VZ 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mraN9I9fJhh7zLxHI61Kk//LT00yYwV3Yro7WUBK/2qdZjjuQWz8jxugyPfzyMq1a7Cv24JL5+gXrNryawMCyWwttWng06Df01f0hLb3JVyWqsSN7fecIo9Hwy5UumSeVW0nYHmqlL/gRENqdR+k1aI5Z+Y2uzskLYmGNIFdnOjVlj86rHj+2b63mfhkQ6ZpnvMf7m0034wUyL72I65vt3roNYB5LITB5LyeOH97K9lmDZE8Nm9QSGvCFuj7dHQ6xCiJ9vSWfStoC83X0mRS2n/egPXdB0Wsi4i8KKMGZdWG5HHvygSXjZVaLXyWn/4o8fa19ioSzcTLh5wfACnUYH8B++yHk8MzShNfp5lagG1pTc6QN5YmIhKP2OMqZt2WK3u6sdb85jE4jgQtrI7wgCoQL5zSLOyn34T2nCUx6t6SOJliCdFEZbjHCwU+87K4hWNs00sEGqaaZxLIeHUgmpj26WJdY318djIpp3RvoGLOmK6QSx3i3vg8f616/G1DluL0f8KGcDYE5M4Mxu08VFxYGvzc7ANDS6BtKJlRRntfiY4CrFpf3KHDTwkQdZcAnPuSXn9j+2mnubVgDDENAF6wBT97Uho1NXhB/tLygr9n67IoxbAK7k1Uph7de3Ah34YdY0Dn0BZGwt20RyrJx3ZNOytEvO9LnGd2UPnLrMoiK2zgTi2b6XRzSK111aBwrSOmdfQYKfgece9UFmVQOS8JWtA5+HdcjDqMhAsYO8QPvdxjqPLZ5XqOeT6Dh7Gpwxd+rQQyJPDHKse+HXEaZeHtTuRh31RQyWJ1kXXxuTKTw51Hz1/qC//1pmScOrnTlQEDmaDgHos99rNArQ6WEDoyDyHVB1K8btmnDqFQRXxzyvbAZBzgrJKWvySsxi6BVCT6LRkLQRTADW36R6Wop7F6gcenD2kMxRA3t8ySgJa722xDYhdtP7AfneEKrk4K0BxSDRCvU7kCfkrIxVnpft2RBFpJ4YhNdGCOOpATxVHZ2U+Uvmzs4lJ/YpaTZ6TZOigkJhDVAs3PNsZVavk034wYcYojlwS2seeVdIsJfe7dOO3cXVd7eGQOHJHmhMVx8DJJnADnt0VEjW9y+3XV3qw6MnIr9jTYk9bP6/FMYTSrYSyFUfq3Mwtvrh9Odp1DRnWcgawY06tkm4dfj7AV3XXSbwtzyDFcetR2KMXQY8rN5GVmbfkpXajXJLAkKMMZ1twLsHALXf+B+Jseu7/4Lii40iL1YMl7kaW6yzts5cisME6nyJ+iQf6xayQ59OFLNr9hGYyWv5CTdMNeNelCrjr609g0qJXYs3mPfgZM6lcrAF8KPrQQ0Fma3e44nTLtr6ue3gvhfglqeNUfVEc7QLzzGTPCg4iK4q0gKXSGf2ozqaXbv66xFBeBOvyYlhz8IXwg/Z4aaR8eSTtigR1MU26dwtPsJqntVKeMpzrSZt/Q62N9VawjZll6zhn/BWI93TTfYJGqLGChSgv3+CNDs0JEmJuvUwuhRGzwPISaEiawHtMYKaQtChMtfK4nb7NEc5SEwPuMDU7sr5bEMN1mIcfLMZgL5qGFxDy44VJBqFLWRYobw0iw+VwZNmBIHxfl X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff2f18f5-e723-41aa-e8c8-08dcf25fd427 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:07:38.0600 (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: nsMQaCk5snBg94QItredc05wQYZHUfyCFKQFsB+siBOxqkqLe1WMbSKUWrT/MbFa7kXmiHDlQ7pA1tQ8cVPuEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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. --- .../devicetree/bindings/net/fsl,enetc.yaml | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,enetc.yaml b/Documentation/devicetree/bindings/net/fsl,enetc.yaml index e152c93998fe..7a4d9c53f8aa 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,24 @@ required: allOf: - $ref: /schemas/pci/pci-device.yaml - $ref: ethernet-controller.yaml + - if: + properties: + compatible: + contains: + enum: + - pci1131,e101 + then: + properties: + clocks: + maxItems: 1 + description: MAC transmit/receiver reference clock + + clock-names: + const: ref + else: + properties: + clocks: false + clock-names: false unevaluatedProperties: false From patchwork Tue Oct 22 05:52:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13845162 X-Patchwork-Delegate: kuba@kernel.org 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 3819B1487E9; Tue, 22 Oct 2024 06:07:46 +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=1729577269; cv=fail; b=U7Q9uRfyAGtWnvjbSZJC97zeNTCKzDlJlOvX9wqlboLOSHEtQdJOAo/1P0Oj7PtMe5/UhCCzgBrSTKLFIhtP2g5Xn7pZZc9hbOQ0BwqEmFEy4sB2H5I3EsJqMy7Vh0n3fux0ACsXRN/nZGMw33eAut8ne9mfbxCCwCFDRHcAZV0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577269; c=relaxed/simple; bh=rlthEl2BPnZ+tmIbGJne+j7S6Rtv03ym8Y/Lgk9SN3Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=gXl1IEPb8en82Z6zA16DQBYoUVJxlXjseIqcVKtv+AWZjOtFDPCnKVIfyTqrMXOEE6C7m4WFzr6eH1GTGL38sih42tBSycTaWt4EQKhfoVJ32RxjhcH6FisXHl2vkF1XnlHq7cK7zABQ4ofssn5JEwMbVcoEakGeeMO0bSLn+xY= 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=lrYykvdF; 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="lrYykvdF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a1K9Ly7TCQE2iw2JjkmWOW+l76QTIPWRm9rme0r/HU2aNC/TVWd57ulNszdeKDENKiBTOMj+Cn+9dr7kn3iBnXYtsiFHJnpkC/g+6+KzbJm7RR9yy3PiAd2PwCXUwDBMfLg81xO5+o34uXBYV/nFofgtue341zLiDrD6gZiQVQK/up0hPcxjX/t+Hpbkd7b4+3DLRrZ1B0jsfHwiGfDwdKA2RqM2WsUSaVWPBlkXBUnG89W4FcXguM1Lgs0eig3H2m0RlWoehXYTOSVowgRfmYWZWKKFu6N858ecZvpHYh5VtIvKLUsbaEwvEVL3kSfwotCXbRQbnDmuF8IohvbYgg== 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=umGQCQ23cEYT8hgU/0fFIANUQHK3YQXwJQbtfW3iAqA=; b=YhnoY1E7E2ns7y7VeqTDC0+7OZoilDS6pJsO8/k1bEDtT1PZSilBluivU/pc5sNQadkwcGoEA+0lI/b8P1yBg3hoE4ZXDlArernFk8ZnfHmkV44fELtYgZb5DjF8wj07Te0uMKJFjUuTCsvMhiigzW9sxGR8rWmNYY0/98fpvTURayLKhYBk+l2jdSiP45UjCSxiE74dwrj/lh0MgE8qaTg8EoTDQ9gxd0KLZ7OrDYYrdpXOFg3mpiogf1iZGznz5junyB26L0cODvCVaPMWndxIrsDvNLTSvcZlbgPE9oO2/EHfZSe2/zLmgcR1q6F+lLWBxRmm+3ealVmDT8kW0A== 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=umGQCQ23cEYT8hgU/0fFIANUQHK3YQXwJQbtfW3iAqA=; b=lrYykvdFi8JsFYxvHjqosvGkwR0yUtqORgFgWZYHrCTZTcy3oCRejAAFhK8mcuz8o4wdZj0g/8gq22Ay5loL1PQwbGKm5JsA9wCYXsKBwoeVBYm+j9VzzbQ+Tp3RTU9qhEUwFfjppXrCiuxSp2UlOh7U9phwJQumIEqsEPzDk/7AKCgwyHq/06SgFNXmedxZMusbuxxCg9ieDnmy56KHYPDlYbEnuEutcSalyFDT88XT5nFtXbzwkAgC4TNRwmyR/9wOo8YgZ59KVPwJ6STMFOGG1sBi3ajUdKWW29eDhrY2oD0rvu5uNB4QWDAEnH3C+at6D1AVgQdS1uQ7hpWaaQ== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:07: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; Tue, 22 Oct 2024 06:07: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 v4 net-next 03/13] dt-bindings: net: add bindings for NETC blocks control Date: Tue, 22 Oct 2024 13:52:13 +0800 Message-Id: <20241022055223.382277-4-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: 96335c5e-33c0-421b-793a-08dcf25fd833 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: Ficl4Tz5KremWJriis4Zp/2rLTvLyhZkX8tTh+Q/osqqSits9ZOS7QmA20mKCWEVInoYO8jCbLJtBYinKlMbVDHxXz6Q0Gw36eNY5wDSF3agSRv1jDbtDL4IoZaNY7VT3RfQBPw3STniMfWd7HM7Dj1wkAvQhHqsYNKx/z+gsnvxIroEdVC7Gz+BWF7ELka06f6Yp7c06xr618PgzlUbkcVT5MvB+dgOBQN966jRwGpATH+N31EzijfnyeK28x/xgaaNNvK+FNujtuIycI5oHgdWNKuppCiXJWyJ0AHsKqtGP1QEE8kCb66NhsM8RLA5tLswZJDRm4bytx2+NTdvoJ6CeNvcur/jy0dG5fGeTYkjzyrZTXArKdoAaPSKP3W1iA1X7DYiDWG60NJIXqXasjQhwLjgUZ13h/uQKZKuwePYuyjzk4Tt0UiM+7q3XJX6Piv/0k+E6EFDVSnM9WknJkHyN75LOcEP3pmsPuwgxxSIdU24gRB2ddRep18zn5R2SfxTxQJKCq6IOyG0iyB017+XzHUL2SHd9v6xeJ8TSJFuYbyGFOgbMQRrZ7lJU/0+N8/yO4Me83Xuy1DPqwuFG/V7HSKQW9SRr14xYYKH6DGHb/lyhsulOaDeiFDC7qXPXStIhAqFNDE4uZlbTdMUCDhluA01qw41YmHKOJpIYTy27HH+ZdNBvVeuUb+ssDC2m+fDLLPr7ym0Mf+N2CAJ9Rx5S5LKNDQlDZX5FMkyKwhQsZrptlu7XksB3lVfxKx2KN48JtXyXbME6JJq28SaDNcbGFS77bjvUjvAiVg4kXHiRf1yWKyOTbqqnnRMWlbKkykluISm/acvv2GUmfidDzc9WDzzeh7lIxNeYfuqKt8soVgAyElx+NOGqvShnjg0U9KKy8xIfK9hKoLZbpUUAUtBpnkZNPLCkX5fkAUlaQzIth9pIwVyr4SeozgePGoemGKN7zIFq0uKJopq7QNWuB0gWo0pw4OlW3xRsfYs7o0iVD62Ru2IA97oE3fFYrA5QZzjGIZ5NCsLA7vOfDzOIjijMWNQMt21/qFZ1pZo3aWDBxdSNAnx4LVqM7TjaC21ixcTkhCRSmF6ilb3fVKF7ARGxtY6Nl0qKIML95C8jWw2snQzQOXZOlNtBWMf7fo6FiG3tjU2bnCB77WP8+4d1EEyWo8CxSDBqXxG38JqGiWnq7Pqj5mGy/2O20y+urxyOoP0lI+/h1BL0WKCVtCBQnmlr3ysndvPsUNYmoQcJwmqyOl611/sPieT12s9T0YGG+fxu2z2wam/6AClyMuB0GH9jqLteQMzfc9+HNCZdI7KeAPs4C7mh5B04rfZlek6T4kqIbH1KE+eNkB/O3+4sQ== 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QtPWlcv5HOx14DxgPLLo7ZSDX8caxTWV6dX+fcyz9VRGiT8XpsLIBhoQRUpVYXK1FZ0RQhpVXeLpvegIrijQdnUjvmlb/x5YE9QvujP2dlGbFiOlJ4HgG68IeMr3qJWGxu6nzAVo3s+ryMnKZeg8QxMlvbNUBbIVjC3PU9K9fB/nKU7rHvwFwW27G2Ume4rFQ6sLVi53RrX+BECU/DqD6zPX3A1cPmYhyEGMFuXT6pm93m5d/A7C6hnY2unBGjKd9Ihw2xzHFAP8eCa81NGfcWjbVs+Eb7CYFNYpshuelaPXghTE2yVMtP0mktAexQr29lb8ewaG8prsA3gi6lXqp0jdOGZgJ+PWo5leoS7WQW+9jAHkditAUVSnq8prM63biD3jUfdBzZVaUXKIvLppntfZMdQIVGHn6UjlXPXDstFwsdCaQN0CKIqGlwJu93c6+WNxrbhFp6tZqPP8VR8oeJfgkgNQcZ3HbT+rv+WPZmP9RrtU1POlrsKG9RYq233aUW/VrWG+ViNKFFbgMhjze2q2x76LN5cXpTVJOrZkBG3yXu7n55B+EzRdw2QJ5qoHSkek6cDJDkbjGp83uc4olyYrPD5JKItueiA4+oIxqIXl4d5aBCj3pnsbbVuF2o6BCwL2CUyJR4crR+Z+pBPVaJCqJ65/C5ecBaE7HAjeJ88sXruGfhS9TzdyZGC65TBiecOa87DMNzPR7H5fxWDZHm/7QapsBK+JA42YqWQVTQF0E0NuLVodyqrlQCpd9FO2TuhUGE4nL0Tn1+3tIFjErHkkknmAWSx/GazxABC/lbG4YW2QplC6RQlxd9quCtkrypCj9vszhs/83IxrlAcltIv640K8wtCg2V/P0/A53yl5k+AoLCfTr25UBKJl7ogku48+vM1nXFvgLaaU+hoHrPRiZKGfU+LlUuB8aCHnDlsGEr2PiWpzFx9yC9fmp0SFpi14VxLMxP+UqbL5pWC62IlvjhmgQk8t6sfvCSTZWW91RnFLHl9/y8Z/1nc4U1Npr7/m4Yk7IVgi0AIUP8tRxQNWk4VGs5dF5alp8yL+dfuhaokAO4tTMAcdw2kuXCueQIdZJ3CbDdNinMjgwkAPip6XwDrjIaMTmeZgkjXrHqU+jIOUwrOh7qb3n65QRLeP4TWjCKmPC71/iOReIhySjfgfKEe/UFU5HjuANw4WLog8TGMQoZFILpXITjidEolb0XW+h4A1KYAc6rU4SOxXkUap9NH+ENoF15KCbf9ZwlfUWNEVgj1wT9JgsTN10d+G6rIkl3QOXi9JJ+7zTugessjeEeppNFF5l33S8L3g6PqaYTDdBWfmt+6mG8P2oUFtA48oMWwXmrHKkN4tUyUGdWeonrjII9qwU5nVnGrlxSlSC5khYvbEVmhZNnzCVDusZxB2ljYF1s+R4sPJOhBUIpMv6SQSYPubmCv0V64lED7mqquzXyiM4A1FTDEsKPn1YiUb9bt0/XlO0Y2gNcM0mXt47MENbgZc70xq7wFoAb7kr0bdoH8KVcaDANAp2fL6cbheMJmDGQAwXv7epKLS3rT3pN2egv1QuOnq8ihW754/SvmFflfA1+e57KSOTTsH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96335c5e-33c0-421b-793a-08dcf25fd833 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:07:44.6504 (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: m96xjBdG3SxxcfKyvxpIRGgb2hWdcBRfhSRO5g7Bn5X/S9tY/f2s5hHlrwFzkdVODJOVSUYlM7utL8v3Yniw0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- 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. --- .../bindings/net/nxp,netc-blk-ctrl.yaml | 111 ++++++++++++++++++ 1 file changed, 111 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..0b7fd2c5e0d8 --- /dev/null +++ b/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml @@ -0,0 +1,111 @@ +# 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: + minItems: 2 + maxItems: 3 + + reg-names: + minItems: 2 + items: + - const: ierb + - const: prb + - const: netcmix + + "#address-cells": + const: 2 + + "#size-cells": + const: 2 + + ranges: true + assigned-clocks: true + assigned-clock-parents: true + assigned-clock-rates: true + + clocks: + maxItems: 1 + + clock-names: + 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>; + + netc-blk-ctrl@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; + assigned-clocks = <&scmi_clk 98>, <&scmi_clk 102>; + assigned-clock-parents = <&scmi_clk 12>, <&scmi_clk 6>; + assigned-clock-rates = <666666666>, <250000000>; + 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 Tue Oct 22 05:52:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13845163 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2085.outbound.protection.outlook.com [40.107.20.85]) (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 A2813149C51; Tue, 22 Oct 2024 06:07:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577276; cv=fail; b=eeIMnaMywu/ha4oth3uP6FY8epFFDhiEWgSfYcWKvr9gfLlmN4gKRmXAQHCn6edBOKHmw3k6KdVBtGYmfl98ZrNHyWHMCf7BJwRPAGL/GCHwEBL9HYxhVgYFMqGIQk/i4FNlTwRVZxqlySu7Sn24vTpF3oidOR0V7eip5S/pnmc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577276; c=relaxed/simple; bh=EMe0qxhzkQNzdrM1UvXF7Xb1oFXJXS0WTTygW+049Qo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=rTCyEZXO6zNNf/8tNAGJU6bKpRfC9+CTMjdazejKeehnD4oS7lx1JZ67JA9/tC+DLtCSIydeXS7GvnqyFuMlwGAnBuG/KaAM7gQqxiz59NmWUpYhEi93SWeIhllF3XXtcR7/69wnZxaHDXuVgGDfJ/1An/IM577gGhpGtLE1W6o= 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=gSK5Yo9o; arc=fail smtp.client-ip=40.107.20.85 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="gSK5Yo9o" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=flFEDzZxSVDa/QJJN7QbzDV5ooziVpWBrEqsZvxczNNVIDE35mm/DDEjW7xbmkGKwOxR9e6SrD/Y69bUP6tLLJUSVSXWQWAauvdn+0wGjpeycDK0nQCILIU2ut9xcnIfQn+6K9b0h+qCk7/vEb5z4LdjxkmD4J7O062a0BTPU1JFqdVEOwyadxZ/WLBq2jR3nOBzxK+4R+z7OGnQClcxtSUI+PO7xdONC6gnAryMcdQE8HEXf2mlC7ABy2j9liXSyhDhMtpEuUcYzAFC8r9MXHnROZqGk+PQTxb9FHtwbZq/AsSZ7VB/yjwKexDoqPK47awYOXJmANu37C5roY9m9w== 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=D0njtcfeOs39sheiSPfv86/NXkATMpdr//Cgps91jrI=; b=TteMQbc2/Do+0+UMNbcOlNDJZtikZIN/2hSbmhB2tALzXRVmfFI+s/IH2tP706uR+XN7J7wMySjeVI9qIh0NRF7RWH7/29L4OeWHPBdfyPO/78hb0jeH5YqXxPz0kEoa1NEXTPC7oQFPKW0s+SREu0lQflMDRLpa85Z9K4AE8DN9/TIrpixn/JGCgnpu/4olA37C4ow7exfAOGXOEomeoj0V1ZXlbqHNdL14Dy/k4lu3Xzjlh74kzsr56bBJ7ExqrIN/crVR2awHfIEdTpGDaW4th/zUc6q/j9ML0JOeJSfgFqedHkMsKutCJVwTwveYc6CUUZfOIJo5PVZYhW8+0w== 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=D0njtcfeOs39sheiSPfv86/NXkATMpdr//Cgps91jrI=; b=gSK5Yo9ozF7Ggcx1FGNCkahpmrwwo3XELsmpWBF3i6L+6TkYQu7iUw9JswA/k5KsKHIUS/x+f1FvWsWniEEO+GuhzwB3htHb600Bsecbin7CRRRUb5UYwAjiBZqubBqtXkIDO2boxoFfi65189UqQec8XRK8onEgp5eqXKbgcT9gjjEr7FKq+iR1kwlviSmuLH6WTLjmGDRfxZfr+bw0fa1hBvKNyOVwRjJjWrj1ljNmXXrhvtT2qDdB15oRRuHqK8uePNq4uD8EtohjJQI836CqoDIDpcdAUXF7MuVYwlOzYVate5vye5zSNlSoo0Oa7y/3oUtsi87zAGbfHN9FZw== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:07: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; Tue, 22 Oct 2024 06:07: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 v4 net-next 04/13] net: enetc: add initial netc-blk-ctrl driver support Date: Tue, 22 Oct 2024 13:52:14 +0800 Message-Id: <20241022055223.382277-5-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: ecb4edca-69e0-4943-2b04-08dcf25fdbe6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: Y65oLl3ZnJyLekszxeXrvMwQDDvTNd9BfVCadXm5b8uKaqcTK38HwhpTNoV1E/lVJpYXMp5902tCKNucHnoXcxmqg8ypGAQKDsbf9TSv/9kEt6Ky3SLJbXHASAxgIRxlpIThG3boXGtUXvSOvsbdsg3CdWmjEx/T7rMl1n18chdJ17wYJO+GOWFbifz1H1xxHqALaI0Spu20orXbF3zJUyrt2Dysq/P9Pl/qq3HKL9GAM319eyUWc26zxPHP6Jk8l110s8PuOWAs5RaTM3zHAJ87hI9wVrcLZdj4zjvyUA/vRe22/vK7ytySq8QRXfd2RPnreWHaUhrBDIpsI2diGYC/I8lgawZkFvVKnLs2StjvmmkJsdSMPGjPhIkn2Ecym6DeqeBsdiDchbIWWtOrnEGyP4nZi8mbem6WOgkH/F78UWjOP8VdDvb5FRPexUiGngd/J09zfQCaKiFszADs0ACA4+rR8L0Jfu0+zPZCGUQhDZM9LArLXDi722vWmNll02/R6J4kh3VYPT3zhRDTAZYNCGQ/Rkg/rpkFexgrLQosenwjrO+Pyv8Kjw9AQKjHJugpQrouga+ekToMzbh7DKx7JxHblTNuBq0O+Op+O3m9rp9dOZBfBLLQkHSQJ9A9HSscBjqDOHadLyNegLM3Vmm7LcvMsqhGgfExpcJwWoOelFzxtCKdHKeqKWo+cPnP3+xVFfWlQY9PPxcPUhokNySoTaLRk5N+Z5jGDYk4bBGNOaN2V738u29+N2JbiSl8JExGKzGixM4blE2vLRqrM38snZRk0zZLleCG5gYv0S3V8nVPXr49jTHBQqQMtdbt8RSi7vkSnawkTzYDu9BjTLHEz7KGkUdKpd2mCpSbzendECxobkuB2qRkNL168NQb16r7Ku71yor8f8IcBeehYd9P4C3EiOhRt7k+30PG61q/domh846iyLAarD1HMPp6qbtV7vC4uzZNFsx0ogOJff7nNrK7vk2ktnaaoB1ernBzendlUvCPYEmaGM4ODUGSZStUT42Odw37q5HN0+ARBCQdcPIZH/U3/DsfEMjBlIS691HhvRy86KN4ZZ8NXTP3KuOOVSSY9HoCvTdriKLXZhRSGFce2CZQzp4vRmTOuzjukkaTr/yLjj41eNpLIfX/ACUPhaNDWjhPOLa1HaPwhbGKG9fBK31kfhMj4KegtLRhaIPsFY7p7kGHtNOrIOyiAk1nRewl+Bv2OwJAl4sLnnDdbq8GBfGXJmkQ5l8AoqSqIptwzNsRfZZUUKPNt7Ysp8nmLY0oQe/fDYMQBhg2QbaB3uWW4tgD1RzvWzIVTYWnJQOzKIisTthS8yHpmUgz8JAX27FNyGBtx7JAKLEIIqp5g5lANg5eKh2kNaWmwQaKXwBjtF0O68C7ueSb5zjQ 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RF14f2H4jliovwA6CyeH5K6ZYoDs06uk3H/2ORGQ9oxH/LtrbMEkWq/jtX1SAfClObsaR8j0DMU54pVSnVuA7vgva9EryPbHEsowEYUCNr3MOHkOhEJkg7DNaKXCUuX8DSFaSPfNvxPkLY6PWMb6p9hB87ATCbRUzalOEtYkenUTnn7zaIzF1v6gntOj2YsdukEiod3KeYlfgk5A1E0YaHeKIq6bYRx2PuCBqDf3uzA1wk+gpdKE4sJovKa3ZLmhJZg15LX2UxXZSpMlN77QllEITtBTUEAXlL0IKrSlJYBH1Hx6J4r9r9LcDfqkButhD4Zm7vIl51/Bq/P2gKWf8c7glaJIim2hsO2b9D45uoZgovdy7uRWQMh7tUOELjdNspDp+n+1Kj5oSIjvnFd56aW+yHqT4lE4EfV4Er8taciQJ8uxDPqJk5+C/5CrwdwtKuliRXr5vB5VM+R6ZnlqUsBjQFIvfRmQH8nKD1zud2A2uGchejbiOCXK6BLDxBUmu1z+poZ0qjir86pRIdt5ecBu4jn4AvQGPKvTI5IEQoRkJFpwbOJ9UC61UJ1RraWZOksjAHrmO1fP1+iutxBenDRHRJBRMyPPC2YhV//hwJySguayQFDz708YmnukpFwD//lNql1dQo2cPe1AVF6BEt2Kb0mo2eEm4h+wbf4mxYL5EoVyoHLpBOkEerEFFbTbWmY/Tlif233Wjkhr+FaE6TVLahN+M/yLIBCvxUwj7323fLqyXRl0XdAm0IE/tjbOoL/UNKGxY340TZlqZ9iljHMny46o2UMTt0WuTVVEyD03KXtIMzOlUA1AAS8v+3Iq3aVNZ9QNFlIsdonAPT0NDgG2lJkVkfn8Rj5AzjBzF2A+EPqmWorBJqbt7hyxW50T1Eqf0WK0BAyTM0rjY0JarEfwDTZSraspSO34gUvQa+jtlfOrBAu+zZbR8u2JRV8WKtHGQm8x2b1hrCGkngefcoDnPxQEnkmBexc+zJ0osUb6tAuOW4NEs/y68FocsdtGWQCNGBrDaOvPR6ivLCQl1HDaCBbQvlk7g3hbVqarBcDpqjlH1cm2A14PdieRA/EEKd5OoWTyaUvlOeQJgutScz4ojE+EgzMnOLKOCjnyfl6e0srfbRjfl4rwee9DJKU/RqsZsUnwjtpWEwkgH6h9NMO3kN9o3HxfWg5m3O7N5E1+hYFjQWEgTFKkNTvRNiBY5rQKhKbkfLZtDjZDscomcZivLVKvrCIhE7r6EPsvE5u5m+vLBRlYuJFSYQzE9/6rBXOTKHucwNEIYAAGUF15PfZudzN4bU87uIdFtkenUXSx0Gt8hd0O61qq88DRboSSuaVlnRoyyfW58Q6+/MbuLGmCseY1+Oi7qqev5gGwuWt6Wok/LkyQed3DauEBZb9M857/u3h1EbBiJMlnWPO9GwIVnr0Dk354zf1IiHQHlzZ+ZwKs3ABMwOmID6OeINmsyjcASH2817NgjU96hKj9ictA7bndU2FF9ilwMfi48FMsaQMx0/E5BVnKqpoztm/5m5ErdwdvNF6tVqOhaSszrdlxPaLiGkaK7warYYi6fqLEc2DyxHgSetPfELpcNZRx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ecb4edca-69e0-4943-2b04-08dcf25fdbe6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:07:50.8577 (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: nRc9Rea/YtFy06EUGQ7opJclq1RrlLV4oa2fdPM062OGYe+P5PW6xRID7EEORp3GFfjkBKdE7A0a5fIzD+gWLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2 changes: 1. Add linux/bits.h 2. Remove the useless check at the beginning of netc_blk_ctrl_probe(). 3. Use dev_err_probe() in netc_blk_ctrl_probe(). v3 changes: 1. Change the compatible string to "pci1131,e101". 2. Add devm_clk_get_optional_enabled() instead of devm_clk_get_optional() 3. Directly return dev_err_probe(). 4. Remove unused netc_read64(). v4 changes: Refine netc_prb_check_error(). --- 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 Tue Oct 22 05:52:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13845164 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2089.outbound.protection.outlook.com [40.107.22.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6676C14B97E; Tue, 22 Oct 2024 06:08:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577284; cv=fail; b=SkZp5ogDeG3yeQvSDVVp8UqYHjkGfpM5vRzmoqrahNUYwJRyfxbERJ0UxlOL5AK4W/+3/GOYxsKJVvHfEnEzVwXRzJqUK5nao6VAEHTa1HzPO+naNGIvacuoDBkqb3arPhhODQbzVBmAtUmUFAJK+/6BItCq0OyFGw1QQBDRVl8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577284; c=relaxed/simple; bh=uYsjQa/qmy7IDvF2d1b3fbMPz4427kXaDv/f3ASQf4I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=dXdhSZApRaKjX/uulDMIOd7PHxJLfY4Z3YpI64hCHypNBA4kv/AZABsFsYlj00fguloRW2NN8q/DtG+0ZrzfOgrMf+6iIAEn0g6L38zhBeafqh19jiFtyH+nrR8iQ4OUo9777ym1xNmIZApzvbGuVMmB39FZETjp7bpGB/GLcgk= 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=CUttu4+X; arc=fail smtp.client-ip=40.107.22.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="CUttu4+X" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kQBJjDENGrFclqqZ3aJsPLjevy82K8DZtvYwCxgnXkxSiNbzDqoc74g9LjO2WVQHFhlBnJHNZ3IK0/lG3IF1M2mWKkmuwdRsfRI3cx3Ij6v4mJADJ6ytaBS29JOI2SM/9ybdU2GOoMe1QuR2wn3DfSVUtHHpE10eSJZxRG7saaWa6fK2gRqjaq8GBHAIcpp85hOaq8GHqCFM3uWaH98xMaxhKRocQZTQXDUttKA7PLHrSI70OPb5zTt7euMGtfZGhVsT4FKnutlO9A+BFbn9U7ccOe3iLP1nvAdmISbsorBVDa4/cOSjG6Fnh5w8ngmkJfcuQ0BQTf+I7EdHqMeEvg== 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=kBtajx33MVZPH8cRiMapimFej7jojqkw8puUQEkQDRM=; b=sgMNe16If8yA+HFx5+DRj7FAyxYp8dcIuzJ6AoqkUWhA/LolR6zuQE7CqQvD6tscfa1yZTWcPzoXEZXraC38GwEyXZKAXTh8JCv/Blm1MDa7DpjKdEvEcI7oVlymnJ4qiZhcafEyPzpVd1g2qGevjg2n+a7SVZGj81dryyLI+u9TAjJoeelDoCt5CQJXYUkLZU8TCGk1UDvmGxct3raT1n0xYrqO6sSDYesBlm8x/9BLAiNmwao7Te956OhPQ6eQux8AKHtm8yp+Cwh75Gpxfls/fhOZQnBC2v8ZbpZ+OHb8SqInDyJSDHFGXGbUsQNOwhaX6JVvIaZjd3rloyVcWw== 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=kBtajx33MVZPH8cRiMapimFej7jojqkw8puUQEkQDRM=; b=CUttu4+XQz7iF8WHJjbfEx0boW9KTxYCGbEfnQikrWrgjlswAsQWvK04B4ugsjhDzgdJyaNfyTzw3dHZE2KGFYEMSLY63g5nLpd6giVoduoGOJMoqt379mc5UB7Py+WPqyr+Mxu/SevjrJxn5G2CAdxiFTmCf2LN4WY1lt7UWCJ/p+3RXhOQs+qvMyfoSrRmEJvJQzVfxEIeZtsoROG65UsGzIqGCLSJTYTd3MarhUCXbX5Gc/R8GHHEyeekkfrTjoWwlPXDhmcq57v4NlVdgvSNCJwV5J90RRhVTi6kqDlHAz5RQBHUWUc7wb9vohDdwGksoAg1R6T3Arwl58TSbg== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:07: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; Tue, 22 Oct 2024 06:07: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 v4 net-next 05/13] net: enetc: extract common ENETC PF parts for LS1028A and i.MX95 platforms Date: Tue, 22 Oct 2024 13:52:15 +0800 Message-Id: <20241022055223.382277-6-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ddd2098-54fb-422f-79c5-08dcf25fdfd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: 2ijl9KmnGI6VPYEPgirQ8OCEGyFaPGSPhxIw1WNrskr1cGaSyYHAxWTpawgb9t+fr/eew8/R3nSkHzDk7ARra3pWWWt7cJ7UOa0hIOFt1xdLdjkir1wVQZ8hPuAaKy2sUQOo87fG8U5oytzIMT5+6485XV8V1ADO/j6ElvsLNBENblkwdI+x79eNgJf9FUtGuAn5fR6EUQ1iK6PVB6XYkTNUfDduqLR5AKmNXZY6l2qK0weav6BSeE75hEZPDUEL2xfZ6qkhdkFoh4nq+cC1LW3dgyuQR2Ofn7j1/LhouJnAx1PyNgKobhJ6j3lyewroTstrpXk52K+bA2CjTsRJsxrZi4b73+hSBFpQZho8ax5t74hli5tQuhr4NH7/NfQJSwb7FHZRtQc57r4MQYyBZkxaf1UMPFd2I8upJZM8J3+MAX/v8OKKY6nQZW1tpNy7j7zxORYHRN7Oe0xMDRhhSjY9jvS6Gxz4fD3VnBpROQwS4HXBrCjr0obapAsUY94zZ6g1wo6vGoMdYx9Jkc3uwg9TlNwPYARYJO1aACcODtAP8okYAJqsnjnNnbB4Kp8Ct4dhxWitKdPEfp4KO966bsPYCdGmV8P+6VPKhxwjPO4/N55LthYNSk0+1VXSEoZHt/XbvKxJmsX1N8d68+/yy7SGrv9DDLDCLbTCO6x/LgwYX84DUq6Z6BYTVrJi/PyLyBX6NOuxvOrMV0TyfIOHRJ5wCJmapC1CfsODDvk2994dVjksxVi57tKt9ELe9hk6TlBIeiUXziUeJbMskikkz2QJoN48ZANL0bYi0lDbcVI6MxCavn2MHGTXkZUf/EQG6mXk8jGNBGBlPB0OrHGvKaFnH+i3SuwScGincgMwyC9RqmZYdScpZwjAXN6nbzCRn5IzrQQxZWXFcs5H6i7rFAVdMzc187DTwj9560DooajKHep7tx12vonxle36zo2aYCtTGykn1jSeVt3QsJUo3NhCsQ3vB9rb5GxiMcNKky1MPk4mPvSNvY/3iS5eu+xufibIPkhGm8TmA7xBRNPT6T005vpOyB42tG94y24NdemBYVoKIpjmHZMdNX5D2mMjdYmE1IAr7T8iWDQ9ijPrHQQUaUmXqY8rzqvwUWDmc7hE0SWbIXJm3nJMN2lYSihxLU0vGgoHOLQZ206nljCFFT2ofTibp62Z8Pr8oYQK1SY9nlDG75Gx2XRDD+/LpFjeDgsg1C9aGVkrI0ROX1djH7SCKapYliZFfRO3POqA7pLeJxHDU4jta2eA/hfZ1pCbHEZDuiKRDUmvZ7h7tjEjU5aA6bF36ET9+IJxiaNWYYuf7L1Rwr5X7mWghIml9vVrjOOhwwiLs3mKT5iYk/keJzFpWIawzU1YhsHEt2qRpoX1yd88ezQ24KvJ5OqOBAZQ 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J0K1A9ECcVuR1cdGnoFOMOP8C21qfBgWqs8SyWj/rSunPaWQIZdCFDMZcai8I3qIgGJ7qhUVQHIrtsqMLXvCFylOWAaao+7vAcLRCg6cTU7gHGh6iZZoG+J/De9qakPzZPIlJS1m4z8nE1yWWUH1YeGNVzzbpIISWJ/DnhlanRS9mb0/+IqQaSyn9fEmWwqKTCOWjioDxOWNUWbyDQksS/YneBOqBQWe3zl4t3KiIXHNGcYhGAQk334QzQq88XoHIwCPEWpx4O7OtiO3ElR142EDSBea8j6nO05VYKDx/uyx1w2EuU/lwyygO+NU9zT18sdbGeNTO/xQcs1DqD7cuPENz8eJ/M7sYZ4tchsuAmYBQt8/9jRit81oQgSNTrS0PnjqEiFmUwUw4bshvU/8bZN5JNL8/smKtsuVKZtnmP+5i78Jsb/ldoHt30cf7SOQQf2pQPe71MiLX7dB/uLd+mE7827orE4vJHvZSlG53jdDat9P645TeG90tYyaN0sb74K0uNKzQyKWD1mrcpYafpgs/sqJIMCD31KsGnKbVHaVQ5/4C/sfsX6FKWQBUPJjuS3FtEg4G5LyXg6ut2MmU25D3GxEn0le9lKEl1+OywdviT+YvN2A3J0SB3bPT4uvKoN4L5wUnz+GM+jlnOMDZkH5cFV6DLubX4SrzYe9EPoPYODdzITGB2k6qHjV9IHZ768BRIObQNK0tV/ckth4MoKfbX9PVyF3SI84EV4sFdAr31rdYogExORzxuKLWwpoqUIvJIZjlCB6ftd2JR3q5bo2Sf7R2+gksT1mJOvxkMmd04spQlE2UVvrtAQNaBmxumPBOi5dPRnldieBHQSsQJatJJbShh5lahKbGqaq9auM2HCiINw7nwvXxuIMMefsN+YfGNM9Yjo0z0gNrRgwXZ2j+jykI7aG9QM0s+Ln3TRYn6PVGA9CiPjpgAJ2zhyuTsOpVskUrEbSjoPl1AGZidzhM922C3bdbONVYB3bUzsG31TZIywgqZhLhhXDdrzQmrwtqcZcnO8LDaIiLd0YYaccsw3GtkZZGoJK0amfy0uUTuoaQgQEWwvbn83oTQTSBg2tB9GJeH7dqKxg9Dh9b2P903XkB+SqAdds7w40bRBEeYSWsQDfBK5Cav9TEWZCMxjd5bpaa4zceQASRZ8U+6p0cWOnIJk3FeRgEddE0o+thrma4UNpoyO61s5t1i51w8/0rYwdzxR8PN69NwVUmOgr6HZwm7FHwVRZ5Y8GrvASrojhw3cGxc81YkrKnjSvj83OZs+wTlj3LROVXqGGsQqkPz9B/+/3BRJnrSD/GFUD93pPJG/B6+90f4/L7XxHSz7mWnnpyEAbmy2QsZoKKpXZzz/Bwym39Pa4BjcAbKjZh7RYy52J3Q2Oc9JBO1y1pVYVTzgsrgOvWksysOGiGl7f/i92L+zWaMgN/u2HQzk2ARW2AfdPY+ZzIaYhtxTNiJcyJKJXym6m/m76KVlhZHU5JVZ4T9MIxnSKmR5O18chbhMVitLQRzfUY20CoSKVsHK4IVnY75Jk1maTKBR/JA2P98391CR+WqWxFzH6c5R2EWVF7d9meq0GlDecuNyN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ddd2098-54fb-422f-79c5-08dcf25fdfd4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:07:57.5299 (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: EESOmakpTkxG9bgn4DKnb5f0FaR/f7oUMjmXOk9oOnjkYnf/O98oeRMS50o6xP5HaOWCAMpQlVlRzaXObEnc0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2 changes: This patch is separated from v1 patch 5 ("net: enetc: add enetc-pf-common driver support"), it just moved some common functions from enetc_pf.c to enetc_pf_common.c. v3 changes: Change the title and refactor the commit message. v4: 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 Tue Oct 22 05:52: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: 13845165 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) (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 3F1E4145B22; Tue, 22 Oct 2024 06:08:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577290; cv=fail; b=m0MIHe7lAg8h0S4CipeGspcd7xNWb7i/zhwZMsgEI1r5BYycoHpsszb7+7j8jQv0Tp5aP7wZtNUprWo4TP00uexaz8XY5FIJULoBoXMeSM3MqMGOt7u8mKKidUptcqbdkzPeX/acm7FGk6340EQ+iuGfSzLaeb6Hn97gsx6cVvc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577290; c=relaxed/simple; bh=OJi986vdpBH0nvj70921/t4I7HSORCZ2X3m0tBljJFs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fqexc8bnT4W/2nA94yh0k/Glaco2+I7/ZG+YmQIFEwQcDQAEHvHP5C1DGcobgCpKkAubT6b65DlmVIUM95bvxDaj3ttf8aFAP1v4w6dgPhtawH2TJZFApX8ucGmBlmhqUYMoIBL/x1JMv0YaZoQjxiOKRLAeKyy+KcCVJPtELYo= 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=JPDMHrjs; arc=fail smtp.client-ip=40.107.22.69 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="JPDMHrjs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FuGkokiAnj3iAgbZrj554XsSgP9lSnmBj/FLPXwKAxXcPZdTf8hR8aYLCYJGLNF4xAQZU+TYcL7916oYD/xDxTn5IFNIx2Zg0P6+TwVCYkpbLT7xxvswazPeUlfFuNw7YSOzGqjdn8WMA4MEHInOuI8me0fLUft6TyTOO088hLoOrrcX4rbyC5/cT7mB83oYPmfI79D/1CE0jHQ3iOOYM5rSzNXZjoBBEvnR7Vy8D+nfkCwSoMcgYzSYT3MvyOGdSHY8SizE2l3RsyCda8yygYdM0DMipvvIvtfD07+CcQLjRHusq0TuLNHnepCYCw8kJ4rbn0mp+KQ8ZgHD4CM/SQ== 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=accKu+9+eH11zX2CtBkofZOVTrsYyhbRegzoPtBBawY=; b=I51eckq51V9NPQnmnJocYVR5nRku/I5Qb9ECLcKNAeXs/MDfJGsP8Ip1IiE0QezDl+irqh4JuOn2C62AvUKWk/Kv0dzi52jxE0EHp6hf5AbbAtitEKLa1Io17TnlstIbm6+0u253FprDsSa5xZdp2X4/o8cUa9Hp7L6ZfscASkQ6uS8I9eykC5uYmfqtvo59sXk9QUbr5+L4B9bvVKm8Q14JKe8NTjekav9vaQrY62TNfKQ6KhIbgb4ImG2SvohGJPQR4YzaCAT2NZHINQwDjOmFzy78pGgo+9HpCDQa1TTsBsIIbujEdBDHzl5mM1qQXTD9lxl6RGifB7m7aUMiSw== 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=accKu+9+eH11zX2CtBkofZOVTrsYyhbRegzoPtBBawY=; b=JPDMHrjsr6wSWM5vsrnRgRiLBqEQZc+fe48FO4swJBhLnLayerQj0JmJKxABVQa+y0Mn3FMAeCZu1l/N58DFp218tEJvHZFVAqUN6Hbp7nBrARsKO5yApdFtonmK2GHvftqMiu6t07EoAUQH/KyW1DXQAwmw+sQsQfDCGjeT0b4t/SQE7oDtPCCWcUlWTuNwySfYwfBweFiGNR9AgtYXIkmiBNUP7qU6CD1121jmyXi27tTGI+80nsFcLvrcB2cVVcMQnNx3qbcHUH4lVCE4Btl7HIw8P8CQIdOQQXhX+DNH8fsLwxmBEjI+8sK90DepVUSBGwiAEr9L4MIrArqsUA== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:08: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; Tue, 22 Oct 2024 06:08: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 v4 net-next 06/13] net: enetc: build enetc_pf_common.c as a separate module Date: Tue, 22 Oct 2024 13:52:16 +0800 Message-Id: <20241022055223.382277-7-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b15ab1e-eab9-4985-3200-08dcf25fe399 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: Ghpbk5hkQVSgwWGc9azBCC4DjwG+rRju4hos0Al43QayHxbliIkYXYwaAF9jpfpg6r13ZS0/zWuM9NGGunceleQH0/YYC+oU93YKaoMu7ovBo+xve7ZOTMxf7BIqtloV60kGmvg54RbUKPdA+eWb/nahJiPpZHdKI4d5jrLTrlXADPVAmkxgtoYQEU7KbH8F7D5BCAswtl0SnPlKSR5T7K4OnpV+/I0w2H7Or1/AZylt2O4ysXGqXlRdtLqgkgOm9HyLf8qDz3ji7JZXpJHQPaHtJTiO4Kuex+p1ZmbyqYkq7HBgg928ttIlsT4LT+huQMkWJi6Hfgq0qzp6HtR7/35LxcyocSRw+S1owxZduSwouwmZ7pI8mZ67r97M5QwkohMpNZZgTN5AM8U+f7429g7R+tYMjzU/ZDel6BQPFr2pO3i9GQy+izQ5Xjz5hRp2JzHn6gQGgRXvpfOPZVKJR6q0KZVzPS5Qn7CNrDAwN4aCXYjuZn4hzkWXhXoTd2i5V3d7zqSZFvl/ZjjbSDwRGRQDLsWuQ0VbANvZsU0rNrKQNB52jZJu5veJwJl6ZNn02xape/wYcWFAN3v8k9cgCkG4h3FIcnQdL8estXrYuQv8KlJyO5yiHC61t6wVZpgyum4cJsEWx/aNxnl8bP/dx0q9cXaFPMi+CQkMY3jlNjgVdaalBdvY6ZFrhz+ggh0rIB0KlATStqfRsIC9utTlC4M7Lzw5sQ1XntEY4g+8CwnjzcgG88PI8WcDS8K/eWF5NMtJHcslhJ5WNoB/7jyN3nz8jqe9jtDLyueBlOUA5OZmUZQmFtUWOqwGwq/CF4+FUciO/ZwwiMucRacXv8uEh9rvu1nSySqKWBSQtCed+qIEyYdggY2shPihkBJhy9GbD8CMT1lIgQD3nSHulSocOWntc5rvSXhLS1Iz+Bw35Sz6QiwvjbsKY+9R+Rz+PoO0FjCj3OAASWLFhphAQxgmD2WptZrbYOPahbO2rI8Rk7Eb3jOdA/7HIfSeGqcVgNhRyCCdl7R0HC8kMEPcK2PYLMNibzk6WxRrFhdVvTtAz9/k1XeiMmYV3BH/gYneNowkHhdjadooy2POXLKzOQ6LvpFUQLGWeK38uBMpvC5nYCrncs8dp7JlG6K0gvAN+OlTE151nIi2Lv/7f67Y+e9+ZYflGqs3yN0gMfibUdxeKXdKu8KsNIRDpbS98GlDEPrcx2bIh4bGIlo533/ldmy+5eWDShPJ7yOWGof4//RWUioW3O4VeXndex5xLOLSAI7o+DJwElbUAoUJJDl1Ng8fpagbffWqpkKmIkR7cat4ioCzXTCWkVsxlz3RJBrvoPzVLpIQr+Fg7lQQnl17Jg0fZHkswqviWIYaAzmW/Jwt0+UnzOGEX3rcWYe+2NPPhHO0 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j7+sLjbdNEat684fQPZI59GddEnuvdtJET8RgeFDeDodO3TIoMlOvYRvtAJLcAoaAMhNQ7tqhdQ8v8WqyAcpOoCJyXqgzUhaptogNwFIHzpshnpO+mwSBF39EvJEP3bYtONV+DF6G8+5Fd4RMH+bAdjTn1jiwPV7AgGQ0v/7xlBZWGF12gSr6oh/175RIAoDxaUXVlH2ULiu5XVgLwzu38mmt1Vz4Djs/Cwam3HgdhGK1kbXQvCiE1KvErWfMW3Lc5YRb3BuBE0G7DYUO+/EQy04yivwEH7iw6eIkXZnnQAIENNntpzOYnHkmUhaecAFApSJk3RWXDASzv3MRTPUxuve2xl8uQXg1XfZcqZowOLacX1w1B1mDcJJyLkHh/elXk4m2v9sYs2crfN/iotgLQ6xSxctCBjECnRZpL7Nvuhyq8569fB29qBotLhwWxVmJLHfH47OFGuJDF28ZlNC5xutYLwjNOfF5BerHaqBIBaWM5QObckvWy29o4feodSpVZir6L7Q6wuKuF93BKsdCKcuQrvmgnv94RT56yFJ+pHa9ofNyk5Gml2NFO8REM1GgT52n1b4M4HkmbVCBsDpv1x6E1lewxopFBAafYy6X4BOVEV6cJ/MoNJgdAVfLEpAjlkNUKhMjEcP5jjlgFHa9yYenVfQxk8DqWx3fBh+SOT8mEe6f47rjdIBHJfE47J9uavS0rS2ZhD5bdWlC1m5wm6AAF9GKd02pYeT6WHkKMkk34als/PEBUr2IJyN3Qesm6Ew9IneJ9CWlvlaJZiXHBMNMPhILdMVKtkG/ylFR5u2rZWXZu9UNW+esLOzQ5dwzrxeo680KK7ZLmlKAoohylbXn+nHlej2nE6nxFKZrOfmt3+wOBz3F7LjepvRdvVociyHdJSMMrtcC+RH4yUzat2guRBwOlx+NKVoJuHj0LofRrTcjZEIWCc/0lDiP7VVMRcWIX51OCuoqwOu9WOdN9nlK17/VgcnPBOuIVwqJboVB1F9U+VeHgpDK6z648xNwAfdXGfXDuAEYMiBVIUgBh+WhmRGkN6q/HbSc7hbp6RlwdjWWbdaJsnGoAa0f7eab5m9t90bwrW3zi7vdyviBv0yhjl228Hi1uEz+h3FrXz7gj0WnTNuIHflEJd1AqMbBolzBgD9LBxit08stM2amWHedCNpEVh3jRP7lNyz/z/FQR0Y0CaXzUd+LUdXqg9yymcCr62+YF8cb45vs2DA0D8QIGPI4SsaT9K9lx/qHi18eCV+HiI0OPgk5pmoq8/IdGCEn/tw5eQikYMaYeSiT/XZkxMbZKLhkTm9i2Z1N8N8uGv+Khlwj6Xa31+KLUETfUkLn6492D8f0QwTeZ+EBqVgINYrSyB9Jiy7sXGyiMMr67VKYX99S8wBdco0wSkpHsQbIKWeYxB7Dmjuucl2fY/hf/kJF5joA6DQQTeNde7tXzPaW0lmfpVADEOSZrTWT6FUxB7cxy3CcgygiAM2YwzqutLG7ubys37wS6HVANzlQjZHs+Y/NDLAjo7iXShddZDnFQxxM3cp3JrCdynjWaApHLnJI0PkaVVl0sMbAH0lyf0Xg3kF8NFjmJiKzriN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b15ab1e-eab9-4985-3200-08dcf25fe399 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:08:03.8404 (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: Icg/UEzWmoi2gVuxtHOFVifJsOBH4aYM12mUlESyDmv67eIPHgey3/7OaS/V7cAbLToSIulU6IlUCoW59kzUlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2 changes: This patch is separated from v1 patch 5 ("net: enetc: add enetc-pf-common driver support"), only the changes to compile enetc_pf_common.c into a separated driver are kept. v3 changes: Refactor the commit message. v4 changes: Remove the input prompt of CONFIG_NXP_ENETC_PF_COMMON. --- 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 Tue Oct 22 05:52: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: 13845166 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2060.outbound.protection.outlook.com [40.107.21.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1AD315443F; Tue, 22 Oct 2024 06:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577295; cv=fail; b=IUA+nibqJedOgdB/rpLNM/xh6CVJ7xxCWHb6A+PTKyPxlFwWK48V634GRjJ5l/bwojiR++wwCbpZoc8lv3jChyOXUUyToM8Yh3rLyObkEkHfi/SD8pj5Rp8y+svbXiJthoz6A26psNz2vj07WuSiyO/NJvtM3sZiyYreimB774s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577295; c=relaxed/simple; bh=Eu1BS74ANXomq1hCfFdsvWbebq6Ai6cbLT+ZoMUG2R8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WF/5Ymt3vZvH7pp878ANB00HRKU/HlRsSKP47n70Yh1iaGXVMVij0LunLYGx3MRf73gyL1J+ER4dmwflBdV0exM97AvumZclErzY4nSHKc9X+9uF4YQyvYE7NbXywETYrKsWHme0F8BTYrEn6p34+0PibRsXaNAu1xJuveD5ixc= 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=OoKCgA1e; arc=fail smtp.client-ip=40.107.21.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="OoKCgA1e" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FG1yi77qY2KK9Ww5nhVVf9QpPFS8aHJIR0IHgBn1wOKrafuAQsfLF2JV91jks3vxvNMi5QklMP9GneRRhKZX1FqpZCpl/U+T7F3DgEQSBFnJXGLisoxvBeRo89sm9nxVnE2KT6i04Lld5dUAw8721ULQUaIcyetugIBlF5XUBxz1m9tDo4JsU62hDHBvFA9PAlinTQEZLVGeCtJWS7kIGCizY1rVRhKQF3JLnRYbbnJ1YWz8jTwG5rnGbS2PXjSAGx4hSHv+f5VwKufasGQFwxw40k9pjkeKgAbTtz08QhBMZAVLy7pnMF3R5lOXpPLWNUypOROHigspI000zLcrXw== 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=SbJbsgnVqfcvlmsoZu6lwfabIjlblR/gyIDOgIZ+eQM=; b=uU/aJbMTEiT+4ZIyWWb4OErDUaj5/ODygAq1Z5MSsJIG8uU3Gm3S1Ix/McM6YG4MLh4x4aQ5DKgTtVILF5JvklN6IQks+3yuRd7oipLYtqhKwIRAeUcipo0/BrIci21v6wpa1JFNHAvSOcFF2I9q0Z8F7/PnEfTKxIjkCTIssUgBVk8q3vo8MuMAEMOq4e6Lf0xWzXIezIFQ1yen9rgENcjxumADuApFR55g/J3MJcwNpLlemJhfq9wHic2EPXDgZz5KbTMtJp2/AUrR5y2JXEYPoFrnxy3/MsiS36AqrayOVWJI8oe567ky21+6dfQTAVOgnfJRYi/jNRZF40+hYw== 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=SbJbsgnVqfcvlmsoZu6lwfabIjlblR/gyIDOgIZ+eQM=; b=OoKCgA1ebC0Z8BdWNua8k3WX4f6vCGaw8RoRgHDL85V5SKnmbi8ak2Mt1Om6VM61nJn6uPXLnI4DkDHs983ZMaYGL6I5aUiLavKWCHTeYt5v0a1NLsZpk2mAffhVdQHWWQnY1J7N4QBOSIfYSFOSZtzFuRTkrgnezd7fPeWVEXWMkDokeuHoCoJKtPUyv7rbYBJiBHQdmDxW9Q45CWcFQW0gaGvlp2dZiX6cfc9GdPOahO4C3sFKdz7gNLXOVvWq9SmLrvV7RFIyv/b+fw+edgWHCbzbF9QKOQ3oNu1bZMJoOImzSUDQpuGhuY6ZnzHBvU6VL1Ng2US6TCfEuj+H+A== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:08:10 +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; Tue, 22 Oct 2024 06:08:10 +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 v4 net-next 07/13] net: enetc: remove ERR050089 workaround for i.MX95 Date: Tue, 22 Oct 2024 13:52:17 +0800 Message-Id: <20241022055223.382277-8-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: 38dbd55f-66c4-4fbd-a87a-08dcf25fe795 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: QgsOG0sQ4v0j9QAYJNRMCEP6VPZHwoN4A3o/1Yrwef1RTXCcr3LaKsGoiENuB+Iocf9+yPAEFCxHZFWaF0E8tN3PF9hmdci3XtnpOX5ttd8ToSTYSgmbw5mFw8o4VTCW7WGT65ylzEAGgwg4efs6jSv31Hqqo5wqoapbvCU+zmfqlHBXxehIeR6Gl9uHgA+7ZO18EIXIjQ3FO0FPSlMFrJahnaa8Hoet6iBX299+ttO6LsnfzfKHN4ooiYUgPdGx6AAJCS5OgcbIZZGGZlTO5GmMTpIWuDwsV1WF7/FPrMdGlqingwCdPX3WsXCfxc61fKIqtqiMM+sUQlwtabppd7j8RfiyIAt4B/IZCbVJKLM0pIUiTzcbLjtXvkVtPVuoV+Myxq6rBjBhRyzVheTxvWPNFndDe1DVJ9sMFskWynrCCQVlqXzN0mK1IpRRNeRQIxYLa5OrFg4kcijAArcpMcJr0DpZ74Ej1omSTLRQX5P/wYb9iDSu4+iaxWmG2z4061JEfTGZuoZB51h7u2/7V1k2BxkVTCwvG1lqZJFsf1AG8VP5nmS20ZeT0YRCT2w1/aBN/uOibbtcPxCfD9slMeYlYGcjXKvECGEnV2PSYTyZp6Et8fdChDp93UAj0ZzOknmYJlvDqf0JermlPuWMApBt58gRrM7dPmM9WfbC8bsWRHKdGEMrE55NMoOQovTnEIny1QD1+v+FszHgYhLETHqS/Wtq97dcwAeu6ZjrZ1OGH0q7ABVzQzFaynDWGzqQH9RiLdrp9z0AM5XbTWnpjGvPW2ZX6mhp4Z+xNWMSdo8dLSNu4oNr1JuaU1OTT2aZ3nhE6OsRHFw5iEb9I8xItm8jFZv8/V8vf667mVrr8xxOAuQkBYrqu7ppUsGfB51QnhNTdQwqgix7NlvgWkV1tEF9wgCtBCZMmcMVg6lAj4Vc2AokGdHqp+dq6+u1CbHR5ooTadb/kmsoscnKdm3Mp8BcfQ/L9AY5FSJyZr9YsVy4J8QD8lv/NKigRtRbrc/mnk6zHQark1DJyU4CSPQq7dXlFzhMKM8NipZeRUyGtlgYi0CJzRuTIjrKXKhnreJNQKG8CoF9zpqpZHgZ7MJ85zLnNJ6lMYt89k7ydsysnwSOft/Wh3q0AgaZzMbUQVQyg1WNgpeX7SoYhGDT39HyBuGtGjccOK74JVozPazxlvrmH1qQbnynB7w9+dlraq69XZnd+3c3S5I07FGxHYs5g5ReeK5qmj40OhreVlV57GZMvVAoRPh2tkWRXz1czx/E/Xk+G+x8uS1tsci5GVyPCQWDxHPX4B9Sfqrx7+ICAtzAoi88qlLd2g9SndaxJ/gigY2edBhOtvRj5w/OAsqV2BG7hflMYUBRAICgtzAuxkSV/62YZ0NEIKf2u+RHlL4s 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HrNMfxJ3rHUqIeFDJ1jHY6EKYurNQ8H4gpY2ZB9aEaJP8/Nd3ltt9diQsvFeZJi9o7GqR+4cbgv2rZu7tFSAUs5eSyiqLBFpoZH27eWaCl2nwwbQS5OKZAyLmFRTbQ44CzQRqVods6WGLyox47N6QIrmow7/4N4RA6SJS/65F8AtmhHSsM5GVfWpshu2K6AyDEyBeFnaHKMZG2ftXbAsUBUgzdPTdRil1B4NkbAVSafsMMBYh6bFyB3I9Uiv84vj5GeYI8UheMPqRoY2rhQ6sLJqYiHkPbpOw9Fr8HxuNxyaJKS+MCPghqLa+rrLSeHnvIn+K39rTS3kuFXDdfqstpr7SYsFRQiao5dygVEArsROk/4q3zbjCCui6y2Fa/3tijf8hvvr7R3ZGgWlDyKTQU1L0UjjDFhH1I1SZ7ZsvLADZEp1VCNVvgQ3QWuLUrPISBJf6y61vd5Wbi2nXdhqoB2JJdFdebiA1p8YfGJYAEq5U6DDmlhPDGmttqVt7OOfr1KCNDxkH55FPF111nRJSs14SWoh+B5GX87emWjV2FJq0z0KEsik2GeFoEtHb77p0D6XorHi8Yiay7xNmYkqLCAJGMdZoMoyhH2DQguIDgOPBTT8D0MZ6KSQlfNFMxHTV8OK4hxVSRkT+ZSpjE3SF/nQGoZEZZAywjHdMvOoq/4y+ysRcoyHmrfljXRWEFJDQlHBj1EfbjvS+nb3tmKRwlXRwBZKZNF8qKOk2KyC+1ltuDRQLFGuEiITDroz8CaECDeIOD92Jx26gd8uChgrBnFFpNDa0Sv2dFLWjUN3fbGqntM5VPSjL9it96MT6wd9kWArQqAX2aO2jF9gksKP5sJ2lCnl3NgEISSruj7Y0Ne0KS0hEBOsUZgmRJ+U6ZQUNiX9Held6ge2HKrxIhS60exd/g06GQWV+WdwqLsIFkaaFo0Da5JjFsoPMvgUxEzcnSETVZH0xFKyLXgFGPPzLXpYZe4E+uJc/1IQxZTpuGZ6DG1/YP6b++4Zley1AGbr65w95oVEheF1171zWeJGCClxilf+nCkFa1qrH5mt36zWWaljmj0vaddp8QVLpZOWx9uv4VCIcu3KzAdXXSJVr8mJM0eTtZTaiT3pPLGWIcNtmigyH1Mcv4OhN3YQF0/hLAvsbySbmj3aolNK8CJ4CHvuiU1erjnqJpQbRGVjg1a+JCYtC7cT8xdlkMqrJCqTd0JkrL1aZHD6kOgQvGSqU2auFkSR4n3NDAcTulce4hmTGp62ODciNwRosYinz1/H1YsStRrYiRG8vdtjg8KF/7HyRhbORNZyXl132uPSQkPIJOkXm/Vlzy6zUPvxxAWoZ0c/M/8GO/TOwrhWjBW9rVMxHbQWcw/IX9xeD7+R7mur5d9YcVdBCkAK+sK27o5w91aud83mKLYBktVOM+kkHjeF73XX6/J9bfYsr18ttTYoi3Jjs0WKoRDdDo6wyhmNr1nI+BkbaQIqQc1iytGdb5oJK8XQezfGDqu20MF4fzv+H4GOIUe5lg6aDrG7AW6d298gC5xSZwMo2QVUUQ+71nF2pShZp9tX1DqEt30UfzQCSh2EB9XnF+Ws44+bEqkv X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38dbd55f-66c4-4fbd-a87a-08dcf25fe795 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:08:10.7412 (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: MjJAgmhWbsnskJMBWvf+WNeQFoUPgUXLIJqymv5I+MoFmsyBDlamoG60gXsnj5umRwnbjsw2iIWrMb76XuoCbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2 changes: no changes v3 changes: Change the title and refactor the commit message. v4: 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 Tue Oct 22 05:52: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: 13845167 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (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 49B6C1465A5; Tue, 22 Oct 2024 06:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577301; cv=fail; b=l/d+jelXu14qKJK3rTZU96SESo9c6UYmoM3DW0O4qzVtVi6vTZ1+U7GfGB5gI7/dKqDtcRoj7F5jvB856d5AWvEQ4WFE8vnlW0sNReaQeopOlz8Hh23d/8Yp2DPvutlcD78hh9tjbsEBq40YfMhnsys26pOXWyneupaSWSG+6Ho= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577301; c=relaxed/simple; bh=RY4ZZpijTUBHMdY/ozxqU3De5Xm5alyvLCJEbAYx5sA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pJzVzVDEVs7jmUufxV2BEjQkO/rSZQx01vKGfGXflyPFYbRbG4d9rtdrdOK3g/ITbaSaXXuLQLUMWcXpUp4wOudyO5H45jLFKeJ1kizMDqdi6hwLywLbQA5M57Bi6xF9dJeHwOEGYFIt6d8kqh9ziViBt0a6CMNQUp1uNzhwBAY= 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=VokrsB++; arc=fail smtp.client-ip=40.107.20.71 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="VokrsB++" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=azDqJqUe7XwpkSloTekzDB8banFvWqTVx0C2Ke1PDsH4OXI6eC5U9YisbvWQcYHeY43owGCYtCrAmlROvoW56G1TNSjx5J26dzxsbkLs3jkiPyptyw7HMdIfmHIOUh3rOmfGfwmuh3ZU1+BRXyBhnwvJkO+7BuJz/A3YLUiwzFC+xxcfhfM/XQ0eH+nlIJBcdc0s3N/9+hoGtzmIeni806VyzkuX87nV1XlDcF778sgg1I+ZIIp1669+v2JRZfXRoiD9FbcEVviPypsV8DYzmbzUlSMLCIBVtkDfghLddtL6UeXHVlVNK3SMaI5MMasSE2X+moy6y4pj0V0+I8TWiA== 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=2cF51rXBwr3FKJihKEGdm2vOShETmCdGZG0YyBB3HWE=; b=KLgjcioWJjkqpqxD9uyxwxdcQaeeHLv5j3TP29HAGc3crRtiQXScIrqZx3E1vTaGuegOx69L3/dFbw6xWacxv6T/CnDRSrpyO0ZkEu/RwHG0Y2lkGEtqaxo+YOpC4sxbrtp8FOT99EXhnJgbBhHwz9XTnqzUW29GfxGGZJ+Pt+uQS3wFnNr792hC6dGivzrpw6zqeS1d4O+xWTghpZAN97+tZ2UfHHE+j3aKYfx4pK8u3WBBIS13gjpsprq5lRPlkPrG7uZCX0qPj/kQ5DfrprmJE4XfjX7sj4qbDQ1LdlqGqXTF3Y2lXeroCuuC1YtX8fP+h2RkxsdqVGc/KmlOlw== 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=2cF51rXBwr3FKJihKEGdm2vOShETmCdGZG0YyBB3HWE=; b=VokrsB++YTqNPNofEavXViXZfwNcY6z44HPuLWV/R2b2/CNJFQe8dKaDku7F+3LLcRa2s+AOgbLsuracm+kxyI0dmUB+0sTXRYDjNMgYdcvIHbqkokouCax986Q0L/1NDVrNAGSMh0iQIjz5C9W2TZ+IvAvZ7kjZf+5EOLUIvNZBjTUWn4OW2QMUJCtj18ldSPuhK5QkGBIyJZZjIPFGi74giUxaP1SKP8jefqiSnmCY3HYVO9aH2ZbYnNrj/LCFfHMSuyGY8hNkyLseyZDKW4ikzXJ1HlbTQWAS7H5aHPgwTcuDGgxOQPZh4x2qjFXoxtnH7BAgaizH66e0FaXa+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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:08:16 +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; Tue, 22 Oct 2024 06:08:16 +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 v4 net-next 08/13] PCI: Add NXP NETC vendor ID and device IDs Date: Tue, 22 Oct 2024 13:52:18 +0800 Message-Id: <20241022055223.382277-9-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: e93b7dd8-9f67-4cc9-ad1f-08dcf25feb57 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: y4NJogaqAZm8v2hvbaND9vQ7WNZHJ3q2/w4Zz9vYbShUob9eKCocVJt+IsEvbplnz1kF6tQX0iI021OyzUkKsob8jeVYbucyFUP2eDu/4h+EszQbDMRhEDV69Yf1z57o3+tnCzSIxiqMXNELcSIaG7teiM436tgvfVuo0uvX2ywtMj1IzmrRIsiwR3I0PQgcELi05l9DTGvWy6q+VhIpAhcGEP97KbiPCHAnmHJTha0lOufEArAK34688mqTreBwuccr+zlj6R5d5nH+/EKe9Ox6PX2P04pUuQS24kFU7Oke1nbofrr977lIwn+DbCibU4qxAwpbhZk5uDCyhLJHrv6CiHXvSzmWOnwq0MTytSYPsWdueckynt1ufItd6dcd0zUYThYRgR/oXthZjKFRzz27DqOuk0aZ/mD3pGHa6c6Zs4pJqRpjtS0Yf6qIfmgI8iRaivr9ACS2CFABPjuMT5J3wFFqouJ6BAVspHmTK1kySF/JnSdSpY9pZDT5s3xG2dMDS7D84RS9xop379MI54KnU2r6a7mtK8K6VaeyUw9cRsyPTd3s7+wHmAlPP+8CkNYuBk0YGoE76iJxL8aDEai/Shq0OOLcne2JUOC1ZzjWQ9LjbobFdGh/5CmdMfkZaopTiD6xBRJyAkhUvbDkKgtQDgXkIgaedM4DSDQMobw7Sg4G9KlEOSJe2FUuM6de9yFfI96h3jcN4V4oyA5j6KcTzb8Fll3bADMVfu1KqkAaHE0Hon0zOusIdm3Q1QoSwR59FZwtwZVD8c6iq29E+JEYR11u7u/dXJsciGDuoCMdPJEfUVqtfw8w/EzJ1KFklvq5c5t2PTWLFrnLWZkTLXeOkOh/94L/bPMAOQ/zxSuyTsd6+NJ4FmOnZJvJBGZWx2PuFcsRZcCNm0AfQ+6pdR6jQyxU7Kds5rcpQUG32/qhbs5kVvzwwR+obnTfUXgLzdMwafQT0nbg1sNV1ApyXIJT018FIt+zLeykxkAVDBqvbkOCZzv+M6cmt6GRyy0Tfna5CYqZ64acbDssMWudwFwMxWGeoX7GiEj254GOnh/XnhJlIUXOWjvg1wpZtmmV3MkIbZCQe05UG8OUOsnwTN76kyNiK8pa/BOCyS+Sa6+3c9r19DXP3eKdcZI0gPOQayFG3OM7LwZyth41PfEyepHIsb6MpfKeRFE6Upg6kLXbl6JRDmqgm+/pdCA0q/nfievcbFy1kEjiory21kvaVA/4ZMD0+Mes6MZMPYUCc0eq/Ku8P+1XH2p+b7tQeFLaMGz3SnwWvRhmMCF3kvvyLainfwWTjsBN67Pg2ZwFqFVMSVaqO3kyT1qkF40+3+jDqynSmpOGTDBuQaiWCbAXOVDDG6qpELG6XsadBHARo6YYWcESQ8SYhH0xAQqbxQ4I 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NUH8tuartPOnz0dgpOUq7YOvPOb5ECd3ZCHpYhD0hUxoNi8t9owNFg8muatXRSXG2vdAmP/Ljznq9Ld8TPpokMVwmVrRv784MFkDjiQGk+pK0s71VdBzdYQuUMvdKAgEb8FM9PVn6sbMvHNFphj+AreUXSiuwX9YA4FnvwJDWM7fDU1mUVW3NAgajR4GIqRUlUBDS4b3aIay2/GlO+yHaY6sR0PmRPJn0IGGwQZdn8NPHOqK2lItGZS2PC4cR3qwyfWh5CAn+3pSPLrU2YGFcW/8VYpuz/+kefELQOGM0P2wbSkggKs+FmRRGvcfNpDrOsgjDWDsDQpBJxh1AueDd2ceQOJywCJLLqljARJFjJ5Q6k8jOr/Eca+tDKKPA+XEdaGaIi875YWEFIbu5On5ZcmIXWfFNo/0GBOyvnub3A0p8/BfHyuN4JZjMqvVTin72vIekq3sIS5ZhcTVfCoE9eVfhZbE3pSjE4+p4aCNbVHAtot44qUWrPPcf1HJt39dRaH2WAbB2Gw9aPJFjx8n/fePOgL+mZCDj50fyao5yA18p8SyhaPISr4L165DMvk/MLhSJ24cljNhsx1/duNu3XvOxgFoNfg6QiXmBBhAR4XTyHRlcAIAe9YnwfR1ED/i0RthWALkYVDV4/TJ1YOdnaWv9+iQnFZopkUxOsDTIvjlR9GJSnIbU3Fh9yrNV+ptqvbQW1XoMZgO6QkirN+to+eXrXwFgXVpbKej54ugs2n5JY8U7tJo8aQhTHN10QWruM0HJc0PoMeYe98Z8rn+z1iY9s9wmD7w2XEn3wE+mNKXSEghOB8RguuXTRuFJPq1B3F9smWxGdKkgZgog5aKCHHULEtT0VJSgD/c8xZAMHJCpqwaZlM3UCP9y/KSFgEovvILdaCK/rgL1ml+orSSRyhkfFosA2MomPzPST/UZJNC7lg4eQdc441WOZJIhTiXf+BsFS/QAbciMA/v3wAEYo8VPgwPtkppazdionVPhXN1fY0H4xKMsdVgLlbN5MFSoync5UeF8oZGTxnX7ubKqtkb1P0KaC1VX7RBudrpn8itajx5ZClFnIUY/F2Zl+OZudTAMhoC+/mqMD2uKb+OPlRaCcAOZ/+w7s98mF/O1ZGZhA0IIkPgnau70aan+p70DlC7NArBdB6eh+qhivvXb5yDTYBdmzTtW2aJYqA/d2Rlv3Y0k9rGPYGUHK3+X5FJ5X8lxhWSd85IEwna85rnCCiH/9onA+0/hIQC+5dwpEnsNnngpZHHYP4nWJUGe7um/B9scnYOx4axX/vWfe9ZjY2WO+DjcxCKJb/Zpfuvs1qILx81BHU3RX0yNAUxYhkhalKj4jf/FVcCvB7s170RHZZEpi+gL1c/RbKZvDhALvqv42Uzu7U22c1IT5ZQRkGZ6fZy0Y6wG79mBpWJqavrd9DYsIJ65ynTQ0ieOGequjiZ/RpBZnRV1fKaN4pJOEAtIZjERLFv1yF3Op83Vkd0R0+FbMCjEgS3ZZNpRjuNSamo3ebWdC8Hhu1TUlpNLDXubOJqwj1jlYyyKuH77G/lxi22AQRRbiPplrwAlvsV57K0ee0UFBtsFIEiUNUg2e+z X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e93b7dd8-9f67-4cc9-ad1f-08dcf25feb57 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:08:16.8012 (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: KDXN6hD5+c/V3v4O6eubjVKfSfyo/OQCxzb9qYLc5LxJORJd9QXTG8aAvTRLPLTIXVrmF+QCdPEpI6LvxSttJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2 changes: Refine the commit message. v3: no changes. v4: 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 Tue Oct 22 05:52: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: 13845168 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.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 BD21F146A63; Tue, 22 Oct 2024 06:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577307; cv=fail; b=aQoigechxo+4X5gAA5+WDiF3B/pVXaRDni72R6KKH49WGbSSFNrP/LWhWrcfnwJC9wZTgGo2g1RT5mKnSUodoQtbEa9epLBziLH6THtrREWG1rj+45FWA+tawhA+TO4Bf1hsLbv416RVBcGROQKIFuKIkepLQueUop2cqkIImj0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577307; c=relaxed/simple; bh=DoD/+DRhWoCgEEbX9Bjh3rSRO/QmRhvbnky5/Odm3qQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=T/c7Kk5JggbglaIrwigDo7PWMRZAPRf0ESPG8a2iOxrs7uV+NliQUV1HPwEQqeSGTt+l7rPHm9OEiYZKBV342+Wm6Z8sKMgzHOroiwo9y1F4gVqIstOZAutbHBeqzYuKBUapVb3XbOXisUnX5t2ISfv+yh/mc7H80a8+SLaREnk= 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=nIVNQD/p; arc=fail smtp.client-ip=40.107.22.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="nIVNQD/p" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R3K3OAOqBechTwdMEFqSEnkxw66nnisuGGU00aQxuzxSMo05FH9c3WBalU2OtiY9vPn+q6SiiHx500VbZnvNozHzjkoD+K3U1BA3STglFBGSPKTbIXGYjy23R5xd9IfIIrDJbH8gbElqIfZal2eX6tQ1StsWVLiZD9rH0MgjoAkFpAeTC8Nw4Wwuk3IjJ6dQBpbcn8dDuCYfifsOSWX907QDt6j09bTPYhZik8v6bfT5qsXp11ipxtMXdTs+l+cpvYkSyWLIfIKF0NtAXW3VoX27BsrVlxtJg7KaYPZd4yT6p1DnjgEprNOZ1ybPgMLzHcpZwyS8kSb6j6wh81+Z8g== 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=UdIP+YzCOs0RDLbVuiRZ6PtwrGXMvUFyWugQy6EygBA=; b=mfujOEgjIoec4lYqSYVojJGGN3Zt++kQs1/5i0dpcuwk7+r9OzTvg6rfZ83IFXT+JtG69hllIN97y8WfAim5uU836xFT+oV/l00cvrUduhp9O+ht4TamJqHkwWFkBqX5Lz9ge8MWSG46xbRBB44MU/NOQ5HBgr8a4yH7NQ3z9YT9DMofQlMrbnNhxqcbSzMNxNhCp1PCYnFVfIIK/lT5tvvf85BXuRwvgUXh77mp4/HjhZsGfMeqG3zaY/qWM9aLBw3OMjJFfmBMl901N2jOgnoJN6Jg+lM62p1gzMxSFPtEklOkcT0LII8xHxwkrQZ22AZIGawhhMPPTIaSX9jq4g== 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=UdIP+YzCOs0RDLbVuiRZ6PtwrGXMvUFyWugQy6EygBA=; b=nIVNQD/pKm7oSafwWiSj/7M3TKLGrYPdVK98Bo/sylXMW9QELEzP5RokhYSN7Z7IUfjjMdXMggyjoqpkN90u9qJ5J5849oMOt4j1TV0UjAjuJRyAsjXe4zkjceLaorhuV0IktXpWFZgsbGEGJrfQKx5GWo9elVsDssOmUNSncpL+4LPLOlRVm4owVmL5mviaTFKz0MOU7dBuj49+dFT8Opzk5wcTH+bxfVo0nbesOBHwuR0jOJq/G3ikjI3LP901Ere+tljA0bEDaYbZxYbwYzFUCqbhfrOMYwGlKVJsBvgafWbOb5BHu2nvnVG6MfZO+500+iTTvpMqF4pm0TKCfw== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:08:23 +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; Tue, 22 Oct 2024 06:08:23 +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 v4 net-next 09/13] net: enetc: add i.MX95 EMDIO support Date: Tue, 22 Oct 2024 13:52:19 +0800 Message-Id: <20241022055223.382277-10-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: 203062f8-8914-45f3-6abf-08dcf25fef2d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: Xsll7LqMgbGTlveAkL+IZ0VRtfoFl12brEugq6PKwTy/cEX0D7IelTbYyz/utBiczQD+/NlDhTXKkcuJV8I3t02ApyvtmVK3+U+JwSr756pT4SWh/9eKyz/uzfH0gl+EypKk8ZeYtX6lF0O7mHWCLshqEbB5JOOpAS7ka4jlmpRAtgfZJ0/YVlkwxdtO8LKKfYm0PmhDsmufYqdiRixS4ghDcJ3CalNGBRhh+bHf2Jbq5uq3UKjwrGNy4RFYYeS/vHnyyeiDtDK4VjgusJxzu1TmV8G3AjzMQxSr7wiGqPxRo0PvE9SdJBjtlsFXDt9xNof6338RIaZ0mQXumfx8agsnTSBtNUODfhkdnXEakI8nFfZykMV/3+5ak+uTNDV7MA3phUBwItdGFCxinolMWeZYLcKGcBnrFaC/4rTW6bAZCZvmiL0IAqqVoYh1S7Qr1hJIHUwHz11DtXi0FAauSAW2aweQcAyzed4bnvDuK0l4H9k9RQTvFNVgKIZ0I2sV6nFhOW5C+LmmVITts5QKezbLQiqGdCAwwZSegaP8pV2AOf28i08S2vh+SXIt2H+RnYH2VbPU7JN4FvEJDgv87zQvmnYxxR4fF5OyLAJ83sP9J+MKjIPBJtIQ0oa7PsZ8z6JqPOvoNsOR0ddr5bHdVEMic244gQ4iLralFrCEPUk2fkE7hyQxFU/IGXigLFfK2kDfRxdAM7EYUci2+1wz8tmm9awre6u00y/85SYM782TCuUT902RRQRqSSHETxv23h9Rjp4uIMaZ4E8xE3Q4m3u2QsFZDOsWdIXfkA2LFgpEmXeCBPduRu9VTSiCQltUKIUK/87DXEjmArNJp2qqyL0BYnYukSnu04HqFjCxgQdJC3hJG/0m4FP3qqVkjxomXZ9m8ylEUiqeEcU2zZUIFIXEjdvTDFrwJEwyDAWHG9rujhjmKlwQqnkz7LtFA8i3YG8AY8dtm5zlmnIJ6ktwzvZqlbwZFyaZYlFBBxZc0JM+aj1tO8zoUqHbn2326VrGBF7wtpyekgb9rl51Lt5lavUq3pSW3GUh2vjtXuAMG5h6f96ao+TOAOuX7nLF67DCuW9+ywfm/6MlV4VhSn3F4KQJ4Rv8LzyC6qxxMWwdpOdh/2VZGCNAf4OwiKVMAhQ8EG8QEouywKzoAjH4df8BTocdCDx0byZY4/HzWu1jkgdizxYXIqZow4s6rsU3qYS8x5PxMv3ybIdsbYEkIas0iPo/QyvsMENYau7R54XU9hrnS8LRdsIf156nVh1isJ1OJ14EFzUIrWSVFBC/bv9a0Z0/vIPwhHekhBE/OJSFZfjhlO1yUJY+LBdZdomSkGLhijoN4VH5JpzsCv82OB/ood1idyJf+fzn6fNJgvQG4miiKAvq3VCGGXn3UDfx8XM3 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5PkWd/gucDp9Ryl7awxwZWfrmjUonfCtYOfSeesX0F82yX9hp9BjqYOAxrqnCnqr3ElK2BpwqumlOPCaFlkTQfvUbnoh1VBRDZtgw5BW5x7zC67sknWnoE2lmvMGzjHvBQbrzFmdMhLENJqdOX2bNjU7Sb1h85l2xg6t0yMz2EpzEZ9+9x0V9kPZe9qtKUspiIFQUxK9rCBBhEj8/eWpzf0RhtbFjYGPHJbYeCtD8k1zFRXUtkFPSvLh+f95HOPmkkLjZla7DtzaRL+lJCy/0e4J7JSMahpkFcyCW40g2VMp6Y7HfNRMiDRNYzNhzdvcY0N+FDUTGQk9XWZEXoO7NKv+9AZWG/A1nna9F6Wcsqv4FbH+BlkikLu7wmwPopWNTsAaDN9SOKEA5HO55d1fDcTZHGIMBpxZSWkr3sDbD5MEyPsSV1VFkjcm+ovowIeo5TYeTVyIb97nLKqErsofEfkYbUaKwzvFjRDkhTBN0NNUOAk72qn9fZwdr128pWrHzPA8Bfi6V0x+t1EBf/dxZ3dlXLs+lYnw6oPuFQAUloDwfs3bDDfWYsgY4ORzEJ8vBhcYMQIPLa5YOCUH6b/dq6tTs32xkLcXENrR9cEGVDD43P0A7CS9qWU19TDboe2JrvSqkHRUWfUNhQCHax7/2VpqanmRGcdrNcujOfH/+H6AONT36RAH0BEHXzsyrpWx25rXvV1Up7gv577oB9EC4cAwoZC9otA7GSEH+wnnMAqueAm2JW2lRn2Mp0X34VFeAK7+Td03+m2wLGgP9YadTNAm22wiXWX3XcGdkkBVkniARdHhkY5jDObGdrJbK1c7thFswSjNEpsGcM7/ur4hmQUW+I4Cxi3HHuO2F1bM4Hylnq11GZVMXbVBUjGLZF2zRvmGq218uyD6f8lsX+DxBLHCWeZuwHYvDPOJ4dhmxMguwBxVROppBuUl0Cych6qU/VAzjbrK5Xy49mrDWcV4cCI5Qyw/W0A1AC/x6eHFJGboTjgUprNbiz1YfKnsmVc2CjSJlzxrK6+27IJ4W8d1XoOB0DfliYdjsQfrlEtgCTtX4dOu3vpZHaMiYgtS+473m0rgwEbTd2ubZFt6OJc1utjvI7xbdvsVwlV7JZ78pvLOCKOhsd2g2qX32zoo87rIM2qtNjxuBN7KWzAzQsCIjSOox+Tg+L8d+4B3iwS3q62Nt6E33JIvzqnHngmc0iz9RyEpfPFGU/DzI4/gyrvV2vhXebl7ppn75pI2fJDvpk/uReoECMNAEsI6AxXk0RiAPnIkAJOj3fwIy8kd5PV5mzbiNOvWJ3u5Qksc675PuX6PkVDh7aJKEXDfSvFUJ6OPjBnEe0RP/TZGncsCGgYN67fVnGRSfuT24zczLwVSodJIOsGWPZBobQs/3r2QK9flAfSRDKQGw614TuvpMTGOxncvEMrDdPlrZVCvj6RNivCt/5qhgBHffW+FZ7fR4mLwYaSOAGE6RKpd/sS5X5BhBtjAOcVm+SA5FC/wd24qGJpvuOIG0Fz/HyNqGIQMUqWnbu2GHULJQr0ry5hNCpWw9yHFIR7mB2R4+aC7Pe1RZ/8v8CBtpTTDEzkmOdV3RNb+ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 203062f8-8914-45f3-6abf-08dcf25fef2d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:08:23.0917 (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: XLrZm2HOnnguEUn5w3mnfDAP5eH6GksCFiojFjfnMdqDTlxfrbewAgA+WcmawmkUIN4y6x0YVrVFZYLHg0dqjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2: no changes v3: no changes v4: 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 Tue Oct 22 05:52: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: 13845169 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062.outbound.protection.outlook.com [40.107.21.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 F380D18593C; Tue, 22 Oct 2024 06:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577315; cv=fail; b=c+4vHwhDGInLQmrHACkaEjdxOMlPuu/5wsx/GNet8HflDKMHEu2I9gAt5Eo+8SwT5A8E08SisiTj4KyAVf1aO+j14vn04YeCAqyDqBQs36O0og6AwxiXGbkSe8pWSxZXhYCs2hP8foszd05N4u/D2cMgecveF7R6WGkYcvoJ9cQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577315; c=relaxed/simple; bh=yVAAHcHHtRX6Bsmh63eZVVCTgbAvgGdeH/W9RESeMgM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=LhjoCAVt2P7YY83svY6k2s1QsFgwJNTK8f2n36mCMqsaaF3/fWS7jhrisQk58rTEi4LeBTyzNksECgQVLlbCJv6q0MxqeizYJrVp6pqDzOx7KwemuE5w0vO27BsyCQmTy6QCOma5LS6rzhKBrncHJTUCdjO8jwPxBhdFM5J61J4= 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=E9WY5zNI; arc=fail smtp.client-ip=40.107.21.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="E9WY5zNI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XkXyQ8+xaOws5Ice3Ql91K7X+4j77u/b5CVUpYrtQR704uwSxGIH0OwENABFlGD4od40a/WPRUzP2img7nN64dN7qfY4i/IJ66uYndqXH8bQ1y6W/LuEkoY1rZsxzFtGKRiNBS478iLWLgY4ruIqg48HcIsJ4Hjp69Via+reota0rGhM87hn9fWddrVmpwWs28rOcFWLsH26Wss/qQKff1ASe7B6x8e6+JGfQEN1sqbuFYlQSf8XEdBv3vKwsb+KPlPNeQlqIoXU713u9StQ0yrxydtv575oVdaR4Q1pDQPlyXUR005S7cigMDkL9BKk4+ECB4QPRQBjC7psHXWA4Q== 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=9tN8ij26V4eZHVADKtxTxTbo5Z3CV4Oy5E4MAWJEEjY=; b=ax++bLPngCHTGOg+baQvT8bGaWdDJHUO2qHGSCrOYbE0/+gjSDsodxQQeRrslLbLlXKNBOuL1MIeIMIPcD3mqYMOisGs3/fCuir8v1leP0lQPYxFT4XZbWWpma46Ym8Rpns8IWfL0Z5pIyjZFxg31FkZm1Nfa4GzZPtkgRBeGnu95XGYEhetW+aBTO0geJ3vES0SLAHyCzFGiLOUfJKbLfqHns1cjc2anLxoLe5HqzduYCBeHQdDDptxJFMXThnZDiuNAYB5mUJfFwmmXZvdDONyKcvB86XwNQ7Qq3j1PPvXISPTtfolz89ZAtVhOqDNbopuiYhoJFteItSNm/xfZw== 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=9tN8ij26V4eZHVADKtxTxTbo5Z3CV4Oy5E4MAWJEEjY=; b=E9WY5zNIU8StiDKY88H+4gu5CFTL32V+HJA5wd4kGb3KB8jEuDf31QZd7itkVR+HkgrNnRRsWq3lBs+0SBQJASh7lJMoSj5bWNPpvIviTbGUM8CoRxj4mnsX1ih36WUh/AkkpdnOSxSbNT/CO9KmV/mvboPDdckCJ4CzfQoET81uZ2WRwrD9Bnowe654gS/SshjnZ/CjAgmhBtXzg+VF/zThquCmnsOeFRXkoxX4iStLjDlB6E+L408dCa80jqwBDbYSMVolDwDBn7KTFDzIVvlYN6ypu2D3j8OWwIOy1BkJqAmVMLYW1Ar293oKu3xXPcAC9Pp6mrzaJB4Kl4SE8w== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:08:30 +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; Tue, 22 Oct 2024 06:08:30 +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 v4 net-next 10/13] net: enetc: extract enetc_int_vector_init/destroy() from enetc_alloc_msix() Date: Tue, 22 Oct 2024 13:52:20 +0800 Message-Id: <20241022055223.382277-11-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: 20e80055-d207-429c-e1dc-08dcf25ff34f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: hRURA9dom5f2ehreafm/wgAIgqVaN6G6cgfJrh9eo2hCaRX7ddlJrjqzaukvofvrhJTUm4qP0+Rzvp9cMoVc6Ww279+t5h83HeeRta/TYVYNdk3Nqx4g35+fT43hwNI+tZ0DIdLbc/bp/RbMW87RdfKAog+Z/NM3cmrq83nS3UauhfXufah4A1y1SZeAMgCLgcFp3e9tEVPeqg3xdV3OokZ6/pJR8fBlBNSSt7KB8YulGADN0mKhnwS+axezB8AElHM/W2nlvb1KHCIZxORjvoxXNM9MvHqf+qIC3pzrORe03UKpCs+CqdAmQ8VzB7ZQbSKMaxCXvhHy2/9nZwh0L+a2GNzd7NutbLqty1rorX2XKilOOo7xcxuMs4zPubBnZzWULcsy+LXutlEv0iw0focvhjAHTE5x3mUR1cqf1FVMgWh4pNJjOfeaIsrwbwVEtSgzPKFTp+xDywdeCwvZTfKY34y86W3Hg74i00nvVlO+z4XSc/L1teqozy8U0kDEbV6wGclakV76sE3i621lomuY20oJfsgsROY7l/iAN1gc2U7vqCXjXpnHHOsekQKp1k2J5GM2cKh7l7np6jPjtwJz53C8PTtQfTaU8LOik5R0jlcY+6ji5HhZDnmpgXgIDCDUGd0sUq2OwHn5GsEA0VsML9JY/RUzKjOKDsrhBq5dcTwslSzwA9pvcfK0kUpr73Dg9/I6W82LDBRUFsOUwIct7XddHvhuv/5a7oaFZI4OlT6fywpTc4s5UUAl5nbEHgXOQWzVNFwuWbm5/h1j1IjU1yjWIfDBtNoo3AJnU2MilUMlIwocYR/t1y835sGWIcNXF8RBD9zpkKJIAIW4K0vx4fBB5YhipvWP23l+4qfFJtgUw1Hl5jBf5qCeRnxugK+1AsvWucfjStuVw9+HtdekN7LL4WL3Hp0JrlYLmWUyT+19TZujAwzVRcSZF01EHhTwYj4f5OT7rhygiYwUJly9Ihy7adROoVeM7sW8Ayv8aypQr1ZtGmDyMtYM5WIT4uVNZY993EZ7I0sr7Y5YRSqTrtqIFP0+GGfUC1/6GWJGagQVPPjGJCnv2z3AqT8MMXButPV3mHnwUo9TJp8eeolwjPUw/9VQtd42WdHbHrUJ5wwBCGrj1s1nGvKY7CF6JQsUkh93kVtBs8CF25YwFrXbm5CEH+pQQAJUDyIpUKPInwxeLd0pu9BtKOfx1/4DX81x4xD9xkuDC4Ascx/Dyhjllm+t+ds0deTmfW89EqsVnCCD2rOQDqQlCA8UAnwZR3high++5vRolcIw3tyiWjjUFRRKd+cphyjHWHHyjUD7SZt2kD3k1QOIsqmJI3WVQji0pHsPwZDHqX/5VbFhw9V4UAu/qHIVK6J2xzaYcFmwN9zm8oLhV12kFansUz2u 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YEyaHb8qIZhSIHPS88dzUhGPOL0x47Dh1oJ1eBWRnVz6ZukfXcrqLlPQUZ0teWc+acMLBudlzTqjXrwmbU5lRsApfVL2uoMDPFkjAoxkkRVTjAqBsq9RrZblFNtk8JBYte5rmjdO4gLdFsY8W2XVkbtPcHHVg4SoTiOkNqTBK+MsT20In/+WxeHC9mkkAhXytnOcNrbUeC3w6jXeIvssO6MSXEmgA7TIFS6s//y5VVpUWKk2CXf8awb7TIypjkLnTgat7q9Pct1bb/1IjJzjW+AXxQG1C8OtDVnfOZtb4Ijr5Q+7ehqP722iE786T84aoD/N3lkcajTmRHkTSSeojf0yGvW1vTGn066LkbpEMR0F7oYlvpSBaPVsyQ0w9JCDxaZj+69bnz4q3mctJR2BY3wM74Borbs/WaBnigyPCHCO9fpRw8DWgAziD/hpFQq9X14qmwMzBDggp5jgtAOYHNAhdwrK8uXLMb8fFDhCuX/Q4eujKpwmqygGAL3ZTTIFTFWPEUwZ+9hr36dXY1scT1h1R5bJiPg6RxxVc/CCYj7Uf8vr10kT5mWUn+GNovIJd21wOPBc+kOYtO/QNmv+i821XFR3V4x7VjTs+ag4zizwq5mIHZW2Od6zBkxKh24VmiO8sl1+CPMX2gkGe/w8d+5WJQ9mRBTRHxSKY0x+YiynQjNDDIwGNI6KNbByTV6GeUWSEK8f4HkBvlmGV6Bfovq0FURQxow60oPpALanchvObljFiI4HPi1e7vPX8JbQATuKTczWd3r3JrgyAf3sqh877TBQvaGRH4s6Vv1Uq77VVDaIeumUE+lSgSQ5ahyQkal2z6efTk5F+6m+X2Y73S1LHBKcOyIarAr1O4BaH7Q+VfpZQ70zuJxp+XiIhrGH7WoGxoACNnoxTDEmGI2TiBEnD/Ki0JVHBU5SXVHz3cdqPahp2uVB3IToMEMdgowHAwqfFwLPPIsEyAgeGBGJVB657Fjfo+dTMzpIHkBaldxZsRLstypMLFPfq1V9r6xcHWA+kAc3mYnuYlV83t3xyZNJK/ejTY1AmOzzcYTnjhm/j/t6Yqf9J1XWnDlmltr6IzNM5LflLLyP86+oulhaMxGI10aKIfg2W+TQT1esWTH3ZazrVTPil3MGafH4cRtNKUmyHXITjt5t6I85CkyfV6QGAc21s12OkyAwPyl0BP8ZocjXahuPFOogAnYRPftS8PvH9HxBrEXCI2STF9WBhu8bSLwinrpgb4LMwG19GxB72nAtWc8sUmfen1c5fHl2BPKTvT/einOHDfT4zsKIu/jUFUeIsFnlWUi2V/PMmnd3eBIYJ+Gzkut8OAxl0CZa2UrFS0QfS8vlU+fGyhtax/FGToO4ZAAJi7iTWjg7jgU/FzX7ik8JrUIItqf0A6eOPfYWwOjWKATtch3bg5HKSsqPP3tx+UB+5IM3FILnwECBr+tbwHPs+KIwWpbJv5zNJXnGtAIc0X/8qJ1KoMabGMVdkirpB/H16R1lKgbDn9PbwxOTdNIc1QSd8RMG42OllHts6R0QCcY8DHU+IpMHbITQ1cltoEL7ivThPux/gra0IH9Cxs3cqAUo6e9VkTmf X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20e80055-d207-429c-e1dc-08dcf25ff34f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:08:30.2590 (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: bwF/euFdESp+GGEtgOlFS4hImGZ/aLmJILQbj66LDMq1C466FiuK5EvSFfVj2j6bM0w0faHe+XsVoE/r/PPMwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2 changes: This patch is separated from v1 patch 9 ("net: enetc: optimize the allocation of tx_bdr"). Separate enetc_int_vector_init() from the original patch. In addition, add new help function enetc_int_vector_destroy(). v3 changes: 1. Add the description of cleanup helper function used enetc_int_vector_init() to the commit message. 2. Fix the 'err' uninitialized issue when enetc_int_vector_init() returns error. v4: 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 Tue Oct 22 05:52: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: 13845170 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2060.outbound.protection.outlook.com [40.107.21.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 031B41474A2; Tue, 22 Oct 2024 06:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577320; cv=fail; b=D4VGzNhtewoZmcfXfC3W2Te5CQQUCli/AvWglIVxtFYwfDbVl7qjFWniS3iQRw/oiHoBdIvl/MIp6MqZ4d6ygHhhg03MGBSHNN1yDODaawGj4ONHD7SjKjYp/NtMSpRXN32NqDi3evt1mkYoNQWUpMFq+WFFTA16XH23TkAj6SQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577320; c=relaxed/simple; bh=kFgkmMpBlZsN7DM9JNq97B87Lawof9byE9hqTeaxjlU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qYjnUxCZeFNlP8GoJ3YHt637DeutVXaRAN8qOYISYXRIpzHLLqCvHVkX8JVL0FQbUcp+p8MLo/pNBVpDPPH3ahKCKaymAUDzoX83nK3KaidtoQtk85LE2xW3VwjEWg8U/fCvYZBV1bXa914IgM2pboGwOyXU0X6LXXpAx1Au4zc= 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=BgeSXHuw; arc=fail smtp.client-ip=40.107.21.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="BgeSXHuw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bXGIusmVq21RJcGIWkkMcpv0iGUY/KFDcTFhhM4uzAxWlt9oOe60wk8NpPgS0eegctE+wL/Zv2o/0WHdBsSr5U3F/vr5FpRjTkXxqZYyJiIYG/HVx16/kD9N3TrSp8ISm0Ir6AMpaySfQ5s0S4HTUyHDjbClqLLnADelLNk4zAqH6kOHruHFF8ry3a/2TVtaQ4AQM8C4mT9KnbSdG1/n76bqhqdAP/KQLFriWmx7a+WRMuW58WtnWAo2M5dmaH0BEQDtJYGzwl2ELl6s8WP7AQ/LuXS1joB/zP+lrQmlZrDNRDqFojO64vcV3aUHll7Z/Alk5IzoGyuHl0xCuPSniA== 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=cdAhcwQQmGPB8MZ/CuJSqegdRBokGu2xj4as0U81KXI=; b=Ix78J370QEsq8yRN1uexEKoXkaReTybUxQHi6/hHSm1yZEqkJsD6+BkROGpn0JPcIOXlE2ulT1/3GYLCFTsLW5XlSQ+dwzALwLi8OB13w7anBYTnYjgSdZWyvS8S5eD7Gcj9qlHPGjEz9CBHGdAxJ6VMQ4BFhZPJGCVuw9glk7vda1NF/CWHmQ4tZcW8bOnXs7eKHTl97Sj0qkzy8pONr/1vEpSeL5ESWIcipsAs3kaIT4ucNBYxZyi0ZjvLSJM/Cc/z1Hr1BHbi4EWsjAL2jiJTZE73LvX1pvXRR6lPuG+Apm2qi4YXuQ2WZSYWKMsckqfxBLsoVxtzEAvfPQX0/w== 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=cdAhcwQQmGPB8MZ/CuJSqegdRBokGu2xj4as0U81KXI=; b=BgeSXHuwEi9ZZr63ZyrgUERXHVIFoD+OSWc0llxLnMPtgMSMYIJht6GV2CnzNd3x5La94bLdqMWZVlwszon48PjCn9XJdk/oTCy6dBf4xTKEhV7ZKJtV+H/5sr1aenBgk6Vv6rLXrs8mnPv6F7ic5XZNRewDbdTt0WHIZxY7ORICbbzHK0EdXpbqJExZ4FygZciI7YoVgcwV53iS0GhNmkz5LpL4quQc1NyJxmo92Xvhrl0r91AeUXaE9qsEeitHrHnMjwVp5VPdor0x6OIIGdUcz0GImzq+XoVysdkaup5BpQqfKtsCtL+bl18ezH/wBLXw8X+V2MVscj0MT4ZEWQ== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:08:36 +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; Tue, 22 Oct 2024 06:08:36 +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 v4 net-next 11/13] net: enetc: optimize the allocation of tx_bdr Date: Tue, 22 Oct 2024 13:52:21 +0800 Message-Id: <20241022055223.382277-12-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: ea7e4a5e-0173-4ee2-22fc-08dcf25ff720 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: qjmTH7ZGWILUgAFHMQs6xM2Kt0Ip+mfaWo7Uk1g48HFESIKbi+GdijfixAAuKNRRxOC/JyLeLBrGiZRsB1LTo4a+3psryIB8Y+jUBh+RM4hb1C0ZhUH+P8eSaAKv5v0hDMCXpApEFNwB9gDkumO8xQ2XcbdD8hbcpdHPIUoPy1c49XQhgNf4V2s71Bg93L8EHSlL+N2W2cKcsvJYyb6Twa28gJgGTmf7ucU2um2VKkSexdM2HoaaMxrNBPydOSIM+V6VgT3PgjJJKEGdjyKfeTXRmUSDv0RDg4n60vL3XHNvb7nDixaLuHebyituMg9NRhorUv3yz+NOZ4HXGH2E/ff/6x66YHFxBCgqi+9dtm0MEzpoEBEgrOwt8OB4fB5R1oRNDhZ5dIQyLiQqyi2M4V0suLYo4R9V8aV4GyUTRPU5fK61r8gUUGOwfgFAKuQZRolJIXBYWRYeYv5ds2F+Fr7O5i2eu9XfuhsPqK7sLn0emcQpDpe9Bixr4mrOgB45/utTALhP+TEJIUfXhWcWc62ug5XZ1VDPCSEVGWzHjBwjM6tu5i0Rp5RN+NGSAVAQZW1tOJ59Zxa0+T1ogXRZCEP+RmcuP+YHWtJORHJxlb8RuyO4JZPeiZnv1QkCFqnVQQG9xi0frY3waHKhzvXhIz0Lx47rPbgHXEiQcM4F3RwsTjxxzCJe2oRlva/F2l+U485V2a6vjvm3LpqN5sVWgokNkotx8ESHcjPzw2tO92L7Zdj2asXnK8baY4btS8YIij3U9eLwyI20xKeq8m9TBT2x+vYlyL031D7PbiGKDpG6t7WHA4IS4ospQrcXBrRM6wlDytw6kBW6U8vVsSmYN1CGXgk13Gfpd6y4hmzD1hFqZhdmIf+7/ZIPpD0yjlXcgZ08y8scOIKlxChvStltNr2kgpd3h9LqHM4F2hQaynyimJYAlbJSTQrPsmsNLoahiGCRQrojIclXQDKvyv5ak1/LebNOPQkDZxX1XlI230d12LISS3LmyX1cRwN461ikhA5/j3hB5ecsgS77CTPcKIiuwjnftc3wM0bbWuq/f3h9DtfaUCan0L0i95DfnysSQ7eMt34I25YLsS/+FXFQ87DLSw2o7GyG3R4tIHwyaH1rSZ9Hj6q8en4QO07imk9HKzF9p0laE/pq3ADRKrYGoz2kihuoSzPQJPL3N7l1g7yrH3HcYLjJ04Wm9ZXrdP/PZ23aT+SU6O4bIk+e48QUpgs8rOMAfQGZvrPPPnj8affaRSLG0lVQMPumNSHK0snnrXmHAQM0iZe5BsRFEohn0/Iwa0zWOlHRmfkUwTOY/qyRmyjuesID0UkK9b38nBYnTcWTXNjMJw9wD9GTMo/gYOnOAMeXtrnZE6a/mrxnF6A8v0UpF/aO1Rxkbwh2f0wj 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RaNQ1M/11Z6+ehPmQYZQdzSdRacKY9dIc/oBhWCxo/n064oaShQrZwx7nUokP2e6qxogtt4j06nf2kO19z8OZ8XTDBivvknmAM7uVEG/gy/E8bl8dMAvnY9qqn1jUZe8sCFCQTM2jL8NMqDmXSucufqQ50TT1jwK+ihvDUZtwaFdRVI8lHNnFywcp8byLcF/PKWC+Zi8OwG140D1E6WboG/K2KLcAV/huhQbH45cuKMGEDvlAfO3qayW/pRWlfDcnVVy/HeX3dw0wQFQX0xjW7j7zdP4e/3DHTpw8SWkVzhIA1wPUBU+sOomPwJqNbrp+uRIL/FOAHJ4cce5xdL1Y0V9AR/jeOXDa0XecuoR6K/ZBOJeWlCG26vWFEgNafc2WssPlL8MvlMp88JnHJCfSqObFWAQ+38+kUnnBjkikB02SYjBsIUzMEkPrrfyxx9eIn6YHtCoPE/7faUye74ZfjsISb+HQ2MY1OB4XzdewaCXP068HQ2V2U9naXzLLPoK+QIjs3NjBy6Ya3rLfX3zcdBBgsHSngFx9vjckjsh5lJnLg1KRRvQIiFBeE+HTJkBFsON+q87HSpEZ3z5+VUrUmOxMelW6hycaxsWmPM83NDWCmiAmQ5IpHmR+u9DMYibxbUKqZostBW5AnTV51+sqf2Q8sPHUukwX858GEufGWvMVPnLLS1KyWfb7abtlYWeEXSacAbAjSbsCJgeJemBXjgOsMq6Szd7s6TCcBsPWnUSuvi355BUO56g44QPMZgic0r4KvfIjxrpgH6bpKCsEbbRc4nNvyaH4gPCjuRuxhuzvHvNpxDzfQrk8L9JciKP/UEdebt2aJl04jtyfxYpbxiVL67LW7QaeNF+CbBe0d+iBTyUPSutJXW1Halh2zxv7dryUmAigf/nK725+lUbgTk86Ltl0ceM29c7E/IKDptmKc69ySyWSZxiYP7R2RQ4oAbPf7nJvgAeSFCIkElHnnD+0hsd357tAnz5rdMKQOrd0R5bjtgZaX5Nv44eHeU+UJDdwnX6jqgMDEezuXHuUiNobmgocfRIlgH7h77JuBvXARJtONNfYfndaX0VwTlVMYMmFw0xP62ioekOWuQ/WCqUfY/U2Dg+ygWiF0cnFt6Jn2lC1srna+EGdgUZjX/8x351/9HTu9szLKb/Bp8NK69hNWzvCvfft4Bsyj6qsn/9C7RO9yFQ+8B3+aQ6doVbTsptZU2/vM0XHO/6biaZYnmxPL7s11VaTewJPWGc3Iy38LERzM+XCgdpoBCXc7WLov2Ox6A/b1tMKvSW9mMCFo6KdFx0WlGaqkIysgAyUCocBXvjcJp2ZhukAFCEihm7O9cqA3GjPIZNEfpuVskbdo6Nntr7Bb5ixub3Ce2i/OIRBPJEdVFIrtsYe068xWeUPyfJ8i6Vx9EpIWsBbpZlnHm0Nix4YxtawXn7T2WdWBuQFeardRic2+NNAsW97kFXnyXxWmu5HVV5HPeYfOT65KIqvNN1N2Zkcj6TLe0ohW++orTL1iivxRvMgZthFAIONseoQL/FX2ZMsBqVqDsQT2ZWWsxOXnpXWllkntiLl5PghoRbPDwIEUMGACzcK2+K X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea7e4a5e-0173-4ee2-22fc-08dcf25ff720 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:08:36.3996 (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: BuC3jZH92avA1d2aq9JYFxtpvgdIFxvpHwQCphEeSQefidMdN5sXdojhpv5QOsYqEt781D49SmS7U+knPuhXug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2 changes: This patch is separated from v1 patch 9 ("net: enetc: optimize the allocation of tx_bdr"). Only the optimized part is kept. v3: no changes, just rebase the patch from the previous one. v4: 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 Tue Oct 22 05:52: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: 13845171 X-Patchwork-Delegate: kuba@kernel.org 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 344241940B9; Tue, 22 Oct 2024 06:08:46 +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=1729577329; cv=fail; b=fhlUyQExsrj/OtS3YDu7EcQkz2tRp8AavVav5346Wt6W1E1oFyntb71tv1+AYaFsn2XoyfbB81K5avfV9WHvO/ZEeCBSeu9bGQCaG8fOP5qJzeLfXK4qRteyU4cICTbB/AYEos0oiFXe6Josfmr8DrQhBizcgkhVLd4atk9eRCI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577329; c=relaxed/simple; bh=I8O6XywJgjHQpS73d86BZms6I9xdAmQCELYvS7VWaw0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=p+WcjO73/WV8IN8RVmMaffh4pS940bFG//iZrqaJZ0KAbFSKwKfk9Hk5SXkRlDJReEY6VIjQgkrjTeqWvqIUCbWHhjix4Ov05psm5/fm8D3FM+QUP2mjuOq4dr4AdWIFvU9VmvI687R8BgmyUwYW8TEX7YGIwuqlVPSlnrKVSDU= 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=F06DRBGZ; 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="F06DRBGZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i9mSiWeeVwB2YO7GpwbbrjcHyhkalVIuWG99nPUxIY8VFPBW2gHA8HQcjqsPFMMTaJ6yQpiyuHtZBYYu3+ylC5q7B0qb/S1t7A7RXcS4FKaXuD36RoCACZ6IZw5Ewn8WEgbm+y7MuA4WoTx7M74KWK/dF4tDDlOTdaYP10pKiRR9Lv6JgPs3QBNXgf2qpJBZUwVk1DefxgI5mvxcwXY6U3DFaPY2fvCSVFwkNMm1oj/S3hWKZg1Pe/wNGWlzxLGgmebH4j3wZZmRWiMJ40Azs6JiDfDxukCRtbmQBEhwY4XUo31aLePapWviE4dhlK4eZwHUY+isisHTJVZU9q7jWQ== 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=BMokCkiLNd6BQOHZrEuvEt5YV5Fol8atYPwNoDAtJaU=; b=RPufJ/ayr8kxdPdUJdFvIhFKFZ7zcziEgrm5JU+vcne6AvSBWd4TlUM2wTrpwko93fn0CzqDngLUPFGUMmDm1jBpGF4CWtWaX4yUFLWgkuVQYthcrtNIJvS+H2mt6mUcPIL/dlnQhYovKsd6gSVBeLKtJkNPzziZ2VR5TAuXOK0qRXm9qYFI5Pm3WDRvLWGio58Hx0ZHT30975P3ZFmy8GXIbHXDAvOnegL38zoHwqLabkg/lHpVUAS51SK3EZdSHt8O23tIRKtBeSnV4LaM93tjjNEup6BgNEEHc2WPeMoMi9BX++eH4OhNsdLnErMG88KR4TwpQH8e2LvML5DaLg== 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=BMokCkiLNd6BQOHZrEuvEt5YV5Fol8atYPwNoDAtJaU=; b=F06DRBGZbrNXgYBxhpxMHKs93eAghshZwygISMoBvqz91FBQTaLECILx6QOBP1LH2oIkTuU9rT4q9mqZh8ygmU2g0gwcAuj4A9ITlLAdx7Q4qYmOoobzW7fM+EMn9QbvtKZ3gtR0qdPShoMUtWJD8amnvX+ljfpX/SUAUr5dZM2DHMzZmFX7Zv2+vpk42u0S8AoGbel0B5L7UWTHznXMa6xprcRyku8VndC3+U5fu2f8V0zXXb7MZmvLpgChWhWwaEDywfE2G2K+UkRukws4Khlc2mbPi7Owqlvw4X1mn/7z+KGDqZ0xUEuDCBk0Jsd3mzlmO3PG07zSJYsNSdHuDQ== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:08:43 +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; Tue, 22 Oct 2024 06:08:43 +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 v4 net-next 12/13] net: enetc: add preliminary support for i.MX95 ENETC PF Date: Tue, 22 Oct 2024 13:52:22 +0800 Message-Id: <20241022055223.382277-13-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: 456dee78-84d3-49a9-49c2-08dcf25ffaee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: 4D2it+1Gc/5t1Y+VZUDEWni9HEoNi9O/2dheFQC59U+ppFP122sUSOvM2Fu7wEborORvEbTOXuD0QaoPIPkWswxh0ZJumwqk/76Gjlp8BJbI8Ug5sd2xu0tae/FLAvaC7Wf7RodhYy4HH443T2mPZw3RTsjjOM+a3NeCEEfGuw5zNxy3siHsADqDL+xfEqjJqIBxjGd4nInmVw4HVGMmOdRfWmN/WZFnSxwtFN1PNv920LToLHXEiK6Mylpo4Oerm6ooTZxRMRndL1Z98DM12yWojnSZAYxbCMzFiu/Q/7LPVOjdDXffDUTzlk/ixMrAZw8KxbWhU1ywvPq9DvENqwLsO/chm2QdfW7PwgUeasXZaR9EecEUUtqHMcWOUUsawg3/iklFV/g+u5s9+6Mhga0NCGhJNiXEOrxjmrBFPyGK0X5saKuvj+hOtAb8VnImMdEbaP8tRaMXLwILCEnHIjXCpZ+2z3JxxjW8JeFP1nB8hvwnopNnEaCOQs5U+uGZkUUlDlLkWxe2O645i+1nqxVvEJfxeudA2dxUOGYHLz5W8hVsDbN6gTxNDvsZyYB74IkcJ3aSUpACm5N3+NcO6Yncdskj19RrVxRCMA4TQf6TZOBrLvohxnl5YRpONqQ5mnBa2AHN67Ymcw5UmJllkQbE4P8CeVy6SFmV2cYciE2Lh97CdKliFqLKhvHNVFNLDLPyiLgrxemvk9qq69x+iqymr7mZIWYLTGHiASGehRmJHZqY7pWndVEQo4uJDZiqewrGzmubVZBzY8brr3CEhXLDtxYzKoXqXpoTExIcu1jbrCq6Tq8msBfpdPo/M/5IQue1HTlkifIlr7T6waTqrlj2IwXfUyk5N/EgTOegu074qCEtGj72HNELbdWi1oqG4w698pn3tUFSvvsTUi91Aty637RYWy1t+v/e59NhDDk1bJ/sN0P4GQzyQUV46+h7KBYvHfg6uPlQnt24M3kvZmCwMFZvzHmjCPzY9NL/kW30PanOuInLMQZlWpf/Pbex3pLvHHHSrhrGAsf0lqkV9MtYUzxLH/Lw5slbFe3mLPJKdYQTsoBVqsLjXxT2jQzssylO7NohgJELEAo/f6z+TxLKwjN7pi3ttRgn074fu+g/gDoYrpD1qjM9CKxSW3gi5N2edgmEmJNBXAcMiFeaX+RGFRcG/W9I4Lywe4VjAB829Ughym6+rz9sy/cqhj6uAV65P61al0Vr2eV+NrtPwYB0AXkxFvd1dJfiwV0wPDo3RUz48wxIbiM0LxYKwOvvBI4EeNBkRG31qYQibOdntWAJba3x9q07JB3iwHdrvAUWpY/1Ep6gEERwGtAXw6fg2NEvNwHbghZ5hp+zpWws1npAEW/lX/fGeU/kPlF3UEEgFYyjtWnKAGNNPWjuR83I 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TOnvxT13N+rzTEMwvw6VYOjvxiBgUDBH5nZAISiyzelDhlU6mwBLkUQnyqF6VhC4AVdL17DT18tkKnsb5d2aRi57o4bEZmKlS7GrnsP2bUmMXy2PFMBvu742wOFlKCzO9JDJpbI22juVkNDteJeNkLxZ5O3zYE4dHX6IPbpBjuUoKLg7mrxiFzUSnQCYH027hHzLylV7284qrkS5MJD8fmMEd3l+T/j407/cjFPKcNnX/UlhqYh+1sfsanAInVATaodhPP+nGciGcj2yUUnKup48EnY80Rh6zDXVT7JR23cAKjgHnYkAyhncNgdi4QsHst1Kh87YNH9DokEfj9h5OPr3m3jCzCR2ni/S3meC4iy6kyhDrAWI9wBG9PjY2eSC0SZAIR8mZC5brceUT1WmHLcgKkPAAj9dSpx4cocCYJLh1yKLWACd6skD8RUSv+74Rd+UhgMkLpMBtWUwf4+Vv61TFuoaB4DJ3MEIAef8ZbSpmZeuV+JOftuFvbxM/vRpEMaVp+METhuY9iWbTBN/ht8FzY7sWmupfh05VMIxHiGruD6YOjaaoVePs3I4z0ZvHSnX2MHkzYeWC9gYZxVCl7RwjnlPV0CMzj/x/18nk7l+rMqIbHa2ZGaPoIi6UaiSA5sWYw3v6DyATXNUy2NuyfOlY6MvFrY7ggHL01QZnwuJENr0gvUxp+a/P4B/KTF+zumGat1PzwJK/Ido4i51UNeVbGiN7BIyFV5rVjT+xW9PCe4bbAL8bg/uzdZh1wJl+SWGblORULXJaKNpfTE9RTNfXf7CoQmFEZXOI8FW289VoxnwKy9FmGFVa2UAWiVPraBymfpRY+XO5ElX41XriED9kpoflRm8qs0oAF9xh8BPh4nnsSlsYU8DJsDZI7U21cN+rnNSzGlsVyZ/WH4JzXZoqekc7o7iBupsowpEn13b6Km6mErnLRlLDw8a+yVapf8646GbVIqDA8j/fnc1k/ApiNU0TjTLy1Y06vV9QLHdqNjehpWkQNpP3O7mo22em76woniiVidenDedW6xB8ECD7dOwedugpmr2TwMpIcoclPbkiiCTW/dve5u0g1XJXuYxaGOCOw0LnZSmvHUU6xVJjbXnRlgTjKcTZTDmZKwXp0mTYumwv4XX792R05bg8DSyuI9D2BPBqVnv0O++efyW9Ahfrg7gD4oFl3xn4pbNQw5batEFsPyvXBnaHC4ccnmC6V+E55l10JOljI/5XGN+FGK9rLczoAHsHEtzAnfcmHzCD7C6/mu4xUPqS+cZcKndYCgSDKt2uFP0xNMf2Kcut358i/uELaRJn37fNDoHohfWANHEWd0H8LMYDqAsCA+jkoY84iSuQ18MpAofetWNwXN7oPymg9xtMhiFdbDPnpRDNw9y79uSlu2nn/jVkiSf4lzEkLXL2/yOUqtp7tysC16lFnUx61/pvH1hZ8G7E6++VopA1Vt4KqJTyaB6jTGzSeWsMDLOdBzse60vkpbJYzaLhiGvIzcNnnnQioZOHDIYEX17Bra+MrXWPC+RaqNUp9nDytJ3vmIR/o/6zbZ/LV0LlLQu7N6LDY8kxTHFItagAYj6u7YN4cSniaQW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 456dee78-84d3-49a9-49c2-08dcf25ffaee X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:08:42.9093 (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: DU96wIsQ4nI2FmbhR/sOjfdchedERDw9REFEhQIkTyb9J7VPARk1ISupS1oCi8cRO3JdZQzLQCldKuBsfsG9dA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 Reviewed-by: Claudiu Manoil --- 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. --- drivers/net/ethernet/freescale/enetc/Kconfig | 17 + drivers/net/ethernet/freescale/enetc/Makefile | 3 + drivers/net/ethernet/freescale/enetc/enetc.c | 38 +- drivers/net/ethernet/freescale/enetc/enetc.h | 13 +- .../net/ethernet/freescale/enetc/enetc4_hw.h | 151 ++++ .../net/ethernet/freescale/enetc/enetc4_pf.c | 753 ++++++++++++++++++ .../ethernet/freescale/enetc/enetc_ethtool.c | 36 +- .../net/ethernet/freescale/enetc/enetc_hw.h | 13 +- .../net/ethernet/freescale/enetc/enetc_pf.h | 9 + .../freescale/enetc/enetc_pf_common.c | 13 +- .../net/ethernet/freescale/enetc/enetc_qos.c | 2 +- .../net/ethernet/freescale/enetc/enetc_vf.c | 2 + 12 files changed, 1024 insertions(+), 26 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..1541c1bb888f 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2,6 +2,7 @@ /* Copyright 2017-2019 NXP */ #include "enetc.h" +#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->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); @@ -1742,8 +1750,11 @@ void enetc_get_si_caps(struct enetc_si *si) if (val & ENETC_SIPCAPR0_QBV) si->hw_features |= ENETC_SI_F_QBV; - if (val & ENETC_SIPCAPR0_QBU) + if (val & ENETC_SIPCAPR0_QBU) { si->hw_features |= ENETC_SI_F_QBU; + si->pmac_offset = is_enetc_rev1(si) ? ENETC_PMAC_OFFSET : + ENETC4_PMAC_OFFSET; + } if (val & ENETC_SIPCAPR0_PSFP) si->hw_features |= ENETC_SI_F_PSFP; @@ -2056,7 +2067,7 @@ int enetc_configure_si(struct enetc_ndev_priv *priv) /* enable SI */ enetc_wr(hw, ENETC_SIMR, ENETC_SIMR_EN); - if (si->num_rss) { + 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; } diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 97524dfa234c..fe4bc082b3cf 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 - \ @@ -247,10 +248,16 @@ struct enetc_si { int num_rss; /* number of RSS buckets */ unsigned short pad; int hw_features; + int pmac_offset; /* Only valid for PSI which supports 802.1Qbu */ }; #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 +309,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 +347,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 +394,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 */ 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..b53549e810c9 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h @@ -0,0 +1,151 @@ +/* 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 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..8e1b0a8f5ebe --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c @@ -0,0 +1,753 @@ +// 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 & 0x3f; + enetc_port_wr(hw, ENETC4_PSICFGR2(0), val); + + num_msix = pf->caps.num_msix / total_si - 1; + val = num_msix & 0x3f; + 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 < 8; 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"); + + 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..ed44d27cc6bd 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; @@ -1234,13 +1236,33 @@ static const struct ethtool_ops enetc_vf_ethtool_ops = { .get_ts_info = enetc_get_ts_info, }; +static 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 + if (enetc_si_is_pf(priv->si)) { + if (is_enetc_rev1(priv->si)) + ndev->ethtool_ops = &enetc_pf_ethtool_ops; + else + ndev->ethtool_ops = &enetc4_pf_ethtool_ops; + } else { ndev->ethtool_ops = &enetc_vf_ethtool_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..a9b61925b291 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -25,6 +25,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 @@ -971,15 +972,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.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h index 39db9d5c2e50..5ed97137e5c5 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; }; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c index 94690ed92e3f..6ce0facd2e97 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -121,10 +121,20 @@ 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)) { + priv->sysclk_freq = ENETC_CLK_400M; + } else { + ndev->hw_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK); + priv->sysclk_freq = ENETC_CLK_333M; + 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 +146,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..5fa2f1db87f3 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((ENETC_CLK_400M * 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..2295742b7090 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -133,6 +133,8 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->watchdog_timeo = 5 * HZ; ndev->max_mtu = ENETC_MAX_MTU; + priv->sysclk_freq = ENETC_CLK_400M; + ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | From patchwork Tue Oct 22 05:52: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: 13845172 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.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 F41A113DDA7; Tue, 22 Oct 2024 06:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577333; cv=fail; b=Jtpabzym3285on9A6r0uK9FEfHgt2P5FAhBUaQGUibM0ocCzXTWaiBT7TVAWuDE283WUPzkCUc0Kn2G+M4cOHQqR0AGogaLjxCQVKDfin6K3+epSFzeNG8HaKryb0LlLHi5DwBmxGn90OirQctOQ8qf/QYg95ayMC6g3fhRxPLU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729577333; c=relaxed/simple; bh=CMR1MTWBRh4PtmuCnZ+YzxacBVOxQaUaEfp6mHI3Jxs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=XlGw2ASlYBSu7CLv/hYDXOz2v4QKCULp7Loh+jxZwn89Qt56iO1w42ouhuJ5U5/JmNTwzmAWmX6gBp0P4p4AE9Z+OYY+06iot+AXNX+HzZfEVNc+3AqJcpP1MbiR+RHiBzL4hIcsyx8XXmA66hXqzZKzgcgc71MSSR/zj6jwc14= 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=N6BkwxKk; arc=fail smtp.client-ip=40.107.22.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="N6BkwxKk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wbPKVd4zo36/bV/F87H8fyP6Q1kfSfn7JVJuFFM/MONCWTGnVsyXCE32UnS0OlijBBR4hP9g5jUbWr8HZNktZbs7lNcjWxMiNwT5WypnB/L5OK5zhbSo0VxYlboXY+uIJTZ/CR5q+NKVi+NkIPNgErIlIO3TNnAQVL3XPPxAhGBWkR0uZN/K7h2ehbwAXJ/ORe1+yoJdODVCrYP4CxXnhBNqDbz3kIR0MnGI/O70Ti9xTxsS8K0HgcaGj1jZlH5oPoFwPWi83J4HCMglcEBEYX1NEAY5m5AMn45ZfNPTmdP9Qap6EN9cdhowuxvaVc2ZpSMK7TPM91BF8X4z8kTWNA== 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=5DbjJMH9diPVADu92WgHGlNkPOBTOQUh4eck8ZNZt88=; b=wbR9/i83vyO0Jy0a5j2mFg6AKWjBRgTDm4XJhgGTSXlURVnwL8KEH1nXDRMZBy6VaXBGOx7zzp1wFOS7N2hmThgBMjnDYA5G2A2TLEn2tYu87UVsewj95xnxYpmMRWrQvVw53zzdEr0lwP6MwiG9Au0w8CT1a4WIoWfVzKJZCzauyEAp5gLZV+g9yDFEjSo32ZdrkSqzB4MUZxYpKzDlqhhZFaktqutoEM0KY4YP2ivfD5Y4jHnr6Rlz73jByzrMVjzdAgmVOKqMn0jBz1YGb7wuUSn0IynWh6d8gxwcZJIdkznfMusA8MxncCJP6oBG4OgMV5iUYUhQ/QRPce4PEg== 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=5DbjJMH9diPVADu92WgHGlNkPOBTOQUh4eck8ZNZt88=; b=N6BkwxKkpTSlxfxDEngH89e0NabiN3L6xFUiY8GeDAAkBgRLRICQmYO19gcoqCDaYZj4qwM6U7JTUSveEdO3q2KfhOx0eqvmkGFXN3qW+ZxDgRg5xFc6WIzY129gyirrZDPfa0B2Kl+jMNPRrfDe9GazXQ2LhNBtmHLiUYqZXEF5db9+YjCzp5bWKilYcu6gZ5nkItoIxXOllbrqC/4iTMlMVVlt//UcWUZxxIpnNlWDPCMTSOb8Z1mmRpx5DRrNBvjdCI7kGAdEuW3Ew+lNIrsFjWPbZGb0EnD/ZPEG9ytP5m45IRgkYavCgs6l3JHlgfNNEec1TXH4HsL/E859cA== 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 PA1PR04MB10178.eurprd04.prod.outlook.com (2603:10a6:102:463::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 06:08: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; Tue, 22 Oct 2024 06:08: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 v4 net-next 13/13] MAINTAINERS: update ENETC driver files and maintainers Date: Tue, 22 Oct 2024 13:52:23 +0800 Message-Id: <20241022055223.382277-14-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241022055223.382277-1-wei.fang@nxp.com> References: <20241022055223.382277-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:3:18::32) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA1PR04MB10178:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e9d305c-c1db-4d46-1e45-08dcf25ffee3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: tf7G8O6hZAu3XmLkuW3+YpaTFcKU6JOQs/JMH3BLKyBGCTqbZFn8csAgL/PZm72FPSC0YeCq4NTOXf2yXbA40xPx6Iwjlv0qJzq0XPDfyHRtwnUisVQlQwCiRsWXqK6UzEiJNU+7teuWW8t0Oysijmqh7QuVRjmnARRw55PzDFypKZzzA8G0b7BBvSzTYpDJSs8zInnyZ4eiee+7RzKEK4SbApFOadFfBW9P57cs8FcHhqH+Cn5/OFStztlcB9zUht+hw5R2Tjwz4Rrj95cEZkP/iOAibOU5MQgiRGZZEHzjWtHXnWxAwhP/X+zLiiuK9hC9KgYHdrQYVaXRANQsjpwAMqcaf5ChzSEHBjas4RAr53sJR1Z9xb/aqXbyH+4ALEWUY5Wv+kitaah3CzbxW3PXuuTC6Ru/IoqkzCBHxtXl6+QgoN5kLAELnVVksW4TJwIc80YaFLC0MenUMcYjhYNg99ZMr+PXTYVGVYuIhUhBC6qyhOb53qC4XAJ7iA/8ldOmb0oyFmXZx0+ie294UYRByw5RgcahDUYC0MtBwlzpOoIWd0Xu9f4CbxXe7ekyi0VFoz5qXkfpOa0di+mUSXa6AZMXz9MFBsTfehY1I21SHzZEw6gx+ZA75MSmaaaQTx7w2EY0jZEYM2fGOjlQ1wiWf15WKQ5S2fbuoRb6rMITAR3q12e1w8RiBdbAB6d+X6ULpIuI93TTqqAmUsKzhPw1OJ+6mwrGG+IutLgv3+H6gi+0X8Rnwq+on+TaX9zUpQW/0CvLBjkiV7MGNFGQ7/F1eo5bEArXZjBlnKeDsExK/idiPu1h088O5bg74Cxb2sagNXNQ6HSS/2T0Uo4cjKlPPV7d2D1pEh3JT/p+LOuXhmoRYmfZ7/QrWumqk56Jk8LFvgA/pSruI9tlQ/FxzSrGnvZl4VmcTrCyqwO1KGV8daY+n/gGrJ478ljDcC1YgPSkdSsbFROQNn35amu0znu93l7cbvwrMob2YZat89Prvp+6jNqy17GEc7fe1sGEZpk0nlJrfi/2g0BU9ZiVk8fPhTdErySiJVYkbpgxbzCOiWM2oRDCNKAQMuIZxjV9WSrg78Yu8tnxe7RB6l/dbCAeGtbAtuMJlFFOCKR9b2Ca0tnfQKtDRcl3Xw0Gis/eNTwON9Il7RT5tvWdAfWdWve2qva6mGHYy4NvVRywU/m7KdquGlsPbeZyn7rmEMkd+WOI/Ze1uWi+uP7CsHBrJCNcwmT79n6fSwH5wE0oCqic4F1PQsnInf6bom8PjNSSVHYcxPwgQ0ZUGBQRt9sCC73A3S6xmaVuI4SE/FL+stkQBGyHNeI9uYFIeRCrMhbP5+k78YoHvQuF1Q4sOBBsI6BSwUqOz/OiZwOF2g/5k1eBLil8lr4dbF0keBUif8C6 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)(376014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JzeIiyaQROEGLhX0XpkaPPQGVsxA/JMVBJuAtnaUJQrH5lx8fG/4O3csBFDwbhcZSJAIQ7vnM609ErDk3GL7gXXwkSqpDgtW9oVqd8FoFiCYk7yL269jq2b3EEbwCxnuWxQpXo7czfqQKoUBtGJrGi/V4iU97ENXr0HIEijARhiw0kbEbfjwh714iky2yQXta5PunH9OU4JB9H9ddgVu5tKf4PvCdUIV8nJ+xouF2ntiH3/1slVo1ylslBaQQGvEvIBEl18wkESmg7l7AkNJf76HvNJHPVR4X7Q63yEo7NFekQ04tit/YJSJzQwyHsGpoXPTe5XkcO8sZGjwoA3OYdzEiAM3DrLmmm7UkuUiKG8c23PhaSoRNF0BC+MCB0WW75TR/xwT3lVNwtSlKssACBYMkzo/udbkQlN7Q/vAOMMz+iJmo6xOc9MNVgtDNa75mBm8htaOpLEc5MfJGg0AuynfVm6MiBVE9y3MsGY4Rwh4wzzdgBGUhi0ToQok/fMSJIzx5RqHLTAJjQLTY6xhm1ZuutlavyfD7cLrK3NgOHO3TVi9Of6r8c/AZhBDe8qkD/QS5x1SdYCVkOVQT8SuxyK+MsLbsLOh+o0Dzx8S40u4vL0g1/2bIQjESikkOGTrVyIuxoBbfb/AUBb4M8wFlcPFwDgdHjus/DF6jh48Ifp6/yIWxW7Gm6vgraB6/NCTMzhVrfLYC+HqqwHkHk6OWc2gRA1MxRvhkJqHDLY/mj8ReM5FRPraovGD6X/EV6DX+RJJFlS3MdvFfD3fy29/TuLd4GgBndW8zmQcyxDxazBHzJI0VNpFr9NrTI53vOi1/5evdli/NyjgfUVhOQYFjWm2Un0JdjNcYXfgOq+/uIHcSuMsbtKLxjjL/l1nVz+MCutYumhUzI84fNhfojbT1vb0jwlKs00KVVfUSFuzb2GO2TKAkofdJR5I78y2i+vy7isXYsBjjn6xcEJtV/yGylIx9EclLrPu9b7/QeFTCRJmWPTTum66rDRyWgPuFAT1R/mK3xJ59ukAukTYOjLGk+zVTQE5dNNOwN2VM4+tMTvYsfCwPxQsxVJn4ubNbyb+VjsWfiOqz4htze5VHagdIvfhWis1+J6XStQX/2u+lRKPI69t6/bvU+HpQE+1vd4B82z+pOeHfmZgllnJ/4HtUbcdcSM9FAQJJdZH15GLHtwyvqudlJQWyCEwA2e6RLT+RQDeV9xbaKKxupZYzhOZofQd7a8vyO8ZOtkEskeruG9yhEWWD23h6C9Fe+VNQg0OtQZB+AayHZji2Q4uX0EsT5xHaT0jUcs4q7zLQuuPljogmhsUfoRYcHh8mQDHTdPmaYIxDBrkruCLS1c8pD1jZgM+CAmotjJy7AfkS1mpER4oQPHpjYD7eopC0horvI26W5261DmCFmQjAiVJFalYArLEIm+jFPM/s3sY4LGKNEryWDo+nVMfv70iWgYsqBICNFtf2rlMyP5EYr2TvAV/JA7kHsLpeI/IwnUbCwbzszATyNdx5JQMnuwCGgLgKQHjnGfAHFRhAWfVX3FVreocrLQkU9YW3reKfCpYS7hdJ6q3AMCdwO5RrtZ41aJbcSj+ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e9d305c-c1db-4d46-1e45-08dcf25ffee3 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 06:08:49.4740 (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: ZPum0pumvakuGHtFGoeOCa2/kST+lUgTnhYqRhAvFc02fiugRuXjvqASEnNLucwH9UeaR77/qRSqOO0j85QunA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10178 X-Patchwork-Delegate: kuba@kernel.org 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 --- v2 changes: Use regular expressions to match related files. v3: no changes v4: 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