From patchwork Mon Dec 2 22:03:40 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: 13891406 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 CCC80E69E99 for ; Mon, 2 Dec 2024 22:06: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:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CGNlAokFjmhN1EyWyvNQ13rV62s826Uf7N3aP5+qRgI=; b=JE3YKjGoeOUxW0K7i9d3wh2zBe qPZ6U4H82AytOifPpSgSUdIqwBkG016YzVXAatKgtywFdRpCBk7ii+eF1oCYcOxp4OWzLLrHPiN5o HgPfp/trUdr5jI0dpqPtEMy/Zl2+eGFFg3zXeGuwT8FkSFydsQhzuWUVvgVxpeLTiJW/eaG2E9xpH iliNy1tHHR0lEGJ8cVkaF3aCzRaynptvPhdKza3VLugBUEFYRZrS3aa1MZ7Lgryeq30+F95sjTcD0 CGjYKwkMCTGoG9FrlMCCLJnVP4oqZPeX5RsreAD6kDFrq4SOhsRZ50YX5Ezp0D+j4NQONl1d6o9bi 1alpVN5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEZ5-00000007aIe-44jG; Mon, 02 Dec 2024 22:06:47 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEW9-00000007Zch-3uY4 for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 90FA0A412F6; Mon, 2 Dec 2024 22:01:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 377B3C4CED6; 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=zonr3mCcTyCgwR7d1gZNImuy1doROORC9hQH8Wi0Qyg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=nb72R6Tx4Y6Yj7Wq4ulQxlaCWNEY+xqoylUS3dIg3QHLZ38QkNcZT9cpAeREmkIm6 GEwLUDQcEAkiWvabN4Bg6e+dfjYa0Hun17ULtP7Zj/Tv5u+qnoarS2/Ekm4V1QUXTZ /rex2n/GJBE14f+RTgNV+vBa327k1UysSuIPFr8vmM1+DZO9HlvXSiI42vRpYnnEQ+ UrXvzQSAq++GOCaflwXzXMdRJXuBPboBrajBK+p3bo1Hq6xTRJyIyywe/oAJM8I9xn J4btjMwUhSt3MOE12iEQ3w24blG30aeVZmYNWrFL+1tl0/mp4cHjon37FUmPnAH1C7 fK8nL3v74ux4w== 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 21BE0E69E95; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:40 +0100 Subject: [PATCH net-next v7 01/15] net: driver: stmmac: Fix CSR divider comment MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-1-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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177021; l=958; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=2KaIHv/oSTo3FOtKPvkHjEF7Z3D3rI5ymtYbTqdzAuo=; b=xop0vlm7spgi//SNJquCZbKPGA9++LB1E+XTzWKR3YhiJTd0rZb6w0DcM9m8o/1GSqOSDg5LR pTe7pB6/pQ4ByCXxay7xg0XAOxtrZ+3AMFuy9e5ctAyiPPpCzwaNs3N 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140346_107917_5C26F67B X-CRM114-Status: GOOD ( 11.38 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" The comment in declaration of STMMAC_CSR_250_300M incorrectly describes the constant as '/* MDC = clk_scr_i/122 */' but the DWC Ether QOS Handbook version 5.20a says it is CSR clock/124. Signed-off-by: Jan Petrous (OSS) Reviewed-by: Jacob Keller Reviewed-by: Russell King (Oracle) --- include/linux/stmmac.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index d79ff252cfdc..75cbfb576358 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -33,7 +33,7 @@ #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 */ /* MTL algorithms identifiers */ #define MTL_TX_ALGORITHM_WRR 0x0 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: 13891404 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 9FA54E69E99 for ; Mon, 2 Dec 2024 22:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gZjPP7BBL4J10vjlQrHIlTqeTEB2nzqZf3I47xfayQA=; b=GtL82YqzCQIgKpikfwxjtJWQdp gUlEdvPDV2+NpMeluf785caVRamwFN0f3hhcCJJCAtDOjymEXxQBqY9fmCKP44ZUEsG3dPUR/6qsh KvvqWkUC0gYsBlL2eZ8MZt/qS917aK92QTlnDTUjApPKIwkSFQqA9813hGp8Vkl4Pt23Mm6vDThmG jW4JBz4pfHL5MH/O91TtWYZJAwuv5w+x4P54dA6aWPgm0FfdtlpOUoKeG4ICaU0OP8R+q0KAg/xXc MQB+qgQyzpDUSgCmlH1FyUylmGxmjruBRitI3ivOwlZROxK6hTa1iu6zLppcZSbPN2z/YgbiWF9ny sZQ48Mxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEX9-00000007Zpa-3DOq; Mon, 02 Dec 2024 22:04:47 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEW9-00000007Zcg-3pQx for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:47 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F257C5C6989; Mon, 2 Dec 2024 22:03:01 +0000 (UTC) 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 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140346_042230_BFEF0448 X-CRM114-Status: GOOD ( 11.66 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 From patchwork Mon Dec 2 22:03:42 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: 13891410 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 D74E9E69E97 for ; Mon, 2 Dec 2024 22:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4S+griczfxgrR9KAzd1SmZx0kxJ5pUx4zHOlhhAKa68=; b=0WROIXKPBF0uk0+20pAQqtQjkS YkPnKkRLrnT8lb5dlwTEjLlJwoNIvL4iogPnhu0dckTnp/0cprpmky3m2Q4Qu1TQCAax2jeWFKDbL SBRi/IbOK52L0y8jrYFH8AIptX74p8mKymZDrq6LRSHBg1fy5gz9nqOt0MeYaeEN+mc+ByQ29F13+ lgHjihBYRz1lt6E/76qpZUoxPVhiFfntSc8aMNxU+k3RBw6njChpv9jBZnZilA9vYb2Fb18H3GH+z DLFSmqVycwnDMjKHyUcg5bI3tzzDK0TEgH6IYq9ADI/K3VA5gKGXtR1y74nVB6fqkizN0TCXV9C08 3rlIGGaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEc0-00000007b06-02Zv; Mon, 02 Dec 2024 22:09:48 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWA-00000007ZdO-2vKn for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id D225CA41308; Mon, 2 Dec 2024 22:01:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 6C781C4CEDF; 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=prEv+e0GG/OD65Qb7TwYdsqNMCpYICnodlwVYKCW350=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=HAA55EDgQdQSAII8K3ryO/QZyuQQvAwtRad8/HB+5yIJvVYIcV/b/Et3Xz3A/6Kr+ N817RqqHKX5PUFCH1WxC0JJVtZgoDcIl6vaWD6Q3DZBfJawzFFqXiTyGQjGhvUZCAY TxLNKbMiW+WTfcRAPCboFnAG+6YCnjS/5NeC4EpOvf0B/Bkr+OF2X3Nkv7pJVUgZt0 xctDWUWvSi3FlqeIw4B1LjWRKggjQJvZ/kD5Vf2nYFFc/ZQmSPRFQwlGAjYb8+lyL5 pkCc0aCIBwywUvaw/qnTxb4v/nmPB8DBC5IGK5oVLUlcHNJ8McsrB2DGh+0Wa1K9Ef 4l57w1rYxt+iA== 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 5B736E69E99; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:42 +0100 Subject: [PATCH net-next v7 03/15] net: stmmac: Fix clock rate variables size MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-3-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177021; l=4080; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=MBmDp2CoF+dbqWlxm3bedxlXiboLWf0OxlOUmswN3oE=; b=xPM1kLA0a7C8k9sWfaaNwGXl0nk36OKozjLEGl9VosrsGgYuzn63q8UcGOZXdeKdIW06DGLK8 pvpyJRKVtBZA5TocIFHZ1gTJu89+wLjEjuTwL5NcO6f+U01B0kv65nK 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140346_868913_26A21F22 X-CRM114-Status: GOOD ( 13.18 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" The clock API clk_get_rate() returns unsigned long value. Expand affected members of stmmac platform data and convert the stmmac_clk_csr_set() and dwmac4_core_init() methods to defining the unsigned long clk_rate local variables. Reviewed-by: Andrew Lunn Reviewed-by: Serge Semin Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +- include/linux/stmmac.h | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 901a3c1959fa..2a5b38723635 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -777,7 +777,7 @@ static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv) netdev_err(priv->dev, "Failed to max out clk_ptp_ref: %d\n", err); plat_dat->clk_ptp_rate = clk_get_rate(plat_dat->clk_ptp_ref); - netdev_dbg(priv->dev, "PTP rate %d\n", plat_dat->clk_ptp_rate); + netdev_dbg(priv->dev, "PTP rate %lu\n", plat_dat->clk_ptp_rate); } static int qcom_ethqos_probe(struct platform_device *pdev) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index c25781874aa7..c36f90a782c5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -27,7 +27,7 @@ static void dwmac4_core_init(struct mac_device_info *hw, struct stmmac_priv *priv = netdev_priv(dev); void __iomem *ioaddr = hw->pcsr; u32 value = readl(ioaddr + GMAC_CONFIG); - u32 clk_rate; + unsigned long clk_rate; value |= GMAC_CORE_INIT; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3cb7ad6ccc4e..d45fd7a3acd5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -301,7 +301,7 @@ static void stmmac_global_err(struct stmmac_priv *priv) */ static void stmmac_clk_csr_set(struct stmmac_priv *priv) { - u32 clk_rate; + unsigned long clk_rate; clk_rate = clk_get_rate(priv->plat->stmmac_clk); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3ac32444e492..06e07e6e180b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -640,7 +640,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) dev_info(&pdev->dev, "PTP uses main clock\n"); } else { plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref); - dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate); + dev_dbg(&pdev->dev, "PTP rate %lu\n", plat->clk_ptp_rate); } plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev, diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 865d0fe26f98..c9878a612e53 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -252,8 +252,8 @@ struct plat_stmmacenet_data { struct clk *stmmac_clk; struct clk *pclk; struct clk *clk_ptp_ref; - unsigned int clk_ptp_rate; - unsigned int clk_ref_rate; + unsigned long clk_ptp_rate; + unsigned long clk_ref_rate; unsigned int mult_fact_100ns; s32 ptp_max_adj; u32 cdc_error_adj; @@ -265,7 +265,7 @@ struct plat_stmmacenet_data { int mac_port_sel_speed; int has_xgmac; u8 vlan_fail_q; - unsigned int eee_usecs_rate; + unsigned long eee_usecs_rate; struct pci_dev *pdev; int int_snapshot_num; int msi_mac_vec; From patchwork Mon Dec 2 22:03:43 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: 13891408 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 CFF65E69E99 for ; Mon, 2 Dec 2024 22:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Mt0rCyXwBH75gm/hEp3dAw9YHLQ8vtgxRJ/+PYQudJI=; b=Aide+NioO8JdJQnvoZqu5ItbOA 3Ch/5bbLLaIgnJeHK9dZSi0J9IdstSUQKaxwKoztJFVxdTHAAIagzjlbbYlScwgVedG/mp7TbABNF k7p8U9nkZx/FA75x0Ahtha9LtIdfiifpFHiuaEJgYACTfBGPsGYtoUuuuO1yMZC8GFJ59NJTW7U3L siSjU3T325hPnWyFJRJZDXeU3zvZZKjos/Gz3IZl0upHJX0cgZAKaOvHXbGPYMXwhIly96HDmU4bt s2Ynsv+g0+VlRzcMtg+uRv2F6QZTq6iJUxBEL+cDvfgr3UHU5EYR3/IXA7nRCiGO4+fp2J9OO3yKg b7Y9i7Rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEb2-00000007anW-0wBP; Mon, 02 Dec 2024 22:08:48 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWA-00000007ZdS-40yC for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 0E713A41320; Mon, 2 Dec 2024 22:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 83AB3C4AF15; 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=qT18XtbzllFJO6K/EGbpIUkVOz74iHPo6IUZe3P4fQc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=bz/JxYz3eyi1DhpbrkglrRzAgfLElTXav/19j3GXNtp9SZKMkT0FbRY4kdp/8LZkc iQZ6sWk6qhKcy5iPHVNu150Hq+ybHvOrrexkJ7axObU7AAF8dRPn5jRrFWt1LDWmt7 w+31n7cHdbE/wf6G9niNqiYv5fHO5d7swxbpmJpAz+g3U3+o6ep/8d9uIn5GeQTEal B7mvhWI+P3l54DcUQLiGcraB7ibaDn1sM3Sw3Bmj2k8I/gruj2d5ek5yMdi0w62KJs UXkFboGXWZQTGEiOGHJwpXyOlkIp/Iud7FZM0u1XRPEygZ86pX2uKSfW31fLhuMPxx 7JCZLiSzH9wgw== 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 742CCE69E92; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:43 +0100 Subject: [PATCH net-next v7 04/15] net: phy: Add helper for mapping RGMII link speed to clock rate MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-4-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=1509; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=3exSjKEVuojsQxBeLN9HdAigOEc+2YUOvrl9BYstKAs=; b=G3P71RfPl33hdVrDlllnb16IbsYPoOcbVUfjx5BRK9sLuAk1f23ksXhvEFKSyHDK31XhRAOK2 U1oVgeCKwORDNS5e53cGGVvj7ThJyNr6urmK7ABSgVasVuimT0ur8iv 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140347_150583_919A5A78 X-CRM114-Status: GOOD ( 10.77 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" The RGMII interface supports three data rates: 10/100 Mbps and 1 Gbps. These speeds correspond to clock frequencies of 2.5/25 MHz and 125 MHz, respectively. Many Ethernet drivers, including glues in stmmac, follow a similar pattern of converting RGMII speed to clock frequency. To simplify code, define the helper rgmii_clock(speed) to convert connection speed to clock frequency. Suggested-by: Russell King (Oracle) Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- include/linux/phy.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/linux/phy.h b/include/linux/phy.h index 563c46205685..a746f056ed57 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -298,6 +298,29 @@ static inline const char *phy_modes(phy_interface_t interface) } } +/** + * rgmii_clock - map link speed to the clock rate + * @speed: link speed value + * + * Description: maps RGMII supported link speeds + * into the clock rates. + * + * Returns: clock rate or negative errno + */ +static inline long rgmii_clock(int speed) +{ + switch (speed) { + case SPEED_10: + return 2500000; + case SPEED_100: + return 25000000; + case SPEED_1000: + return 125000000; + default: + return -EINVAL; + } +} + #define PHY_INIT_TIMEOUT 100000 #define PHY_FORCE_TIMEOUT 10 From patchwork Mon Dec 2 22:03:44 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: 13891407 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 67001E69E9A for ; Mon, 2 Dec 2024 22:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=czEMZ2LYZ7yn4W/XpL9xxgwSyAv54G8CxWzNOcpEJ10=; b=doY1MT7YICgmi+X6C+64dGXBET 1o2CPZ99r7/9cnYMQiT0Kp8F5SPfF9O3cP7+MFwIgXFjFMlwdYCtulVVA2EXn4O8qMASuVPjd9xXf Y0vaG24VS8lUT2vlPyB0j4eIlsIf2TZyGARHjHIqRQAQBCSFrO7SMm0n9iQstaVMNDrQ9NiIuB5cK 6vah+eInvoZaBoCCWXtXQCeDtWnF+ZWCENd65KOeIyqAV/Fj+6np7rVfshI1iOmc7lt/qnI6ZBW0k fclZDsSAXDkccAkZgTjjMlP4FZoFlyOEQlHOTounig5dYDoc5IwlK8GTumGsc/L+KR6ulrN7qBfHU v/DEpI6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEa3-00000007aZ0-2Z6R; Mon, 02 Dec 2024 22:07:47 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWA-00000007ZdN-2E84 for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 83A0B5C6990; Mon, 2 Dec 2024 22:03:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 9982BC4CEE3; 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=cDLcuBxu4MlG3S8lQE9mNu4I9S677lFh6lW7mFum0/A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=T6hjT1+arBPgp7c33VwEcTT8f/S4S9a673U+azCiuPkyQ+12Juiv3znjuZqbOVHqS jg25QPFQIAvpRtiX3s8jGJb4wW0DFiVLfPokQL91YL81Y6JTj/2M92d54Ke/MqnSL4 JeiHXYwERm9wUkoP6QO7LLyqRvqM/453/NNHEqoSXQypzpiF81iCv96WhTCmROA24M 8jn/XuQllNnyFdG7J1ymxzSfmX8sobB/Ys6Yo2cibrfCYP2ZcPtjkNnvKz+smG4wbr VVJkHm4xMbf5fLz/TSkiJxTp0CkEOml6j5BiMyHwe+Qn13y6QLBo5F5nt3T6ASTe4u n0vtNf4CXVuqw== 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 8D717E69E95; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:44 +0100 Subject: [PATCH net-next v7 05/15] net: dwmac-dwc-qos-eth: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-5-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=1290; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=ZX+NwH2HQko3cIWDQjmmck130Lb3TijMXiPn59w6r/U=; b=uFp6e8h+BhAGpSRRXxR2e7S65R+2Nk4BVvwpSvoqxh9gwImcp6mIyNDmExHQ6dDj4WXJX7JbM p5u50oCGZHYCFppK8t8F3U0MIgqvWLohOmp9qdkp+hZl4WEN6/eC13h 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140346_658183_B2B3A5BD X-CRM114-Status: GOOD ( 10.51 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c index 83290e707df5..bd4eb187f8c6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c @@ -181,24 +181,19 @@ static void dwc_qos_remove(struct platform_device *pdev) static void tegra_eqos_fix_speed(void *priv, unsigned int speed, unsigned int mode) { struct tegra_eqos *eqos = priv; - unsigned long rate = 125000000; bool needs_calibration = false; + long rate = 125000000; u32 value; int err; switch (speed) { case SPEED_1000: - needs_calibration = true; - rate = 125000000; - break; - case SPEED_100: needs_calibration = true; - rate = 25000000; - break; + fallthrough; case SPEED_10: - rate = 2500000; + rate = rgmii_clock(speed); break; default: From patchwork Mon Dec 2 22:03:45 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: 13891414 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 B5EC4E69E9A for ; Mon, 2 Dec 2024 22:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ts35rcKCuatC08lXoSSuzq3DRWdEbfMfyrqLNSbugOw=; b=ZFw0HfovW2NekmJQlyiB61RinP rbJc1GhyignBAHIeITVzNFMqEkFxSW8B+NNfm/oabQLAVGGwfeU+ST7oLlNZOgYjKZ1wsvmCa4VVR ekzmPlvzZ0GOKlknExMRbTZPXLv+JYpSJQOM939DY/KSa2PUx/DcBdLxEGyZtDLqM8q2yEMKrW3gQ 9O1IzGjEX+FHR67nhfxADjTDm+puPau4f3+UxYaBY1j2GFQabj7oI5ILVxpXJ972l2a75WtK9giXc 6gl6mR4mXXNSniQ1sXFoq/rjSqKfQFAf47PsaHB5RvgrY0KrktkG1gkDE7JvdmuwahA0AYHFp4/Jp PAcbON4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEfq-00000007bjj-2Mf6; Mon, 02 Dec 2024 22:13:46 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWB-00000007Zdu-1eBM for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1E909A41325; Mon, 2 Dec 2024 22:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id B98FBC4CED9; 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=2tMu+v0wz2kD7vp6+Ltgu032C6Y9FI2iXPc3O/OTgDs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=o8/Pz00vesbdSwhCrM3CJ6CD8ksO6WsLD4D2rWYU8WvedyniqWtJEQrxRIWe1VOqE t7LCP6/OL5Obppn0iOIzGHcr03s7ASLA/oAX61O6a+q3Fyjk8SZvktJvYo6U8Vj68Y NSlKlGY0leC17jBMT+P/6bLTQ/fSW/xjfjGJRwy8+UQpf2wZfbAPQmXVzdePHHnKvk PVfxJX8tvFLZxfQ33RT0LBAeoGfp0idNl4Dg2c+SDdkRUyboul56ZSl08ISpSEWmiJ Kxp3Oo0WIjee8+h/ZyfWbyvFTM14NVG+dkZiSr77Dm1OhsXLKnHJWGv9HcKcJ9M2m9 eHsE/R8kMAowg== 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 A2C8EE69E97; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:45 +0100 Subject: [PATCH net-next v7 06/15] net: dwmac-imx: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-6-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=1376; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=SsszkUP8I3NbcQMnOnyLygQGzFscaLh2fXkadRBQwQg=; b=9hHUt4Qq44TlHvyR2z23YCG1uAC4LFSMTHZD90Lgc/7EaGWLCOIxcHRF0zaruNcS6iaCwkIO5 GNQhSu694X4DbDyV5GEi9npK8Ft/AwvuNCLSehUeXXWU2YlyKgTj6x1 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140347_606405_E1A1FDF0 X-CRM114-Status: GOOD ( 11.02 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index 641f3cd019a3..43e0fbba4f77 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -186,7 +186,7 @@ static void imx_dwmac_fix_speed(void *priv, unsigned int speed, unsigned int mod { struct plat_stmmacenet_data *plat_dat; struct imx_priv_data *dwmac = priv; - unsigned long rate; + long rate; int err; plat_dat = dwmac->plat_dat; @@ -196,17 +196,8 @@ static void imx_dwmac_fix_speed(void *priv, unsigned int speed, unsigned int mod (plat_dat->mac_interface == PHY_INTERFACE_MODE_MII)) return; - switch (speed) { - case SPEED_1000: - rate = 125000000; - break; - case SPEED_100: - rate = 25000000; - break; - case SPEED_10: - rate = 2500000; - break; - default: + rate = rgmii_clock(speed); + if (rate < 0) { dev_err(dwmac->dev, "invalid speed %u\n", speed); return; } From patchwork Mon Dec 2 22:03:46 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: 13891412 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 72FE4E69E99 for ; Mon, 2 Dec 2024 22:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XWu6Z5v7RGtsxQryvFIF5ARBAtAKsVetYj8/dSX2OYc=; b=HaQJK0twSM5Rl1qRYNb3BJNmie 8HNrJPAwb+5Ivi0FmII2aVk/m+Whghs9v9B8N2rH8QDG6/MkmH21Z4edfLia6Cq8VuTYjPvyWuQsM 36R5IgIfbVq5fM4XLyCYZn3jQ1CQnD6eI25CSVRsWCklEPWZrvtedUbCUSB8IlSk7H/2M/Nu7OWRU L8Diyjq1MR1gqdu8hFGFD9QbWT6TDwPoDsXvI7rYG9T9tMWPQb35CxOrciw81T3WLXjoCsbdtPCFI foVKak/X7jTQR415zcj6t0aqAIcEC0mWRZLFoRO09druAoMaNeeMGMTXKdKYDnQPSimB9r+FlOOi8 Kd+2xMww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEdv-00000007bVU-136W; Mon, 02 Dec 2024 22:11:47 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWC-00000007Zed-00ag for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 39135A41329; Mon, 2 Dec 2024 22:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id CCF87C4CEED; 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=MdqsHWxoEbswm9BrGX6SpwNbcHkCUMsgVrFUDFuO4JM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=aZEu1Zsz8eCmY9cBFgCU57SdKOad9AbLBl0RiEhuMWQ/yude6wAHnAv7Rs/yDmP0T xtaV3N6nctN08hkpvRxZl7EtOv2vQAFXYPxF3XG3Qr1il3qdg5uMPB7JY28m2oONM7 ing3AVOwF9SAY9ZNyqqKXfckphi3Q2qoqYyhJqHohO2+Su4vf/YYuV9gpR2UuTSO+Q PMo2UFj5ekp9aoa0Pa82NxpdzVKrMEfhg09C8T3SqfUGPoIGyEvjgh+yV5ztcZwLIV JgSpZ9iOXYfEu+qaSg6Y7/PApQ6MbSbIuLfQb+/VO93JLPfOvsbWn9QH5HoyazzVJw VcIdEQEV5QazQ== 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 BB6C8E69E98; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:46 +0100 Subject: [PATCH net-next v7 07/15] net: dwmac-intel-plat: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-7-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)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=1284; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=Ku8xMy0eJs5aGJR44zqrL9wRlkD9lntzlgmaMXGJpvg=; b=2U1B84zNI+h53ExIN6aeEX6Tre/is8ckFDswPulOpJ5/biVW0pNGxVGH2d065bRWqNMwX6Jtm SJ5TQHoJyPbBLV6EConUgQI0xWPW+8dUiOa9c3542MDtOBOHH/wLazN 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140348_209783_114B23C1 X-CRM114-Status: GOOD ( 11.54 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). When in, remove dead code in kmb_eth_fix_mac_speed(). Reviewed-by: Andrew Lunn Signed-off-by: Jan Petrous (OSS) --- .../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c index d94f0a150e93..ddee6154d40b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c @@ -31,27 +31,13 @@ struct intel_dwmac_data { static void kmb_eth_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode) { struct intel_dwmac *dwmac = priv; - unsigned long rate; + long rate; int ret; - rate = clk_get_rate(dwmac->tx_clk); - - switch (speed) { - case SPEED_1000: - rate = 125000000; - break; - - case SPEED_100: - rate = 25000000; - break; - - case SPEED_10: - rate = 2500000; - break; - - default: + rate = rgmii_clock(speed); + if (rate < 0) { dev_err(dwmac->dev, "Invalid speed\n"); - break; + return; } ret = clk_set_rate(dwmac->tx_clk, rate); From patchwork Mon Dec 2 22:03:47 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: 13891413 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 9EBA9E69E99 for ; Mon, 2 Dec 2024 22:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=idcXtrY2wMDq7fT2DhHNi1p2L8LAbPUxMtyDpo9U+f0=; b=2o5m3mOXdEJ7qqWtsKDa/IB5HW L64ocrmEZ8k6MRoP5X5qJgg1IbAS26UQr6s6vWYaa4e/LziZjfs+stc37z0yCOMQZqb+zqy6POdHC npvLPUVIoOiiB++wF5s3AeFK51fbZ3Tkq77TkF9dy8SoPr1Fow0qNvC146nU8BrN0l5DoS0+xEeY+ bQfcPwPyY+Hulg2siyyOTyvswxjBdHc1d4VtwHC5vdN8btyvhxUawTACAEEqCOpLn6G3n6Csg9tNq Zvv3sjhruTSqRaKlafATYAEXMk8E2UgbdWrUV4gC6B8Vjsm4Tr0oSCMvN0DXVxxgrn5uBvvKqK8Xx YxPOjlXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEes-00000007bct-3XCe; Mon, 02 Dec 2024 22:12:46 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWC-00000007Zek-09ji for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 792A4A4133F; Mon, 2 Dec 2024 22:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 11B7DC4CEDD; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177025; bh=8EXZPVBYXlmWobRbQGHWVYHGGh1m+iUrmdn4povZRwc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=OmnU1fFGAx5kBt3l1068m/cD0b1OuVqPxeQv+RQTZyYqDNjlAa8KGO4vgAWrmwVKi Go5MTvjnYengKInUGSGCRqpkFlSj38aBHMRvcCB2RthsjspgvL6hcTDK3dY0c5z+k4 o2vTUxn2efWfDZ0KXHfDtpO/L8cqQCVl+3CqR9R/xa7izHJhJSX+GSv/dVjIHdU6g9 GYu7+sXhcIdKIqz9vm+m7/sHzNWVQCfOidYyfJXKhftiypv9TH4Sj4+KU6ys+AcYzD pi/vPBJTQgXMNzfaX3gLuV2DsOraKBhkQ1lsNnDQd6rrYDBOJ5qknL5092Lkk7HWBb JtHgXvrCYLI4w== 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 F2468E69E97; Mon, 2 Dec 2024 22:03:44 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:47 +0100 Subject: [PATCH net-next v7 08/15] net: dwmac-rk: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-8-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=1773; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=gyls2APUKHLlHqQNKqSG/VCF+Tkp2Zbsb4S51j4pUXE=; b=vy9DLGv3Vdm6Dm1LqomplrVBOoVGrMYN+KNky2654yRfzJ/IP9V2YrCQRm6G/rwtK3eqAkVfp iz4VIegNv8YAQwq59pWaCtB8/29r5wMg4isaJXusoe7T2ZtWlMAhs9O 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140348_267387_66D3AECD X-CRM114-Status: GOOD ( 11.15 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 30 ++++++-------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 8cb374668b74..a4dc89e23a68 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -1079,20 +1079,11 @@ static void rk3568_set_gmac_speed(struct rk_priv_data *bsp_priv, int speed) { struct clk *clk_mac_speed = bsp_priv->clks[RK_CLK_MAC_SPEED].clk; struct device *dev = &bsp_priv->pdev->dev; - unsigned long rate; + long rate; int ret; - switch (speed) { - case 10: - rate = 2500000; - break; - case 100: - rate = 25000000; - break; - case 1000: - rate = 125000000; - break; - default: + rate = rgmii_clock(speed); + if (rate < 0) { dev_err(dev, "unknown speed value for GMAC speed=%d", speed); return; } @@ -1540,20 +1531,11 @@ static void rv1126_set_rgmii_speed(struct rk_priv_data *bsp_priv, int speed) { struct clk *clk_mac_speed = bsp_priv->clks[RK_CLK_MAC_SPEED].clk; struct device *dev = &bsp_priv->pdev->dev; - unsigned long rate; + long rate; int ret; - switch (speed) { - case 10: - rate = 2500000; - break; - case 100: - rate = 25000000; - break; - case 1000: - rate = 125000000; - break; - default: + rate = rgmii_clock(speed); + if (rate < 0) { dev_err(dev, "unknown speed value for RGMII speed=%d", speed); return; } From patchwork Mon Dec 2 22:03:48 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: 13891411 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 AAB02E69E99 for ; Mon, 2 Dec 2024 22:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MmlCmuMPlIo/Q+zBFJ3kcGAH/uG2HIzfycUmqJYQy0w=; b=RLKsutyXtAMX5iSLnhVfTpVQRL tKNLhW8HE7woVgq3ej/iVlL+ux3cJ/RNyM/GQQR1kp0A+oxqEdrtbnURcTcTjsl5M7xmJbyO9XSrN H9c45hMIm/Gp6J1z4pjqcsxt19XrXQRX/Pu+avZq+YrT8bCEEFR/uBK7UJc4cZLe1MNEyYPvHhCI+ Rt7slA3rLtingpPHMviwfRhgVpd802QQ3fXYfklgI0RqdhC3oVem9Wi8Fc6oVIKzctrYjbMu5cnHI V7XTcScQGir6nhOvh8VcLt5QzrZ2uSvViUqni5Q+UaJuOir/XgaHbuq5bqU5hE1+QynLdAqKWOdJ3 XyJglxPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEcx-00000007bGc-2jK0; Mon, 02 Dec 2024 22:10:47 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWB-00000007Zdg-03B0 for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C4CF45C6999; Mon, 2 Dec 2024 22:03:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 2B592C4CEDA; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177025; bh=KSQ/a7NqTpyosWEB/jr4bID1FonyDJV1OEBnEmOAv/0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=HscXUc1nINjeTaACp2C59NdCUMD8lWt8QTFrpcCkzBGWaa/oBfD4De5MP00wOy3E+ F1yLkRlV80MikJOMsxRsmV/wh7rf5Scae3HAjo2owQdTfPF+GNC/s8AhxWTVwBaIS1 LE1t8G6LKFytzIfsdpv3988cJ5bH+KpmNUUZub9gTAmBpccefvZrxYWniLqyvYIG8S 00zzBv9iVKX1RAmRUKKoGfFIuCDDXbtjDmPhtXMVTpJCW6TQjUSLXtfZH+lC4nC9Ai E8YdtCci+cOdnjR4gAZ2o4cCXk3XdN1AcmTeyCR8PEetN5LHOTA6tdTdJjOwcZESqQ 6rcPLaDZ56KIw== 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 19283E69E9B; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:48 +0100 Subject: [PATCH net-next v7 09/15] net: dwmac-starfive: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-9-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=1292; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=XVAWyqUUjd8nvrXhKQmMFKnUq2h/nlnHImM7aCwOPfU=; b=Zcljlik1hyP/2RP9UWvjuyfLctnSzRnlQQzlgEYfMjxqQ+uSPMXRVptQQG4G1gHlDf4nMT8Zh QoOd1yFPDa7DOnDcGLUlw5bAR7NGPjot+92S2P7Q/shZ49ADNYYEqJG 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140347_191935_0E606577 X-CRM114-Status: GOOD ( 11.05 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c index 421666279dd3..0a0a363d3730 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c @@ -34,24 +34,13 @@ struct starfive_dwmac { static void starfive_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode) { struct starfive_dwmac *dwmac = priv; - unsigned long rate; + long rate; int err; - rate = clk_get_rate(dwmac->clk_tx); - - switch (speed) { - case SPEED_1000: - rate = 125000000; - break; - case SPEED_100: - rate = 25000000; - break; - case SPEED_10: - rate = 2500000; - break; - default: + rate = rgmii_clock(speed); + if (rate < 0) { dev_err(dwmac->dev, "invalid speed %u\n", speed); - break; + return; } err = clk_set_rate(dwmac->clk_tx, rate); From patchwork Mon Dec 2 22:03:49 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: 13891415 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 B9EDBE69E9A for ; Mon, 2 Dec 2024 22:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s4R9ZCznSvP7a9d+goJa7yTje1YRCtLV0iG5CivTw30=; b=QwqEE/mJZ9c9kJeJhFgVgM5XUS TvgQkBU+x5O6v3H/K0YWUTEp8hyhQVvtylsHR0T7TodzSkY3yd2/m9WieQHgoRHMVPWYuMD7UO6bt xOcnTdPvXSdEIJydOqmFmRGH6PVW889a0c2a/mT7qIt3AA5YT802kegwVY4FeFQd1zvIKJtLzFrUi 8M0Yzz0FTcW8NIYEsOS7MCeicDZQ40/pa+rPX4bvXW4qZTJpyCwvXBM3pnOQ9q8iwF04gA5Mx1Ody wB75p6nwDkp+ZoALxYHcOtkrG9DrDRX3Nubvgs6dYk5qlKyDwFxAMp8MPvLhJ3SwWw2djrFNge8lr QRzIajBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEgo-00000007brO-0cW8; Mon, 02 Dec 2024 22:14:46 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWC-00000007ZfM-33wF for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:50 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 91633A41345; Mon, 2 Dec 2024 22:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 462E9C4CEF9; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177025; bh=AlRn+WZd6SfhWS2fa7bQSadmkZzrS2yhhKqX7aao6Sg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=t3bMmAgpeny5Rr+dKIQ9di8i8EW3v1hGNeFya+sVpq3OuOd2tcQurffmzChhYa2tP 5q/+Ur499VBFfZWbES5za7SQr9yY4M+1WP1quc2Sw0xIx147zDaBVk2zlEOhObu6tI ZE6YEAzGR8puHRHfApYVLp0pkuEy456/ohHBL+74e42890nIS0vM60LYXtTZSYOr1A GG3Qj118FaQd6UeaDA1Lf6j9HxgGW+QMy8KiACJKkr7UFCzz4ASdk++GVQQzpmGx8l KUtE4y3TjwlbzvaF3iweY/hNw9FZ87FMFggAhAExp2Rk006j469l7hhZevUGJtOvCA hcsBTX9v0V0gQ== 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 32BB5E69E9A; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:49 +0100 Subject: [PATCH net-next v7 10/15] net: macb: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-10-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=1061; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=lqge0TxoQLFiynEUre89U7vm4A38Pvil86ayrYiUui0=; b=0dojWH2QurVqIGbrYi00WlLX9O3NILvUHLlJ/KB67z4SodY4PvsGrC59IwIbsUCA89DV5gqdY whHNEsCZMZNBHHh7mB85iweZKRjpFVy/NGd2ofn+CnBQO/gbxxohgyv 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140348_955802_477251DC X-CRM114-Status: GOOD ( 10.15 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/cadence/macb_main.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index daa416fb1724..640f500f989d 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -530,19 +530,9 @@ static void macb_set_tx_clk(struct macb *bp, int speed) if (bp->phy_interface == PHY_INTERFACE_MODE_MII) return; - switch (speed) { - case SPEED_10: - rate = 2500000; - break; - case SPEED_100: - rate = 25000000; - break; - case SPEED_1000: - rate = 125000000; - break; - default: + rate = rgmii_clock(speed); + if (rate < 0) return; - } rate_rounded = clk_round_rate(bp->tx_clk, rate); if (rate_rounded < 0) From patchwork Mon Dec 2 22:03:50 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: 13891416 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 75B26E69E9A for ; Mon, 2 Dec 2024 22:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YdV8B8FrQyPertKrQMmuIzrsZcu2pgueLdXDLFnU0YI=; b=jY0Es1XpSQ3w4xTx67FmfLzT2t m/yMM2Cd4jY3gJXVz6FmUNf0qSG3ZlY5/TNZijidTPJGkWbQuaCht2tLzsu/6zf/YCUT7S0nQ/RHT XCkZDC9Ab7ZucFlBm6XvAbYBg5vGozs4pQxh57qD7Y8N7c8khvBYMT1JYEqGiwQMt+MVxW9pMUEqr H7P13bYBJUoQWl5kow7Dq5CfJ2sLPszIzm0Crp4XjBXr6iyLkpp5ovRTGYIhaFel3txvsmms6wtxO /6BXSSr2HcQNmjLBGWTX2kiSU7GfsEZHikcAF91OSS+sNO/FGGHoodsDSnR/3a+FgreA7eRqLcBXF IqP1pt2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEhl-00000007c0Y-3RIM; Mon, 02 Dec 2024 22:15:45 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWC-00000007ZfS-3H8z for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:50 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B6C35A41350; Mon, 2 Dec 2024 22:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 71412C32781; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177025; bh=zUEz2ANM1tWrM6cItHLJ+CI7tAh+sUssEFYL0gzJjUo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=CrCkluf1Lk7RZDDKqdKsBpE6hcP8KZ6LgpfxABEO7i3xQHWVtMGjVSwenNOKX8anz zZDZ8mBQK8Q1pNu91tcb0+G+mHxj6QVcZ8uCphGvGMtXK4hGx/+zzBuPWbeIw8s5Od XQhkpv0M0gdLmwsEinOA6HV9g5AfeoJaFw/v6p7Z+XlfMynrB9XUkpzFsW5jok5b6U QsRWlr4/bzUlaRvLNUda3ZBYuSfPtY3OnJvJ92TrkuyGpePig7DIeHYGAFMqJ8JEfi tgA6oKQxCEk1bKYKJnUuEEs6Btg3zsiyeBVM6zUV2MCI/w3xNFUwxlevb6iJTd/jWF GooH8EjPHed/w== 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 5C931E69E9B; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:50 +0100 Subject: [PATCH net-next v7 11/15] net: xgene_enet: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-11-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=1191; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=yT5e9PnijROcL6qGdZBMgaJx1+AeFQufN+me46lPuTM=; b=I95Wr27S4IfVs/rMlFvgsfgIVyruXTBBSAYIbseNDgp7vuKeoDZ80N0sObA4Zhv4vzmHR4X2G 5STbpY3tK4HAJC+5X2IXvJ97pdZYYVTFcl/xQM2FsPALwb/jI45/Z/N 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140348_970564_67DC6C59 X-CRM114-Status: GOOD ( 11.34 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index e641dbbea1e2..b854b6b42d77 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c @@ -421,18 +421,12 @@ static void xgene_enet_configure_clock(struct xgene_enet_pdata *pdata) if (dev->of_node) { struct clk *parent = clk_get_parent(pdata->clk); + long rate = rgmii_clock(pdata->phy_speed); - switch (pdata->phy_speed) { - case SPEED_10: - clk_set_rate(parent, 2500000); - break; - case SPEED_100: - clk_set_rate(parent, 25000000); - break; - default: - clk_set_rate(parent, 125000000); - break; - } + if (rate < 0) + rate = 125000000; + + clk_set_rate(parent, rate); } #ifdef CONFIG_ACPI else { From patchwork Mon Dec 2 22:03:51 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: 13891417 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 74D30E69E99 for ; Mon, 2 Dec 2024 22:16: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:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vLOQaL4VwkGwmmyBjTxl0a8isrwBxSjC7W+8IS5dpbU=; b=lH2QaBbGnZRmgP5caIjbhxSjR4 gnweB8Ty1X4hXcw5Q+jFJKV+94qzlptzWrebVgsmhcdjCZYtvM4jzVw8Kzc02S0UBEaEozOJ1LS32 8opnPJsaoys/K0fmUQyhxRFImW3c4kL2cVfRXerOQE/ZfyqUd3prY8AaxulsqEZBcZqrDzhq+7FV0 NiqgsaBQyYX3LiaKAZOgxazQfkJeWJ0THMZ+4w83ERAOlPu5WTTNQDEjlh26+/7157HnmiC0deQQs laQKgk0YHWnWVKAOseHk0fxgjPgwgb2kxst6nO1t7F68ez/Tm2iUDsNngaulF8Ka4c8RvDTM2JRzj VBZ34DdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEij-00000007c7K-1nrb; Mon, 02 Dec 2024 22:16:45 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWD-00000007Zed-2lnB for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:50 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1FE67A4136E; Mon, 2 Dec 2024 22:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id A8534C4AF49; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177025; bh=F4cbjF/9M6ITcKCkPhkzEDR5HNiIhwkdl+T79A6mE8Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Dh7iRQsP1aktNPhrpo01hU5yRN1vLgusFkuhdNuBSHoA8rlteqrxBaHPpjow93iJo fQuLACvA769PrPubsDkJ5phrh+FavEljQaO4Isr7WnxjG0xG1ile1Aav7WH4MCzMGN /lK70kgx6IsGLa8bJlZKhNkO7bFil3p2EbIMRXIWW/vAusbJ6cdp56u5REuyOY79Pa 8MHEenU3IFX7epAj8gqw7Kn1woxNVP9zcr3wflvX0jTO9qKwON0Dj1wKAWNgWM0d+O 7dREoWK8i6eiv2g9hMETySSWCCjDqNuWOj8jwAGP/XCaEahxCrjar3/7xcZ3KehJlG lUGCW2Q+UoQig== 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 80BBEE69E99; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:51 +0100 Subject: [PATCH net-next v7 12/15] net: dwmac-sti: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-12-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)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=2017; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=E3dKlyRUyP013sEwa3YoW1YOIguttVezMK0ReGNP/J8=; b=5EU9Td/kVd7f4K9kEjDJi+349oi1iNwhZveDd+NbdQO1HK6hNFZF1sN6KFKDbDtGKZoUd0cQE bWHECNs0viOC6v11NRJYA4/ZXYvX9/tmNblOkNBiTsbNjmEjreDosHe 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140349_842317_23F5110E X-CRM114-Status: GOOD ( 13.79 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). Reviewed-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c index a6ff02d905a9..eabc4da9e1a9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c @@ -21,10 +21,7 @@ #include "stmmac_platform.h" -#define DWMAC_125MHZ 125000000 #define DWMAC_50MHZ 50000000 -#define DWMAC_25MHZ 25000000 -#define DWMAC_2_5MHZ 2500000 #define IS_PHY_IF_MODE_RGMII(iface) (iface == PHY_INTERFACE_MODE_RGMII || \ iface == PHY_INTERFACE_MODE_RGMII_ID || \ @@ -140,7 +137,7 @@ static void stih4xx_fix_retime_src(void *priv, u32 spd, unsigned int mode) struct sti_dwmac *dwmac = priv; u32 src = dwmac->tx_retime_src; u32 reg = dwmac->ctrl_reg; - u32 freq = 0; + long freq = 0; if (dwmac->interface == PHY_INTERFACE_MODE_MII) { src = TX_RETIME_SRC_TXCLK; @@ -153,19 +150,14 @@ static void stih4xx_fix_retime_src(void *priv, u32 spd, unsigned int mode) } } else if (IS_PHY_IF_MODE_RGMII(dwmac->interface)) { /* On GiGa clk source can be either ext or from clkgen */ - if (spd == SPEED_1000) { - freq = DWMAC_125MHZ; - } else { + freq = rgmii_clock(spd); + + if (spd != SPEED_1000 && freq > 0) /* Switch to clkgen for these speeds */ src = TX_RETIME_SRC_CLKGEN; - if (spd == SPEED_100) - freq = DWMAC_25MHZ; - else if (spd == SPEED_10) - freq = DWMAC_2_5MHZ; - } } - if (src == TX_RETIME_SRC_CLKGEN && freq) + if (src == TX_RETIME_SRC_CLKGEN && freq > 0) clk_set_rate(dwmac->clk, freq); regmap_update_bits(dwmac->regmap, reg, STIH4XX_RETIME_SRC_MASK, From patchwork Mon Dec 2 22:03:52 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: 13891419 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 6320AE69E9A for ; Mon, 2 Dec 2024 22:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XlO2AsznqGHvnCu1qZjIsNLjWqOeodvd8IUDNjUrjpQ=; b=MI+IXI9xt9MSM8pdOb7PeHjp8P fgJtYWWVy9DPI8j/Xr5bIEY1VSlhvMRtizh6rcS7jA1fwYqV6kh2191SsbjkJnuJRLV32itkicUxW /di/sXe5XcPVLPpF4vEzwTHI8sgB2sKHD+At0Wm88PByo5f+F+SReVfFfYHbja85k5FYLXtP2RZc7 bVI9FbgZmOs8T/QS2kzPvxIXwAIX0/J+feqVXnPg7MLT/Y1qCp4RdAqmEAkkK9Rx7EzmogvNbMQTC lYTF02IzYCnVZk6hTKB9DdJzOd1qwCjbj0INnkatj7nwc0NNB5kfD2NkUf/01qL6+JGPF2NOjbipb iYdO8o8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEke-00000007cPB-2hlZ; Mon, 02 Dec 2024 22:18:44 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWD-00000007Zfl-0OX0 for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 370F1A4137F; Mon, 2 Dec 2024 22:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id BF8D1C4AF66; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177025; bh=hRTYBgd5aMrqxBD9zYQNvdPGPWcLGVS6g40811SQlp8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=aJlFNFOcOE0uG4vbLmfuOXnmFQtUGRNhbrsalGR94bWMVtYanbuORS3irLV74VBgc FlSu8zp9jLqJIEsiBvr6GiVZOYdTac4Pxex6zQ+V0zfr5UNegrI6lK5m8fwkYR9CJI ArR/bnXT/8NkB9Fr+aRKL6KjCli/DjBMPZjZHeCb3EjfTz+vojTfpIa7N8BkHHjugp AZFhRrrF5W6+6lifx9NO8P25RxLoTgIf1p4+Lvg8AyaZzkrfqlUep0221ue+GvAqvE 4fWyVvxufK3AZGsbX+zQYR/SiQIqyxRaZfZJf7euranEno6pp11cFJ9Qebp0BHeiZW 76NY8cXoId2Ow== 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 A75BEE69E97; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:52 +0100 Subject: [PATCH net-next v7 13/15] dt-bindings: net: Add DT bindings for DWMAC on NXP S32G/R SoCs MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-13-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)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=4096; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=HHjvFK+MHmQc/THlQijGySkp22UNi4Qf+z7YD0xfSdU=; b=CMtyvGEcz3oJ2RWs/sHx7na0935CqSyW5Rk4GQslIviTURRU2zvcw3tTeDczQvuPi6IWIq+L5 SANRZgK19n/BtZhgdYUMLcGkdw8yaqJfRw44ok++Arrt/Jmo+dBQmYY 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140349_274247_AF83BB4F X-CRM114-Status: GOOD ( 14.53 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Add basic description for DWMAC ethernet IP on NXP S32G2xx, S32G3xx and S32R45 automotive series SoCs. Reviewed-by: Rob Herring (Arm) Signed-off-by: Jan Petrous (OSS) --- .../devicetree/bindings/net/nxp,s32-dwmac.yaml | 105 +++++++++++++++++++++ .../devicetree/bindings/net/snps,dwmac.yaml | 1 + 2 files changed, 106 insertions(+) diff --git a/Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml b/Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml new file mode 100644 index 000000000000..2b8b74c5feec --- /dev/null +++ b/Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2021-2024 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/nxp,s32-dwmac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP S32G2xx/S32G3xx/S32R45 GMAC ethernet controller + +maintainers: + - Jan Petrous (OSS) + +description: + This device is a Synopsys DWC IP, integrated on NXP S32G/R SoCs. + The SoC series S32G2xx and S32G3xx feature one DWMAC instance, + the SoC S32R45 has two instances. The devices can use RGMII/RMII/MII + interface over Pinctrl device or the output can be routed + to the embedded SerDes for SGMII connectivity. + +properties: + compatible: + oneOf: + - const: nxp,s32g2-dwmac + - items: + - enum: + - nxp,s32g3-dwmac + - nxp,s32r45-dwmac + - const: nxp,s32g2-dwmac + + reg: + items: + - description: Main GMAC registers + - description: GMAC PHY mode control register + + interrupts: + maxItems: 1 + + interrupt-names: + const: macirq + + clocks: + items: + - description: Main GMAC clock + - description: Transmit clock + - description: Receive clock + - description: PTP reference clock + + clock-names: + items: + - const: stmmaceth + - const: tx + - const: rx + - const: ptp_ref + +required: + - clocks + - clock-names + +allOf: + - $ref: snps,dwmac.yaml# + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + bus { + #address-cells = <2>; + #size-cells = <2>; + + ethernet@4033c000 { + compatible = "nxp,s32g2-dwmac"; + reg = <0x0 0x4033c000 0x0 0x2000>, /* gmac IP */ + <0x0 0x4007c004 0x0 0x4>; /* GMAC_0_CTRL_STS */ + interrupt-parent = <&gic>; + interrupts = ; + interrupt-names = "macirq"; + snps,mtl-rx-config = <&mtl_rx_setup>; + snps,mtl-tx-config = <&mtl_tx_setup>; + clocks = <&clks 24>, <&clks 17>, <&clks 16>, <&clks 15>; + clock-names = "stmmaceth", "tx", "rx", "ptp_ref"; + phy-mode = "rgmii-id"; + phy-handle = <&phy0>; + + mtl_rx_setup: rx-queues-config { + snps,rx-queues-to-use = <5>; + }; + + mtl_tx_setup: tx-queues-config { + snps,tx-queues-to-use = <5>; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + compatible = "snps,dwmac-mdio"; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + }; + }; + }; diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index eb1f3ae41ab9..91e75eb3f329 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -67,6 +67,7 @@ properties: - ingenic,x2000-mac - loongson,ls2k-dwmac - loongson,ls7a-dwmac + - nxp,s32g2-dwmac - qcom,qcs404-ethqos - qcom,sa8775p-ethqos - qcom,sc8280xp-ethqos From patchwork Mon Dec 2 22:03:53 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: 13891418 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 68285E69E9A for ; Mon, 2 Dec 2024 22:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=a+HxGE/akY8xFsa0vByPOSLkEXZdmbwnQnIPbdbsMjw=; b=J8WeQKe9zGWonvx27+uY7SnJQX DlVzVhj/MPx1WO6PDrVb+dwAcF6impKj2+uzV8EEIKX5Gu+ymE7DeTskzT1m2/+4+YJpEu3qn3WUS vk+eQ/Ce4u2GP6KAYgfWle9VmvS+qKP4B4tMakRCvtBojG9r/vcQ2Yx6a3owYTQj1WvCqC//+xLXz YlyTegjcN+rJvxQjx9UsN1/+NuMnLqbg/0du8EvI7/UNRCOaBv6nr3Tp5FTc3RAcT/j65uLzY4+vS Q/0Idwe9/nD+XtDkocXMl/90mzLDJMpZA8GtJBwvjBU1StO3ZMw8XZ7M7jJM2FZJwVdmF7N4PS6Ek 4npUuWoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIEjh-00000007cGe-0Dg6; Mon, 02 Dec 2024 22:17:45 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWD-00000007ZgZ-3fiE for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 5D077A41385; Mon, 2 Dec 2024 22:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id DF175C4AF10; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177025; bh=AnO4R5j10w0FZih8smewfXdNr/fzYaVAE8TD7GxYUsA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=c3u3ZQ3j/+UvUZNRbxr/0rLA0C0b0yoDN79b46U/VcwDRDqXyCMH9ZhSdXsz5mRCF UaM5S1R1HQIRW4hJC/sleJK/lYQeBNVQDUvd5Czlbl516echx0LdQvFhkmHQy0VYEo pggzcENWeILAHIa6xM0nGgu0xWDc8SnEaJxfy7S8DyYvog94ldLzSgaRQZzH5v9zFH E2nhLnwFFMRsQz12nVUiN4to4nC8E0OsTeOQShrpnSO2cXjsombpnbotvs6Df5rrUG KdYNEheV5sfEZPKUHgUo53LnJ/CmHK4yFa55m5Gox7GT78Pv7vaZv8wwo037rNnI4q GSS6AEaE4sUgQ== 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 C5ACCE69E9B; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:53 +0100 Subject: [PATCH net-next v7 14/15] net: stmmac: dwmac-s32: add basic NXP S32G/S32R glue driver MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-14-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)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=7205; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=qUYNPbDOjNkOyElyWl7BlSsQNIBb0+hkETF3fWGpFIs=; b=NRwwqIFLSLDRWVtaEY+U4k3Z0VspGg5na1mXQdB2vWtPdgJdhOJyUf1ESKV+7z0ZllRndSHBl l64C5mBb8i8CZU2drxEs3Fn54ZOTBuIMC7W4Z8PVUDqz7L/7tRh/0/1 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140350_080996_312C6A79 X-CRM114-Status: GOOD ( 22.59 ) 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" NXP S32G2xx/S32G3xx and S32R45 are automotive grade SoCs that integrate one or two Synopsys DWMAC 5.10/5.20 IPs. The basic driver supports only RGMII interface. Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/stmicro/stmmac/Kconfig | 12 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c | 189 ++++++++++++++++++++++++ 3 files changed, 202 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 6658536a4e17..4cc85a36a1ab 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -154,6 +154,18 @@ config DWMAC_RZN1 the stmmac device driver. This support can make use of a custom MII converter PCS device. +config DWMAC_S32 + tristate "NXP S32G/S32R GMAC support" + default ARCH_S32 + depends on OF && (ARCH_S32 || COMPILE_TEST) + help + Support for ethernet controller on NXP S32CC SOCs. + + This selects NXP SoC glue layer support for the stmmac + device driver. This driver is used for the S32CC series + SOCs GMAC ethernet controller, ie. S32G2xx, S32G3xx and + S32R45. + config DWMAC_SOCFPGA tristate "SOCFPGA dwmac support" default ARCH_INTEL_SOCFPGA diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index 2389fd261344..b26f0e79c2b3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_DWMAC_MESON) += dwmac-meson.o dwmac-meson8b.o obj-$(CONFIG_DWMAC_QCOM_ETHQOS) += dwmac-qcom-ethqos.o obj-$(CONFIG_DWMAC_ROCKCHIP) += dwmac-rk.o obj-$(CONFIG_DWMAC_RZN1) += dwmac-rzn1.o +obj-$(CONFIG_DWMAC_S32) += dwmac-s32.o obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o obj-$(CONFIG_DWMAC_STARFIVE) += dwmac-starfive.o obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c new file mode 100644 index 000000000000..1853a6b26e46 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * NXP S32G/R GMAC glue layer + * + * Copyright 2019-2024 NXP + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "stmmac_platform.h" + +#define GMAC_TX_RATE_125M 125000000 /* 125MHz */ + +/* SoC PHY interface control register */ +#define PHY_INTF_SEL_MII 0x00 +#define PHY_INTF_SEL_SGMII 0x01 +#define PHY_INTF_SEL_RGMII 0x02 +#define PHY_INTF_SEL_RMII 0x08 + +struct s32_priv_data { + void __iomem *ioaddr; + void __iomem *ctrl_sts; + struct device *dev; + phy_interface_t *intf_mode; + struct clk *tx_clk; + struct clk *rx_clk; +}; + +static int s32_gmac_write_phy_intf_select(struct s32_priv_data *gmac) +{ + writel(PHY_INTF_SEL_RGMII, gmac->ctrl_sts); + + dev_dbg(gmac->dev, "PHY mode set to %s\n", phy_modes(*gmac->intf_mode)); + + return 0; +} + +static int s32_gmac_init(struct platform_device *pdev, void *priv) +{ + struct s32_priv_data *gmac = priv; + int ret; + + ret = clk_set_rate(gmac->tx_clk, GMAC_TX_RATE_125M); + if (!ret) + ret = clk_prepare_enable(gmac->tx_clk); + + if (ret) { + dev_err(&pdev->dev, "Can't set tx clock\n"); + return ret; + } + + ret = clk_prepare_enable(gmac->rx_clk); + if (ret) { + clk_disable_unprepare(gmac->tx_clk); + dev_err(&pdev->dev, "Can't set rx clock\n"); + return ret; + } + + ret = s32_gmac_write_phy_intf_select(gmac); + if (ret) { + clk_disable_unprepare(gmac->tx_clk); + clk_disable_unprepare(gmac->rx_clk); + dev_err(&pdev->dev, "Can't set PHY interface mode\n"); + return ret; + } + + return 0; +} + +static void s32_gmac_exit(struct platform_device *pdev, void *priv) +{ + struct s32_priv_data *gmac = priv; + + clk_disable_unprepare(gmac->tx_clk); + clk_disable_unprepare(gmac->rx_clk); +} + +static void s32_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode) +{ + struct s32_priv_data *gmac = priv; + long tx_clk_rate; + int ret; + + tx_clk_rate = rgmii_clock(speed); + if (tx_clk_rate < 0) { + dev_err(gmac->dev, "Unsupported/Invalid speed: %d\n", speed); + return; + } + + dev_dbg(gmac->dev, "Set tx clock to %ld Hz\n", tx_clk_rate); + ret = clk_set_rate(gmac->tx_clk, tx_clk_rate); + if (ret) + dev_err(gmac->dev, "Can't set tx clock\n"); +} + +static int s32_dwmac_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat; + struct device *dev = &pdev->dev; + struct stmmac_resources res; + struct s32_priv_data *gmac; + int ret; + + gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL); + if (!gmac) + return -ENOMEM; + + gmac->dev = &pdev->dev; + + ret = stmmac_get_platform_resources(pdev, &res); + if (ret) + return dev_err_probe(dev, ret, + "Failed to get platform resources\n"); + + plat = devm_stmmac_probe_config_dt(pdev, res.mac); + if (IS_ERR(plat)) + return dev_err_probe(dev, PTR_ERR(plat), + "dt configuration failed\n"); + + /* PHY interface mode control reg */ + gmac->ctrl_sts = devm_platform_get_and_ioremap_resource(pdev, 1, NULL); + if (IS_ERR(gmac->ctrl_sts)) + return dev_err_probe(dev, PTR_ERR(gmac->ctrl_sts), + "S32CC config region is missing\n"); + + /* tx clock */ + gmac->tx_clk = devm_clk_get(&pdev->dev, "tx"); + if (IS_ERR(gmac->tx_clk)) + return dev_err_probe(dev, PTR_ERR(gmac->tx_clk), + "tx clock not found\n"); + + /* rx clock */ + gmac->rx_clk = devm_clk_get(&pdev->dev, "rx"); + if (IS_ERR(gmac->rx_clk)) + return dev_err_probe(dev, PTR_ERR(gmac->rx_clk), + "rx clock not found\n"); + + gmac->intf_mode = &plat->phy_interface; + gmac->ioaddr = res.addr; + + /* S32CC core feature set */ + plat->has_gmac4 = true; + plat->pmt = 1; + plat->flags |= STMMAC_FLAG_SPH_DISABLE; + plat->rx_fifo_size = 20480; + plat->tx_fifo_size = 20480; + + plat->init = s32_gmac_init; + plat->exit = s32_gmac_exit; + plat->fix_mac_speed = s32_fix_mac_speed; + + plat->bsp_priv = gmac; + + return stmmac_pltfr_probe(pdev, plat, &res); +} + +static const struct of_device_id s32_dwmac_match[] = { + { .compatible = "nxp,s32g2-dwmac" }, + { } +}; +MODULE_DEVICE_TABLE(of, s32_dwmac_match); + +static struct platform_driver s32_dwmac_driver = { + .probe = s32_dwmac_probe, + .remove = stmmac_pltfr_remove, + .driver = { + .name = "s32-dwmac", + .pm = &stmmac_pltfr_pm_ops, + .of_match_table = s32_dwmac_match, + }, +}; +module_platform_driver(s32_dwmac_driver); + +MODULE_AUTHOR("Jan Petrous (OSS) "); +MODULE_DESCRIPTION("NXP S32G/R common chassis GMAC driver"); +MODULE_LICENSE("GPL"); + From patchwork Mon Dec 2 22:03:54 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: 13891421 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 28B40E69E9B for ; Mon, 2 Dec 2024 22:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v2SQUJ8feS2vWSkqRhDnu04ZlmDiO8QT5kf89Oqyqng=; b=sMlpWlf0UPbkJFplIzH9aLt4cj dIYXY0KLUCHlb69LDROW/L5GEP09zkhs5apPc4vt5i83eZm5LPtaVMU1exNJ8yaUPszgX1DTh7Qj5 oerwd9rw3ZTS5g9QbMcwSh5Tf5CS41uj5yQAxUlqUwGcZkHT+PWc7OQrGUAp6hQ6uU+3/dR6b29YU XMAFQ9hUQAJp1Ci7abI/uCpmYnCl5/cO4C4v6b5n4zhnytEaR/5yTKr6j00mqFVd+iBh66j5c4iXC gLYHOEO8r3PsBMU0+GgFriI6KWjsG5e54INCndzlj5piAcovA4Co/3/SzEpaeXtTVbuJ8aRYs/i7M Eni0GHqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIElc-00000007cac-1FmQ; Mon, 02 Dec 2024 22:19:44 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIEWD-00000007Zfp-1b2n for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 22:03:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 5CFF8A41307; Mon, 2 Dec 2024 22:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 0A36DC4AF0F; Mon, 2 Dec 2024 22:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733177026; bh=Xx7A78Az9LY483yNlpcxh1fnnI6+OBafjR3+xqpR+KQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jS3/Dd+wkDSrpAc0yAvYYv9Rz06C+hX4kA8ABD9kebFqonpa0xmxMRFl5kbDrk+Sj FpPy0UNolN58ovi2+MnHR1xUdBWCrz/0jSqv4QGToz89seKktiQNH3ogNJX4rm3uyr DS2w/usoM3nK99Pj+sK46/ENgQmFwLqOuDuPTzwyOWdZZpjJwC3HSvFzRmGeF7GJPY jKPyNwL6vzwHtYqpqGCRAE0WmulsD9dm4WCA2pdrD+wU3jz/9EwJZW4nl6Ai20/2T6 drH2j0ZODwxOdB9yslU08BfPwNfT0tf+UDKrneUH0cT+rjT07BQj89a2j4hPlE1Jhi a1/JzMkvdOZSQ== 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 E3D3DE69E9A; Mon, 2 Dec 2024 22:03:45 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 02 Dec 2024 23:03:54 +0100 Subject: [PATCH net-next v7 15/15] MAINTAINERS: Add Jan Petrous as the NXP S32G/R DWMAC driver maintainer MIME-Version: 1.0 Message-Id: <20241202-upstream_s32cc_gmac-v7-15-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)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733177022; l=915; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=4615b800g/SFqCBNWwu3wPncyuWc4LNL3Kg9996VRhc=; b=R1xsjMpsqLH/cAho48SbcZaangLpTYAtQG3NRaP4fkNywz9ximUdUwFyBLo2fMhpiFQh4iebH BmkcKeEldPtDJYSKYlUQj1TPfRyU7/OqIdwSLmYQxZplRniL2b4KZiB 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)" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_140349_587539_FE0B80F8 X-CRM114-Status: UNSURE ( 9.32 ) X-CRM114-Notice: Please train this message. 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: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" Add myself as NXP S32G/R DWMAC Ethernet driver maintainer. Reviewed-by: Andrew Lunn Signed-off-by: Jan Petrous (OSS) --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1e930c7a58b1..baf41d73d14e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2836,6 +2836,13 @@ S: Maintained F: arch/arm64/boot/dts/freescale/s32g*.dts* F: drivers/pinctrl/nxp/ +ARM/NXP S32G/S32R DWMAC ETHERNET DRIVER +M: Jan Petrous +L: NXP S32 Linux Team +S: Maintained +F: Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml +F: drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c + ARM/Orion SoC/Technologic Systems TS-78xx platform support M: Alexander Clouter L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)