From patchwork Sun Aug 18 21:50:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous X-Patchwork-Id: 13767641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A9E3C52D7C for ; Sun, 18 Aug 2024 21:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=x3Pksx8KqxVNKrFJRl+o68DtVs5WwvMiJQOuFvqMRM8=; b=3V2yR/msl33+OyUAVRgD1FOBi4 KjZyyzwCtiDHmMqEvKKF6eKlnUVSosKaLMmd7zXs5Xp//g+kBUf/4+iNCEFsAO1v1dbh+gX8cyaGd ESkx5crasoHw3t5/f9bvY2xonWbuBHncgY5US+zhCfMqQlyuaPZuKzWBve597J9f2rVHIp6L2CDqd O0uIpc0ZbagIAA5dRCIJQR/SrdeHksklqQIViofATOeKcLEdD6IGc9mfP6xyKOYbxTWXuKVHSdoxP FblBx76v2h32/Fyy+Cu07NgCO0BvuUD1OXvqF/0RCYn6dvFFeeDW9P02i1Tgm6cfoICplQFpuFVAi cjpBDAoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfnoO-0000000HMVx-1p37; Sun, 18 Aug 2024 21:51:44 +0000 Received: from mail-westeuropeazlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c201::3] helo=AS8PR04CU009.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfnn6-0000000HM49-1zHO for linux-arm-kernel@lists.infradead.org; Sun, 18 Aug 2024 21:50:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RAXZiMQm0vuUuVGt3HL4wRW+gviIviT2im4ExV2sw+zedBR/pY2Nr/SxT7DvUDib9cqROmVj5XYavvDiTAIUetbvnYPh8yGKDBAm0t9g+P4ve4O680JY0tAYr+506McY5YZZ56gZeFuhiS/WDY9UssMBvQEaeCI8Ateefje0AenD6fDr/DoDuG258geTcKlSpzDAbNwlY5CZwdAPfgMyJLoXdKi4OjL+ckVLn+JutlHag58lYmhXoLCpsOI0Wc6rKNGLLAFBC/Sr8qHwTU1zBuqST4x5Zfl+zWie3MLkdoQXYMeysUZPN/v3qHK5l84PvUo7Jp52ZAzEPKovG/rA+Q== 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=x3Pksx8KqxVNKrFJRl+o68DtVs5WwvMiJQOuFvqMRM8=; b=RfJpmgminC97RE6hw2HH4anql65Ydc6uTqJJsedJLpSUU5bqW8g1S23LgjxjlHOfzjsxHz2ZZbB+mHG0foIgruiKmIwPnA6oTE3fvHAVkhgEg8kd/JJAgGhgFu4il4rlIF+IBpGSsw9MRpgDlecYZE+z6vJGbHOvdD8LPMnR5/LY5EoG9FVt0Jv+l3Tx4bHVnoE5SlTusNofFzPFxzasAN0oxM970uGxUL6nEKIUJZvvHmgdKzbgmqx2rzZZVNR+cuiiXC2cM92A/6tlEPgeZn9eZY7o3W7Waz/0iRaVY6nhpUGxbRhqrca/8maDfAps24O4T7RLD0U685z3TPWEtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x3Pksx8KqxVNKrFJRl+o68DtVs5WwvMiJQOuFvqMRM8=; b=gEDO0sgfiLVb1v7rI709J3uer103jLUw0iiz5xUC3+HBeZ5vZLATtfJr/XG0jNug5hpnnCCQP+kJvaTky4WvwnzIyOvX33hxetjf4oNPm6lKsXt72xG38+1rYPq1d6ASRNRNdJSYx4OkWj6nULRuQZHNtd7Gns+2qhP2JpEyjjv/Ba6CI1piHgoC08+TI1Z1dvvA1gdshUQ4pEPGfrn8qhsGRzAuGSflY1uiQgKspicDEQF7vaa4/0HDOUbnxvAPTUg6XW/PJa19RjCJdeuRsNdKoyv5cZuoLVKX0Oojh0gn5t9lg6C/qceIGZWysP+LG9HDQQpDjUSJW++9EBEs4Q== Received: from AM9PR04MB8506.eurprd04.prod.outlook.com (2603:10a6:20b:431::16) by AS8PR04MB8183.eurprd04.prod.outlook.com (2603:10a6:20b:3f1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Sun, 18 Aug 2024 21:50:19 +0000 Received: from AM9PR04MB8506.eurprd04.prod.outlook.com ([fe80::5f7:9bab:66a3:fe27]) by AM9PR04MB8506.eurprd04.prod.outlook.com ([fe80::5f7:9bab:66a3:fe27%4]) with mapi id 15.20.7875.019; Sun, 18 Aug 2024 21:50:19 +0000 From: "Jan Petrous (OSS)" To: "Jan Petrous (OSS)" , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Vinod Koul , Andrew Lunn , Heiner Kallweit , Russell King , Richard Cochran , Giuseppe Cavallaro CC: "netdev@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , "linux-arm-msm@vger.kernel.org" , dl-S32 Subject: [PATCH v2 1/7] net: driver: stmmac: extend CSR calc support Thread-Topic: [PATCH v2 1/7] net: driver: stmmac: extend CSR calc support Thread-Index: AdrxtQ4W/YDQwJHKRK6EOcoVPCOQ7w== Date: Sun, 18 Aug 2024 21:50:19 +0000 Message-ID: Accept-Language: cs-CZ, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM9PR04MB8506:EE_|AS8PR04MB8183:EE_ x-ms-office365-filtering-correlation-id: df9ed5b0-c600-4139-d499-08dcbfcfc0ae x-ms-exchange-sharedmailbox-routingagent-processed: True x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|1800799024|7416014|921020|38070700018; x-microsoft-antispam-message-info: 88jzSiI6QX+9qXYbJEHRs2zgxvKX09Isszp0z7dBqrLts5V+gLusEli/IupHaMkaRrGhTjsnWk/3uVH1BSz4f6vnFRCGZ9/eqSCjmtdz3R9OM4SLH2W2fJtH9vWd/7wWZHYnmITrpaC3wudGWqklVar0LJZ7waGivnVEGBFdSwNUpgPWIQBQTQS3y7M8UDZvdAuKNpAB76JJSaUGHl+pZ1bYen0PdxYuNk66+HoUhBcpL5vEH/JZ3keblGz/vLn7P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N7JxqRp4rLt6Fz2ML2P3U3DCHV0eCCYBb/NeQGFECOOYKSIS2uU9An2sEFSe6KYikVp5ERDwQ1dSHhd5+MFe+UfXNVPcL3gzVVYv9XPRMm/Xl6j4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8506.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(7416014)(921020)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: xKiziUD2oAGZImQYxAbW3ESWgCV8vFX0qcZNPYPyiVcvJ7/KXA8sjiGy5r8CcA5Sb+Zo17tLDnjlAsDzbhLRA2hGO0c2hp5uY1vNeuhRyZ3U8j5yh2wAt43WWKi2Rm/bp9K1/UTWMsk1ut1wkFMaCW+Ps+XfuJKsYes1/bpAgcBL92YRUeM8VAI6eVl+5QDhmVogWzvoWoF9lr32Ny57TLcClyphqSGpP2SCNbVY5dJs138IHuBlze9mio2WfyPu2hbJAKwbhY3RQ+5hsA5oylt+U9zKe3k7uIwhsFQxiqDEIH96DgoSZLZE3Yn/Lr3jSabHbuL8KEXwwPa5aZLXxxjRvMxkDd62tEyxMSmmkHiea0KFUF3kIQ41Lv0MOL+ulZRwWshiA956Olx+8OgMoJrjVXSZ2erqfYDU9BEukVl+jOlgPxH2PFbXRrGsLTCfzi7oXh1ehMVmALg1UuCc6wLE///DmCG2vMtoeHkiX9AoG5VkEixi99jVKrWz3PztIIn9j/dpRERAdf1ESDBMLDTFMf98HP6tYXdu0ESUEU5+pRA7nA9H0QT84h8UPnq6o/Gpy0k84wcpuxxhKRd+mTcbXL3lnbHD3rCBi1laKaqXNXNeNlrWEb/ufo402YTHmfFuLOXpKkQoElnyKsdU+7AhKmjTdmtdyFB/RVzy0Qs6VyzvT2EgCVugjWy47YEa5ABFG4CFvT1Bqnt9yZcZhZaplg3yx5BHBUzYnLEMR5b/Bw/HAHEH2vhMpVAlpa5jUl8pER+5vq+ZaPktIBDDXuDRNugXxlKbDgLgHf7q0nBaSontf4l6EWMcxQDejBU4AInkVUY5x+mYxQXf/51rNmFU1wHFp/AAV/3PGWsGLMFvfye7+UbVO6a0cN2AyJBDouftGF1ExG88apQRgNJRTkMJTFji9BJMqg6dT9F5fWznP/GGNMDeQvKWRPZxoItfQN30uD/YkmRr5IL1eHW3BBTiKpE5hL+7y9CsAqdX9dato0sHUKFYz1j5TLiXlI9tN9uQ6ouxlOYwUK30Xs4q0wIgoKIs8T/WpyshsMtV9FAjc4udRiqCyVo+725FBJrJb/vZn02rU47UZIWNU04/FTXcG5/mAdiO9qAprPZtGlE73lmKkfEVEDkXNpzU98zQQ820O0txyDGx/rvvMX5dfbe5IyZhhL1Uc95ec4DxshFJW6O37EdbBmDlUwLadLwZbbBfSRGAZuw5uq2HJmQ/FBS/8KTlogYoRpxOdFN/zpuqAevcnGVAkjt3V3Izi8RKEszZ4IZOWj228vp1dMuDxmJ1rVs5i1jzEdF5obFWRATTgl9DFG/ZfuThFgYlaLBBf/P7doJcn1duWaTuSnLEp1WLSZORbo2C7Sj1O0NeZvZTf9kSV8AACYk+MPt4uVYFiCgbIVvbyhF2VKJvB/1+S+X10afniLrckUaLdxps4ubuoO00kWBOTtQ3Y8N2sGBZRIaRM2zPXaPCYqufJif+QPMGY4iYxPKwFjUy6Gos90r5Fy2MPPi/ZJZGEf81Neef/PJXleQYxLeYezFd146IgBk6D1JtaVoY3J8MRI9dg9s2+XMJTsDBCBvBtbRj3PNW MIME-Version: 1.0 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8506.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: df9ed5b0-c600-4139-d499-08dcbfcfc0ae X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Aug 2024 21:50:19.1222 (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: KYABlX4saHOzFm43DdnntjJRD5c6HqieBYalzJDXjvt/vXffwKftQJCowlxe6XGdegqbnPZXS6Nr95QUaqjNOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8183 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240818_145024_542094_AE2E7A4E X-CRM114-Status: GOOD ( 13.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for CSR clock range up to 800 MHz. When in, fix STMMAC_CSR_250_300M divider comment. Signed-off-by: Jan Petrous (OSS) Reviewed-by: Jacob Keller --- drivers/net/ethernet/stmicro/stmmac/common.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++ include/linux/stmmac.h | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index cd36ff4da68c..e90d3c5ac917 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -256,6 +256,8 @@ struct stmmac_safety_stats { #define CSR_F_150M 150000000 #define CSR_F_250M 250000000 #define CSR_F_300M 300000000 +#define CSR_F_500M 500000000 +#define CSR_F_800M 800000000 #define MAC_CSR_H_FRQ_MASK 0x20 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f3a1b179aaea..ac80d8a2b743 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -324,6 +324,10 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) priv->clk_csr = STMMAC_CSR_150_250M; else if ((clk_rate >= CSR_F_250M) && (clk_rate <= CSR_F_300M)) priv->clk_csr = STMMAC_CSR_250_300M; + else if ((clk_rate >= CSR_F_300M) && (clk_rate < CSR_F_500M)) + priv->clk_csr = STMMAC_CSR_300_500M; + else if ((clk_rate >= CSR_F_500M) && (clk_rate < CSR_F_800M)) + priv->clk_csr = STMMAC_CSR_500_800M; } if (priv->plat->flags & STMMAC_FLAG_HAS_SUN8I) { diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 84e13bd5df28..7caaa5ae6674 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -33,7 +33,9 @@ #define STMMAC_CSR_20_35M 0x2 /* MDC = clk_scr_i/16 */ #define STMMAC_CSR_35_60M 0x3 /* MDC = clk_scr_i/26 */ #define STMMAC_CSR_150_250M 0x4 /* MDC = clk_scr_i/102 */ -#define STMMAC_CSR_250_300M 0x5 /* MDC = clk_scr_i/122 */ +#define STMMAC_CSR_250_300M 0x5 /* MDC = clk_scr_i/124 */ +#define STMMAC_CSR_300_500M 0x6 /* MDC = clk_scr_i/204 */ +#define STMMAC_CSR_500_800M 0x7 /* MDC = clk_scr_i/324 */ /* MTL algorithms identifiers */ #define MTL_TX_ALGORITHM_WRR 0x0