From patchwork Tue Oct 15 12:58:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836352 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2046.outbound.protection.outlook.com [40.107.241.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F8E01D5AC9; Tue, 15 Oct 2024 13:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998024; cv=fail; b=YP5Q+DVkif9WzFAI7PMs1nRyi4YHbPQMgG9Swy6D/uY+Li4GgdJtGeqm71wlOoBIIss7jl/fRAB8zg/6wdd/YjjXGrPlb+89Sv32Ej3VQ3BAfIxBTkxpF66O2JKr9kKsRoEQF63+ZS/CirkZIwPuJ0Ba/ZB36u4/iJrpp2Hsr80= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998024; c=relaxed/simple; bh=rWZH3otLH2Vgc/nQPhpcxfZVCaj+0vmIA3Y7E9O0VYo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HHLPO9ASeb3NWpF2wkW4FK/Vu7wBkO2x27X1OkgPdv/vV6LyFPK1J8N8du03acABCYi6idK6uc0yJyUb4GSiJ77NgfKhmBi18OrLJUUOD4a/7lk8/4EmNjih6MSQoUNxnBBs57WqOrzP1NPs98WClYw2KR3yZEJPrRg8gkyU64o= 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=jmtWQ5io; arc=fail smtp.client-ip=40.107.241.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jmtWQ5io" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fLURmgdrXXRq1zxQeI790G8GODvi5Mh0ytJ7iMD/dpvqpL9fjGLSKKc8AiKqgaNnBOlBYtARSkZN41RrsNmHH9n4JDmdYZefsRdeOuNyrim2UzSdYF60SSPKBwmsAa7zA+y/wlFjp51ZUzjrwLr/VrCt8GMpfGsZu2w1GuhaE4/+VYTk7xWcdH2brCghVy9GQBkS9D4mFmgDuR+MbkH++dz28wW6oebnBX87N9Grkefa6bS0WnUF7VgBLpMXRcckClPfvRLqRT6Gzgj2S4+lMllDtKTnjmiN8cFcXxsc/uuz1Z2rGgGpX3iqCAEXpmQ/1dh+14M7j7ahbWMaIuD5Sg== 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=3rWZjqMHjcsrEjEiwT4YROTt6gdb4/Ommk1YHIWm5wE=; b=opqi5pC1aULhl2+YBk1DZLEjE7i9S4hBSR0P8UM83vsRQ4V0vkgS6JF+qrEpfrZaUQLHE4l8znXyNysyhiidzExSXs0Ln75DAKb3c6LQ9R8iaaWM/LTQ4uTYsjTddCC8IlpLPFArScYZdajiD4FU72iqoE1X7OrUGnUnhJI+rMHkxNtbhFq+stqJC8NawdSMsA+7zDvbF0Aaj0h7zys8mUCeFfZtcmUDyn4RoqJhKOPUPl+JuJkwfnfGYlR+TPAVzxolV7VZEdPXpNYRQClPKCuuhxSqI1eI/wpwKJmOMYnGMpvdGqaLYwldOG3L7pXwKnxiHGII+hfN3WYeSSjdTQ== 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=3rWZjqMHjcsrEjEiwT4YROTt6gdb4/Ommk1YHIWm5wE=; b=jmtWQ5iok+6QjavBpnWF4BYc6C7NlGN7EYLHD76XCmAOrlSiLiCEES9RdtOCkHkCwzQASokP5lPt7mSLqYl6nqVAdHMovvk+KmcgEp/XiaLKYX8Fg3gG2F/oyAtjOSOWuZrKzhI6JHxxZPZN/2cAmvO9wMCRLNWURbMbRTgAPgIial+qizBMTCkwryrSHj0lg2GrPHnNUc6Yrgmssvnc0jtv2PNXufcQU1z/y7sHc3jAnEQxoXnm8xELv2gMNFANQ5FPsfWVD5LHgLAVSerORqUbleAYNPOmKIydP55RSo/QQ+N8RuzcHmlVAOFo76clMrvzYjxWXDo0SCS1rr5CBw== 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 GVXPR04MB11041.eurprd04.prod.outlook.com (2603:10a6:150:218::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 13:13: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.8026.019; Tue, 15 Oct 2024 13:13:38 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 01/13] dt-bindings: net: add compatible string for i.MX95 EMDIO Date: Tue, 15 Oct 2024 20:58:29 +0800 Message-Id: <20241015125841.1075560-2-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|GVXPR04MB11041:EE_ X-MS-Office365-Filtering-Correlation-Id: 29994ffc-9c59-46e9-38c6-08dced1b2e9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|7416014|52116014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: YzI/gDiREx1GNPE38PnFhAYkeuQwnUJbR01Q+FKaehBHOcwz27g9iOEN7r1yLHJCV6X6glppBkG0unn0luRBjc+82N5D6DDSoxqqJiWz5fdlFWuXm8rY9D+jKemLzqkOe41chNllInzlrYb89W+HeVe+etmTJ3KvRDYUBPT3Or5w+ESWO2fYaBA/MXGrGXZoiDTTRCsI3IdLRwJ6x9YWTqPdNyJW0kJkvVYdUZAjCDNHA4RtgtuFAJlOwW6cMXMk5odU/i1shis+tX4U7nKxTqOPSL1DK55z4TSygbjDUJqIuAs0krFPD8YiCJBwmQ1OyJqeF8TKJFDrVptR7OuI20yXOfbnKtSS54737wADMCqvHsW7Vgf8K77b8M+kvav4a/NohbkvG5iLhiOWwRqkqL3bvVxqZEgAJAEY6I86JaDgrFHNHsuUUI+PxXZ2ZwA+LWPtahfUST8v6XCSHo3JeVyqvYYU1wOEZy+nhQoUY0tgKxXkmKRoD/V6rF5WFztCUF6wjSEOgLsb2RGoA74XixI3P3v3dA+EvqqqK/zXWZGZjv3qkkSkvyh5i9O+sfNfNFFwlU/2BSiRMuhJjtXU6IRaWz3d/GGO4X0e4EWXdKB1Ufha2ZE/SYwUOEW4B8Ptqqjsrq/gqjz2xZoro9b+K3fpjpkpL6ewD2078mo1w3Jnz5Wv8ydgEKBmtjlj5hiFy70HtwYI4hPwUaFyFC/0iPAik85ziq1ilUcdRBh/7Sdv4t5XglGwr0LRK4pMLAiFIuE0ZYOYCh+QM5iXociJ5kjEuqW1VgqNrmPkkzlG8zgy0D3ckUpTYCyQr9s0eV1vUhvas011PDQFeLU+HpezNlzSmdQC13QflocvMFz9CHCgl+N29stX2OGIOcf0ofDXW3dAkf4kpPGUC31l1XbxHIEyw+zmdx+0ukYZuBC+A6jnjfd3xa939AyqQnEvINqBIoF/U18dKb4x1JrZbwO8ch45EBHbtAMUefc7lt/bbljXj8cX6GZ37dbXsvTv1fan4/gHEbUzsxGYQSCTb/aCWM74JGFfFx2iKNgLlD/oB3POyagvmpYwZXsv040ZV559j0dmOrPQ5AEU6+jmeUqKfCG/fQQsa6jMW3jq2wkToab9mskYv+sCUakUQgyXWuadHIJav+Sj6bhxSpMvMvSK32OX70aSAjrdbwON/AcZTv+DlPILdHEbAv2ZK+AMo25+0aoZEhPj5mASCdL/ELmO1jkFDIMVHMTy8sGfJKCfOk3MWyk8+xs3+vMTxfqezc1IKT3uJ443e6o3DzfFB9a62PikpXNU4o9hIeki07EFRAYP+HK5JkJyqCLPGzV1/n7LRQ0hDqMORj+NM9Gd6Ar7+bTMmtASwWVvshMbllgis5k= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(7416014)(52116014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zot/0HA+Pn4kon2S19YYTimKtwqWwvAOmtrLbwEElmkKHy1H3byzjx4y56zSIYI7Sl+cV++xAsVufEkfwUbwDcxg2598QRhRFVmwV1BV68HvamLIvYZNQL2M2N4QRnkQ13UzcF2q1kEG7GDltleihBGJWiZYywvFKTIqBYyeebSB9cgl2HYvnEqVyU3HxUDy0IigBCSK8d4/JyuR+a4hXtnfvL1pKkZ3B9mwRd/p0D7NpFtJ2yGdBTTTNSiAsXGG0pyisAM8o0pavQgd2NZ5OGW62nK8NMtx6/TEjs6UYpXvSVdAqLLQoUfYue2orTvM72zJz9RFtPgyeaak2Svmp0dcjpqEiL9fALdlr+U5Tzmd9Um1XzP2av1Rl29ZEE3rxpQRBrwfHd2uPJUpkTeztA33xSRiMo1+XczoGnl+2FeT+1cppVtWKrMGTvD10wmq5dwuQO7jVkQWg8T96jOVTXXVtBOyKebD51zrLudZEuORAXXY+GldJz9ao7/suPXzsSAHzblCRgCzLQWzvpxQ3azq8ifQ34ZkrKJLRDevawt77p+LYk76BwVl8ODd7UkB/paZNKIaUKvV2jRpmx/G0UyQRqDRn+lNPu+0RxqJd9FETZKphXZQmNfS/+Qas6/xU7o8T+joRiApzNfVO2/3MpBW5h2+/L2KX3RKiBNfhXHruCb7NCKG+0eq0UbM/LVfYJgG966JWtpoJhQRxK0PoiAUSuQVlujnekZZckGYccaiLJ+wxjRpkxxuRc5CfV418WZNybZy2Z3SJzDTfEuGhGXS1cFv+aPSFOiRgW4B90ZwjT+tutqIFLUWCb/fuCjq6vqo/n+omyZIZ9DahAxkVHVC412XUG4bM5fPnVzBoG6lZNaqrrKr4RhNUt62C/YJPp2j58zSMbk1JQxiydtZgQ/gRoLtlR7SXnobGY4obb+hXzWd3U5ZQt/hP9ZVUad0vkWM78UE1OYxf2TaWF5gyf7nzjgwmoxNfOLGZsaC2ogA6PycfzAUNTOA0Us46AXglX0hf4DwNivalFPGqOxzK/V2/8ijP01QqJIvs4TLOCW2a4ljO7VBV6TN24z6yO1DH5vQw+TNsNd1t7d16D+zvkFnreoT+pK/xFMJSzei/cghkySNHliK5eY44oOzNO7JLf4AMlt4Qv8DLZ5Aq/Lv5+WzsfZuS/wgX6qHwEVOMs0lftKDrTSK3mM1hipTWJmqACEgZG2P5ylhR4J+HOzthOD0bjl6Ct7HYNyHGegd5SrpPTk0aFuebPRsiBUZRqwEK1WlA044UL3pA2qKJ+Etgd2EEVObX7OXhimZO55kgABnLq2kXB1GpR52v2snklnGX+9dRInCvxK40NyuvykiIzjoUlWdM0HKJ5LFgixolrB89phg3g2PnzHrIbfskrZ8I/9LaCsumVmLJ+252MG4jMCUOtoHgRWst+lGMcQv+qzmRh+PTMQBJEE3NmKx+pYGw/ZJkOqw+rG0Y9fCAgPRm6rBd0PmNSZmTUN9B/M1vBIEswD6oKkmRcCoyOkXCSa3LCqmPwx5FnUYO1iN7H+pXxZ/NU/x2LFsWUZfSrrncnkjb6zDq71dSVzvxwMwX7i0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29994ffc-9c59-46e9-38c6-08dced1b2e9c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:13:38.7728 (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: h+ls5dBgpx516mKfGSbgFO56seci3avXeJiUYfChxRzZWfGXhsW/UiUPEzGiqctrZguecA/S9r4m5HetmhmHsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11041 The EMDIO of i.MX95 has been upgraded to revision 4.1, and the vendor ID and device ID have also changed, so add the new compatible strings for i.MX95 EMDIO. Signed-off-by: Wei Fang Reviewed-by: Frank Li Reviewed-by: Rob Herring (Arm) --- v2 changes: remove "nxp,netc-emdio" compatible string. --- .../devicetree/bindings/net/fsl,enetc-mdio.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,enetc-mdio.yaml b/Documentation/devicetree/bindings/net/fsl,enetc-mdio.yaml index c1dd6aa04321..71c43ece8295 100644 --- a/Documentation/devicetree/bindings/net/fsl,enetc-mdio.yaml +++ b/Documentation/devicetree/bindings/net/fsl,enetc-mdio.yaml @@ -20,10 +20,13 @@ maintainers: properties: compatible: - items: - - enum: - - pci1957,ee01 - - const: fsl,enetc-mdio + oneOf: + - items: + - enum: + - pci1957,ee01 + - const: fsl,enetc-mdio + - items: + - const: pci1131,ee00 reg: maxItems: 1 From patchwork Tue Oct 15 12:58:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836353 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2050.outbound.protection.outlook.com [40.107.241.50]) (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 8C23B1E3790; Tue, 15 Oct 2024 13:13:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998029; cv=fail; b=eOL5w0lTP/1GK80GstfoYTHOBPm6S67L90X/gxCWd4lDFrTpTv3ogmOiOZNmlyuAxJiv5I4J01XYpF/Ae8FMffPoDfNB9r9XoK5NcNlHT5EVp8COuNr1XXiGhpaNXJVuqa1zz193E7DHDrhJS7H3qoucWF+zCCJNS3jAIx3Vpc0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998029; c=relaxed/simple; bh=vOYt5pc9CLUk9g+61ym0JlfJ5NQ4N/HkRG2V7f0RPDg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=q+GxQGfDVWGt4zYFiLdHng1z+WXTRBZiHE1lP3GceN3JdpGi2Vt7JwPTR1o1cmBjc5AhSZqL4LBtYQbBeoeyCyQUPmlcTpL+jB/HegpSAKCK14J4s6e8zxcA6SL5KstuF/VNDZ/zBGjIITqTQc6UY9CdnFj4Hdh5YuP1YeruOdc= 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=XWbyL3Ss; arc=fail smtp.client-ip=40.107.241.50 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="XWbyL3Ss" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c5hmET8RNtvKNfRzpfdYJHGJ3ICMNmrTAuLbWA/+SWR8WbsrEdTPpfI+BhdWgtwWbDGfFlWijnEx9XzqSOxn1WQVzqhTDemm8UGeVOL5kflXDt2K4URAGyTndPiioD+7IGyyJ2kRHO8mKWHwBKt5JfH1wp8TItJdNWTkgaL3gMrsRSIIj4dFwSrZrWpSU2StEvsJuv7YpvpDmVjR7YmrEy/GULKaujKfAqVmIwUB1f7JuV7ecQlm83Hu+ete2Z4sBShrvBxaJNg3SkPhgd6ByYRNKQQBK7ozU1e8HBc4gGZgT98JRxDjuTGcYlQplHO9AoU7FQxC+elHr2WxvQ1eBQ== 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=mpTDZ8jdwDxlJQiNlhbG3oBSIEbo9cWDP/D0msqeQlk=; b=KPH9BgDtaYDAX9mGovH/ri3//MknwmOylxTWHDnEEzdcSFiDc66scmQ/dxuS5XFwGoF6x5Q+hdX0R7hxTSdPN1WLnlZBvkzeFJ1S/GWqQYye9HyvuNMcBxCjtxD0i4+CA3Vy3qcnpDyP5Z8gDL6KQSlLpAbSnzINtGimwHeimGp9jPj+shXnR2M5cx0jEvSPSq4iZDDEObwSLUSxIKH1XlhSXbIbYKpyzyWOcNNRRE+iySnCptvkitUm8ARw0JhrTB/Z9tT2dpmWmH3RgqhWTqBIyLL1rFJh4r527CNFztOQQA0r+l3QEkbYdKJae8eIOjhSAcIjAO+unioPYPApbg== 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=mpTDZ8jdwDxlJQiNlhbG3oBSIEbo9cWDP/D0msqeQlk=; b=XWbyL3SsmAw/EWIN3BEJBsJjc0lqfzXqXMvv+BCVPgzAiil91wSl49Xn+CpRRGqdWThNNLHcuRUPkfD4mBEp0CrkuOZ7zhDZXYDvnEPxFregTPmxcjH+QQFHqX+yE7HLKEsMRduwYeXda3382zU6REzvpmewpE6v2X/OETbvRihDR6R2sJjGO2SnQKd57SI055dxfumwn8MNd36ngrTyCFWnizV8bNG/dxN237t83+S/HyUVTC8pfBQbp8S7R7NvfSxbsmnvhz8bSUT3a16jo3Af3SqvH4XxkSQp4gxPg4Cz4J9EKqDjSEGItslsOyrF0V1CxNS8vNiRknrjI5ETKQ== 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 GVXPR04MB11041.eurprd04.prod.outlook.com (2603:10a6:150:218::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 13:13: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.8026.019; Tue, 15 Oct 2024 13:13:44 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 02/13] dt-bindings: net: add i.MX95 ENETC support Date: Tue, 15 Oct 2024 20:58:30 +0800 Message-Id: <20241015125841.1075560-3-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|GVXPR04MB11041:EE_ X-MS-Office365-Filtering-Correlation-Id: d7545c66-953b-4af0-b9f4-08dced1b3226 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|7416014|52116014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: cb9e/8kzX7pB6GsgvXxa75PL32RZsfPO4Oug8onUoIHmUnWBPc2KshYzy/tVIQEQteG/SO+x0wHfLxjKKiDP2jj3wDwTnBg2tgjX659FWrahn3dB4qB3pAW2c8ACwsl7707wy3NvRSuNq2CW2Q5AI/8ToH/WXIexUbHHo7gdAgUkmeoNrqUZ6k53y8b4+dmOuuL/sgHHbu3uGjeWjIPy5Y6J8/CPUHZLPqVoLpAsjlXJ1QkH47T88MycW02Fse8MJ/GoqGWGyazYdBJKTtSbNPenZW3KJc1/Xiu100JEAHZkFpJkPlNj8phRmZQExFV5RmYs54BZ3ARjlO6QM1mSTErs7spI8dJvWcNWMTWY2KCGNYbNezY8mCZOeeYysAI9vx4/oy2JCxl3jshoS307SpAoatMsuqldXoR5EPMTFSQSiJXyZXvluUGSyNGoUKDqUWqsDTU8HA9OOZvnAtXtuVtxrfpa3J1yXvQFjjUuRQCYfkL4f6n0mN3JlkDSxsTIJqahdkmWgG+M2wwW2TbvNoNor36YPsFSID8Od7FoprZzkffoLq9SCPAAxQLAleQs+VupogUNj97GHTBsl43I5R6w8F1RIH/wjcZS3FQ0jWAW3uE0DYVQLSkRiJzlNVjZgOn2eHOjU4TeZr4ws78SfsQ4RqlCT435sEM1MWWIeMyS/J7R7nsgqAZ0CvNWCj3gTG9OHjYGdeZiHcQBhq0+DUE8X0HkOd+Ek8/sfN5pIcl2P2habkjzAX13EodfFrOkPUQmKOt8WrqoVDN6cRmnNwda/IfhvKfhVr9R7cnt6Wo25/x8/ncS11vdBkS+2U3Dy2XjEQIIcNUdug625prQFVOKlJPmXXFoVJ2URIOy7Ig9zOq/T5bmCaDN6YuzFeCbu4NJ7/x0gqb4DtpTVEir8YJWtvXf9wWcIYyTHS5mTIjVFBPeo70SPmfng8rVUMvOB2zvn7YBs6J7+R1g0zsvl8ZPnNZthDB8wFklD4kYRZOw5S2a9Cly6P0VjBVYNooHE53OKFmCCUEdtI99kTH7XWyH4LP08LtTP+p7pHUzX/2pMjoCDFrlwAiyamDe1hvdXxmTcNghRvZjrbK+N9afW13RNyejzo5Elmpkv6aCx5QEoK2VHMpuRfQUA8GT98+HWyP3RQPu/jmdVFYsgpEfnPgYFk8yamUc+cgJLwI36Z1HkbKPXx3/eO3pk02scEhTWVOE3bEihxCyp6RlLeFOH3L5b1AUixb1N4BY4e5ukwJefMhFUG78yFA1/0uOBPYzQlJKRAvFodM+RFcsPj/VFllzelGCGNokIlASXOKdEM8X2hUs0OE7YcQ4JKTgvdoENS5W4D+OPIHHqGI2Gh2WEHIhQRlf1CfE4YdSMRFzmhY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(7416014)(52116014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LbhE7oDuQA9wwmeF1ZvxHJja92ul7ZYJTM8yIIfFjvN9CphiRks1oC47z14yM7D21GWNHM0kg9VWZlaDEB70PV54tlJWP/VAJMHOexvHErt8w8MzzoV+B+tk5cEqnqP33Fck/cRAm7TqXvORIsbVAVfnFMDMUaDkwmeX6zRiQqinhzOARtjprC7ZKMav1vAY0dTZI/SA6QV0KXsxLbR1cSuaaIovgJX+xowvtABbHEUrud2rH4uklH/BS+AUq/DtEsQ+v9UhyFo2yDNfG54pQWW2OM9fE0LiNUszRrz5LExmCOi0T2HHGngCzo4LPxKZwau4l2cZrU6yjdjxjUPuytuFvKCRGOksG4gntk2effEL4XUGv4m2o3LXrm9cK3nx0VKeMF+RPgO1YVYT3BOBqCyp69w+nv2i/r2oVMOAhHX9WlB4e1ukCTUfz069AKe3+FLzb1ifDfGmIIKo+xxUspxlV2t2dvF1kNLjo4LoV8on80V0Q4fnSTA1InOBYmwCzKxt7lGUaRRyoEMv8oQ+rqp81jjmxP5e3tEcwDgINcCP+9fl8zkLxqNIfsdX6r9QMRsFwUMLTmE9AmtyvWBtVOeh0LX/S/WaSyK7fTdZIe1+4udnClmQixd9y2/Y8y9qRf94tQRf0YboyalyG+F62TVdUAUxYYMPzUSGtSRwmjDLHnyy3rfu0wbl9pkoSXOkStAcHJh6ZGMMSxSAUYiV5Aj4cP+vHJk0CBRb7TRhZPeOO4oqANXqmCpy4k/R99dZDnDb3dV8uGx0jthdRyiOrTHzhNuYFITUqNRK5G4aOCCE7F7Ouh0CB8cPBfT+BVpobd/XZvJv+p8CebOmFVaUr+usw7wFgOXvjpjghR8jveUugiqpyzSFSZBYw3LzS9n+VSaY7MASWI8gfLqRvfRrxNZumrg6NO3YpWjbWNJD28nKZ4IbOSejCkC2uCnthykzYlbb5RGboz0CqCbw6FMNvqmcN1+CKV8jsoNRmT4ZHzl+zutr0+L6x8zBA1JymH3m97WOnAi5geymgP5HDUXd+itRTlQrEfWL7VgYnbB6OHvQNC2F4dwvw1BhOR8qGFrMYt1ppaMlCqUpOOLT/gqBp8AgEp0Bs+MFwO1+NxBZ4fzEjR6V3WbqR1iPPMKBhff6N8OdO4KUSn9CSeoNgZyw+v0bhDAYX91EsB6kIqeHX/aSKATnHdmPGGmDtbm3Pt9Wv5RqFNID3q7+5zgqYH0MkP+jJQLC/X1PVBnoTTEAYNDqWm8mC09XHKJNq9lbYMolI4B04jumBKjz5lHKLmAfUFrSOjqRxm+nKkgJwsIXwHJ8N+qjbalaL0BNfqgDEeQOCJ/miTNankSNCJbByeOmwOatEcMXKRZCfw6dYjSbVqJB7ZnjabGZvr4Mjw6lZ/m7s+iZXj3+o3pgkZT8p7aPBZk1QQODg1LXaoqfvrftBiNBzORGz8H3RBChVwLobsoQE8A8aoNQxdcrU442k7ETsxVMJncK+7p9/LFp1e4NRA1XncPUMg2gLurZrjyfB8oayUEonOwRQtzt0dplcngk7l1o95aKMBBgWXa56XTPY59IYTiPCH86sqjxJcVFr4uf X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7545c66-953b-4af0-b9f4-08dced1b3226 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:13:44.5878 (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: q95x7SdLnAB5gMGfta04giP27HvnYMJ1S7QhXS2ziGRJNiLb/yMvoqux4HKjNlVw0DNoMiR4B4uNRl/Jg+A6Yg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11041 The ENETC of i.MX95 has been upgraded to revision 4.1, and the vendor ID and device ID have also changed, so add the new compatible strings for i.MX95 ENETC. In addition, i.MX95 supports configuration of RGMII or RMII reference clock. Signed-off-by: Wei Fang --- v2 changes: remove "nxp,imx95-enetc" compatible string. --- .../devicetree/bindings/net/fsl,enetc.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/net/fsl,enetc.yaml b/Documentation/devicetree/bindings/net/fsl,enetc.yaml index e152c93998fe..409ac4c09f63 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: - - enum: - - pci1957,e100 - - const: fsl,enetc + oneOf: + - items: + - enum: + - pci1957,e100 + - const: fsl,enetc + - items: + - const: pci1131,e101 reg: maxItems: 1 + clocks: + items: + - description: MAC transmit/receiver reference clock + + clock-names: + items: + - const: enet_ref_clk + mdio: $ref: mdio.yaml unevaluatedProperties: false From patchwork Tue Oct 15 12:58:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836354 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2065.outbound.protection.outlook.com [40.107.22.65]) (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 3D5FD227B84; Tue, 15 Oct 2024 13:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998035; cv=fail; b=bYevlS0kT/OXZdP7b/qpHeLhhuWmvvCZWoYf0VBMy+/mh5QmNecJj9gwqaJI26WJkB7XlfzPB4mL+VpOmdHI4xxeBCJkHB87nC/U21cZVnM5gx1NmIqCck7Xe7eRHznrlD64tyQkaSZeyagBHExysEAHcSLIpvTOFE/yCHP9Zfc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998035; c=relaxed/simple; bh=m6QZd2W+FGDZ7/+DLRV6ptbnvayiFlpyLJ1PRo89eNM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HVbUL/gDQYN3b3r/UwaHL8YAfUPj6fxPXLqlgXc/vLzj9r5zMO3Jif4gfTZ5tQyb6JYam9rChVPStZBwzPefr/UTKeq5Rz+6LvrrciFq4lnAIyHkYLD1Ri5nN/215mKYY/YiPhIFVNpuGgV2RsfwzfXR+5MFR76L+WVNNVF2rbQ= 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=C5/ns6uD; arc=fail smtp.client-ip=40.107.22.65 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="C5/ns6uD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vbgKDHMYgZuiGEoezfQP0pAJeZBGe8waLNsjhwh6QfZ95RETDSbANgzA+Nca2evYz2TwNGcdyhUq7DTmj0C+dAg9v06lN0CU7jSePUvAw8WjzHOR0HvgS5SBviz9GEohwG7qodG3PW1CZKeeex+ZXTOVSf1tNrKWsRTJMh+r/8mZXUlLcV+VswZaFAOTjfV/9UgwDfQrPZ5d9UFpQIwv7/Qiv51AgGRM46Tfu18js0Is/RHbaMcNJIXuVFbFdL+c2k6kCl6Aimq5k9u7I3bDZcxiWuliXBg5B8HxQGxFt/Efa3mDCmH2B2a0BOIx+OYnAZRrho8nc2oTufWQyanOhA== 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=q33dEmPWNRXmhcrUMfWZDC19xxfRYpOcCFacPXnIzis=; b=Xc1K+hjM/KHdoqV8XxDESgP9c3XsKZrj7DxFVpTE5kkzIZ2dz4+gY5keKqCXjF0UbLEI69zrDTixob/PRolsqwwpcMM9UAmz09rtfzNHCPBQvzd7ViCxuzOYWP6wAVS13w3Y+LQkq8evticWlaMPtfD2a/4ns+q5jRRlEaPnZT/S3OGupQOcZZ98f6qnWavg4z7my+21+QYEfkqBcMwshJIMuKr+kCqwrbLjhlgzpX4TUTidwCEuJ8H7NqfODBS6KR95FqsRLdYvu+ECFcf14smZUaxrFYsQR9K4OVO0/2pPO3SmXoZ8Xk6DwlDZUDwCPoDJfTow6AMAtXurMixBLw== 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=q33dEmPWNRXmhcrUMfWZDC19xxfRYpOcCFacPXnIzis=; b=C5/ns6uDelIJMc2JNxrJNxJ1MsEDJZzB5pP9EsloS2S4fL3D2WD3QXT98nlvKANFJLbv8poEnVjfrSJSMtCF8GfaR0sKs1W2G/8y120H04fvCPVAA6i887auucT5avYh8G+tlVrGNSWdP7xm8cp1ZTVAP6NlC7/P7JgSJi/lrI1JVlWUnmHs8hUvbwgrq7Q77mK/k5QokK9jryrICITs7iDOnrafeVbGBelAU0OSFk1lJFFSngbXnRwKtQpdkn5RhAbiGxCkYF9luq3RYCSqGJOyKimAzQjlvLTq+V42p8/F7HWNWnV0/Lo5Jx4p7KUGPjhgT41uwiay47wFifmrug== 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 GVXPR04MB11041.eurprd04.prod.outlook.com (2603:10a6:150:218::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 13:13:50 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8026.019; Tue, 15 Oct 2024 13:13:50 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 03/13] dt-bindings: net: add bindings for NETC blocks control Date: Tue, 15 Oct 2024 20:58:31 +0800 Message-Id: <20241015125841.1075560-4-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|GVXPR04MB11041:EE_ X-MS-Office365-Filtering-Correlation-Id: b5be645e-a9f1-4b4b-bc2a-08dced1b35c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|7416014|52116014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: L+QESobnR3vTY8E1603I5SuIGCApsYZGDIeB3MrNR+NaL5xKuBmAMgldRMW5GvuzvDwdvBGuF+SVRs4vZux6lYoM2Dj6QiApBcK5+N7T/iGK6P1a9nuwhUUgTwDA1QMdOPy+MmAYdYJF9w0UQ/0pEXOoBwNnaGf3D9bTMDdrQEYLYaMGEXhRxKxOBuccxNP0+fUdAnF96+bD5LKYrYtyYghfHWy56D+nAAoHm3sfKsebMSmPVaCnup4j3J95ibYAeMQK6XNCqXIgVeueKU9hwr9wJJgax8YwbYuyLJYuMJn8f90ZURMifCDmVifvbivb/i/zWhBNsSEmlgCnvb6sBulTmB8dL+54oGqpJtk4cCvsNFynb8Zh+FGl2mf3OxKyC5OrsncdM19kOE3EA6chsIzG5rQsrPA+Hk2lFRsUGQs552mRqpxIvRpCbpLWQ3CvtTYplrfX6KjT9VIGjHdmKEj03F1rkg1+shrX245ffOCkdrh2QYmpbWQ8QPu/EamCDjMCe+c6MZcFwHgKWPfw0HgmkhAc9iioYKiigE+mPRQm+GvNVdcKsZhIxS8ayX+C8yC6N+INvUjYPwJ2qbjIrsn27yaaROY/UQeYz+W3kksjjJHwDyjYOKYnvX+g6EP459CztfLpnyv599hJfIjb48+Pa1uAZ911DizQng3P9fYD6NglBLoYoLW9syD2YtT5wg3U8e8KwIESZWgIz5sGtLu5VHuPQMY3xZx5h+5xlnWzOYVd7m3A4rYv37kovR1ZekUjMZDp2gIFptvBiYBVXOcvgi+Iy4qnoQF8L9ZJ/miKDLQB94nX8pw4xdN9ovPuuWY1E5Wzhk3nYkXT2h52VK1MUT5f9jS6DThu/KoTv+DGBFezYUogPpMXQ7M1ZpmmX+C1E+PgFIAS4+gFeo7lnI19r3SpwCfM8skan00gpNOSutQDnOJcQraQWhrHG6wso8A51x3lF0DgTfYdTFyV8hFEACAqkhjCuOTcGpMPYw+0td6Nfakm0yzB3AS0NKmtDR8W89CBnhN3RkX+TxA4mL/Y4qniWMSbXKUkFmXD+3J9oeJ7oMYWXZ6fiYtuWTaX6MwkKj54Uqs5QxOMRMmzbv4Tq2eC9RkxVqAwm++UO83cP5aXIJx7uUpW1i8pmVbtpqak9egcikHW6zamOFBXzJNEIaeAayniSi8QbHMKGy9kTULkrT3jgaNw7cI9MP5MPuD4AmgtItdjcMyAp+qLbanh+yKPbXsGeg3sQWJUqMs2UqYoFQsiuuQwERVEHVrSkMaQcnCGyhakjZjlOgFMyK2nI3+JRUpyEWe5utz8jPg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(7416014)(52116014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vH9E/RymwlDeMLpsNSJLKpHaHIeNPhqZBDIz7PTgLoYmMlpdZrV5t61vINf9UrRguhjCZFBmObYxpMPKZanNzJDA6BRq/7LuzPX1N4tG34mKXzvP1Cv914+KfflCJwtAIb+hdUzg8XjxmNcWOgvolxNgvMZl7AhAqhOCGHTSzqhgawhSAcIqILUenQ4x20H0VHnswEFuv6ySkOwOMD3kbqeOXtE2+wqipo3I0OtisMXPaKt1emTrjgQGS/stfU12DYKoPsGDX4UMs8EnKjljiO1gL5nNI1FsV5JCS5j1+M649Q4PcDhdui8rRROfjle0LBZ/c+fi0g/8fTtyv2isQezWxw5WrlEOt5uHgqs9R7gnZK1mMtFb8xhVApwGvZGc/Ec/0QGTNMLVliMY5YR/FgJ9R/MpDxYK/RQR1qHgC2buVHa1ZPsMKdFzO8GYwByezITouVSKn0pBHMKiYuoW9eTB8hoCydZtxz0G8w5LC/IbY0dgGdDaDavYOJmWZCWplceMQDK+nfBOM3y/LIYAO1e+XhFV9LcHtr/qvj3VpyxXAsIokeqZj5NqW05PdDiRsC3nd2J7PsHE3LIN6Fs+cra07ih0hHqqwfwLcowcM9Wu4HqNG46k4qS8FojBobD+9MFYoHCRmCbdkYLjpVrDmsAaU9MxJQG2dJ/LqrITuJszrsP9hCNeLieSIEsP3zZN+DMs6EdClF6Q/uL+e6LMTA8sD8bID+BwAacShs+JnpsBGPvpMpsvQlu1Ixwjgn7riQwd9HeKHRmrr1leFk/zDbDU3+2NoT3AnDHmxlZp6cYEdaCwNsEr3izZFdo8/e5AXH16JLnDmqpKok+LD7X9lal+Ih9DrxbqANRx0XG8B6fjGmieplopY2epvxSifRhxc03kKHJDtp8AG+0fozuuWIwJOMU6ueBublAzjuRa/IvSZjfNYkATWqO+rS7MM/Wc/7PAqckNSvQxs8mnEFYf8b0Er2FvxBSYQtCyO2T5c9+yuQo3Q6PJdKnqgcdFC/mW+tN77FRbL0vnBd8Cx8LrmuNShlpsNSI8COkqRuiU/j5DGPRMS9yPTHvytj2+OGwiiu/XgeWqA7EMcf7QocTQQgm071jqtT7cSPMIQZNmQ4KfBA/d/3d0F4ULshL85D3pGTXKJXhlpAhgsUHXb18aelUvd6e3xvJD8VXOlsOkX4o6n2765ZcgMzx0SnoMyiyU3owR8TsZHea3OUUZlSgtv2kvWJciifXBK9uV00wwkwwx1KdFnkribqh9RxbvffGtdkUfymXZ6z5+yv7nWl6zlZBMSGtBYKUYJc5MObRnT6f6+GmXqWasK1ox1iCWS4MIe2mWt6xg9rP3uDCKAK8S0mZpZ95j1dY6nyijpziNAHT9HUUU8cvK/9XN9ixUvzn+8W/mwqlXuLSqcdgqn6FNjh5YJVXwZdCHdcrivvxGoyvIo9+8EdhE+ABWTrXJw3ElfvnK3Ea48+zPX1+vIwwxTTMriKuWu14lDHEPxcjmz3J1JGJRYML7+9qX4kOCHFPxlLj6HdyY/ZaFuGLvDWcPYOSJMKgYRcieFExqcB0sLWanxxv4RfqtLtg8Gxdeqsb4 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5be645e-a9f1-4b4b-bc2a-08dced1b35c2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:13:50.3488 (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: 9gptV7H4MWNuPCSoKoqnGIBuhh71DUfeOc2zUIvYZ48lMFePbDPNeiHwMkNNzjfBfp/eS4UMXxS4Hiff4uXrGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11041 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, 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. Signed-off-by: Wei Fang --- v2 changes: 1. Rephrase the commit message. 2. Change unevaluatedProperties to additionalProperties. 3. Remove the useless lables from examples. --- .../bindings/net/nxp,netc-blk-ctrl.yaml | 107 ++++++++++++++++++ 1 file changed, 107 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..18a6ccf6bc2e --- /dev/null +++ b/Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml @@ -0,0 +1,107 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/nxp,netc-blk-ctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NETC Blocks Control + +description: + Usually, NETC has 2 blocks of 64KB registers, integrated endpoint register + block (IERB) and privileged register block (PRB). IERB is used for pre-boot + initialization for all NETC devices, such as ENETC, Timer, EMIDO and so on. + And PRB controls global reset and global error handling for NETC. Moreover, + for the i.MX platform, there is also a NETCMIX block for link configuration, + such as MII protocol, PCS protocol, etc. + +maintainers: + - Wei Fang + - Clark Wang + +properties: + compatible: + enum: + - nxp,imx95-netc-blk-ctrl + + reg: + minItems: 2 + maxItems: 3 + + reg-names: + minItems: 2 + items: + - const: ierb + - const: prb + - const: netcmix + + "#address-cells": + const: 2 + + "#size-cells": + const: 2 + + ranges: true + + clocks: + items: + - description: NETC system clock + + clock-names: + items: + - const: ipg_clk + + power-domains: + maxItems: 1 + +patternProperties: + "^pcie@[0-9a-f]+$": + $ref: /schemas/pci/host-generic-pci.yaml# + +required: + - compatible + - "#address-cells" + - "#size-cells" + - reg + - reg-names + - ranges + +additionalProperties: false + +examples: + - | + bus { + #address-cells = <2>; + #size-cells = <2>; + + netc-blk-ctrl@4cde0000 { + compatible = "nxp,imx95-netc-blk-ctrl"; + reg = <0x0 0x4cde0000 0x0 0x10000>, + <0x0 0x4cdf0000 0x0 0x10000>, + <0x0 0x4c81000c 0x0 0x18>; + reg-names = "ierb", "prb", "netcmix"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + clocks = <&scmi_clk 98>; + clock-names = "ipg_clk"; + power-domains = <&scmi_devpd 18>; + + pcie@4cb00000 { + compatible = "pci-host-ecam-generic"; + reg = <0x0 0x4cb00000 0x0 0x100000>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x1 0x1>; + ranges = <0x82000000 0x0 0x4cce0000 0x0 0x4cce0000 0x0 0x20000 + 0xc2000000 0x0 0x4cd10000 0x0 0x4cd10000 0x0 0x10000>; + + mdio@0,0 { + compatible = "pci1131,ee00"; + reg = <0x010000 0 0 0 0>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + }; + }; From patchwork Tue Oct 15 12:58:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836355 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2079.outbound.protection.outlook.com [40.107.249.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 D03DA1C07DF; Tue, 15 Oct 2024 13:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998049; cv=fail; b=UNMtBbySQxjXh1AGlkmWZc7ViE0Ouik1xXzCcyyE4r7DSdPxara+NFMVwm8Q8qREO5SaHA+nesTGYJuRVb9Wzj1k58AMQvFn92XPpaWK94dTMmpBEMAwhi+vodvRnXyT05oDeGIqn+AzTHKW5hxXh6CBVD6DC1yOqk/NESFsVa8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998049; c=relaxed/simple; bh=nMNstx8N/DHc34wc/epr1BcfPX/BDc+MTGNUyWSpM4U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qf3aJyeTjJGO9dnyQcItPjHTKWbNNSj717v3V9H7ExA2LI9T88uMpd9SsNvqcfoi/wdeZWmFwLgFhC4XpfkRYk01zHCZx6em7hfUSryCGyfxLwUBm1bpmP3nPSRHnCmU1d9vQgJAw14tYqPUxIec/z1gaAa9sFnTq4F2q2hIuJo= 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=EvT2s/Sy; arc=fail smtp.client-ip=40.107.249.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="EvT2s/Sy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nwrSnjMOBK6fgwjTs+Tg5ehCydM/RKWUp0sI/7SW1zYHFyoJWkerJxb8uUqB89oMgk7n9GduZ+4VOd2KNSZmUCmEW7brmDeAl5pIij/S0g6fCMqF+BhK5khY2a84TlXg54s3Hl2fm2wGNbXVo29ZyF65ZdGjHFiaHQLdYXmzOyMtE7qWZn0kurVsFGpS8hwkJ8/UJN3Hoey4Ha2llQeJw7HMZtNqyA7bSZZYtWkhIdhdMPXJ5WUApPhtPSqNTZocGLt43hpqau8Mq0f6tNz2qeVA+oPIikgz7TPlRbwO+z37zqhCUlyvG41OUG1Ts73altVHe77If/B6YjSyRgMG3Q== 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=et3/3713zFU3WJwXkhw0hKja9HoPGKS9rMBOmB0bplM=; b=mHrnjjDyQRaRASRubm0KRWb+jUybVm3ZVZjMsjkKUzwaFi6VkUCf6LAtAAw7tlgTcsneedRYyn5talYQ76Lcaw49d6aMCJ6bi4k4tbsYdoOCS2nX8h/JH5JxWWY98T7TCakCqB4gYH5Wr+Jl11/Q0MDFnmuVCZkv+M2cPRCtlbvPVcK2lGiJvs5kvxT2EWU+Uf9P5svAJHQXm7mBvKCzCPJrtitW9zAcB8HFdbipghXufTsCtuxt60/hNEPWuPgFYGijGZkC3hvRlN7z7l6dNRNPzNWkAq2IeZByPuN5kG/Xa9DEtUGWo5Q1RakKmOcLi5bKY0JGtMzdFm8wD7kK4g== 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=et3/3713zFU3WJwXkhw0hKja9HoPGKS9rMBOmB0bplM=; b=EvT2s/SylMZjvJslrkxrEXVpPwVyqgHcKj/2wgF9y3+D8HvI5Tf5p6FygSq+DSKJJ6ILwQTCMW7zrjcOXywfUPFrdkRwHI/Gv5st8yeY2Jcy0c+hXY/CNTPeNSYCVm9n4TbfLTeq48FPmiBpzrho/CZmQsKl4PkEhxRYq3BJhx/IG+SPEq0W789+rgLu1rUo6d7jEhS1NfODlMAyAPl3hG5WmTY3MwBVnMus5Lp3jEI+PMR9cmLv0YdM7I/A6t5oZdzGcq9f/9sKnKg1dMXzrQs5DW30YZlsRagmq1BmvMlxLBJgcBENyzl2hoDB/LgbgvBCgumaX5IAPVRVgo6BfQ== 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 GVXPR04MB11041.eurprd04.prod.outlook.com (2603:10a6:150:218::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 13:14:02 +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.8026.019; Tue, 15 Oct 2024 13:13:56 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 04/13] net: enetc: add initial netc-blk-ctrl driver support Date: Tue, 15 Oct 2024 20:58:32 +0800 Message-Id: <20241015125841.1075560-5-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|GVXPR04MB11041:EE_ X-MS-Office365-Filtering-Correlation-Id: 648e28ae-aaac-4ed1-1bfe-08dced1b3911 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|7416014|52116014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: FTUUW2F+KqBX+D/sTkVaUnljLppPidMWfbxwoNY6qdvQL00EnDGAn8+i69WMOnunbS/tf0WDo4qalxd9Bw+Kmyh/rFWszrm3o6iXpU8ZLHpQH+O3Hey7aQyKcxLqs1WRUMmJkZCtn/oNM4wVbOQo+7kUss65DcKWiB870aGih24Heo4PNbnhFt5gAON/8mZpSUnKldbWX6V19mSHjEuz7mXAhZ2Pdfv0fKXKKE0vzTzKHRQ5NhmihzMKh6sQe7z05oR3/M68xuhTpaa4yij7VqEuFq7k/f9lVlwKGZwml+94pgrwvYL57QUVUStwuv8Pe0ZX2npFUyh8D51totBIqzFSX9M05my3SdPWDOShb7aMi25RsKtX6c4bzQp5Z190MlhOSodKi55X0t/QXTYDtdcz1w4H8oR652ZufM5fz7EgC9JA8s/h4Gnx5azz4uu80CdCHmvcHxjeT8I2GrlH+u4pssOt9ppaWWGV98t92UzL6zt8OVw8EGxZig4vplCERbhoGr7uC0L3jqhztOLBAFE97OUM4f+Yhqqp/sXVGwdPkbmrr5uMOalZFlb499ID2It49w4finpI/8hGIprsV7lUCKQ+lnngWMm7ygqakEc5o59SzsTMCiTahbub1+XdKSVuNn4+ocNe+mXu/HD+1jekfo9+wNLuYUxEDoH9uGv96VyZteiT8E6JUSLJHLCcwCyqS20WaXQqeHCxSF0VZr2PAWddb4GEiPb5RqSn0i0w2G0Zy2BHoTH7g496I/7KBb3+A8R9WXOhLB0PRP76Sp6m3rbZUdeZl+5ySnT1p/M2R3EvT7RJ+f6bRls0Teo8Qi9vf5tKd4KxR4twwauOPXXIUsyLsxKa/7zXo5WnD3zYpkHr8yavb0n9PU8r3ShcgmcOS9dsi0reEfR4qblTMxWKWLYt4qGyZVvjHcy2Qtf4bkN7UeK+jj7cAOtcTUsvpTYmvIMy0zNQDn2JEsVCybhchbd6CCS5Z3Z5dzTzyFPJ6DRdZrnCflEUn3a7gIhijoD7gzZoyMMnAkmPWSj/jKUcrrB1ckq3nqBq7YZwTs4nHOWlH8zgtjfCystxHbRCJxf0nXIEdLCNHreivI5cjgIDO41pnxIhTJ8Zwjh82QFe4+YrSizSRnCVKVDcuVoR4cENlFE2tS13xkJp9FCz545F03GpE+PtGB2cpxMD9YeGGuDF45HTvVJ340k1uRPmFCuq03h8cdoih1gVjqwMuoPIxjvYYMFnCToRKzVp/38SOxQtc/VqoJdMir6cZGlS6TrVrB7GecyvZ2HwHa529jDqLRgJ38xXmN0GKzIbJbRg9RxkdRSLXbw+/10I/85yV5KiNwdisxpK9/zfVzBeAGLA8CWvl4x6MG6W7sQ0e4g= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(7416014)(52116014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WIckJxLTV4MCmPDkJMPDxpxFAQ08DpPKuysB7m4eAN3LFR03iuH3kVr57jw+savJw3JvK6G8fgDuBivazAUvvNyIMWRtgP/8z7v7oemY5YeUqMgBZBN3nOJD+uSV0lTLgxtYaAaLFORhDVWYotmfcgHf3tPqcU2kaNyXQUpR3PEUP6dFBfQO67gCgHmJDLDYRH6Upididk4K7/RjJGpb9MGnoNnwKdk8VpmDiMmfUCvUD0gkgvc+aQaxxE4K9UqO/QS8SJtu+xLTp8ZpvswK/yEhVIfgDh1zvZ5ozuosGnYeYagyvMwMXvKcBo8lFAl5255pzd8NYKk7DYP9oxcFsxwY5ErJ/WTBWGZfzKJGIeDzaTciZ2NXcK29cxih3iwSLdnM0XlSBx96AmQ9VtAFTOzFvXQkGB7A2ZEfvKYKRfKnIPdSaqgrsLwXfhYbG6kw2HwXxAHiwQm5l+ZYUXRjrNHilo7XEauZO456Uel2ROSifxS0ZYpRJ6KcgBwXgDymPfbJKSrmFKdCY+8ZY+51N5ZUEScxIbvAB7qyHhdvhi8Hp4rOt1XgC890cIrQqs6CHFOlZ982ZAzU509NW0cKhxfz5dZey9Yqb0rLF19pI/lN/skAEtxx6C3BU1GPpG+j/rgntuXt72LwgSg9HrUWGs8n+ExU0Hfc8UVwRCXaJ+w3Iy9f/XdbjlIs2FQtnOO/4bNI+GfbLxRH8avFojgUWw0rdCi9EKIBHxM28LI2VniqfSVcd/kIS0DbRUrDmY1zsGFhwuuH3qODMhO/LFa7StdILoDoRTYX11cyL6DpUJmzXrcvcb2CU4O0IzLUNTK6cp15x3oAoyiq114kHE+W0ybsV05scR7fLCaQ7POp7wIH/Jr/ecT2gLovPjWo23rcn5Ivf6U/F1fxUTgnHsWxpB0v39QhD4la0iJiwf/ORvhqU0f8QzNIPQ936Hze5CsXu1v6KEevbYj5EB7XCLMaLCQppHZrx1RaSav5DKSOTS89za2DyuBPacEmF8pyNHIV5LCQh43QLP2KscRgmes2XzRgL3JYA0WZOURBRZUYW65nCV1+4zuEufdGa2XFkkWsALKA8KY5THeDP7x4pGDPzm+hTf/8iNywYP0BjccrmOBBZ0wvE4pGDe7u7Wms8VmEughsmUqEBlZE70fPIPh2VxgHrug2lzj39OjjMA18amveLiE9v/CHfpgWAOaV8eEDnrdR6PQuNZyjwkCQGSd5THJngSoNj4zMd6QedbpkvAlaZqsSZALhzRrYzpiJny7puqKirZxm9TcaOuUby/F3haFeUTiht7hoNoF+L7spuJhrFGSBiMbAAzJ2w58+8ttk0XrbnNr9uTVs+9/rUXqxVLKhhvWQJaVGew409S0OBIlVhVmLJL0qT2Ojs+mQtJ0549zktcKuckRuSLxhVumTQ2GH2EdG6XSqzGO/z8w5jSj/VA0j+SjT9/3N4EMItsC7Crz6KwPayyKrrfVtPyAjTpPIBHi64cmwSF1SHKtSwWRK+MPUdr9jRakGZYe4xuLpta0/jGuf2A5myw5rny3MbjE4qWATPjQ4vHbmyQsymr5qNd6SWiKSsOL1aeG5pdnP X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 648e28ae-aaac-4ed1-1bfe-08dced1b3911 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:13:55.9648 (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: gGrFs0CEF9fIlVzq+4xzCmaBbg5ZZg5xYZFoO54LdwPgtBDu1W8GBjgxtOpAZtVPOAaxxMR0bCuGKLM4HoJNKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11041 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 --- v2 changes: 1. Add linux/bits.h 2. Remove the useless check at the beginning of netc_blk_ctrl_probe(). 3. Use dev_err_probe() in netc_blk_ctrl_probe(). --- drivers/net/ethernet/freescale/enetc/Kconfig | 14 + drivers/net/ethernet/freescale/enetc/Makefile | 3 + .../ethernet/freescale/enetc/netc_blk_ctrl.c | 472 ++++++++++++++++++ include/linux/fsl/netc_global.h | 39 ++ 4 files changed, 528 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..5c277910d538 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 \ No newline at end of file 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..62c912aeeb5d --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c @@ -0,0 +1,472 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* + * NXP NETC Blocks Control Driver + * + * Copyright 2024 NXP + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* NETCMIX registers */ +#define IMX95_CFG_LINK_IO_VAR 0x0 +#define IO_VAR_16FF_16G_SERDES 0x1 +#define IO_VAR(port, var) (((var) & 0xf) << ((port) << 2)) + +#define IMX95_CFG_LINK_MII_PROT 0x4 +#define CFG_LINK_MII_PORT_0 GENMASK(3, 0) +#define CFG_LINK_MII_PORT_1 GENMASK(7, 4) +#define MII_PROT_MII 0x0 +#define MII_PROT_RMII 0x1 +#define MII_PROT_RGMII 0x2 +#define MII_PROT_SERIAL 0x3 +#define MII_PROT(port, prot) (((prot) & 0xf) << ((port) << 2)) + +#define IMX95_CFG_LINK_PCS_PROT(a) (0x8 + (a) * 4) +#define PCS_PROT_1G_SGMII BIT(0) +#define PCS_PROT_2500M_SGMII BIT(1) +#define PCS_PROT_XFI BIT(3) +#define PCS_PROT_SFI BIT(4) +#define PCS_PROT_10G_SXGMII BIT(6) + +/* NETC privileged register block register */ +#define PRB_NETCRR 0x100 +#define NETCRR_SR BIT(0) +#define NETCRR_LOCK BIT(1) + +#define PRB_NETCSR 0x104 +#define NETCSR_ERROR BIT(0) +#define NETCSR_STATE BIT(1) + +/* NETC integrated endpoint register block register */ +#define IERB_EMDIOFAUXR 0x344 +#define IERB_T0FAUXR 0x444 +#define IERB_EFAUXR(a) (0x3044 + 0x100 * (a)) +#define IERB_VFAUXR(a) (0x4004 + 0x40 * (a)) +#define FAUXR_LDID GENMASK(3, 0) + +/* Platform information */ +#define IMX95_ENETC0_BUS_DEVFN 0x0 +#define IMX95_ENETC1_BUS_DEVFN 0x40 +#define IMX95_ENETC2_BUS_DEVFN 0x80 + +/* Flags for different platforms */ +#define NETC_HAS_NETCMIX BIT(0) + +struct netc_devinfo { + u32 flags; + int (*netcmix_init)(struct platform_device *pdev); + int (*ierb_init)(struct platform_device *pdev); +}; + +struct netc_blk_ctrl { + void __iomem *prb; + void __iomem *ierb; + void __iomem *netcmix; + struct clk *ipg_clk; + + 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, "nxp,imx95-enetc")) + 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) +{ + u32 val; + + val = netc_reg_read(priv->prb, PRB_NETCSR); + if (val & 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; + void __iomem *regs; + int err; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->pdev = pdev; + priv->ipg_clk = devm_clk_get_optional(dev, "ipg_clk"); + if (IS_ERR(priv->ipg_clk)) { + err = PTR_ERR(priv->ipg_clk); + dev_err_probe(dev, err, "Get ipg_clk failed\n"); + return err; + } + + err = clk_prepare_enable(priv->ipg_clk); + if (err) { + dev_err_probe(dev, err, "Enable ipg_clk failed\n"); + goto disable_ipg_clk; + } + + id = of_match_device(netc_blk_ctrl_match, dev); + if (!id) { + err = -EINVAL; + dev_err_probe(dev, err, "Cannot match device\n"); + goto disable_ipg_clk; + } + + devinfo = (struct netc_devinfo *)id->data; + if (!devinfo) { + err = -EINVAL; + dev_err_probe(dev, err, "No device information\n"); + goto disable_ipg_clk; + } + priv->devinfo = devinfo; + + regs = devm_platform_ioremap_resource_byname(pdev, "ierb"); + if (IS_ERR(regs)) { + err = PTR_ERR(regs); + dev_err_probe(dev, err, "Missing IERB resource\n"); + goto disable_ipg_clk; + } + priv->ierb = regs; + + regs = devm_platform_ioremap_resource_byname(pdev, "prb"); + if (IS_ERR(regs)) { + err = PTR_ERR(regs); + dev_err_probe(dev, err, "Missing PRB resource\n"); + goto disable_ipg_clk; + } + priv->prb = regs; + + if (devinfo->flags & NETC_HAS_NETCMIX) { + regs = devm_platform_ioremap_resource_byname(pdev, "netcmix"); + if (IS_ERR(regs)) { + err = PTR_ERR(regs); + dev_err_probe(dev, err, "Missing NETCMIX resource\n"); + goto disable_ipg_clk; + } + priv->netcmix = regs; + } + + platform_set_drvdata(pdev, priv); + + if (devinfo->netcmix_init) { + err = devinfo->netcmix_init(pdev); + if (err) { + dev_err_probe(dev, err, "Initializing NETCMIX failed\n"); + goto disable_ipg_clk; + } + } + + err = netc_ierb_init(pdev); + if (err) { + dev_err_probe(dev, err, "Initializing IERB failed\n"); + goto disable_ipg_clk; + } + + 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) { + dev_err_probe(dev, err, "of_platform_populate failed\n"); + goto remove_debugfs; + } + + return 0; + +remove_debugfs: + netc_blk_ctrl_remove_debugfs(priv); +disable_ipg_clk: + clk_disable_unprepare(priv->ipg_clk); + + return err; +} + +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); + clk_disable_unprepare(priv->ipg_clk); +} + +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..f26b1b6f8813 --- /dev/null +++ b/include/linux/fsl/netc_global.h @@ -0,0 +1,39 @@ +/* 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); +} + +#ifdef ioread64 +static inline u64 netc_read64(void __iomem *reg) +{ + return ioread64(reg); +} +#else +static inline u64 netc_read64(void __iomem *reg) +{ + u32 low, high; + u64 val; + + low = ioread32(reg); + high = ioread32(reg + 4); + + val = (u64)high << 32 | low; + + return val; +} +#endif + +static inline void netc_write(void __iomem *reg, u32 val) +{ + iowrite32(val, reg); +} + +#endif From patchwork Tue Oct 15 12:58:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836357 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAC172281D8; Tue, 15 Oct 2024 13:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998056; cv=fail; b=hgZfxKY33x5+X1HqFtra3cwEy2e+dj6nejs1g0M5eufZm24JtePr9dD/9r8BWyd8V3iG4LH8WM/lHxSD/DTeD373KyxC69vP+FEFMAWA0e+99pizoiEHQE+u0L4o1fvXyXBAUBC3US253KaZA/ywJwNDzaCor3anFzl5vr1yU84= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998056; c=relaxed/simple; bh=rmBKb/g1LIxBAei6hcbiymqGc9ncmmzjPEbBmArZjK4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=LtOeCUMhMAChTPGReOgu1zgIcVbS/xKOonlf3JCzNaO3WXmR27WKuciRJ1OYaRITJIFP2y7M2GpUE7mG+qqxluztaFrP8pfL1i+YhXoFuUr3suuEZdIiCnSjnKkGB64C38yg4X8jhGTMKDuWaoSpbGS0gElhIkDbMLXNsm9f78E= 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=Dj4glOPU; arc=fail smtp.client-ip=40.107.22.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Dj4glOPU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n3EI/AIcGK3YHG5lB2CxcFhCD210cCFxL/xTzrHKPV6cHwv5rzz9UHuwNreu2uJ/mfwS2ZJ2fz/9Ma0ItLdDM9FdrUdBcOE0Lkl0RG/h0qvs9JSRvOTZEBeaRPWqTKdkLtXZ3lMxLyt/0d2Y3P3Ql7crqNzg1zbYWiXEGqSSvje9BCRQ/7o4oZMwYBDX/jxNPuszUHwMgIqcRvicq0TKjtw6FVsczx9OGftSD15eLPZkV0+pDpwKWEaoqQbxHK91/TKCA/K3Zeh1R1oqjMGncsfnaI708EJiBg6/6YDNrfqff0TfIXJd0NYd23XzU4ZsmYjx6HY6FYBDOH/yh4B1vQ== 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=hRhAdL9GW3rTCSOeBdOXsogL4MAIz5gKonT1u4/rBUo=; b=qGnRwCY/VOjt8BQgqQimmR0ilZVRYLjVgYo6M2kKkL0JsA//sTx5ewCtgq1CgQCM6YgdnfN/gPms0b+QtjJACWcjvkXoOCE/M+/pVk/GRMPa7Mnxajg8xH7rpbWMZXUtzgXMmCy0nQo+0n5lAjdXiS7ozAZGtKbp7+janh1gqk/fw1vdI6TTRvBYHnYLjLdeLVZwAiKnXVr5Fgu+XTxqjsFfQTW1UNT8AHENm6XahLVZNBrZYplhqiLP9Gvxq1yC0cLZniZ2nhTXCOxP/XGTOPsMAlis5StpHOzRZhFmp6XZ+ywB8pv3Hf0Hhpm56vEC02go/g/cgL2OLBVRPyVBCw== 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=hRhAdL9GW3rTCSOeBdOXsogL4MAIz5gKonT1u4/rBUo=; b=Dj4glOPUrdJny4NCXCgeHrnXp1p727CbV4+xd2/dQcVvVDhzstFADWBswxEGe5fIeixoqwol5Fx7Fade83qHMclVubnDmDiInb1BuxEUcxZfC6dPMnFHK+DP8buGBfHnItd0pPMB+/A00mS6PS6anwwU/heQ0jTiSW/NMTUY/vzRxjeXziWcGW8j+zaKOCVxJxJQp+EfK2eQRWQ2SdnZp3JM7GAlaJT2UUQ5mT9aff8VTxlTBy7qz+zyff+mbYoMAfdi4YZ9kAiTSRJTcHOnZgseO2R//mzki7oJLUe4P3vg2jRF6aIlXehhAyZxWWq7uDRzRrE6fXrdJ6aH86OVMQ== 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 GVXPR04MB11041.eurprd04.prod.outlook.com (2603:10a6:150:218::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 13:14:03 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8026.019; Tue, 15 Oct 2024 13:14:03 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 05/13] net: enetc: move some common interfaces to enetc_pf_common.c Date: Tue, 15 Oct 2024 20:58:33 +0800 Message-Id: <20241015125841.1075560-6-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|GVXPR04MB11041:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e164b46-a21c-4652-2064-08dced1b3c6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|7416014|52116014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: zx8rAnbkbli3X08W1NB3lbBX8R2xL7+ZDdaPLaN8QC2lCRLH+2tulmsD0y25rI1KxRn1dh4999tqorX5pg2/MHSLDf7NHG9aMhqsMSmqNMJvzAaJjA653fezYO9Q/xknD7w3iP3S/+/OgRkkbL2Zx/DTJgg7jR/MiXIvpMNG9tJD4zSJHWDcv1qCMPXeLNDDLcYxt+FumMZRzaknOBpq7S1TH92W8S8Zyl/Bo3eUkRHvyWb4KR9Z0jYUYRjcZrZjtFV8Gw3VQFKAT68tE2CLFiESeO5Ad0TopAu9QdQHLInJ0IpaAVpiowQvSmqzFNXqKekKqASp7J7pkIGaFN7qXT3yXk4Fg2ru8M6aeuhXYHD1MOeT2ScldcL4VMTKwfnpf0z130vWA9D/dY1ySQI9XkDCFBs3LkuifJhwIHVr88B/AjgLIDLKrSMHSN38BZ54nSSOLZxLWk6vcCqIQaKpwqnpsyHWNwXkO+grv4+aoT9AkHPfL0PSzKioufeOLsYLkK5ftA0BKEQWuGok9URrIN8Cwrbn37/K88Ve4kT3yAulYSxZ8vZGPD9+0/7eHKeFrslc589Zb8ArqMnQVGXq4z1UJmAVP4oerNS05scLonrt3dCO8JOFNSXhqNYOeKXCnIwnJjhsBaJc8sjJZCFKOdrpHfwCMzwRHrF0VrzY9QM5Q2+MkjERgAlh/ZqrSAHYyHCFOrGcPGIZuNxLI7Tl2ZX2ZSHLWwjsbd+WwJg1hdtJfb7jvu4fJ8VP8ilfikfQqGHqfSqFGN7wTCbX75kVjcYzreupksTfBrRU0JvnEFrw//VgFcENHXJ9kDsp2uqHup1+omI5S9lvomU/l9hUZjTAnfePsXsNGJHRreBXkPnr2kwq4H9iaH34DupXMpSuJMSgDp/q3I9cIdTaEPfBToWNMoutyV/U3Oo5YAj1eeX8ZeRrK/S/5qp69DhZBrnpJL+RqmuXxnVGl70lpEa/XAu79nvUy1ZqyiG2HxIJcJ4Ot3pYj0P1NEad1sFitdC0QlVGCWJ37VscmzxAS2OQxgtxfeumTs28vq5FlC2XSooJ6/xJxhbICny6YYcu+Mi5AmiLvibizSdcF0Zj01lK3z1B0nQXykBJITTDdKwNEHvwB6oeDSv1vxyMURokcKZCWDYeVXKT4IUrJjs9Fl5//N1F5OowVNXbjapDInWaAEGgGSeDthNm2mbF2s3zVi5wz4e4AfCELBg2y15WNQJj9En+oXpPkjX+dU0V4LHc/EpCb1HcxDgG6E6iGQK2xBo5YbQ2AX9r+pje/poqh652RfiMQihXACMSJSFksSDwVVu3Z+HuEXij7KobxqKxa+GNBR0JQE5sI/Q2nuvlalPaWwCjfvudI/RZg3sp9AukTkQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(7416014)(52116014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: V+vMtzwuIKgiiXNbTGrFTLLMhNNLZNsdx4BpaWVc6bMxmkANDG7S68gvWK3LsXl4GdBveiqxhB2UcYRp99sg/Zolt7tBJVk/sPDdwfvU//l2pwJ9PyLc+SvevTIufj2tSgsbLfJrLkDIS9STYoIyxY05zKxZhVp1/UGU5ktHhMAKxLO3Sl8Pdr7s7eZB/j0GIKtdCd0+1tkopNxd8fnZoo7Z4V662fcemCYjClUU8C7hJd0tBU+Gr92cL8ee9nZHC6trMeJa7T4ty6JlVk4w3d5JzFLxdNn0ZudiDF9ekjqdt9Vaq0phJIr7Txy98s14e1AtbdtDJagfy7C2yn0hPaG1ZXZtjzPZZP6GmUFOKgtSLlvGEtZQCjoFCv2iboRG/f9Bq71EZWOYLpt96QuQGy2Gi9TbYYSnhrtlv6hiWqhluTbCDIxl+k2c5gylpZNRYYWFWY64cGaIqNaFXDNLwTqFY9cnB+e8OoFkXt4+QWQPj+N0l7Ka1hlaytuHqx8FEbpWp4QrME34K4d5KIPS/JLVht1i4SyT1XVEzJSpKr27ryMVgVfyrYHQaXg/6Rq4MYny7re6i8CHp8Ukvlo8NqHBoTKIrw9ESGNG6TZYbIQlp6Ekfgd1OoAqncd4clQQjQpLE2CI+rA9wRLZgVNO91qzt26Go0tXknSt55stXF/qU40BR6lu+HfpNvRCYyQ+imifHwOHtFjzUXG+ZJlmXWzjI8PSOY53e81v/agrFz8lRyIxzYR6EfEqntu8q9NJCcBnmjptZ1nKCRaGn4Pc3rv6NuPMC5X3rITCeXrdndBcAYR/FXzJtgXvOfa32FNpD5mLD21PizJDDLQnzlckDlROg18zLRsq+c7bKi9B1vNqU7IhW7Xb5KnCoyiwcJkXB/jwKXXTOcxJZXc2N7BaBvFlBBQKWBPYyZ0DWra3W2HT3gjb49zlbuyBbDuSppQe80UFpndQ6fJvmUOYlnNgznSMLIUUlsq+VhxIWsj0PnDRJecbhwxAigJsHWgBMZk1PB6fIIYkzpk60Y7n75xK5eK4zkZd6cnpN1WP9h3P9aMRZYqs/P4k/Ser9iPcVB5UVBdFjeUZgNtUbeY/gaz3jmL07jN5O1VF64qozoIwi5uMiKpXwYfqsgpIjpntxiwmr41sbvRDy2CZVnY91vyOAWJrtehynOhzlAIHQe/p2gB2zUSnOopNgDCB1EKO4qQiEUvM+gxLS2IJYMqY2vN+F0OK+T9D6H4OtFfM5pV5BkQXeL7f6h2870VlSJOWB85rXQUgbIB0jDxTr4i2nCC/cXkgNcD+tGMi7tDagsqWxKJBsyoCdv86fFkg5btrNUU77OcUK6IzCLK+ki/JqJ4u6ugEQDuEyxF9WZD+GpQRbcrwAwKiKeWIN1dslgj59sKRjECPOZPcepOvXapuEraBdSy9khXIPWGTmwxVm+d5lr4hItzrbbR7ysif+a6khD3pZrGHHX06Oa0OLM/ZIDe8bapNM/USg+jzdNUlDPGYW+vx8Xc2DGnQSe9JJYvbHxgQU7p96ghPunPP9VLt83i+ZqJghwR9xqd1iaH+ScCwMh17utt2g3/SD6lmee14LLaD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e164b46-a21c-4652-2064-08dced1b3c6b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:01.6171 (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: hb3F/DkhTvH1djWcf67woI4F4WhyOUA6sqcn4TimOA/1SSzrd4ns22P5VlMokMvWO0LlvqNEJjFjl+K9nCYoug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11041 The ENETC of LS1028A is revision 1.0. Now, ENETC is used on the i.MX95 platform and the revision is upgraded to version 4.1. The two versions are incompatible except for the station interface (SI) part. Therefore, A new driver is needed for ENETC revision 4.1 and later. However, the logic of some interfaces of the two drivers is basically the same, and the only difference is the hardware configuration. In order to reuse these interfaces and reduce code redundancy, so extract the interfaces from enetc_pf.c and move them to enetc_pf_common.c. This is just the first step, later enetc_pf_common.c will be compiled into a separate driver for use by both PF drivers. Signed-off-by: Wei Fang --- v2 changes: This patch is separated from v1 patch 5 ("net: enetc: add enetc-pf-common driver support"), it just moved some common functions from enetc_pf.c to enetc_pf_common.c. --- drivers/net/ethernet/freescale/enetc/Makefile | 2 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 297 +----------------- .../net/ethernet/freescale/enetc/enetc_pf.h | 13 + .../freescale/enetc/enetc_pf_common.c | 294 +++++++++++++++++ 4 files changed, 312 insertions(+), 294 deletions(-) create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_pf_common.c diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/ethernet/freescale/enetc/Makefile index 5c277910d538..39675e9ff39d 100644 --- a/drivers/net/ethernet/freescale/enetc/Makefile +++ b/drivers/net/ethernet/freescale/enetc/Makefile @@ -4,7 +4,7 @@ obj-$(CONFIG_FSL_ENETC_CORE) += fsl-enetc-core.o fsl-enetc-core-y := enetc.o enetc_cbdr.o enetc_ethtool.o obj-$(CONFIG_FSL_ENETC) += fsl-enetc.o -fsl-enetc-y := enetc_pf.o +fsl-enetc-y := enetc_pf.o enetc_pf_common.o fsl-enetc-$(CONFIG_PCI_IOV) += enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 8f6b0bf48139..3cdd149056f9 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -2,11 +2,8 @@ /* Copyright 2017-2019 NXP */ #include -#include #include -#include #include -#include #include #include #include "enetc_ierb.h" @@ -14,7 +11,7 @@ #define ENETC_DRV_NAME_STR "ENETC PF driver" -static void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) +void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) { u32 upper = __raw_readl(hw->port + ENETC_PSIPMAR0(si)); u16 lower = __raw_readw(hw->port + ENETC_PSIPMAR1(si)); @@ -23,8 +20,8 @@ static void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) put_unaligned_le16(lower, addr + 4); } -static void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, - const u8 *addr) +void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, + const u8 *addr) { u32 upper = get_unaligned_le32(addr); u16 lower = get_unaligned_le16(addr + 4); @@ -33,20 +30,6 @@ static void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, __raw_writew(lower, hw->port + ENETC_PSIPMAR1(si)); } -static int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) -{ - struct enetc_ndev_priv *priv = netdev_priv(ndev); - struct sockaddr *saddr = addr; - - if (!is_valid_ether_addr(saddr->sa_data)) - return -EADDRNOTAVAIL; - - eth_hw_addr_set(ndev, saddr->sa_data); - enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data); - - return 0; -} - static void enetc_set_vlan_promisc(struct enetc_hw *hw, char si_map) { u32 val = enetc_port_rd(hw, ENETC_PSIPVMR); @@ -393,56 +376,6 @@ static int enetc_pf_set_vf_spoofchk(struct net_device *ndev, int vf, bool en) return 0; } -static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, - int si) -{ - struct device *dev = &pf->si->pdev->dev; - struct enetc_hw *hw = &pf->si->hw; - u8 mac_addr[ETH_ALEN] = { 0 }; - int err; - - /* (1) try to get the MAC address from the device tree */ - if (np) { - err = of_get_mac_address(np, mac_addr); - if (err == -EPROBE_DEFER) - return err; - } - - /* (2) bootloader supplied MAC address */ - if (is_zero_ether_addr(mac_addr)) - enetc_pf_get_primary_mac_addr(hw, si, mac_addr); - - /* (3) choose a random one */ - if (is_zero_ether_addr(mac_addr)) { - eth_random_addr(mac_addr); - dev_info(dev, "no MAC address specified for SI%d, using %pM\n", - si, mac_addr); - } - - enetc_pf_set_primary_mac_addr(hw, si, mac_addr); - - return 0; -} - -static int enetc_setup_mac_addresses(struct device_node *np, - struct enetc_pf *pf) -{ - int err, i; - - /* The PF might take its MAC from the device tree */ - err = enetc_setup_mac_address(np, pf, 0); - if (err) - return err; - - for (i = 0; i < pf->total_vfs; i++) { - err = enetc_setup_mac_address(NULL, pf, i + 1); - if (err) - return err; - } - - return 0; -} - static void enetc_port_assign_rfs_entries(struct enetc_si *si) { struct enetc_pf *pf = enetc_si_priv(si); @@ -775,187 +708,6 @@ static const struct net_device_ops enetc_ndev_ops = { .ndo_xdp_xmit = enetc_xdp_xmit, }; -static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, - const struct net_device_ops *ndev_ops) -{ - struct enetc_ndev_priv *priv = netdev_priv(ndev); - - SET_NETDEV_DEV(ndev, &si->pdev->dev); - priv->ndev = ndev; - priv->si = si; - priv->dev = &si->pdev->dev; - si->ndev = ndev; - - priv->msg_enable = (NETIF_MSG_WOL << 1) - 1; - ndev->netdev_ops = ndev_ops; - enetc_set_ethtool_ops(ndev); - ndev->watchdog_timeo = 5 * HZ; - ndev->max_mtu = ENETC_MAX_MTU; - - ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK | - NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; - ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; - ndev->vlan_features = NETIF_F_SG | NETIF_F_HW_CSUM | - NETIF_F_TSO | NETIF_F_TSO6; - - if (si->num_rss) - ndev->hw_features |= NETIF_F_RXHASH; - - ndev->priv_flags |= IFF_UNICAST_FLT; - ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | - NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | - NETDEV_XDP_ACT_NDO_XMIT_SG; - - if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { - priv->active_offloads |= ENETC_F_QCI; - ndev->features |= NETIF_F_HW_TC; - ndev->hw_features |= NETIF_F_HW_TC; - } - - /* pick up primary MAC address from SI */ - enetc_load_primary_mac_addr(&si->hw, ndev); -} - -static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np) -{ - struct device *dev = &pf->si->pdev->dev; - struct enetc_mdio_priv *mdio_priv; - struct mii_bus *bus; - int err; - - bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); - if (!bus) - return -ENOMEM; - - bus->name = "Freescale ENETC MDIO Bus"; - bus->read = enetc_mdio_read_c22; - bus->write = enetc_mdio_write_c22; - bus->read_c45 = enetc_mdio_read_c45; - bus->write_c45 = enetc_mdio_write_c45; - bus->parent = dev; - mdio_priv = bus->priv; - mdio_priv->hw = &pf->si->hw; - mdio_priv->mdio_base = ENETC_EMDIO_BASE; - snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev)); - - err = of_mdiobus_register(bus, np); - if (err) - return dev_err_probe(dev, err, "cannot register MDIO bus\n"); - - pf->mdio = bus; - - return 0; -} - -static void enetc_mdio_remove(struct enetc_pf *pf) -{ - if (pf->mdio) - mdiobus_unregister(pf->mdio); -} - -static int enetc_imdio_create(struct enetc_pf *pf) -{ - struct device *dev = &pf->si->pdev->dev; - struct enetc_mdio_priv *mdio_priv; - struct phylink_pcs *phylink_pcs; - struct mii_bus *bus; - int err; - - bus = mdiobus_alloc_size(sizeof(*mdio_priv)); - if (!bus) - return -ENOMEM; - - bus->name = "Freescale ENETC internal MDIO Bus"; - bus->read = enetc_mdio_read_c22; - bus->write = enetc_mdio_write_c22; - bus->read_c45 = enetc_mdio_read_c45; - bus->write_c45 = enetc_mdio_write_c45; - bus->parent = dev; - bus->phy_mask = ~0; - mdio_priv = bus->priv; - mdio_priv->hw = &pf->si->hw; - mdio_priv->mdio_base = ENETC_PM_IMDIO_BASE; - snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); - - err = mdiobus_register(bus); - if (err) { - dev_err(dev, "cannot register internal MDIO bus (%d)\n", err); - goto free_mdio_bus; - } - - phylink_pcs = lynx_pcs_create_mdiodev(bus, 0); - if (IS_ERR(phylink_pcs)) { - err = PTR_ERR(phylink_pcs); - dev_err(dev, "cannot create lynx pcs (%d)\n", err); - goto unregister_mdiobus; - } - - pf->imdio = bus; - pf->pcs = phylink_pcs; - - return 0; - -unregister_mdiobus: - mdiobus_unregister(bus); -free_mdio_bus: - mdiobus_free(bus); - return err; -} - -static void enetc_imdio_remove(struct enetc_pf *pf) -{ - if (pf->pcs) - lynx_pcs_destroy(pf->pcs); - if (pf->imdio) { - mdiobus_unregister(pf->imdio); - mdiobus_free(pf->imdio); - } -} - -static bool enetc_port_has_pcs(struct enetc_pf *pf) -{ - return (pf->if_mode == PHY_INTERFACE_MODE_SGMII || - pf->if_mode == PHY_INTERFACE_MODE_1000BASEX || - pf->if_mode == PHY_INTERFACE_MODE_2500BASEX || - pf->if_mode == PHY_INTERFACE_MODE_USXGMII); -} - -static int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node) -{ - struct device_node *mdio_np; - int err; - - mdio_np = of_get_child_by_name(node, "mdio"); - if (mdio_np) { - err = enetc_mdio_probe(pf, mdio_np); - - of_node_put(mdio_np); - if (err) - return err; - } - - if (enetc_port_has_pcs(pf)) { - err = enetc_imdio_create(pf); - if (err) { - enetc_mdio_remove(pf); - return err; - } - } - - return 0; -} - -static void enetc_mdiobus_destroy(struct enetc_pf *pf) -{ - enetc_mdio_remove(pf); - enetc_imdio_remove(pf); -} - static struct phylink_pcs * enetc_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t iface) { @@ -1101,47 +853,6 @@ static const struct phylink_mac_ops enetc_mac_phylink_ops = { .mac_link_down = enetc_pl_mac_link_down, }; -static int enetc_phylink_create(struct enetc_ndev_priv *priv, - struct device_node *node) -{ - struct enetc_pf *pf = enetc_si_priv(priv->si); - struct phylink *phylink; - int err; - - pf->phylink_config.dev = &priv->ndev->dev; - pf->phylink_config.type = PHYLINK_NETDEV; - pf->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | - MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD; - - __set_bit(PHY_INTERFACE_MODE_INTERNAL, - pf->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_SGMII, - pf->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_1000BASEX, - pf->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_2500BASEX, - pf->phylink_config.supported_interfaces); - __set_bit(PHY_INTERFACE_MODE_USXGMII, - pf->phylink_config.supported_interfaces); - phy_interface_set_rgmii(pf->phylink_config.supported_interfaces); - - phylink = phylink_create(&pf->phylink_config, of_fwnode_handle(node), - pf->if_mode, &enetc_mac_phylink_ops); - if (IS_ERR(phylink)) { - err = PTR_ERR(phylink); - return err; - } - - priv->phylink = phylink; - - return 0; -} - -static void enetc_phylink_destroy(struct enetc_ndev_priv *priv) -{ - phylink_destroy(priv->phylink); -} - /* Initialize the entire shared memory for the flow steering entries * of this port (PF + VFs) */ @@ -1338,7 +1049,7 @@ static int enetc_pf_probe(struct pci_dev *pdev, if (err) goto err_mdiobus_create; - err = enetc_phylink_create(priv, node); + err = enetc_phylink_create(priv, node, &enetc_mac_phylink_ops); if (err) goto err_phylink_create; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h index c26bd66e4597..92a26b09cf57 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -58,3 +58,16 @@ struct enetc_pf { int enetc_msg_psi_init(struct enetc_pf *pf); void enetc_msg_psi_free(struct enetc_pf *pf); void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int mbox_id, u16 *status); + +void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr); +void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, + const u8 *addr); +int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr); +int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf); +void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, + const struct net_device_ops *ndev_ops); +int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node); +void enetc_mdiobus_destroy(struct enetc_pf *pf); +int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node, + const struct phylink_mac_ops *ops); +void enetc_phylink_destroy(struct enetc_ndev_priv *priv); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c new file mode 100644 index 000000000000..be6aec19b1f3 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -0,0 +1,294 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2024 NXP */ +#include +#include +#include +#include + +#include "enetc_pf.h" + +int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct sockaddr *saddr = addr; + + if (!is_valid_ether_addr(saddr->sa_data)) + return -EADDRNOTAVAIL; + + eth_hw_addr_set(ndev, saddr->sa_data); + enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data); + + return 0; +} + +static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, + int si) +{ + struct device *dev = &pf->si->pdev->dev; + struct enetc_hw *hw = &pf->si->hw; + u8 mac_addr[ETH_ALEN] = { 0 }; + int err; + + /* (1) try to get the MAC address from the device tree */ + if (np) { + err = of_get_mac_address(np, mac_addr); + if (err == -EPROBE_DEFER) + return err; + } + + /* (2) bootloader supplied MAC address */ + if (is_zero_ether_addr(mac_addr)) + enetc_pf_get_primary_mac_addr(hw, si, mac_addr); + + /* (3) choose a random one */ + if (is_zero_ether_addr(mac_addr)) { + eth_random_addr(mac_addr); + dev_info(dev, "no MAC address specified for SI%d, using %pM\n", + si, mac_addr); + } + + enetc_pf_set_primary_mac_addr(hw, si, mac_addr); + + return 0; +} + +int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf) +{ + int err, i; + + /* The PF might take its MAC from the device tree */ + err = enetc_setup_mac_address(np, pf, 0); + if (err) + return err; + + for (i = 0; i < pf->total_vfs; i++) { + err = enetc_setup_mac_address(NULL, pf, i + 1); + if (err) + return err; + } + + return 0; +} + +void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, + const struct net_device_ops *ndev_ops) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + + SET_NETDEV_DEV(ndev, &si->pdev->dev); + priv->ndev = ndev; + priv->si = si; + priv->dev = &si->pdev->dev; + si->ndev = ndev; + + priv->msg_enable = (NETIF_MSG_WOL << 1) - 1; + ndev->netdev_ops = ndev_ops; + enetc_set_ethtool_ops(ndev); + ndev->watchdog_timeo = 5 * HZ; + ndev->max_mtu = ENETC_MAX_MTU; + + ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK | + NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; + ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6; + ndev->vlan_features = NETIF_F_SG | NETIF_F_HW_CSUM | + NETIF_F_TSO | NETIF_F_TSO6; + + if (si->num_rss) + ndev->hw_features |= NETIF_F_RXHASH; + + ndev->priv_flags |= IFF_UNICAST_FLT; + ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT | + NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG | + NETDEV_XDP_ACT_NDO_XMIT_SG; + + if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { + priv->active_offloads |= ENETC_F_QCI; + ndev->features |= NETIF_F_HW_TC; + ndev->hw_features |= NETIF_F_HW_TC; + } + + /* pick up primary MAC address from SI */ + enetc_load_primary_mac_addr(&si->hw, ndev); +} + +static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np) +{ + struct device *dev = &pf->si->pdev->dev; + struct enetc_mdio_priv *mdio_priv; + struct mii_bus *bus; + int err; + + bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); + if (!bus) + return -ENOMEM; + + bus->name = "Freescale ENETC MDIO Bus"; + bus->read = enetc_mdio_read_c22; + bus->write = enetc_mdio_write_c22; + bus->read_c45 = enetc_mdio_read_c45; + bus->write_c45 = enetc_mdio_write_c45; + bus->parent = dev; + mdio_priv = bus->priv; + mdio_priv->hw = &pf->si->hw; + mdio_priv->mdio_base = ENETC_EMDIO_BASE; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev)); + + err = of_mdiobus_register(bus, np); + if (err) + return dev_err_probe(dev, err, "cannot register MDIO bus\n"); + + pf->mdio = bus; + + return 0; +} + +static void enetc_mdio_remove(struct enetc_pf *pf) +{ + if (pf->mdio) + mdiobus_unregister(pf->mdio); +} + +static int enetc_imdio_create(struct enetc_pf *pf) +{ + struct device *dev = &pf->si->pdev->dev; + struct enetc_mdio_priv *mdio_priv; + struct phylink_pcs *phylink_pcs; + struct mii_bus *bus; + int err; + + bus = mdiobus_alloc_size(sizeof(*mdio_priv)); + if (!bus) + return -ENOMEM; + + bus->name = "Freescale ENETC internal MDIO Bus"; + bus->read = enetc_mdio_read_c22; + bus->write = enetc_mdio_write_c22; + bus->read_c45 = enetc_mdio_read_c45; + bus->write_c45 = enetc_mdio_write_c45; + bus->parent = dev; + bus->phy_mask = ~0; + mdio_priv = bus->priv; + mdio_priv->hw = &pf->si->hw; + mdio_priv->mdio_base = ENETC_PM_IMDIO_BASE; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); + + err = mdiobus_register(bus); + if (err) { + dev_err(dev, "cannot register internal MDIO bus (%d)\n", err); + goto free_mdio_bus; + } + + phylink_pcs = lynx_pcs_create_mdiodev(bus, 0); + if (IS_ERR(phylink_pcs)) { + err = PTR_ERR(phylink_pcs); + dev_err(dev, "cannot create lynx pcs (%d)\n", err); + goto unregister_mdiobus; + } + + pf->imdio = bus; + pf->pcs = phylink_pcs; + + return 0; + +unregister_mdiobus: + mdiobus_unregister(bus); +free_mdio_bus: + mdiobus_free(bus); + return err; +} + +static void enetc_imdio_remove(struct enetc_pf *pf) +{ + if (pf->pcs) + lynx_pcs_destroy(pf->pcs); + + if (pf->imdio) { + mdiobus_unregister(pf->imdio); + mdiobus_free(pf->imdio); + } +} + +static bool enetc_port_has_pcs(struct enetc_pf *pf) +{ + return (pf->if_mode == PHY_INTERFACE_MODE_SGMII || + pf->if_mode == PHY_INTERFACE_MODE_1000BASEX || + pf->if_mode == PHY_INTERFACE_MODE_2500BASEX || + pf->if_mode == PHY_INTERFACE_MODE_USXGMII); +} + +int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node) +{ + struct device_node *mdio_np; + int err; + + mdio_np = of_get_child_by_name(node, "mdio"); + if (mdio_np) { + err = enetc_mdio_probe(pf, mdio_np); + + of_node_put(mdio_np); + if (err) + return err; + } + + if (enetc_port_has_pcs(pf)) { + err = enetc_imdio_create(pf); + if (err) { + enetc_mdio_remove(pf); + return err; + } + } + + return 0; +} + +void enetc_mdiobus_destroy(struct enetc_pf *pf) +{ + enetc_mdio_remove(pf); + enetc_imdio_remove(pf); +} + +int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node, + const struct phylink_mac_ops *ops) +{ + struct enetc_pf *pf = enetc_si_priv(priv->si); + struct phylink *phylink; + int err; + + pf->phylink_config.dev = &priv->ndev->dev; + pf->phylink_config.type = PHYLINK_NETDEV; + pf->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | + MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD; + + __set_bit(PHY_INTERFACE_MODE_INTERNAL, + pf->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, + pf->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + pf->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, + pf->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_USXGMII, + pf->phylink_config.supported_interfaces); + phy_interface_set_rgmii(pf->phylink_config.supported_interfaces); + + phylink = phylink_create(&pf->phylink_config, of_fwnode_handle(node), + pf->if_mode, ops); + if (IS_ERR(phylink)) { + err = PTR_ERR(phylink); + return err; + } + + priv->phylink = phylink; + + return 0; +} + +void enetc_phylink_destroy(struct enetc_ndev_priv *priv) +{ + phylink_destroy(priv->phylink); +} From patchwork Tue Oct 15 12:58:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836356 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 083231EBA0A; Tue, 15 Oct 2024 13:14:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998053; cv=fail; b=MWE78ckXdcMLqhWekUGcbBe/sn6XnV16yZFmf2l9yK9aSQUaOQqrvcYKktsyW7SPVAm9r90PXkpZK64XSQbz/T3bNGk65mctfgsIbnFW2aUTNbVDO6nsFiRigBM9VoEcq+YVlQWFxK2cAsNaags2r7lANvSYO9NVyztsOuoCO3A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998053; c=relaxed/simple; bh=DXxE5sdv9kHRGjXKOaKSZU5gwo4AoPZZDDFXX5BcVSk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=XikuM6nvIFrGbJoVAsuJhqicg2fTjcovlZagQRxmuvtuqtyYIu2YqumkEcmjhhbiaaymkGZ+G4v38btayJGgJZg6QAX+3RCIw0x5ceQ1AeEZp55DziRsxl4Aiv7/0VRNyPjEu49EAFx8tPnuumV/k0g1/p9FldAb3D5JGzbnbNE= 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=VMb0YAoc; arc=fail smtp.client-ip=40.107.22.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="VMb0YAoc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gvq1YS+lp+Rh+okzDUGsP4Zf0nZ1J5qkNdUkxjcVg4KZIDlerJdoTXQRKixBtmGz8Jl+9aqJagQfuJavNkxD9bPZAbLajILjSfhvNVd7eZPlmwCDNPzlk5FzUEeWJrxiFV4lqcPUrqNijLUagWLT55ixF5FGCsuzTKEHYwSaWfUnZ8rMMJTjBZxUTf0BV0V5wFjqH2u9XM21mPkMedi07a3K8hkkZol8uG2Z5R+J5ZyZtnVGQ3bx7FOhL3AOKC13zcq0UN1f9ufiX27/w9Wz3XEBMSkdZdC4z+JNVegHcpHxa+sQOoDPJu5x5v27qCxFPKGsckHjp9e6uyD4JHZpZA== 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=XzgW82gh+W7ywGDGYHLoWXNKz9H9Maz2cK013I48Ogs=; b=g4MI9vpyTjeKv2bqjn7KyLeC+JW145F+5iqXe2xKOsN2eDOAz94mlh4p07x9j/yFTajiytLHKu3djDFM1gFpCtQWe+yHWuWpVhN2bE00VTWBjC5xP6Ht4QbroAvXxjNlVy4dGGpuqR65sMhi+/C7b9u2EOtxV8aO+h8HVW0f8Jr768hKWH+ca5StYkb/CNpMV2Or3GYT5FGH+xLHvJWldbCSqqpEQXzXK/YvEO41yQrhmhoOXJHO52Rs5YMVJ+4QK5XPISiga2UTLfZC3z3pALS71qqIIXeP61ieRIy/T8SEQW0eGDG1Xlqerm/zZpAMNFLbAOdJXMXStRhvU/Z8Lg== 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=XzgW82gh+W7ywGDGYHLoWXNKz9H9Maz2cK013I48Ogs=; b=VMb0YAoc3pEabL5LXyEoVZoWA+4Kg2L+vCHlIMEUqlxZG/L0mxLYb9bIS/TZ6TDfPPiZz+Xqrb3vKpBAj8opI8VWDYNf/WgwMksZLY7R95Dr4whGeV2ZyML5AGIUQImlnGWqMxb3dOF5YxBUfXVGLQfa41OMfN8HrmTmBK1CSelEJOw8BtwK8PrShUMuBm+4JwtjTzX48gklf7gOqGZ4nml+aZSOTEjSlQsUex+QTtLwutmn6UYzrkkIoo+KdknWWpx41yfWSOoHq7asAKsyI6r9ib0Sdim60BYTimtVihYqp4EI1+6hoPlJvAABCLuNqQ/91HolRIfqTNLaCqTNLA== 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 GVXPR04MB11041.eurprd04.prod.outlook.com (2603:10a6:150:218::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 13:14:07 +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.8026.019; Tue, 15 Oct 2024 13:14:07 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 06/13] net: enetc: build enetc_pf_common.c as a separate module Date: Tue, 15 Oct 2024 20:58:34 +0800 Message-Id: <20241015125841.1075560-7-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|GVXPR04MB11041:EE_ X-MS-Office365-Filtering-Correlation-Id: cf43f6b5-d4e1-40bf-ad93-08dced1b3fc2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|7416014|52116014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: X6yCSZQlGrcKCe0cLiqfC8KaBW9E8I0saZ56xIPNAfbuCtDCtLwdRzvvRZwg1dHGC+KNBFEmBJWVzwTeYaOsEZhDwQr5jQufxSaMXMvpCHNTaELFRuw/L8WVgwX11PjPzTgMdd6ZJKDOxvnseyA+WHAcvYtvdcWt94F8C1RAM359/CYvjz90dn9rSzQlWupYvLl5tUCx3w4pZFE0x1H+nFFOwz6o7x0pc7/DC5zd6wQLR5MYgl4yap21Tgm05glC1NcIJr5pkC4p3t5XIwLXPKNFoUEm1Mm0z/Pd5vAxfLGmPU7vP4mcmAHcRe4hZ4/RlxxoJ/DxK6Wkjc3DnN40UHzdM54n3Lq4cutGTWrkBvXLGqFI0LYFGUCTEQx+Petzv1ch4YbPtSwBQ3EtsQJtJqeRwxgg3RO11Yrxi+7nXrTTGZ+rf7mEIlXFb6lZxeRRfaHmL3XV+SSjMQxjphLn+v6oci9VKAWjIGxH9xpUG6Oe7PJiEpsn+pDVdwY2QE23wYsdfXwoYON5PMNQygtcdme1/WDiteJUQj2f6BWCNzY+ieKFkLro/9XFozvn7D2eLVGfB4aGyGMi3h3BivUy8EFgLkphL904sAo0TG3KAbGKPRfSLkBxYF1XeDncAy0G6Im+DREOp90iUwBNsS6NPkSZhYV3WU70Bzt1OeI1BmxfkymrBT7e5I70/4FOcxdcHkJ8ZV4ny7ZohU6UQoW9uu+etruIM9TN1hz9kzaRuR9A8oS+tr+O+Ihx1DnX2bdnQBH4mchmQ7bNyzteQhunlK9U0K2a6vt7kGbDguTxud+aaaiLTLvG0ZSCjVYDyEWkrEKa1e90gpsyu+y5lcon/KbqnG3Al68jNObnprGWeWaVRKMdkdxGIYFNEzOxi8YRBm6JsKjB7XeyRGoz5PVY10IuJkzAfeOshv5ymxlmIkFWRmvL5tMAB0HFCdvLV/VYDDjRZ5FF3E3g6uBTioDeaVFSD551GM5x1YdiNRaQJxOoHGxrmg2J1MQDDad72k5wL8Lj75+akJ/wq4D+5mlRqWQayKsktr2vBA/ZDus91Zek3zzLpcQ+lAiNwdm1dv6Hh7NgaIs//MLq5M30HM0TyQUuzIWvR4cZJt4AMh3KcbOdl+b2Oi/Mkp5av2Tfz06Zsf0YxOjZ/UWuAzlmF/KwstEvOZXM17iHr31vPSmHW3QX6E82XW2nnAuq18sTNOuDzsCRDI1j4/L0uf+okbmrNb7Gp5Srh52aFZ4zuxk/RyuAITbSRJcq0T5CZVoa2x/mu3vtK9+KJwRsqtiTvq0TKJnKaZKJrrOd+pYpSop5XcfdCZ+yf+ZM+2Be8yPuPfpjhD225HSzZUkr9zezQwaQcT7UUluxBVlpK+BrHLp4+Ps= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(7416014)(52116014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QcybJ0r/P9mExUK5M7UrzIgNnTtqGFeExl0FYmRejRa77+7Myl5vRf2BJnYETZWku21YIH4elgitKq0mP4zyfNNuRnTfG/ktY91+X6kFU5ZO57uUHcQtO5xkWKtccBxvKZHNEDrHZs6WG2bHhQpJOR1Z9fLcHit0lXZeqrZXtGmv1iX0RcJwgJpIU2nK43bY5pcLMl/qqzjbxuqvVmevJlOfyZXWOF6i0D6PsfVpOR8jeH8FOuEAkQZC+9lQqX0A8ZfqBBovcHpl32Byb6ruYHJ6kKWJA8xgINB465oIs6bNcK3MbkWqT5g+SSzw+9ET1cicIpcNaQiiaxAXixeu47S1a/IYgo0tsT7Wmak1QbvPzv9ZS1NstMUvdISUA+07Rb1pwxt+YBeEPuPwp9fapeJgMnfH6NPgQMbnx+5wlqvtT37l/PKdOQCvW3xWTIzvJg62SWtDQEYevZjAAxcJ12vz0f7vODEDYlV25GbhrLLkmMgFrL2CDH3cF09pIjUB31lPCJvI4OVGUhjMKKQCUpn0uPFeXB7CLxw9WMJbUDSQ7q9jRNhcBgrps5dz5xn7LoafKmzcbFc3WLyD55GyFzefqn1Rhn3VEy+mJwd/2z3j980l2BX87VB8uDYcKW3ZK5H0iX3yfWJJuA3ZyIijNVGfEiPPKQ1sJwMA9xS4xyUdLdYnZsxd01kYXgfkNVvk/RMV7XtS5Yt0dhb7GAaJ9TDt+pujipTurLet2FMHZFVsx2hbmDiQWZA2PIYswl9jY8NbN39/6BYxqT6fgDOJ5XrJMvGjqZsxvpkxRosiGN6+rztm1LAf+4HycCcpMBopYX5LYbLvsR9bm/ZRXnKLJ0BxtGkSJtjEuSVQfi2jrfo04wTrL/NxTzszUiCEkDBLj6faZ4Sq3EVtDMwX1ubCFzLta97RHArWWNvPTkwJNk5vIhvQ/er4rn2NTXpCqUMa76oP6aJJpVt5me/zExgCANXnZV33BbFd36ChDr07zrfG2GouvjRYKSiE6pReXoTZGBHSUMo51DfAq/eDltmJtK8jRggpFb+6whrX1uZwndxJ4tEKSbrWKBs2Df2dSvG3xAUjeMZkmpvbrV3ZDQlBzzPFbaU38fe3YcMEHgD3PMx4TY31Fa+r+uaGQ6ewCpxwW8wTxbTvAE7x922tqXVTjbXsyVhun6232GVluOCpNO4ob4jtj6tMXXG69ZO45sxvicyu+Ln7K12rRvefYAjHD23mEFGOIHVX1GphXUllMvlQvUBm/16OGUSvG9/goQl0/P6DBUuOvSB8BIWsqyOvf0oubqhozNsBPMHeE+CyuQOL3Dcy44+y8ZCW/QN5Iv1Sc4N1Xf9MsFCa5kUKsV0fC+0G25EJo4cksUYRhDhp4N3H07w+xMNTXxsoSEwKlTjOkiahbyR6FcMuLfshmjTVC1tn2yPHmlq/iwti3gCfSfBckgkERKyFNcJBgESyzM+3zoOXIaHRXrK3z/2gWnVxlXW4hFXItaQGv3yqdygscKvEaThDHUO0PYmfB383M5glGKaT+qDSNjqkvhO3xXCXm6Q71usXMLc4iFRjc/hRzZb9Zs168WS5CHKNzzJtAQGv X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf43f6b5-d4e1-40bf-ad93-08dced1b3fc2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:07.1978 (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: u6a/gad2EuaWXL0k/V5eEXY0EfiJVGg5cAvXJTPXXNOVekWteZU8UPUn4K2C0O+Sikg5pYGOqQtK/r9MsNOw+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11041 enetc_pf_common.c provides the common interfaces for the PF drivers of ENETC v1 and v4. So it's better to make enetc_pf_common.c as a separate module in order to prepare to add support for ENETC v4 PF driver in subsequent patches. Because the ENETC of the two versions is different, so some hardware operations involved in these common interfaces will also be different, Therefore, struct enetc_pf_ops is added to register different hardware operation interfaces for both ENETC v1 and v4 PF drivers. Signed-off-by: Wei Fang --- v2 changes: This patch is separated from v1 patch 5 ("net: enetc: add enetc-pf-common driver support"), only the changes to compile enetc_pf_common.c into a separated driver are kept. --- drivers/net/ethernet/freescale/enetc/Kconfig | 9 ++++ drivers/net/ethernet/freescale/enetc/Makefile | 5 +- .../net/ethernet/freescale/enetc/enetc_pf.c | 26 ++++++++-- .../net/ethernet/freescale/enetc/enetc_pf.h | 21 ++++++-- .../freescale/enetc/enetc_pf_common.c | 50 ++++++++++++++++--- 5 files changed, 96 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig index 51d80ea959d4..fdd3ecbd1dbf 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 "ENETC PF common functionality driver" + 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 39675e9ff39d..b81ca462e358 100644 --- a/drivers/net/ethernet/freescale/enetc/Makefile +++ b/drivers/net/ethernet/freescale/enetc/Makefile @@ -3,8 +3,11 @@ obj-$(CONFIG_FSL_ENETC_CORE) += fsl-enetc-core.o fsl-enetc-core-y := enetc.o enetc_cbdr.o enetc_ethtool.o +obj-$(CONFIG_NXP_ENETC_PF_COMMON) += nxp-enetc-pf-common.o +nxp-enetc-pf-common-y := enetc_pf_common.o + obj-$(CONFIG_FSL_ENETC) += fsl-enetc.o -fsl-enetc-y := enetc_pf.o enetc_pf_common.o +fsl-enetc-y := enetc_pf.o fsl-enetc-$(CONFIG_PCI_IOV) += enetc_msg.o fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 3cdd149056f9..7522316ddfea 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -11,7 +11,7 @@ #define ENETC_DRV_NAME_STR "ENETC PF driver" -void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) +static void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) { u32 upper = __raw_readl(hw->port + ENETC_PSIPMAR0(si)); u16 lower = __raw_readw(hw->port + ENETC_PSIPMAR1(si)); @@ -20,8 +20,8 @@ void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr) put_unaligned_le16(lower, addr + 4); } -void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, - const u8 *addr) +static void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, + const u8 *addr) { u32 upper = get_unaligned_le32(addr); u16 lower = get_unaligned_le16(addr + 4); @@ -30,6 +30,17 @@ void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, __raw_writew(lower, hw->port + ENETC_PSIPMAR1(si)); } +static struct phylink_pcs *enetc_pf_create_pcs(struct enetc_pf *pf, + struct mii_bus *bus) +{ + return lynx_pcs_create_mdiodev(bus, 0); +} + +static void enetc_pf_destroy_pcs(struct phylink_pcs *pcs) +{ + lynx_pcs_destroy(pcs); +} + static void enetc_set_vlan_promisc(struct enetc_hw *hw, char si_map) { u32 val = enetc_port_rd(hw, ENETC_PSIPVMR); @@ -970,6 +981,14 @@ static void enetc_psi_destroy(struct pci_dev *pdev) enetc_pci_remove(pdev); } +static const struct enetc_pf_ops enetc_pf_ops = { + .set_si_primary_mac = enetc_pf_set_primary_mac_addr, + .get_si_primary_mac = enetc_pf_get_primary_mac_addr, + .create_pcs = enetc_pf_create_pcs, + .destroy_pcs = enetc_pf_destroy_pcs, + .enable_psfp = enetc_psfp_enable, +}; + static int enetc_pf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -997,6 +1016,7 @@ static int enetc_pf_probe(struct pci_dev *pdev, pf = enetc_si_priv(si); pf->si = si; pf->total_vfs = pci_sriov_get_totalvfs(pdev); + enetc_pf_ops_register(pf, &enetc_pf_ops); err = enetc_setup_mac_addresses(node, pf); if (err) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h index 92a26b09cf57..39db9d5c2e50 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -28,6 +28,16 @@ struct enetc_vf_state { enum enetc_vf_flags flags; }; +struct enetc_pf; + +struct enetc_pf_ops { + void (*set_si_primary_mac)(struct enetc_hw *hw, int si, const u8 *addr); + void (*get_si_primary_mac)(struct enetc_hw *hw, int si, u8 *addr); + struct phylink_pcs *(*create_pcs)(struct enetc_pf *pf, struct mii_bus *bus); + void (*destroy_pcs)(struct phylink_pcs *pcs); + int (*enable_psfp)(struct enetc_ndev_priv *priv); +}; + struct enetc_pf { struct enetc_si *si; int num_vfs; /* number of active VFs, after sriov_init */ @@ -50,6 +60,8 @@ struct enetc_pf { phy_interface_t if_mode; struct phylink_config phylink_config; + + const struct enetc_pf_ops *ops; }; #define phylink_to_enetc_pf(config) \ @@ -59,9 +71,6 @@ int enetc_msg_psi_init(struct enetc_pf *pf); void enetc_msg_psi_free(struct enetc_pf *pf); void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int mbox_id, u16 *status); -void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr); -void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, - const u8 *addr); int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr); int enetc_setup_mac_addresses(struct device_node *np, struct enetc_pf *pf); void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, @@ -71,3 +80,9 @@ void enetc_mdiobus_destroy(struct enetc_pf *pf); int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node, const struct phylink_mac_ops *ops); void enetc_phylink_destroy(struct enetc_ndev_priv *priv); + +static inline void enetc_pf_ops_register(struct enetc_pf *pf, + const struct enetc_pf_ops *ops) +{ + pf->ops = ops; +} diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c index be6aec19b1f3..2c6ce887f583 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -7,19 +7,37 @@ #include "enetc_pf.h" +static int enetc_set_si_hw_addr(struct enetc_pf *pf, int si, u8 *mac_addr) +{ + struct enetc_hw *hw = &pf->si->hw; + + if (pf->ops->set_si_primary_mac) + pf->ops->set_si_primary_mac(hw, si, mac_addr); + else + return -EOPNOTSUPP; + + return 0; +} + int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_pf *pf = enetc_si_priv(priv->si); struct sockaddr *saddr = addr; + int err; if (!is_valid_ether_addr(saddr->sa_data)) return -EADDRNOTAVAIL; + err = enetc_set_si_hw_addr(pf, 0, saddr->sa_data); + if (err) + return err; + eth_hw_addr_set(ndev, saddr->sa_data); - enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data); return 0; } +EXPORT_SYMBOL_GPL(enetc_pf_set_mac_addr); static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, int si) @@ -37,8 +55,8 @@ static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, } /* (2) bootloader supplied MAC address */ - if (is_zero_ether_addr(mac_addr)) - enetc_pf_get_primary_mac_addr(hw, si, mac_addr); + if (is_zero_ether_addr(mac_addr) && pf->ops->get_si_primary_mac) + pf->ops->get_si_primary_mac(hw, si, mac_addr); /* (3) choose a random one */ if (is_zero_ether_addr(mac_addr)) { @@ -47,7 +65,9 @@ static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, si, mac_addr); } - enetc_pf_set_primary_mac_addr(hw, si, mac_addr); + err = enetc_set_si_hw_addr(pf, si, mac_addr); + if (err) + return err; return 0; } @@ -69,11 +89,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; @@ -106,7 +128,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; @@ -115,6 +138,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) { @@ -161,6 +185,9 @@ static int enetc_imdio_create(struct enetc_pf *pf) struct mii_bus *bus; int err; + if (!pf->ops->create_pcs) + return -EOPNOTSUPP; + bus = mdiobus_alloc_size(sizeof(*mdio_priv)); if (!bus) return -ENOMEM; @@ -183,7 +210,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); @@ -204,8 +231,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); @@ -245,12 +272,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) @@ -287,8 +316,13 @@ int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node, return 0; } +EXPORT_SYMBOL_GPL(enetc_phylink_create); void enetc_phylink_destroy(struct enetc_ndev_priv *priv) { phylink_destroy(priv->phylink); } +EXPORT_SYMBOL_GPL(enetc_phylink_destroy); + +MODULE_DESCRIPTION("NXP ENETC PF common functionality driver"); +MODULE_LICENSE("Dual BSD/GPL"); From patchwork Tue Oct 15 12:58:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836358 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2062.outbound.protection.outlook.com [40.107.20.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DFA822910F; Tue, 15 Oct 2024 13:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998059; cv=fail; b=JcKGkwgtp0recjmHaE9GVN3+eGQ1Q/VrYGkzd/rUGZJKkjr3/8QTu9qOzEfqobrnEr9esk7wTt8UOU/492F/quyp7dAv0mrceVEoJMxF4ggGKhyYMCRaZoRyYs3Z+Iq6egYguTTHLH+Z5d/wh5mVTnRK3Gpbc+DppWttx5Q7UZo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998059; c=relaxed/simple; bh=uou1nui+PU10Yj9GprrdFQ8ElRvbPYAB8tO5gcsxj5Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=hCq66TRBmlUboQQzgAgOL/zmuQfkaZPh+DTtLTTH23Y1tbHMDWQ2gFeABXl/o/G4aG76HeZ3xgVVdB5wKUAsxifyqNBj4QYB/KjaFEa7U4s1HqIlFNxPSJeegm960Yy6yTX97fwCGC2gAvUB4eBHpr9Wqn96Tehne8tihFKcwlY= 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=TPTpOjXE; arc=fail smtp.client-ip=40.107.20.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="TPTpOjXE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fmyVA9d0OcbDh32m/Sp6vhBckJLwpMjtYr04XNl5ghWm8wt+/GAV4x2XztWMWi8YQjpdt3/sGXMFneaGCFSHslrsEUYIwuWGdhdPyj9yijmcKuTgwh4xbLeNPBUc1sc8mZo88Dw+nXci9jS4A4w9z2qhVyckL6LH2ZJZFjbJJurvYJVx7pkh21RC/zB4dT9jG3UfuDuaofVBJNyidJfcnBobxuoTCGpru1Jd5Kj6Vc3sprYTJXzK1KJSO5LLXaYwOst8XKXf5pShJ+ds9G3qHLvYhS2sucNrpNY+DNiyW/Fp7VV8cV4TZdeuVlCkvEQOc02ztgAEFNhzRaCymuF+0A== 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=qUHeaK/qB1TBP4EDPjCJ+4CfLjC4+VET72XOwMXTzGM=; b=mSvYf7xnXzcSPdaxVaf3SpLyXa4OG12qwvczAa3cHSgsniJBtqDGYStA3nCMvFuQdXYsyqQFYJVt0DuJT+q/umiGP28tjL3zShqnSGkZUR4LmtxYlZ+/HH4GjBf1sz8hDpx+9w/Egn7U8xVl3AJ1SY9NJ5WkFWZw0pdNlbgkUUv0H9m/r68fcA1tztc9g23JPteeX3FaF/SBClmRD5J3ru1SiBLidchd2F6jNk3EbAhsGfeo1YfxvnsbkPJILdTyaD1DlvfY0bY8Biv6/V3G28mtCpRkg2JPdP4/vDsAUcnj+BeVy2xSRiLO480bGVUz9//4FpN0sGKTwQYjyEccYg== 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=qUHeaK/qB1TBP4EDPjCJ+4CfLjC4+VET72XOwMXTzGM=; b=TPTpOjXExOO6bTBJbg74zB+OhO6l7rQbgiB2uKzM9RjI+/oBzwvdC/gNs2Nb5z0NgGdPPp7opbWKzWOdWE3EGdwZT+ayAIbNGLj9sJy7WSoVGDq9T+Ew0JxyhlDrVlTVblixG0yXVqeCzCOr4L+a0Td6q3GbjfRFPPa3hYmbYwiDseQFj+glMfcIj0k0SkAqf0IgN9cClIdkjIufNR8ig6SLUMte3+CJ+9QFZIAL0XPBoJaWrRTZMdyyt7tqF9nU6yN6gu2uthV+TsFYE0orfftdID03tXXde3+h8H7AR0P/MC0jJkVxuyyhWd2OyteUHUEhEVKvN0k5m72dyxnzDA== 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 AS5PR04MB9876.eurprd04.prod.outlook.com (2603:10a6:20b:678::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Tue, 15 Oct 2024 13:14: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.8026.019; Tue, 15 Oct 2024 13:14: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, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 07/13] net: enetc: only enable ERR050089 workaround on LS1028A Date: Tue, 15 Oct 2024 20:58:35 +0800 Message-Id: <20241015125841.1075560-8-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS5PR04MB9876:EE_ X-MS-Office365-Filtering-Correlation-Id: c259396c-df93-47f9-1775-08dced1b4318 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: POU/ldv7aPtOTduGmnxaKQKT2hDZv/e/kmCs7UBmoU1Y7DSj1v0zWl3mBNaN7YbTsptkbK1H8x0uJMTtPCcXPZEUzCkabR5iIy/Yz9a8pezLO71doc23bPHFEPU3GiSff95/fQDlSBy8q7BKSXnhChVkNvVa4q7lkLAE06t8dm+XL6pqhc0JOUMWq4YPhJ/bPDqWRthAkv0WBUk6TaQfIXxOGS8vbPdvz2L4+B+8MeB8FZzDZLFr5HhOXXXc1e3U3S19YZBx2BHY+JT8n4Q8iBgIZurBBIDbgfHhircr2x4w/y3DfanrCHPFppuhmQNqGqM6csorFuiNOl7k0OMbGTCFyXwc8JuPkS4lKbDM82WYNtbiWkFznrlMWpk5F7cBB3KVEMd7v6lJNR6V1HkrRH+qWDa0/uWsXR/60vUvhGz0+IhD+5g9RVVW6ONOmVrxK2sKqmQhayF98eScO7qnEqFhLAo+7f47v1TnyKPxJstaALx6Mi8bvAnhJN3/8NtsuErfGEzjSgCqpSjbgihbyt9SM5L8oeRQscPR1DNewKPtzjeDUNK0oPdmp5oPl0bQkQOT6itoUlyMuzTlJZ8LCiKqquNjM9wHpLvUyqt8i9eDwLYXPxW7+1xat1A9qWYO8M6ubfyiTOSRPCidnyF4MErQUa7eX17OE/jHvCUFTvISczrtZGjotcBLG8w5gRzuu0h+s0Tj19npIQu/Q9/iK3lUFEzx7ASDtMatMzgcVXgzNGudbP7JXYixmkOEA+TRwMyI13G5DbbnCaVF4Hkpbv5I2Wc2ZpjAaB1Jpt0S9LKxBteYe7UgFdrWYADUmP5FMbnPF1N7wglwMUmqm7YNz/TA+0d9Zpf+yq/Je4cMBNimd4amRQy0xT93vpTObaqVjYmLqJpnkqTglvJ8D4YAbNsJHXTCAcHQvMSwWla/gyRLRE78QK2Dlesyf7aTK6zJk9tolYHJQPXOqXw69QzhAe+saafZZKkpTAwv57AwbvDP1q+knK8Pu/caeJagwOrTvqMIghwcD8B4MSasqFAA9yyVOUMaWX51hBkIBpGH5xSWjM4Amu1WhhmYW7nSqsYlNjOqT70jCfEgRiXFLYFllZLMK8qj2iMgTEMIJcthgVRLcnFCx+HvQFw9ti5yzMgGa+kB4vZgvGlBd+1sCYeihyOJNzhy6K9DbUeur+aPCl04UrlMxvahlwnUPkIEAmpBoPcB+zyGx/d+Z0VeOM/DJ97GwYgy1NG3CfUJ0XiHc2IOQo30SC9ngA+6AmzkZWbjRVX6aunLzUdbmlXdgDrzfMX2fwPNXqPJXJ1xSlbfeJw1SSDpy1yMbeclaxkrvD1wg1RAiAO/uC18NVtEHdQMCVdjn1Ven+V6ktIMhHudWEw= 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)(52116014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SkQbSukBrW67qcxx7f2B/G4VGcTOYf2CE7yVRA/7lzR6AUXIeZPLhZ58xQkX4vAGBKjTLN3pzTx5sdXDGWI3CSraoPQPvUPzK4i07l3F+1NYGkC6BZ6K/PXs50Xeh9j8x8bC40brE3okj5ynoBWua38BMqVN1B6dSMHCD8AfsoVBDBgkAUxNUpQ8rjXK4HzN7OK0r/JaILv5ycLpSGe3HYXjmsRwfplD+BtzaTJ3Jb8IjQKUMUxbGMWGbXeMmfMMPcEPzYk4cbN1yZDd8acsoNsPCZroQtXAclknO+qb5EZbxx8fUhmkzUvtJaRyM+PwlBCC1QBDvQOFcwWdGophNhvWth+icMZyAaXxE04o3Ts7hyjeeTnmm4cX5LLTGuT1uZN4ouYXpYJPh7sBv7OVjcw4Wj8VePimh4uyj60q7GTG50HnnIc3Vedq0C2pLmhDr3b1lAfGnTWGkTFky7sueNOIfKHFg+XqluHce/56mzdLsPFT67t939JBzH7EbPN8SfU6cOG/a/OPvEnfYsYqIkl58kfFuokRbgcKDYnqwNLtvyQuOCmLUraxMkpsBkLKPPEdwJNxXfqYV5EEnnItMweAaj2ugNSpLmQgW7hHAbksk0y8eQy77E8J+7dccUZm3b/pMG/5Ac+TtebnV9jsnsC68yGLOmHoxkWHbc+c1Ta2kHTO+ebbB4tKtT4NTK3cI1zOM9MahWLj0Y+xA9h13F8ekNSiKL3kAiqL8tpWvLi+0BAvZWPfwtebKHbIoS8j6+UYpTvPkadCmeLd1J9cYHnkKK2uLnoURpBomBIiZadQ6efXMkzdAmjTHHaw+xNm+v9NKkz6O7htg5G/Jt/kuE/iD+3eXzI1kDxzDKAvahIRCOth8a8dBtPV0NAsWu7mSdcNouRpEZ3E1/ZWODoD8LWi+XlK+r2RNaPjF82fd8G705q07QeFiEzHsdFczc7yljXXQ/t6pNOTMwhFIsyN3SvIlNWNeKoBaHEOEa8NvRGe7DmWZVyobCRDn981GR3xP3bPU/5FXYtYuXeTGjnQMSv1gcpAR5HR69SAkVR83gadlURdKzONhUMhZnKZOV557Dcw8gDNIZIQ2l8tBIDrkXWLieUabHOWBktuHXC4P+TeARRrkGjEvGz21x/V9eZjeiJA7ByLkSy/GzURKLnpwgPfCneblZV8ncCvPE8LDw1iyrAXhBVDX6SCq/B7POCuOIFIBs0yNUHBDAfTdbLsQVEdtSlb6C26fOzpYBG9Z/xk11ZEkKjuIxw+6RQdy3kMIDsxpAnFSRhMgqbVHBcxP+Sscjw549A7Cm9849yVGduz2nsDRA78kE0awjIYn6EBdpO01A5joBTaNo12iISPEFO+kG+LatZcoq4Xz/pKN3rsk91fzMYm7+AexCxW0s7VdVUiM+gBYMAZRWQ4N6cuILAY63Z2qefEYj0oLJDFKde5T4RzkfVMsVwKE+iSuqy6LpSKoomj1u69dHex7U6YuyEBfdhUB1MQPv3YI72eYO4JdPOopC4i3+4MblXRaLFcQS3Z64o/qtYZECTFEtLpyzgU7thTNJAZzj7UkfmAT9w14qdoTlnT4X5ljUe6Ef+z X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c259396c-df93-47f9-1775-08dced1b4318 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:12.7132 (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: ebkDMmd48Rg3Xk2QSKvBIIWUHleeEwk4twW5VX2gMaFXgfP8XcknCp1qWdrRZmX9cwfiknOSfAVtDhVgFVRJCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9876 From: Vladimir Oltean There are performance issues associated with the ERR050089 workaround, as well as potential functional issues (RCU stalls) under certain workloads. There is no reason why new SoCs like i.MX95 should even do anything in enetc_lock_mdio() and enetc_unlock_mdio(), so just use a static key so that they're compiled out at runtime. Signed-off-by: Vladimir Oltean Signed-off-by: Wei Fang --- v2 changes: no changes --- .../net/ethernet/freescale/enetc/enetc_hw.h | 34 +++++++++++++------ .../ethernet/freescale/enetc/enetc_pci_mdio.c | 17 ++++++++++ 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index 1619943fb263..6a7b9b75d660 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -396,18 +396,22 @@ struct enetc_hw { */ extern rwlock_t enetc_mdio_lock; +DECLARE_STATIC_KEY_FALSE(enetc_has_err050089); + /* use this locking primitive only on the fast datapath to * group together multiple non-MDIO register accesses to * minimize the overhead of the lock */ static inline void enetc_lock_mdio(void) { - read_lock(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + read_lock(&enetc_mdio_lock); } static inline void enetc_unlock_mdio(void) { - read_unlock(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + read_unlock(&enetc_mdio_lock); } /* use these accessors only on the fast datapath under @@ -416,14 +420,16 @@ static inline void enetc_unlock_mdio(void) */ static inline u32 enetc_rd_reg_hot(void __iomem *reg) { - lockdep_assert_held(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + lockdep_assert_held(&enetc_mdio_lock); return ioread32(reg); } static inline void enetc_wr_reg_hot(void __iomem *reg, u32 val) { - lockdep_assert_held(&enetc_mdio_lock); + if (static_branch_unlikely(&enetc_has_err050089)) + lockdep_assert_held(&enetc_mdio_lock); iowrite32(val, reg); } @@ -452,9 +458,13 @@ static inline u32 _enetc_rd_mdio_reg_wa(void __iomem *reg) unsigned long flags; u32 val; - write_lock_irqsave(&enetc_mdio_lock, flags); - val = ioread32(reg); - write_unlock_irqrestore(&enetc_mdio_lock, flags); + if (static_branch_unlikely(&enetc_has_err050089)) { + write_lock_irqsave(&enetc_mdio_lock, flags); + val = ioread32(reg); + write_unlock_irqrestore(&enetc_mdio_lock, flags); + } else { + val = ioread32(reg); + } return val; } @@ -463,9 +473,13 @@ static inline void _enetc_wr_mdio_reg_wa(void __iomem *reg, u32 val) { unsigned long flags; - write_lock_irqsave(&enetc_mdio_lock, flags); - iowrite32(val, reg); - write_unlock_irqrestore(&enetc_mdio_lock, flags); + if (static_branch_unlikely(&enetc_has_err050089)) { + write_lock_irqsave(&enetc_mdio_lock, flags); + iowrite32(val, reg); + write_unlock_irqrestore(&enetc_mdio_lock, flags); + } else { + iowrite32(val, reg); + } } #ifdef ioread64 diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c index a1b595bd7993..2445e35a764a 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c @@ -9,6 +9,9 @@ #define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus" #define ENETC_MDIO_DRV_NAME ENETC_MDIO_DEV_NAME " driver" +DEFINE_STATIC_KEY_FALSE(enetc_has_err050089); +EXPORT_SYMBOL_GPL(enetc_has_err050089); + static int enetc_pci_mdio_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -62,6 +65,12 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, goto err_pci_mem_reg; } + if (pdev->vendor == PCI_VENDOR_ID_FREESCALE && + pdev->device == ENETC_MDIO_DEV_ID) { + static_branch_inc(&enetc_has_err050089); + dev_info(&pdev->dev, "Enabled ERR050089 workaround\n"); + } + err = of_mdiobus_register(bus, dev->of_node); if (err) goto err_mdiobus_reg; @@ -88,6 +97,14 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev) struct enetc_mdio_priv *mdio_priv; mdiobus_unregister(bus); + + if (pdev->vendor == PCI_VENDOR_ID_FREESCALE && + pdev->device == ENETC_MDIO_DEV_ID) { + static_branch_dec(&enetc_has_err050089); + if (!static_key_enabled(&enetc_has_err050089.key)) + dev_info(&pdev->dev, "Disabled ERR050089 workaround\n"); + } + mdio_priv = bus->priv; iounmap(mdio_priv->hw->port); pci_release_region(pdev, 0); From patchwork Tue Oct 15 12:58:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836359 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) (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 BD4582296C4; Tue, 15 Oct 2024 13:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998063; cv=fail; b=bwqv9+e6tGvd1WDdpcUkUCOnfF+/kassabZqtuLRVwWd8vVJQLyxnYOfUkJ34TorR5YUocOnv53JZbCLuDcaesgplJxq5xlUIE50nD3KunHZhqsDJQP1G858N4TBjhaFY4WoX+m9CuNSKGlEu+APM9Tj5iw7OvZKDcPl/B/4f+I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998063; c=relaxed/simple; bh=pU2YNBmHM+U2yQDpWC3Rl0BuMrBjCvTVm1O43zOFO3g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=LrO/jQcBGhKKblrWMwdFXLBGVRfuPAMJWNP6inJwba8F1gLQXziS0tFBhl/uHD0pU6zCLc34DF9/KX/FBq5vbA4ca8Szs2LAJcFjQRoE6007l6FifRmZzY5dEGZ59FfIFJVuaeWI4hUHxm8eCFLSmCi6lD3vVZnJ9w0Ft8M5BR4= 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=GTfraEZd; arc=fail smtp.client-ip=40.107.20.61 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="GTfraEZd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lRPubp0QW8g072h8X3banPs8SzmtU+hhzHy6puEeNtUlwqftRsSFSZuOSTVFsxky6jI135JULMllbYhMo2+yWMK47dQarmDlcNdC5UQVtbx0FWalXDAKvzKL/Cxo3IDNwOBPA4zCd9xwIi1g7S6sfVPlJgKnXnFfbeIVlfn+US4pZMnt65yz97DxBMU+P1k+nylIOKI5K9YpvuHxyziAV4oB/r5cyTCra3jLlZpYfFXp+6p/HqfP/9RlUYbmgCEstvvuTtAX/k076+dGy/U7HVHY+hG3KZPqzpf/p6qt4eck6WXBrtC/I8ZUvgmjeteqbgAXc1JgUCrdaXHSk7grVQ== 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=3End52Pxbygyt0TkRjAbFp67xxEV7s/gKNgMqwzW35o=; b=PMAIZbzeppMRAizUx/18/0ZgvV8mqNM1QhT5LZUGWXZisXFY89NgvSBwAqshyJSmMuJN9fHpm55TJeUBOLq1Bq8knMcAU6ZdORQnpXSA8Rz0B5BOa3VCTTSUOa4MYFUvgbE6H2/bCUfi6pyc0m/hbfceuNflWBfAtD2VoRYlVfOoaHF6bGy43HCSdK5XlAmpZAFQO1xLHdA3wAvCkpQGfUn5xPWaUAffwjsGJpELasqV1nOF+UVEdcUp0tQ3HaZg9fqEawnzpmqnhKKVpcwDFnhqusbCg7jrhpuXtv8eK9pIOVc1HSLqNFkUS95cCDUaIWYer+0diBdeWh6yt8eE/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3End52Pxbygyt0TkRjAbFp67xxEV7s/gKNgMqwzW35o=; b=GTfraEZddNEoZ88XaFcmTdvyYR76mbI3/U4XpXOr3smDFkoTEN0grpHTbuZvcAL0/yiv4lKsVJmhK8Mjn2gVlwPCAlhS1vs8eaf8dxEBYDSxtN4aPj7s3lgOXETw5aKfONBl4bq6Jw2mJRK7CswdwPLabCYVV016zEEWniz3hPJzNrnOlTZwtI+1zNIrr0bepCup/1THFXghLgNXF2KN9F4ze88iQa3TIZPskWE8oG9kbLb7EVP1SrudBy+aaIatlBan/cTrWqMuh/JKCb0E9jf3xmJLUvxsWWmsmyod5dQhzCWfoiYtUrKOdb1z4mWXHkxr2X8jyCCk5d6Uj1aYkg== 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 AS5PR04MB9876.eurprd04.prod.outlook.com (2603:10a6:20b:678::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Tue, 15 Oct 2024 13:14:18 +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.8026.019; Tue, 15 Oct 2024 13:14:18 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 08/13] PCI: Add NXP NETC vendor ID and device IDs Date: Tue, 15 Oct 2024 20:58:36 +0800 Message-Id: <20241015125841.1075560-9-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS5PR04MB9876:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b41275e-ad6d-4f5b-2452-08dced1b4693 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: h4Ejup050IFQTt7nklzCQK9uMsbBDohREFMZNYxonXkB4dreWGt8v+BgIWnYsAJja5qSguQWOzAP3Biny2tJ17/uRPxp4jEhfdfEueFDDapjuz7W7lJzfU4eLgmjKrtUXy42PXbd6AcKIh4dHBWWTtMpNh7xmyzxZ3G2Ws48vs8GRG0I5r3bQocoDQYW2srWLW0tgX+2TUDfAJ1q150XLLNj3GS8SS99XFDsqDYOvhRMIvQjgBkH4WXJeA0tVJ3qLbGtDvk4TymSYHsxruDXEDq0vqGbEIzO7xbItPLzZNF6IUCNWR9Hkcdrn+98SClu9kTFXX/7JXV6/izms6bRnmSMDnnD3xOTCSHCWGQ+WKwQ+QltUGNPcMRNH2WjlTsEOv49+Cre/qBHJadynX/q8CrKs8cptLrou1/AIPvybZXn19F9yV1KJZfmFoquCUrHH8vf4z32BH7EIXm3LwvksxfIM2fk/VTGYltyg7zjeeC6H14VKjZx7c14uP2y5jrkpv+NmI98TKohmA61MBQP9Ik3GnZ+uJfRFz+O72LUTft2oxo2IZLtfRP0zqAs21nzQcGW5aOphHQGQmzKEVmqGc02YCE0Y3VFIfU7HjNxMA2DdY4LELDpqSFmyEEaRth9WYNGQJNGAC52RezTuJzTXQY5q4/JKZrFtm/HuKUC+Ugo6eXXBUzdATbmN00R7YlWp/exOs+rarjej8iQ20U+w4avutuKJrexmF2+JZsN7uZ8YzEFe7SnWiQXb+bHFgNI7ozkVKj4RACSX0+uHaM+oWaCYEYLhe+lPPGgjmXIBHPMiofH1OfTnwbFFUaDiRikSnPlk6yMuuAKFV2j5K5G0G5K3WCehbRQIKOnsKkl0wZWkcTb+qQn6gMJdKyV5FJXBJRdKvoA/J9lRde1z1CfL7cr9OvZrh3pKZRfs1abOxW/pJl2q/ukczV1X8Ug8djRb/UowjVWiHklVZWR+7diPIZHMP+4xg7NgIjPS4U1rys46Q+dj7oYWe83KmBzZx95ppKN5a5hzzzklUGn8t3V18WeZVyy7oTK4DckB1UuLaW7s7GPwGpiywAat00rECYcaFHt71g19a3oZNDpQyTZmSH0vnG3ESco9Q8GvMH4cgEKrU2c6whw+3obvECP6uYU3rLTuyKG3gaoFavoqSlQ3yIm9NdSutEZTJ43Nb83BLB7mXC02+1SJpAz6TMJsg5JxDn63lskMIcU5O0t2+a73+P6FyOi2iF1S4mkR/JQkrpuKkxTSD/DX9WI8AnDabJmfTQnoT2ukCPHF4NhJEaKu8w5/Dme/hijQWUa+8W2nkBWCTQ47fp3JmJ2HK8QJvVDCu5mK+z0RndybyfEVPbG2rbEirrQVsbHlSEy0JNpGa8= 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)(52116014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W2DEqh286uvTgfebXL1JbdT6FSRNHAgHK88VvwODYOCbbmCGE3xNqJpxlpwLDyyqWVNMetR1vra/2YcBstyNNUzW3uXRGHsBZxu/IuQwEI+vfuEmRwWMYeK2kE0Wdn8eHj9A5im/l076i40QlKou6AgSMDwec3bTMiNI3trsK77a7yzitZyJlk3nZnk2QoAGzCZcMsonMCwlv9cAmtmotGfl8xIDa9bg13xoIBRXclqp1n0RIA7GQbi5wh1OvJ5SKlfFO+9gWx5CIym7h2BIjvcKq/x6Kk2UNFdIsFAlTZjXDX/S3FTMjYJm9jbHvKb6gS98Xz3Gdr3TKYUXcBc90eh1KmZoLocHAjs++2CgwgRdzm8pPAJjx44bmmAcRBYwE8M37gg3f2+2DW1Of1ePDkbjVogzJ+dhegEPEyMaHbIfM2SlJXwwcQNuGw5e4snj9s35Y3jsEMjeGPactChgosXylJtRF2oBKNrRxzlV+wpi6HJ4ztppzFxjhulsHp1AWhjIryBG/3+qhV1GS9P/DXCGg6Zxc3CuInBf9VijRAsOSrXw/VQIP4fXgScYeyQH/GUbbwdffapX0EWHI4kugOEDr8C18cHq+6NTv4/VUiucORevHktHl5J5/waTR5Z3kWxYer0K3VYnvBY7M7PlXUYZBy3Xtej1taAqmVUcmNfu+2CAfPhYywAJFaZfIYyVUbz6lZ1y5Vo4DgE69vj7Stgb+QfSB2LQSu2+zZ840khOhxAo60ejURvSYmfl/qMhJLbM84zu2A/wzQqRU9SE3YAlJn4x6xe5g0m7U15wMOohNvC2UucUHM7svfZy9wdCOHE69vGfzKg1rWV+K5TSPUEnYQVrE8xrq3jODFBjVMl7kjMSIldDHx8u+liz2+S3ehu67rwYc1bZVp9xD2EXLx2aGzjG/LWNT+GBdmzVfHwiYsWJphiBoK1YbV9/NuBptLfv+eqC7db1x+vrZW2n41uFrJEFSYwUnbYeVTFPA/o2tG0dmOuWVUsOh1lwFIB68eE5fpRcgLcBpfUT6BEhsihFUQo44oAFcaEU8l2AF0hS9BN7yoeqhrj6vnWfohCCO+k8qlJBbv9S/SjW5iN5zAIn58A/Gik7Ow69P+2PWhMFF/zRNzliMl9kQEyRIpjM7Sq92RbL5OcblV7iSDV6IL/NdItlJKRpTqzINF17FCvm21wvzlRtdZjqDsAVFEUtVE1GTR7EJJ1R/lPKvYFdEumtIqitmFtJtnKnLwdjv7rveaYKK0jXfze2Nal0Ncg5dDfXNG425xSVXszNmczkv4Y/UdiHCy/zebfNP3NZRTUgilVBGH29alTxXPGRIP4PMlvyub7kRrBgUNkhGhQXcu8/X4I9piLZOrQ7V7Fd1CDtTJFw3C78AiEW0SpkLjYJpyMLdbsL/Sc3nwRm+2CqVZNS+uFHfTRRVYBvVRXbDPerLjkzMcKUXPOgj/sQ7npC/sb6cmLYzginU6mZ5V3DlsGxHTi73EHhajLuBppQVdh5sTcRPj9ilbf13jlwwn9/2WdxUrZj7iHJPnpGlPeOL+D90lUTn7gGwhpV664F02GME1n3t8b6pgKrOGUVnIhE X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b41275e-ad6d-4f5b-2452-08dced1b4693 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:18.6603 (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: fPyD1b7/tIN7TbdeVQU9yFAHV9l00cWp0aSbTjEBlF0ufmJeFjo4bqcFQKTilNf0YTt/uSwhvvxKLLduGE48DA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9876 NXP NETC is a multi-function RCiEP and it contains multiple functions, such as EMDIO, PTP Timer, ENETC PF and VF. Therefore, add these device IDs to pci_ids.h. Below are the device IDs and corresponding drivers. PCI_DEVICE_ID_NXP2_ENETC_PF: nxp-enetc4 PCI_DEVICE_ID_NXP2_NETC_EMDIO: fsl-enetc-mdio PCI_DEVICE_ID_NXP2_NETC_TIMER: ptp_netc PCI_DEVICE_ID_NXP2_ENETC_VF: fsl-enetc-vf Signed-off-by: Wei Fang Acked-by: Bjorn Helgaas --- v2 changes: Refine the commit message. --- include/linux/pci_ids.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 4cf6aaed5f35..acd7ae774913 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1556,6 +1556,13 @@ #define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 #define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730 +/* NXP has two vendor IDs, the other one is 0x1957 */ +#define PCI_VENDOR_ID_NXP2 PCI_VENDOR_ID_PHILIPS +#define PCI_DEVICE_ID_NXP2_ENETC_PF 0xe101 +#define PCI_DEVICE_ID_NXP2_NETC_EMDIO 0xee00 +#define PCI_DEVICE_ID_NXP2_NETC_TIMER 0xee02 +#define PCI_DEVICE_ID_NXP2_ENETC_VF 0xef00 + #define PCI_VENDOR_ID_EICON 0x1133 #define PCI_DEVICE_ID_EICON_DIVA20 0xe002 #define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004 From patchwork Tue Oct 15 12:58:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836360 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2059.outbound.protection.outlook.com [40.107.20.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA0DD22910F; Tue, 15 Oct 2024 13:14:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998070; cv=fail; b=bAK/tTgOBDvwr4b1qTvgLlai02MxDTYKaoSCGfPwOCFs8+nZ3lPPI+zzsyLOhPQRb6GYFaXOXyqlyhLpxED4Ld6tHt6z7AM6N7dsCPlbrFeJm+IhKd+9vakOIoqt6N3QHyjWxeX7UhWUCvZgZc5lmmdU3USBilYk3G9r4nq0Hu8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998070; c=relaxed/simple; bh=GL44PGLq9yRdyT5n1FeI9TLm5RBPksdUP8Yn6Lzks3g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ESpoKj6G/5+ncG7WMr/Aw3BZVhgFPKk4p4p1k2KrFr583JBzY0TuGhkXjUFgBCeX1TaY4BwuNHKDfD47/tVPS/syF6UZmMvj/BOEMKraH7yKUavx9JRJD2Acl486te017Ir8OUyey0dxMYFNnfUWRQc6sldBjuAthwHX4PIM4A0= 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=DqKhyXWi; arc=fail smtp.client-ip=40.107.20.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="DqKhyXWi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ehsd7+9rlOMqd3qsCXygL3NKlF/Ry72TfBD3yijGg5baS5YqG+RDS7fmjZwyxMSclPSl8jdpyEAG12WIIX8QFhUqdELZK/d7NGNPDv3637SzFFyu2tBTzaNDceA7dJa6Mf55qfKVZHsVGJ5NvNR4DclljrBP+V72Yt8OQDDjIP5YcNdT8BiynJz1NYl52t2v+728Yrrkx59cQIYyHka7WKSG9sorfuqf/FXC9pY0XuX++TewFlNOmfsN7yn+ZqIb01zRLkQ6ftVD7lpIrQEovQtQFOCR+xFGtjexMEMzJTD6YQH1xHZamHH8IkcBnzZFIoUh16WtuSKhrYtCrBDbkg== 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=DmQbl/5l7dj9TKEuA4IXc+GLMs+sn/8OKVJuh29x5tw=; b=O5B7n71CLXhCnnEXrv3/TMryroiNAiTwt92pS98DHWIaQQE8VJ5f6xbwpxeTKtOeqdkeHOmtwyzdGIll17FTEQgP1RgHAhqjUFXfkAxAMTJhe9xsVWyzBSEC7V4fErdA11khlO036zHIHFj0ACRWPcuha5R7j9qCv6WpqRu2ps5wJQ0joMWEvZp6XnM4i0KcibEwUm7iu2nDlm5yG+Gvr4b3arTyowWgjJUO01Wgtpq/i59RVbvPyTmpdVFM418+8TStZiN/67iNpMG4bOSvgH5W0FnaogtGt9BQO+YlWgew8/TxHkJduMVtK1uWc04YhfTQr8/iJ/9mUkj0zejv9A== 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=DmQbl/5l7dj9TKEuA4IXc+GLMs+sn/8OKVJuh29x5tw=; b=DqKhyXWiLZWcWXztXSojmw71w+uadDcI2/q5UcHVUf2Hg2xeFq2rSLCOy3Onj2W9tQQMnsT/AlJSPxvuNiFs8PJ28n6MdNKp6fy8B5XdZ6ksbSO/13Rf7EoV/N6qaqLoMTW99jfU+0Ng4ZNkOLwd1GkwWKSlPdRZY+QaZRTDG0F09D9KIcRt/K1pjX3imBlNhyED5Nzdb8c9CldJd5Kuwry6znP94fQBACI4/dhw+zMiYj+ATmfJhQOXRv3WIxQTshfm4IYCJbp+PRhIPhWMR21rTjdbHUSiT/ma2qKIvlzFJHGF73Pheo+ToOQh0XsgHmvl9ge9KD4z2bRq6TqdEg== 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 AS5PR04MB9876.eurprd04.prod.outlook.com (2603:10a6:20b:678::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Tue, 15 Oct 2024 13:14:24 +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.8026.019; Tue, 15 Oct 2024 13:14:24 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 09/13] net: enetc: add i.MX95 EMDIO support Date: Tue, 15 Oct 2024 20:58:37 +0800 Message-Id: <20241015125841.1075560-10-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS5PR04MB9876:EE_ X-MS-Office365-Filtering-Correlation-Id: b60fcb81-0f4e-42e0-330d-08dced1b49f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: LzyxAUKzMVInM+DxX9tTruz97+ngBIwmZzy+CmB4JcJvzFS6FdgZC/imPfSEMZ/caNcTXbf+1jBDQVpKycoLRUUciqeM1r4qjlDn3ypmF4eO3O4ejj7OgGVZhMQnznNa4u+flnIHNzx6QvaNwclcfjHS1u7pCNV4dPz5rVG3clDlwV4/oAWcdQ059+IRTcQKY7GaiH700X8K0GzWVYisW5LfR4YLddUtlZlP7xV143h8W6UnlP8aM27xN/MvFuDa9bqaDSTBMyWICuggOkyFBFS2CZ5TdNgvW0ie5vufDkPSlHENT7utq3Rva8asb7IpnYiKe30x/uhc32Eho0JuRmOkZDYDS06kz8DoIQMjSRZlaSls4BhQdzCrITt+/z27NJy+honHs1MRCL1FFPFb4dTmIFZ/TVwXepyRXV9w0JwDgrszkYcbzM/uVrkGvygnKuFgTsdRxIfGLxo2svBj9KNTVFKMRfshewU90o4Q1if9DMyonOK4vitqAJVsUlDuvXYdIN2f0sKLFuZIIaxbRegnTfXSH1KvLjz1uEW3uh2sWQbUCiricQAQA8Iy2AkpFRi3BRsCfNiVFYEntQJNn+SusxqH7NnuiQyURqJDQ+8E/M+AUWk+ZAgRHPFu8a0w0m7B31P0f82MRii1ffIfFNIf7x3FPApmRnMC22kb1M8Vv2D09mU8baEApioOKJDkJsGqoWKO60D/2CSv/P9mHH/j4foCcXDCX/oZoT3akFlPuLrSbdew2sJ3nNJ4kbEi1byIoYIQFb8Xo9v5hfWBqKrEf9wqwF/M34PLGyqKbUXxGNFaJnMUESsox3RlVbBy4oZiDW2s8lUEICJCmNmKQlU20FEQooHLl4Fe9CoHnXoFANuRvbeObagshB+YmhxnjYT3ehY7+ip1jIrYdyMAq+FWQyTbKZVcn2VbA2OEc8GQztgB9vbm6cWmHoa0dFY3Ap+Zt/SXuIn3u/ocBzEtSHjIYxAFDcjV1kMG5eWJ+OD2WqcX+M0Wjx+c8SknIh1pbkiRDehOGEuiJJEMWTipmXMtJN4gWEpxKp98uYQ3X5vdurhtRp2wD/nFAiI+VeGiSswjKtmSxz3uYA+rNjQJKi09yebzSjFsymFafyt2g1HR9Sm/ME0egyAgK7/jMxSyX+PP0Kw6PGfH3qF3KW5Xbt+yjQPOmGEo5qaCWg60SnSXfa1zri6HIC9ImCgKWIFREwKAxVXIIOfjvpciY3Bno19PhFWqD3hwdvjPIoa5VIhlW0stjRuIKdDe22MF1ADG1ZfckXuyK5+Ro9qEI2DLbz4xNYHLKmmUl5VJ5bUPrGhM2i7Mor3DYhH+Nx9kgM7hSoOKTR+r/F4EaMuuJX3F64ZSRokYnPgzxVKYSdDKehE= 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)(52116014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /PzalbG4Q/mJyQ+KgbeD0uLV+tzA5CZFWR7I+EqW9EZfMtKAUEAijlyOzkHRARpSLXdo9jTy5YoUDUwQ0lvtpKKAqzXH/pLedxmZseV+PzVhYyCDJW+5WgAPOzFLa6uKNtVbCxFi1746ZmxqFpOWECsWNuy74Jg7woB2qN9oW+qdmC57Rx2dA9PJvGAxn32tY1242OjKdr2tS8OkX/S8pKksUXCX0hDVhBPQnXKXOK/M0FctPlCRVrT8hSe4iNvhTQOgoJojxy2kpRY/9Im29j7gmgQ+id0I1EmYvMs+RuScX57Rhz9ZD2OnwU1a9sxRcAy5kwpCollWKBZB0z8nYZ3pVWrBPp10ks66dh9prLCTX17Zltc+1yXej57u8NGhrkpKS8mZEA79zLUQVxOr+vGrkpypt1RC/knHWmbds7DrEq0aludDIFdMtZa0iOatrdb2L8V/XEgaL2Ld2kSEKiqiB8UT73Q8zyny+8gkJSCGk6xMkoKm50ev+aSH1JsRxCHPhdG/1t/oXyVx1/eGeSw38k6TGqwbf9uAvu2x4hZfZsR3FJWiaWUWo3tF07kD1zu6ll/BSY+NxFyE9u4aqdrZ0O+Tj/Js2Pc+vyFOfxgl/3BSQiWaX2yKW8J2NwGbuEKP3/jrp680kiBb+xm3aeMrAqgUugmmYqsjo/yfv0qBc2TVddrG1ERR13JZv8U61gMHnHoGTrQa7mpmFC5Ar7grAnSrHugIEUwro+a8e/67XLeeE7A0bmtbp0JL4cUBxYxCRGT73xYaJyS5HTIproNFuIsMPgfz6lkNvfsL7ohqY7il2VH1uO65BIz9c8TAvLWWVPoyBj7k/dp4UU4fGU3lyeWlEPIYou8zM6pSghU8r3GgrBvXq2ZQZRNl5XcMdgmQTeZL1fXccNjBRDrt24pM1XaUnJjaZnUXbipexZBNAgwCPBYEN4XymiNuo5HTytpZF68kQxvz/fo9IGlH9Gx5hsmfrzM2YwlOf31bq+nSxBb8hSTGyGjKcIrV5GXUxA++E+49rUdc2wBryoErUGTBGWKYDntBrV6/F5uO8E0aMgXMIF1QWvJ6/AGaXHxnkBDY6zIITBCLCDvnD2BvWQY9dbFqewuuk1CCslvIJc47MP85OjUUh3MceYBtjdMemW9UyM97vodoo5AX7cyGLhgAbEk/d56ct4uKLU/AgauahMxvTXAMquR+WLMDKU5v4a2QZaaH0cD3Yc6Cf3qDNiaQiH35PZfrFSLK4lBnUWomIqUkIGPZdsdwxGux8CyMorzlKh8LFuCYReBiIoFwK1SGttv9SWCJEToMHE2rSNDGmEpABmT4oP8DBp41Xyoh2EHawYe+fZc/s5uzYir1ew+GksMNefNhl4rcXxb4VDX1g/aA6n7CsvMvgX8KaQmOLFllJRH3ycBCGSbHS1CZQPut35hy4Hk3Ui2+/uokp7E45m+zDPcYn2ps3iALLBJxp1uIDQQjFTgxJtEXVS22DapSlekbRMBQwLNi704EC9XEehDIa3qKrRD4+1rbwu4jRUNCR3+75/+UfYYordY6s7ke28BnaTVbeQJ+uheMUqK3ddy9BtjwPo3TqV/u2Ajl X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b60fcb81-0f4e-42e0-330d-08dced1b49f5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:24.2419 (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: cXQunXfSPujnKC6KsUXiakOn5LJC3NmOEPro8x1uNO8w3cM7peuOBmJxBAGzShF1MHEnoH7hcRmlKZUZVPXIGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9876 The verdor ID and device ID of i.MX95 EMDIO are different from LS1028A EMDIO, so add new vendor ID and device ID to pci_device_id table to support i.MX95 EMDIO. And the i.MX95 EMDIO has two pins that need to be controlled, namely MDC and MDIO. Signed-off-by: Wei Fang Reviewed-by: Frank Li --- v2 changes: no changes --- drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c index 2445e35a764a..9968a1e9b5ef 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c @@ -2,6 +2,7 @@ /* Copyright 2019 NXP */ #include #include +#include #include "enetc_pf.h" #define ENETC_MDIO_DEV_ID 0xee01 @@ -71,6 +72,8 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "Enabled ERR050089 workaround\n"); } + pinctrl_pm_select_default_state(dev); + err = of_mdiobus_register(bus, dev->of_node); if (err) goto err_mdiobus_reg; @@ -113,6 +116,7 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev) static const struct pci_device_id enetc_pci_mdio_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_MDIO_DEV_ID) }, + { PCI_DEVICE(PCI_VENDOR_ID_NXP2, PCI_DEVICE_ID_NXP2_NETC_EMDIO) }, { 0, } /* End of table. */ }; MODULE_DEVICE_TABLE(pci, enetc_pci_mdio_id_table); From patchwork Tue Oct 15 12:58:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836361 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2048.outbound.protection.outlook.com [40.107.22.48]) (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 394963DAC0A; Tue, 15 Oct 2024 13:14:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998075; cv=fail; b=clbBXfqgRN6WxscLezr8h2LnBfJFBFCbu+FfyeEc6RACFYrAq8i3d3CgegGTZkvkFVSypuCpNrkA9DK396ASiw/qhT/IjFmkO+cIOvx74Pt8d2IVNS1aL8T62UTTiTPRr4mhx3/xYr6eE46EowpkW6PaqazbDcbSLP7NRdFuB38= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998075; c=relaxed/simple; bh=MmDmIDm0jAWTDLlpIRqmWWIpOR6bw0N4k2dbVuAxM9k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Ow6V7mrMmh64ZXpUCtMcGLFopxf2xxd2ZWMNnZlslSijTWHVvuTKteszYs4GhDiwkeZX+7ostkZEqcFjO8d0YWcvh7UdXmmzQlP+qUqDPl78LCFHkOYTBTTTYL41117Ei0k6unCbiWdaud5fi56RjdlOjoiVQjK5JyeSDFzGOYs= 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=hfKs2Wf7; arc=fail smtp.client-ip=40.107.22.48 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="hfKs2Wf7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jb87eQ8A964vB4J4lUgGiALFBjrZ7J/3zJ+VRUDRzgRTcsdXp1Q/OJPkPGZgWfaiLzbEmp7PR3nC67nuLvuRwq045xqnUE5vyRuBaoks+/v+eUfIjat2ophC1Rvy6cYthZULdIADuIKfqb4vpye1MIO0AEB47iWinL+X0nYYQ29GnoG9hCVJxHz/d/li/i5RPzFWw3BjchEMggTXlTkg3EYc4vNdhJkmWysijNhigbwGmq3EMCcWxiHAE6bVu4r6sm1hEzehxOLAcO4Yws9MUY5L79U54/GQvFVWCC3IPRAjJgTZ2mcRFOxSWHe4if6DTeJRnkfTns4pVSxiIlb/QQ== 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=J2cAAlZDdH6Vpfu7V08Yut44j65BcaePFXdV+RQWjuU=; b=TvwtKKH87c97NsMFwFMFQCzGwDZPf+X3+a3ZU0qE+6MteM1l+TQxCOSak1PyUvp47y25zHYf20jl/AV5uKapMXToRcHgv98bzAStkPQOGco41q7Z7WHOp/RrkzN01sPDmPRk3FKdFqv/UxOmji2Cm3ZfzMWgf6HQQML64wGSi0ehvN3JT3bCy56W1AGWL01NpnDk7g1vMyYy6nxO+a778ja7jHl3jSKlU5lqvjnGLaAgEeb2TDksJ9eGUoT0Z30GEHo0W56/x2wsyMeJIAei+7hmqatxDYF77yrdA+v4cgKliuQM0wvSps3Owfq2OTIsr2cc8qIyuvWazlSSj64lQg== 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=J2cAAlZDdH6Vpfu7V08Yut44j65BcaePFXdV+RQWjuU=; b=hfKs2Wf7arllxEtiNXL4gl9MEyy+NUAUszywcKgVKO1VuYGbxEI/fJEBozKvG9KiEc25RpqcjX7ZNaNGwl6LUjP/EqgnUrS/d4HrdTCIJBhHVoTAX0HlSfdtdQr1OccrQyZ0M6xhB66trjg4B4h+vZ4AvwdepxMGBBWHvqRKJ6s3Sl5GrS8ei5JEHB0N+gV2ggIHAw2wPIniSqRo4GI7Pv+QQ/o5JP5jlcijfSjbl+W5JyDgSN56zThAluJUNauEev1lPd/AA0OvMbEBQrVi1tQ4MxuJxUINsb00fkZmSmSqvXURDSXTMCobila7cf8CWGxjCssuMWaoO+n2G6bvhA== 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 AS5PR04MB9876.eurprd04.prod.outlook.com (2603:10a6:20b:678::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Tue, 15 Oct 2024 13:14:30 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8026.019; Tue, 15 Oct 2024 13:14:29 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 10/13] net: enetc: extract enetc_int_vector_init/destroy() from enetc_alloc_msix() Date: Tue, 15 Oct 2024 20:58:38 +0800 Message-Id: <20241015125841.1075560-11-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS5PR04MB9876:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f68f8d6-546b-44c1-9bcd-08dced1b4d53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: xtPtQZV6S17801VrYcTfD/WzhAvgG87rehlrlJ279Tkk6ggteHVWvgrRLaKD+8j7r2YYDoQK87AnRksRx+LHtXUgxb6ehxNdEqmQEg/B3R+7CeJJmaFa13ae24HwGTxJq8NfdDEgx0Mi15/Q98xRwkuauxPrfOM6/YF3SC2LDxzpljeiue/sgtssot+IbgWSa68ItrqvVxK2gXTgmONaYGkF3rAZM5p51Gdq6UpAUVVNMMeVDaa5ICwjQkSCHFJG3zlB1BJ414ZakaRwTIrqT7cwNjA7up4NNWocWMZx83JRwuzR4xmsHZf+sDxkOP3GEE9wqHCHuHTYmSOMj9+wpJQV0TaueTFxdLfxbLx8/W/jRAAjbXTFgnJrz/JRI9TOpda6D/7NxqhBBT3ONcwHut0Lmj3bILarxjsBD3bmrl5dEkNyndRpOMRi3tzEgZsUtvsFdw8mm9XEce02iKVuJOu2oBuN7aBV9hp3wG1oG/IvgNlekaBxOv1+QudBiEqIky1tIbVBJQHg+DIi8iosl2crkYok+QW3QazjXTymqbcwf1qAxmhSNmYM+zzzjW9Bz+GTxihqPJ0VIuxd3dm8/4t9aFHEHtqlqMwVZ0d7WNL0+c96fvHMo3Wb2wcNnkp/QVMIHdUANQCZsJCu9aYB2AyGp18uGgEsx8aCY7gfcU3+AfMdA+HoCIkX1lTrX+nCDCPEWJgxAjBZKCl9CWL5by+6yhC7d/e7Prp7GKzoMoXPhwu6gm7AdqsIDXBHHfVpnHU80XvAUkdPwgSD7hQSkwQaHD1QuYNYsI/8iOsW9u7ZkyLJKOaocFayxh0KtsDcGDT6rS6D06iO5AG17w/2JvuWIivARXFpHPXM30Wvf3yyf/CC9ROthSF10JCOrVOGK2Uen7gt56ALVkAY1/ACYQ6a5U15yBi9ZkrkDlYKhYhHZdnIyE4i9vf6z71yMk4sxVqDAm22NACNM+IvgvnYQzgaN28vLvg7ayOw5ZKoZMyagBWze2VyhIUjNjl/dTMkfnyZPHykarWzAgen/UbHFtvuRJIgIl4ZbE8Eyk3TNQJRzj6VHtmV6ToE0/nMaRPkr5LDzVDGieED4OAKtC+C9D+zm19cXw3BG2ywoeGitMIA+YKMsbWYsMI4kJnMgfsfAiUJwFz55mNbZr7wgGZglO2nYjRMTFX/uKtn0NRQ528ukLWdkLX7jCotzBxZOQ8eNUCUoupPTQ3d1qvXQFSAexQnuBy1cPI35WKTV//9zRqbCb7xjV2pD0L2nxZpmbOH8shvBaIibJEOvMWU/2aXmLozoXV5r3uFKwDVGiHO0RciuaclkcPItR3wchXohJv29BNr/fTnSrQ4Tbh6Zr2IV8YuhWvAaM4PZN4tbgi8jdw= 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)(52116014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CqmE5d9RdDpLYLmyZBMbz6sGo0+bMgbx5biYN7cS1y4kM/l15UmRsANHvqVEA25kNIlNLl79QJfLjh8SciWCpjt0xm9WsortMyiOKqEyeoF1AJ+bMme8R9m5ZNV/+JSznP5KVMkHMZjVXbf452iMUvS1nJShHWzgCyAyAiO/q7c8+RBTCFATH3SFPER9PEFz8CnRPVrhzbMPavOYaOYedLky32DkWkIlyvmNAbo7hY51LohGUeA1kB9AMKJqC4ppqeS9uqCgN7saLYE9Dvtw2CutYnCMEPU62mZbAUzXW/WEro9Okt074qom3sDeZi5Sr81aqnY+zpj2dN7KUD+CUmz7KU/Z+Vi0HT5EvMFsg+1FWqiMxuD+0Ng/f5DWdwcQI8H4QJg2CjKVmrssIymP+n7xJ7o5b8HmxTNwgWJcJeR193ae1IsrE0o/e4+r02+0L57rA0rMfHP9JedjPuK0AqdhsQukufnykS/VIpu3f2VjJc2aqhHhaOt4RJUMsq6FOczUfNNWpNfb5iTSEWBy1BNr808M4pk2+w18+9F6yiGUXJPIVPa+fvbG+2e3kVQoZsNrpsakhQCoDBoqvm/dkyl/ksWyzCsxl05W9APCDrTmMRnbd+fXCQIAeWD2GJX/ErHybdR9br54qovj+xFWaRZjG+Ve0TGKEVem4WLpBMKprXenuUNQIOM/ndA68Cy+Xm1MIoYpWt2LYSquKEl6vJFb0ng5Ksaa/BN5jYKxbUvEONM1fhzNboHB7TPmRs9S/Csk9MyfEW66TxLJ8e4tOex65uDbY1+6C1I/vqk2wJNQqmRAvx0BLDQNGc5rD5lvD2O+QBOJUc1N2QpVRxI/JNX7XobuwsLZ73DQgA0MDpPwxVuU0G3ZH8iwyKKvIoxjT2xUlG+kG+cO1r4K4GydbmZ1/+Wvf5EzviPj+DXyjo6I3IJ/lzhmdnKYix66ic9JTvuU0ErLhWylagVDa6HeTOpxEcZDmvhbnk9r1BowwIgNXF9n/y0RKecVO0XrKngAaiBB3S9bJczRS5Uw7VfJl7v+55G30aBwfEcoNWUzHHg5qm9nvG4teJl3cwKrBIej546bwTPVUJQrIqW6WMKYq6k61Wb0CfU1xJpgBsHr+i+0SZmB7k1jA0/2bB4w+7965RKB2CjpgCTKxexHoXVua8Zf64fNtasq/qT0XKh4N3SIXBgOYjmu5YK+xtE2os8KyURi2Pn1KyYkWDotIyyb6WUpCfYCx6+CNW7uvl+PQ3ydyCvIgie3XNRT3AEcSsAWF0r6KmIeO9CEJxAc34jNoPjBVBDzy9Bnm2U+Vsb+mt1Yl2YkUMyV/lL5HLFfRic0CCpsHm9pp+Dt77A/OXlU5Y9V25H52Yvz0pA+p4PwiWx5/WjK+cA56zqUWU3y6D/HV7Tm/r9x9rDH4brTEMBFc6NXMayGvBK39+z+mzEDS0U+9m12HW50pYSy9Xp7QT6IWcnSaLeVeWudC5tR8A4v3MmgUWdQASxzPIY6zfvCxBZ/tVcTvatJRZvJ2eof2gb/vDFfFeCLELCyDZDubnUkmrtCV2mxyXYY5RMV322iTPChdWJRmrmFyOzK8oS8E55C X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f68f8d6-546b-44c1-9bcd-08dced1b4d53 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:29.9436 (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: NkHfBxgK2idUAClWGW06kStVrLQUl6xasMO5rzvpu76ypxSjd4AlNK1tYuT8QOGZYLQZmcIRgAEJjRIR0vXqrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9876 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 Reviewed-by: Claudiu Manoil --- v2 changes: This patch is separated from v1 patch 9 ("net: enetc: optimize the allocation of tx_bdr"). Separate enetc_int_vector_init() from the original patch. In addition, add new help function enetc_int_vector_destroy(). --- drivers/net/ethernet/freescale/enetc/enetc.c | 174 +++++++++---------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 032d8eadd003..d36af3f8ba31 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2965,6 +2965,87 @@ int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) } EXPORT_SYMBOL_GPL(enetc_ioctl); +static int enetc_int_vector_init(struct enetc_ndev_priv *priv, int i, + int v_tx_rings) +{ + struct enetc_int_vector *v __free(kfree); + struct enetc_bdr *bdr; + int j, err; + + v = kzalloc(struct_size(v, tx_ring, v_tx_rings), GFP_KERNEL); + if (!v) + return -ENOMEM; + + bdr = &v->rx_ring; + bdr->index = i; + bdr->ndev = priv->ndev; + bdr->dev = priv->dev; + bdr->bd_count = priv->rx_bd_count; + bdr->buffer_offset = ENETC_RXB_PAD; + priv->rx_ring[i] = bdr; + + err = xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0); + if (err) + return err; + + err = xdp_rxq_info_reg_mem_model(&bdr->xdp.rxq, + MEM_TYPE_PAGE_SHARED, NULL); + if (err) { + xdp_rxq_info_unreg(&bdr->xdp.rxq); + return err; + } + + /* init defaults for adaptive IC */ + if (priv->ic_mode & ENETC_IC_RX_ADAPTIVE) { + v->rx_ictt = 0x1; + v->rx_dim_en = true; + } + + INIT_WORK(&v->rx_dim.work, enetc_rx_dim_work); + netif_napi_add(priv->ndev, &v->napi, enetc_poll); + v->count_tx_rings = v_tx_rings; + + for (j = 0; j < v_tx_rings; j++) { + int idx; + + /* default tx ring mapping policy */ + idx = priv->bdr_int_num * j + i; + __set_bit(idx, &v->tx_rings_map); + bdr = &v->tx_ring[j]; + bdr->index = idx; + bdr->ndev = priv->ndev; + bdr->dev = priv->dev; + bdr->bd_count = priv->tx_bd_count; + priv->tx_ring[idx] = bdr; + } + + priv->int_vector[i] = no_free_ptr(v); + + return 0; +} + +static void enetc_int_vector_destroy(struct enetc_ndev_priv *priv, int i) +{ + struct enetc_int_vector *v = priv->int_vector[i]; + struct enetc_bdr *rx_ring = &v->rx_ring; + int j, tx_ring_index; + + xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); + xdp_rxq_info_unreg(&rx_ring->xdp.rxq); + netif_napi_del(&v->napi); + cancel_work_sync(&v->rx_dim.work); + + priv->rx_ring[i] = NULL; + + for (j = 0; j < v->count_tx_rings; j++) { + tx_ring_index = priv->bdr_int_num * j + i; + priv->tx_ring[tx_ring_index] = NULL; + } + + kfree(v); + priv->int_vector[i] = NULL; +} + int enetc_alloc_msix(struct enetc_ndev_priv *priv) { struct pci_dev *pdev = priv->si->pdev; @@ -2986,64 +3067,9 @@ 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; - 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; + for (i = 0; i < priv->bdr_int_num; i++) + if (enetc_int_vector_init(priv, i, v_tx_rings)) 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); - goto fail; - } - - /* init defaults for adaptive IC */ - if (priv->ic_mode & ENETC_IC_RX_ADAPTIVE) { - v->rx_ictt = 0x1; - v->rx_dim_en = true; - } - INIT_WORK(&v->rx_dim.work, enetc_rx_dim_work); - netif_napi_add(priv->ndev, &v->napi, enetc_poll); - v->count_tx_rings = v_tx_rings; - - for (j = 0; j < v_tx_rings; j++) { - int idx; - - /* default tx ring mapping policy */ - idx = priv->bdr_int_num * j + i; - __set_bit(idx, &v->tx_rings_map); - bdr = &v->tx_ring[j]; - bdr->index = idx; - bdr->ndev = priv->ndev; - bdr->dev = priv->dev; - bdr->bd_count = priv->tx_bd_count; - priv->tx_ring[idx] = bdr; - } - } num_stack_tx_queues = enetc_num_stack_tx_queues(priv); @@ -3062,16 +3088,8 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv) return 0; fail: - while (i--) { - struct enetc_int_vector *v = priv->int_vector[i]; - struct enetc_bdr *rx_ring = &v->rx_ring; - - xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); - xdp_rxq_info_unreg(&rx_ring->xdp.rxq); - netif_napi_del(&v->napi); - cancel_work_sync(&v->rx_dim.work); - kfree(v); - } + while (i--) + enetc_int_vector_destroy(priv, i); pci_free_irq_vectors(pdev); @@ -3083,26 +3101,8 @@ void enetc_free_msix(struct enetc_ndev_priv *priv) { int i; - for (i = 0; i < priv->bdr_int_num; i++) { - struct enetc_int_vector *v = priv->int_vector[i]; - struct enetc_bdr *rx_ring = &v->rx_ring; - - xdp_rxq_info_unreg_mem_model(&rx_ring->xdp.rxq); - xdp_rxq_info_unreg(&rx_ring->xdp.rxq); - netif_napi_del(&v->napi); - cancel_work_sync(&v->rx_dim.work); - } - - for (i = 0; i < priv->num_rx_rings; i++) - priv->rx_ring[i] = NULL; - - for (i = 0; i < priv->num_tx_rings; i++) - priv->tx_ring[i] = NULL; - - for (i = 0; i < priv->bdr_int_num; i++) { - kfree(priv->int_vector[i]); - priv->int_vector[i] = NULL; - } + for (i = 0; i < priv->bdr_int_num; i++) + enetc_int_vector_destroy(priv, i); /* disable all MSIX for this device */ pci_free_irq_vectors(priv->si->pdev); From patchwork Tue Oct 15 12:58:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836362 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2072.outbound.protection.outlook.com [40.107.20.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 3D5F122737B; Tue, 15 Oct 2024 13:14:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998080; cv=fail; b=PY8yP6l+u0kI9JwqZqAyU7zbb7CyZHeUtEl/ZEMHyozNsyqhGN+LpJpoJCV/Pc2fdrmwei0IQFI9XGA/tK5pFhiii8ivKjFFEDX0cQEQqBpYFfh0ESPXy53xI01Nmgq6W3618RvDMm0qc3uC63GLG3A8uYsFkfUi0V1IAqJCNK8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998080; c=relaxed/simple; bh=sQLdV0v06zyyvLzB9Nv1+dtWHHhm+b8u8Jz1UJzn52w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Kv9BIF7wpvJUIPbVlwXFklnPfQqOXRTmE+5dM+EPl7RCmCoFcvKhGszsIhpcFAO7a5NUotTSOywglWmHkqor3gilxRsYYSsumgJf2IXbxCzFlWPyUCzMPqPZB9c0kA1VlSIb/wz2u3darc1L83Dyp94VWa8AA3BrGyOyMDzuCn8= 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=jjZ0zksH; arc=fail smtp.client-ip=40.107.20.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="jjZ0zksH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J9KS28CbWM0YmuUJ7wWY/ENFUHT1jwpgx5EfitvQ+YzI8Zz/CQAzGdWaXfFaezgyAPJYyuuqxTrIRzjIW82tv/FrwG2H0NgUMPQSNvnkd7WH8ZoIHt8GCAz3SHGPa7IM0QXZAiC4mCEPO5DZv631LczagKhJpon4Y6nlSosIZRMQT3eiVtM8BVbL3nH4ZFzV3E9gL5TcA7PJQYsyi10ToLldGkxOrtRyu4GfhUdrmHrBv371yXoqPXX2aJqrPu7JJG0LbjfMSTCeQNQuwcsO0as0h/wvBJLh1AjtuE4r5qjkdX+iUsyp/z3tNi83sQxlHkrQaff9FSIzIOIDQy42XQ== 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=FHPIArrijIa1XkRQC3JI75JkmI699A8/kvPPVkroewg=; b=tufoOw008+l34I56W2wFEV7roylPKgjuVzEVKc/4q+py7fH03ReHUge3B62s/vVi6TmA4jlDqTgtpXYUwsgqo0IUwyTmQmB9pgVXPakwnJ3BBDHeRCv+6flToNEOtuR3UH/u/VPegsCG9NkwfAUloU0BbRPCP5LhJcfO0HtDoRYvjk5aJPDxdemeki6TNpMgwoZ844xLFo5SzAI2TCuFczlGbcOZzcXYEI4gl99RQVvvmN1ArS+HPjWm3+ccPjKtHa1M0nMzuz8QaJ9TVIluV+7VlwgSrKY5RPokulX5/pBQo5Apr2RvGfccdBoF/iEcIlAVh/ZwBtNpcdL8i4wLJw== 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=FHPIArrijIa1XkRQC3JI75JkmI699A8/kvPPVkroewg=; b=jjZ0zksH9CeiS2YWrDltypzkCbo8OX+CY6tyJHOsBgy7YOv4YstNrFkk95ITbgKg/6Z7KuSpxJz9dyrP0A+EhxKI/oDNtKyu/GBKQirnHWg64l/2HLKPPmHZeRPHfie7dP4flr2cq1pXJUWsG7jE3sZy0ulN6eyAM1xhRQhi9aKEMXiGDzOfC6cKGy+1wpe7evebsxl/C2bblckBW2tEE7Nvn3vpjQfPuxNiVbBt0UvWwJTooSpi26LDujPWv+WWjK4s4REUDRgxl3rhavusMWzruM96GMCwrRNOAM2uOGdpz5SUSHb++6uDVkNVQLp8YNqeG8IhXP/ygmDwMjmxbA== 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 AS5PR04MB9876.eurprd04.prod.outlook.com (2603:10a6:20b:678::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Tue, 15 Oct 2024 13:14:35 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8026.019; Tue, 15 Oct 2024 13:14:35 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 11/13] net: enetc: optimize the allocation of tx_bdr Date: Tue, 15 Oct 2024 20:58:39 +0800 Message-Id: <20241015125841.1075560-12-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS5PR04MB9876:EE_ X-MS-Office365-Filtering-Correlation-Id: 4491cf10-da53-43eb-5e23-08dced1b50ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: oM6SOMveA6PZWgteFpFYx6F2/61csWTw9D+jS8HhqPQmH/PkbpYbohhmPiSObY3qeE71EGTA4n4K2I1obZrRfEAYpihQv1ofJMDawXkEyJYzAjzfbGleCQbUF6kbJbwKUabeYTiowc1PKX7HFQlw01R7Slvfit+YOKHRWjk7WKXg82i0KsPocq6xJTebWyeNd1lqMv4pTvkOKBqIt20uxtAvF8gIY3bgqqRX+hOStx+axnCZ1dy6+KVjiQuPlkzZt10+XiNyFGoUM0R2TbfKhGWecOgd0Z9TLpUVqEOaoLHFBq17QQqzH4lFX5+1n7Mms4AhZ7cL+MKAz/V9jPp1hOPZElah/xM6o7g2gDwFVvqfdLmWwmSQ42G5aMtGIi8iEh/2GETCie61PaH1FetDqppFLwIn5H1WdBIce2yF29IMDneO4FyEJ5lCx3Tjg21BDm/ya7kS5jitB9eS+nxuVGRaXz5QMSZuV7Qp5fG9RnJHISGJbGPAw8iTPaxftciLtR1qV9rmdy1iq61DZ/aJ6KzoEv/JH0BcJrbqTRuYSb9jnhVECegB6jW32T4A8H1UpwlVCzBRTRz64idzQSQItQ/hewROSsQXvZ0nBT/2/s19+7D7HrmAp3aGtsXFCutIvYbk1m9TOpC4XF4ljpmOkujz/Wqw+f1kuu4bXboZhq9zeBF8LZKQVgMQgPIKgcrGId4rR77z2NYfGCmZ7Nh1puinVwJcdSUph4xmOEjBPgOWVLOTgCeM43kEVICA8z1odDj8MBcjHC4IOrSDfReLl7vFzkLO6KFX9S7PQdN3Q0DgC6jfSpWiHwLmW2mUHUDCTG8ydLFvoSexGpGQYcXdh5bK7KkiVywirnN7v970DP7JRLX8Uuhj8Zv3g6zV0h/vaA2qc7Mmtz0xubg7wTZ0R4oynIadCOzWKpQnOtjXHD7AX7zc0PV8Q3ntdc2ViuCDArK3u4t7Dm1FErrPivpMmoBqcA46/Ppd78xYzYSpvxw6F3pQvysbyhK1VxPiUV9ksl4gN4zmyUFJHvDtMfKKd/lhFDZgI9W4NqHc04MKRut6xjQETQ86dD0/vksoYZ2Q95K515JLWcEFP0Q1VGhQMpSr+4xil7XAEb1ecIsbH9TM1/O8C9sx4dcgFFykghAJo4rBe2oHS3G7yEamUEiBC7NRhqpEOof6TtyT8WAqu/zBmmaqCD7UQV4bLsB4A/03c+7huXt/vqJEbiDfUQnJ71WKx4hhBp/61cPsk89yC5AKZfoZa7RWpbTAcNcfh71HxG++0uNRHGfWq5xKACgDlMYMObW1D9BT2+l9Swu6UFM9WZtppYSsv73Zu5eQr6l9PODnCqThIRGyLk0a7aUr6g== 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)(52116014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j2Wd9MlnApb339V6tYn2R6zNFiY7J4N+hn6G0JC7xj5nwMR7fzOyZU4wTRfnMeQldO1cnOSHlwdmPXYTxL6MM4OwzpRkPO7NGeN2gGcZ5cEYrIixuu7Z5on4ANoaOUkFdNGcMPF5xsQcgUQBH0pXofjCJ7FSqGJrFVHQ+BMtjZvK6CLoJJ7Nu5RbnaKDecTdDv2kAg0JZIFdtAtrKGvCbILS49WfP8jkVE09USGerOAr0idnppP7JS9GF+tU5N85lUapo6pInb0ChRFCv7wBzgVYEnwennpCNMvyZ603Dl/AqtHOBibWqizEj9Aufu6yIcLgtSZUBWPQYlLYvdnZy2UCO9BKNbkIOQDjGOWmTlpHb6j41qVWmtQgMWAo2ti8E0by4f4n61W5X2s4LKw6Ms3y+Ijl/oTZ17nT/okLJOdjM1mr27ZwAGbuDlLA/tSY0qx7VBCHU/MvSFbw5xEqL4qQYp8jNNuoyYAlrChiFhO/dxjy51p8kzfxvRxnSUZ4axrb2RMylFNNd/3cuhYVA78y4Il2e79OZS4AqmHXdefpRA1ELuZdKofcOVgFX7ZrXbdSMRNDiautA3Ek0u03G42hAzgYYuulpxrGi6uWhjIFszbuIisuQ7TKvqjOOlAbOU9jE7potcciwdtvL7gU/JdXMRi8NcIf3EpptgwfUzCFsFOTP3dSnLvWTtn/Stx4y80CCwEnTwvzN0EI4YpT1eT+i6/B4oxnoKKPwqcWNrknJhYcv2xhg1g0P6pPSGkYk/DQx6Aw4KmYzvZdU4kLQTuGMxPK/Zbupxa+RRSqMn133rkibc83xcp+H0Z2qKiVOVYIYzDvDtUa6GPAuu3y+drwvSM+KxjZhAbRqk/TFRjYLXGzwnarpSf7pQyIVQ9D/roovhRv0WiwSa0UcFAaOQl3LCiAedBKk1lXvbvoFXJlWo69zo2J3KGhXp/oHD7jS9ePP21HQSusiUTLDY5jGwe0kdWzuHFvc4/wqrkxAIIlA3eiW2kAJtenkLJyIpzrzCWs4mYhXcyfQqSLSnNx5kkaY7T+auJ6Epb0ASBjBLSsBQGtVFwRZnm2BHxCqX/tFHFlvTuY25TqNjfbqWHMDPOzddXgPTgLKy3XT2R6XN5dqXQJIxR+dcSINyrbnaXgNY6lCxFaDmZQPigHsxeUeb5Bx91HQNwgSlL0FulaXZNJT9ArUhg2saxoYEu+Edn8nr91hL3mlSVE+nLhpy2xds1WbyBAAxpIFduUictluOND3k8lqCeb+EwyGVhzHVrNiFTbUQZccLB90S+Yuim96AyanxS00bFFAOzhX2TfxODpoLKYIEknWzzv9soQ8pjmmzJQHdBhXCGtgWK1+DmaprEElgK35eewUC3arfBPCTvC28RRwLuVaz1bh9A17K49FXBaNWcr9u7BDxOHvyvyU9Uwds9e5F+kK2Fuczz+9+jYwddsgaIP/xyvGw9aTffQiOdsuAFkJkbZg4Hg0CoPy66yckcRxDwr0LAojXXJjcwXE3K/QAFeDwrEEcR/KgYEgZnoiMoUm7KPcmsl2OTQ5eBk2pRvokZ6GS9GfdACxwi6N8ESVMMJ9Zx4cMfKkwc8 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4491cf10-da53-43eb-5e23-08dced1b50ae X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:35.5579 (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: OKZMAqT8JImtYCkY/v0MHeJLALRdiMTYeFIo/tG6Ytu2O3gjnBWEjqX/em9W3J0+vJMFaZSTCG8KmsF3pt83pA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9876 From: Clark Wang There is a situation where num_tx_rings cannot be divided by bdr_int_num. For example, num_tx_rings is 8 and bdr_int_num is 3. According to the previous logic, this results in two tx_bdr corresponding memories not being allocated, so when sending packets to tx ring 6 or 7, wild pointers will be accessed. Of course, this issue doesn't exist on LS1028A, because its num_tx_rings is 8, and bdr_int_num is either 1 or 2. However, there is a risk for the upcoming i.MX95. Therefore, it is necessary to ensure that each tx_bdr can be allocated to the corresponding memory. Signed-off-by: Clark Wang Signed-off-by: Wei Fang Reviewed-by: Claudiu Manoil Reviewed-by: Frank Li --- v2 changes: This patch is separated from v1 patch 9 ("net: enetc: optimize the allocation of tx_bdr"). Only the optimized part is kept. --- drivers/net/ethernet/freescale/enetc/enetc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index d36af3f8ba31..72ddf8b16271 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -3049,10 +3049,10 @@ static void enetc_int_vector_destroy(struct enetc_ndev_priv *priv, int i) int enetc_alloc_msix(struct enetc_ndev_priv *priv) { struct pci_dev *pdev = priv->si->pdev; + int v_tx_rings, v_remainder; int num_stack_tx_queues; int first_xdp_tx_ring; int i, n, err, nvec; - int v_tx_rings; nvec = ENETC_BDR_INT_BASE_IDX + priv->bdr_int_num; /* allocate MSIX for both messaging and Rx/Tx interrupts */ @@ -3066,10 +3066,14 @@ 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++) - if (enetc_int_vector_init(priv, i, v_tx_rings)) + for (i = 0; i < priv->bdr_int_num; i++) { + int num_tx_rings = i < v_remainder ? v_tx_rings + 1 : v_tx_rings; + + if (enetc_int_vector_init(priv, i, num_tx_rings)) goto fail; + } num_stack_tx_queues = enetc_num_stack_tx_queues(priv); From patchwork Tue Oct 15 12:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836363 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 868621B21AE; Tue, 15 Oct 2024 13:14:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998089; cv=fail; b=INe7CQoBDFcquQSowk1DeP/hV2wJTInzh+Dbnl8uxejP3XKGTEwgMz+ioqgPmJ9euZSpyTahjYyga7hB34GTK1na15hQSguMXPmNSJAxiBaItz29SdNZiGbgUP5AVWqKL5+qz0yZeZGSgqioyS7zkdbVeA9UzMR9thDNFPOmYoY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998089; c=relaxed/simple; bh=6TJLSHMobtuA5qbBaO/1aZa41MYkdwkjSPf8jbThMWw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=U9UQfus9n7RREmBGkOr09/nYqEZ0vIitC2AtxLIY8d14RnUfu0ngk2nytjdPPoHqwS4eV7VJ7WedlRinrOMsIuMXZ05sPkcb8JWJrMW5cAH2gQWNUpBTl0IFeFlkJheflJKseMwaBtWACPRh4i1RN5SlC3m38IdQWdyu6Ppgjas= 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=Rg1hxEyA; arc=fail smtp.client-ip=40.107.21.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Rg1hxEyA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X+CyGSK8Pda4ZuBubqKurUEZxKUT4zELigt4Fh/B5oTxErszMVDWyZqxRdhgNvoniTBP0wM3iqC4nbjnNke05QybrlkeaA0thmY2Psn8WGtHdKZqgFQImp01w5A6cj3wtKkcEuthwv3jswb/40ilHubF523vGUs++2bB/dQiFvrgsliVhUdKGJcR+rKsMaSnFZPjp0HVTAVfyYjYyPc1t0O+oXpI6lqk4HD2iQW+MUmKVAeiJS6nY9RzJO98MNZBCpx9RHcEqyl9ajaQAV0ay5oGmNV4Z3w58BE47Y8PpW3R80w1swkNWjc9ZIvA4Q8oNAcMY5fH5713kspOdTqitA== 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=mNAVmboS3Sq7TLBeQrAIgV93YxMaE8w21gI4KK0O8d0=; b=ioTvnR03H13YKNFvzEQhrd5b+G1lbGGfR3YMBSLkW/LTBgHdEp5WjhLP1WP+Ng5L0Son/d2lnjXFq1qdRhbhDqtD3niCVoPfzTCjsZ1jt0iLYKdlxslkxoWJwxqech/u47PzrXiWBQ9sYeMKVlWRN1+1/JTfWN/LbiTPWe8rksV8Zs0S671+vvhxTt4bqGOaddcA2cFBecIUYQOR/g4TRaJvtoTGHVZ5vk+z0Eg9IcJtyCUZm7xG5Y6Mew+L9serWv0KsGgWjA/qa48xm6if+l6KEAEeTuoSM9rjR4tYAzBUORgAPWGHBNWyLC8iRMJ7jzlvPYlX0zf/506WuQO1Rg== 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=mNAVmboS3Sq7TLBeQrAIgV93YxMaE8w21gI4KK0O8d0=; b=Rg1hxEyANR+0l3DRwWcZlujGU4IDLaHQJA8lfXY/xF1bzyFA7YSg5q+z4LHF674ot2XMR63rtu1+ieM3TR/1aQiHK3DDCV/cdARoJB51BcsPVq69dgSCQU9qzYJsFg3kbk/cPZgZjNiQULjRmDCqL7AfVO20G1i5WkHNttI718rGSCRws5uRnG3d8mCLX25ClC2S0JVkL4jSxr1RoJsE9l7hX9D4NvXNtca7FpQt4KJT8YIkr2WAr7EFqL96AGN2SLrbusU68IB9SqAjGW5k/e6DQvhsfIoDSpI3lvluZxQSimuwv5z/WH9uBekHVkuFVKzRx7aYqXIuOdXDDy0p2w== 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 AS5PR04MB9876.eurprd04.prod.outlook.com (2603:10a6:20b:678::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Tue, 15 Oct 2024 13:14:41 +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.8026.019; Tue, 15 Oct 2024 13:14:41 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, xiaoning.wang@nxp.com, Frank.Li@nxp.com, christophe.leroy@csgroup.eu, linux@armlinux.org.uk, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 12/13] net: enetc: add preliminary support for i.MX95 ENETC PF Date: Tue, 15 Oct 2024 20:58:40 +0800 Message-Id: <20241015125841.1075560-13-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS5PR04MB9876:EE_ X-MS-Office365-Filtering-Correlation-Id: cb6724fa-d766-4f2d-05ff-08dced1b5404 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: YdxyBDA8gGEn4ixAnNlx1VeCl2de2I0r8KMaojeYCev7zv5cOyIHExVbDZHRwGK0ps6aJpKtboh/VrBeq4KGgEvJnHymvYAZVUEUBVcCXgKH0jSrjoAvrJYHNzgin4/aTxgQeBIznRkKiDvZiEqd29iaZp3Zk8jtawIZ1W9Cz8jmZkAN7DcxtDXrccS29QSkaUE2AhP4yFrcVLwrZL4y5QVVfCkPM8fvNd7iC8BiPOrb1/yg2ihWeihWw0yKHlpztnDB+G84L1P/9GEYGa9fuxJV6DwZooUzoYMkD7bh1z3Uw7798HePwEji9qZU566EVgNMKZlXRxMiaDx1V7Tp7pUdRy4+W+erZeOT9z6oqX1ao4Vv7jb7V8koWF4wSUa38ZRAvxOXkOA/uUGGLnZP3i8BWHrxZOKrmRVmJnX98Sw3ZJ5Vm6YhETURgyx6EfZ6mvJhbli8KuJlHkvljF6ZdQHQ8W+wzD3Xvad/7fA5BKLkdHZEUYLaZJ/z7gJdx/cwc8m+VunctLkLyA/6ZxPIxMmAu08+gclnNekGgv37d/k6hoETXbo/ESGuP4/nprgQxFTEnVrV/mG7aFJGTcYFmgZ0joKqzOlOfv74/gNpsUGVx5p8IzO/w3GvQJxXMUhoutO4rOtF2JDCq5d97ZNpneF/spDAm+ueAAh3t5eQGKrZZPg9orJsV7RfLSKHMHGFipaklVnRoR58J6hOAh9n8izwB9/t8E4GCdltfWkcgCEpSmglcm0ESPlI4az53vDHP1LyxNIe6XKFIU10/JS2/dqpKe2DMoLjbpfxN9kDhrnNqJh38kNDJI9Eda4YFlOBRMgnDkTOFBgoJ7E8EM8QcygmpGQB4WyvXa/9bxObCP+WCCxF83AvJoEmlhBR0DLuLg/iwaSt/pHTn/uk6jDeJsPZxLqK+k0EQxGevoVhTU67k6012/eEMpXg9UddnGdLI9QTvpRH+HuxKrKvOEJAl2GG1GAC7ylzDLbuKZeFcO+2FR8fAFe50SMIsFY8oEzB4vVXEw5n4tnI6pRJX4ty30K/MVW6eERgUjMzroNsyLGkFFufpq94/mksvIcJm00XCTy1EaeaMmO0TmGGJkhip2jdB/vM/SUmbcC1LeeTt2Vmp93qn4lbbBkcJAyusxcf5CNVaHxyf+oYIHOPpN/Y7WG1UJJWaNIOgf012HV8EVIO+vlxSbYoe5UloVstzqUtEHVYEfkj3YFUgEuMFIkTWM26TWel7hQmgslpLJ2dyLoYhT0h3bHiClR/MlAQP3BrRLlZtTnSQLwZA8O28Qk6RIvoOkU9BoqL9q1jxqCFuxNq+wEfyPpvqrG77hfvgerFa5AqIGmXGdCLLFFKLolsp+l6XWcj/xctUogWup9SaT8= 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)(52116014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rwIsdIt7GKIL0nzRk1mZtttFVv3pt5Qhv3qFtCX+tAlLwykNZmcHgmHsDl+cJO9eohy8fqbTLnkTnaf7yH6PzWLA8z9E2yC/VtK6xX833Kt7hFnbpNHxZNrhRfsYq6EA/YJizVkoNYKmHq8b5Suq8E7Y0cbxRnZFWfVekmloCktwgDGbjIl6xLE+4Y6M1QRkjfMLbJu4xpm2gjfOxC+4K3Mxg/oSXmqFygsFmjxn+ycZhHaYDVZN9N/M6sTZgYov7xXIAb8S2Ol/anVogJidNAmsRnh/zDBSbFOGKWWt87oF9uVJyBwk2zYwVWYy8lTRa8UyxKy5KTYbZ0YTbIfYoR6Z5RtCpOcROCnV/rf8GuH6n8eSVAvXPkSJ6rBX9cI9NL3LHG9YZyPepW6ablLSmwOL44/AJ/n38aRxObQ20zu/WP8ukI9hKUjMFJlkArfw1iOxUOOwfCODG991ConSWqgmbdoIE+MS0R4ZIp34r+naVTFwr8KGdK7umOuez/cwVONRpadLVTbwLIG4MRjbCj4E7ewFBVOQI6ExRewMYTueeJ40urTe0Oc7ZI0C9aQRxKG/rBgG8V74xA/HBZg9dvr9ob0xy7FL+Fawh4JP/yIyNM7K9dhmMCQuTNdHwzR/BDmglXbR0rZ6IGcG/mojK1i1MgTzO3/x7GZGBvKOLE1DwWjYi/sVD3qzFQmhfYQyqj46nxarjtksWVZ5hPcFHnkkta/egXIxUzxr+EbclIzU8aowXtNYlT6HreqWkaAChE404ZY3PBaaFoQb6U3IkVd9SRTgZBVOSutEqXWtCvKPG0zamzDyeOmAE8PFafl+dyfhGbo9slearFzQmiiuf69F3+HEcvf7rajYxP8bhpLk+myVAOqGyBZgtcZZtO9A5LBv52LB1dCNMx85wGdqHZTn5I/35EqnvOy7mzNXqYGScTIZUZufXxi8WL+N94Ve8FMRCcGWkE7iAsQ8f2cRgVBVX8+kK35h+zanZZYduUzQbNsAJxlq7gOrhf0tOpPtujam5sL5cPhlrkGxrYpa3DOBjrXS/v+jF38dj6Y3ZNfLsiRrktfCuH5ZEjl5ld81wzXhNjL03wUs1iKz/4APcxhvoaal4SZKEYY3LifqJR2tZHNERZc7RzxzH/NEHZFRb2r1RByxs3GlWAgqJUktT+6uYG5uoNjG8vFC0LYu1SNy6X70bptMnBBAW07+KxiJ3xk4k6BTpdCyj/yAFCv5V8d0H5AeKuDC7KHQ2J2jxthbucNEkQVUKoWV/ELb3hDqfGMRQYXvxpG2T11niC6E+posu9kmL9c/mxQiooEadtnCBsJnx3acxowKBAx9SC10s8l1bUiF9qUvXPG6xvKEy4C659f93usZooc7UmqSFyEOQvBi4syC88VogMoq0uLP9XJxLke88S9JStorJ+UQHUvB+joT5KG6VpWPMCRBugoY/jCFkDGI+jtx6ErxKzdtYNBkOcreprgAhahqv0Vgvw7Ymrqa01m1pBPGbiQh3ffwzzpzhz+TS8yL3T0fgMfc5KVUMmOKiQd8j16Ls1bnGqzzuLq22TkwEUl5aCecScJgGfMRxMHiPtMzftXMMpJj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb6724fa-d766-4f2d-05ff-08dced1b5404 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:41.3474 (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: FmA2RT+3ujKvp2sfNre3QfQJm5LSR7A/IgMtJM/ukrgtlPEdVyqvYDhYbeFdcURWDTTUY49Yzdz8lOdNGkAYJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9876 The i.MX95 ENETC has been upgraded to revision 4.1, which is very different from the LS1028A ENETC (revision 1.0) except for the SI part. Therefore, the fsl-enetc driver is incompatible with i.MX95 ENETC PF. So add new nxp-enetc4 driver to support i.MX95 ENETC PF, and this driver will be used to support the ENETC PF with major revision 4 for other SoCs in the future. Currently, the nxp-enetc4 driver only supports basic transmission feature for i.MX95 ENETC PF, the more basic and advanced features will be added in the subsequent patches. Signed-off-by: Wei Fang --- v2 changes: 1. Refine the commit message. 2. Sort the header files. 3. Use dev_err_probe() in enetc4_pf_probe(). 4. Remove unused variable 'pf' from enetc4_pf_remove(). --- drivers/net/ethernet/freescale/enetc/Kconfig | 17 + drivers/net/ethernet/freescale/enetc/Makefile | 3 + drivers/net/ethernet/freescale/enetc/enetc.c | 50 +- drivers/net/ethernet/freescale/enetc/enetc.h | 19 +- .../net/ethernet/freescale/enetc/enetc4_hw.h | 153 ++++ .../net/ethernet/freescale/enetc/enetc4_pf.c | 757 ++++++++++++++++++ .../ethernet/freescale/enetc/enetc_ethtool.c | 68 +- .../net/ethernet/freescale/enetc/enetc_hw.h | 12 +- .../net/ethernet/freescale/enetc/enetc_pf.h | 9 + .../freescale/enetc/enetc_pf_common.c | 10 +- 10 files changed, 1076 insertions(+), 22 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 fdd3ecbd1dbf..750281e3d285 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 b81ca462e358..5417815957b5 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 72ddf8b16271..fd7a9dae9e14 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2,6 +2,7 @@ /* Copyright 2017-2019 NXP */ #include "enetc.h" +#include #include #include #include @@ -21,7 +22,7 @@ void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val) { enetc_port_wr(&si->hw, reg, val); if (si->hw_features & ENETC_SI_F_QBU) - enetc_port_wr(&si->hw, reg + ENETC_PMAC_OFFSET, val); + enetc_port_wr(&si->hw, reg + si->pmac_offset, val); } EXPORT_SYMBOL_GPL(enetc_port_mac_wr); @@ -700,8 +701,10 @@ 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); + u64 clk_freq = priv->si->clk_freq; - v->rx_ictt = enetc_usecs_to_cycles(moder.usec); + v->rx_ictt = enetc_usecs_to_cycles(moder.usec, clk_freq); dim->state = DIM_START_MEASURE; } @@ -1721,14 +1724,25 @@ void enetc_get_si_caps(struct enetc_si *si) struct enetc_hw *hw = &si->hw; u32 val; + if (is_enetc_rev1(si)) + si->clk_freq = ENETC_CLK; + else + si->clk_freq = ENETC_CLK_333M; + /* find out how many of various resources we have to work with */ val = enetc_rd(hw, ENETC_SICAPR0); si->num_rx_rings = (val >> 16) & 0xff; si->num_tx_rings = val & 0xff; - val = enetc_rd(hw, ENETC_SIRFSCAPR); - si->num_fs_entries = ENETC_SIRFSCAPR_GET_NUM_RFS(val); - si->num_fs_entries = min(si->num_fs_entries, ENETC_MAX_RFS_SIZE); + val = enetc_rd(hw, ENETC_SIPCAPR0); + if (val & ENETC_SIPCAPR0_RFS) { + val = enetc_rd(hw, ENETC_SIRFSCAPR); + si->num_fs_entries = ENETC_SIRFSCAPR_GET_NUM_RFS(val); + si->num_fs_entries = min(si->num_fs_entries, ENETC_MAX_RFS_SIZE); + } else { + /* ENETC which not supports RFS */ + si->num_fs_entries = 0; + } si->num_rss = 0; val = enetc_rd(hw, ENETC_SIPCAPR0); @@ -1742,8 +1756,11 @@ void enetc_get_si_caps(struct enetc_si *si) if (val & ENETC_SIPCAPR0_QBV) si->hw_features |= ENETC_SI_F_QBV; - if (val & ENETC_SIPCAPR0_QBU) + if (val & ENETC_SIPCAPR0_QBU) { si->hw_features |= ENETC_SI_F_QBU; + si->pmac_offset = is_enetc_rev1(si) ? ENETC_PMAC_OFFSET : + ENETC4_PMAC_OFFSET; + } if (val & ENETC_SIPCAPR0_PSFP) si->hw_features |= ENETC_SI_F_PSFP; @@ -2056,7 +2073,7 @@ int enetc_configure_si(struct enetc_ndev_priv *priv) /* enable SI */ enetc_wr(hw, ENETC_SIMR, ENETC_SIMR_EN); - if (si->num_rss) { + if (si->num_rss && is_enetc_rev1(si)) { err = enetc_setup_default_rss_table(si, priv->num_rx_rings); if (err) return err; @@ -2080,9 +2097,15 @@ 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; + if (is_enetc_rev1(si)) { + priv->bdr_int_num = cpus; + priv->tx_ictt = enetc_usecs_to_cycles(600, ENETC_CLK); + } else { + priv->bdr_int_num = priv->num_rx_rings; + priv->tx_ictt = enetc_usecs_to_cycles(500, ENETC_CLK_333M); + } + priv->ic_mode = ENETC_IC_RX_ADAPTIVE | ENETC_IC_TX_MANUAL; - priv->tx_ictt = ENETC_TXIC_TIMETHR; } EXPORT_SYMBOL_GPL(enetc_init_si_rings_params); @@ -2475,10 +2498,14 @@ int enetc_open(struct net_device *ndev) extended = !!(priv->active_offloads & ENETC_F_RX_TSTAMP); - err = enetc_setup_irqs(priv); + err = clk_prepare_enable(priv->ref_clk); if (err) return err; + err = enetc_setup_irqs(priv); + if (err) + goto err_setup_irqs; + err = enetc_phylink_connect(ndev); if (err) goto err_phy_connect; @@ -2510,6 +2537,8 @@ int enetc_open(struct net_device *ndev) phylink_disconnect_phy(priv->phylink); err_phy_connect: enetc_free_irqs(priv); +err_setup_irqs: + clk_disable_unprepare(priv->ref_clk); return err; } @@ -2559,6 +2588,7 @@ int enetc_close(struct net_device *ndev) enetc_assign_tx_resources(priv, NULL); enetc_free_irqs(priv); + clk_disable_unprepare(priv->ref_clk); return 0; } diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 97524dfa234c..7f1ea11c33a0 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 - \ @@ -222,6 +223,7 @@ struct enetc_msg_swbd { }; #define ENETC_REV1 0x1 +#define ENETC_REV4 0x4 enum enetc_errata { ENETC_ERR_VLAN_ISOL = BIT(0), ENETC_ERR_UCMCSWP = BIT(1), @@ -247,10 +249,22 @@ struct enetc_si { int num_rss; /* number of RSS buckets */ unsigned short pad; int hw_features; + int pmac_offset; /* Only valid for PSI which supports 802.1Qbu */ + u64 clk_freq; }; #define ENETC_SI_ALIGN 32 +static inline bool is_enetc_rev1(struct enetc_si *si) +{ + return si->pdev->revision == ENETC_REV1; +} + +static inline bool is_enetc_rev4(struct enetc_si *si) +{ + return si->pdev->revision == ENETC_REV4; +} + static inline void *enetc_si_priv(const struct enetc_si *si) { return (char *)si + ALIGN(sizeof(struct enetc_si), ENETC_SI_ALIGN); @@ -302,7 +316,7 @@ struct enetc_cls_rule { int used; }; -#define ENETC_MAX_BDR_INT 2 /* fixed to max # of available cpus */ +#define ENETC_MAX_BDR_INT 6 /* fixed to max # of available cpus */ struct psfp_cap { u32 max_streamid; u32 max_psfp_filter; @@ -340,7 +354,6 @@ enum enetc_ic_mode { #define ENETC_RXIC_PKTTHR min_t(u32, 256, ENETC_RX_RING_DEFAULT_SIZE / 2) #define ENETC_TXIC_PKTTHR min_t(u32, 128, ENETC_TX_RING_DEFAULT_SIZE / 2) -#define ENETC_TXIC_TIMETHR enetc_usecs_to_cycles(600) struct enetc_ndev_priv { struct net_device *ndev; @@ -388,6 +401,8 @@ struct enetc_ndev_priv { * and link state updates */ struct mutex mm_lock; + + struct clk *ref_clk; /* RGMII/RMII reference clock */ }; /* Messaging */ diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_hw.h b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h new file mode 100644 index 000000000000..0b2a35189e9d --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_hw.h @@ -0,0 +1,153 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* + * This header file defines the register offsets and bit fields + * of ENETC4 PF and VFs. Note that the same registers as ENETC + * version 1.0 are defined in the enetc_hw.h file. + * + * Copyright 2024 NXP + */ +#ifndef __ENETC4_HW_H_ +#define __ENETC4_HW_H_ + +/***************************ENETC port registers**************************/ +#define ENETC4_ECAPR0 0x0 +#define ECAPR0_RFS BIT(2) +#define ECAPR0_TSD BIT(5) +#define ECAPR0_RSS BIT(8) +#define ECAPR0_RSC BIT(9) +#define ECAPR0_LSO BIT(10) +#define ECAPR0_WO BIT(13) + +#define ENETC4_ECAPR1 0x4 +#define ECAPR1_NUM_TCS GENMASK(6, 4) +#define ECAPR1_NUM_MCH GENMASK(9, 8) +#define ECAPR1_NUM_UCH GENMASK(11, 10) +#define ECAPR1_NUM_MSIX GENMASK(22, 12) +#define ECAPR1_NUM_VSI GENMASK(27, 24) +#define ECAPR1_NUM_IPV BIT(31) + +#define ENETC4_ECAPR2 0x8 +#define ECAPR2_NUM_TX_BDR GENMASK(9, 0) +#define ECAPR2_NUM_RX_BDR GENMASK(25, 16) + +#define ENETC4_PMR 0x10 +#define PMR_SI_EN(a) BIT((16 + (a))) + +/* Port Pause ON/OFF threshold register */ +#define ENETC4_PPAUONTR 0x108 +#define ENETC4_PPAUOFFTR 0x10c + +/* Port Station interface promiscuous MAC mode register */ +#define ENETC4_PSIPMMR 0x200 +#define PSIPMMR_SI0_MAC_UP BIT(0) +#define PSIPMMR_SI_MAC_UP GENMASK(2, 0) +#define PSIPMMR_SI0_MAC_MP BIT(16) +#define PSIPMMR_SI_MAC_MP GENMASK(18, 16) + +/* Port Station interface promiscuous VLAN mode register */ +#define ENETC4_PSIPVMR 0x204 + +/* Port RSS key register n. n = 0,1,2,...,9 */ +#define ENETC4_PRSSKR(n) ((n) * 0x4 + 0x250) + +/* Port station interface MAC address filtering capability register */ +#define ENETC4_PSIMAFCAPR 0x280 +#define PSIMAFCAPR_NUM_MAC_AFTE GENMASK(11, 0) + +/* Port station interface VLAN filtering capability register */ +#define ENETC4_PSIVLANFCAPR 0x2c0 +#define PSIVLANFCAPR_NUM_VLAN_FTE GENMASK(11, 0) + +/* Port station interface VLAN filtering mode register */ +#define ENETC4_PSIVLANFMR 0x2c4 +#define PSIVLANFMR_VS BIT(0) + +/* Port Station interface a primary MAC address registers */ +#define ENETC4_PSIPMAR0(a) ((a) * 0x80 + 0x2000) +#define ENETC4_PSIPMAR1(a) ((a) * 0x80 + 0x2004) + +/* Port station interface a configuration register 0/2 */ +#define ENETC4_PSICFGR0(a) ((a) * 0x80 + 0x2010) +#define PSICFGR0_VASE BIT(13) +#define PSICFGR0_ASE BIT(15) +#define PSICFGR0_ANTI_SPOOFING (PSICFGR0_VASE | PSICFGR0_ASE) + +#define ENETC4_PSICFGR2(a) ((a) * 0x80 + 0x2018) + +#define ENETC4_PMCAPR 0x4004 +#define PMCAPR_HD BIT(8) +#define PMCAPR_FP GENMASK(10, 9) + +/* Port configuration register */ +#define ENETC4_PCR 0x4010 +#define PCR_HDR_FMT BIT(0) +#define PCR_L2DOSE BIT(4) +#define PCR_TIMER_CS BIT(8) +#define PCR_PSPEED GENMASK(29, 16) +#define PCR_PSPEED_VAL(speed) (((speed) / 10 - 1) << 16) + +/* Port MAC address register 0/1 */ +#define ENETC4_PMAR0 0x4020 +#define ENETC4_PMAR1 0x4024 + +/* Port operational register */ +#define ENETC4_POR 0x4100 + +/* Port traffic class a transmit maximum SDU register */ +#define ENETC4_PTCTMSDUR(a) ((a) * 0x20 + 0x4208) +#define PTCTMSDUR_MAXSDU GENMASK(15, 0) +#define PTCTMSDUR_SDU_TYPE GENMASK(17, 16) +#define SDU_TYPE_PPDU 0 +#define SDU_TYPE_MPDU 1 +#define SDU_TYPE_MSDU 2 + +#define ENETC4_PMAC_OFFSET 0x400 +#define ENETC4_PM_CMD_CFG(mac) (0x5008 + (mac) * 0x400) +#define PM_CMD_CFG_TX_EN BIT(0) +#define PM_CMD_CFG_RX_EN BIT(1) +#define PM_CMD_CFG_PAUSE_FWD BIT(7) +#define PM_CMD_CFG_PAUSE_IGN BIT(8) +#define PM_CMD_CFG_TX_ADDR_INS BIT(9) +#define PM_CMD_CFG_LOOP_EN BIT(10) +#define PM_CMD_CFG_LPBK_MODE GENMASK(12, 11) +#define LPBCK_MODE_EXT_TX_CLK 0 +#define LPBCK_MODE_MAC_LEVEL 1 +#define LPBCK_MODE_INT_TX_CLK 2 +#define PM_CMD_CFG_CNT_FRM_EN BIT(13) +#define PM_CMD_CFG_TXP BIT(15) +#define PM_CMD_CFG_SEND_IDLE BIT(16) +#define PM_CMD_CFG_HD_FCEN BIT(18) +#define PM_CMD_CFG_SFD BIT(21) +#define PM_CMD_CFG_TX_FLUSH BIT(22) +#define PM_CMD_CFG_TX_LOWP_EN BIT(23) +#define PM_CMD_CFG_RX_LOWP_EMPTY BIT(24) +#define PM_CMD_CFG_SWR BIT(26) +#define PM_CMD_CFG_TS_MODE BIT(30) +#define PM_CMD_CFG_MG BIT(31) + +/* Port MAC 0/1 Maximum Frame Length Register */ +#define ENETC4_PM_MAXFRM(mac) (0x5014 + (mac) * 0x400) + +/* Port MAC 0/1 Pause Quanta Register */ +#define ENETC4_PM_PAUSE_QUANTA(mac) (0x5054 + (mac) * 0x400) + +/* Port MAC 0/1 Pause Quanta Threshold Register */ +#define ENETC4_PM_PAUSE_THRESH(mac) (0x5064 + (mac) * 0x400) + +/* Port MAC 0 Interface Mode Control Register */ +#define ENETC4_PM_IF_MODE(mac) (0x5300 + (mac) * 0x400) +#define PM_IF_MODE_IFMODE GENMASK(2, 0) +#define IFMODE_XGMII 0 +#define IFMODE_RMII 3 +#define IFMODE_RGMII 4 +#define IFMODE_SGMII 5 +#define PM_IF_MODE_REVMII BIT(3) +#define PM_IF_MODE_M10 BIT(4) +#define PM_IF_MODE_HD BIT(6) +#define PM_IF_MODE_SSP GENMASK(14, 13) +#define SSP_100M 0 +#define SSP_10M 1 +#define SSP_1G 2 +#define PM_IF_MODE_ENA BIT(15) + +#endif diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c new file mode 100644 index 000000000000..cde529a19f13 --- /dev/null +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c @@ -0,0 +1,757 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2024 NXP */ +#include +#include +#include +#include +#include +#include +#include + +#include "enetc_pf.h" + +#define ENETC_SI_MAX_RING_NUM 8 + +static void enetc4_get_port_caps(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + u32 val; + + val = enetc_port_rd(hw, ENETC4_ECAPR1); + pf->caps.num_vsi = (val & ECAPR1_NUM_VSI) >> 24; + pf->caps.num_msix = ((val & ECAPR1_NUM_MSIX) >> 12) + 1; + + val = enetc_port_rd(hw, ENETC4_ECAPR2); + pf->caps.num_rx_bdr = (val & ECAPR2_NUM_RX_BDR) >> 16; + pf->caps.num_tx_bdr = val & ECAPR2_NUM_TX_BDR; + + val = enetc_port_rd(hw, ENETC4_PMCAPR); + pf->caps.half_duplex = (val & PMCAPR_HD) ? 1 : 0; +} + +static void enetc4_pf_set_si_primary_mac(struct enetc_hw *hw, int si, + const u8 *addr) +{ + u16 lower = get_unaligned_le16(addr + 4); + u32 upper = get_unaligned_le32(addr); + + if (si != 0) { + __raw_writel(upper, hw->port + ENETC4_PSIPMAR0(si)); + __raw_writew(lower, hw->port + ENETC4_PSIPMAR1(si)); + } else { + __raw_writel(upper, hw->port + ENETC4_PMAR0); + __raw_writew(lower, hw->port + ENETC4_PMAR1); + } +} + +static void enetc4_pf_get_si_primary_mac(struct enetc_hw *hw, int si, + u8 *addr) +{ + u32 upper; + u16 lower; + + upper = __raw_readl(hw->port + ENETC4_PSIPMAR0(si)); + lower = __raw_readw(hw->port + ENETC4_PSIPMAR1(si)); + + put_unaligned_le32(upper, addr); + put_unaligned_le16(lower, addr + 4); +} + +static const struct enetc_pf_ops enetc4_pf_ops = { + .set_si_primary_mac = enetc4_pf_set_si_primary_mac, + .get_si_primary_mac = enetc4_pf_get_si_primary_mac, +}; + +static int enetc4_pf_struct_init(struct enetc_si *si) +{ + struct enetc_pf *pf = enetc_si_priv(si); + + pf->si = si; + pf->total_vfs = pci_sriov_get_totalvfs(si->pdev); + + enetc4_get_port_caps(pf); + enetc_pf_ops_register(pf, &enetc4_pf_ops); + + return 0; +} + +static u32 enetc4_psicfgr0_val_construct(bool is_vf, u32 num_tx_bdr, u32 num_rx_bdr) +{ + u32 val; + + val = ENETC_PSICFGR0_SET_TXBDR(num_tx_bdr); + val |= ENETC_PSICFGR0_SET_RXBDR(num_rx_bdr); + val |= ENETC_PSICFGR0_SIVC(ENETC_VLAN_TYPE_C | ENETC_VLAN_TYPE_S); + + if (is_vf) + val |= ENETC_PSICFGR0_VTE | ENETC_PSICFGR0_SIVIE; + + return val; +} + +static void enetc4_default_rings_allocation(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + u32 num_rx_bdr, num_tx_bdr, val; + u32 vf_tx_bdr, vf_rx_bdr; + int i, rx_rem, tx_rem; + + if (pf->caps.num_rx_bdr < ENETC_SI_MAX_RING_NUM + pf->caps.num_vsi) + num_rx_bdr = pf->caps.num_rx_bdr - pf->caps.num_vsi; + else + num_rx_bdr = ENETC_SI_MAX_RING_NUM; + + if (pf->caps.num_tx_bdr < ENETC_SI_MAX_RING_NUM + pf->caps.num_vsi) + num_tx_bdr = pf->caps.num_tx_bdr - pf->caps.num_vsi; + else + num_tx_bdr = ENETC_SI_MAX_RING_NUM; + + val = enetc4_psicfgr0_val_construct(false, num_tx_bdr, num_rx_bdr); + enetc_port_wr(hw, ENETC4_PSICFGR0(0), val); + + num_rx_bdr = pf->caps.num_rx_bdr - num_rx_bdr; + rx_rem = num_rx_bdr % pf->caps.num_vsi; + num_rx_bdr = num_rx_bdr / pf->caps.num_vsi; + + num_tx_bdr = pf->caps.num_tx_bdr - num_tx_bdr; + tx_rem = num_tx_bdr % pf->caps.num_vsi; + num_tx_bdr = num_tx_bdr / pf->caps.num_vsi; + + for (i = 0; i < pf->caps.num_vsi; i++) { + vf_tx_bdr = (i < tx_rem) ? num_tx_bdr + 1 : num_tx_bdr; + vf_rx_bdr = (i < rx_rem) ? num_rx_bdr + 1 : num_rx_bdr; + val = enetc4_psicfgr0_val_construct(true, vf_tx_bdr, vf_rx_bdr); + enetc_port_wr(hw, ENETC4_PSICFGR0(i + 1), val); + } +} + +static void enetc4_allocate_si_rings(struct enetc_pf *pf) +{ + enetc4_default_rings_allocation(pf); +} + +static void enetc4_pf_set_si_vlan_promisc(struct enetc_hw *hw, int si, bool en) +{ + u32 val = enetc_port_rd(hw, ENETC4_PSIPVMR); + + if (en) + val |= BIT(si); + else + val &= ~BIT(si); + + enetc_port_wr(hw, ENETC4_PSIPVMR, val); +} + +static void enetc4_set_default_si_vlan_promisc(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + int num_si = pf->caps.num_vsi + 1; + int i; + + /* enforce VLAN promisc mode for all SIs */ + for (i = 0; i < num_si; i++) + enetc4_pf_set_si_vlan_promisc(hw, i, true); +} + +/* Allocate the number of MSI-X vectors for per SI. */ +static void enetc4_set_si_msix_num(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + int i, num_msix, total_si; + u32 val; + + total_si = pf->caps.num_vsi + 1; + + num_msix = pf->caps.num_msix / total_si + + pf->caps.num_msix % total_si - 1; + val = num_msix & 0x3f; + enetc_port_wr(hw, ENETC4_PSICFGR2(0), val); + + num_msix = pf->caps.num_msix / total_si - 1; + val = num_msix & 0x3f; + for (i = 0; i < pf->caps.num_vsi; i++) + enetc_port_wr(hw, ENETC4_PSICFGR2(i + 1), val); +} + +static void enetc4_enable_all_si(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + int num_si = pf->caps.num_vsi + 1; + u32 si_bitmap = 0; + int i; + + /* Master enable for all SIs */ + for (i = 0; i < num_si; i++) + si_bitmap |= PMR_SI_EN(i); + + enetc_port_wr(hw, ENETC4_PMR, si_bitmap); +} + +static void enetc4_configure_port_si(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + + enetc4_allocate_si_rings(pf); + + /* Outer VLAN tag will be used for VLAN filtering */ + enetc_port_wr(hw, ENETC4_PSIVLANFMR, PSIVLANFMR_VS); + + enetc4_set_default_si_vlan_promisc(pf); + + /* Disable SI MAC multicast & unicast promiscuous */ + enetc_port_wr(hw, ENETC4_PSIPMMR, 0); + + enetc4_set_si_msix_num(pf); + + enetc4_enable_all_si(pf); +} + +static void enetc4_pf_reset_tc_msdu(struct enetc_hw *hw) +{ + u32 val = ENETC_MAC_MAXFRM_SIZE; + int tc; + + val = u32_replace_bits(val, SDU_TYPE_MPDU, PTCTMSDUR_SDU_TYPE); + + for (tc = 0; tc < 8; tc++) + enetc_port_wr(hw, ENETC4_PTCTMSDUR(tc), val); +} + +static void enetc4_set_trx_frame_size(struct enetc_pf *pf) +{ + struct enetc_si *si = pf->si; + + enetc_port_mac_wr(si, ENETC4_PM_MAXFRM(0), + ENETC_SET_MAXFRM(ENETC_MAC_MAXFRM_SIZE)); + + enetc4_pf_reset_tc_msdu(&si->hw); +} + +static void enetc4_set_rss_key(struct enetc_hw *hw, const u8 *bytes) +{ + int i; + + for (i = 0; i < ENETC_RSSHASH_KEY_SIZE / 4; i++) + enetc_port_wr(hw, ENETC4_PRSSKR(i), ((u32 *)bytes)[i]); +} + +static void enetc4_set_default_rss_key(struct enetc_pf *pf) +{ + u8 hash_key[ENETC_RSSHASH_KEY_SIZE] = {0}; + struct enetc_hw *hw = &pf->si->hw; + + /* set up hash key */ + get_random_bytes(hash_key, ENETC_RSSHASH_KEY_SIZE); + enetc4_set_rss_key(hw, hash_key); +} + +static void enetc4_enable_trx(struct enetc_pf *pf) +{ + struct enetc_hw *hw = &pf->si->hw; + + /* Enable port transmit/receive */ + enetc_port_wr(hw, ENETC4_POR, 0); +} + +static void enetc4_configure_port(struct enetc_pf *pf) +{ + enetc4_configure_port_si(pf); + enetc4_set_trx_frame_size(pf); + enetc4_set_default_rss_key(pf); + enetc4_enable_trx(pf); +} + +static int enetc4_pf_init(struct enetc_pf *pf) +{ + struct device *dev = &pf->si->pdev->dev; + int err; + + /* Initialize the MAC address for PF and VFs */ + err = enetc_setup_mac_addresses(dev->of_node, pf); + if (err) { + dev_err(dev, "Failed to set MAC addresses\n"); + return err; + } + + enetc4_configure_port(pf); + + return 0; +} + +static const struct net_device_ops enetc4_ndev_ops = { + .ndo_open = enetc_open, + .ndo_stop = enetc_close, + .ndo_start_xmit = enetc_xmit, + .ndo_get_stats = enetc_get_stats, + .ndo_set_mac_address = enetc_pf_set_mac_addr, +}; + +static struct phylink_pcs * +enetc4_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t iface) +{ + struct enetc_pf *pf = phylink_to_enetc_pf(config); + + return pf->pcs; +} + +static void enetc4_mac_config(struct enetc_pf *pf, unsigned int mode, + phy_interface_t phy_mode) +{ + struct enetc_ndev_priv *priv = netdev_priv(pf->si->ndev); + struct enetc_si *si = pf->si; + u32 val; + + val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val &= ~(PM_IF_MODE_IFMODE | PM_IF_MODE_ENA); + + switch (phy_mode) { + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + val |= IFMODE_RGMII; + /* We need to enable auto-negotiation for the MAC + * if its RGMII interface support In-Band status. + */ + if (phylink_autoneg_inband(mode)) + val |= PM_IF_MODE_ENA; + break; + case PHY_INTERFACE_MODE_RMII: + val |= IFMODE_RMII; + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_2500BASEX: + val |= IFMODE_SGMII; + break; + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_USXGMII: + val |= IFMODE_XGMII; + break; + default: + dev_err(priv->dev, + "Unsupported PHY mode:%d\n", phy_mode); + return; + } + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_pl_mac_config(struct phylink_config *config, unsigned int mode, + const struct phylink_link_state *state) +{ + struct enetc_pf *pf = phylink_to_enetc_pf(config); + + enetc4_mac_config(pf, mode, state->interface); +} + +static void enetc4_set_port_speed(struct enetc_ndev_priv *priv, int speed) +{ + u32 old_speed = priv->speed; + u32 val; + + if (speed == old_speed) + return; + + val = enetc_port_rd(&priv->si->hw, ENETC4_PCR); + val &= ~PCR_PSPEED; + + switch (speed) { + case SPEED_100: + case SPEED_1000: + case SPEED_2500: + case SPEED_10000: + val |= (PCR_PSPEED & PCR_PSPEED_VAL(speed)); + break; + case SPEED_10: + default: + val |= (PCR_PSPEED & PCR_PSPEED_VAL(SPEED_10)); + } + + priv->speed = speed; + enetc_port_wr(&priv->si->hw, ENETC4_PCR, val); +} + +static void enetc4_set_rgmii_mac(struct enetc_pf *pf, int speed, int duplex) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val = old_val & ~(PM_IF_MODE_ENA | PM_IF_MODE_M10 | PM_IF_MODE_REVMII); + + switch (speed) { + case SPEED_1000: + val = u32_replace_bits(val, SSP_1G, PM_IF_MODE_SSP); + break; + case SPEED_100: + val = u32_replace_bits(val, SSP_100M, PM_IF_MODE_SSP); + break; + case SPEED_10: + val = u32_replace_bits(val, SSP_10M, PM_IF_MODE_SSP); + } + + val = u32_replace_bits(val, duplex == DUPLEX_FULL ? 0 : 1, + PM_IF_MODE_HD); + + if (val == old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_set_rmii_mac(struct enetc_pf *pf, int speed, int duplex) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0)); + val = old_val & ~(PM_IF_MODE_ENA | PM_IF_MODE_SSP); + + switch (speed) { + case SPEED_100: + val &= ~PM_IF_MODE_M10; + break; + case SPEED_10: + val |= PM_IF_MODE_M10; + } + + val = u32_replace_bits(val, duplex == DUPLEX_FULL ? 0 : 1, + PM_IF_MODE_HD); + + if (val == old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val); +} + +static void enetc4_set_hd_flow_control(struct enetc_pf *pf, bool enable) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + if (!pf->caps.half_duplex) + return; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val = u32_replace_bits(old_val, enable ? 1 : 0, PM_CMD_CFG_HD_FCEN); + if (val == old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_set_rx_pause(struct enetc_pf *pf, bool rx_pause) +{ + struct enetc_si *si = pf->si; + u32 old_val, val; + + old_val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val = u32_replace_bits(old_val, rx_pause ? 0 : 1, PM_CMD_CFG_PAUSE_IGN); + if (val == old_val) + return; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_set_tx_pause(struct enetc_pf *pf, int num_rxbdr, bool tx_pause) +{ + u32 pause_off_thresh = 0, pause_on_thresh = 0; + u32 init_quanta = 0, refresh_quanta = 0; + struct enetc_hw *hw = &pf->si->hw; + u32 rbmr, old_rbmr; + int i; + + for (i = 0; i < num_rxbdr; i++) { + old_rbmr = enetc_rxbdr_rd(hw, i, ENETC_RBMR); + rbmr = u32_replace_bits(old_rbmr, tx_pause ? 1 : 0, ENETC_RBMR_CM); + if (rbmr == old_rbmr) + continue; + + enetc_rxbdr_wr(hw, i, ENETC_RBMR, rbmr); + } + + if (tx_pause) { + /* When the port first enters congestion, send a PAUSE request + * with the maximum number of quanta. When the port exits + * congestion, it will automatically send a PAUSE frame with + * zero quanta. + */ + init_quanta = 0xffff; + + /* Also, set up the refresh timer to send follow-up PAUSE + * frames at half the quanta value, in case the congestion + * condition persists. + */ + refresh_quanta = 0xffff / 2; + + /* Start emitting PAUSE frames when 3 large frames (or more + * smaller frames) have accumulated in the FIFO waiting to be + * DMAed to the RX ring. + */ + pause_on_thresh = 3 * ENETC_MAC_MAXFRM_SIZE; + pause_off_thresh = 1 * ENETC_MAC_MAXFRM_SIZE; + } + + enetc_port_mac_wr(pf->si, ENETC4_PM_PAUSE_QUANTA(0), init_quanta); + enetc_port_mac_wr(pf->si, ENETC4_PM_PAUSE_THRESH(0), refresh_quanta); + enetc_port_wr(hw, ENETC4_PPAUONTR, pause_on_thresh); + enetc_port_wr(hw, ENETC4_PPAUOFFTR, pause_off_thresh); +} + +static void enetc4_enable_mac(struct enetc_pf *pf, bool en) +{ + struct enetc_si *si = pf->si; + u32 val; + + val = enetc_port_mac_rd(si, ENETC4_PM_CMD_CFG(0)); + val &= ~(PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN); + val |= en ? (PM_CMD_CFG_TX_EN | PM_CMD_CFG_RX_EN) : 0; + + enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val); +} + +static void enetc4_pl_mac_link_up(struct phylink_config *config, + struct phy_device *phy, unsigned int mode, + phy_interface_t interface, int speed, + int duplex, bool tx_pause, bool rx_pause) +{ + struct enetc_pf *pf = phylink_to_enetc_pf(config); + struct enetc_si *si = pf->si; + struct enetc_ndev_priv *priv; + bool hd_fc = false; + + priv = netdev_priv(si->ndev); + enetc4_set_port_speed(priv, speed); + + if (!phylink_autoneg_inband(mode) && + phy_interface_mode_is_rgmii(interface)) + enetc4_set_rgmii_mac(pf, speed, duplex); + + if (interface == PHY_INTERFACE_MODE_RMII) + enetc4_set_rmii_mac(pf, speed, duplex); + + if (duplex == DUPLEX_FULL) { + /* When preemption is enabled, generation of PAUSE frames + * must be disabled, as stated in the IEEE 802.3 standard. + */ + if (priv->active_offloads & ENETC_F_QBU) + tx_pause = false; + } else { /* DUPLEX_HALF */ + if (tx_pause || rx_pause) + hd_fc = true; + + /* As per 802.3 annex 31B, PAUSE frames are only supported + * when the link is configured for full duplex operation. + */ + tx_pause = false; + rx_pause = false; + } + + enetc4_set_hd_flow_control(pf, hd_fc); + enetc4_set_tx_pause(pf, priv->num_rx_rings, tx_pause); + enetc4_set_rx_pause(pf, rx_pause); + enetc4_enable_mac(pf, true); +} + +static void enetc4_pl_mac_link_down(struct phylink_config *config, + unsigned int mode, + phy_interface_t interface) +{ + struct enetc_pf *pf = phylink_to_enetc_pf(config); + + enetc4_enable_mac(pf, false); +} + +static const struct phylink_mac_ops enetc_pl_mac_ops = { + .mac_select_pcs = enetc4_pl_mac_select_pcs, + .mac_config = enetc4_pl_mac_config, + .mac_link_up = enetc4_pl_mac_link_up, + .mac_link_down = enetc4_pl_mac_link_down, +}; + +static 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, "enet_ref_clk"); + if (IS_ERR(priv->ref_clk)) { + dev_err(dev, "Get enet_ref_clk 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 net_device *ndev = si->ndev; + struct enetc_ndev_priv *priv; + + priv = netdev_priv(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) { + dev_err_probe(dev, err, "PCIe probing failed\n"); + return err; + } + + /* si is the private data. */ + si = pci_get_drvdata(pdev); + if (!si->hw.port || !si->hw.global) { + err = -ENODEV; + dev_err_probe(dev, err, "Couldn't map PF only space\n"); + goto err_enetc_pci_probe; + } + + err = enetc4_pf_struct_init(si); + if (err) + goto err_pf_struct_init; + + pf = enetc_si_priv(si); + err = enetc4_pf_init(pf); + if (err) + goto err_pf_init; + + pinctrl_pm_select_default_state(dev); + enetc_get_si_caps(si); + err = enetc4_pf_netdev_create(si); + if (err) + goto err_netdev_create; + + return 0; + +err_netdev_create: +err_pf_init: +err_pf_struct_init: +err_enetc_pci_probe: + enetc_pci_remove(pdev); + + return err; +} + +static void enetc4_pf_remove(struct pci_dev *pdev) +{ + struct enetc_si *si = pci_get_drvdata(pdev); + + enetc4_pf_netdev_destroy(si); + enetc_pci_remove(pdev); +} + +static const struct pci_device_id enetc4_pf_id_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_NXP2, PCI_DEVICE_ID_NXP2_ENETC_PF) }, + { 0, } /* End of table. */ +}; +MODULE_DEVICE_TABLE(pci, enetc4_pf_id_table); + +static struct pci_driver enetc4_pf_driver = { + .name = KBUILD_MODNAME, + .id_table = enetc4_pf_id_table, + .probe = enetc4_pf_probe, + .remove = enetc4_pf_remove, +}; +module_pci_driver(enetc4_pf_driver); + +MODULE_DESCRIPTION("ENETC4 PF Driver"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c index 2563eb8ac7b6..13ce771e0c43 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c @@ -44,6 +44,9 @@ static int enetc_get_reglen(struct net_device *ndev) struct enetc_hw *hw = &priv->si->hw; int len; + if (is_enetc_rev4(priv->si)) + return -EOPNOTSUPP; + len = ARRAY_SIZE(enetc_si_regs); len += ARRAY_SIZE(enetc_txbdr_regs) * priv->num_tx_rings; len += ARRAY_SIZE(enetc_rxbdr_regs) * priv->num_rx_rings; @@ -68,6 +71,9 @@ static void enetc_get_regs(struct net_device *ndev, struct ethtool_regs *regs, int i, j; u32 addr; + if (is_enetc_rev4(priv->si)) + return; + for (i = 0; i < ARRAY_SIZE(enetc_si_regs); i++) { *buf++ = enetc_si_regs[i]; *buf++ = enetc_rd(hw, enetc_si_regs[i]); @@ -229,6 +235,9 @@ static int enetc_get_sset_count(struct net_device *ndev, int sset) struct enetc_ndev_priv *priv = netdev_priv(ndev); int len; + if (is_enetc_rev4(priv->si)) + return -EOPNOTSUPP; + if (sset != ETH_SS_STATS) return -EOPNOTSUPP; @@ -250,6 +259,9 @@ static void enetc_get_strings(struct net_device *ndev, u32 stringset, u8 *data) u8 *p = data; int i, j; + if (is_enetc_rev4(priv->si)) + return; + switch (stringset) { case ETH_SS_STATS: for (i = 0; i < ARRAY_SIZE(enetc_si_counters); i++) { @@ -290,6 +302,9 @@ static void enetc_get_ethtool_stats(struct net_device *ndev, struct enetc_hw *hw = &priv->si->hw; int i, o = 0; + if (is_enetc_rev4(priv->si)) + return; + for (i = 0; i < ARRAY_SIZE(enetc_si_counters); i++) data[o++] = enetc_rd64(hw, enetc_si_counters[i].reg); @@ -331,6 +346,9 @@ static void enetc_get_pause_stats(struct net_device *ndev, struct enetc_hw *hw = &priv->si->hw; struct enetc_si *si = priv->si; + if (is_enetc_rev4(si)) + return; + switch (pause_stats->src) { case ETHTOOL_MAC_STATS_SRC_EMAC: enetc_pause_stats(hw, 0, pause_stats); @@ -418,6 +436,9 @@ static void enetc_get_eth_mac_stats(struct net_device *ndev, struct enetc_hw *hw = &priv->si->hw; struct enetc_si *si = priv->si; + if (is_enetc_rev4(si)) + return; + switch (mac_stats->src) { case ETHTOOL_MAC_STATS_SRC_EMAC: enetc_mac_stats(hw, 0, mac_stats); @@ -439,6 +460,9 @@ static void enetc_get_eth_ctrl_stats(struct net_device *ndev, struct enetc_hw *hw = &priv->si->hw; struct enetc_si *si = priv->si; + if (is_enetc_rev4(si)) + return; + switch (ctrl_stats->src) { case ETHTOOL_MAC_STATS_SRC_EMAC: enetc_ctrl_stats(hw, 0, ctrl_stats); @@ -461,6 +485,9 @@ static void enetc_get_rmon_stats(struct net_device *ndev, struct enetc_hw *hw = &priv->si->hw; struct enetc_si *si = priv->si; + if (is_enetc_rev4(si)) + return; + *ranges = enetc_rmon_ranges; switch (rmon_stats->src) { @@ -593,6 +620,9 @@ static int enetc_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc, struct enetc_ndev_priv *priv = netdev_priv(ndev); int i, j; + if (is_enetc_rev4(priv->si)) + return -EOPNOTSUPP; + switch (rxnfc->cmd) { case ETHTOOL_GRXRINGS: rxnfc->data = priv->num_rx_rings; @@ -643,6 +673,9 @@ static int enetc_set_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc) struct enetc_ndev_priv *priv = netdev_priv(ndev); int err; + if (is_enetc_rev4(priv->si)) + return -EOPNOTSUPP; + switch (rxnfc->cmd) { case ETHTOOL_SRXCLSRLINS: if (rxnfc->fs.location >= priv->si->num_fs_entries) @@ -678,6 +711,9 @@ static u32 enetc_get_rxfh_key_size(struct net_device *ndev) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + if (is_enetc_rev4(priv->si)) + return 0; + /* return the size of the RX flow hash key. PF only */ return (priv->si->hw.port) ? ENETC_RSSHASH_KEY_SIZE : 0; } @@ -686,6 +722,9 @@ static u32 enetc_get_rxfh_indir_size(struct net_device *ndev) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + if (is_enetc_rev4(priv->si)) + return 0; + /* return the size of the RX flow hash indirection table */ return priv->si->num_rss; } @@ -697,6 +736,9 @@ static int enetc_get_rxfh(struct net_device *ndev, struct enetc_hw *hw = &priv->si->hw; int err = 0, i; + if (is_enetc_rev4(priv->si)) + return -EOPNOTSUPP; + /* return hash function */ rxfh->hfunc = ETH_RSS_HASH_TOP; @@ -731,6 +773,9 @@ static int enetc_set_rxfh(struct net_device *ndev, struct enetc_hw *hw = &priv->si->hw; int err = 0; + if (is_enetc_rev4(priv->si)) + return -EOPNOTSUPP; + /* set hash key, if PF */ if (rxfh->key && hw->port) enetc_set_rss_key(hw, rxfh->key); @@ -775,9 +820,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->si->clk_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 +839,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->si->clk_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; @@ -843,8 +890,12 @@ static int enetc_set_coalesce(struct net_device *ndev, static int enetc_get_ts_info(struct net_device *ndev, struct kernel_ethtool_ts_info *info) { + struct enetc_ndev_priv *priv = netdev_priv(ndev); int *phc_idx; + if (is_enetc_rev4(priv->si)) + return -EOPNOTSUPP; + phc_idx = symbol_get(enetc_phc_index); if (phc_idx) { info->phc_index = *phc_idx; @@ -942,6 +993,9 @@ static void enetc_get_mm_stats(struct net_device *ndev, struct enetc_hw *hw = &priv->si->hw; struct enetc_si *si = priv->si; + if (is_enetc_rev4(si)) + return; + if (!(si->hw_features & ENETC_SI_F_QBU)) return; @@ -960,6 +1014,9 @@ static int enetc_get_mm(struct net_device *ndev, struct ethtool_mm_state *state) struct enetc_hw *hw = &si->hw; u32 lafs, rafs, val; + if (is_enetc_rev4(si)) + return -EOPNOTSUPP; + if (!(si->hw_features & ENETC_SI_F_QBU)) return -EOPNOTSUPP; @@ -1090,6 +1147,9 @@ static int enetc_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg, u32 val, add_frag_size; int err; + if (is_enetc_rev4(si)) + return -EOPNOTSUPP; + if (!(si->hw_features & ENETC_SI_F_QBU)) return -EOPNOTSUPP; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index 6a7b9b75d660..230e94986091 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -25,6 +25,7 @@ #define ENETC_SIPCAPR0_RSS BIT(8) #define ENETC_SIPCAPR0_QBV BIT(4) #define ENETC_SIPCAPR0_QBU BIT(3) +#define ENETC_SIPCAPR0_RFS BIT(2) #define ENETC_SIPCAPR1 0x24 #define ENETC_SITGTGR 0x30 #define ENETC_SIRBGCR 0x38 @@ -971,15 +972,16 @@ struct enetc_cbd { u8 status_flags; }; -#define ENETC_CLK 400000000ULL -static inline u32 enetc_cycles_to_usecs(u32 cycles) +#define ENETC_CLK 400000000ULL +#define ENETC_CLK_333M 333000000ULL +static inline u32 enetc_cycles_to_usecs(u32 cycles, u64 clk_freq) { - return (u32)div_u64(cycles * 1000000ULL, ENETC_CLK); + return (u32)div_u64(cycles * 1000000ULL, clk_freq); } -static inline u32 enetc_usecs_to_cycles(u32 usecs) +static inline u32 enetc_usecs_to_cycles(u32 usecs, u64 clk_freq) { - return (u32)div_u64(usecs * ENETC_CLK, 1000000ULL); + return (u32)div_u64(usecs * clk_freq, 1000000ULL); } /* Port traffic class frame preemption register */ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h index 39db9d5c2e50..5ed97137e5c5 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h @@ -28,6 +28,14 @@ struct enetc_vf_state { enum enetc_vf_flags flags; }; +struct enetc_port_caps { + u32 half_duplex:1; + int num_vsi; + int num_msix; + int num_rx_bdr; + int num_tx_bdr; +}; + struct enetc_pf; struct enetc_pf_ops { @@ -61,6 +69,7 @@ struct enetc_pf { phy_interface_t if_mode; struct phylink_config phylink_config; + struct enetc_port_caps caps; const struct enetc_pf_ops *ops; }; diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c index 2c6ce887f583..18fe7861a6fe 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c @@ -120,10 +120,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_rev4(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; @@ -135,6 +142,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); } From patchwork Tue Oct 15 12:58:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13836364 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2059.outbound.protection.outlook.com [40.107.20.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCCD1227B86; Tue, 15 Oct 2024 13:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998091; cv=fail; b=ecBEm1G0XwbXO/VU6W4UWVDBRSmFBnHQuvAg/c//y0lZXafAvCnn+DWuTXDsgb6jnGqNyiKRhwTbfRdMTkBHUqXiW7sWNaXBIAWdM5sB2ka9AJf3GXyzsrEqU6vtI0Huw8gshtPye1PGpMr8kt5ffyK2guZFaTgJm3ShiTA/iIs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998091; c=relaxed/simple; bh=YgZNB/EmSVJPLKDYKi47AleOk5ikPYICbIRo2U2baf4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tSN/EyN4NFJU+qQfF7I+78yBMF+l8EqHumBySTh7aQxVYLKAGbPCb8YnTe9jSsjFgs24NCWnHfFsPY6forqcfNpReSZ9lPC//bnxIE2mNb5dVs5S3jCWqpUU7VM97G4xk3ev+h+fJIRybLeppgBitTH5nsOK+i9lxC2SfZDXumE= 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=EVQBh0ml; arc=fail smtp.client-ip=40.107.20.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="EVQBh0ml" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GEre3735zEUkg+KvJ3AC0h+pga26Do6kJ2TzgtJHV59/hYw7diYEth29onTKma59hzPiYMYzYfa3/ONgTOhDLKSdNzRtz3KL8bh/ZjZHN341J39hs0oRlAyBQlNevVj3u4rLRL7XVQN9BaVvS2ATYmbNeYIkSlkLLadgAfb0+GVi8W+FV3YGjeajh7H7lvUVvDa71L2ITSnEuJ2sIll64YOj7nifhliSKlItoV/1DJZhMLfqbLJyMvCaMrglwZHh/d2VMFwAIZscpUf7fQuGUv0PkPOYphGhF4aeKVLmuzWO81wZn/egL+QtxRhVenGL/7eUF1Fk/7I19iZrq+xytw== 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=NVtYO/fn4p2g/u3b2G4C8Nt+g+55vkATBe26/TZIf1g=; b=lIUdfUpoBJr/9aGjSzDaQLBuNymnO+3kZyQewZNVtoO5orRiz9Vi+y0XDFe+mskyGTAolYAJatTeTxsqoSRpFrq8djBwhiDRVZH6bXrqHSV5eY/Jk2MGRb7+uXkkVnsjL+V+ZJeYyMqPSFf5fXQJRad12B7poDX+Wk/++4MUreYcEPOCzgo1FEZN4DO/B9OYzlInw9LlAgkUolg1gX5YJ4aT4wYGOpbGRs/63hKzv0fxQckCq79dBlaPcPqLazBx/XkWEsMLgdcK6GGKbmeCrd+xif7RkaRnQqIW4I51bN0nFxkU+Yrya/CiJXQrbGI6RfuSliRppsauUrQxPpTcuw== 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=NVtYO/fn4p2g/u3b2G4C8Nt+g+55vkATBe26/TZIf1g=; b=EVQBh0mlAO9rTofsSkPknL9uyDk9E1Y8EBOubr8KEg2lTa8uGW5WC3w+19gV2VJwAb8ukpswXlNGEHomXERo7mp/dD7Coh1TgsNGMrLzfz51n2iwi8LuewVHHfycH/JxWpBHWLuX/qqF42GqNiIQd4U+Q0P/xx2esovwyxYyp1jYRgKFV46ZMBwx+lMw9IR57ZhQ6WTEcegaWBEqfNhVxkt6JGUolcW1knQsNgpl1toHHh9C8Wt7iYiCW0288n9k3rfmiRp53GfdkNXjPugujUrEzCBCRI4g/wycXqc2NhAOTg8Ly+jfPp5WszHYg6jIq7ms1fBlWzIpuLLMit3hdA== 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 PAWPR04MB9988.eurprd04.prod.outlook.com (2603:10a6:102:38b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 13:14: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.8026.019; Tue, 15 Oct 2024 13:14: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, bhelgaas@google.com, horms@kernel.org Cc: imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 net-next 13/13] MAINTAINERS: update ENETC driver files and maintainers Date: Tue, 15 Oct 2024 20:58:41 +0800 Message-Id: <20241015125841.1075560-14-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015125841.1075560-1-wei.fang@nxp.com> References: <20241015125841.1075560-1-wei.fang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|PAWPR04MB9988:EE_ X-MS-Office365-Filtering-Correlation-Id: 16f04ea6-d5a0-4f05-8ccd-08dced1b5779 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|7416014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: OodAkMIoGsTe3CInzM7/o+L4UePet/S67hVgOvC0ORQ6iJrEpODvbB02KkkL8vKoZeo01e6HFhLBKUa5MLK9XKhB2TZ/Xh6wOEXrlhqtZw4gf5+B+VCS9HrtMOH49O93XsSiZJt9AgGJ5RFxIBnTY/BA26AwRWBhv/urAxPecirmtrInWPrAOgTC/cNHK14Gg0S/1HeyfdNpiVcpCtGRvHYdrpo31P4D/qjnPMEReGp9okYh1DabMhSb7Eg4FHxHvJbnKS4ce45CJJeKkaGitYVE6MivsDHn/szJIZ9ob+3gNYRtFUrY4nmWfYpcf9zlf60Aqy49sVD80dZI1m8IBgLW+7UYQHXd/+Qaa1pmWgyOvblI65D9lju2W1hi1QxWfpjd3OIO+W25kS5yyKdfyJ1E8tJIQRiF4RIpIG5xFrHTME1cWTITI7fqRj8UYT63uUr1ix0syZuaLhmOmKdQQyL4iBE94UMUuSSwfIGHL0cAPyL+KmHqw324D0bCy2Al4MEzjeF36IfBZipFDwb5usdH2iMu5j9AExm1XNvhjB3iI02jTfYcWpPC+U8oWo4whMQDEpsWnfVy525baK6i3gvHhI0mpvnlZZxGY/xGua45WmZwAW7BogUgqhp994pf+gSAhUqNmH4RsxIzYXo17iG7JRCJdXqxO950l29jjOEPwGcZt98Z9SLpmz3b3uiFLZ4f9d6+VF39Tmo2P80vISpGbwjsOZ2fqLlnjCeTewHIpXfrprdF6vdwjt7vXPazemf+Sk6DkiRYl84QoJGzolZ4x5wo3Gi/acRaX3nnpKQ7Lq64Qzlr5/ig0zEFqrcRqa3TQHv2WlpUmJOSTZJ22AHg6aQxgsTicIUYUlK7xPP0ExIOTeDArX6XwMfZTsziSKXuS6JL9lLlNWdGajPIWDp1ox1vn8Ejt1P5y4cjzJvgvNGPV1lU/5Odd29rgdIKQ5PwEZ+KpTGo5EWKVLRgs9wEGJHfWu7dY6BS+6xh9pn5du1DJ4mG7HZE651/sm/wEKQavxieuE7rZTrzzRRGCztW+gIvyvKtprkeEopENAj5mpxZ6f60J0EQeA6jTW2LH1/VJyDBBkIJY85A+rorqb0uatRKg0PXelmd8Sjm4I3w/P99+rlyP9YZwJI7NM0cIkLpfyZrJUV80QlPmbePAZ0gFzht1oR1HunCw6FvxiaB5MvCQZ0fIG8eJxWgnFKcDqbxxhTYJjGLw8HOoiS6/Ajgkv+VNRuSUF+odJYNC9vQR1tTnabrAcborbJQlYTYz6o4M9gmO/2p5Wppom2+KXLEUAzgQ4Of/WzN+8f384MDJKe15o07y2p8IlqAtt607Tchr3TDpdVGpoLG6d2XQ4i2BOn2fI+gxhxf9Ls7xog= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(7416014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2Tfsp1fxMXqnBpOjsMVB2KUTTGY5yFDc6BUe2jut9VCbi3H7dhc7wcDTq2cr5uHOdDsYMOarwn4CVx29+V4crVYQFhxOq+0BktaB+Fq7oncCWm2+LZ22avnk1IUr3zQWewBvMyUcAH25MY3dzRqmZa7jfw1XSVxokN6OpdHf0X1X/N0wq3TAZE3mMNoPlOB6c48783wyhTwpPDMVNfj929ZK7bJ9OlvPbRYCy7Z0CSUmPFPPugflla7zG22WpM8tw5bJ4K52NahrFxcwtemsRNtZBS4zP9iAgKTXw2wtNsmd0s5FnyxKMQCZxT5L8eQfIV5ag+ScsMo6jrdocVP8RFg/IfmW4P9rBUTkcofcKT0Jtqs8PH3ppE55l1HOE2jX3HCi/n0BEB5S27lKQl8DbmVhEXrPb5IV7wnGZoRr2Gm24sNI4ILhLvvCSEe8tEfHysxtfzbwcQdloEXZ/QctzoxZWT3QjlNNgOI8X68Zn41WuiUqz2DmADdLSZcwnrFGnP9TdkbFS5AOkExIdR+SbpPd7codaRS3mxYxvX5cuapgYxltrmRKZ8fZxxWwuoIFRqCW7VG6O35o/tZErflud65G8RDL+LExcWvi43/N0hniki6KBHZeCpgv93zlGOYakSz/IdHJtpddUjdS6McKBXFWh6JfTJ/PnzwUhkMEMfS2QiWHyRWYbzkxR75Z1bpPT2O8Eesh9ZqtiwWx/+bxL76Vk/uKi88lmfR68bh4FxwOWCUwDMCS60fxHLA3XKV6B9DVmxvgVekFLDdblNzvS8b9U5xMeH9NDn+RdW6Ryu/J39zZBDv00ENJPmgkaERwe7gUIDTVnpoA78jTvJNR+G+S3D5rjfKl2ret4S15vuqahirlBB3ug/B3LFIIhhTVXR5P4/R4DpRC4QNGQKN6PkuuqjN4lKFSbLb9lqfDoR7w40StXIyf92OyJ/uIOmRSb1tNGuKbTcjc8SFmkbUdOc1KKhl6Raj4zoCGXUDGxOYIh34aw/7Sufm1K3HPs1yASPh0NsRyg8xh0ske2iLnzL9BU6OUoD1y7EL1B/X+5ioxnXnhAJGiOlwrzpNRWbu6j0X6jtbbol5vScrBoaHLQYfpEmG01vIFVrDpXB2royAv4FdzPIYbd9nSNT+0o2r7bVCb63RqGzPhIiUDZFX+UxJ0U9Mqq2rfbo9/zN2Et5QDHq+FGS7/QAedMo623S4H9bYwhQ/nymax/oM6aQxWA6oRxy6JPolpd1N0LXoGGSCveBWAo4nAvC2yvJdwl01YGJcOfnSx1o0+WTZg8uPtmRH5Aq97CE8t/etUxXGBSz7JJOXppSwz81WbhpYt441NQfPdSjQOUc5A9mjSWltkWW2o8m5TpGewOR33N7msbg6D5BPEa7Uwmkqm9X6jQqp1blrw+jZzUbCDK/emdncSD8T4k1wx2Uwfu59aFSAGxSZRQKentlDJLLUqPmkHXK2eoxw6NXj28jUtIGlsdF6mW9fnrDTWx7JF82tsPrLhYCQw6pUDEdNZ8tESTa1rjZHyAwVTiaxXgf9ZrbQSbXbQH4gkg1UaTXI6h3EgrRBr+8wsmYZJcP9DLidcu60vnlTO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16f04ea6-d5a0-4f05-8ccd-08dced1b5779 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 13:14:47.0014 (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: tq+r9FGnIG621JsA3+qE66Qay1IrBlG6BurOm5CSmu+dzd2g4Ikv2kpP1vgkc3+Jq8MYFAL+xQLzAj3J5HoSwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9988 Add related YAML documentation and header files. Also, add maintainers from the i.MX side as ENETC starts to be used on i.MX platforms. Signed-off-by: Wei Fang --- v2 changes: Use regular expressions to match related files. --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 560a65b85297..cf442fcb9b49 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9018,9 +9018,16 @@ F: drivers/dma/fsl-edma*.* FREESCALE ENETC ETHERNET DRIVERS M: Claudiu Manoil M: Vladimir Oltean +M: Wei Fang +M: Clark Wang +L: imx@lists.linux.dev L: netdev@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/net/fsl,enetc*.yaml +F: Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml F: drivers/net/ethernet/freescale/enetc/ +F: include/linux/fsl/enetc_mdio.h +F: include/linux/fsl/netc_global.h FREESCALE eTSEC ETHERNET DRIVER (GIANFAR) M: Claudiu Manoil