From patchwork Mon Dec 2 22:03:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 846686 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CE9571DF748; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733177024; cv=none; b=gfrBNpAmVCW83NJyyo94mP4uEPLJGljcJWqt3OCNDLCBC9WF/1qkHaKsboLfHtYdCJPavOgowLVcG/9qJYJJUPJCZQUkGC52PULhllVZf+R/64hdi2U9AAD1W+Pq63JPRywCh4faCaoXH2wHprweBTE1wC2ueCTiqIx5Ob1sC7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733177024; c=relaxed/simple; bh=fQ/wiWKsuKCk0mrEeSWFTz5B5YHpae7Id2vaFJhJWVU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Am6fDj1kR3H8RWRsaV4yuTLVNmmbgap0tLDqk3vA+rEPcWyzpsbxi/orBEPIEZQFPcVXTm4U81JyYrr6n2MkAwNgG433qxaIYdCxjG5hqGKy+zS7HGCISI2ShL/kxmR4MIqTH3eUNJdMHzE7vTkAzXTvtSJRrJLs03Ai3/dDOGs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dyDcuGQ+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dyDcuGQ+" Received: by smtp.kernel.org (Postfix) with ESMTPS id 55A90C4CEDE; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177024; bh=fQ/wiWKsuKCk0mrEeSWFTz5B5YHpae7Id2vaFJhJWVU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=dyDcuGQ+z68hsCUUh/M+nt+vXRuV0I3FbDQKqiMVXTQGJOuVlvNq5bFgQ2FlSyOP1 KkCV/HvCYsxXmqrXWjhyBx/kVlBoaqFPpWBw/2T07WjSr0P16HEwmmtI1xuGXuyomd AruwWdAIVfOUnJYlPsBYYl+Tol0M1bWOL5/0J6OGfMVdZcyokpfYXBUG6m2sAm6R5D U14V9uh+zIXxot0jQjUVrCU0R8ohiexEAsEmjAopbeB1BHzHMtosutUp100FkTlPgK 6SwusTlr4yJ0lyyzt8h6pc9q4AGWmA3a468C2VF4vVvkvERalP0lxXP2kmRfhbn4mJ y71h4CmOm8Z/g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C11CE69E97; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:41 +0100 Subject: [PATCH net-next v7 02/15] net: driver: stmmac: Extend CSR calc support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-2-bc3e1f9f656e@oss.nxp.com> References: <20241202-upstream_s32cc_gmac-v7-0-bc3e1f9f656e@oss.nxp.com> In-Reply-To: <20241202-upstream_s32cc_gmac-v7-0-bc3e1f9f656e@oss.nxp.com> To: Maxime Coquelin , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vinod Koul , Richard Cochran , Andrew Lunn , Heiner Kallweit , Russell King , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Emil Renner Berthing , Minda Chen , Nicolas Ferre , Claudiu Beznea , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Andrew Lunn Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, NXP S32 Linux Team , 0x1207@gmail.com, fancer.lancer@gmail.com, "Jan Petrous (OSS)" , Jacob Keller , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177021; l=2290; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=fDnNMvO2KmjBflv1GlEvIV7YLrxVPMMghn+V0RbzyAA=; b=aOe9w5XgVBiE00VDwkHWXsP1gCY+5Wnqv8rTim0sKJ10cW5fwvJgDPSy8B0BYUS+3i1lYBs6C TtAfq2GAs0bBxJuAvB1VffikbOw5hufX6iuEFKtDDI8INKBV/vFEnmq X-Developer-Key: i=jan.petrous@oss.nxp.com; a=ed25519; pk=Ke3wwK7rb2Me9UQRf6vR8AsfJZfhTyoDaxkUCqmSWYY= X-Endpoint-Received: by B4 Relay for jan.petrous@oss.nxp.com/20240922 with auth_id=217 X-Original-From: "Jan Petrous (OSS)" Reply-To: jan.petrous@oss.nxp.com From: "Jan Petrous (OSS)" Add support for CSR clock range up to 800 MHz. Reviewed-by: Jacob Keller Reviewed-by: Russell King (Oracle) 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 | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 1367fa5c9b8e..70d601f45481 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -257,6 +257,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 9b262cdad60b..3cb7ad6ccc4e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -325,6 +325,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 75cbfb576358..865d0fe26f98 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -34,6 +34,8 @@ #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/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