From patchwork Sun Aug 4 20:49:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous X-Patchwork-Id: 13752705 X-Patchwork-Delegate: kuba@kernel.org Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013029.outbound.protection.outlook.com [52.101.67.29]) (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 37BE022095; Sun, 4 Aug 2024 20:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.29 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722804580; cv=fail; b=pqwXCc0VgRIeybip9tOXwk//vak+8nqEpHk+Oy3g/zYFYhy/psWTRgXlJ43uS89DFqRf8gEOxS/d/4E9ybKTn1z1AgzPxPR3cOkP1u6/z47Kr9tJz2+LcWqMlPE4y0+YfPCe7JR7zHshzX1iG53gVpFR8kxIPsvoqipSwRRtfHs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722804580; c=relaxed/simple; bh=ZKX7VytUsWlSGRGU3wmsS3teLwQ6HYWpc4tmuTGjNlA=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=kgo6CfB79X9Njx8oQu+U6/yz8uMuUXAgCcSNuS0pOopBQxIvMBzUSf6Yxzyhd+1SRzaXSgj04r1SwQkQtqCLEYtiX0fOYJttXea2hIYl4VuOf7wW6Je5jS1qoV36FEqVqTBE9kq3YEU28Estcg9VBPTf1zK/8x/9o+hUFFTOwoY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=sF8WQm0L; arc=fail smtp.client-ip=52.101.67.29 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="sF8WQm0L" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GwXIkNCKwXQh6mgc72/SwAe7lcYKFuJ7p978+Qx8WSZTqZjLvle17OCoP3BCk//YLQS09hccnMhTojvYB+KigDGtTpivxQDinmK7PDwJc3QDns6fP/LdOcxS2HF5/n8JQYYoE9sjJQCLJ5rF90ZLz/OTZb/UidjpQ19BxdMI7xDFyvpatsfEpCdq1f5PIPgodfEMEbgQA5O1GHqocQFEgKRiDoKmI9NUukrDIduSP6BYpKO+ZgonBaLszS8smvTov8GU61UUPOVY7Zc97aFCGmDzY9UPSVfvqO/YyD0d02GP9ab74Trg9HXmSeZJv4mnjmoo6Qqwk5scSaKIjKQSDQ== 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=PEVTv0FWlk8JDzY0sd7BIrVpqlx3+DsdjiPVsgRhvLY=; b=HCiiIybldg8x9U9ZertvqjXvwM6IytRTXqGWL5MepibbU0MeMDyll8Ak8V4b/odme+5YLOr3HaLpprai4l6YxdcIfEqy5KAuWB24CmdN8AD7n3JGzRpEOdEzZIflDczYtqJSnDK0P34RPp9j+fZWv91jIGdXS75/3FmffiKTvvGi781mTRB1CE0L/ZWVE3ueAkNACgZsmmAKrLAc5ODwwh531gMU46AhjEMNX/bj6dY3LuL5bH4qXer+VTIiqmHFlVx3cMnBIEKPwtK7I6StS0SfMkyObcIEeMzxs2I+1puf+hfhOiIfP3DiD/ueg3D4mR5qYAayseQg4h3LVmdagg== 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=PEVTv0FWlk8JDzY0sd7BIrVpqlx3+DsdjiPVsgRhvLY=; b=sF8WQm0LyX7eOnkY+XgMaavsWxwyozQ9+ivGipunsaZI55QmVva51843X6IPiiE0wKnXJL1Bxb824EYTXNDrB9IgF2I4kjtbWTb5VsHjk1QjGDwXUNCCT+seskAv3ZqGxy6dbwzQMcCenhKS4K9wZBYPbAqdELeR4HjwJwL8jpYs9kg/InkozOVGRqop8GYBL8MtkZG7XH9rInXQw+6Q4zTu9YJT4R3lBtiYLmY979Eks5Hsjq8/oEYr+trkM2k1RV4JBa2kuAkBWgghLJezd2WJTX3yWAZKG25aYhsUfjrkzxrRtoTPKiWJHYede97gFljG2oUyScUL4csSQLw5Rg== Received: from AM9PR04MB8506.eurprd04.prod.outlook.com (2603:10a6:20b:431::16) by PA4PR04MB7965.eurprd04.prod.outlook.com (2603:10a6:102:c9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.25; Sun, 4 Aug 2024 20:49:35 +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.7828.024; Sun, 4 Aug 2024 20:49:35 +0000 From: "Jan Petrous (OSS)" To: Maxime Coquelin , Alexandre Torgue CC: dl-S32 , "linux-kernel@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , Claudiu Manoil , "netdev@vger.kernel.org" Subject: [PATCH 1/6] net: driver: stmmac: extend CSR calc support Thread-Topic: [PATCH 1/6] net: driver: stmmac: extend CSR calc support Thread-Index: AdrmqCAbIYfhhpSjQm+gwLO5S8kGvw== Date: Sun, 4 Aug 2024 20:49:35 +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_|PA4PR04MB7965:EE_ x-ms-office365-filtering-correlation-id: 11c2bb2b-6ac5-4009-f34f-08dcb4c6f2e3 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|376014|366016|1800799024|38070700018; x-microsoft-antispam-message-info: 8PdM7t14UC7m6kvj8gewQKYr1uGwziconZg3kMAjOPD9psoFqv3yLllHQ5UMIcQQH0G34a0AY1bzzhMo/hX4lxUdU0uMwYPL8ueg6gHG1VePyvautTfO0022H8AxYkIPupQDtLQ3qttTWPz9PGBLeK1UIpgvUQX2Bx55e4DAvsRodAae6ARiXfca6mYMor/xsPVkRp3HGHkYi3WBeLQNizq6Xe5Cv6GwL46VSijyb0jxH7O63ZY8Jo7L5tNHtiCIfzyllSNmW+GnJsD7Eir5hNsG47yPB1u8CiNKKz9m/ThspEdZ8ajeKJ57Kd7vsG9eg4Vdi6clvboMCQ0fb53LPtZtGBBjEi9bsRw+3fqTtZ2V1fUDgVekMB9Y/vMmpnEYvnknac9Lmo1H2gKzugqD6ke7TQ3JuhxE29SR83k+GHZT4HWWQipmZwIEJh5MfTVM/H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ook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: I2JiaV5EvVqLSga3PeujftYM58AZFNVnkjWlb3UarToGrHIUL1gX11iuPNSB9jTmr0LSVElcgvW+fF9dCcGD9O2ipxWHvgnkgHmMqz72WadtSKhUzNnh5lzLvjGprPLJI/r9GwQKPIU5f94jT8gI4bbDcFAOC1nB5jFx/He/cbapn7fWmIC/D9pN3+xZgXkF7AxMzodKsVFuXz6JaEtXVNs9vFrUIADDXAkoQNGilXpU1iEPRavt9p7Q3KX0gm7X7qm7rs1k1f/+Pxy3Vl96YhMeeQyp2nHw9uJobBzU2rps+bDvNU0zKbEFTI6yz1KmogmqRV93sjaIulHmayq9o6BPZvqcwNIotPcpjQFa6sCK4gPEdp//SbFgse60gKHSeRZVelQhjFmmF8bBwZUa7ZEwkbgbbqest8y3nQlwEdt897Q8DZM9+EDqyjgsPSykyeay+MgdrNshrxtZ3Oz/U/r7z02NzTn9IMOi+alvj6PLYr/88AOlEidbInpK5zXb2buLWysXjwI6yt55aQNvjjMIdnFvmaP++JgnF1sxsSMvQK47cl9CxEcpkN16UkO+CPGpliMFTuqPUfsZc1mw2hrqWyTLGA4AGQ44YMiySjZNOErHNoymEXYGI8BYIiWb3LgjaF/sq5g7VuLaax7UfXdyLc11docmEqNbBvu/7KLwCx4Vx9Tdv4BOWFPWvLJQZpnpdxQ2BaLNr4xVlTi0fsVRm3kxQQqJAE1+ga+xNP4gbsbanr2NXjGZ77vEySwItY3qJzntK6sMM1CGM9YvPjRgko1dxxriBYz71SXcNla1LaTZGX12kMbMJc/X1x8ojzE11R4SVDolKeFEBWVSlaEarQ2L+vjxk0EZeHquOg90rauSl1/WulIgJICR7pLkCEG0wM5f4xkSdqATc+SemwG172+gqPsc9D+5mmXZ2QF2K+AQk2HMkCz6ZhkerNC50FK74Spl7DnISbP810pS5UQOVCrDXPxdArNsZxptcRtnIKR5EBF2hpUbf4CWQi5ETrxo/KmcR2NG8Fbx85Y5koMJrP2O3Hwzj/aUwoADdtEY3huBYvXJNv2cOLL9nZ/ojG3BJgPLf8obVJrf4scLDBdqrGqCgMLlZyQ7un42jx3OltxnanE7YDyRu7ANEkwTlfvwtPZwv56mqilBQh0ptjGGcQ+e0WDkTwVz9+nDud1TiGbONq8psaYQm31HwJv966ceFExOdDzdwoRCqD7awZ7sRp9ILyxFPbY/tvRonZi+hQG/lwl6Jyf1pQBJnE0xyjju8/2LkVGpcA49rCzfEmg+tAEzhpOeL2S2cdvHHbVN4FVZqF6oRuX71tpkKjXZZ4ESeFbRB9xivT2yYucnAkerMiMQEkBdt1hrgklgDJR3jZnYlapSY6eqMleNGKn3zUjtpBOI64YVk6zXA9Lef23RFetHeAW08d4AzzMKbvem6X/qhN/grRKeO+PctEYsILhgi3sD8UkAwtYPPbUrAYLnzzjdXCVicsxeL0KvoB1zms+Z1YcRWBv1TeFbFw0OeFT7BUBMjb4EgGtDj0zMr6vaclDzqhm2cGoRAhOiKlsA6vOC3H1V0jF70ffq0iEn Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 11c2bb2b-6ac5-4009-f34f-08dcb4c6f2e3 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Aug 2024 20:49:35.1159 (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: GAmvWBhtx/e9gSVQD0OGovZ1Wi8Wl3i1kakC8Sif2Hahsl+e+04T1Os7TdWp85xG6L/FpHmBKp+3npVcOCO92g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7965 X-Patchwork-Delegate: kuba@kernel.org Add support for CSR clock range up to 800 MHz. Signed-off-by: Jan Petrous (OSS) --- 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