From patchwork Wed Oct 30 09:39: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: 13856211 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2049.outbound.protection.outlook.com [40.107.241.49]) (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 2A9F61E283F for ; Wed, 30 Oct 2024 09:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282093; cv=fail; b=Kp2uF5TxZ5ummyBDE05XBB386fwkvhTv03veXoUXijdRkTlPeGnMPO2TNoh0NNqFfWrN5jA9pq4ZD5wtjJhixHAPH2T83DQv9A5rErLGzK+J9kbyt6M6suIyEGdWMwvC77aFmz9sfxhnGNhO+CbEh02R5NNsWpRfluQaX/52I0U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282093; c=relaxed/simple; bh=rniyf7Yxw4BAxWUJO1iwBwhqrfYWWXkxrT34rzz4Pss=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=uNMzaiGKlqXTXFU4zaCrkhezgwXh37194E8I3Js9D2/z98CxoaXnTydGaA7V/K2H61wxnb/rEOdu98O1pKjKw0Lf0dHSqslVu312c/T6tiyLalvW0BT71vlfZwgDqA5ZTv6nK1nkpl8IN4U72cz3HbL4uNDkGRShHyCOaSV96gQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=RDpS0Wvo; arc=fail smtp.client-ip=40.107.241.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="RDpS0Wvo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=W9BCAiCGR8gOIV5m78kZ6himyldx2RtlhIXJ8hjNCyocTQc0uXh0HHZXzq4BiLV5alGVlDHm3xMapoB9yOJkZgKxkrTz6dfxIAJcmsGOY3NGUwVLK2JuRV43vyUEk74hBgxx5TU1IsLWtEM67YBvMeEdqSrJqlbWgvDzOy7DhuZHH6f8xQksJRxx0L6Y87Y0avccdhQBuj8Q34cenRoKFTlEkYyNXFmxhhRMGemeFZH/hd1wRWTR5A7batVARUa47czBwvs/MGwHcWZyblB6aRQX6/wCXpfvekmulrsXBxoROb/k2OBd47C9d/3y+clZlVehSeTKeBaz0/3Zk3MH2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JUK0l6Utl+GYdHNvpbsSBEXzn6QKesyFiji3dKJO70U=; b=Q3qNqkX4Ti1l3D5/latyRGRcfbOW17H8Z2LNQ81UxUfcWORd4BmSV3JvYYD+URJA6muqGYJKhKKYOhJSPfrpoZWznx4RonSwOaN8c0VZxqUqgAhPEs0bc64aN+yPpCBqnwteXoeKdoiRE2hgLSLu7ZmCCQPlctTVziGifMzXLW6GFdvk5Nggqc9LR2VPplq6R63B2PX+f76c1yHPkvj9L1BTCoPNTAlXwVzzPHpVJr9ydIBbYP1NHv5Jh+GQehDf2Y1QBuMRBxX7ammPolE/jEnoNifyPulEstllcB1sYSSUrDvmdeQpyr7Ilp149/zGTAjH57u9mRzvuAuaCwUQPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JUK0l6Utl+GYdHNvpbsSBEXzn6QKesyFiji3dKJO70U=; b=RDpS0WvoNoTes/tU3+mjSnWU3MM2sM77GvvDQz3ajGgazSzVlcmoNWkIBCqs2kLwnuy+C08zAt9TpOIs7EtXwDgrTAbhBqxdICBAnOXAcOhfcb0FiyNKlNTTQOoUNclmut3HQp4xXcMVCF1fxdNYF5JaYJbxd0kwBDYHr4NJfMd91XmW6WdGhV97d1ECSiwdJBn1D9NyHE+DkLZL1gP5QbpbmpSwj2v3RgOiZzRpnWJCEgNK6qCFhPjvKTRLfvruvwDf7QWyNyTPQg2m9nnrM3WnPRLPnHlR/YqxxTu8go56nGeFB9SCe9Ek+WclevZZELQhiKNP4ahienQetc/zMQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:54:47 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:54:47 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 01/12] dt-bindings: net: add compatible string for i.MX95 EMDIO Date: Wed, 30 Oct 2024 17:39:12 +0800 Message-Id: <20241030093924.1251343-2-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 74f13a44-acd5-404d-b064-08dcf8c8e387 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: Eh/mBw7axHg6+By1STQlyqkIL9djSGs28D6v7qzxMHz0oI4ttXhRxNCCmuSBjVhIjMW5gUqs37Rdz6m1mjFKzNFmkiFHBMl6CWTvqHU6lT+RTTcJd1atZVX83qEGTpT1qsqrGJ8A5y4Dt6rRYFUU5uOmgJadGQrWRU5XmW+e3GY1Y4JGNuQiahkxzj8ujNlWvAV6xwl9fRrXQjQitmxU+Mp0ya1ouJYilVflfpE5wdkawTwJff+Yjo+03kjTSqiu8sDiDYQxRhW+nyIgOSYEVNab8m8900LNFFw3O+CNqsiP6g372g7e/QMpEUvxXMjdhtBCsASruz9UYP4wAkubHoe80GvyMS5uX5Xb0TdIsQuQTyKESA6CYv30hnmDcElRDHhGZBbfL3HG1g4NGSp0YcFNuEYm0zMKAcb6xvZ7ixPzqqZitu4XBlRix9OqBwqI920wzgg0Bd1aTkIsEqgUMF08IAaM7zsB+OXvZXFD18V+x/JJwqCz+sSZXRZZsUTaWruwsxbobq+VAvXeGYbCeLo54m19OOb9BDTkfVOAULlbym59e5m5w5s2rNYTw0qvt9k5cRKWIkPiweIKywJpxBmhw7zjl/QAWcdOaPG8K+/TMufkWoTo5qeekEHWVSkc6DpjFMeXH4NL8u/LZhJq1ERWLrJT5Ncg9oTIo8oQQ9a5JMSVPuFmHpsfTRqNwOsK/QLwffK0xM3/MmC64UZjSUzinS1boYInrpAPoZZe9uC4BmqXrcECbU4UQ61lWD/dxju2ui8Q4Qh4hzJQRayD4vk7EzwcheWynohGEPM4lprm/MaQCKYSvDXHaOIE+2wzjQcFWUjKFt4I3hXYoaX4VwGn8nSRTPa6Uq2Qg4zPfUCL6YlyZ1LEBXFa+dnJhMh5MHx1S5EILH/DPTbz0tt6QPCCEnJJX1X8g6DoUk4nNK0UIStdney0yHkvVm5i2LDgWcXAqfyPtzDQl/sB9CDxHNujwofmiPcwJoBReb1djqfoYMZel4bexlGWyHjjzCsYzrjHiK3Q31J6y42njRqZBCAcV9tGQbkPFxCGWaaiZcKTp2XOJLCYR8x5PbcvWwB4OLoH37alHQh2SkR3e1B3SZLXjfcWzZOFg2rvRcTaPW4H7ovvdyzz4vurlcFKgIirPAkkfZKMn4v6uTvsKftlWT9TCTXwfs66Exxs9a01G0HaP1HgPTCv4oLQGx472T9vrkMfcr0jrESlTQ8n04GoT+m16QtSGGH2Mbq8TiI4JqiZvMc8F6Xh3n8UVR6tIvIINhIV8MTwbkQsy0RbjM3FbImhNT2YM2zN6AAA8uznbSdBG52Z8gtDSkLBA4wz3089X+UsLjm5ah2pghjcoVKS/EbDXai0ple89xSC6ClQJm8Voj/3C5CL/tpVvNkrFw9/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8zuPFWa+1PPk4DyO8Bb2gpTplazF7tcUZkaMANVCPk/3cEEWrak9IDwM3Fb5ARPBDUCPohMlLPuAmIUAAe5Vfn73BK0kgzsEKR5qOlnVnJOfpBqV3rc2PTB09dEkQ38Mhv+FihEgYlex8Cgrkk/hmslRD8UYakabRLtTaKzTL51qmFHEmtBxuDOWmwFAyso+9BElQ3+dBkuqXEj1UytVkSKtkf45u+dv5jSy87T03exoF/NCOac+jbyI6tueokD5ULThy3NPeDzTtAZ04hD64omC4e8sYU584fj0R4/3CrW40aBG1zusObw5NHJV8cs689jZl4X6b7bjjpO8JHCnOjmkmpUvdfs59WKsObTIFAsvfGKEVzUfIj1WxvWgINCjDFUHrBnGvJac6BkfRFfZZ78KGZIrThhtEqJblfTHkkSeaqmm8sxso2rqxMm/xBWAXDAy/VUOF3XcTxFvX/C/Igd0U8XAQgpc5/HBqLNnW0JJNZ+YmZZMO6q37Ux7AgZ/aDnbTQtcJ8NDps8a2T5Knq9qeLAqPg3CSZjwA7wePL5AmPWjR/j/KHUeRt4yw9/e8DGQnLs+CthlNfoOtXvuANDgK4TV9BWtkpwf6k7W4WD93ozSE4LoopgKV9GeLgqG+Q0Pyamd0zZoBoMd+CECDIEKTLcRNeE4aGw2OUnYZhj1oPqnEmgVXycMQooWLCWsZaLvWyiGls1lb5BI6REGSGuo+fGf3aiHxwcEONye67rzJ5/9CFrzdHfggKY429ulVik2SW27hKK48VrsYP2VQyM02KVeiDNq+2Tnk/4hDjtKkgobZ7sMTI4utBQMeOBEvGtMQKOD6WtQDVoFoadmKhaJAP2r/UAioRBWeHf2tm10JnTKZD/BhBm7b8Mz6iZVdxEPuTk7PbMCS+Z6OF9dgCcMhIPwDCrEFKNHl2ttgQoQCx+0ags1CWzrjSpCn0+6vAC731lgy4QgcPSIEuAsMk4x45rj7Q9FHHJyejFSrOFVdBPyU7+FWU7AQdyac42nLxB+AqhAsH4k5azFKc3Wn7qJKqU1BigFG2vEeF/eVIed6LtlOKuDgZjewklxcStUxYtmUITtJmW2cA8DFqngg+BhcvdJ+1civYlYVqxPTMRkBIDbXQSth8c5yCVm0CQ6uk19fgmzoZK841ymp61mHn/BimO6m5fLZ7/mBsXjHiMUVmS9lOPIFIqp+oxx6qztaMrn0pGJjkg7U58LljLiBJmCdVjmUQ+VEq+pOqIsq5qVN/V/gq9Wb0lQq1yHibGneitbW2sAwDqCbg9tKvBXntce4mg/cN8Ir14cWzqand/ffebtqMAQfKPHcPssCGZl3ApZ6m9rmFhNKNL/u21eo845cfC76KU2bc4neCi6AFe0WGynzzq2EJBIhYmthspK0q2V6cg+o/Zjxg0pGKS85iEJC8HF6Mo6WeoGc5xLM0z2cMS5wS+x6+8RXypTgvp8lVU42MMu/V7icvpsCcj8aF+9ISBqd+ASmYcaYUUEPK3tjGDLIwQbYp/SSyBfDIgKxlzvWzfxYsscTSRBw4q+NWPCVWJh3ssz7LXrhzD6dkTgtrmFiT0apX72J9dKnUpc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74f13a44-acd5-404d-b064-08dcf8c8e387 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:54:47.7504 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /FXoAQvW6v8nZmqzfbz+rJTEmCTYsElmFZr61LoxI7/MZSBlAxAuONj2U6UpVJ7cVQ+4AqLfR5h2tOUzXIIErA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 The EMDIO of i.MX95 has been upgraded to revision 4.1, and the vendor ID and device ID have also changed, so add the new compatible strings for i.MX95 EMDIO. Signed-off-by: Wei Fang Reviewed-by: Frank Li Reviewed-by: Vladimir Oltean Reviewed-by: Rob Herring (Arm) --- v6: no changes --- .../devicetree/bindings/net/fsl,enetc-mdio.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,enetc-mdio.yaml b/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 Wed Oct 30 09:39: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: 13856212 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2069.outbound.protection.outlook.com [40.107.249.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 DFEF71E3DD6 for ; Wed, 30 Oct 2024 09:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282099; cv=fail; b=APengR7frkCU7GJw5HoXGQF+UA7doKdR7oPJhLZX9n4bWUR4ufucDkYLbDY559s92tsz6QQ0FYGyUgqaAPSSWDebKGQuUxP4vp+75G49/7uexvgicd5IMFAj993592mnGtm/0WOcsSgTBINqlE1uq/ojwaa6dArLpO2JOdmu+38= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282099; c=relaxed/simple; bh=ljN9ZHauh4wygTQilaxfPPWuIIcZHUE1isT9KuEFctM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=hNTo+gv63NhHQSnS/zQWiG951HG+CffMc7Qt9MunZB/rGoTLkjGqGLISuAg8M8Jc2wd4BmiYectp1zPLENDmeHATv0b5pYfJUyiEYPvLO3EM//qZrp60sDHLaXASd/KgjVS8Lpwrrh3wHRDfIjcaLYLwv8Blo/Cl3u6Cga0uCWE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=b8Q+eYiU; arc=fail smtp.client-ip=40.107.249.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="b8Q+eYiU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EtBR2F2YYVtDUH08ygQ3jg4Fl825wOoFn8BFpJcqtZNzjrr2jx2IShyewSMOXtxwi23dVMJFEm4Qa0PP8Hyhufjv96qYOUcFChW1JWet2kaYKRTl1jKEQ+UJuDvLSMHqKX4ZP2DuH9X4eDqsecplGWslh9EB5+gg1j+E6DJBAbDG/ZJWuAIrEKEBywDjYL5WJbqjYc/DltGwMlKsA8Yht2gD5VZZh/xAHVfHE+zNfPE0M5ipYvbfnmuj0NIGxB4vjnD6wXOFdDjIPYPRM1B1sZB9+b39cULTb6Vib1zZLO4kcMdM9lKSoXJTdWcHneN1wbxITNBLl/jCsSnHHZawHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jPKZ5H/nfdjETseUZ6lGYMeiOrIqJfyaut+UoWtHqes=; b=sJHufIkCmlq/CLFzcgqFXI0R3iIwpUf0qh+MONHT0RV/0WG7XM29VWpxQy96eN+xAc6dF18yJJZFFk61RsdH1Eu3+lvU+xhSThjHm6Vl28SVRwEdrawDBabp9kgu1Y9hPS3ftiEsmKE0ErYzb91E1vTQfNDnhW2ANCM2Sjw9HUQ5YSLNDthNRr4s9UnMSyZ8i1q6npaUp910k7226nTgOQjUQU9vf/Yg7bsMafMYJHQSZJSHbMSs8c5SdWfMcUjZa5nW/1tZ7AIg/BbIOwoYO8nqD4AqPnSSr/Xizim05oqcQ/31HwzTWx20fLrOLGMG/rkKvwa+hJRdnhqgeJ6eng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jPKZ5H/nfdjETseUZ6lGYMeiOrIqJfyaut+UoWtHqes=; b=b8Q+eYiU0FSdNqcHqYrNcnrpRCC944f9HhiKdewaPbQfDzAMXBTsRjXlD7urz1uto+Z0MvGJBaqthU1b1zUmBZocZGoGVvwzW9xPhRYEI4GcNQH+1vMw2AFzKfjLffYX8DTe0Aio6EX8SKHJK6Jn95xUeEdInfngSAjYx6Yd+7JVXp65Tx0+jhSuP/zl3VTYs1aQqCxl2UIeH6hlEv9dIdtugqXgaHDLaB0nlBc9ekC5FU9D+E0xC1/JbvaGA1CCPsFtDe8msYLf79ApQAGLLQKsCZw1v5lreMthenjHb7xKaqjCHVAXmAk5s0SRx3kybYBHdecOgAEKDu7/ayCrjQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:54:54 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:54:54 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 02/12] dt-bindings: net: add i.MX95 ENETC support Date: Wed, 30 Oct 2024 17:39:13 +0800 Message-Id: <20241030093924.1251343-3-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 14cff7dd-bd0e-47ad-371d-08dcf8c8e77c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: 1ZQMkH8BOYNxUnxZT9DvO+0I39QaNCKNpyPNpWEAS8l8qWVxIqEYSy8RZIFevOlXT+WqmSxgMDRrsyy+kI+5HGhcUUbFwKJ7suV1ohDAS82+ZpMa72+NDibrBtE1c8iF86yhulFeu24d5RaUWS7ETI7VW+8q1M66JXhPKbZv2k+kalrrUq0ffdlUvt+la02B6Lj2i0fmktsdXjMbJeMrLrR3lWvCOI2Qc053bC1ErvcfTWTzfRa0mxdTS0Ui+hbIysrgQCsN4mvfge3llFfmzJpg9AIKQgW/Q64+4pz5EROnqCIgBBhr5KMWi5OvdirkMi77s4lDdTrhBLVIqW9NEOlgUC2xMv1+Ya3GalsxBviGDBq4/NFqb3EWhmry4S2BrNuBaZVZajIks9boVFYxLLfa8zBMPU9k8EwMaxb6z1tn0I4/snUxHPBvJ7CnQR0cKD5dW9P/kLnODCgq8m3a/yNDhofI7B/LGkzWE8YIN7KCfsM/8KxuWOyWPAzXfwF2VfD/8xvBmS8Dq+AVK0SwNnEAJzLPUFrdNPm0tdo/Lq0RURDwy0xzEaGgJahbJ+aC/n0yLV+TnByvcUNeOHOEs5S4wPS1tduqL68GoeJb1Qydvj1iwfQ8CJXFt9mHiEsbKStgQjKPOlezj5SzK0yDvT2rBhDcIJ2MSrkN6HM7m3k+6cGIfUF0/POweZRMEgmlKqStqZgzemjCgrePsHsZUIfmoRr8GwxhZSOf4BUs/EZ0cac1DKfC0AWraVeAj2x+CtyRUNZA/BWuMz3xEpV+2bTMyTYpxMbyrzuvhxYs6ICJmc16BfVhj2qwYEwe10+8/qFUrfI88yIGhvHMU+F2naWfaLMsfZkwRixY9JCI1i2vKY3uAvhoIGmteG2fZsTcd4gbewLtu9MUjT2EkkfytUZMcXqprwTpI4NH1BUZBxoe83B3EAufSyZHUi6L4ALkd7XQGGSwTZxd8ri7B7UL/cekqn+yXIzFbO5iZNzLrUMaNwvhYIJp3Vp7S+12xEBtJAgr/Ho3XO8CBN+jsJB4dsMZUbP3LWpLbF4kuVhf2TxaemaE5dpJwQ7X+R6rzOPJmGybxINKY2Lns1sjasOXGw0zkJ+WOc0Dv290w9XHr1UCj/ZeJ9hqDLoP/JxMZDpPOl8W848cuk92g1JXH6w7u3qntvhIxqGZVbClfD3/OPztTCuAYC1bPdA3af5i4sjVMQ7C4g3aNreFLyrkkfdk+aeEvQbIwbRak/JMmEHMiyliGfmy0PP9/5zVoBFVS9/6QL63lxQc9uWEGpIOm0bKTsWn1r6WC1g6Wx+iJ9bpPJp9UwPN6k3gj/c1lDtLbpwKpntnf55jh8MdL/WhP9Yx8lwgpwvDbTqKaqu/NfZR7agjf6I5TfLj5YAuEBI6bbix X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QozYOwyQu736+tENSPGnskOhvqSd17j8axrr0DSitpItVWxHsLpHjTpnW0O9jZbplXeyaC2xYJLDXqnHyYvDQD6G5hhdGwp14Oe9Au8v4V9SGerQHlnhcT4H1C9DNVCxkEtD2bee1TUyLyhiOA3rSAwYA53XVCC0iz+uHeX2dugIuCvFhFcE3eBUFIvyJQVToGlstZabm61nglCC0x7QRBR3PMxKl+oZuzhAF1mdfNo3ETpUXGVNvc9gfC+6VZo3WKY9dmJYrdEniqXg8CPzAsVbjgy97wm2I5+HJORQA6KS3FevUKa/ptV/r8Ui8BeYUcYyCwJ0877eKfsWHXc3pLiRqPJc2qF946fDpX6smIyet18WXcyXYM2Z1rhrkslzfTHEnq2HhSWR9nkDT7TwAIh6RU7F6brnSzqDlU+7+evu1P8fdS9/zlirY/FAMiOP3Z9+1bs3W3S88+h9aR1b7s/Sn4Hk9rG20SmGDgMVmWAx/ACZE+7DwiGc/PWOwVQFbmePsPpzZ1s5vOAwUhsyeAhT6K4XwchmFz9kkYxi7cw4zYBjNxdFnVxlSdWIhTxuH3HE91A2S5wB4dx3hb+UakjFT9Uw8tkALgQo0xfezOsKdAr4FQFdiGuRRr/CKlXN3AqAAJqPgzzKAEqiUbaC8rGo7LWq2ebbppsKJ5TFeEvK7isGSb9DNacgp2hm6eDhD5TxOd98HdC3Iq/mLlrHLhyz1dWlk+n1X22Oz/f0s+W+LvKGhSSUpG3//DOOpasdmSiOhJyzYay4l+wj969WyPJAw+KmKOMAd+EGRw981tTWVC2OnJ55dDbPlBdJ5051u49UkrNXkx0NrQD2NSuXSRuMczoTn5nf54CIjCgUn9h+dI++Mx5llyNZ8Lolare5ySnYBBX7Vowng5uUxzwu8d16vbH/b2+XZK4NFlXHYlRJBi+DfV9WETQNF9kthUzDbOQNky0x0ywp3u6mAwalYx4C3kniuMlo2R5BXPq7RajRa7Lo6O3tH+sXc7th9RXcYfvaig7zMSEP2QY0jmFSbQ8J8YGEOCydWVTFgj4PwXB/wB5qC5BLUmaRL6rfnE93TpkK51OqYJrOeliJEKSxvke0chNklq5VRryqtaGPj6fn1psDDH1yl5wotKvqtoZQqVdp9Ta1OIwEeVh0fe7Mj2JKesE6am/HEgskDtMGqYeckvRQSspfAVHF9EtK4RNvUl9JEZtKbAv+XFLSmQ9NXnVecoN2bvmph4tlLij/BI4aO4PsoDPKfghqW2nUK49Vg4DeTlKcF8BUc8j20Vqi208BfKQJotxvyJj11oGhP2wHM4l1uO0VmuXq0eACaQOysPexEp8jm7qCzPltbAxH7yz5f+Ls2vfR9nhqoQ/qrt1gXwZH82KV6L71DnCkS0UV6rrKysoeJ0qyMXteRuBvgw1L+CPqTlqFOV8k2AkTVkLgP/57a58QPe5uAWEvymJPoDY8IomN7pIYXJHB7eC+3y8igzZYw7F/C4fhk2blzBgGKWCttf9VoMQFsglpoTPPc8aFF/O4PfWaVq59jM4Yg3dhnVDTXYDjKrirnBoYxd0PJl1PfQWh9h7rgWpID6bB X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14cff7dd-bd0e-47ad-371d-08dcf8c8e77c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:54:54.2991 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RTEZ2ctU+I8C4zWjGras2r2OZoir01suqvmC+1zszQVbFDAKsvr4naDeHhOGAr1dHNiiqo0/lKOg7tRoXvWaZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 The ENETC of i.MX95 has been upgraded to revision 4.1, and the vendor ID and device ID have also changed, so add the new compatible strings for i.MX95 ENETC. In addition, i.MX95 supports configuration of RGMII or RMII reference clock. Signed-off-by: Wei Fang Reviewed-by: Frank Li Reviewed-by: Rob Herring (Arm) --- v2: Remove "nxp,imx95-enetc" compatible string. v3: 1. Add restriction to "clcoks" and "clock-names" properties and rename the clock, also remove the items from these two properties. 2. Remove unnecessary items for "pci1131,e101" compatible string. v4: Move clocks and clock-names to top level. v5: Add items to clocks and clock-names v6: 1. use negate the 'if' schema (not: contains: ...) --- .../devicetree/bindings/net/fsl,enetc.yaml | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,enetc.yaml b/Documentation/devicetree/bindings/net/fsl,enetc.yaml index e152c93998fe..ca70f0050171 100644 --- a/Documentation/devicetree/bindings/net/fsl,enetc.yaml +++ b/Documentation/devicetree/bindings/net/fsl,enetc.yaml @@ -20,14 +20,25 @@ maintainers: properties: compatible: - items: + oneOf: + - items: + - enum: + - pci1957,e100 + - const: fsl,enetc - enum: - - pci1957,e100 - - const: fsl,enetc + - pci1131,e101 reg: maxItems: 1 + clocks: + items: + - description: MAC transmit/receive reference clock + + clock-names: + items: + - const: ref + mdio: $ref: mdio.yaml unevaluatedProperties: false @@ -40,6 +51,17 @@ required: allOf: - $ref: /schemas/pci/pci-device.yaml - $ref: ethernet-controller.yaml + - if: + not: + properties: + compatible: + contains: + enum: + - pci1131,e101 + then: + properties: + clocks: false + clock-names: false unevaluatedProperties: false From patchwork Wed Oct 30 09:39: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: 13856213 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2040.outbound.protection.outlook.com [40.107.249.40]) (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 39B991E47C2 for ; Wed, 30 Oct 2024 09:55:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282105; cv=fail; b=d5nOjPU2moxX84AdThc6SECrnpe012fVWmxwkWlXQLiKsalpOzp3DmCPgr8Nnm9FHsn+U8vcLnCmt5I4uoMTC6E8Fiz/H4MVLanqQS0EocRhCNaahzOazvE9MbASMTw0nZUGAiqvuliLiKKNEUBvulSoYP6MNzx6lwTR+//LdFU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282105; c=relaxed/simple; bh=N27vAl0VQkmk/pthLh7J4jKGbNZqaHwAFvpq/UlPCt8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Lvvnv7I2HJIOiydxx23KWdQ/dQaszGsVDXQuBRbuppzyUeVGZNqFhDo/lkAMRBSXx8UMovJ4F9Lu9tiQdto9re59qcxw4QuxM0OtvQun1OB8n1+BSv+IGG4VQ7i8BjE2aiNoj6mEPcQPjA1qgKgkUqDntsmDNLb/Ix1d5Rnj69U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=PEOhniym; arc=fail smtp.client-ip=40.107.249.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="PEOhniym" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wPYfF/A49DlOVSiiLqPv7WfdbMx+Kxlpmf92onLa5CULqjgtROln3Ukz0q9+Hg2IpqgIDqB7I9Ka4aq8iwZKWgmMcGm9WcpUkbufHiU40VR5GxfXmXYbRy7BkCXTVLrbj343Ve9vjSRp5TYrS3G2l8y6E9vuvlNu2YRpMgE/02/H6WJVoajd4aWPhFqTIObi0mqirJDH60YMmHV2JLnhpFmbcjPObXx84GMInMlKxhi7UriP+WYJVOF+EkQPjrL90ThO+QW/CcMZNENrqtc0QUFThmBBoVwPUGh8f4tdVWSVNGNS3JAvx1YDRTUU7eQ5wmcnLJNqE8J24n50E86qrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f3gtJW+qT2QgAKXpLuB/j4jIp2NDFcfKLtK+lYc/el0=; b=avw1iYnkbswcbh1+V1aDtBPGGNv5mYhNFRSjv3+nMzOulj5NgaqL8vioPpIaTsovlUHN9QQRKvZv8TvwGQ7NLcwxSA38ruUv3TYgJ+jEpFpHUYpf+wQTFVTdlAa2NC1eS2AhQJZyp/PvGzMSTyElQRvatYiwVsEln7u3aUgpEayQ0jiwBp9Xl7QswRNiHHDp36exQWveEFxQiCQTb1AlLgUGPW4Bsm+d+i3nuGLDLjFQWnmcuYmGoU3G6nnO/RjaziO39sEO/oLm1cu1WmyW99QwMzMtWXNExAOQnTT+ZwRfwj6Tumi5cSnIosnj6X6frmT2ePtxUBOCu1pflWOtEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f3gtJW+qT2QgAKXpLuB/j4jIp2NDFcfKLtK+lYc/el0=; b=PEOhniymQHEeJbPBgnESvdd8fRTEzdb/LNLtWdFEgfPJhxIlXYla0XqIrRVHQ9oHfSNrFayJUpClpPS74Zgvw5diWpBp4ixCgGbduzV9FQVWshDkNxaY0YSwdhJpkMrJE1Yz6DQuvLpMl6/ohlc43hIjiZn0xLoLuk3V9Xgvo2W/9GAT7DEOBk8tO/Xxiiyh2ZtMJGXLSof4Xh7rD4lPUwy8fhD3wnO3ZxgiaOqSvWaUBRBFnyKCFi/B4pQTsZnTaejyA/RLgrYz3d8giN3DHnA/qqJ7kYEI6wTYqPzOML5ZofOmqNuEA+lKCnolBZq+DcowGgML3T+kOHDFkP8ICQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:00 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:00 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 03/12] dt-bindings: net: add bindings for NETC blocks control Date: Wed, 30 Oct 2024 17:39:14 +0800 Message-Id: <20241030093924.1251343-4-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c0f6698-595f-400d-2f14-08dcf8c8eb38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: D7bJjb3xQIyZon1ZjC85oo9Df2hDJFEdQHfofatILyWsy3STfm/41pM4sABReA+tYuz2Q5EQjXW5tasrJzgCewplOYIBzXQERduIo626uRTAUV/8Yf8ZGddwxYHYvCPLq+yMiEuyDRAF5HEK0V1nW4Wmoh5wBcVFaEYwBJj3hCA0WOSwWwRlvpi1j40tbNCQhBCYOOHsTsqWM1ccB48KN1NwN3cuxgHagusAUTAqPDmUT+VUGcs7xyChjtljRktHFd0ooF0wnML4spD+ijI+d8MkjIe/3EligQD4ogzBrHncF+mCYK9Mveg5GF8XzSawsqRyESffYFbjpBdKw06rHQr5FlV7skmBWxXl4mZDDfDbd3pGNfB34fRWZGbKNwE/CsXDHTwG+GTOo/cWMj525hcug3RpVRyPErJz3ufZMtjNKpyJF4Jntvaf5SJq5w1IKZ/n9GvlVtbh4Vp46R6bEkkelKpzmQhK2h3KeE/tQ/xP+18Y/4vkfOxU4dinUwUf/oGtceb5a/5Ze46M4GesHOx2WDYBFlQc8oa17sbPZcEqfaCQ2ldWm+6hnpq02LPVwWwqjpHEX3LfMGo0opFagYweUHEwiK6tvTD1deY0rHmKM3jJ8WRtk0rdeu/5BihHxtW0QDqg2jbCcyoXbil6S6Ydw5R077kyfSLKJLS5jdjoKTOZppubaH33Jo0oXgzhRpy5Ss33gdEAiGutRJAgWWYbfyWAfggJ0abuUeXEilYxtCvBKB12P58iEYjlI8/xUOsj6j5lWDnZBHG5ZYYPJfpzD4hKvIYubdn52uuxnK2qJPbyQC00IJ+oRFKoU0n8C3GwSkDGboC8qiXouIg5exiPtsdDIcOJ+il2Pb1CENhCqq58ZJrFY504GPDjjlf1BTnV38fEan1++3zRxrv/OkOZyc7EXjWJkQwYGU4loJw9eV/RODAzRD3sTpff+XB+LfPkS45dFuZByLIMF7+0GQ86Ki0k1v8xLOitQfA9S6QhcpMDkdPyYNiz/NIdj82IHi2pcWyPMUb6RGlsYWR191+GNzbFdmafVFWAIGIugArj4tPI/BzoxLn/xtYImUUtf5Jm5c2QJV31BIEuMl4PG/RBUTlXoTQ8mTWKa3gnCwu6wCeCIrBWyCx8njqT9A/8v+KD0ppEmCaYovQWX8McGnlT90PpPsdzwkKs57Fv75gvJy3Dqwpi7epbrnZkpbJ7UaJPou9mfxiGP4dnZYbqWFyEk5peErB8YMhNJHgJ/PXqf7IVHJGglcjQeQvi1LDulAQXYWTAMlpTV0k9zi5W/WMCFvGksOL1GbDBcdSOEkko1ZMtbVItnq2T8RUOSd7lcrWGeQJ7u9KlFIIr3DOYaQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D8MlbnQmyruiGqN4d/+1e6iHzlHlhCVgOAM7rrpreiktYSm0P15HCEy9LDkNgj28gwnrIYNJv5DsGJNWaYf9e6cHMehYQZ/4Jd39+4VvmAG0ny9F9ZZcsIsSw7MS7NCNC8zPCZYs7N6elVUiiwJPSyeUajsblm0Ba7VlMgx6rIKOGLLlnuVOxyU3hHd0cKTFKR6PEOpOmY177oyaOUjfY65mg6MYE3+vLgbik07l7agqhlfXTfQN0aHAn8MYoQb6tDCkXlpFVuzRvnIh4zqAbScw0bDa7WSeJPvgWRhNM8lTeOK72nEGG3NVWgxOM/V5dNVpa5tFXYXmhxZwC7X+cPL361GWQ0ex71o3dstuucgHtmCuHeFTEjgnW/8BWh8mCpwxg0pcmUMreT0/W7RekbulaCbJL+WQ6nKgHun8RKFGj/2tq/bdTTtlNs0QHjBif6aBLs53tT9xorGEU47Qc3Dqz0V0eeSiN9GO/R4gcuLBIzL/8s7Ih8yrv0dQXJ1rPd2UlT2QK71oK+rnyGzp+2nQOwiw3997z69A1F6d9S12PYinK1nOoR9xebhbwDHtvBljugpCtihg9We024m59F4z9dLFUWAC5OUM2bnx9gH9yJ7LJJnsuRxyiZs+dJpWfW85iAPyZDStcDQPx7g0jkWXB2P3A2wOpbJPTakgwLLKMUbcpAJK8DwxiFnu/tMLNc3SMLrdREbRU3LhsuOSAJaMTNYqZ2x+4+dGFHDcKqZmAGzIkp7/NZ3NMOc7eWDFzTT0RkTwMTYUsMTM9hLU50d7QhuLwxuntyveDi22cMwCnaWTpQR5ewMLmsF164IH/GYUCXfSM2hYXW9vATT5sGpZcRgDepqLb2tW7TT6+MKZS9wY+eiGBa2+63GjjVXFLqNYBPJD9T/KbkWoNx71N5a1TN1HIzHLUUKvpOvlZFzJET59uIrKCnRpuYZonT1lQ7c0iTGqhpybSMEFUjQf9GrOLsCRA2Plr0kO08HXIZK6nNSvNS+mvVtGaM32BGMoBIbpHd7BPn/wI7t7C1QOmxH7Rhm4CcsFq6x9UKhfBf2657s3nkwtkHTeeWfSZAUdcxqqHnEUwHrW/eDvQMn2I3KwF8AGNcW5zlX1mqrxhROch4iO9yQXOYB3zaLlZkq1i9VB+OyFb7CKBWvGozdIxfDe1lvAggU2SL6YRqTCfi7jysy37e9dayl9S3s90S2DQmBOIL+t6zsiOLrmco2w0+Nnyiprv1lFvC39bjW8Cm1TC+pH9B8iuN87k2tSBeBGGfIXEED8HjsNctaVbKlFCPQuuEk/UemItPRW8j9PaI841JznV2uYgfr3azOhdFAnS9xJp/RLY3V62n4RTZkpuWgyprz7QV4vV/onkmh+iCRDckUWlZ6AHkKzv2I8nKTY8xaUtUcn6+AaUJRveFoLIAmdUpVhGg0Jo1hGbNDiwp/+W8xNE8IONb5J7Dgev5Y0p9kX8zsevDffTlul91MngADNLgyAY/1/FmqkdguBMP8+aXbU7OWpK95fY4c589YMODUq2avuwY06dnRQLbpU1cHbYTkGDg8wFaK96uzgJ/G1BOZ1gt0TM2MNDlBq/Lez X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c0f6698-595f-400d-2f14-08dcf8c8eb38 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:00.5315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aUGR9GWs6C76YUXPb185sMdOREoWCGpxYlGsL8p57yekqWlUAM3L5+6k3Hz8h04N2PzTmWTjJ3rsvYdCzFTx4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Add bindings for NXP NETC blocks control. Usually, NETC has 2 blocks of 64KB registers, integrated endpoint register block (IERB) and privileged register block (PRB). IERB is used for pre-boot initialization for all NETC devices, such as ENETC, Timer, EMDIO and so on. And PRB controls global reset and global error handling for NETC. Moreover, for the i.MX platform, there is also a NETCMIX block for link configuration, such as MII protocol, PCS protocol, etc. Signed-off-by: Wei Fang Reviewed-by: Rob Herring (Arm) --- v6: no changes --- .../bindings/net/nxp,netc-blk-ctrl.yaml | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml diff --git a/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml b/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml new file mode 100644 index 000000000000..97389fd5dbbf --- /dev/null +++ b/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml @@ -0,0 +1,104 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/nxp,netc-blk-ctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NETC Blocks Control + +description: + Usually, NETC has 2 blocks of 64KB registers, integrated endpoint register + block (IERB) and privileged register block (PRB). IERB is used for pre-boot + initialization for all NETC devices, such as ENETC, Timer, EMIDO and so on. + And PRB controls global reset and global error handling for NETC. Moreover, + for the i.MX platform, there is also a NETCMIX block for link configuration, + such as MII protocol, PCS protocol, etc. + +maintainers: + - Wei Fang + - Clark Wang + +properties: + compatible: + enum: + - nxp,imx95-netc-blk-ctrl + + reg: + maxItems: 3 + + reg-names: + items: + - const: ierb + - const: prb + - const: netcmix + + "#address-cells": + const: 2 + + "#size-cells": + const: 2 + + ranges: true + + clocks: + maxItems: 1 + + clock-names: + items: + - const: ipg + + power-domains: + maxItems: 1 + +patternProperties: + "^pcie@[0-9a-f]+$": + $ref: /schemas/pci/host-generic-pci.yaml# + +required: + - compatible + - reg + - reg-names + - "#address-cells" + - "#size-cells" + - ranges + +additionalProperties: false + +examples: + - | + bus { + #address-cells = <2>; + #size-cells = <2>; + + system-controller@4cde0000 { + compatible = "nxp,imx95-netc-blk-ctrl"; + reg = <0x0 0x4cde0000 0x0 0x10000>, + <0x0 0x4cdf0000 0x0 0x10000>, + <0x0 0x4c81000c 0x0 0x18>; + reg-names = "ierb", "prb", "netcmix"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + clocks = <&scmi_clk 98>; + clock-names = "ipg"; + power-domains = <&scmi_devpd 18>; + + pcie@4cb00000 { + compatible = "pci-host-ecam-generic"; + reg = <0x0 0x4cb00000 0x0 0x100000>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x1 0x1>; + ranges = <0x82000000 0x0 0x4cce0000 0x0 0x4cce0000 0x0 0x20000 + 0xc2000000 0x0 0x4cd10000 0x0 0x4cd10000 0x0 0x10000>; + + mdio@0,0 { + compatible = "pci1131,ee00"; + reg = <0x010000 0 0 0 0>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + }; + }; From patchwork Wed Oct 30 09:39: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: 13856214 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2049.outbound.protection.outlook.com [40.107.247.49]) (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 8BA5E1E500F for ; Wed, 30 Oct 2024 09:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282113; cv=fail; b=V6XOq+AXx4IAuruQ6C8g/xLOVphK84N2fAF6VnntWVtbsGBr0bGCswGWioCm6mPfsNZJtHWrqeJayw9En78psNUekhvS3ws/mwkGAJdcGm12nSwsdEbcDxqIOKfl57c72Uj3ugk3wsq5qkOdmhrH7WEv4OLo5MeSgsfPgV3BHOI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282113; c=relaxed/simple; bh=wrv+kqkkPSZ6cvh0Xend1dn0/bI7PplICNknS9E+fQ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=aBiks3nKnWvtadHaesKGOCQeYL4PHzmKc4tJNMzfMGllVP++unk90xA7B1S4lz16O4zgDrdllo353z7CNZfitbnRGlWmAIw1vwzi/zL2ZZmK0YI79/WS1bEIDbXHeoxlBPXiNXzzfYKPY+JY09M3/go3Azl9nyCuOfiWoUMMqyE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=ZHmvG5Ek; arc=fail smtp.client-ip=40.107.247.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="ZHmvG5Ek" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MKvnybDrIl26jxRDOxHx+ubdHz0bkMs/YLlvuYN4olo7LZN4gGxq9qRRxt8KRBL1HDPQKym8Jzpc7GmHOOnAsVF8BKZzcERngFfKEmGrUwcZgYdzySyXepMMPinLKYCHqgtGgpiZZ9nctjW4bVkzewG55O9Og+353qA0fZNhHst2Lwp18Xbq8bJ51t6Mnr0GhUQ1uW6/jsTqZqOV42t3tiEo+7XkmdHzGsWZ58GAtIJxeJjej+x8RXRj2S7iVoJiHnveoXkskjLX0LDyvJBQuIlIoqeSaUvfpJdT1dmYCpvoovKETVs+JUbXVWuNcZoOHfG+3MtwVctB0BvgAMIaMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ARbD14h42wKT+hoa9jYlex8DCEdlnracvHxWNYQo0Vc=; b=zRaaqvOhp/ffI/9NBjM5fO4qQis9dDiuPlTZ38Zg8pVVAbsKHg1Vdx3uTjmzKfkNXynZuJApTAtuPOaT7b3/ZrRed5C6w01+sGQpp8aiOU/UV3vQ82qWmB6oD4F5Vv3K0zV33vQmVd6AvJz29OUtv6dMmGl6VDeNgeibw/U/sV2dZh4nN2smmcvowahw4VyJF8C5ZWbpuCaM3OF07dPbivoK8LlkZx5EF2OWV2DE8bVtiprYJoRmtP2cs0WGqYkoT9d1qMh0D0ZNtAv7inXVf1Haaq0p24zhKos9qae/m/nBjGlLwC+B6KhzR2DL4SyRpYO07Fjh6yS2/Nk/ld8Cng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ARbD14h42wKT+hoa9jYlex8DCEdlnracvHxWNYQo0Vc=; b=ZHmvG5Ek5eNtu8xIJ+ufor5lbwCxdxuxA9HUM75KyvtMDhDy0vdNzyamjEokr9LqqXwsvVn+zq3XlPPWgWn3E8ntp/6CU3bDNh5QwkYZo11peSbMlx9gnjVDiad7Xyr+MbmdEROPysoZPNozTbUZJsCA0Qfgpw4HkAl5HodLvyJK1BNTdsOajMZU3eFKVCCwR933VZON7yvnM8r/iK0IvT9Qkf6pzUedV9AGihnI7YYJvJUzypsoXX9i3X7eQshsFVUT90Ka6A3n4WOq+nvx39pFW87UOty19WPpe7DBSS48GH1VdmVovg0FdsPL9WVWosFlNmAu2LOn2f1SlFvfeA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:06 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:06 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 04/12] net: enetc: add initial netc-blk-ctrl driver support Date: Wed, 30 Oct 2024 17:39:15 +0800 Message-Id: <20241030093924.1251343-5-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 97f6be59-d8e3-4c04-b90e-08dcf8c8eed2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: y72Eqvoixa9EY6UCPONxyaiDuMKMBl7HTGVTOGItea7ZO1BGzqjDzf6E5cGxmyxGM5kUAOyWgqQ60M3DJZ5hEsRrDf2DEWykNYfXA8ViNRxmFrSyKFRLW6w4/6Li9vsAH+GnJ+ehjy78wx1rYxNFmqRTGkhvu6yxDdkjhWWpPFlxIQ7vMo2kFkBUDERVznzrvn3DtMbRNDnPFvUtEgrjln7av4SXmo2kz3hEsZVtIPdwMfwb0bHdfAzTYduSrp+C6ZsUEkqhfv2Ixs1yngg/Gdmv0THr8a72Mlsxfz5Qna/d+HcXdvxIZxKMXdebz4+LgKGAo7a2px7jUX0iK6tKrrxVmdmgWaDKdiN47IGeI7WdtonomgUCMKPkgZF1c5/c1wSg7HnW3Mj76lgg4wkoeKrSdxtt41vy+Pj7z5uGD9a4ms76DKwoyLBAIj2vLGB9XcOIFkfwVxukHyokqR4Z/+3DTXQRXpibbSsz/6CNb4D+fuH/7bHRJqisewFfNt7fpzlV3IcM6ihhPMofiE6IEPj9NI1bqrSq866wPyV59lxtBQmM6PUmQi81timwruNUjnP+oLNzh0x9TnM0IE8FPHQ6ZxopEjAEvbz5k1Es18IouZNOAhiVvygW9jNftzccF3t/dbUbEem3Q1+avWgGdPIlw/SCt4Gn/r94NXPdDdFQTtOz6IFRIP6wpjzLZ6YjGQvAKhOqOfpfGmambwWjylKz27uMASEVSwac6Akx0+iWhr6fh6qwn0OuZNI6gWFAzvt4W00rbZXliKaAncElJPPWb+Spr65JVVw3WN6m7MkkU4xdk/8ghQI9u/SvIQFMOjMgQHV9OzupHd/AtRMABzneSXqto751jcc2scJZvmGh4QyET8QhkkUcYNkO/svVp0NlyRrm7ZCZ6Q35E4yu7P/mNRUyVxNKl3852RQCZPvtDdXtcIerydxXI5OIXchC8YmKytHxY/NzsZBcYLXw62vX7kQ0wxwfER7d/PvS2URmR4twgjJ7S7QG3H2B3jXC8qQfd9dLNU8du5oEHOFdgQpcF4KSbGccdT5Yn9IGb2G3Ev01JuSlNWXBhXz6BvY/XDWyZdMZZWa11zRujkrnZUEo4alE5i1bKwfgxtm98sSh/tM6IAGX5WxtWTDoSdrfBVmoPDR5n4IXccKhmtgfku0CDrA8/DdUDbQ4fVujzhkkkaSOUf1yn05QXs103O46nYe7ztoEv+Bxvaud+JnHqjlx2WC4Y/DSZT4TRT/eUcCVxZXg8R1AScIGi7BE+K03T/noWIsJjxHUV/J//WKVNa8wf35YPko8C3OCJi+dA3Pgco8wvvFeuivt60eHVOoMzzbCaw+EJThZ1wFHnMUKz8wbW9Qg/w/xSgNOpo3c5FSEvOa00SMJHoOZrOG/Gk1d X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vy6Umd4q3DNXAJRIT0pfwpEM23xQfVLgPF3PtU400nSqCxtYxSRilsA1c4DOg0GFRjeSYYSNM77ui3dCn+fy7mbtmZoYr0NGOYj74/j9ypwUftLnnvdlXBg5uiNQtO/fIUFAl3dcY2FRkdXwR1H+E3bT0SnTsHxQBy3rooxeDB6/P7XxL1btJbg5EDNrixIIinBNvZ4ZMmS3VWiQ93Nto84KYtEm6tpFm0n1hL9jlB93dTw/6cCYBZECpTFQsRXioEO4jWp4H4AlM668QHhdLuPoSmvpk1hGAaKfOJwkvreAfyrSsa3yOJ6B8q9dcMqs/TPczeVo8o6V4GPjy6eZrXo3znxpqhcU4zw3AwcOVycgLGV6CxxHMBsFj80aeXJHuruF9Uz8ayrhS0N+ycVQtvThiLVIMNmba6PpiVNVDtXkJ8gQb6gQK13EzyFGa8Sx+tPlmPRzohN5KShANrLvsdpekIZjop/g9+rVIKbJPfo1F+g5TrJftul7GCOSd1gAcZdanZ3uNC9YnfVVcUpYBvK1lojls0GayesPhQlYrlHPB83AcxBlc6OpZQVwmTdQRcRoNPOdz9mGRUlagPXq1UAzXWDJ6we7WDUMdc1FXxBN1kwgRCW1cXivKG0udfz1pktncoe7quxqjTiQxpfhMQ/ME+OWcSojsjXtbxeY0qmzh0qm3qNLm/rzb6vedK6HxpvLX8nZqV6zFpsf4SJbQjB1lRfD1fwGWjFV/nnfTJ9cYYt+JdW5QSZV2f9NERfGPr7xGxib0YtYV5amjXhqVkYovy2CFXpFEnxRGnuJgHdmKlLpG2Dkclwc+l3PQScvKFwteNBYB+F+327sLYDcyylvlDaZMePFQQruf76R1Upd7rkG7eUl3VcqKi+8ExS3G+eYgVzQduLeyF3qodTimdJhGGXOmvaFj8ZRrHBf4vuAdzbr6CfTI6nn5Ev7KvwYPD+yuzoJPTiEKS9sHLBcMDmf98jVm3euWTGrd6mwC2wDPCRWGxZKFchFYSs5sX8It8wA5W+xpNRn23B6/gh8TRLkXGEhvbnPk27r+6xFQeHNRacIXIVxvkrDSJUdWtz6yrx8PWLjhdtDgxJygoV1SwNlekarDgQdIKB3h5Ed9O7pYPK2Z8Ciev7LyQPWTvfvstxWLHkt/rSnWcObM6VJIh+V0huqXs4/dXqsciP8jRu9PupxfGM4WKKewZjYz6WygGuCCzTTy2si4ujiAfh+pSO2a0ymdLlNhoPoIEZR3Q4cOOyT2vMzIIvZrwP/MYGvwWe6tVffL0CR1GH5KIZhFRxFQIy7rro/QPOeQf6L8ACa+anKVQ+OCnQYVi8+iYHi6HrgaqVT8mfLGxY9z0jSUWZBXVWCbE0Twdq4TKZdBFTU5ETWWBDPBbe1/mE2bXb0ovp6mdCDKPOwT8/5n3Ps6jFMD2VBE3GLn63TJ0hhSNZ8qDQWBNEKj/KA4v9DXHLayivuuW/cLaTP3TOEip1VOtXaYlEFMq3aPmQig3LtfY98CVdA+pLknZC8jUKmeZnZF2xMioDu1VEGQpimuPAT1yKIpUBielf/JWozQ+AwAAu8mLDJhfS0je3vZS29nGZq X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97f6be59-d8e3-4c04-b90e-08dcf8c8eed2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:06.6619 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iOJim/FYDjGT4hKw85SJnK6cKwTr1UNIF/oNC7jHnFtDqswGZVPywSx7wLctqP1eOxMj1D5pd2xsbKswmoh44w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 The netc-blk-ctrl driver is used to configure Integrated Endpoint Register Block (IERB) and Privileged Register Block (PRB) of NETC. For i.MX platforms, it is also used to configure the NETCMIX block. The IERB contains registers that are used for pre-boot initialization, debug, and non-customer configuration. The PRB controls global reset and global error handling for NETC. The NETCMIX block is mainly used to set MII protocol and PCS protocol of the links, it also contains settings for some other functions. Note the IERB configuration registers can only be written after being unlocked by PRB, otherwise, all write operations are inhibited. A warm reset is performed when the IERB is unlocked, and it results in an FLR to all NETC devices. Therefore, all NETC device drivers must be probed or initialized after the warm reset is finished. Signed-off-by: Wei Fang Reviewed-by: Frank Li --- v6: only add some opening comments at the beginning of netc_blk_ctrl.c --- drivers/net/ethernet/freescale/enetc/Kconfig | 14 + drivers/net/ethernet/freescale/enetc/Makefile | 3 + .../ethernet/freescale/enetc/netc_blk_ctrl.c | 445 ++++++++++++++++++ include/linux/fsl/netc_global.h | 19 + 4 files changed, 481 insertions(+) create mode 100644 drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c create mode 100644 include/linux/fsl/netc_global.h diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/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..bcb8eefeb93c --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c @@ -0,0 +1,445 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * NXP NETC Blocks Control Driver + * + * Copyright 2024 NXP + * + * This driver is used for pre-initialization of NETC, such as PCS and MII + * protocols, LDID, warm reset, etc. Therefore, all NETC device drivers can + * only be probed after the netc-blk-crtl driver has completed initialization. + * In addition, when the system enters suspend mode, IERB, PRB, and NETCMIX + * will be powered off, except for WOL. Therefore, when the system resumes, + * these blocks need to be reinitialized. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* NETCMIX registers */ +#define IMX95_CFG_LINK_IO_VAR 0x0 +#define IO_VAR_16FF_16G_SERDES 0x1 +#define IO_VAR(port, var) (((var) & 0xf) << ((port) << 2)) + +#define IMX95_CFG_LINK_MII_PROT 0x4 +#define CFG_LINK_MII_PORT_0 GENMASK(3, 0) +#define CFG_LINK_MII_PORT_1 GENMASK(7, 4) +#define MII_PROT_MII 0x0 +#define MII_PROT_RMII 0x1 +#define MII_PROT_RGMII 0x2 +#define MII_PROT_SERIAL 0x3 +#define MII_PROT(port, prot) (((prot) & 0xf) << ((port) << 2)) + +#define IMX95_CFG_LINK_PCS_PROT(a) (0x8 + (a) * 4) +#define PCS_PROT_1G_SGMII BIT(0) +#define PCS_PROT_2500M_SGMII BIT(1) +#define PCS_PROT_XFI BIT(3) +#define PCS_PROT_SFI BIT(4) +#define PCS_PROT_10G_SXGMII BIT(6) + +/* NETC privileged register block register */ +#define PRB_NETCRR 0x100 +#define NETCRR_SR BIT(0) +#define NETCRR_LOCK BIT(1) + +#define PRB_NETCSR 0x104 +#define NETCSR_ERROR BIT(0) +#define NETCSR_STATE BIT(1) + +/* NETC integrated endpoint register block register */ +#define IERB_EMDIOFAUXR 0x344 +#define IERB_T0FAUXR 0x444 +#define IERB_EFAUXR(a) (0x3044 + 0x100 * (a)) +#define IERB_VFAUXR(a) (0x4004 + 0x40 * (a)) +#define FAUXR_LDID GENMASK(3, 0) + +/* Platform information */ +#define IMX95_ENETC0_BUS_DEVFN 0x0 +#define IMX95_ENETC1_BUS_DEVFN 0x40 +#define IMX95_ENETC2_BUS_DEVFN 0x80 + +/* Flags for different platforms */ +#define NETC_HAS_NETCMIX BIT(0) + +struct netc_devinfo { + u32 flags; + int (*netcmix_init)(struct platform_device *pdev); + int (*ierb_init)(struct platform_device *pdev); +}; + +struct netc_blk_ctrl { + void __iomem *prb; + void __iomem *ierb; + void __iomem *netcmix; + + const struct netc_devinfo *devinfo; + struct platform_device *pdev; + struct dentry *debugfs_root; +}; + +static void netc_reg_write(void __iomem *base, u32 offset, u32 val) +{ + netc_write(base + offset, val); +} + +static u32 netc_reg_read(void __iomem *base, u32 offset) +{ + return netc_read(base + offset); +} + +static int netc_of_pci_get_bus_devfn(struct device_node *np) +{ + u32 reg[5]; + int error; + + error = 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 Wed Oct 30 09:39: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: 13856215 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2072.outbound.protection.outlook.com [40.107.247.72]) (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 EE3031E5737 for ; Wed, 30 Oct 2024 09:55:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282119; cv=fail; b=kn2MrHeT0eG7DSHIVCbi+ZRCGsqB4ElE6GEudn5RKdCikuR4fuMT5kguFP22m/rtFPMGfSVwugKVEiXHl5b2H3/m6Lbcj08YT5aw/47zAx2FK6C34JqxDt24tMRxtWDZuRUNwSuuO5LZf0Te7c+04Wo4TOfU3bzwVHI8XoeR+KM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282119; c=relaxed/simple; bh=NDR7LnrQ5T15luvLkGYarvUzp0hF1MlcF1z9FzpC34w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=MjCKas4on0riHluJg+KcdQpsPHTsWwdgxJgVqTxNyCQKu+pO2g6hWtr5xdmSd7qGJat37xfON6A+OfEwvY/5oUEouIUVUpJOLAeAkQoc522YjmM7Zc9FebcgTHorqPmRR28/nM1+K/uUmwxN7QGb0e7Yl1+/gzIIEFFw1dCfxJ0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=m8SjvAgK; arc=fail smtp.client-ip=40.107.247.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="m8SjvAgK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MWycTAxpPFCfCAxVZHnKeyVuT7wYwNgmtfKcXD0hInxbQEb7NgWe2L5Ji9WyMj/9nYpAeDCjm2/HPRXfJK5zxohjtwRBcBtZ2c7mKdWCgUyRs7bBwtCilZBh4qAfJsTEoshdq2unRTLHVoGISwii5fLzFZdROJ5zsuzgbPahRCblJPCoEPVVQdZGdLfDsYhVBF5aNVgV6BndyHspNPWRwYXZ+OIULIukXs6uchpuCFYDwXdQ97qI6sLKqNacYb85vuWYwkh1vYzGHLBISKakyObUDJ5D6sH8JOpQik0irFbhCpFC+evm+p2H7U6WEfJUItlbZZlNeQ43V4Alv5UPLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dzEAYbuzQq7kWIaCobdlMT1UGL+EjI3oUibzL60t2iM=; b=L+43dDgcaiE5HnZ2nkwDA7iNm0U3DgiAah3Q4b6bmbEBF+uwfOTgS2aLAwfig55MXVKb9+rcdUzmB8Ow9NJDECJuXZSqdRajiczin2BtIFRS7vlQ3RwDGEISHNooKstzb1JnT1LDtHyw90kyxThtFDicy5U0jTfQQtGRfYV17mhD6boPvSzOkX/H0R1MVjAriN1bfX4mBU6TNln4QyoBwaRSWW5ZYGquOloBlnbddP/+8rBw9dQ7ppGDb4k6h4Gfherr8aUDG2gv6bPMid9DDYhz8ULy39hoFsDN8WnJPMBE8VCzm9W4f+UpN98O4GqfwitcxrpaBedCZsZ8q1bmBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dzEAYbuzQq7kWIaCobdlMT1UGL+EjI3oUibzL60t2iM=; b=m8SjvAgKP8CmTIb2CqaDKMIlXg+FDHv23XOnuqVECODjLmzB9utvReQ8T6pCJXbOCTl3niCDdod6bkCvCN+chxUaUMRv7WF2Kmsx+GoTOPhuI6FdEaoPDSOk8GmgvjVfDej8NWDSwYftZ0+FVPMnrIwFZBQVVJsQzrvb2zhdiXyj9pQ1Jrn0RXCdQ+JtegLA1jvkO0w5ngBrFF6qj7RB+TQdl7VNEhOxF0GJHPfssNbb79DZyuH3lnfBbCOKzlwuwaQCQay2S06tqVECzgOnMeFJbZruSdk2vdBCj4/HDpxvOVftHT6uJUv60XAThvBG+jJAZ7zxe3SojQMfzIOl0w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:12 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:12 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 05/12] net: enetc: extract common ENETC PF parts for LS1028A and i.MX95 platforms Date: Wed, 30 Oct 2024 17:39:16 +0800 Message-Id: <20241030093924.1251343-6-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 2880330b-7bc8-4160-9ce5-08dcf8c8f275 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: OtgKcFTaPn/9XfFE+Hol3PVLubkADjJb6AXNzWoE3Pyh5EAZZedI4uD4zRiEJKhw8PUQf8VPNHX2a5D60/D/m9QUvmM+e2/YcTB32JRoK1lg1bMkPWgjw6FcYZ84fAMbBvbm+neGErbjEJWO4hBS6PLP5GSeTgVP6p7lgQ9RvahLajf9cjG+WDXT1CuRgmY98P+Y4wwFpJ8/03gyMLiHXy+a6mB5eEUYut+8779F8DLCXVHsIvpUrFzR6G9pBEhlK10C8lMlWP3sUZ4if1VBuWt3WjBoI+LgU5i/xXqiNoJqtRO7mhjlHhGe5RHce5MvoCjvuy3ah5rQJ2wCSmhvc02UA/mZjViVql6k7G64nPVEP1FZhS6W+2GdaYxfIagOOU8DI1iOwDLkSZwdsZF8465m/xdoalw6KEGALk94kBmqpL7tdNRo8J+772KJ0qGLyZZpKtiJ8ltB4+QwRHq7r5YsHSXsv+v2taQyc3shyAnXMhMSWLwqYGCMJRI5qNA3FSzv/Mp8t1yqiux7iSFo7qx7Uh+aqZ8p1Ey2RluDtIJ/UcEBsP21w3UyVP5uwal54wuaOy8ZgdujmYG1ADgjLpz6pRWtQsNNbvtzPc5cBokkmk88iMKFM97XMO0erT+bbBUA0DGT62MSJbX6FMKUG9KEpNfoCWANGc6AcfV0QwszJpvSv+lGmdCGbaT3X/2BJ7ENCUAlnmmizF18eInLZTBBzshLXioKsECNo/LFAz25y6VbOxQVgDoesAmuXocpJHwCM2IEzVinapsossyFHdq8cH7aSXJ6Q0yVP84oNPe/iBhsgd585GH5Ds19qb1fsbgZzZfkm1USYQdEiD4OoQtz2Y8swB6Dc4RE7sknZlC0BiW61/wVUhbHMbAsKysGZ7acYqs/rxjSOz9L0IyJWu2hKQCzqBpDAENIy5Wph7UQBC3H30nEKNbOgeEt4MY6w1EEt74VdE9XXtU1VeuyND2tbsudMVu66OhhOptFRJvHRFPYtUVtCWUU/14V/OhRoKCv9eUdFlEsbhmM8F/9OiAFSe4AdLOEXPzv49i/8ty0dLzYDY3XjtLbXODiL7Jn7EhjPQ6rLCqMYPI4UmwoMIV9PAefyensKgFytlnwSmKeywi5RS022LDTGwcO5ehbIuWPsPWn6w4W5XBcGQF8+hh9rbGha9qCtj5sUi+lO+6KvEjCvV+PFNoy7Qrpj0cuRCAqfhKeoaJeNUxZaYa0D5JXnWtze/qKc7MTMZqo9845Xbv1NmCMfj/cuz+GGMCMJzgFE6TVmoKOnhsT+RW6GpJ9oglICcY40dBh8iMgpXdmCYIuZWaJG7ve0gPXvzSFs5v25AhJH3JXfenX12CNC/fe/kS4dh05RfK4TcsQgFVH4cMcBE7hj0pxiw1X+R1f X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7Vt2ZTa2dM2h7I/wBKEV6FheJPxbyt14DBZyVfmYaE/JlAiT4IxSLS/UKzKC5betKfJ+PFtQItN9NmtytakIO+VPX/bqoJggeAKvgBAERffco0Un+68JAE0DIxnVBW+oW/I1A1cbJuo1iR3LsdRtMGORvsSHzA+4pPIkHQVZro5FU78JsV1oaHxZBzAZwbxOwhauVs4E9C/TKUy1QQptYh55TimVGrb5FWD1r1LCVx8LLH2rYZwKnzreI6CHnYIA+UHAnSUwjEiWomPAQDpmyutGHkuQtPjUS/j9i0hZOLUKFMw0TQ8lbEbwXqhWQG/j/KsDw9Dfkb75Dr1OdL9GWYCF885HpxiQ2Octay7YBMjJawy2nj6+S7TcDVekwSTQGzTQadTiL5BRW/jtMP2uIfnGKfMmeuE5aDoqbiXN5TEfxK0QHlDw3Z4lJa59EnXWhlVqOhPOlq1WJM57uo1l/MEJ3ZWBgg/CkWTFVBo9viaMIPplxzrpxXs/tdtRPnInfZ3cf45SxQiwSi8BNO2A02eh8ft85Hwqor7J3qrrQltUKZeVDA5mrxBWOCKTMeU9FVPbiq+azW9wGtm1Iz++g1wOWwbF/ap62THd29ZyB1bIayn4M656n+rBP/sBFms5YV8Iz2YIz12mSqwx916DRB00xUzVYbzV/ZqEhAOL762DapRTkej7DaG+vg5Ij4MtV9pyni0kRQ4gN9hnXSefaQq/+0FYjawhcZlVdaxR3Sho4tCpHjIUIhDIo0S+tuiNkOmSWf9qvEAaTOST8pzgaSUpLGLpVIBbV0vwRWWaQ5ZeDU8kIYuq/YPpY3n13WuJ3hiL81krrbNuDMnvuN0vlVyjAidmYJhpzS/Mgru3s9rtIUClP+KRjthpG4VNYFHyfUsx6iQrRQ+n0kByRnQXX5cEc45JwIoJIRYZb6qPnYy6YmGoD+MXNAPuecqOcy/NXfSefGOC6/Y/PewdT4Zo3596dg2vAMzdFdC8+ZWZOzynZ22Locc5SRKT4ZeHs0fHbZgNYB308iYZ2VKtCSiVU71bpqdqKJFeJAmNmdUCXJ+fdJMRAOljNQ79jVp/ZIjp9g6hRr5Ku6R0Hx4cdAEJLJOVOxKlPrzkAinrmJYfHdJO/Uela4RIVckPewKuaEX+Xn4xdVSmPL9EvgEq98Eqj2SK+5Xhixn1LlxZr0Cn+Em9sdB+XOPxV9+/lqThGJqojYpMpXhWJ1VhXYgdzjIukiGTLqfb34jygL0W5JmzWP18yxWBdKB7IlG0EugfLm3MWQSdc/J5gZqCDEG+UjnL/rClP6tfFPx3oixURvZcgdCah5PVhOH6AWYF/qDl+jyHweV2XQDI/hb5Yn62CH+gUTVml7z2GkTrTT0zkbJZhbiYLnmbjrYMOw1X06iGRWaN0TZMCrbd8KtuPo/T0R0NfqDyhMSIfCafvsianTjSJo7BqVJ5eLBpONKkE0wq/lCeIhIvvDVrU0Mf6edZnHOlfqgb8TYef0fLVqluwWuU+aZvxy8SruzLT2+yz0NOvGloBA3Sy3j+htkwjQkJNZ0zxBURkcISzfQcLzwm/B7qpVVlU5ZdWWOCnBxJYkUp6mwU X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2880330b-7bc8-4160-9ce5-08dcf8c8f275 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:12.7514 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jPt8zz2uTZvviF4/MqRxMmCssXh0iJschePCRN0/cNfPGFDA0GWc9sgnfIqGpoG3txohdhOL92GRDAdATVJ/hg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 The ENETC PF driver of LS1028A (rev 1.0) is incompatible with the version used on the i.MX95 platform (rev 4.1), except for the station interface (SI) part. To reduce code redundancy and prepare for a new driver for rev 4.1 and later, extract shared interfaces from enetc_pf.c and move them to enetc_pf_common.c. This refactoring lays the groundwork for compiling enetc_pf_common.c into a shared driver for both platforms' PF drivers. Signed-off-by: Wei Fang --- v6: 1. add enetc_pf_common.h and put the prototypes of functions exported by enetc_pf_common.c into enetc_pf_common.h 2. add linux/of.h to enetc_pf.c due to undeclared function 'of_device_is_available' --- drivers/net/ethernet/freescale/enetc/Makefile | 2 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 300 +----------------- .../freescale/enetc/enetc_pf_common.c | 295 +++++++++++++++++ .../freescale/enetc/enetc_pf_common.h | 17 + 4 files changed, 319 insertions(+), 295 deletions(-) create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_pf_common.c create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_pf_common.h diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/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..36fc93725309 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -2,19 +2,17 @@ /* Copyright 2017-2019 NXP */ #include -#include #include -#include +#include #include -#include #include #include #include "enetc_ierb.h" -#include "enetc_pf.h" +#include "enetc_pf_common.h" #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 +21,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 +31,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 +377,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 +709,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 +854,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 +1050,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_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c new file mode 100644 index 000000000000..925011b16563 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -0,0 +1,295 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2024 NXP */ + +#include +#include +#include +#include + +#include "enetc_pf_common.h" + +int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) +{ + struct enetc_ndev_priv *priv = 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); +} diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h new file mode 100644 index 000000000000..2ae9c87c8c8a --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* Copyright 2024 NXP */ + +#include "enetc_pf.h" + +void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr); +void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, + const u8 *addr); +int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr); +int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf); +void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, + const struct net_device_ops *ndev_ops); +int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node); +void enetc_mdiobus_destroy(struct enetc_pf *pf); +int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node, + const struct phylink_mac_ops *ops); +void enetc_phylink_destroy(struct enetc_ndev_priv *priv); From patchwork Wed Oct 30 09:39: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: 13856216 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2047.outbound.protection.outlook.com [40.107.241.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 625811E7C11 for ; Wed, 30 Oct 2024 09:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282126; cv=fail; b=g6RAbfS4P50eR9dEgYltUZJRT8Y8k4vDMehizA/my5/Fec0/+weGLhxkAeoytqtFN7m3adlKk8Sw3OXL9wgZ2Xo3ka09gGNQxVt2kS74otI8Yn30oDp/ABV0jg8BavxVlpxVRQcp55Nh2jRWO30SrXg5PypFARzknxmqeqEU6Is= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282126; c=relaxed/simple; bh=YS2XdplDiXW/5w49ve1q91uIog8nXZXg8WS0hMduREY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=VPmcCx47mZwEshizsC+iTcN0GorVMNYci0daB585SSI5iSt0yMF9i8xJiWLaLkem9g8vK7UtAWthTAzFnV3irkydJpPf6CyF4on04yMf71q7lSlGezMgMieASLALgmyE9/uNb0I7f5qy4TMoc0IFjI7XMfmMZme++Bd7uK9nr7U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=M4fYGNtl; arc=fail smtp.client-ip=40.107.241.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="M4fYGNtl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kb5nZVpqg7ZrbaH71v3MGU9iOyD+n2lqOkisEtqZa3nwB+zA+3qk99ULB6mQoXKsGTPEOVbQlRdkLQhk9cAnmC5bFN82cuZ6apfMeQVRYBur6qwLOMzxztKeZN7UmziV4+sOx92YTSBPNhoWCm/051fHxUeK0fbDiVwur94Z0BvVbBHLMXGO+VnCkkyK8BkOCteWuBMl7aqFnCr1JoCBoYs7pKjJv0fngcXbArMvZ9rraW2R6yNfz1Yj6qb/xMgqUBrLoh40f+TV5GjmrztOVRuZ0UZXaCqjabMrFHZgk9XchQIZZy3ouyGapKjXKrSmSxFWC+/s+lF60LWmsVwK5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mJZ2mRnHJXen3PuDRZoqky66nAAg2vjUnvzzmEgF6Nk=; b=D9njqXFKps5WWBCAutitdCXFB2MWILghe0LtUeTGwYXEhKlSLEj60eDPRowwZNi3mSgmstIkHfLVQN41pwYMHLRISGkPdKz2JFnvadXcSaW5x4JToowdVWGgqstpthTvuA6uQvy6FM/aN1eP4kRgcBNlvx0//zDeW8viSjv1FSUCzXUToiHiiKUIbNNYxoGvLLYibZLiBnbniW3FI1J0v2+b71Q8Zpo8iuDrjxo+b0omEvrG+5t9Y3knw4ZtbV97qxbE2XD6Da0i3u1DjkWP7CbsJ3vjgBmxqI9WyX21IV7wr++p87DMDJ1sOZDmo1TKwhWZb9y5zuUjelF7QaXfMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mJZ2mRnHJXen3PuDRZoqky66nAAg2vjUnvzzmEgF6Nk=; b=M4fYGNtl+VkdBAw7Rv7MvU0TIHEOIBCvjegaOLjfrh/gBLwADAaILoy+KfyrL+lNh2N0L6sggJwkypYSceCnQExJzN0o9Heje9VkqCXKSrccFG/1cstwg6Ney1nBC3rMPXDL+09bVsfQxGULfkiUx2Xgyn1Xbjjoa09BHaivfUian2L0Z2bLDwhwH+ZBPYWdpl2jFqVOv8HS5TC6fLU66S357OSI0yEYJqwjSAhNNNOf/6zRZNTK5sfRWdmz41d7KezmPOQrCcdYQnWcW8yaL5AX3OMk+OJjK8K7Om5WhsjYzQKn4X3thiqWjGWrHKMlGZsBnszskbqryxGEXiaZbQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:19 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:19 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 06/12] net: enetc: build enetc_pf_common.c as a separate module Date: Wed, 30 Oct 2024 17:39:17 +0800 Message-Id: <20241030093924.1251343-7-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: 8108af12-f642-4581-c48c-08dcf8c8f677 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: l/Wux0CLfAVPuNDUZvokCVAlzwaH1dq9AQW7rVwHJtVtEWN47l9wjlEAYmqQweCzKKcVzh6YZOOASpgaA9LOyQU88sjjdYQcFjxlN7hbxOxuty4J2ZhetpkBOKM+RrFyfHVblfYdNt+DLo/fXrs2kgtqpa94BMJfCLiXeHe24jK9dlcdkqviWpTDop8YLqT+7oogCHRyXMR5uUJnrfNNnuCjVWPqKjXf2SlNfsJ4lvzXkLNyC2Jnpas5gqMuJFdC9IX5gTfNsWcNqacP7Z79OEqCmChzjhpZeqGRCeV3i+EOxZHyaJ+2ErLdhulCNfejbSK1xyq+yBbCPTn4wtJ+EaB+Kl6CwWOaqKS7oxc2PsCAN0aPmWIs12gb85vks/LsQ5nMF7r/53X7evXmbFmHiLI/+ihsy0kNr9eExNNzroD/GcKhCXf7j+uD6j18xQRUoUUYGM0EdOSh8QEHQduWUQEtQkvTMf2vCJ9rxIRajMd3b42eLeNcX6zWhenkzUU3ZAy3h18Eqhz/KGVAmwpacowdUj2nwna/0tZd7M9DQj/+tX6nzUhmRWpM6p+qaW7zu7ar1lJEgLJMtbA0FlvFt24Mlr/6k3E0ULecNBZ78Z8TW9sSsyOU9Tio1eBzQisKg3RYpnA+g7JkdDOs12YNh5otAdhrKKR1bWw8hcdm5qQjHEP8kRLEFrlEftWRrg091zlDJY2iQx+GeIrrlRTjdc19w47S9zXwVnDt2kyxWmzRQH/jCEGTeqXf7/YLjYJ1S8ru7qSmHaYYDS8WDmhUtlLw4Gu/YVOg8WCmwuDW9hoirEWQRvQHobus8dpbKUOJjurwEaSjyC/fnkH754axNC2Jp+8kFlVPuNpmxRNWAgXMJLmz2AxFdzqbSsbiPV1u3rUOaK3qeYm85Q8O1O8R3iVIW8jxi+db2vqMhLwtQwbbBxcMWlxNlRIm05Ft1U8DYA2ZSDx2tMtIV/7Tjco1zmddU7jU9ZbvXC0y1OL+TszgoiNAS3Tr+V1IOkgYFUhpMFelmyYow1FYkV997upmBp/iiddlslKnPPIVK3f2VusrW33ujqWMP+HXwjiHFtDbgYyTeG6bFkOnAoxgv4OZDx8Zm+Z+sBZ4OGVo4EBMnm+ZVJIqEJ9eKZ0yWPrFkqM8rOmUHYZfR1Np+efzUNWQTMkIqwxawX+LYLOjmGQgFqXRSWICUWbWatqSttEzkkKHjDPiZLGWCdLRolQ1Rj5Taj4ycAr98yjooH22ttwHlh2infUrSr2kuPzahFpYqvn03RRRiQuw/GTazr6b6QvVv2eVo/txNrf4uQZc8EuY7Zc5yO9pmZA87Ir7DCrZT+qjGVyA4OsF0tLuYHRLzsTqpRgoBQrJ4/a0Blp5mMCl7bf3IMQ25vfFh2I2oQ2NQUdx X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NjOBQEbHLtJ41uDyAR1bRFvCxO31M8yEF1jWiBVhQVDGaGNXY3LKm6MGdoCbiW8F/6W3TPOxvRqcwDKdN2Gig31bve3j/55YCdo3GiIGQT1FJ8czsJHxAsoMpQjueXEe9Eq8WPGGeRgXgWMndv57TIT/KzKjnvrpDh6kF1Bwia86Zwf4Z8nBkJEwdwq/+vt3uUIGJQ3GGfa+DbhkkGYkPytJhXePiHDpfPZ+gfmmgCNp5u5nEk0udxh3cO8BXV1PPuuIT0fN4tNXz90nP/oGVe6PoNbc+wF22Mce7mNqwnzpV9LKtr9YhRHQG0xjAwa7JvI8aJTscY6QFc4+b1Rkb3t/bhSUJ0knE1vzXVd6UBeubMUb7uYx4jjkGgJusT7ImH2FTt9oX6ksgHSZo+T6Vl+/4JHrCBi+3V0Id+2w0i0ez2hECAdbFFaJ7EuCwHVXkYhX9hkddPKh5O1WKIknXuiK37RTjlOFQOuuc+HsQpYxX1okJ/PPLLu22eBk9HM54LqaNcwtqfWLHF90qMVmJFKhQl17I8qX4wMzOvrgMJEpNRYnpn2fhUAX+Koxwa/V6k23gwWCiKILPh3VDfdLDpe38nc6oSo87ph7E0VVHfTH5q5yPfHK8yfEaiWr7ZTYxuoRqxAWP/VternNvCZ/KY4RQ2yM3epYaBCVOrjlA8+W+iejkIGSCk1budB4HsbaYkX2znh1yHv4fsRbMxieBvJ2eAXw7nI1Jqzy09zcq4Kf3MFlB9FtVafJzSdJVDXZ1agbXzhmF7Eq2JIZzb9PgrmPv29PRNXC75QtOaIpcMJHyR/y6ZrYocz0nNY8UZwIltURMZjVBkruPyhQb4ybzadlprbXVDj/nfv+S9Eg89QKTfWZ9WpgSTnyWIfOcT+8lqQnefdEkMHYRnbjGAbFP+VGFTJZC45Y7ahUxVMRgfO27gpHGdQCMJNb05ieV5DAAZvpnpBK0o/aax4w2FCQj8YzEAMZV8rM5FQA/PzhaHY7YLzmyq/bvVuWww6tx+4V2ORQsUK5bQ5j7VBZQgkLaHornb7x9rR5Y0y4T5OI5/OH/45PGbYooNCU1GGoDCCa6IrcvVeFPAK5qQEYBVFvEJW6Z1JO9XCgt5GJF9xBoVx0wkGPVBDtjl3nb/JHWLKCXbfxM+R4xQgFU8EoxcvLwHEeCoe/TccfxDc65TpalDxvOCmGTjMDb+q1Q6gLIsYeJTuolo7OQCcg9//PqBIxckNOtdeJpQ4fg5/1w5myUuN3f10nf33oN5vJjTFQrHeZ/YoboLkB+UCEwr+qivaOLc/i8HyUogD9taGrvjY2DP4Pzhqql9z6xfa/awL8LSedxpbQubvgytGtFZCCAXBAjSF6atY5zmEqygHzOiTruVKbSXy68pK8DQN5ZjM3TzB6N7sz9eKarPh9jmYuEuF8hpiA9DwagjL0mQXtRnKZtXrNAADXhISM5MLsj+78K4F70G2Xrmw7rgeqZ+JWqUOmDOjZqQzFpkDXTyRp2+oIHmsB7KG6HyROapbnIoLLBmJ5JuC8BwEkHIxp4IT1WywJk/oc6WQDNJ6QucaDRYtBnhiTLbwcSP/ThixVpdEtyCIj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8108af12-f642-4581-c48c-08dcf8c8f677 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:19.4867 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: V1lXNS+ETTV50gISGmv7qGA1bf4vsTJanTBRF+JZTqFUTCQ5GUgNZARl6mzXqqyPP419A+EaVVhvVTP3HX9RPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 Compile enetc_pf_common.c as a standalone module to allow shared usage between ENETC v1 and v4 PF drivers. Add struct enetc_pf_ops to register different hardware operation interfaces for both ENETC v1 and v4 PF drivers. Signed-off-by: Wei Fang --- v6: 1. remove enetc_pf_ops_register() 2. do not check enetc_pf_ops::set_si_primary_mac() and enetc_pf_ops::get_si_primary_mac(), because both enetc v1 and v4 drivers supports them 3. add enetc_get_si_hw_addr() 4. add dev_err() message if pf->ops->create_pcs() is NULL --- drivers/net/ethernet/freescale/enetc/Kconfig | 9 ++++ drivers/net/ethernet/freescale/enetc/Makefile | 5 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 26 ++++++++-- .../net/ethernet/freescale/enetc/enetc_pf.h | 12 +++++ .../freescale/enetc/enetc_pf_common.c | 50 +++++++++++++++---- .../freescale/enetc/enetc_pf_common.h | 3 -- 6 files changed, 89 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/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 36fc93725309..1ff9a7a3386c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -12,7 +12,7 @@ #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)); @@ -21,8 +21,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); @@ -31,6 +31,17 @@ void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, __raw_writew(lower, hw->port + ENETC_PSIPMAR1(si)); } +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); @@ -971,6 +982,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) { @@ -998,6 +1017,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); + pf->ops = &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 c26bd66e4597..53d20752aacf 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -28,6 +28,16 @@ struct enetc_vf_state { enum enetc_vf_flags flags; }; +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) \ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c index 925011b16563..e95252e898ae 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -4,29 +4,44 @@ #include #include #include -#include #include "enetc_pf_common.h" +static void enetc_set_si_hw_addr(struct enetc_pf *pf, int si, + const u8 *mac_addr) +{ + struct enetc_hw *hw = &pf->si->hw; + + pf->ops->set_si_primary_mac(hw, si, mac_addr); +} + +static void enetc_get_si_hw_addr(struct enetc_pf *pf, int si, u8 *mac_addr) +{ + struct enetc_hw *hw = &pf->si->hw; + + pf->ops->get_si_primary_mac(hw, si, mac_addr); +} + int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_pf *pf = enetc_si_priv(priv->si); 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); + enetc_set_si_hw_addr(pf, 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) { struct device *dev = &pf->si->pdev->dev; - struct enetc_hw *hw = &pf->si->hw; u8 mac_addr[ETH_ALEN] = { 0 }; int err; @@ -39,7 +54,7 @@ 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); + enetc_get_si_hw_addr(pf, si, mac_addr); /* (3) choose a random one */ if (is_zero_ether_addr(mac_addr)) { @@ -48,7 +63,7 @@ static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, si, mac_addr); } - enetc_pf_set_primary_mac_addr(hw, si, mac_addr); + enetc_set_si_hw_addr(pf, si, mac_addr); return 0; } @@ -70,11 +85,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 +124,8 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | NETDEV_XDP_ACT_NDO_XMIT_SG; - 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 +134,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, /* pick up primary MAC address from SI */ enetc_load_primary_mac_addr(&si->hw, ndev); } +EXPORT_SYMBOL_GPL(enetc_pf_netdev_setup); static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np) { @@ -162,6 +181,12 @@ static int enetc_imdio_create(struct enetc_pf *pf) struct mii_bus *bus; int err; + if (!pf->ops->create_pcs) { + dev_err(dev, "Creating PCS is not supported\n"); + + return -EOPNOTSUPP; + } + bus = mdiobus_alloc_size(sizeof(*mdio_priv)); if (!bus) return -ENOMEM; @@ -184,7 +209,7 @@ static int enetc_imdio_create(struct enetc_pf *pf) goto free_mdio_bus; } - 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 +230,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 +271,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 +315,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"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h index 2ae9c87c8c8a..964d4f53806b 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h @@ -3,9 +3,6 @@ #include "enetc_pf.h" -void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr); -void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, - const u8 *addr); int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr); int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf); void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, From patchwork Wed Oct 30 09:39: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: 13856217 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2079.outbound.protection.outlook.com [40.107.247.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 61AB91E882D for ; Wed, 30 Oct 2024 09:55:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282130; cv=fail; b=CphDi4XJSbWNESP7OUlXFg7aN1Rb0bkp/Hmkh9nKfGJrz3uM5i/Q7G3rUbtwDq/WrHsDfjM1XJZTj/IM+vIPJz3DBI4f3jSsTLlEzPSvVwyehjuuu9ghn4GqIj34DotSyND6QeiTjZs766S21ckkSPGK+iRx1mmrIUeghM8UPng= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282130; c=relaxed/simple; bh=LoUsaxQvi5J2FenkG0OgttwaDu0kjbKp1DRV2sJvJZc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=uGCAVuRuYju++/N/zHsN3il08Y2UNgfAPrXlRpEpolRx5yKqBmB0HzTLpoQafgdvGU4ass6y/TtKpLrK2lwFMDkr3rG1yfho76vdJboUwUHVLjQgCVggdWD252nBJL8i38HfNxJf0kTfM3Et3pqjOBk5sOzVTtsbwprhghDGPXs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=mFbldHw+; arc=fail smtp.client-ip=40.107.247.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="mFbldHw+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pk6yQc1NHW2Ru+6OCKtXxN4o4jeDefvcBoQkNmF3r0Zhg7f4do213cY1Dbe+fF6xwdO3YGlkBMnWv+xpGPk0dkwd82vh0xyTJIaLw8LAd9mbfadid/iM60A75rjtYs20srQrBleu0BTPw/SqDiSpIFU3vx5Qolx8YT0yQWhZuO5C0QnedYP+mIAaCn6tgWmDOBUMKteNk+viystBVRXQ+2lHB1p9qy/khQgEymK73MnGCYsDXfZ9sPH+9zOjTBvXwoF3qYiO7N2Yn+pvNGnVXrynGdlnE0bjxosCYYVz5F43K3a2VuU+9CL7CpB6TWypu34N7eu/ZCwt6cFEE8DCdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6qGdonxkWsA0PHrlZn2YAzdO0pw9VKF0Ky5FzaXdeNQ=; b=fF6IxnIghux+x1nVfyQzLGtRPTFWUPRAx5cImSzTCsOr8aWkqSXwxITFrNZxEvHwWJo9VF1zZ1GIA0G6RLNsYKJpPpDQgb2LJY4tlXQlVWJZKy1cj5zrnCrwUEVp4gHvo5p9kDyRr2gjl06Ev0Zb5YRdgUIP2jKuFxdQrqrAYeRA/l+BO/VpdemATE9xysLzptvrGLBXYS2VIvbqidZxs5KZw3BLqXrLCSF9VZbb2Kpp9USvgbOnOZxSYquy+mSMmjSrDmxK7Exx03Pe8DOsHNtTtoLF0EDgbz6Mwwj5g3DTWy3Lbzwm5vmR96UEMbX7zHbzUPkCdCcgB2X3tpM51Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6qGdonxkWsA0PHrlZn2YAzdO0pw9VKF0Ky5FzaXdeNQ=; b=mFbldHw+tYgVSjEO2XNoBx959OxQ9jKXKgL2Fu6wqNuNwYpATIJZwbCmeyBKWgM8PQq8fGErqtCWiEep+ZKiMyey9DLMxEhK5jKUnsEwwOTNSPYnROysnP88Aomec8LnZfn2NQhGfxZ1W7m5cYYCjwLtnOzBPmLF6jbTmoyp8I2yJxSSnhog5dbPlJWb89kFx3dmpz81PZT4XKEk00YGM71FuzA1e9fArvreJ4j27/fWcry12YL/suqjpZqMu8RAUPUNSHQwJVbodYyAH+qRK5tNvJSMzVuBi1lgl0CltBuBwp6FwagWyoIeoAkk3AGD2w4l80C2SpmDj3e7ELtnOw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PA2PR04MB10347.eurprd04.prod.outlook.com (2603:10a6:102:424::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 09:55:25 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:25 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 07/12] net: enetc: remove ERR050089 workaround for i.MX95 Date: Wed, 30 Oct 2024 17:39:18 +0800 Message-Id: <20241030093924.1251343-8-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PA2PR04MB10347:EE_ X-MS-Office365-Filtering-Correlation-Id: d03f02bc-2390-4b65-b173-08dcf8c8fa4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|7416014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: l7kwhRFcLU6xc0clJHUHSG6vsoc3BoKxlYQavQgnedJXwWG/Q6roq80qRvlf7oJ1SGe1flS2f/uxGcNdl5IatP8e2VMv/xnG8+8EHDkUo2kPezd+pB7paBtC6H6BMKu37eEw9A6h9maj45ezR7pPpAiUj9u3TsjdW4qihmHseyxdqYs9Nq4GKxTACwnubOWLhenZ/ZNaJu/bqkUxNS1zNDjrKmS4iglSdQZttcANR1eIqbJkQkRfOX4pssMPymb3KEBQDR0Q3p9G9b4zHwn4XqV35LHUsBE4mfgMmh9wKH0kD9PnpEiiY7GxhHFhpVj6qszwUN0aWZI2Ju2j6LV7Xz+upn3pjfKBAjln3i1joy5RzA4SdjxHacuXko1wJk7rU7OknUyXX3FKT51+fcjNnGZgOGgBu0DWpRlDhzmNCXAjoWbKGHVD7+hUj/H1Mly5a8BoBbzz5tELexn8GyJd/e7DkIuY9MywUaNRIVZ/RyWNVFDd4nnjRSH3sU9R2jMSYlaFcqnzmRzaOSd21nTJI9B+kwxSIss1aPeOAh/NpKCeQtvn+EshzhpoTZErqyNkWUrOU95LTG8axm1l3hPbwj1FF3ivE9s/+hTsKkrliQig6E4AxCBHOQWgcBz2YI+ni3vGrSyBfObUP6d4HNtyz3XceZpzeSk+c+YcL55ZhWqniN2e9uNyXsp5BE6LnpMFwNyVnoGjHigd0yYLnmsjgtVU0t3xHP7c8azL3aZLM/KmO6h9cNP2pi0yQMevjGcSLwZ/yW4C3d6BdV2lpmF1BPhcBqEKfKAtihfdR6t5DncWh9b49QQ0uEQ46IFJG/dhHr2PR0M6JozVinDonCSISf0hlST3ZrT4ql/DUJOk7RdGX669CVy72o10NSrS2RyedCir95Vupzoa51ND/W4bGBmYzWAHqhL1+HVA/E1dqcBfy7Fb3XTKlB6DDgdaxExTLxNpaNUn1d9/SsPG+gmsVsMMlxdlwvXLCzus2rmKS3wuMzsB9ai4tM2gmCs0rxsx9TmPaHRHWQGgvi7c0Kuy1buFXGh6rYxT+SLFTKPvWapO0NB7AAVTHr68cewQZfIGeKWFS5ly8JzXCtsRsRgY+XnZBaCGZVPHbtxIbH09tmqYV4rSSTYYczZMrELSZx4U0zCDmPEZ9kQOnoHNQpkso0HmXMmIdeMe3gR5VFbDyZdAgJliBaRvGg3C0/TV+I3yW+IgSwNDBrZ6HfV9NZc0G0lhuEitZAMra4XZ8idw/udwSju5UCqpDwwkY1iMaoQubWNVxUsMFmFX4rbKTOnul2L54jtI/NEh+koIPO5KjmZHIwk38pWTPwHup4q9FioJG+My0MET9idJ/NAxPkklvLIWuVwDQFDHMSoJUDIzlmBCADUb6xvlm3mb5VlE6x1J X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(7416014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1NHb9UVewLxIq2lHqtfr80ZI7xZT8lISNXDKcdr4MsjuRTpDlxXo0lQ5O+Qz1aZqeDPM3JO0MF4G2AaAN9zDZRO3QjMikvfScE5FBBc5qqUk2AFb3KfACaCoqsUFHcoe55uSQo15gUUKHLwgluDqD+p4C1bC+iTWePfhxcbOPnsEXBZoAIsgRe0JF1lQ+ijb3qKzH2KlR3OZTtyqiY+fWtoTUgHppIzvPc34xSIT5vpBgb73UlobM+M6neRR8ykhy388dviToMDa1enVKMkAT3KLXUPFYXYAs6z3q58jQqOnmCCQgO+x3hePtv5uLsWeaHbRKWOmrkq1bhSJXgyHiqvZnOLsfInATI5JkgryzXX1T8OqCfJ0bXKRGxv0HUk134BbKmJ509gW7C8420RmmPB1wXp1RH3q9HHmqF8utaz04fgRDw3XlGV0t47kcBnRwvl5YH2ULTWXEnEBVRpKFdxz9TFtA6NK1aFqGuFDEPwzU7vlHDOxW3GIlBVNqxvnHgIt6CVHlFF14E2QTlMPY9BDVFRscnv9V7LEvh85sGzBgpELpqWwergJWRn7pvTcwvkktad++rRgjUaPv1HbWNWB0i1IZCw4+TT3o56zw6R8yJK0QzybrDUCEGTcdh87EeIP5XizKxMusr9G58mLOEI2p4szrDdenEYp5AH5jNEg4k0OEeGUEQlLbumw11+qZdn0h6PD68tOOBTBF/5s4C+fXyeVIHVggf74yxlxNTOKJVWQyc8myMZU5DMbWib2W07QoPJkTpuLBB5j5gFCDABiRW1aj9vb+eOnLWN9SDIM1wiCQ4a4AojpAueUYCc8Vg6HfOINLf3nfsiEjJrnQ8fPLWzwcxjiZT+fAZsmygj17mgaRdVqlm7+wuSGz35r5Jng0rzjkeuzAX19fiWtMWzUBvg7s8rMoffFEY49oTT1gF4aeSGm1K0iopWGop9T98qHEwz3i2+tg/NtQJpxxCoz4zQB8lvQ6tHDohYWAK1khoe4PgsHf6N9Gd1AkXjnaxekHpA0ENs1GKE0LQj9FaBsCtOhCAxkBu8TRuR64nepJQlTsfvCnVozKpRlyFfobzw0jR2B8jzjzUPWJI3ON1l2e4KNbX+6DQz0byCq3Ssz+CRMc4wPP3FAEnmWO6oNqarCKeE4Z9AT4Nov+z9tbd3n/O8MXLxaecdwFp+CGTCte9Ys7O8zTiq+qTXrKmHPUgDybQkbrYSOEQrevkqd0BLJahSWN+9vM6PMd7/Q7khMLkJ3+AlRr73rlW6+G7rxXHe+HH1ZlOQ+qpd9qeL58wRLhHuV3GVxWeeFiKaDh6dPbtLf361F2s50w04juZiK2PMTHOCEnwWdoNItKbpcWUWdtKmgTXqMAoL9dDvZygBAgRWcweStMz6j6z4ZLmwj6whi+qOu5h3a8wU/5eIsr9CDJMhQlNsw4EQ+UQ31HbE2pMyL8HnDO8PwTeIrJOD35AR0FDDNGk17t59Vbyr70Y5FvzkUhHpd1EXJ83Vlpr8v4Mt0dHKnvSeNcr73i7H673rPk8Nguw0r6Ds+beABzLS8G4pQNiHL+X8Qc5/pt8Pq8GgEKoCNs4vbjB2aQueD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d03f02bc-2390-4b65-b173-08dcf8c8fa4b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:25.8169 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZY0pv/rcJkCUpXLCIRPIUE7aAHwK0l8Zx6Itch/t84HYCU8IfpupXaUzPLfMzumELsRrAbokkYmuOlz0aaT/zA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10347 From: Vladimir Oltean The ERR050089 workaround causes performance degradation and potential functional issues (e.g., RCU stalls) under certain workloads. Since new SoCs like i.MX95 do not require this workaround, use a static key to compile out enetc_lock_mdio() and enetc_unlock_mdio() at runtime, improving performance and avoiding unnecessary logic. Signed-off-by: Vladimir Oltean Signed-off-by: Wei Fang --- v6: 1. add helper functions to enable/disable the static key 2. disable the static key if of_mdiobus_register() returns error --- .../net/ethernet/freescale/enetc/enetc_hw.h | 34 +++++++++++++------ .../ethernet/freescale/enetc/enetc_pci_mdio.c | 28 +++++++++++++++ 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index 1619943fb263..6a7b9b75d660 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -396,18 +396,22 @@ struct enetc_hw { */ extern rwlock_t enetc_mdio_lock; +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..e178cd9375a1 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c @@ -9,6 +9,28 @@ #define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus" #define ENETC_MDIO_DRV_NAME ENETC_MDIO_DEV_NAME " driver" +DEFINE_STATIC_KEY_FALSE(enetc_has_err050089); +EXPORT_SYMBOL_GPL(enetc_has_err050089); + +static void enetc_emdio_enable_err050089(struct pci_dev *pdev) +{ + if (pdev->vendor == PCI_VENDOR_ID_FREESCALE && + pdev->device == ENETC_MDIO_DEV_ID) { + static_branch_inc(&enetc_has_err050089); + dev_info(&pdev->dev, "Enabled ERR050089 workaround\n"); + } +} + +static void enetc_emdio_disable_err050089(struct pci_dev *pdev) +{ + if (pdev->vendor == 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"); + } +} + static int enetc_pci_mdio_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -62,6 +84,8 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, goto err_pci_mem_reg; } + enetc_emdio_enable_err050089(pdev); + err = of_mdiobus_register(bus, dev->of_node); if (err) goto err_mdiobus_reg; @@ -71,6 +95,7 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, return 0; err_mdiobus_reg: + enetc_emdio_disable_err050089(pdev); pci_release_region(pdev, 0); err_pci_mem_reg: pci_disable_device(pdev); @@ -88,6 +113,9 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev) struct enetc_mdio_priv *mdio_priv; mdiobus_unregister(bus); + + enetc_emdio_disable_err050089(pdev); + mdio_priv = bus->priv; iounmap(mdio_priv->hw->port); pci_release_region(pdev, 0); From patchwork Wed Oct 30 09:39: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: 13856218 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011005.outbound.protection.outlook.com [52.101.65.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 975BD1E283F for ; Wed, 30 Oct 2024 09:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282138; cv=fail; b=P82nOB9QKhSEIA2BBtVqE2s1LMdDtfANZnnlu72zAjQPyoya4hQBBjYuaGYDW3vYbqZsQlWwK2Kz6xGDo9NC15Gjvq7NLdjy13aGmvpykSu6Hq6Ie0EMiqkMDwKFou3fT0kQYYpSxKGM2b5kePR8v2B9CKtdEqmXW//6/jl9LR0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282138; c=relaxed/simple; bh=hyRnsl5jU+Vel0B3sgQD+sox0n8z29Fr7D20Gkk2bo8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=BfcPEavjRZ3BJCxCxPXMXGrlWcIxr0ZeJIuNwd4EK5DuU4wJGpvsdNFe+b1H9UFBxFIq6trduKLN6Jhz8j6ONgYZb8A4vXV5UMT6omaiAKB1yd99KonX6rDyfeJOuTrW66ixaNTUfTJSj2WJS1VcZY90ytOBserOw3dl537jbFg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=BX4DNuP+; arc=fail smtp.client-ip=52.101.65.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="BX4DNuP+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BuEALesVyPVByAptHgUdZUYoiCLDWVsavIb8cQkwDfaj9UjQBA68WdKfeZ9VzzY+fmTPvSrS1Cpi7EywOvBQuZVsxwwDfrSIhoJSFI+zzY3FKMZZO1ODahanIW3xGCgR1K5xJ1qX1BLUdjGL7tmf8bQqW2NIBxhJ2t9oeFjSuAN4usTqtmbLzjFIpKo3DeSRH9le+u2mdZx30EjZl8PHQy6vAGH5BMF4fIuy219Z0G0Wg116qPLQ96d3tlOStWiDl2DIdb9TYABGXUIIKK7EkJBIL3dlwU5tNHx5vDc2O7h/uDAtMoKmhntwxBkXzU28vtQOFF+iF2s0V/irkfipDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tXmqI8W+fc/2sSZVXMJE0OeFFECeCOvicnTTeb8H7f4=; b=WNh4XrIMNKiBqytGHzsSvChnRTi8qQ3nH4mJN3i8cHmAGWxm0QydQc+cuYoG/7sUvtSvIAKcn3B7zocA8VjlLEQx7O9CMSGjZ3qTrOCt9xgomcCjRnrn6Nwk4NGUIPv2udVTDSoSp4VBYr+dpfKh+km5//xJKt78Vu9yxGCYL65qs/ieovpVkHAjJDKIK40ThL63BZDbO9oL+MUx58skmBjV2XLHd2dLhg8/JXO0AxJBL0i1q8+fYUY1JN/GkaYNq49FPEiZztevYGcVLn1DU1/WAq1044SIO7nFcgDxTlm7vdIJFCtpubw70gXY6zSyQfE1+DxIHgzs65b9Bp6fHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tXmqI8W+fc/2sSZVXMJE0OeFFECeCOvicnTTeb8H7f4=; b=BX4DNuP+r5Bzy1luA+OHhT1Y3icVnLQp54gPUIGu3EhI8RtTzfandj/ExWRkZJRHhcMEPhVB/oLIDoAUdf0M9heD7xO6G06//8d+jD7LXfkoIVyJvRGYQf7Sh162wihkMsvaZ2RPV6Mn/d9IJQxt89+mvYyDllulNTYdonK8duo5p79u8r2tUGGc5R4b5vUHBRBXwX5KrfP649BzmOjOLFXjtiKGIdK8Oz8Y+/CqVi9/i7POrwBaZA77CWpnCIQjVCgtD+KjoBtVCcmvDCnPL4yxB9AIEgnOKhdQZ+XTh6xUMBUhotfsOTbIwyqDyAhmDpVCtdrqPRu34NeO8NMkWA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:32 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:32 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 08/12] net: enetc: add i.MX95 EMDIO support Date: Wed, 30 Oct 2024 17:39:19 +0800 Message-Id: <20241030093924.1251343-9-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a55ea36-ed0f-44d9-0914-08dcf8c8fde2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: C+y89e1ZHn6IiFbTreQOobKz9zOWhd76lKCLrVLDAb2YgwyFT3hKyHFJVUEoFurt7SGb2GfkWe2qR0gqw8nwfVbNt4D5a6XV+LGBrTYuUwY+W1CAx8oppqBhjpwIuc0xJ3PfWQrE1d+UGGWr8GKGYc+Hg1J1uL9IEEmdmNS5fw3BjaJz2pnB1g7OxtxHPnPg2Bts8FQX4BBiZD3qSfLN9O1mLIsE19oayYQnki1psRJIsFX/AxOEmqy44LaShb3QLwkRtZilXg+r43MBM5owRCCnrKCOMwRwx5/Xxq4t2yYXZaYKbK5D3u7dI09/1UmZMv1UrWD/9sYaRZSPpJzys4gEWzleqAlJwlL/g83ODenVYuUL8n7ER1XfGxg3F8pPc6+c/SNb2YeIKJQEf5g88z/C8a/B7IXkFe7ZHyv1JHt6E9jh2Pw1GtJ+0vZRQSO6TRVooMzg1096VHOY88sk4mWyTmClyfj3i17aJabdOhecIXSDMDUwSHUxBH8npaidKeiNCy2tOeTskPwyMlJ6RtO9umKI0HAfbIB6bdsOA5Ixn6Xin1zhyHxmLgGsvrA0tK7X9fNMbkGjdyZm2RlHOjeYGhqrkCbeEB1vYpHox7T5+KdG78HbAaCSRM3bx8DXUqw/ApoTpsqFOnPltdzeeB3X8wCyZ1+53nMs5TacFqr4VTsLMkUUtvATLIE2m4QP7CF5/lXds8OgHZUNReh1mFdvdMyOPybzQb6cFplmnswvuY4tW2d9XRbwd7Lh8YAo8937iCDAe3zeBErjcG7inwzLDhcrSSOXf0oV31sq4qb3devKc1jnqOFKUh4kcVzJy0NWGEtiFDpOXEpgSt8MPQ3wC/d7Jphqs964F5yroJFhEcXodufgeA1vY2CMOKSN3Qgm1dvzLqbGU3Eo4K1NQSlQ8HS2xD/XKBY9iS0uE/0TDQVNZJ6GawvnoYyq7eOT8PeVSZk9hy6bEzLs4rDYXA3/a9ARb/BK0FJR6Jzkue8+H4W4kcSCryvvQSKijeg6mAinezhqlRP/YIfBfW56DQFr5PBkOVEldz5QqGe9LFAJWl1ArefqXk5YHb5jRLkBDxHcJTtr+GfKKBU8cEqo8iaq0YpHMzXX1+Mkieyejx0V19kRFYLCyaivBEUKI4khsz7+jZL9y5cL2Z4RLWdzskV20bzrgvIORDAQ1NADzqqFLBMXvlX9AdbLpyBv7sPavJtMTOLG78AFiH5K28QTzKhO4T1iiQZanPkoRt1YeT/6o1+4vJPQpXmUMr0fHOtyHqsoUMhKvNDw4HvxyUUFw6kDwbXu1yC3k9bglrzOOZINMGv3Yxg9035bQg3dQtY+OfBCgL5g4LZJMdpk+bR7fVGjBJARVTQVCJzAJAAMD7iTA6zZH9mGOAClZDFF0z2Z X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: un8noA9x51zekHXC/d2v41HWgl70KkMIBOUIRNL+xCtwtIZrLnshT7abYeDdwGw6vXKls/Bl4Lip/1VAeXF22wQkQxR05F88PRJUuDhyZW4jnRw+5HKPE4XsN/tfasj4Powh3YRCmTbvBqOJavz4+3tpVsyyT6QiktP6sVZ05ET6F1Yb5Mgp7KpGlafC+LBCTFoyL2VjxH2vfhwX6tQ+a6iyAi3t9RNuGjc02BREIxqV6TPHkOLkb0vvygLD6SdtWqO5dsCs5AgwFMSeS6FO1UO+ZzqfClj1/Nm5eGNAoqODNjUmD16WmcsieNTJfkj78qR7YWFTyZYQkNRQPmYtBgzPUNck2Pph+6BbMFyDWA0azmJE0dytLKeTn6cH327AFXR8e2WGPJbP6o6gpmrdzuBGf4JQoy65w+dmFMjcvXAcsmTIPZc6akkhGiEU/RxoJIlK9ylkYZXBbqUDimXMEp3KgSz+F/NQe/t205DygEMEelSTb9ZVo923czuJ/RtDUwllw3aBtSg4HLqmzmvY2kmFSb/17XTYmXQScmJnn+GlBmJ6T9hO8mWLlzEqkyL/eMqzm3bCS2vI2AHC1L0jqcuIDrAUZzLNlSzQxAFqSdT8p06Y7KxcrMek/rsMYniGGxb39n4HdZ3Kf3a1+WY1ofEuEthqx7CCqcZhQNLbFz0sC3MB14Gf5FXGYLw8DnBYLvYEszZLjkh0hbVj9CMOZpZghA0es+WyvBAaAFUX3kOv5F7AwPAxesbfu91gY5rwRQL/wjyf8uCov30ZXY8oHejyTHAcGgT/K9wBhbT4csrVMUTiFMgjpbVWgfpyiVQlAdASPDKdiKdM8+VrEErOGmUSuLT2c8MO1VbLs4jFVoHDdQivCyoOXvB2x1kpEMpMZ9sAF9u+pZDnWUEwLr1hHJshxfMs6IVHdb8yJiyKAHqhvtF6w5TBskjEFUc6Dbr7CWcIrTHnFk5am7hTeH9kdi3r5eRG/fg2WNSBmTGSGt/vlGy5CyxcYG3KJox0t7WjdztBdE4RQIRMP6+QcV7ZaTe9ecye0vwqWKqZ/njwBvDTPhLTChVtCRW4dGpK42NRGOSlKprsfrhjtf1Zq5iXjCAmO+6cTbXyP4o8IY+eg7Yksa0P8LUsWVxU2IvhhT1fS/t9siA15mCbrGoYVm9+DAbfz2VG/SVS8RQfsURKLEKEYutabXexDzGej7BUvvtmGZoMc/TPv6dyUBRDgWCv1kQnDE49ZcXp24yS4eAzgfx0bgg+P96qb915CUptBLZKc9ioRh1pwmMU8Xku8NHuCd5nbYZHKyxjYqj0YU27r+vsm4l9j/J5y+X3L4YDRQBbL6l4Dbsn7kIZg8SqfZ+ZRvXbE8FyF9i75ftnYZPu+rSM28NTrqpOzFWwNh2v1ew2i12cdGPhhprivNdKElLuXXiJkT7W2TCE4iSUFJ2BlZwXFJ1Wujxz5lN1QTO3SBx4HNDp09EGH8d7jSEGUmy0J0w6VNw/iw9Yq4mHG+NJC+r/X8gwP/7jHwjeix1bLA4ZXyqsjWYGOD79sODNmhLrrINr2YI2nVGSJ/o8VGLOOMwi0iYXVOJVwoemKqwwoB9f X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a55ea36-ed0f-44d9-0914-08dcf8c8fde2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:32.0001 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LpI6cPAmQZqrir5P0Yc56/oFWuZfTJQ6NHU2+PavifNOvXXT4USDgN1y1nNOFMpXzvtfUCpfm6LlmJ4SWixcKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 The verdor ID and device ID of i.MX95 EMDIO are different from LS1028A EMDIO, so add new vendor ID and device ID to pci_device_id table to support i.MX95 EMDIO. Signed-off-by: Wei Fang --- v6: 1. remove pinctrl_pm_select_default_state() 2. Add macros to define the vendor ID and device ID of EMDIO. --- drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c index e178cd9375a1..e108cac8288d 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c @@ -4,6 +4,8 @@ #include #include "enetc_pf.h" +#define NETC_EMDIO_VEN_ID 0x1131 +#define NETC_EMDIO_DEV_ID 0xee00 #define ENETC_MDIO_DEV_ID 0xee01 #define ENETC_MDIO_DEV_NAME "FSL PCIe IE Central MDIO" #define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus" @@ -124,6 +126,7 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev) static const struct pci_device_id enetc_pci_mdio_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_MDIO_DEV_ID) }, + { PCI_DEVICE(NETC_EMDIO_VEN_ID, NETC_EMDIO_DEV_ID) }, { 0, } /* End of table. */ }; MODULE_DEVICE_TABLE(pci, enetc_pci_mdio_id_table); From patchwork Wed Oct 30 09:39: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: 13856219 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011052.outbound.protection.outlook.com [52.101.70.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 531391EABA2 for ; Wed, 30 Oct 2024 09:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282145; cv=fail; b=fUCqs533H01zxQkP0NYgATC8HZ2RW+FE50kEVQueA6QGEwZ9ahRT5pyLkr9NiUwo2Xu159gJCB4M+T3r5TgbshCNt/m3YVzi3qqknfsEEfwnIrJqXNTV+z3idC7dBI82YW5ZG5FRa93YIZKAws8aleXjT5KrqciDGo1SeKHguHE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282145; c=relaxed/simple; bh=dLlg/2utw/KVdtGSn44OntDeTHoruscl/LecP9o+yaQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UsPoJxo6MW/TSh/HPkAqHpFwOrZzA2zxfjrGoX/v6aShdHuif9Ceim5cIvxd74oBsqQIG+t9fF7/wmc5YxQ6PTHN0AtjP2dp0aIZUxt2FCv1WYNaiW5Oabrq3qiqd3dTHHMCyMWAB0U7l7DBQSp1ys8wR6lqfqsgB9qggbQVdms= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=eWf1EqE/; arc=fail smtp.client-ip=52.101.70.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="eWf1EqE/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kmz0ZG1Og5tNputNrpiK6X6nlqQlznMQ5pw3mfF3kImZ3jWotOzQj2O78B51M1PtjHeqxzdGS6mSeqcZOxLMBpIs+Xv8qmWOuiOu9SnUN5knf+fM4QABadATChpakUSUegEDjEMtQ6BiE9gGNnY9TKGEssEaVm/bXjMejyIDWlv3qxgEotuDn8/YsHLYMbJVx3pObLvXqU4HR6P3wBOGMPGY5ffvlcxaGQjUmaf2ImgQascr2BElhNHLXCKAb3FfiYnEdGMbFX8Hqx2FpKcpOfJBpkSisRdd5MujfXUQFyTGe7WngstnejhW8RUsIaBiR05svpk4c+VR5bGaFwHc3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GZuOxz8yzyturV6RHu8PVydjVmO/8OC8k5rAVJeKBnY=; b=OeJgitG7CKAwOLlDwuBzBs+p8lJgqqM+/rwoUzmt3A/Kq4u7j4euE0xagYpVGHw3WcoBT5FoFiCk4W6BQ9m5JH0TkNHyTVMpLzwU+KjDyyfVa2xfq1AFXz1zpC8n+JOR4R7UK/DD7Q64/kmpqCAXsf3Zsn7Qn/ldMvyKnnTI6VLrKJyCzaWMvWqdcTTmwDceVZpXtPGeRWoQ6EeOjJ+onF7SI078HLPmbKg36gCGlFVtphJv6cqAhlZAsxSwKhpUXEHAl7mlK20MLHyjj24lpmXqMdYm/UngQ07EVHw0fgs+0RY67Uyb6Wv3YSMcnK4TLtOwz5rLFBl7v87L8cZIBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GZuOxz8yzyturV6RHu8PVydjVmO/8OC8k5rAVJeKBnY=; b=eWf1EqE/k+Lyy3LftNTWVpX7Dd+H75JRzVY0hyex9Z2Wef/iJJXNc+qN2rXFpuME8pw4uGw+CWLf7M8SPhnB2R4jJguQzmyDGhVxcCkK+EAUHrcvnPhM98Z7ytf8N3ywvD5qjcyUrN98MSUU+KPNjuqtw5tcXkO/3AAF6/MBRsIpBawyZHJR8vX1GS5T3YI2ow3Ny9stpnrh+26YueFJ51/lib7v7wV0HA53g0wYr/eSLkVDRr6whqWQ9SQJdaxeD3nsievh+5WSGEQDCJLN2f4tV6QTHm4MHRv57V6RJ/ska6XBVcp9hF14Pf7ObVAf8s81qRm0pM/DIKNmt1ru2w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:38 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:38 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 09/12] net: enetc: extract enetc_int_vector_init/destroy() from enetc_alloc_msix() Date: Wed, 30 Oct 2024 17:39:20 +0800 Message-Id: <20241030093924.1251343-10-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: cb03506d-67f7-4445-13f0-08dcf8c901fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: /9TS3Bm6Gz13tN4r1J/T7JW49JDdJnvJQ+4E78snrabMefGrPqBIN1BQ/APSb4hwPBdVVZxXG7Iu8gq0LuEY3Na7uQ6RZYtl9dxNtd6m8rtAkwbiN9gX0hLPvzIrlj0E7ufG6btCFG4guyuSV0hwN6xCBxtwmaOI/fi9NsCDYD65KmJ26zY2Jp5PAGAd8weQUS2kXDQ9rKJDfqhEx+5gksd4/46k05ppHA/1O1meIsJMHnYWB47G8hnPr4VFh69IuFWWuKkIKrRLY1K0qmmFJvu9oPRABX+Rv3TorZym5/XM8fwrTGLIuSUZ/4nC2c+jlejOYlpGw+DzWTVcaKeXam7573IF/Z37J73HeRwuSYIkYOgqZCXbOOlw7pC3IO53k8kumJHqNF42dVF4iNWOkd4FsSJKsauzv5i1/yMpr10rfJxRV6tIeunMr/4XRPAl1C0zaLeUJOLl7Kip8Bdas/B04Lq6HQTOBBmIOvNZo+PO4YF3CR7SRx+3/+eP2Jvp8ldfXe+vMqjZy+VPr8+IoaGZUagNU/aItG85l6dEuu49IlhxOZqbNkqNlYgh/fjWd6sk+257MK7R+ZzXgKjc6w07Zt2UYLSbkEOoqHQNm9HFv3rkqwCXgOUlxlcavrOz4pOfw3MItH6q/TdCySBXpJmRYYJiA7wViwE7/JfouDRmL6CtotOAqiAHB/pbCQAh3x6LSWbPs+ihyPKcmDA9CM/evI3gE+f8zrH88l8gYfDwOc2dLWTr9FGf/PKAkqaBWx2tXlLq73sKGReEAukRYNNWSkxyuAKcO8xYq5Swd8LQH+A6h7TqkN56afUuBQy2sbb3W5SwdFccMObt1t/bi3ZydBooxXsJXDrpOuNQmgD17DqQyJnu/LmsuGCiZ7DXokRqwqZ573W7neqUG0D9s1mwtXsqKivyPI0zTaMWdgugbyBpE/HaROas/SiQbR7k4o1PX8jH6X42A5/9tDkMlvTsCWyp989+fWpYTuGOzj5QA5OfYNaOv1/JEsRYeFlsrmhw2jpaCnc6TwHITXYhmwb0aOZlNC5bewYWwj4q0azBst0NRXWCNC+4COxoFSWr3m5QQemsTgDyeBk4YSeLtoiTR+w9jkFXDofOFL0dALmJRG6hKremFueBPWxko7WnKULHQTJ7mt9+jNDV3d92GJTB9efLopw9ctnmCvypNY9RylaQkOfIw0E3v32/tD3AL23+3cUtPXLiguze6pnrvNImtrl7Vf3/Io7UVz9ATjDeaogd70yUoPdPz66szhy00JNwA+GPFkBqxJ6lCOgzNhXq1F90CVES+pANssjMo8E5XJ3+0abN32TspmWZ1F/pjipsHJlAHon37ly7ICffJSqya3YDCtj21O6mXyBginsabgRy92UAJgM3J2R1iCSk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KWuxzeYPr/ckBjF873SsPPCVwG1b/WYOt7HHLxNHecrZm2z8YrKAgwsNiS+X6B/KcXujQ5Zo+0aD0b0A95c70mZF6hjbcrqVEK60V4ya/sLlZoFPPcSrWLQz4SA+DGj/9MJH91Q7U9qtSZCLCt57f6S+MUTZ0g3pSLkOGKwewG4tP1x8vkkEtSU+252fdJq2wK1owhcBFLwdK82Re2g6FQuldyNjRCgo56fxpPUruQIsyuV96Mbk+CBkXy+hQIlRCoHww5QZ6FCnANmqq0NLL/bRjs1yp0Uv7fjEuOE3zhrh45u7VXQlHgykzxcecwVLXI57Cw3LoijQy7jh6qU9skQ5NGTQaszSfnJeFLpz48nxa/lug9vLPcJ40JASllnSotWr9uUmJAxIhjiQUR8k9pN1WjikXuNc3eJ7X/jGP6D9DAJvnjLyBb6M4pdtmNq1osSFjf9+mJvyMJziU02J7TZCkjERABFBY8m3MdJDQOoKVtBR1K6g3vnH/qK0zV6/yd2Yq5v/j/zZjRryjCyCSOapJ8b09RdHcv3ueGT/4erit1I1lVJ67ZivBNAFf7Cr5rOEWAHRi7+ngdx4ITyK417EbVBM6pYmQQx2dQ2XAvxPmtBg7ECTaf5QTioClZ98kk3iTqlP6a3awO/p0KM1AlXsxCV3eTgcN/WhAJN4VF8pp/eT9O/0keOzKnqwb3PUwAU+E8YS0Q1Y3qW71VRguq5vKwnUGS1KP3XjrZ1B7hpil1bq3EvTQM1A6w/qaA4XfxSvGNWRIoRE+M97d6v0FyOzkELD4GJ+4Ju8cdv3mHMct/CrNoXBH8JfhWV1dCw0h9HI3WrFO5Zv3cGGIn1nfu3uEXiXP5tRGqO+61KTx8QZougOfxmt7O2y2szVUUMtqWqFF7qeuMiuRcz3Jk3XiGN5I0gG7Kal4s16W1HxnNdcMHZtWyr8NC5x7SsKkBKs7YQf0211eXujilYpnS8WTKvedsjUZUrmaQnNsdXcEo4XUjU7YdMCN7/JN/P4wURvvOmTnAbtdtBJtTfmJ41vAp1KRtneBRR5G+W2We8AlOBf0gGa5Mj0LYXsjG7NbxdozHwgKXPtO518ESUapuBrlcklNixCkzSTKiOA3ko4xpNQBBPFk0J75AVcz6c8me0X+NKAbr5uKpTrxCUUBf3+k+Eyqr70o9zHVvbA7frAoodh8gW3Q8NbkCy8xFxBpDViZrrxRBGzpZrRWvMZJAzn+MqlUsCHgbT7YjjYtTmN5+2RTjrDUspoel9dgxwyPxORJyGJGHLlM4QyjAAiLogIaKhCXj1BrIcTQTqZHJBeANwrjqtqSZKgv1MBV3CtPNCDFjwdafcrwySb6gReo9/x7UFL/guDSTw12m+/19GxgkhCe3I4+r0BfSUWZ4QiHR2TfXnx9XI2XvXXEMORoaQYlIE5mfQfHLu2f+Jn5a2HHrkm/Cli5fv5+GNhxp1R4tAkfmyJLW8+logUBWJRpHb7t0wtxcXJKsX2xczzhX5BMBzROWJ42nPjNhikm2rOmJMYmYiXueHXHfJvR8a4ZP3fn9wyQKx9M/NQrdSd4hsHIwPsnTSCqgk+J9Oax6Ebr4iC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb03506d-67f7-4445-13f0-08dcf8c901fe X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:38.8476 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lHV4ZU0eb99GYEU+2ToanTPtN8NkCQVbI4rHyaXacmzouTMheTxRN2Y87DLpmry2ypuXxOrfzqBTU7PU0nDiMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 From: Clark Wang Extract enetc_int_vector_init() and enetc_int_vector_destroy() from enetc_alloc_msix() so that the code is more concise and readable. Signed-off-by: Clark Wang Signed-off-by: Wei Fang --- v6: 1. remove the cleanup helper functions --- drivers/net/ethernet/freescale/enetc/enetc.c | 177 ++++++++++--------- 1 file changed, 92 insertions(+), 85 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index c09370eab319..f292c5ef27b7 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2995,6 +2995,92 @@ int enetc_ioctl(struct net_device *ndev, struct 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; + struct enetc_bdr *bdr; + int j, err; + + v = kzalloc(struct_size(v, tx_ring, v_tx_rings), GFP_KERNEL); + if (!v) + return -ENOMEM; + + 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) + goto free_vector; + + err = xdp_rxq_info_reg_mem_model(&bdr->xdp.rxq, MEM_TYPE_PAGE_SHARED, + NULL); + if (err) { + xdp_rxq_info_unreg(&bdr->xdp.rxq); + goto free_vector; + } + + /* init defaults for adaptive IC */ + if (priv->ic_mode & ENETC_IC_RX_ADAPTIVE) { + v->rx_ictt = 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; + } + + return 0; + +free_vector: + priv->rx_ring[i] = NULL; + priv->int_vector[i] = NULL; + kfree(v); + + return err; +} + +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); + + 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; + } + + priv->rx_ring[i] = NULL; + priv->int_vector[i] = NULL; + kfree(v); +} + int enetc_alloc_msix(struct enetc_ndev_priv *priv) { struct pci_dev *pdev = priv->si->pdev; @@ -3017,62 +3103,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); @@ -3092,16 +3125,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); @@ -3113,26 +3138,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 Wed Oct 30 09:39: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: 13856220 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011042.outbound.protection.outlook.com [52.101.65.42]) (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 BD8051EABDA for ; Wed, 30 Oct 2024 09:55:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282150; cv=fail; b=tGaXrpoSzpgvrOus/Rt7+Kx8FR9XS0nwpo4XRyjHGVhM41TIIBHwC6DVpTLnhPVJpOsx8EWabp9OdvzIo6aysRYemDilMUa8WJ6apUUbyi6FfNJIsZU5wocrR0JCqcarb8ZwmYnmGkSCnFSzL8L/xfPrDJRvhQvlFHVzD9xNL/A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282150; c=relaxed/simple; bh=HoBm1EzDooAKHys1FjB6qVsFv9CMTg4Qgxw1LVvF0Z4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Y+ZbgrO/7jgJD47ACw/yC4rv/uzutfBuwstGWbEX/yDD0bL5bF2CWQHOxzW6rCiuLUZ3EwHABhf8v34aZc8WfHRk6zEFDLip70cqCzGO3CzgI6fBOJUZimNw9FeTiOPS9p/CJln4MRNgP1haaUcv1ezlGOvfL0oBJJJXZrr5kwQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=cWKdImBI; arc=fail smtp.client-ip=52.101.65.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="cWKdImBI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tQPm+ZDXwhKAA/WLv0GnYyWWhxuYqGJ9iaF4hXS4t+vxOtz3J53UoyuYA1W7/BUnKnwfgyK/HfA3Co8hXQEHlrAkiTMkOmGaq3WDJ556adqkPW8P3iU2mBjKMnudDOfIpHAvGDmNBU2wrGXc4cGJ6BE7XdsEV6PVoij7Js+gE55fvKvFaeGmX6wlz2ZJnBlPmlPJv3njNFYRzW2tQMWi/D/pmZ+qZf64zAG3y/8UALnhQPvbc9RTqdQT+oNLb9dFGr3CavSLHpUnCScQR5jHjqGzR5gHjXhzFD3syEVhEts9RYKiVCAxsKnfPscvyPGcRVkHvSEhK5PxzK2hBuRFMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZCq20NAtgk0hyXkMNIIn0r67H4ms8Djwh3AFS5QawQs=; b=bHgrvUkcO/VRTS72lp/UfideXnOA9aznPXsBbdQQyFTw58b/P/HbFGSFmqPslhCEyiF5hCsBi0NUiWDpC7bqcIQJHY3fbFeRKeU/90dC66r3AIyLJDmjYvMz/bDPbBD2pNCTTA0kZ4RBzkdptfavA4o+qWxrYLh6UOawRjcRKUqFqjwTt3K9aJrTJrK9vS/dVHt/VYZipFqu4lHGcEW/rMt59TwLnoN4VrdDC/88fwnWjPiEdUaqP8pmAnrF129NAcJxuLnFm+PXlUEcpE2au0gNOHqmOIwzef1M/efwas/NHuekIr/SKNGmWFtZfk3OjLSjCJ/EiWyLfiK+ATm0pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZCq20NAtgk0hyXkMNIIn0r67H4ms8Djwh3AFS5QawQs=; b=cWKdImBIgJM13nCoUfYSs55GnngHVPPe4cyRtm8cL4F1Q2ljSPGKL7Gi2atZNh6N12z1maNFQ2OKqPD+YL2JHabAaPKmlZXnV1Iv3sMIJ4TrF/OLR15KbQ0vOvJUu8g5rxvLGyKurhMfTfL//SLvtgnUGNN8y2NZ/mkknOWPa4j7BMJQpl2rue82SGbTb9gO118eBmjdYE8t7eBLgWwoJeMM9J//ZnRqdJ3/t4o3bj9OUuVyVd2gvf9pFHkfBz14RuxaJBR4THwvJyYRkDOGlh9Juf/VeB1CleInIAHiZU/RvG3N26sj4wQAabfSD7ZVLooLAvXLQfrji4kYh7XPbw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:44 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:44 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 10/12] net: enetc: optimize the allocation of tx_bdr Date: Wed, 30 Oct 2024 17:39:21 +0800 Message-Id: <20241030093924.1251343-11-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: b3c2dcc4-7e37-4a04-d197-08dcf8c90595 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: lYinEs4DKPoMnmXmWcKdqEfUeTEcOBACqFtS+uVyX2kodH/gZ+di5pNrrbg5AsxgSGtK0vT3tYEQAzX8fDXSnJKjj9dgJAzpxuHVEfCRzniFp0GY8EIGusyp+aQ7rVlbT/xqazCEGB/YH6C0ZX6Ft6hvph99cLUSO3iBXCvJVU1dqHFSWAuXTHB3luHFfrMLlT0Aqj4+11I5ZlYMncgXI0K07udK110GHWR48O8Mz210UdE4rMLfN3rQU++AOMKmeRRMqx3XfVgzqUH9vav9L/kVF3g4XOqIxa+OqbPrzB74daCe7mOju7AffNIvT6fUV+sRnnRSs9blNcU0ca6DWUSKgjCAiwOlT4xOGF+/PgIQ3qd8ACYithEOoPZcKMWVM2VVWQCEZ/L3E3H534c4eAyV+CzvmlU4L/J6f0C5yPPk/CqXuJgNMFNTEjql7FbM/Ln/dITbmFfqVYMvJ3KkREMDI5Dx272Hv6R2Jtc4N6udj7XuLZa8VIeqWLDi0mkGd0yBjCdN08YGtJvktPR7WgQ++JLGoWyw5BmNSY1A50eIvpgTcapWh4brnE2JEAMAEmq6aHCj9tUgcAM/dTd7YZh7JV36tclXBO1jq3JEfwcQX4IHYgfbZ98aUypTHtA1oX7Sat+ISLHcO0x011kjEdqodXCk3swRYege8hTaOMpyzFA8vMCDpVtPm4hXHNVDU+ViOmSjwTLupaXLE9/QjYWfYCL/x+krVLR53b/vyUQtgqtFGm2mSnSYqVsiHHHGV4/CWEWopjceFjgt81fKH9ipgy/BUiJOTbAW1/AqAXD77NS8/gJti4MHukPZP4NaA5F4gWfQ7hrkmuB6ftmW7/YhpVhOekxxdcX88KqyDCry47U9nMLvsFQBLC2VPVyTBn99KH8lT4HeqsCYMzDufVId5MRP8fljdrSgRGh96VoYqfPrJX701aPYRGiOz4fO4okzvJ7t8h3Bd7JZ8kyIEXwviha0JYf5v/0fze6+MOL+FDOtRGyb99wWv6IvQdmjl6pEBHK2sWkej8bZPZh5zYSAk2rlTql2C+MpthPB8ODinI3c0nUAl490aBKVrXt3k0tHvL1GPSnTvXXnkay8V/uxNnFy9rHU1vy4pO9RVNmBUSnpTMT0HMF88wvFyLHovvlNKz8tbuHH9h3A4EK13B318MHY9hjz3p2yZ/EiyhKUtNgrh+m32nWhUfTMizhkN/Pf7aq6Y3oCZFgD16i4s0bwxgPM8+uoZ37m72MGzbJWp4SYbCnu8n44P+kpWOiUEHrgUgqiQfv2zKLANK07UfrtNBlnCdC2zrbIdwzRcFOTmLZSAphG71onrj8yohpdVru1Cfw2DXqVjwz6JMDiP5m9Y+P/EQ4cIz84OJtK7Sa2IvXM6R7dEIz+w56VcAPA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xC3mkSs7xLfBQif7vfS2d1jRCOyaapXDOn7YM1HzOnp9fyzR3F7+Knx9nH3nMB/9tctV33Ex8QYBhRz3R9Dz2N+7B2UFnOZyC2gGEk2x2VvP0C0ngVmqSbcuEOHVYX3uxFkxxAPOdJ5U8/nYdbezfWF0/cpvcBB7KSCm99DIeCuWNCrePbldBsajRuHzd+K08jzS57G20u1lGYdMVwRTwalDySTfCDXo58i+tPEcq2iDTKpPRilY2Ol4ioqHJ+eMCqbcH3Hs99iKgURKPXDMAqbSlY2xaUZdSNC6ll04Vu0AP7imvFdnZwRuNUo63zygaKPgRU15OzuSJUxXZPtmV2QAy/0hYnTl/bKw9r7a2Zy/owmntte16830dNiRltWpM+LTCx/gg7ZZR18YE32bsPA72geWYS4F7SfF0L9O5TWpRihmN8c79XwGrRI5G37wWXCKVJJCqJiQq8+ujL06KqFok0UVawj3uk1Rgq/YHS6HfAlpdsCkS6empC52Tg7ojzur7aaborTy61bTIvucvddiPhKvU8FoZwreDMLuM1PESz+goVR2gvkqKDrPEEjJs4dnkOA9dniknH6m1BwzmGl/URIcjb9YKEChbBAppat8zchURZx3GQhc10YOOfu1kTTjS9/5gNBqVFNBMs2NQnzWkCykHcmKUyrFqiQsChU17F3WSBkTJMDrmBtzcjx7noXZ9E/ESPZEOrsYsHcAwCSuUVXct8yb0Tmb0x5g4rzU4+eeP2v/ebVPHw2fmjohrmYF3u/PJBXThz44ehZIDg49hsgd2uQiGbMFEEONEF0rXmGD6Xk0Y2hkv1xs2HIJJ3qwOKA8MKGOiNykhlUcp/kMUpetfZlMiq9dMBb+YFXQ1hfGZvAXY7MmGILuZ6nRt88w/D4rLmNv79mJFfT4WwfDowCcoVKIMn1Gsq6VJaRtpKESDwXCkOkiHDRAWt9YD7IX7+X/6IzmisLcwzf4M5gv/6Z921v8OjU+JlEhuQHmy8zcEvLbLmyen8ISZWUN9y7Im/rEO6xwspVJZXSWyDHDzAY6P8ttvtHXBsXtBpwxzm0YGkb7wIEOVFoD/0kyqFIiafwDD468H36hb/vR+5mUnN/4YieY1jjGq3aS1UYXGXhWTmc+G2/ZeY5yohp9d1JANNRSrdP1ZM+ePB7qmqkXOxE92WbccXiTm1kaJcCwt3yKlwFU8jaJN0LbdBy4tsgrG6M4400NmxEVcM5S6J41UrFj5eWAjqiIRrpHMw0ZWIsTJiKDK4Dm0EF0+bGhr8o0KQjWelLMLAqNf8m+PCGqHx7BneNMBhiI94oGH8h6u2bYfzt92Bih9ojClYA/hWBi4hlbaycBWEnhDYT9tJybb7jXXWZcAp8OqOqiWm9u4boiBx4HwwdVomfkRA0J10wUB5D0s94JksAfUTLr188CVtG/xFoWma466nZ3XSf+Md/yrKPai4Ko+LeViLJXbsjkshuaQnIi2Juhzyt3vZ2MWlWLH7AH6hTuXLr6PTwQ7qKaDTJuKL3wK90ZyVlzquEuj7EfJYBZKZddV0Ec2Dp5CC+7qxuXnDO/zICF4w3psqEd6hUj/zPBqfcO5SeP X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3c2dcc4-7e37-4a04-d197-08dcf8c90595 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:44.7699 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Pzvj64BcERSAWlYkr1qA93pCJgzY5i1tvAJIXlAcrdXgZG2xyjhYeyyYbFK4SZwKGIf0CZmcswbBYSqb2RftKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 From: Clark Wang There is a situation where num_tx_rings cannot be divided by bdr_int_num. For example, num_tx_rings is 8 and bdr_int_num is 3. According to the previous logic, this results in two tx_bdr corresponding memories not being allocated, so when sending packets to tx ring 6 or 7, wild pointers will be accessed. Of course, this issue doesn't exist on LS1028A, because its num_tx_rings is 8, and bdr_int_num is either 1 or 2. However, there is a risk for the upcoming i.MX95. Therefore, it is necessary to ensure that each tx_bdr can be allocated to the corresponding memory. Signed-off-by: Clark Wang Signed-off-by: Wei Fang Reviewed-by: Claudiu Manoil Reviewed-by: Frank Li --- v6: only add a opening comment in the code --- drivers/net/ethernet/freescale/enetc/enetc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index f292c5ef27b7..89d919c713df 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -3084,10 +3084,10 @@ static void enetc_int_vector_destroy(struct enetc_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 */ @@ -3101,9 +3101,15 @@ 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); + /* Distribute the remaining TX rings to the first v_remainder + * interrupt vectors + */ + 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 Wed Oct 30 09:39: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: 13856221 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011012.outbound.protection.outlook.com [52.101.65.12]) (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 520B91EABDC for ; Wed, 30 Oct 2024 09:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282161; cv=fail; b=DLCsXSORlD0xJhiREG9YQmB7k6ivMEA2HHgwbqJaSF2PhTkIYFd+9xkfWiXSRItkRkTnX5E2HzFyK+OTCPAx22J8TOMibSZzdEmj9c0q+YKD8UiuWhWW1Oz+p8q53zP/UmyiPhuK97gy4Covd2F4uXNHw0ozPhiL76njPw3jZIY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282161; c=relaxed/simple; bh=INVeBupvy2cGxoXb75qDtjwyGRZT4IU8RJxMIn66mWg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=CneDF1ffToOAEQ+7r1IIPjC/UeAFhZ97Vr9ZKJbv/Ad47iwid2Hi/YbruUBnv/LM8nYBj0nQoPeciASFC8ygiAe0uKD22Td0DgeEXVKBYUw+D73PiDBdxPYPJhhpjvPioLMetKwPaYPR+2B1o7yN1ajof4X0lyyvrmAw5B3dywo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Tv2ii15t; arc=fail smtp.client-ip=52.101.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Tv2ii15t" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y4x34l0eZ/qBVrvh4Qzwte8PKZAr52BbGbJnDSJe9+E0YaHsZ6yU09evc8KGau3Mnb+mh62qgQlfCqAoiLUtoywlnbAFFxSScDhLUoZ6kJ31Jnx5aVJtPGaoE1No4ePcaCyUmjRKEbQZiY3iVZCjG1YEFY/LU67yE32Y86x2lKlaooyfa9SVphMp7qrEEg1aeoUG1s2hVi55cWVZmCGQrGjsrowdCZyvJYhN1Q4cH3+OZQ+1vD3H96DgfYPrh5iH+HYySlPyVQD6a16n5Gh4z2btWKwDJX+ne738YM5RA+WTAca7/m4LoLIhEB+VnKcHaEutukW9rfIIHtPJydx/tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K6zcPzxzKup2kBuony84RRVBCouQ1NZX9F8Tw/hVJOk=; b=e++np/VouDnH0LlMPMG0ZvpJqEEA1PAzTPBSV/5W9FeGhkG38MF2PXoInKAGFHqeFx239fzSRJrpI2XCASHClXWqwhr9gQXNNSxXjozuOGgEn1H+uw3GpI6D4CZjZLJZmn2WOb4/rxX1IHaaQfcnaIQbrGBT4FD2Q7X2bwxRrKPx1NMqRqRwKDaclTWHHfR3GTUcmJrg97bzqvaWkzq8FvsGbiYh41uVwtqpV1E89Zx6zRUPBiqGtvpoCLeRW3q8p7eEi/R2miHqI9Z/fpFJ8f62llLtxQsEF675rKtqkMZ5T7bZNVF8RzOMtvrOk613WV6i4gGmJ+cYi9MZ2c09kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K6zcPzxzKup2kBuony84RRVBCouQ1NZX9F8Tw/hVJOk=; b=Tv2ii15toUJwljlIK4hrCScJtEesdY+jX0FFlbXTZn+dbd5GzV7SSRoDx/kxc6A2BisQ91lgYdCu94x4e8Ebbcax2Wqw0yPW5Nc82q+nWDrtOwtvvl3Fr9jUvDUHOYmGMZ3t/pBniHSE0zagTBTQ0mcux/QthvRYLccPFPk8ZICid8f9DVHYT3F2lU5vh/DJjdEvFhxzywpS92QpFoiZwABMm+r+70wkmZRl7MyL+DXQm6SqEfODkJaMMhGkY8GkxQ6ata0qJ+X/1iePGAdPEEtaL8rriYLPGVEb+KIeDkvFMk/yJ5tyIgr6xjP9LOLWsh9Cf+fGQveemZpCVpcrbQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:52 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:52 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 11/12] net: enetc: add preliminary support for i.MX95 ENETC PF Date: Wed, 30 Oct 2024 17:39:22 +0800 Message-Id: <20241030093924.1251343-12-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: 17ccb9bd-c400-4845-adc6-08dcf8c90950 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: m+Vi81aOhls74g9AN/c7+rLlpZY3i6djrZlpD/Q2Ng9x91fIKc5wDL+0hn2wlPVa/OeGdbc7pLVLWess2DyJVJY+tS8nxZmmOf5ZI46iGnhn6Uut/eKRg4GWkmv+4DDJ8FujcRdB98K4QIt8I06CkMIiYv1MqkdEutKMcIRLVqVA2iqA0MP9CvAfj5aHFupxy+262ewXqQXNg/rg9Zr69jNlioSW1tTC0nrshXXRWEar3OFyljv9KKbZ5R/HzIQXiQZU+EZP+Jpx2zAyGS4x+lhucJSliLg3CbkRXEvHIJLGZqVF8cLyx9F2SkDvetGcszqKhlmFXeqaCo6Ot0mVWnzva/fVs44MmodhGRMcNmtPmjI7pSFDG8JqERqOrla3Hz9+4LLcqRqHhUg4WrjSV1+Esz6E0Drc96mD9dgYfGStTSTshi+Wl9Z34G+PkzYHS7IeM5W/f/xUjuLFTszekV9VUPeRqxDgDpGWOKsHkSyqZRnzxv7YK2Ip9nXuEB0HVMYPsrJxWLszbtzzWiaW6s4PFGJ7/SWBY5SD6JKqRJALO3/x9nq+N+m2S8EXAMZrpWPzaNE5LphZDnpJY6YAPLaWRyxCUnGe8pXjX7zvdL78SZ5Jxhj1kVwpHtmvRVLgLa6qGT/cdAMk/Ey4RM6boWuj2BX+jNSjqyu4qs7crL0wZqOoIwjunQzhrAseWMqPp+b8Yl0gVCVwdD9KqzjZ14naMLh62o7AGukDmQ+kOun8D6JE7nDfKyQMVCLbz1rigNKbQKAJtUsHFNGwJ/mWWx3r7q70uEQO2fK2k+b+TWVUegE81W6ufWDSMgz7EnwmQLT9XC1ZTcdn/jNREyo91oF7dfVLrphYXFMcw4EKs40AP4Vbi+/vzoyLQtZxG4w+Rh6vaDjQ7RlVb1HoT1WZ4aVALItEhb3lCOSbZ3517fmGOG/iAvRP65p1KuMiEaF5pTyfikl+3GgTfNQH9ckoqUpqbpFku3lMAxi4S+uI2FGrETvm9NR42JZpmxsO0B8+UspqRvBa0SYykcqFs+MR0ByV10/jvykgUgPytV3IBphsSAEQiW7zk47osrRt6ksb5M9W+GXYRfBQOkuX0etdruVAWy70vA/wc+9UEXCC6ZA0tjgAN55CspJtsCDLQeDdsZZE91vuh1lTEr5R7mvNXBa6FzJ9irao3I/nc0JKT02qB31iXWfx3GU3eVFNLEEl64l48n1lc4Li47pw2s5U4kJWC5dDmUgQXd1Iay8tI5xVim0jPXNQUk4ZJ9FWnEa9ZlWthe6M5IeatAxe4zyWMW9X5tN6D6cNSGaJiEivob4FENWD/TsOQTtUIsTqnj10dMsCXVElhsbeIB1gmjIhnl27h/FJLWD6pciQzWTBpE5Qz49wfRmc8W9qnelF8nU+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3nj75KhiNhOYolKLV9gST+QyZ9Ryqg1OS9LRVg6KcylrW8RBleFB7T8LXLK98gHuryZ9dQVGRQAenUYJMhjfnMcEn7pbxKXNdo1sdsK2Pj6in5u0+bSZmM7AWzNmFHVDS0BZVJrROlKWVknMzZ8A2622pQ7VEReEaqxZ061js9QteyEZlvJzBnShvCy99kbwrkXx8RenuZQ68t/xraBPbV7zKqQASpWg2bjFa0uxwPLuVYe0P61LsvAzqQivqPV7S2nRMfMu0t1pQqZsiaPEN9TCJaKMYKfjOGlsWvkKeNfH0YWDxDmWWCPJQKS5i5b1PxU9mBsBZgHUlnZryzqRfQPtMy3WxFi1qQOjjpmohtgNdL3xcy6LBHJVKSOW1pKrgRuNep5VElVdfBphl5stpJnPmsbB/6A/nOu20I3u1y4us90aDJcHmzthybGNwaV9OUyUYpKtCT/J1eEYnBYdQYGJFSutjpilf1hsC2oibI0xMuz1UnKorsSzbEX3aEXaBkpFC63bF1dVLAPlB0yGdEFU7/xvDQdYAXZYmgteTHQICX8mVjtQiZxXSt4xv5gW/ugX+PKPj7gkp8bQn1wHm2rkQskh2s1uX0+CS3mp6CPn6SWL+nGuSRBdQSfNvrOH3ErwgVu/5YATW0E3o5yUt4Bx7ILOGNGYCuLxdJIV6Nz5fpH5gYrr0IuGd7NLNUPJ3QnKpZ0c/MyYyTwuvseuhsXNrc/EqDN6kS1DDOY79wxw7dI5kcwZKfpdHAi1+HZbsKL2AF5kZLmUengb1MGJyzEUk1G4YVj/PRLPdBVs49Jxi1xPN447ANPzwG5NcJh4XEclk29P3BJNET/O4dSt4Twrm+w4mZE/l9uCyILhjdvpF73y2thnduS5BEoE/f3OgPHwhH5qi82J2D6Rz/jTqXw66fryPz7l+D8wnrZSwIVvsRNrDB2oigA/A8CVmL/FkyyLu55AhuRYcYxa1hel/OQ/28pOAHoQjOnZ42HDqW1jkyX055Lj6HONsMJ3nGVCyhwO1pnZI09r/vtB0juxD3A1bphALp1pKkvq+Od+PjPaBdsqv2st5lUpn8CnZpWI7v1CZv87l8ywqiPlqiMzx1LI1wJCLDdSO8HptgsJw0Myzzu4yaLN7vmyvJU99q9HfXENK2AJ3A+E9x0IGILjIta/lJ3BdV4cgx09qwm+0bUf6gzCWWcKJGP7O0aqd+8Sq+ug7Wy/6tIXweA3CrNIyQ6dRq72lhFOfofs8N2FgrxoCWN4f17h5FKRWyAfdBmgCx6zvQ1bD3FzD7BVIQkN5CKYwlI87ClgB4sfRM/r3OtXicw/2bQhv3hnbDEXt73f2yp0PEPs9SgU6PW4lPab83PeB3B1hpND1XNa+RQ4wcrdWgsiXYXzO6XUK2dmMRiwUhrqjyLBrODslrAq0tuSK7wc5bkxVu8FP7hX8UVit/4MAQHSISfZ0yK+pEcZ4gskPr2Qbk1VXRtx4/j12Fhx/+AU2uJjsEZzUD+4y1X5GFABPW0sxZEv7vlGYBEMkWYxFSO0rWK2azBSRfy0zCFkF0ziHk4k+BURv/k0gY/u07S2Z5Xw6LNOVXx88COF5p/g X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17ccb9bd-c400-4845-adc6-08dcf8c90950 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:51.9672 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DNJp6U5V9iYkIwZG9jak5qDVXQ5Wfal+LuqfD6GO0ECfCWNmbP4OHFD0zNLcmbuCXWMw40ruD47wbkGz5n6SWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 The i.MX95 ENETC has been upgraded to revision 4.1, which is different from the LS1028A ENETC (revision 1.0) except for the SI part. Therefore, the fsl-enetc driver is incompatible with i.MX95 ENETC PF. So add new nxp-enetc4 driver to support i.MX95 ENETC PF, and this driver will be used to support the ENETC PF with major revision 4 for other SoCs in the future. Currently, the nxp-enetc4 driver only supports basic transmission feature for i.MX95 ENETC PF, the more basic and advanced features will be added in the subsequent patches. In addition, PCS support has not been added yet, so 10G ENETC (ENETC instance 2) is not supported now. Signed-off-by: Wei Fang Reviewed-by: Frank Li --- v6: 1. remove pinctrl_pm_select_default_state() 2. add macros to define the vendor ID and device ID of ENETC PF --- drivers/net/ethernet/freescale/enetc/Kconfig | 17 + drivers/net/ethernet/freescale/enetc/Makefile | 3 + drivers/net/ethernet/freescale/enetc/enetc.c | 86 +- drivers/net/ethernet/freescale/enetc/enetc.h | 30 +- .../net/ethernet/freescale/enetc/enetc4_hw.h | 155 ++++ .../net/ethernet/freescale/enetc/enetc4_pf.c | 756 ++++++++++++++++++ .../ethernet/freescale/enetc/enetc_ethtool.c | 35 +- .../net/ethernet/freescale/enetc/enetc_hw.h | 19 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 7 + .../net/ethernet/freescale/enetc/enetc_pf.h | 9 + .../freescale/enetc/enetc_pf_common.c | 11 +- .../freescale/enetc/enetc_pf_common.h | 5 + .../net/ethernet/freescale/enetc/enetc_qos.c | 2 +- .../net/ethernet/freescale/enetc/enetc_vf.c | 6 + 14 files changed, 1113 insertions(+), 28 deletions(-) create mode 100644 drivers/net/ethernet/freescale/enetc/enetc4_hw.h create mode 100644 drivers/net/ethernet/freescale/enetc/enetc4_pf.c diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/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 89d919c713df..4be7c767d1e9 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -3,6 +3,7 @@ #include "enetc.h" #include +#include #include #include #include @@ -21,7 +22,7 @@ void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val) { enetc_port_wr(&si->hw, reg, val); if (si->hw_features & ENETC_SI_F_QBU) - enetc_port_wr(&si->hw, reg + ENETC_PMAC_OFFSET, val); + enetc_port_wr(&si->hw, reg + si->drvdata->pmac_offset, val); } EXPORT_SYMBOL_GPL(enetc_port_mac_wr); @@ -700,8 +701,9 @@ static void enetc_rx_dim_work(struct work_struct *w) net_dim_get_rx_moderation(dim->mode, dim->profile_ix); struct enetc_int_vector *v = container_of(dim, struct enetc_int_vector, rx_dim); + struct enetc_ndev_priv *priv = netdev_priv(v->rx_ring.ndev); - v->rx_ictt = enetc_usecs_to_cycles(moder.usec); + v->rx_ictt = enetc_usecs_to_cycles(moder.usec, priv->sysclk_freq); dim->state = DIM_START_MEASURE; } @@ -1736,9 +1738,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); @@ -2066,7 +2074,10 @@ int enetc_configure_si(struct enetc_ndev_priv *priv) /* enable SI */ enetc_wr(hw, ENETC_SIMR, ENETC_SIMR_EN); - if (si->num_rss) { + /* TODO: RSS support for i.MX95 will be supported later, and the + * is_enetc_rev1() condition will be removed + */ + if (si->num_rss && is_enetc_rev1(si)) { err = enetc_setup_default_rss_table(si, priv->num_rx_rings); if (err) return err; @@ -2090,9 +2101,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); @@ -2501,10 +2512,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; @@ -2536,6 +2551,8 @@ int enetc_open(struct net_device *ndev) phylink_disconnect_phy(priv->phylink); err_phy_connect: enetc_free_irqs(priv); +err_setup_irqs: + clk_disable_unprepare(priv->ref_clk); return err; } @@ -2589,6 +2606,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; } @@ -3254,5 +3272,55 @@ void enetc_pci_remove(struct pci_dev *pdev) } EXPORT_SYMBOL_GPL(enetc_pci_remove); +static const struct enetc_drvdata enetc_pf_data = { + .sysclk_freq = ENETC_CLK_400M, + .pmac_offset = ENETC_PMAC_OFFSET, + .eth_ops = &enetc_pf_ethtool_ops, +}; + +static const struct enetc_drvdata enetc4_pf_data = { + .sysclk_freq = ENETC_CLK_333M, + .pmac_offset = ENETC4_PMAC_OFFSET, + .eth_ops = &enetc4_pf_ethtool_ops, +}; + +static const struct enetc_drvdata enetc_vf_data = { + .sysclk_freq = ENETC_CLK_400M, + .eth_ops = &enetc_vf_ethtool_ops, +}; + +static const struct enetc_platform_info enetc_info[] = { + { .revision = ENETC_REV_1_0, + .dev_id = ENETC_DEV_ID_PF, + .data = &enetc_pf_data, + }, + { .revision = ENETC_REV_4_1, + .dev_id = NXP_ENETC_PF_DEV_ID, + .data = &enetc4_pf_data, + }, + { .revision = ENETC_REV_1_0, + .dev_id = ENETC_DEV_ID_VF, + .data = &enetc_vf_data, + }, +}; + +int enetc_get_driver_data(struct enetc_si *si) +{ + u16 dev_id = si->pdev->device; + int i; + + for (i = 0; i < ARRAY_SIZE(enetc_info); i++) { + if (si->revision == enetc_info[i].revision && + dev_id == enetc_info[i].dev_id) { + si->drvdata = enetc_info[i].data; + + return 0; + } + } + + return -ERANGE; +} +EXPORT_SYMBOL_GPL(enetc_get_driver_data); + MODULE_DESCRIPTION("NXP ENETC Ethernet driver"); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index fb7d98d57783..72fa03dbc2dd 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -14,6 +14,7 @@ #include #include "enetc_hw.h" +#include "enetc4_hw.h" #define ENETC_MAC_MAXFRM_SIZE 9600 #define ENETC_MAX_MTU (ENETC_MAC_MAXFRM_SIZE - \ @@ -231,6 +232,18 @@ enum enetc_errata { #define ENETC_SI_F_QBV BIT(1) #define ENETC_SI_F_QBU BIT(2) +struct enetc_drvdata { + u32 pmac_offset; /* Only valid for PSI which supports 802.1Qbu */ + u64 sysclk_freq; + const struct ethtool_ops *eth_ops; +}; + +struct enetc_platform_info { + u16 revision; + u16 dev_id; + const struct enetc_drvdata *data; +}; + /* PCI IEP device data */ struct enetc_si { struct pci_dev *pdev; @@ -246,11 +259,18 @@ struct enetc_si { int num_fs_entries; int num_rss; /* number of RSS buckets */ unsigned short pad; + u16 revision; int hw_features; + const struct enetc_drvdata *drvdata; }; #define ENETC_SI_ALIGN 32 +static inline bool is_enetc_rev1(struct enetc_si *si) +{ + return si->pdev->revision == ENETC_REV1; +} + static inline void *enetc_si_priv(const struct enetc_si *si) { return (char *)si + ALIGN(sizeof(struct enetc_si), ENETC_SI_ALIGN); @@ -302,7 +322,7 @@ struct enetc_cls_rule { int used; }; -#define ENETC_MAX_BDR_INT 2 /* fixed to max # of available cpus */ +#define ENETC_MAX_BDR_INT 6 /* fixed to max # of available cpus */ struct psfp_cap { u32 max_streamid; u32 max_psfp_filter; @@ -341,7 +361,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; @@ -389,6 +408,9 @@ struct enetc_ndev_priv { * and link state updates */ struct mutex mm_lock; + + struct clk *ref_clk; /* RGMII/RMII reference clock */ + u64 sysclk_freq; /* NETC system clock frequency */ }; /* Messaging */ @@ -418,6 +440,7 @@ void enetc_init_si_rings_params(struct enetc_ndev_priv *priv); int enetc_alloc_si_resources(struct enetc_ndev_priv *priv); void enetc_free_si_resources(struct enetc_ndev_priv *priv); int enetc_configure_si(struct enetc_ndev_priv *priv); +int enetc_get_driver_data(struct enetc_si *si); int enetc_open(struct net_device *ndev); int enetc_close(struct net_device *ndev); @@ -434,6 +457,9 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames, struct xdp_frame **frames, u32 flags); /* ethtool */ +extern const struct ethtool_ops enetc_pf_ethtool_ops; +extern const struct ethtool_ops enetc4_pf_ethtool_ops; +extern const struct ethtool_ops enetc_vf_ethtool_ops; void enetc_set_ethtool_ops(struct net_device *ndev); void enetc_mm_link_state_update(struct enetc_ndev_priv *priv, bool link); void enetc_mm_commit_preemptible_tcs(struct enetc_ndev_priv *priv); diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h new file mode 100644 index 000000000000..26b220677448 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h @@ -0,0 +1,155 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* + * This header file defines the register offsets and bit fields + * of ENETC4 PF and VFs. Note that the same registers as ENETC + * version 1.0 are defined in the enetc_hw.h file. + * + * Copyright 2024 NXP + */ +#ifndef __ENETC4_HW_H_ +#define __ENETC4_HW_H_ + +#define NXP_ENETC_VENDOR_ID 0x1131 +#define NXP_ENETC_PF_DEV_ID 0xe101 + +/***************************ENETC port registers**************************/ +#define ENETC4_ECAPR0 0x0 +#define ECAPR0_RFS BIT(2) +#define ECAPR0_TSD BIT(5) +#define ECAPR0_RSS BIT(8) +#define ECAPR0_RSC BIT(9) +#define ECAPR0_LSO BIT(10) +#define ECAPR0_WO BIT(13) + +#define ENETC4_ECAPR1 0x4 +#define ECAPR1_NUM_TCS GENMASK(6, 4) +#define ECAPR1_NUM_MCH GENMASK(9, 8) +#define ECAPR1_NUM_UCH GENMASK(11, 10) +#define ECAPR1_NUM_MSIX GENMASK(22, 12) +#define ECAPR1_NUM_VSI GENMASK(27, 24) +#define ECAPR1_NUM_IPV BIT(31) + +#define ENETC4_ECAPR2 0x8 +#define ECAPR2_NUM_TX_BDR GENMASK(9, 0) +#define ECAPR2_NUM_RX_BDR GENMASK(25, 16) + +#define ENETC4_PMR 0x10 +#define PMR_SI_EN(a) BIT((16 + (a))) + +/* Port Pause ON/OFF threshold register */ +#define ENETC4_PPAUONTR 0x108 +#define ENETC4_PPAUOFFTR 0x10c + +/* Port Station interface promiscuous MAC mode register */ +#define ENETC4_PSIPMMR 0x200 +#define PSIPMMR_SI_MAC_UP(a) BIT(a) /* a = SI index */ +#define PSIPMMR_SI_MAC_MP(a) BIT((a) + 16) + +/* Port Station interface promiscuous VLAN mode register */ +#define ENETC4_PSIPVMR 0x204 + +/* Port RSS key register n. n = 0,1,2,...,9 */ +#define ENETC4_PRSSKR(n) ((n) * 0x4 + 0x250) + +/* Port station interface MAC address filtering capability register */ +#define ENETC4_PSIMAFCAPR 0x280 +#define PSIMAFCAPR_NUM_MAC_AFTE GENMASK(11, 0) + +/* Port station interface VLAN filtering capability register */ +#define ENETC4_PSIVLANFCAPR 0x2c0 +#define PSIVLANFCAPR_NUM_VLAN_FTE GENMASK(11, 0) + +/* Port station interface VLAN filtering mode register */ +#define ENETC4_PSIVLANFMR 0x2c4 +#define PSIVLANFMR_VS BIT(0) + +/* Port Station interface a primary MAC address registers */ +#define ENETC4_PSIPMAR0(a) ((a) * 0x80 + 0x2000) +#define ENETC4_PSIPMAR1(a) ((a) * 0x80 + 0x2004) + +/* Port station interface a configuration register 0/2 */ +#define ENETC4_PSICFGR0(a) ((a) * 0x80 + 0x2010) +#define PSICFGR0_VASE BIT(13) +#define PSICFGR0_ASE BIT(15) +#define PSICFGR0_ANTI_SPOOFING (PSICFGR0_VASE | PSICFGR0_ASE) + +#define ENETC4_PSICFGR2(a) ((a) * 0x80 + 0x2018) +#define PSICFGR2_NUM_MSIX GENMASK(5, 0) + +#define ENETC4_PMCAPR 0x4004 +#define PMCAPR_HD BIT(8) +#define PMCAPR_FP GENMASK(10, 9) + +/* Port configuration register */ +#define ENETC4_PCR 0x4010 +#define PCR_HDR_FMT BIT(0) +#define PCR_L2DOSE BIT(4) +#define PCR_TIMER_CS BIT(8) +#define PCR_PSPEED GENMASK(29, 16) +#define PCR_PSPEED_VAL(speed) (((speed) / 10 - 1) << 16) + +/* Port MAC address register 0/1 */ +#define ENETC4_PMAR0 0x4020 +#define ENETC4_PMAR1 0x4024 + +/* Port operational register */ +#define ENETC4_POR 0x4100 + +/* Port traffic class a transmit maximum SDU register */ +#define ENETC4_PTCTMSDUR(a) ((a) * 0x20 + 0x4208) +#define PTCTMSDUR_MAXSDU GENMASK(15, 0) +#define PTCTMSDUR_SDU_TYPE GENMASK(17, 16) +#define SDU_TYPE_PPDU 0 +#define SDU_TYPE_MPDU 1 +#define SDU_TYPE_MSDU 2 + +#define ENETC4_PMAC_OFFSET 0x400 +#define ENETC4_PM_CMD_CFG(mac) (0x5008 + (mac) * 0x400) +#define PM_CMD_CFG_TX_EN BIT(0) +#define PM_CMD_CFG_RX_EN BIT(1) +#define PM_CMD_CFG_PAUSE_FWD BIT(7) +#define PM_CMD_CFG_PAUSE_IGN BIT(8) +#define PM_CMD_CFG_TX_ADDR_INS BIT(9) +#define PM_CMD_CFG_LOOP_EN BIT(10) +#define PM_CMD_CFG_LPBK_MODE GENMASK(12, 11) +#define LPBCK_MODE_EXT_TX_CLK 0 +#define LPBCK_MODE_MAC_LEVEL 1 +#define LPBCK_MODE_INT_TX_CLK 2 +#define PM_CMD_CFG_CNT_FRM_EN BIT(13) +#define PM_CMD_CFG_TXP BIT(15) +#define PM_CMD_CFG_SEND_IDLE BIT(16) +#define PM_CMD_CFG_HD_FCEN BIT(18) +#define PM_CMD_CFG_SFD BIT(21) +#define PM_CMD_CFG_TX_FLUSH BIT(22) +#define PM_CMD_CFG_TX_LOWP_EN BIT(23) +#define PM_CMD_CFG_RX_LOWP_EMPTY BIT(24) +#define PM_CMD_CFG_SWR BIT(26) +#define PM_CMD_CFG_TS_MODE BIT(30) +#define PM_CMD_CFG_MG BIT(31) + +/* Port MAC 0/1 Maximum Frame Length Register */ +#define ENETC4_PM_MAXFRM(mac) (0x5014 + (mac) * 0x400) + +/* Port MAC 0/1 Pause Quanta Register */ +#define ENETC4_PM_PAUSE_QUANTA(mac) (0x5054 + (mac) * 0x400) + +/* Port MAC 0/1 Pause Quanta Threshold Register */ +#define ENETC4_PM_PAUSE_THRESH(mac) (0x5064 + (mac) * 0x400) + +/* Port MAC 0 Interface Mode Control Register */ +#define ENETC4_PM_IF_MODE(mac) (0x5300 + (mac) * 0x400) +#define PM_IF_MODE_IFMODE GENMASK(2, 0) +#define IFMODE_XGMII 0 +#define IFMODE_RMII 3 +#define IFMODE_RGMII 4 +#define IFMODE_SGMII 5 +#define PM_IF_MODE_REVMII BIT(3) +#define PM_IF_MODE_M10 BIT(4) +#define PM_IF_MODE_HD BIT(6) +#define PM_IF_MODE_SSP GENMASK(14, 13) +#define SSP_100M 0 +#define SSP_10M 1 +#define SSP_1G 2 +#define PM_IF_MODE_ENA BIT(15) + +#endif diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c new file mode 100644 index 000000000000..31dbe89dd3a9 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c @@ -0,0 +1,756 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2024 NXP */ + +#include +#include +#include +#include +#include + +#include "enetc_pf_common.h" + +#define ENETC_SI_MAX_RING_NUM 8 + +static void enetc4_get_port_caps(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &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); + pf->ops = &enetc4_pf_ops; + + enetc4_get_port_caps(pf); + + 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 promiscuous mode for all SIs */ + for (i = 0; i < num_si; i++) + enetc4_pf_set_si_vlan_promisc(hw, i, true); +} + +/* Allocate the number of MSI-X vectors for per SI. */ +static void enetc4_set_si_msix_num(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + int i, num_msix, total_si; + u32 val; + + total_si = pf->caps.num_vsi + 1; + + num_msix = pf->caps.num_msix / total_si + + pf->caps.num_msix % total_si - 1; + val = num_msix & PSICFGR2_NUM_MSIX; + enetc_port_wr(hw, ENETC4_PSICFGR2(0), val); + + num_msix = pf->caps.num_msix / total_si - 1; + val = num_msix & PSICFGR2_NUM_MSIX; + for (i = 0; i < pf->caps.num_vsi; i++) + enetc_port_wr(hw, ENETC4_PSICFGR2(i + 1), val); +} + +static void enetc4_enable_all_si(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + int num_si = pf->caps.num_vsi + 1; + u32 si_bitmap = 0; + int i; + + /* Master enable for all SIs */ + for (i = 0; i < num_si; i++) + si_bitmap |= PMR_SI_EN(i); + + enetc_port_wr(hw, ENETC4_PMR, si_bitmap); +} + +static void enetc4_configure_port_si(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + + enetc4_allocate_si_rings(pf); + + /* Outer VLAN tag will be used for VLAN filtering */ + enetc_port_wr(hw, ENETC4_PSIVLANFMR, PSIVLANFMR_VS); + + enetc4_set_default_si_vlan_promisc(pf); + + /* Disable SI MAC multicast & unicast promiscuous */ + enetc_port_wr(hw, ENETC4_PSIPMMR, 0); + + enetc4_set_si_msix_num(pf); + + enetc4_enable_all_si(pf); +} + +static void enetc4_pf_reset_tc_msdu(struct enetc_hw *hw) +{ + u32 val = ENETC_MAC_MAXFRM_SIZE; + int tc; + + val = u32_replace_bits(val, SDU_TYPE_MPDU, PTCTMSDUR_SDU_TYPE); + + for (tc = 0; tc < ENETC_NUM_TC; tc++) + enetc_port_wr(hw, ENETC4_PTCTMSDUR(tc), val); +} + +static void enetc4_set_trx_frame_size(struct enetc_pf *pf) +{ + struct enetc_si *si = pf->si; + + enetc_port_mac_wr(si, ENETC4_PM_MAXFRM(0), + ENETC_SET_MAXFRM(ENETC_MAC_MAXFRM_SIZE)); + + enetc4_pf_reset_tc_msdu(&si->hw); +} + +static void enetc4_set_rss_key(struct enetc_hw *hw, const u8 *bytes) +{ + int i; + + for (i = 0; i < ENETC_RSSHASH_KEY_SIZE / 4; i++) + enetc_port_wr(hw, ENETC4_PRSSKR(i), ((u32 *)bytes)[i]); +} + +static void enetc4_set_default_rss_key(struct enetc_pf *pf) +{ + u8 hash_key[ENETC_RSSHASH_KEY_SIZE] = {0}; + struct enetc_hw *hw = &pf->si->hw; + + /* set up hash key */ + get_random_bytes(hash_key, ENETC_RSSHASH_KEY_SIZE); + enetc4_set_rss_key(hw, hash_key); +} + +static void enetc4_enable_trx(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + + /* Enable port transmit/receive */ + enetc_port_wr(hw, ENETC4_POR, 0); +} + +static void enetc4_configure_port(struct enetc_pf *pf) +{ + enetc4_configure_port_si(pf); + enetc4_set_trx_frame_size(pf); + enetc4_set_default_rss_key(pf); + enetc4_enable_trx(pf); +} + +static int enetc4_pf_init(struct enetc_pf *pf) +{ + struct device *dev = &pf->si->pdev->dev; + int err; + + /* Initialize the MAC address for PF and VFs */ + err = enetc_setup_mac_addresses(dev->of_node, pf); + if (err) { + dev_err(dev, "Failed to set MAC addresses\n"); + return err; + } + + enetc4_configure_port(pf); + + return 0; +} + +static const struct net_device_ops enetc4_ndev_ops = { + .ndo_open = enetc_open, + .ndo_stop = enetc_close, + .ndo_start_xmit = enetc_xmit, + .ndo_get_stats = enetc_get_stats, + .ndo_set_mac_address = enetc_pf_set_mac_addr, +}; + +static struct phylink_pcs * +enetc4_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t iface) +{ + struct enetc_pf *pf = phylink_to_enetc_pf(config); + + return pf->pcs; +} + +static void enetc4_mac_config(struct enetc_pf *pf, unsigned int mode, + phy_interface_t phy_mode) +{ + struct enetc_ndev_priv *priv = netdev_priv(pf->si->ndev); + struct enetc_si *si = pf->si; + u32 val; + + val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val &= ~(PM_IF_MODE_IFMODE | PM_IF_MODE_ENA); + + switch (phy_mode) { + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + val |= IFMODE_RGMII; + /* We need to enable auto-negotiation for the MAC + * if its RGMII interface support In-Band status. + */ + if (phylink_autoneg_inband(mode)) + val |= PM_IF_MODE_ENA; + break; + case PHY_INTERFACE_MODE_RMII: + val |= IFMODE_RMII; + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_2500BASEX: + val |= IFMODE_SGMII; + break; + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_USXGMII: + val |= IFMODE_XGMII; + break; + default: + dev_err(priv->dev, + "Unsupported PHY mode:%d\n", phy_mode); + return; + } + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_pl_mac_config(struct phylink_config *config, unsigned int mode, + const struct phylink_link_state *state) +{ + struct enetc_pf *pf = phylink_to_enetc_pf(config); + + enetc4_mac_config(pf, mode, state->interface); +} + +static void enetc4_set_port_speed(struct enetc_ndev_priv *priv, int speed) +{ + u32 old_speed = priv->speed; + u32 val; + + if (speed == old_speed) + return; + + val = enetc_port_rd(&priv->si->hw, ENETC4_PCR); + val &= ~PCR_PSPEED; + + switch (speed) { + case SPEED_100: + case SPEED_1000: + case SPEED_2500: + case SPEED_10000: + val |= (PCR_PSPEED & PCR_PSPEED_VAL(speed)); + break; + case SPEED_10: + default: + val |= (PCR_PSPEED & PCR_PSPEED_VAL(SPEED_10)); + } + + priv->speed = speed; + enetc_port_wr(&priv->si->hw, ENETC4_PCR, val); +} + +static void enetc4_set_rgmii_mac(struct enetc_pf *pf, int speed, int duplex) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val = old_val & ~(PM_IF_MODE_ENA | PM_IF_MODE_M10 | PM_IF_MODE_REVMII); + + switch (speed) { + case SPEED_1000: + val = u32_replace_bits(val, SSP_1G, PM_IF_MODE_SSP); + break; + case SPEED_100: + val = u32_replace_bits(val, SSP_100M, PM_IF_MODE_SSP); + break; + case SPEED_10: + val = u32_replace_bits(val, SSP_10M, PM_IF_MODE_SSP); + } + + val = u32_replace_bits(val, duplex == DUPLEX_FULL ? 0 : 1, + PM_IF_MODE_HD); + + if (val == old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_set_rmii_mac(struct enetc_pf *pf, int speed, int duplex) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val = old_val & ~(PM_IF_MODE_ENA | PM_IF_MODE_SSP); + + switch (speed) { + case SPEED_100: + val &= ~PM_IF_MODE_M10; + break; + case SPEED_10: + val |= PM_IF_MODE_M10; + } + + val = u32_replace_bits(val, duplex == DUPLEX_FULL ? 0 : 1, + PM_IF_MODE_HD); + + if (val == old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_set_hd_flow_control(struct enetc_pf *pf, bool enable) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + if (!pf->caps.half_duplex) + return; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val = u32_replace_bits(old_val, enable ? 1 : 0, PM_CMD_CFG_HD_FCEN); + if (val == old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_set_rx_pause(struct enetc_pf *pf, bool rx_pause) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val = u32_replace_bits(old_val, rx_pause ? 0 : 1, PM_CMD_CFG_PAUSE_IGN); + if (val == old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_set_tx_pause(struct enetc_pf *pf, int num_rxbdr, bool tx_pause) +{ + u32 pause_off_thresh = 0, pause_on_thresh = 0; + u32 init_quanta = 0, refresh_quanta = 0; + struct enetc_hw *hw = &pf->si->hw; + u32 rbmr, old_rbmr; + int i; + + for (i = 0; i < num_rxbdr; i++) { + old_rbmr = enetc_rxbdr_rd(hw, i, ENETC_RBMR); + rbmr = u32_replace_bits(old_rbmr, tx_pause ? 1 : 0, ENETC_RBMR_CM); + if (rbmr == old_rbmr) + continue; + + enetc_rxbdr_wr(hw, i, ENETC_RBMR, rbmr); + } + + if (tx_pause) { + /* When the port first enters congestion, send a PAUSE request + * with the maximum number of quanta. When the port exits + * congestion, it will automatically send a PAUSE frame with + * zero quanta. + */ + init_quanta = 0xffff; + + /* Also, set up the refresh timer to send follow-up PAUSE + * frames at half the quanta value, in case the congestion + * condition persists. + */ + refresh_quanta = 0xffff / 2; + + /* Start emitting PAUSE frames when 3 large frames (or more + * smaller frames) have accumulated in the FIFO waiting to be + * DMAed to the RX ring. + */ + pause_on_thresh = 3 * ENETC_MAC_MAXFRM_SIZE; + pause_off_thresh = 1 * ENETC_MAC_MAXFRM_SIZE; + } + + enetc_port_mac_wr(pf->si, ENETC4_PM_PAUSE_QUANTA(0), init_quanta); + enetc_port_mac_wr(pf->si, ENETC4_PM_PAUSE_THRESH(0), refresh_quanta); + enetc_port_wr(hw, ENETC4_PPAUONTR, pause_on_thresh); + enetc_port_wr(hw, ENETC4_PPAUOFFTR, pause_off_thresh); +} + +static void enetc4_enable_mac(struct enetc_pf *pf, bool en) +{ + struct enetc_si *si = pf->si; + u32 val; + + val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val &= ~(PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN); + val |= en ? (PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN) : 0; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_pl_mac_link_up(struct phylink_config *config, + struct phy_device *phy, unsigned int mode, + phy_interface_t interface, int speed, + int duplex, bool tx_pause, bool rx_pause) +{ + struct enetc_pf *pf = phylink_to_enetc_pf(config); + struct enetc_si *si = pf->si; + struct enetc_ndev_priv *priv; + bool hd_fc = false; + + priv = netdev_priv(si->ndev); + enetc4_set_port_speed(priv, speed); + + if (!phylink_autoneg_inband(mode) && + phy_interface_mode_is_rgmii(interface)) + enetc4_set_rgmii_mac(pf, speed, duplex); + + if (interface == PHY_INTERFACE_MODE_RMII) + enetc4_set_rmii_mac(pf, speed, duplex); + + if (duplex == DUPLEX_FULL) { + /* When preemption is enabled, generation of PAUSE frames + * must be disabled, as stated in the IEEE 802.3 standard. + */ + if (priv->active_offloads & ENETC_F_QBU) + tx_pause = false; + } else { /* DUPLEX_HALF */ + if (tx_pause || rx_pause) + hd_fc = true; + + /* As per 802.3 annex 31B, PAUSE frames are only supported + * when the link is configured for full duplex operation. + */ + tx_pause = false; + rx_pause = false; + } + + enetc4_set_hd_flow_control(pf, hd_fc); + enetc4_set_tx_pause(pf, priv->num_rx_rings, tx_pause); + enetc4_set_rx_pause(pf, rx_pause); + enetc4_enable_mac(pf, true); +} + +static void enetc4_pl_mac_link_down(struct phylink_config *config, + unsigned int mode, + phy_interface_t interface) +{ + struct enetc_pf *pf = phylink_to_enetc_pf(config); + + enetc4_enable_mac(pf, false); +} + +static const struct phylink_mac_ops enetc_pl_mac_ops = { + .mac_select_pcs = enetc4_pl_mac_select_pcs, + .mac_config = enetc4_pl_mac_config, + .mac_link_up = enetc4_pl_mac_link_up, + .mac_link_down = enetc4_pl_mac_link_down, +}; + +static void enetc4_pci_remove(void *data) +{ + struct pci_dev *pdev = data; + + enetc_pci_remove(pdev); +} + +static int enetc4_link_init(struct enetc_ndev_priv *priv, + struct device_node *node) +{ + struct enetc_pf *pf = enetc_si_priv(priv->si); + struct device *dev = priv->dev; + int err; + + err = of_get_phy_mode(node, &pf->if_mode); + if (err) { + dev_err(dev, "Failed to get PHY mode\n"); + return err; + } + + err = enetc_mdiobus_create(pf, node); + if (err) { + dev_err(dev, "Failed to create MDIO bus\n"); + return err; + } + + err = enetc_phylink_create(priv, node, &enetc_pl_mac_ops); + if (err) { + dev_err(dev, "Failed to create phylink\n"); + goto err_phylink_create; + } + + return 0; + +err_phylink_create: + enetc_mdiobus_destroy(pf); + + return err; +} + +static void enetc4_link_deinit(struct enetc_ndev_priv *priv) +{ + struct enetc_pf *pf = enetc_si_priv(priv->si); + + enetc_phylink_destroy(priv); + enetc_mdiobus_destroy(pf); +} + +static int enetc4_pf_netdev_create(struct enetc_si *si) +{ + struct device *dev = &si->pdev->dev; + struct enetc_ndev_priv *priv; + struct net_device *ndev; + int err; + + ndev = alloc_etherdev_mqs(sizeof(struct enetc_ndev_priv), + si->num_tx_rings, si->num_rx_rings); + if (!ndev) + return -ENOMEM; + + priv = netdev_priv(ndev); + priv->ref_clk = devm_clk_get_optional(dev, "ref"); + if (IS_ERR(priv->ref_clk)) { + dev_err(dev, "Get referencce clock failed\n"); + err = PTR_ERR(priv->ref_clk); + goto err_clk_get; + } + + enetc_pf_netdev_setup(si, ndev, &enetc4_ndev_ops); + + enetc_init_si_rings_params(priv); + + err = enetc_configure_si(priv); + if (err) { + dev_err(dev, "Failed to configure SI\n"); + goto err_config_si; + } + + err = enetc_alloc_msix(priv); + if (err) { + dev_err(dev, "Failed to alloc MSI-X\n"); + goto err_alloc_msix; + } + + err = enetc4_link_init(priv, dev->of_node); + if (err) + goto err_link_init; + + err = register_netdev(ndev); + if (err) { + dev_err(dev, "Failed to register netdev\n"); + goto err_reg_netdev; + } + + return 0; + +err_reg_netdev: + enetc4_link_deinit(priv); +err_link_init: + enetc_free_msix(priv); +err_alloc_msix: +err_config_si: +err_clk_get: + mutex_destroy(&priv->mm_lock); + free_netdev(ndev); + + return err; +} + +static void enetc4_pf_netdev_destroy(struct enetc_si *si) +{ + struct enetc_ndev_priv *priv = netdev_priv(si->ndev); + struct net_device *ndev = si->ndev; + + unregister_netdev(ndev); + enetc_free_msix(priv); + free_netdev(ndev); +} + +static int enetc4_pf_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + struct device *dev = &pdev->dev; + struct enetc_si *si; + struct enetc_pf *pf; + int err; + + err = enetc_pci_probe(pdev, KBUILD_MODNAME, sizeof(*pf)); + if (err) + return dev_err_probe(dev, err, "PCIe probing failed\n"); + + err = devm_add_action_or_reset(dev, enetc4_pci_remove, pdev); + if (err) + return dev_err_probe(dev, err, + "Add enetc4_pci_remove() action failed\n"); + + /* si is the private data. */ + si = pci_get_drvdata(pdev); + if (!si->hw.port || !si->hw.global) + return dev_err_probe(dev, -ENODEV, + "Couldn't map PF only space\n"); + + si->revision = enetc_get_ip_revision(&si->hw); + err = enetc_get_driver_data(si); + if (err) + return dev_err_probe(dev, err, + "Could not get VF driver data\n"); + + err = enetc4_pf_struct_init(si); + if (err) + return err; + + pf = enetc_si_priv(si); + err = enetc4_pf_init(pf); + if (err) + return err; + + 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(NXP_ENETC_VENDOR_ID, NXP_ENETC_PF_DEV_ID) }, + { 0, } /* End of table. */ +}; +MODULE_DEVICE_TABLE(pci, enetc4_pf_id_table); + +static struct pci_driver enetc4_pf_driver = { + .name = KBUILD_MODNAME, + .id_table = enetc4_pf_id_table, + .probe = enetc4_pf_probe, + .remove = enetc4_pf_remove, +}; +module_pci_driver(enetc4_pf_driver); + +MODULE_DESCRIPTION("ENETC4 PF Driver"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index 2563eb8ac7b6..4c223eb90c19 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -775,9 +775,10 @@ static int enetc_get_coalesce(struct net_device *ndev, { struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_int_vector *v = priv->int_vector[0]; + u64 clk_freq = priv->sysclk_freq; - ic->tx_coalesce_usecs = enetc_cycles_to_usecs(priv->tx_ictt); - ic->rx_coalesce_usecs = enetc_cycles_to_usecs(v->rx_ictt); + ic->tx_coalesce_usecs = enetc_cycles_to_usecs(priv->tx_ictt, clk_freq); + ic->rx_coalesce_usecs = enetc_cycles_to_usecs(v->rx_ictt, clk_freq); ic->tx_max_coalesced_frames = ENETC_TXIC_PKTTHR; ic->rx_max_coalesced_frames = ENETC_RXIC_PKTTHR; @@ -793,12 +794,13 @@ static int enetc_set_coalesce(struct net_device *ndev, struct netlink_ext_ack *extack) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + u64 clk_freq = priv->sysclk_freq; u32 rx_ictt, tx_ictt; int i, ic_mode; bool changed; - tx_ictt = enetc_usecs_to_cycles(ic->tx_coalesce_usecs); - rx_ictt = enetc_usecs_to_cycles(ic->rx_coalesce_usecs); + tx_ictt = enetc_usecs_to_cycles(ic->tx_coalesce_usecs, clk_freq); + rx_ictt = enetc_usecs_to_cycles(ic->rx_coalesce_usecs, clk_freq); if (ic->rx_max_coalesced_frames != ENETC_RXIC_PKTTHR) return -EOPNOTSUPP; @@ -1178,7 +1180,7 @@ void enetc_mm_link_state_update(struct enetc_ndev_priv *priv, bool link) } EXPORT_SYMBOL_GPL(enetc_mm_link_state_update); -static const struct ethtool_ops enetc_pf_ethtool_ops = { +const struct ethtool_ops enetc_pf_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, @@ -1213,7 +1215,7 @@ static const struct ethtool_ops enetc_pf_ethtool_ops = { .get_mm_stats = enetc_get_mm_stats, }; -static const struct ethtool_ops enetc_vf_ethtool_ops = { +const struct ethtool_ops enetc_vf_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, @@ -1234,13 +1236,26 @@ static const struct ethtool_ops enetc_vf_ethtool_ops = { .get_ts_info = enetc_get_ts_info, }; +const struct ethtool_ops enetc4_pf_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES | + ETHTOOL_COALESCE_USE_ADAPTIVE_RX, + .get_ringparam = enetc_get_ringparam, + .get_coalesce = enetc_get_coalesce, + .set_coalesce = enetc_set_coalesce, + .get_link_ksettings = enetc_get_link_ksettings, + .set_link_ksettings = enetc_set_link_ksettings, + .get_link = ethtool_op_get_link, + .get_wol = enetc_get_wol, + .set_wol = enetc_set_wol, + .get_pauseparam = enetc_get_pauseparam, + .set_pauseparam = enetc_set_pauseparam, +}; + void enetc_set_ethtool_ops(struct net_device *ndev) { struct enetc_ndev_priv *priv = netdev_priv(ndev); - if (enetc_si_is_pf(priv->si)) - ndev->ethtool_ops = &enetc_pf_ethtool_ops; - else - ndev->ethtool_ops = &enetc_vf_ethtool_ops; + ndev->ethtool_ops = priv->si->drvdata->eth_ops; } EXPORT_SYMBOL_GPL(enetc_set_ethtool_ops); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index 6a7b9b75d660..7c3285584f8a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -6,6 +6,8 @@ #define ENETC_MM_VERIFY_SLEEP_US USEC_PER_MSEC #define ENETC_MM_VERIFY_RETRIES 3 +#define ENETC_NUM_TC 8 + /* ENETC device IDs */ #define ENETC_DEV_ID_PF 0xe100 #define ENETC_DEV_ID_VF 0xef00 @@ -25,6 +27,7 @@ #define ENETC_SIPCAPR0_RSS BIT(8) #define ENETC_SIPCAPR0_QBV BIT(4) #define ENETC_SIPCAPR0_QBU BIT(3) +#define ENETC_SIPCAPR0_RFS BIT(2) #define ENETC_SIPCAPR1 0x24 #define ENETC_SITGTGR 0x30 #define ENETC_SIRBGCR 0x38 @@ -368,6 +371,10 @@ enum enetc_bdr_type {TX, RX}; /** Global regs, offset: 2_0000h */ #define ENETC_GLOBAL_BASE 0x20000 #define ENETC_G_EIPBRR0 0x0bf8 +#define EIPBRR0_REVISION GENMASK(15, 0) +#define ENETC_REV_1_0 0x0100 +#define ENETC_REV_4_1 0X0401 + #define ENETC_G_EIPBRR1 0x0bfc #define ENETC_G_EPFBLPR(n) (0xd00 + 4 * (n)) #define ENETC_G_EPFBLPR1_XGMII 0x80000000 @@ -971,15 +978,17 @@ struct enetc_cbd { u8 status_flags; }; -#define ENETC_CLK 400000000ULL -static inline u32 enetc_cycles_to_usecs(u32 cycles) +#define ENETC_CLK_400M 400000000ULL +#define ENETC_CLK_333M 333000000ULL + +static inline u32 enetc_cycles_to_usecs(u32 cycles, u64 clk_freq) { - return (u32)div_u64(cycles * 1000000ULL, ENETC_CLK); + return (u32)div_u64(cycles * 1000000ULL, clk_freq); } -static inline u32 enetc_usecs_to_cycles(u32 usecs) +static inline u32 enetc_usecs_to_cycles(u32 usecs, u64 clk_freq) { - return (u32)div_u64(usecs * ENETC_CLK, 1000000ULL); + return (u32)div_u64(usecs * clk_freq, 1000000ULL); } /* Port traffic class frame preemption register */ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 1ff9a7a3386c..a76ce41eb197 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -947,6 +947,13 @@ static struct enetc_si *enetc_psi_create(struct pci_dev *pdev) goto out_pci_remove; } + si->revision = enetc_get_ip_revision(&si->hw); + err = enetc_get_driver_data(si); + if (err) { + dev_err(&pdev->dev, "Could not get PF driver data\n"); + goto out_pci_remove; + } + err = enetc_setup_cbdr(&pdev->dev, &si->hw, ENETC_CBDR_DEFAULT_SIZE, &si->cbd_ring); if (err) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h index 53d20752aacf..a26a12863855 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -28,6 +28,14 @@ struct enetc_vf_state { enum enetc_vf_flags flags; }; +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 e95252e898ae..0eecfc833164 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -100,6 +100,7 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, si->ndev = ndev; priv->msg_enable = (NETIF_MSG_WOL << 1) - 1; + priv->sysclk_freq = si->drvdata->sysclk_freq; ndev->netdev_ops = ndev_ops; enetc_set_ethtool_ops(ndev); ndev->watchdog_timeo = 5 * HZ; @@ -116,10 +117,17 @@ void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->vlan_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; + ndev->priv_flags |= IFF_UNICAST_FLT; + + /* TODO: currently, i.MX95 ENETC driver does not support advanced features */ + if (!is_enetc_rev1(si)) { + ndev->hw_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK); + goto end; + } + if (si->num_rss) ndev->hw_features |= NETIF_F_RXHASH; - ndev->priv_flags |= IFF_UNICAST_FLT; ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | NETDEV_XDP_ACT_NDO_XMIT_SG; @@ -131,6 +139,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_pf_common.h b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h index 964d4f53806b..48f55ee743ad 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.h @@ -12,3 +12,8 @@ void enetc_mdiobus_destroy(struct enetc_pf *pf); int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node, const struct phylink_mac_ops *ops); void enetc_phylink_destroy(struct enetc_ndev_priv *priv); + +static inline u16 enetc_get_ip_revision(struct enetc_hw *hw) +{ + return enetc_global_rd(hw, ENETC_G_EIPBRR0) & EIPBRR0_REVISION; +} diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c index b65da49dd926..ccf86651455c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -336,7 +336,7 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) * * (enetClockFrequency / portTransmitRate) * 100 */ - hi_credit_reg = (u32)div_u64((ENETC_CLK * 100ULL) * hi_credit_bit, + hi_credit_reg = (u32)div_u64((priv->sysclk_freq * 100ULL) * hi_credit_bit, port_transmit_rate * 1000000ULL); enetc_port_wr(hw, ENETC_PTCCBSR1(tc), hi_credit_reg); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c index dfcaac302e24..31e630638090 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -128,6 +128,7 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev, si->ndev = ndev; priv->msg_enable = (NETIF_MSG_IFUP << 1) - 1; + priv->sysclk_freq = si->drvdata->sysclk_freq; ndev->netdev_ops = ndev_ops; enetc_set_ethtool_ops(ndev); ndev->watchdog_timeo = 5 * HZ; @@ -164,6 +165,11 @@ static int enetc_vf_probe(struct pci_dev *pdev, return dev_err_probe(&pdev->dev, err, "PCI probing failed\n"); si = pci_get_drvdata(pdev); + si->revision = ENETC_REV_1_0; + err = enetc_get_driver_data(si); + if (err) + return dev_err_probe(&pdev->dev, err, + "Could not get VF driver data\n"); enetc_get_si_caps(si); From patchwork Wed Oct 30 09:39: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: 13856222 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011012.outbound.protection.outlook.com [52.101.65.12]) (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 2DF091EBFFC for ; Wed, 30 Oct 2024 09:56:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282164; cv=fail; b=MLoIVMVjx/pQ1x05pzqqNls8+30lNCujpvWAqNC5h+JfbX2xz/gMD1bzX5JzfNezirIk5C9Chb2CJkKAmR5qVIc3J5iG/ahh3gxiwm6Wn37ZllPWj0vNzT6f6tysJYfXP6+QaUPIC+aKYyEyMbuk9//986LgbnIs4tlaBIH7eeM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730282164; c=relaxed/simple; bh=pHlT8jL2EyTWjidj+y7k0/9mI3y1CeEQQQSc8BjP0ck=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=i6a10lcwm6bJPMfcwZIfEabuuHWpoiFxpjEQqwdGmjt6pvf3lwn8vn+TZ7qDFwKjgcV7T/r6yYcKR71ifmFatfcpFAK+JmyKZ2GRMRwhlEJ34VrwAuj6ddevCWtag7C0168JuculW8cSWHttez9hc5TZbDE33neiMEZnWqvHx00= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=E14YCLMh; arc=fail smtp.client-ip=52.101.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="E14YCLMh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xyA/h//pnSPS22jIIbKC7DHy8/+o/J4bd5H2Qfo94N2FMxofWotuGXx2X6H/zP5aCvK4GiPnSLbEYdEkxnrIiw1HQq8VQimVRJxAHmclL+PRIrextcSA56PO7BT/1rDV7YIJoeP9cv+g155SzSa0BFBIdZwAK6w13Eh9A3yt1jaLbaH4vy9rNF0nos1d/p5Eebw7kFB+DrQyhttH7Hau9YapqmM7bNTCVXzEpxoe4Kj4wOIbeCxZnYCH2uy33rw17+McPIpUiHN9LTQ+KxmRZsv1Evx/CeYLBBpFH7AP4f7mcpGWPUkzWs4WZ752jMdxEWeCvlWlrbesBJsEvGLVcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7N44tyZPXUffv7eRlDVOVgDDUU4G9aDUtWTZGXJ5L9c=; b=pC/gn7yKlzB4sL5IAzvuziToPSKeZw2pg0JmzVfNpkRRF620WTH7oQoOLqBdKfAq4RXhgN4v46Lovtkd9NT9QVtJWlEEUfXEO612k/NxyT/SHal+Brg8nNDYhZ3S5qf0qvr4jlKMi6MqKuoCgh5whrFQgK3v8Y54ktW9+4sfXBPWY+qJPo+xv/QRZMsrgyUTqo0Zu1lrvODMO6uS7D3XZpSm7Tp/jwXZlVUBkOPSK3fRgB4t24zP1RDUBUCVmN3gby1HbP1pTocwLsqH+achLqpsER9apJgS8sQsVjF+Xl6XvjhQgbRjNxe805hrT+hr4lPoRxn1Ev+cHzXao7rPjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7N44tyZPXUffv7eRlDVOVgDDUU4G9aDUtWTZGXJ5L9c=; b=E14YCLMhE61EwRAqG/e/06Lsh87GVhrU696PEfY7eNM9tUAMkH/iWnzCPYSxVETd08pWubsaFyfDyD87Cdp5d1CUX5d36oAQJuWZUWA3SpiojIYo8sA+B3msIvrKp/FqnYXBl6+wggl55J1ptASjSE9HA578wmqjXUmhPi7aoJU7uEOvziwBOX+OouKfRnMUAcHY3/rfeat9uCNMO2Xlwy40NzvmVzXTxQZLZbyLdE0FtuarIFBG3V34mc+wDat2h3RAiv6t98KU/f1FIQsSP5gB2jevhWG1fM4vVbGRiKDs7BKDZTXZ3wbhVuSR+AcdqIEnFa4wYCVwWufuGV9SYw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by PAXPR04MB8912.eurprd04.prod.outlook.com (2603:10a6:102:20f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 09:55:58 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 09:55:58 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, alexander.stein@ew.tq-group.com Subject: [PATCH v6 net-next 12/12] MAINTAINERS: update ENETC driver files and maintainers Date: Wed, 30 Oct 2024 17:39:23 +0800 Message-Id: <20241030093924.1251343-13-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241030093924.1251343-1-wei.fang@nxp.com> References: <20241030093924.1251343-1-wei.fang@nxp.com> X-ClientProxiedBy: SG3P274CA0009.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::21) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAXPR04MB8912:EE_ X-MS-Office365-Filtering-Correlation-Id: 111cdbc1-55db-4fb6-9a78-08dcf8c90d92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: drK8iwBUfLoqCyKaa/yE7wjj4LbFvLaUinxWbuJ3OOtrMFC1Fyju1lwsB4FQ6qHiFvWtYwaN7QfHc01pUU4TR5C4pYYK8+tCsSea5oQkrs702JyS5buFLUzTCgbHlzB8EthceC4RGfumJ83JSvcLR1FJli+IdguOipeB7fmnPxm9gXo6Jvi9nfsS3ifKEP1vEOk6oGqjDgLDfa3daLIkDuZRaFxzRXIN2he47oIPYfWASytoB0/BZFLuBK/AMe9xciKs2O0q4mAhLbIfpI2Vr+IAZVRE1R+gow6TE3xWXGfHhzux1HDXZ0OsFWKwFBUpTVuUhA/QLZogdgCHjcblQniuNbDd3S8oE9i60R+yigf44oL4HdFDXCq7JUCzdcAzZELi/9g0XO9LxfEaJl85WemlBKuirbj/vybCQfKXwtSF5RqWAsT+ziYXc7FSKaXKxuiAaGZrgK6KQHr1/0u+9AdDwHOETaNMGvuwfyaMN9VtO8lT8axwD7WLSZoLhj55rcPjKW5VOJ5S9IAw/2ptpPwXmmMp4oJUfBme09txnh4ii0Nj+3RUYoSZd9Hgv96tPt1YEwv+t7SylJacg/p4nQfvufSUbhI9KBd1mQ9/+Nsy44rJkjwzEdxk/CRAeBUV55BX/C3+5BbYF8nWdFshwvcMZKHAocTJI+ih+L/r9oVJlH08NKxVb1ut4nbHuGwL0xvRH/BTtZwy4sbatWVFQQ0IdJAUCuX7TMGLGNqnqYJBID8HMqNJEclNR8uZ6BvJi7qRHMJekKI8zh5q59fj0HtjYxm2H4Xf9A/EEhdgxsK4m4iYeJWrxnnWPn7c0bi7Y4EdUtM6WoNArPS0dvWSQ/QZ/iA0h9G6xKR5iy/oMCZXG9uOZiOh9ROLnDU8Rbfl7Hq49kQVlDvXS9mvWKUCDcj3yXZtCMTj8XU68br/WX3u3pnH39vvZ0cFLqntaTmjR8zZyGL9FycV3IIJ26YsD20clhPIWkjomokjMuQ5ULj/ysg0RIeOuo6CdPO+2WR4/wK0Vb5wrAww6HD1vQNXvBhlGDVVuMTXPCHzr5tr98rfb3go4aqUIf9OMomIvHnpEDKTBTlQd1EubwxcfOb5DAQfSPfZEcSnzBuS/QwenPxIu1cAmpNDIUj02HMrYgZeMhG94Seje7KGekhUeTevldV75FYUNVYiHlsrU/5NRF3/ZwGd8j3dWFzFMPgXOQYZAbo/WTOSXqmA1y0YybkxahWgiDECH9ce9cA6QFK505DYOPq8yzCOAcCT/nYZFISe/0Kc0mMJaqECKOnMSg778qaX0Zmreu1z3HujfNPrtj1CwayEK5Qxecj9Gs1kXlecDhIYR8WSoOxL5RNcckuxmon2+RMdCyik246QE3wKKkabjcxJj2CQBBuZFLfXu+rY X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sF4R7J98vMw64bRtDEuJSV9Q7Fdcm3kJWebMIqHIElteOpEyOcjlbO1VjU0jPQ7wQobJceOWO3SAwR5l/Mbf/ihyZTB8qARdYtZGCSY+jmwl/FAL7O8B054t4gawd6HCz5k6laq0liqeyv+/O4pcv/xx8a+kDTzBSUQf87I0OQsJ4k98l7TYkZ+0/mkaENZ/KEQXN1AuGamrG/vOSg7i7jRf18/uM2cGJpZenyE8qnNIB+5dAvmLbOFW/aDDg0M7H1NP9iGI/JP5i5YpPZxP0/vGOi3O8+z4gEHZsb50WqCayRgbgp7t2QLpYq5UIa+NFKxoDLNZV8MwOIxyS8vNwJVSmuWX0soeeLQVw1lzp+y06/MhKdk/dB1HJ2IDuKH1oLu7w0dM6t3ghq+wyC+jXlB8lho42RC/uERgpdqNvDm9a94YxB9FCzyatlguh/rbXQ38/3QEaIPqt2jmrfFQII/2YRZTPELKWGTMb+BYHpRprJbOq1eliM+TXEph3QpgCtCLYX33eOCMDf8dB49FU8f8F7pKNwOPi7KvoWAN5a+xDGdUmhtN9rbU743eDR8vP4JnbWiIcKHL6XKh2ueUTmAtJYW98Y2hTEVH2Btfol6avcf44ol4JngdOYwRhP8W3lDqWnWtoUpDlp8YzMZhzXgaAi//W/9xK1S4uQlcBWBZ+7/oUTluq2fqduaFj4mFkbCDGtH5CXHXcbNsmtSt4T3vt5cJCufrBwWE3KvXcTgga6dWyiKGBXs4IuvfdIO5oy8MEG2HRdVjb5vAd8Ch8w1ZwqW+qLWtfGAUVKF3rJyA2XwGeBk3WL1kNivKMet8ncZrcPdv9G82Jw5GjFZ3GRLFwSEP/j+I8FTM7m2sQh5edcx8pyR6/t4HnYc++Ewminzmi/5Ij5hwlgpfAGquwb2P03Y/RZVAtOjPqTTFwHPh52gHRyG0AXOQgtiGqFu1LxR/eMtthUkj5zwEtr8wCjj6cGdOmzAdWNtb7uXpR3foqA1j/B6UaVRl+EUlRJ12loMRnGKmztNGRfH+aS0dcZy+3vBFjMKisNBbHHX4B1GUsUea+D9o9f6kpyjDl1PdrsyTSrCr0g/WX0IADuPkWC5bSGRhxe0xh/pbMbv2nNX9PElzS2DzSx+jj+vFlVcii5eeTZ4sbvzfF8Fy4rafr2xYeGVd7Z41pf4OWR9ZaYPAn8Lg+O7Uz0eH9j0tQJI2PyO4BDwNRGkzKbv35VuMKR81CAusQ2TAbfbnmkZCkrdRxmJjTmm4r9ftAf8jy28drBnDQQYN7NBa6MlnezYUtiZRwhUkEKUohEbbY0+eEX71P578u3G/MjX69xsWmoVbhnS3nd2eANuKTG50I6ASiD+krnhpvFjxVsmup4qmxDm08TMFD2/jtQXE8FUH0iCgddLQqXRqkGS1uTrckzRSD9XJLorz+bKdS5gKxmMX2LHSXlwq4OsKpQxEbpsxQEFOIX9pqzO2d089+YigW+X61wuj6gSNK+ucuCZvM86sVCFKQrrv+VVFRGUglA1Q7n0x79l6Oe6Cz+/VRdgz3tsDn6itsTpZmUx5X4PoOgM20Q359Cl+1fMbEX/+Bz0oBrOa X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 111cdbc1-55db-4fb6-9a78-08dcf8c90d92 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 09:55:58.3336 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wvTIpyK0DleQqTPyQcTHoAJtZjU4knFQALAFij96XvZPnlVMmlOEdXhlM2s/RgGBRerFDvxF18IBEkC/QEA7LA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8912 Add related YAML documentation and header files. Also, add maintainers from the i.MX side as ENETC starts to be used on i.MX platforms. Signed-off-by: Wei Fang --- v6: no changes --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f39ab140710f..9ad6c9aa5941 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8996,9 +8996,16 @@ F: drivers/dma/fsl-edma*.* FREESCALE ENETC ETHERNET DRIVERS M: Claudiu Manoil M: Vladimir Oltean +M: Wei Fang +M: Clark Wang +L: imx@lists.linux.dev L: netdev@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/net/fsl,enetc*.yaml +F: Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml F: drivers/net/ethernet/freescale/enetc/ +F: include/linux/fsl/enetc_mdio.h +F: include/linux/fsl/netc_global.h FREESCALE eTSEC ETHERNET DRIVER (GIANFAR) M: Claudiu Manoil