From patchwork Thu Dec 5 16:42:58 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: 13895782 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 671DCE7716D for ; Thu, 5 Dec 2024 16:46:52 +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=qgzYgby28RVKqlRfhP3Sn1CWiG dEPdJNDEwLmV8T0/C5A60Or5MmaFzUbgjEDZAn184KZ/5PoChyQvIm0zjF5m2HgAku7im0Pd+yiM1 h8fQni965fxhZGj/H76dVuNLc9Dm9d2/4NthCIO9m6W1EYcjPjhR5kMfgChnM1YHFKTVnQv/szpSW i5dH5Iwb10XqV0Fz3M93pj/OqItBNBwcJEMjW09rtAn2LywrAzYoJgJ1j/JKOvZtJSNIgYjQigjOP POjE9Veodl1PnJlgZE1UOELjApM95UvH1q2KjuHz5wvhbkH9xMDTdv7vfysPs4XKd//oCQV7JgG9f DCvBZAqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJEzw-0000000Go6t-0Wrt; Thu, 05 Dec 2024 16:46:40 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJEwv-0000000Gn5f-2KNF for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8E2395C639D; Thu, 5 Dec 2024 16:42:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id BECAEC4CEDD; Thu, 5 Dec 2024 16:43:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417011; bh=zonr3mCcTyCgwR7d1gZNImuy1doROORC9hQH8Wi0Qyg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=B8oc+62XcqZXJYDwzLdQHxQmjtDEty3a7JQFOJ0C0Edbj/d2bfrEcBuv5IQ8B1/6I pLuWV4hK5IjYngf+Sd2IALqQRA61xTXnq4x11haER5s/IYRPA9gNRTYIIUaHiM4dtz 5SkI0uHnUuGZntafkU+iLJbq/D6OIGtO5dJEjkJRaZLaITLLcihZHaPM2AueAyV+G3 hJXBicRsgxNKT0OeD9jG1/A7VDTIQHmm2sbZj/aOf3uqv7zumdvktYJi/GgVoGhBCm p3yib1MMTL5tEqUejwVTHD8aiRMBJrM9zWmlOOihI3fggWpJHkg0K04IHtU9aya57+ TjwEGYRFxkl2g== 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 A7815E7716D; Thu, 5 Dec 2024 16:43:31 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:42:58 +0100 Subject: [PATCH net-next v8 01/15] net: stmmac: Fix CSR divider comment MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-1-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=958; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=2KaIHv/oSTo3FOtKPvkHjEF7Z3D3rI5ymtYbTqdzAuo=; b=v8pvfQ8UAtPhcdINtdsR/HinWMhi87hDMqA2bUaESoiOXT0yKZSWa3bAQ70f2YH6jc3aLZyRV y5PdyrHt1rvBDETp2KAy9KF3HHtfsuJZrbEbJFNcPj5qW7cGAh8YN0U 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-20241205_084333_677954_2707A07E X-CRM114-Status: GOOD ( 11.36 ) 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 Thu Dec 5 16:42:59 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: 13895795 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 A0190E77178 for ; Thu, 5 Dec 2024 16:50: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=gZjPP7BBL4J10vjlQrHIlTqeTEB2nzqZf3I47xfayQA=; b=4jPk4XPkqlSTXNLLzJAfd49AZZ ywLblDHj1VZFfWS8iet+SuGw/17yQ8bOR5UBzC41k0QGETt7l8aSS5wCeuUTBJ0YWBPtiVI8KG6Sc gFjYznxUJJe5k26I7JqYN1lAeEJ+JkCfz3s3YB1FR1SKmiSlPPG15XdYAaPNSET9g+ZIUKGsYVQL7 sP6FaI275wulkBm13mLVZ6M7/YVffjOChWSnkBdDEZ5Mgj6m4j9zS5jwTPnT3llBU8C71zHxwCDtc vIt8/hO9IG/g13vftUgIkk0ZMzPGEnwWYfqpoGP2QCs9IQWrEbb1gNoLF4aWDJC63TU7+G7IHKohV pFJdI3fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF3u-0000000Gp8v-3fHL; Thu, 05 Dec 2024 16:50:46 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJEwv-0000000Gn5w-37RB for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BC5765C637D; Thu, 5 Dec 2024 16:42:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id CAFEDC4CEE4; Thu, 5 Dec 2024 16:43:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417011; bh=fQ/wiWKsuKCk0mrEeSWFTz5B5YHpae7Id2vaFJhJWVU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ZdeTpPn4miPcr1cOi8V99g/F3rpOALzz8Izfnx/f+8HzsbD//jAOs9PfRrDjOPdU6 2TVbOsw7JFwKOdHEHbdKNZai4c4RsWpxe8zwFFqdinlzVVYcw7TDRN/8y9KUddAh+r cG96GVzX7wSJI8wDO/itKYeeVCX28CUkshhdCPW5QX3Rlv31BNkqSQD7pkMvsBnKkT pBRp4Bl0ToZ6a4Pwy8jfWnni7RlBhSH10wy7wKcqdhZQuqIjyEgv1S5b4C4hAZsgrT jGZ9uujI1aZpx8EjhD8CP0OqNr01ZgbVpDYIkyPFGLmdhi77QmXQ1XluWpDH4efuJG olbjs+0a3rbrw== 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 BBAC5E77170; Thu, 5 Dec 2024 16:43:31 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:42:59 +0100 Subject: [PATCH net-next v8 02/15] net: stmmac: Extend CSR calc support MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-2-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=2290; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=fDnNMvO2KmjBflv1GlEvIV7YLrxVPMMghn+V0RbzyAA=; b=DPIcLOBghbMJaPzoNAkVtnDlOM/EtO7yz3KF3UZC5yxzyc5hKRzn/+s2uyWSSIgONWU2P81vL lp3YRqgTW6FCQjByMwjCTeVUHCfxqtL0hip2mtiiQdFWOzj8pa+hwrp 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-20241205_084333_867764_F235D79C X-CRM114-Status: GOOD ( 11.63 ) 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 Thu Dec 5 16:43:00 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: 13895783 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 69D39E7716D for ; Thu, 5 Dec 2024 16:47:51 +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=bYrx0S9GFf9IVqrP0s/QHPDMsj gkUBnKd8ROZSS63BrY4CsgxFSmNFSpKpyMM+WTTjSlvtujGBW9d9RQOV+YB/ytmTCZA1wyetoMOLa FPMHiI/e9yHZd11bW5NRANLK761X9QZ+vAyrP7fXeLU+fmgnumSTwJRr5SJUj3KBe9fTKNjERKwC5 uzabNrEfFp2IW33C2X9NLS/27C9WdzbLq41Csm6ibppVnQpAybMAkZaRYjBIvLXUhL4QdML42X7O8 8oboXFqe8PJuQRxMjonwEgLVabBTbYaEGC0nXafjAPcQuiqZkdAKjMBDBtAa7bmIhz0kHfDh5j8/S UUqulwEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF0v-0000000GoNx-3NYp; Thu, 05 Dec 2024 16:47:41 +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 1tJEwv-0000000Gn5v-3eBW for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A4F6DA43839; Thu, 5 Dec 2024 16:41:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id DF30BC4CEE5; Thu, 5 Dec 2024 16:43:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417011; bh=prEv+e0GG/OD65Qb7TwYdsqNMCpYICnodlwVYKCW350=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=GGzJNXn31M94/47WhfVe5KNP5fWaCLN9VTNnNLEF5Lg1wQd5tiLZKhf/8XdlgCOdS fEqH+ZAFXLWXWE0yjRcnYxBqI9GCikHpRNya3pcn7SA0s0FRu6nflQJJsYs6kAtPyg hsduLiBrd5X7gEcuMmsqXLmgkpgExKY3JGpmRwyULVtMjUGj8cZ2RRW5/iizme8/vd 2g4kTWa/vUuihUI9ktGiZKR6KjFmeJ20NsZ+RQLpOPY5EMsOAm+EJSzWzo38o3C2y0 FutFvJviiX+m1Pka8vJSoTMzuKykhqv8TO3+bONfSEM+llSR7b7oEDpzBVOUqUB8ir A5KR1XmOiPB2A== 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 CEBBBE7716C; Thu, 5 Dec 2024 16:43:31 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:00 +0100 Subject: [PATCH net-next v8 03/15] net: stmmac: Fix clock rate variables size MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-3-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=4080; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=MBmDp2CoF+dbqWlxm3bedxlXiboLWf0OxlOUmswN3oE=; b=8uHChxyIMSVZ0sLlUHsuSF/lowaFTxpDQYDwaIyAUy7QxgcGBTDGIIbxtarvCJivFXktl9Q37 8F1uSfvC6i8D/yJXSIPYKNIbZ+O+yaCVkgno9jXKCpuEvJjniOSU3Qy 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-20241205_084334_037921_4B83D756 X-CRM114-Status: GOOD ( 13.26 ) 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 Thu Dec 5 16:43:01 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: 13895797 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 8C4D4E77178 for ; Thu, 5 Dec 2024 16:53: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=Mt0rCyXwBH75gm/hEp3dAw9YHLQ8vtgxRJ/+PYQudJI=; b=OPZ2gbTQyEmyBlU5SKfwgygQAN JZE5mAXRmquaJTuhUGZqj+fjuSFGmSy+Y9g2gOL1iM3hCbT+h41X9H92e64m8Cg4IZxRgr0qlCM1j 4Dzh9AH9w9PYKBQFvszzOpYC84P/wy+MQiZBIAj5Fem/J3LrfucOwVEIY0VG4QhqEbHj+3N72/Z02 p49d5KWlcX1WeQTbqY6Y+O//6cLkT/Pq4vOVjTF5TXEEZIEfJBGxFpVZzVsA/DXqXRMcTpFy/fIUb yKiz0EdTCRvsWQAK5A6RA73/pMP+aboya/UVehPvOPE9FmkrZntZq+sxqpNimW7RnLv/698+9X+jD AF2ot70g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF5u-0000000GpiR-0Jn5; Thu, 05 Dec 2024 16:52:50 +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 1tJEww-0000000Gn6r-21Ru for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:37 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1E4845C6720; Thu, 5 Dec 2024 16:42:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 03FCDC4CEED; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417012; bh=qT18XtbzllFJO6K/EGbpIUkVOz74iHPo6IUZe3P4fQc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=GB8zKrNGGftjiDTmD1Tl/rUYuN6P3xev7DqIfBj/0kmKu4jWc26BiICyXkbxO/hdI 13qaIvyVa0g3hzsMs+bQbrVjU2c+0ZAY8BvO9HulrPK1ReQZqEidXnhTPb7j+TdXYG 5NqyuuPR7ywggaHsFr9+C9q79bTQxfSDEozo9az5e6jhWJbz4Z3xyi5Sdf75QoReR8 vhCigSKXXTImIBY8zCaBPp862A6SkwMjgNruEVN19gYpQq/TG/l4DxuBqIL3iMgu93 xa7hm7v9KIsjFnVEgvACrCJbHuqYUm/BE1ct+TJmyYxmhmKgFdIq/vCmPQpwbJ+7rp hTTB29wIuN/Cw== 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 E98C5E7716D; Thu, 5 Dec 2024 16:43:31 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:01 +0100 Subject: [PATCH net-next v8 04/15] net: phy: Add helper for mapping RGMII link speed to clock rate MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-4-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=1509; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=3exSjKEVuojsQxBeLN9HdAigOEc+2YUOvrl9BYstKAs=; b=mNFYLfQv105ROGOwlEnxB5fCA+2r6XhmI/q3hg5Ago/2NAp0TTsQCa8sMxSHZlBt7CzuAmfoG aMbYb0d/YdYB7qfGFkN26+mFOUm0y+OMiVWKG0DWo/JUd8XpPN+AVPV 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-20241205_084334_654303_B88E9E3B X-CRM114-Status: GOOD ( 10.75 ) 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 Thu Dec 5 16:43:02 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: 13895784 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 26139E7716D for ; Thu, 5 Dec 2024 16:48: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=czEMZ2LYZ7yn4W/XpL9xxgwSyAv54G8CxWzNOcpEJ10=; b=XRORcSSC754Ne+XzeOFvNRFE6m qR3AkrRvBYd2atoolRYQNRcpGvUGlWRcZ1iXjczJOII+Ull2TDWp8DZ+3RgMrOGUNe1qfn+HE+v9I x3+vdsuy6EdyH3Mb5R7DgKR+PqO7P2cX1bwguMqCBq8lD2zh435lQh3eNO3gvSyIQ3bwS2JWmD7Fa BV8B4HFAWJTsGMNdMTYSFUZq3q2xlpE6O5ER2Oru9uyrtezJPL9OweT3Q/EwZiI90wkmdSr0zEZ4p OKXGbmtpXXF6NCNCE8UPAHg/nqZW5X0g6XGiu1sUna5LoJtmIUQzQ1kUT8ar8AD4d03Jv3YfFYA6N 5dExirLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF1w-0000000Gog6-1iTK; Thu, 05 Dec 2024 16:48:44 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJEww-0000000Gn6P-0a11 for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0DCD55C6675; Thu, 5 Dec 2024 16:42:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 1EA45C4CEF0; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417012; bh=cDLcuBxu4MlG3S8lQE9mNu4I9S677lFh6lW7mFum0/A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=K8RWg/DlsQu66Ixs0wzjrqSpU9Jr6xPatWib64QGnMyRFeS8ZPmAjK35+CikrSGwT Z+X6J0bb07bGRg1a2aNjnbwpRmS4GWVmkxqtSPdQ2zrDjaUWR1Syrp3MYBc7juKLi9 DMj7yM38/wb/YB0WFMt7UhXjW+UDLJtDMj1Ag+xTRWWBdduTDiiy/DPAJgP7+6JCki KnDE3hKhtGkHf5SwVlWgvT/dB+OZceUVXDmr/rmWir34WvScQ6+Hb57wBkGACPUBlV RQd/Z6iT+0LXzgd0RIIwY1ECNNfvLqBVT/isQKZv4RPRR+ADr7ZCZu2OsIa9ewXIKh RYlSnSXNbS6AQ== 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 0FA55E7716C; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:02 +0100 Subject: [PATCH net-next v8 05/15] net: dwmac-dwc-qos-eth: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-5-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=1290; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=ZX+NwH2HQko3cIWDQjmmck130Lb3TijMXiPn59w6r/U=; b=PiP3f5Y7IK9B/J+oX/VL3ObtYifBhcxhpwIqRynudDjaaEIP00vQhJrkSe7I9cyTonjDFywbU oDNtZ0epzAGC7ZXXBTUXFmG8kC1MhnkYuy68W5hG3JFBtKBuNHAdjl+ 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-20241205_084334_291056_BA8551E1 X-CRM114-Status: GOOD ( 10.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)" 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 Thu Dec 5 16:43:03 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: 13895794 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 A9AFCE7716E for ; Thu, 5 Dec 2024 16:49: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=Ts35rcKCuatC08lXoSSuzq3DRWdEbfMfyrqLNSbugOw=; b=wnJfQc8gZdZdDjmE5EVlAZTdTq Girrga13ViyDG/qCwKIDd4oYOZRI9DRfjPcr+dRw9T8ouTrBK7NQ3gb2zQsPDA8IzpnP/UbhmIaW4 yvoiqNMNXjzh0vaQVMg98FkahyaBB+aTt70W0UU5+Hrl9rMPmN1MJV0UkZhwO6oWCcjIXAdOKFK29 7fGavj20JkkEEyogzxFnuAm71RzgdlkxABuHkw0y+5De4wiPZ9BsigXme2VdrhvTmoEUupvJKt8KK PA5FLhzCkMbAJdIeRUI8gBVlgX8FM1jTclO7kw23cbOFEThv7TA6kWGp653SAqk08oslE+7+cYwnU 9lZK+9iQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF2v-0000000GosT-0UDP; Thu, 05 Dec 2024 16:49: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 1tJEww-0000000Gn6Q-1HK4 for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 0943AA43E72; Thu, 5 Dec 2024 16:41:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 39B1FC4CEDF; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417012; bh=2tMu+v0wz2kD7vp6+Ltgu032C6Y9FI2iXPc3O/OTgDs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=AeZ5cl3wIVc0+P1U0N8VzFSYmq2BS1RV0b47scbL/8WnK9HRirvc4MtYbXHIYzXit 6KinKFayqsFNbm4ATUqUGxun/bdsOVpN/XZhZ9ZQrPBjKT2RFJyiIjQ6TzGW1zId/U 4y39xFA5BKWusLe+BjLybqEM0xT+c3uYSA+tql3ThVS8W52J7+irx75Zmgu2Ifw7t6 XCQmaLZDZDN/rkzYcmNAIH4N9YIRt9TCg48gSB18HFkNRTGVKyRs/3zlx5zov9B92s jwslDWf8q9UzVNYCwlEbokrupE/mO7pfuPefCVKTV0jDa+OuIbFuhiczGhz3Y1RKy0 YkjLmZ2jUMYOg== 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 2BA19E7716E; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:03 +0100 Subject: [PATCH net-next v8 06/15] net: dwmac-imx: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-6-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=1376; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=SsszkUP8I3NbcQMnOnyLygQGzFscaLh2fXkadRBQwQg=; b=lc904ovhcDHwsz3S6+/yhAQ3DVjhqUws0FAD0VB4VOg/wAZ6wwLIVRyccIlIgoRzYFBkx/Ry6 H1ojoPZYKMRCz5urnHcwieizMwUdXicNLwmACSqFii2xsZYe9nQ1yQu 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-20241205_084334_497444_0D878ADA X-CRM114-Status: GOOD ( 11.01 ) 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 Thu Dec 5 16:43:04 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: 13895798 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 608E2E77170 for ; Thu, 5 Dec 2024 16:54: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=XWu6Z5v7RGtsxQryvFIF5ARBAtAKsVetYj8/dSX2OYc=; b=PTLKWJHYwXxWWGJ62sqKqYIlsd 4j04OrfZF9QvdkJWsokpkSk9R5WWxbWE1haYkAUH/n25gN1m99XJauGBdKR/z4/+eRCe82dhMXK2B 77R+i8on9mkdNmpUf7KbCxsGFK/VUJ8O41oAklQyz+HhfUKK+bwxCi/hCTu82u4sc9CkNi3xpuUzP WSi0pb1RK1jlLIyTgW7BMlqN/BGev/jmmTlagSKmufEla6R5pm88TWZPQXzUyRb42WuzQBfIiztXf ckF+e7mq+GY9vEw1K8WfNxCUwe1/zHp8piQYqP/tZpthdogoMp6RhE9K33AQQx90LAi4I7VjG2GcQ 0GKZQr0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF6t-0000000GpzH-32QL; Thu, 05 Dec 2024 16:53:51 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJEwx-0000000Gn82-1GjY for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:37 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 520F25C68B6; Thu, 5 Dec 2024 16:42:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 51ED8C4CEE2; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417012; bh=MdqsHWxoEbswm9BrGX6SpwNbcHkCUMsgVrFUDFuO4JM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Denyvrpf0tWH62oxZRuwZeV9cAUf7quM7F8qC3nvWM+wA8PpUg8GrE8rX+zLe7hKx YUxvUd93ULGbaCpdFox/yMriOn05fbgq/hSMNHbHPqdKugAgpTRqTlorwTquAJgJKa pKfyk/rkcxMirulLIMF/WfNnVt5KyUsCaXAcVn0+s1kaZomIygajUnxl4CoDlvr1nP gIvSB+aDzuPhF0n4wXEss02OjaaYU+aEq+IGCoTBlkJdyUlQALb8i3mni35++UY6c2 gM2Aed4MwzhUXBgazf6V6ShmmmnAXLX/34wCKRmwUQbkBv8sTXgarQptn6cxZLA0iR C0r4LJvxZCWlw== 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 43098E7716D; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:04 +0100 Subject: [PATCH net-next v8 07/15] net: dwmac-intel-plat: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-7-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=1284; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=Ku8xMy0eJs5aGJR44zqrL9wRlkD9lntzlgmaMXGJpvg=; b=SlpOh7v4nNVm0pLzCwptN0QBO2ldqsCSY8Sf9nSyQhquMj3GTfNs51jbIqb7A69K9Y2Oz4E7Y PdHJq4FPfOODeNV5AMzSER5GuG4JDLjTKCNEpQfcqWKrIuUZAvOaO+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-20241205_084335_474439_43F577E4 X-CRM114-Status: GOOD ( 11.52 ) 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) Reviewed-by: Russell King (Oracle) --- .../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 Thu Dec 5 16:43:05 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: 13895796 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 135F1E77170 for ; Thu, 5 Dec 2024 16:51: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=idcXtrY2wMDq7fT2DhHNi1p2L8LAbPUxMtyDpo9U+f0=; b=LMMd7HyStr1jaJtkY9CGgdhGha ttOwV33DbkTEY9qbSKVOR7H1ls0LdcC5OZyTkEawbqipZ9XQUry2P1CzVvWOXnFZYQeQ97ivT8qU3 VEcWlpo6WoAe50P9i+1XA3JS9ZuCX6wgTzJ238cQf/weNtbCozK9K+OQoWVi5K1ZN+q6cx7nGw+0q pv30aY2WlYqDxOYrsa8niHXEPbkZoCintKI3/rpektIFN4KoGDe2iKrkQIhzi5wxNiMuYjcxmk/XX nL5xgvZiXB5gkzpjx9sYzfB0WxfeRlvFA2xC9fcN0Qddya0PgRuorgVWeQYTuCz+VeczL2iyYUbgi x88eznXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF4u-0000000GpRU-200p; Thu, 05 Dec 2024 16:51:48 +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 1tJEwx-0000000Gn7W-02ON for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 45E3DA43E7A; Thu, 5 Dec 2024 16:41:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 72B87C4CEF8; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417012; bh=8EXZPVBYXlmWobRbQGHWVYHGGh1m+iUrmdn4povZRwc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LWFXkx/8HF6Rq2j2sUucPlrvEA1Paa0iVHD3pIuQX0BY/whfa8kuhnek763HSD/AK qvjw1sNDvx9zstD+R2I1yJeadCXaSUPX7Pv2frtc6xaHPBshwHdnIxobp8eDnjjKrN IDL1+i7BoB44ofTP+pQV2lGz32snAwxPvGxdj1WiugCUSyxbzcEK9FVnmHxkIjE5T3 +PABD1Rs7cjnutFK5Eg6H3rRwMMDs8IxAEJjL+36EbDQNecB3mwArxK1sUeu2JDyzy BtnkCFAhPdbPQ4Tsgd/70NRxQUGV4BN8+ayvQK1obhtPWQVdHM6G5GDm3OLjlr9hHO m6HQR3DdAZw1Q== 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 5E745E7716C; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:05 +0100 Subject: [PATCH net-next v8 08/15] net: dwmac-rk: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-8-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=1773; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=gyls2APUKHLlHqQNKqSG/VCF+Tkp2Zbsb4S51j4pUXE=; b=qbnpqhoTgsRvcMIEUD4goyvuHM5dCLfQoGYQwklMsFdan4e1Zue3UvG0j2mDkqaMy8CsHkIel zdqdSPX83MqB51zs9IE1oQLfkrzH1L/X+4uLO8G7tpEZy2NLVFfkJP0 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-20241205_084335_191090_5A286592 X-CRM114-Status: GOOD ( 11.14 ) 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 Thu Dec 5 16:43:06 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: 13895808 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 47FA5E77170 for ; Thu, 5 Dec 2024 16:56:03 +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=NwutsNPAZK7/hfdSHu8QBUZhX3HGDLwE2+eaXINxW7k=; b=grV0beX8ACxYeC2qvPkE+E/UX9 hTRO0mzXc4GbdcoKGRvIUFljQIOIJzI3r+Ma2dxfBdvgBgIreLbpP60UbsGG8Dr3pyIl9b5BQb61k gpSCXsiRO1aqwWPY6Jxl4HST5h/aQ5cPi3rKsVFDldmxkHMw4YiBpQkqcHi7LeznQo3zAFqdnMYgN LgwdoVbHlKpuzPuEKHqH0V0mUXuWhhPyV4Oz0IgqNmlCe5wVWZkWDMoCiouj8zZjWh9trpsI7T80J dGvsfbChRBercsl4fZsdkoyAy8cXjaVlcuDZaLG3qgIyQSXKLFZB1rhxac2k6QUe4w89CYIkxoAwr vm2gxgAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF8r-0000000GqR8-4B70; Thu, 05 Dec 2024 16:55:53 +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 1tJEwx-0000000Gn8K-2plu for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:38 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 9DE1BA43E93; Thu, 5 Dec 2024 16:41:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 93D9FC113D0; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417012; bh=sBLS/P03iFF2+zCHse2AmBVBwkDaehZopS1JK5brE2o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ok6JwIrao+YnzyNUl9KBasZ3yy+g+xIqNJUqKuFuxV2tYqPAldecOGgrn7xwssSej YnFEVs6Y8esKw/EzTjPyBcTqBMOyUSqO32jrhKV7S68DK1r+dhGXQvLN2XToKMkVfr gZzdL1F87tqXbb5zY/07FVHCxzXt6frQRQXZSSf/jQKErpgWz9GGkpYo0TzCW2Gt+y i8BSQ3EeZhdDDCUwYoKKGRXDd+knF4ISXm6aWvYCvJ0YJcuw2rWxNXX8h+KBiEVlFL PngGNTdN3u2QeOtV3IkKZJdN1I5SfW/hbHiwE54wPn3+OWSWz9cgcDcuayrfkFPOl1 pE+OwBiF+LzSg== 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 82BAEE7716E; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:06 +0100 Subject: [PATCH net-next v8 09/15] net: dwmac-starfive: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-9-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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)" , Emil Renner Berthing X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733417009; l=1364; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=iW+rtrhNTh7WkbcA9xBon+2w19YzKulFFk0dv7RW/YA=; b=NOIwLIuzNeNzUYzaRpQaBZN2GHObVUWkFhO970SdtF6MLwSTP4bOhX/HGV5TRldTVniarDwNt bVYJMWLRcV7DILqASh3TIhxMmDjdEp44snp2JFS13GWdOv3pbEd2WU2 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-20241205_084335_877722_93E2741A X-CRM114-Status: GOOD ( 11.13 ) 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) Reviewed-by: Emil Renner Berthing 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 Thu Dec 5 16:43:07 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: 13895807 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 F09BAE77178 for ; Thu, 5 Dec 2024 16:55:04 +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=LzRfifZI/bHOWNEAl3E7GKQ/ut kKacEWROKbv6YnJhv46fObFj0IssSjcDLIK1jWnk7nSv/YWWZYmG4J2SnEo17RrPtxdKfKBq0bEeB d28Wf1HyO7JA7lkGNfxj9pRbTt2Fc23jf+pJbmJLa+NIy1M9tAawW7oEB24Dd1ggTtK2GS3M4aNHU BSyDGPZ24Uu3UfTSTtAw5loN/NELACdmR8kvoT3UqnwgRILqcLiRBd/yXEILTRljjpUY20iuJ7gZP Z6zKMNEJj/0pGqzhzQQEh3NbNEx0SQCBtlEwHLLSbLhUcXvbVZMyAZ4vrRIs85Za3pD+cyURv11uv gKEB9omw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF7t-0000000GqDl-1fDP; Thu, 05 Dec 2024 16:54:53 +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 1tJEwx-0000000Gn8H-1ZgE for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:37 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BE1685C6ABD; Thu, 5 Dec 2024 16:42:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id B2CFBC4CEE7; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417012; bh=AlRn+WZd6SfhWS2fa7bQSadmkZzrS2yhhKqX7aao6Sg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=TmJbDTemO2jVZW2qnNkIWzlh81zLnENRSZ1JjgBLJCcy6My0Q8ksunQTBpkRCYvD9 bCmJiCi7dX74qGD7B3pgm63rX/6QmcS0lyArExyci+t/DYSWoyV2VfVqbP6xhtk9Ef rRRF/N4zdoPKZR18t6Dp3KLLcxWASykmOd5h0njZGQRZPuaLUwK5MwZnDy0jPZuPos AJpD4X8IhzdzRnOuJ2qSj4pdSEluKt9Ws1zbaU4+d7xzitroQBQNM9goYsAHolvLjs J3lw2inbcaucpE7L9RlwmAlyRR5ZSHVeHxWDxlUkOGUcnxLSS2x5Lj4WIeVpTHLIpn VeWkdq0v5qgHA== 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 9D4B1E7716D; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:07 +0100 Subject: [PATCH net-next v8 10/15] net: macb: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-10-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=1061; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=lqge0TxoQLFiynEUre89U7vm4A38Pvil86ayrYiUui0=; b=HVHZUUwYBwhrlL6BmOOImKqXUfNg2MEpvgsvdQxpheQtqTJkFS1atcWcvBZMIuVU0RGITds2R JKKMG6yJ6L2DRn5uzlzCLP26+8gBZZpw93jPiI4gG63B7AyoGOJhtW+ 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-20241205_084335_540862_A05F7B52 X-CRM114-Status: GOOD ( 10.14 ) 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) Acked-by: Nicolas Ferre --- 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 Thu Dec 5 16:43:08 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: 13895809 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 08EAAE77170 for ; Thu, 5 Dec 2024 16:57:08 +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=dr5z2vrxk4Qxb1n61PC0Mk/OZ5 zTAm12azLGZvhTJbVdUpgsYWs7p7aDOXA11HvafP4H+N2MKYCSP3g7cumltR13otIY0I03iF18Bz9 YMDyGqtGgKtczxmXHVlqWEyHy3GQHoFRVFutOJ6qCph65fixuq+hCyCl4WCyCZVLi9X7xNQSdYze1 PuWOP6iyhAHpb/oWnl6Dc23oeLv5k8jfvBHAI2Oo7OC8Sb4w3ub6g186XG0jpC59+GC29bMoziynw 1wnb1CwCrPV88HKTkhtQkKuax36ef/Qn3dkOMdHhJOiH1SD7ORBdFALI735K+sek6R6+Dq8ezi16x Kdi/yDhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJF9r-0000000GqfT-2gIi; Thu, 05 Dec 2024 16:56:55 +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 1tJEwx-0000000Gn8c-3EQM for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:38 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id BF6CDA40FC4; Thu, 5 Dec 2024 16:41:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id EB615C4CEFF; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417013; bh=zUEz2ANM1tWrM6cItHLJ+CI7tAh+sUssEFYL0gzJjUo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=S3Se5s91KmNBupBt6GTjHQmRqPzstj5nC9S5/XWgmfPtT5ZeWqNK1RcdBcusahgm9 9mHYS8rbL2TTD/yPWbvFFPwCWTX+YSsblS/cIJezPOjGxr7sMIfAk+qsDwQhMcef9f nojh+3QfBJy9yr/wg/zDn2mGSdNE92osS4yGb01fT/Q+bruJzO0BjDAbGf0yiH30kZ HaVZDmdJdjf2tFbyOoAD6Bmb+9phh96SSNyTNKTDT6cB76ZGvGvujRNRhzjXuhwNBe Jhlky9PIW9SPVqfRwlQNl0OCOTmH9E0+VufvvSHLOhKEDIPjFOwF8dN4FoV9g0EjTE 2CANKPn1+Q6Zw== 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 D4AD2E7716E; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:08 +0100 Subject: [PATCH net-next v8 11/15] net: xgene_enet: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-11-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=1191; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=yT5e9PnijROcL6qGdZBMgaJx1+AeFQufN+me46lPuTM=; b=buC5c2GkYhQ/NsyQePazI8hBsK8E3aHOL9F+ZxsQbkzw8cI6D6S6tQJOI9vbMfYOi13+7YJjR ZAG+pz3zR00DO4Le1o6AMqEhmjBhUx127NpkLAsBkBoG+9HltoNpzeA 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-20241205_084335_982704_744BAAE9 X-CRM114-Status: GOOD ( 11.33 ) 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 Thu Dec 5 16:43:09 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: 13895813 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 D941BE77170 for ; Thu, 5 Dec 2024 16:59:09 +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=eIM+lAC1Zuqy1eKGY2JixSG2zM 1ZkL+our8Ap+zM86NXV9nQXpcYfBCEVQP8a+MPKqz05VkmMeyKurpVQr1PLNgDqWMEPf5n5CztAii p7oE+69WcG/+PM698dO0pX53O8mubGESjWNSswOtSk5zhHSWz7K0CRCi/f4eqDmjSBxBhrCQ51zyT C34ArpWURuhPHyZvpCwY4PIAM74CTv+r2rPgzOvlaTEctjp41ngkdLVLWxm9vVXDG6OpPXtQhh4iT pZ27TIMJJE4rH93P1LmJ9asxzlYgxXWt5yTf9sy+KtrJypFXKkNKQYy8QtBx3WhnZ7OGEwt5pfPbl Ow4Hh7BA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJFBq-0000000GqzF-3QPb; Thu, 05 Dec 2024 16:58:58 +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 1tJEwy-0000000Gn9D-0M0j for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:38 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id DA33AA43EA1; Thu, 5 Dec 2024 16:41:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 074BEC2BC87; Thu, 5 Dec 2024 16:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417013; bh=F4cbjF/9M6ITcKCkPhkzEDR5HNiIhwkdl+T79A6mE8Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=c+lbWT6Oa4H/YFUBLUZZ73QB0R/r52M4UnCMLipwl7hhRT+ZRlPLeYcRNXN76h4cZ yUPEnCXRuvhu8/nprMzTS4II93q8OrYvpOkXM2nKw5+71bjlaVzkoZpG7+3KE8k6A8 qFmRpY66r52IH0am2B7owZbfIUaqRR7kPBtRzNo4csmA6OOT8KUV5xJA7KVP+vF7MF WClFxw2icgePxfeudSrX/CndOnlt8pQkjFWxiWKUzPPgYzLjbp+sd1H2a7jQgSxdHV 54QzBdDGezzwj2iELw9TCRKen6Mml9aS8u2pj9qdC2ggMPoKt2Nb2xq1mLJMnSWRtl oxG9p0kmJjazQ== 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 E9A28E77170; Thu, 5 Dec 2024 16:43:32 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:09 +0100 Subject: [PATCH net-next v8 12/15] net: dwmac-sti: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-12-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=2017; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=E3dKlyRUyP013sEwa3YoW1YOIguttVezMK0ReGNP/J8=; b=sImS8PQ8VKMkuX+28+APct5ZXL/fCvsFyTBpL9QI8EO0wYStDjTL+0OSV2nnDekqX3NaRa9Ca lgmEBJRysEYBX95Gi3uwsyc8i1dZmTbX7aXmRyQRJZ/vbxWr8wf2UNG 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-20241205_084336_260483_2EF4F192 X-CRM114-Status: GOOD ( 13.87 ) 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 Thu Dec 5 16:43:10 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: 13895815 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 29A14E77170 for ; Thu, 5 Dec 2024 17:01:16 +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=HQJnilLzC1LB8RiLzornbeQyri 2ZGqG56fIxo0UV9ZinWURKwPMp7FjhQdz3Odn4BxSE89kmIhQXQ/7Y6n0OeeKsrwZy2u5kk4QL3/7 mwzaiZi5kvWyRFWq6BASiViSa/0YocvkZ3obV5ftZIBKcjuq6q4f8nPeu10ZYUVIYcKMUuuLPTyvX 1i8FcLOXzAOVvZAGtiOFIWFz7t+ct6xfIIsq6kCxZh+DxJf0jxJX8MBBsjbFIUwLnpZp6t4QwYXBh SNTZYAO++rO+TuzYE16hQwUTMYQuEpq9YRSx0gHKTKScTumHfmcQ5Nh8w6M1J6svKq02w2HbF7Kbt epTmcUkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJFDq-0000000GrMK-0fEp; Thu, 05 Dec 2024 17:01:02 +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 1tJEwx-0000000Gn9B-3uil for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:39 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4D3215C6BFF; Thu, 5 Dec 2024 16:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 2B665C4AF64; Thu, 5 Dec 2024 16:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417013; bh=hRTYBgd5aMrqxBD9zYQNvdPGPWcLGVS6g40811SQlp8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=aVeP6mdXCNn292kteUDrYdf1yfvZFaTpbm4g7pxBnLfCLgP1o58t+awWSGq1i04tH mEgQ0XOdiJbmQ0ehBmOrzYMxuyRgukyNZSpkGViMWaFf2kHmUVyBgT9+L6VcVfh3WH q3QXfVZjEz6LOYQGCunwPF/0J6T8OSqMOgTetzlbFKcJggw2BknBu2l2VsXCqtcMo1 48prGCdlvYYMG8T4Icp0gIC/IwqnJ3PQ8UiswekPi2QPSSv24O/sHq7um/uoXUeoAV aTRBStwBezi+AvqZsgOSQn/Ov0rdeRxt4J8qa/VOvtyKJR03w5EIwvJ7Ko6RlMOcwA YHQPVbE0GaVog== 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 11F24E7716D; Thu, 5 Dec 2024 16:43:33 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:10 +0100 Subject: [PATCH net-next v8 13/15] dt-bindings: net: Add DT bindings for DWMAC on NXP S32G/R SoCs MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-13-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=4096; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=HHjvFK+MHmQc/THlQijGySkp22UNi4Qf+z7YD0xfSdU=; b=F6PbHPEfkdJBXld6Aef064uiC+FFrYJk8IuaodDsSLA0Ew54pX44H2unpaE1B5CkdAWwOlLDS s1hqDsqvLC7BL9axrTDnAhjnUK0mc8CIF6ZutaRSUMsc8QrsKtc3CW+ 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-20241205_084336_073542_5923FDA4 X-CRM114-Status: GOOD ( 14.61 ) 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 Thu Dec 5 16:43:11 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: 13895810 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 1B378E77178 for ; Thu, 5 Dec 2024 16:58:08 +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=2MCnZe34EtubHpzrneOEwrl1G0eWOK3s5lQ6WYRYYp8=; b=TmcsMUPG25tjAAZiGXQAB3KVyo cd+IMuIUjNsh+jk51AOmq5NiBUwjhzzBlsIeuo2OyyFPsntmegZBE+EGvAuBmkPFxnE7LFgqq3CST LQ35MRXPAZgtUCEjR506o/W53OopcRO61ofgphlfgp0uFCZn7wZGlNQgqFw7yhVu5Z5nYai7td+y2 ToK5BfBs5SoCrrHrGcN0I8lcYJwEYvu95jtsJpKJfkdEKj0Os3cTPeISld+dcRUYPfNnu/D75zrmf IbRixeiAQjbWx3WMmmQQ5e4MIlJVPOeWasDMc82vuQ0D11o/81GMO3gLDgdhM/PMC9rexmIF0Pqvs tGY9Pwrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJFAr-0000000GqlZ-0u3g; Thu, 05 Dec 2024 16:57:57 +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 1tJEwx-0000000Gn8e-3B0q for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:38 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2F8085C6B8F; Thu, 5 Dec 2024 16:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 3C844C2BCAF; Thu, 5 Dec 2024 16:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417013; bh=CVwfivX9Uoq8NW5yyYwUfH3ih4XNtxHdoR6gSNW6mVc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=QkJEa3SXMX9I46KupgMfdwl3/sKCOCIXL6J/O8orMYJGanieHb0LvzAFPlLfcHXfw EevdqDawNwYayMYzQnhb9o7k3KRaCtWCJfyCSYfuz094OfmqHEjiijs1lPPBe3nAzx TEHNN47WieMXCL4efoPFGXI2AqGapim+zO3Hj0TYchXdZObIz0fyZju6cmiWDFddD8 doRtD5M2NbK3Q4wmlrPJcGpyCY+AxPJUUNWY8yh3iD/j8QiEFmW6xyxhBnTYYA4+2t r6wxtBFuTVWrz8x2tG5I0MrwJpucYqvSbz+PHPPw87cn0xZq1oVRANdxnrkQmT++pq BRQeg8g+rjpug== 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 2F547E77178; Thu, 5 Dec 2024 16:43:33 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:11 +0100 Subject: [PATCH net-next v8 14/15] net: stmmac: dwmac-s32: add basic NXP S32G/S32R glue driver MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-14-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=7585; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=D7duZN/WctLYyRUUnIZQfArfNj1uNxuP0Pm+u+Oln5c=; b=52oMys99dOfuJkPG8QBHZJT/kZXM5UX2dJoO6SOwm7agHVISqJWq6dJr21tjfNxmVikfaJ3px BTOtzpNOIAuDbUcE37vYpXVWY89TwsZd3ffRfWX1GYv8j3BvLrueJll 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-20241205_084335_954061_4B4D7964 X-CRM114-Status: GOOD ( 23.17 ) 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 | 202 ++++++++++++++++++++++++ 3 files changed, 215 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..9cc0e5817416 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c @@ -0,0 +1,202 @@ +// 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_INTF_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; + + /* Set initial TX interface clock */ + ret = clk_prepare_enable(gmac->tx_clk); + if (ret) { + dev_err(&pdev->dev, "Can't enable tx clock\n"); + return ret; + } + ret = clk_set_rate(gmac->tx_clk, GMAC_INTF_RATE_125M); + if (ret) { + dev_err(&pdev->dev, "Can't set tx clock\n"); + goto err_tx_disable; + } + + /* Set initial RX interface clock */ + ret = clk_prepare_enable(gmac->rx_clk); + if (ret) { + dev_err(&pdev->dev, "Can't enable rx clock\n"); + goto err_tx_disable; + } + ret = clk_set_rate(gmac->rx_clk, GMAC_INTF_RATE_125M); + if (ret) { + dev_err(&pdev->dev, "Can't set rx clock\n"); + goto err_txrx_disable; + } + + /* Set interface mode */ + ret = s32_gmac_write_phy_intf_select(gmac); + if (ret) { + dev_err(&pdev->dev, "Can't set PHY interface mode\n"); + goto err_txrx_disable; + } + + return 0; + +err_txrx_disable: + clk_disable_unprepare(gmac->rx_clk); +err_tx_disable: + clk_disable_unprepare(gmac->tx_clk); + return ret; +} + +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 Thu Dec 5 16:43:12 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: 13895814 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 7D4B6E77170 for ; Thu, 5 Dec 2024 17:00:15 +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=ClO+u/E1iOslagKp4CMnvIXAGK XoPK3fm+Sng4f+Ar5T6FWwz7O0ab2rw3384nr3J0wnDeFCMJT4c3r0ph/YU7PAq0c4vx0pLYoditG ktz6n7P9r5tlCljkwbkKPH+tixByDK0zRwVHXjhnmVEjJBNFaYIHk5VYPVWCEAqaK+jL0msh78Eog 5FSu8Ia3SEzCDftwvXhNd+IM/OPqmk7b9L7DREgi1rcgJfUjhoIqT8K6XvOqPF42nlcuTrHSjaHLS VHLmw8YNPj2UJUQb/2jSvvoK2T9y3HrP66tfH7613LIQvn7HYJU6tUjKKBea3YHW2Jathm2/UbTXd WlP7s6Cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJFCq-0000000GrCa-2JV0; Thu, 05 Dec 2024 17:00:00 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJEwy-0000000GnA5-1YnB for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 16:43:39 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 89A655C6C7D; Thu, 5 Dec 2024 16:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 6E963C4AF48; Thu, 5 Dec 2024 16:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733417013; bh=Xx7A78Az9LY483yNlpcxh1fnnI6+OBafjR3+xqpR+KQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=QM9nY57spjMtkErm9STVuknbjej5xOtwsM6kKdJzICAddxEHoQv7KCTSfafSlohpd XT9CCCws4128i/lxPltoesA2VJf4+nvPsoZPP7nUxf18caKoVvcnEU0TmqqF1sdWXm O/LMprrwTXBZOFJJND4ViMuMxiZMMA5F6wCYmxR64GGOpMURRRhnsYFcWekPWiPsVU fzX29jkRiAYd60lPSQW1GE+kji4j+7S0+n59TEPHVqL7EnPS1l1/EqimGTkWDDV5/k Z5eYAFgPEsCddOTtLnHO/L/E7sFR24QZ16+Q9iIs1ERD890RRn9V+Db1GuNcts4mM8 8DcszR1Nq9WpA== 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 4439FE7716E; Thu, 5 Dec 2024 16:43:33 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Thu, 05 Dec 2024 17:43:12 +0100 Subject: [PATCH net-next v8 15/15] MAINTAINERS: Add Jan Petrous as the NXP S32G/R DWMAC driver maintainer MIME-Version: 1.0 Message-Id: <20241205-upstream_s32cc_gmac-v8-15-ec1d180df815@oss.nxp.com> References: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@oss.nxp.com> In-Reply-To: <20241205-upstream_s32cc_gmac-v8-0-ec1d180df815@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=1733417009; l=915; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=4615b800g/SFqCBNWwu3wPncyuWc4LNL3Kg9996VRhc=; b=iHjYCpZqYkAdGGNf2htSefhxuLA/jKkUAXsRqww6ZbewlC5g8kGDDaN0TU2iO62ILZ6IAuiXq Plw2w4PtKPNDG1jKxr+Xdc6LD6uLrMSCe4nP6yfBi7ir9R0QLkDMmMb 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-20241205_084336_534089_5A15C53E X-CRM114-Status: UNSURE ( 9.40 ) 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)