From patchwork Sun Oct 13 21:27:36 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: 13834043 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 8D2F2CF2591 for ; Sun, 13 Oct 2024 21:31: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=6IV6BmTJM4GcJ7vPiNoUkLwo1hoeksQbZ8iCfmB+mcY=; b=IZN9o6vayCbNRaYDOePx84gzJM QwPjTyfnFXABWer2ZJzasi1U1YoEOhTguT2JsM1/fxfDeICX+0rt+gCih59Yy4RKEW4mkoKoASPd/ 9cn/2mjJjEi6mX4iOtz4RHzoudCMvQwbTnZOGL/fiRSwttgpJ9GXDUiOTOC5q6GGSYG0AHkAJF8jb eNYPXDO8uA/SanSL05AjRZnTZWr937jNCDEecGUebuEHtegjfu1T4ZOoplH5t/5mqCY3NH3sBekaU T2S2bZoY4uNka/VS66zYYDMK4vi9NqehSiutWAw5qZg98gu64+F9WnBAtyWJABxhXPoKpYgbodE9E SVn70qWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06Au-00000003GYY-2VsQ; Sun, 13 Oct 2024 21:30:52 +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 1t0687-00000003Fpx-30bd for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1CB1C5C581C; Sun, 13 Oct 2024 21:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 9737EC4CECF; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854877; bh=RgbIdJN+VqFXRLRSWXCj5mbLS8wmvR17QJqbojTIhQw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=XsRx9qbDbrJE9mHjmA9Ol/v/7VTsFvYuL1noSJnUsC3Xoj32Bd21EpVHNXAJrBl/Q A5kMXpcxI2k8btTnomFbIYAUNXuEh14QsJJBCH2gLkcc/OEWcT+LBcZbPdcxOHKuHn w4BYtl6qSIqNVA5lRJd+S9RFiV8yY0GMVbDf/vepY60a5UXlF3kYDEiHTOGiQxoESp 2V+UFoV++niuICNszd5nopKh8ipzT+yQVFRDEJGlQsxbjSIKEaUJBJxn0SDJJs8WhE rhHIabYT/Ee9bgOLvE3oqzr3WvU+Bjbmw2sQbZIALTKhTnjbjie4J9Dqj0L331mKLv UXK57ys30WR7g== 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 84F95CF258D; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:36 +0200 Subject: [PATCH v3 01/16] net: driver: stmmac: Fix CSR divider comment MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-1-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" , Jacob Keller X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=957; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=8n8ej/rHu52TTToCJhA4ikVpR3Q+lsQuV+aNubhE0Rc=; b=MoZImcR0uKl3vpz4ak+fge//EmVq/0vEY6/rQyYOpdrp7HfBXPvM+Vdj5fKEpcoX3Pp2XKY+p UwwUd59fwp8CvO8VwdYccjnmzwUKajEOjeUqHRUckomYKb6wh0tD6na 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-20241013_142759_882567_6C9CB4B3 X-CRM114-Status: GOOD ( 11.62 ) 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 describe 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 --- 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 Sun Oct 13 21:27:37 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: 13834044 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 A2ADCCF2591 for ; Sun, 13 Oct 2024 21:32:25 +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=OxcocJsDwtCeMOlIzk97pymOXb4OVdbI51If4rUVYM0=; b=XT7O5i8d3KPo6McqtRqfOAM6rF 95AFMm4oZLPiNYcXXS34xU3nzKvpBt1eLxMeIVfYEDGMpcrv1VIb/Ar95E0rGXksG0lrfkFSHUvXY uoJmDzQ3Z3IckORCaD071ujRiYq/bw7ztptNKLBU88om4wLSucXBP5on1D+GeKqRj5TGA3B52XvK2 kw6tPTfuR/vbTrsmjmSyge/7IvDhkab5dW2ZPY0PNLeCh5aHkEIEBUxVwA+ax8ZTNpI0KoFcWa/D8 tfkVlNK92mZFr7B13/UGqyVuhlHTjdxQ0zS/69O1M+h0Y5Av37RvMubKKtXl8p3z+A7Ipgg/4ud2N 25L5JBmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06CG-00000003GrL-2w8t; Sun, 13 Oct 2024 21:32:16 +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 1t0688-00000003FqK-1G5H for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4AF4C5C5826; Sun, 13 Oct 2024 21:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id A7138C4CECE; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854877; bh=/HY98JCmDq6A/RzqUc/7qBJZ10w18XtngjjYcjamv2s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=S2TabdmwyViGKcMHAOUwHupwXWy+07zeJvTGFu3XNFnQ8/j2rjgBGR7kZnRahJUkV 8xVME3YJA+9/5PI8Fnf+/9cAW0uPA4CfKXJOTOtIJM7iVYqs4KN4SyBMQQs2RGr5DJ QcQ7HQ+AMuurrmqanxF+N1pLWvUkmT5Ydl4IAk7NkraftG1RIhQsezk8+Hx5lbSJHX HRbbYVFcneFfFRieN+dg3KSzOOti9ix84Hv4LRLYM525V8FKL+RYZy2DIVo4KRUaJ4 ja3PZDeSyKL5nNrLbBZDQ/JS6L1KbSo1au/vWU51BkavSw+9GFSp/LdM3IkRInI1Rz zvclXlpMswaLg== 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 956ABCF2592; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:37 +0200 Subject: [PATCH v3 02/16] net: driver: stmmac: Extend CSR calc support MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-2-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" , Jacob Keller X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=2225; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=KCikXBvga2oq/pWon5eW8eJjp8QFlxmOB2nCnbje1+E=; b=+YUV3HwYa33bDd0l9Tj0KRKbV7MkAazvOJPlZtfbV33B893gCIrnZGaVF9u0mM9kOWUapUVlV No69rq3b4L6BzoQbMZuIHD29blNMsHqO3H1mZSDMy6tAPrONwkqeAfG 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-20241013_142800_493221_B4A950B9 X-CRM114-Status: GOOD ( 11.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)" Add support for CSR clock range up to 800 MHz. Signed-off-by: Jan Petrous (OSS) Reviewed-by: Jacob Keller --- drivers/net/ethernet/stmicro/stmmac/common.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++ include/linux/stmmac.h | 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 684489156dce..e364cf99d1ff 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 d3895d7eecfc..f9cab62cfde9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -324,6 +324,10 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) priv->clk_csr = STMMAC_CSR_150_250M; else if ((clk_rate >= CSR_F_250M) && (clk_rate <= CSR_F_300M)) priv->clk_csr = STMMAC_CSR_250_300M; + else if ((clk_rate >= CSR_F_300M) && (clk_rate < CSR_F_500M)) + priv->clk_csr = STMMAC_CSR_300_500M; + else if ((clk_rate >= CSR_F_500M) && (clk_rate < CSR_F_800M)) + priv->clk_csr = STMMAC_CSR_500_800M; } if (priv->plat->flags & STMMAC_FLAG_HAS_SUN8I) { diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 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 Sun Oct 13 21:27:38 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: 13834049 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 EED68CF258E for ; Sun, 13 Oct 2024 21:39:31 +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=Xd98uJV5RtJYGEkEC5W0BLsMjcnIsJmhWXzsaqrKC0Q=; b=zY8V5Ir4lyJe/XhiDX/Bl1S0eF vmTj8riwcBDV/jjHjhHYsX4KoBXxU1GPUO3XJHmw8nF36Hpl7JYG0rXyAHBs5EdnyHo1MUTbgsvUP m2ISS4mKwGH2v46ayDa6cMXSC3bbGtg3I6UD+MGFhDOpFl1G5zAImUrPk+beDJcBzzRgjPz+awjEZ tHWXyUjLlGWtXhMJsl2OnpmScry+tl6Aqj03S6iNXtDv1fpArndSBx/fHvoveU8do1gTcB78ARu4g 4OjxL/tEMu+ktKE8SQE0mFNuU3vee/QF/yaIeABO8nxBE0D2Se3xXjwVsKVfbMXZIV2o1UC6D6Q1k huPoAHww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06J6-00000003HxM-3Eh1; Sun, 13 Oct 2024 21:39:20 +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 1t0689-00000003Fqm-0xz0 for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:05 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 873FE5C5847; Sun, 13 Oct 2024 21:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id B5F45C4CED4; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854877; bh=OjTehc/SjYSJ6s+SGBVf5yG2y+QV0nJLwhhFg/WQymk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=p5bQZuSbrNAQsbQCXgFONqwC3pWiUInNOc6I0BK394gB7gxUErhieX7Nmu2+euNVm EQeZdT8p90oLeX+0vB4FjBBjw0edo1ms6ZMFkfsJeKj2gaX3fCWZk4bid15eS/VsIW 8bhMCJQRLWRe0/mO413UGnjqj3o+r/TgcNK4SkUH1vJyQnZuiPX2HIgwDbDvnstrxz eGqCY7REuwTlThpTNNe+McIPn9FFv/2X88imQ9TkRriw6736ETLGriJs97M8/JLMZ5 hb+fhT2RknYV1exlDGco3ktCV8SGBDp9+XYKI1ltO2lMqsKV3H4FIkV9jN62jxqfLb fbc/GUitjtnow== 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 AC31ACF2591; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:38 +0200 Subject: [PATCH v3 03/16] net: stmmac: Fix clock rate variables size MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-3-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" , Serge Semin X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=4015; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=rZtvgxdJs+uvFCspKOdVSbISr0XerCY0VS1ForZPWcc=; b=qGAdtifhY+adK80vHwqsEVOx202MRrqBh5WpmcYV0IkVWKznOLsSbId2cJxV1jKHUTTa4tLZj Y0KinVpiB/cAg9R4msHIXGf55De/5B5x9wzFZKCe9y7Bvxw/2wh2vmZ 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-20241013_142801_405892_C67C4DAC X-CRM114-Status: GOOD ( 13.42 ) 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. Signed-off-by: Jan Petrous (OSS) Reviewed-by: Andrew Lunn Reviewed-by: Serge Semin --- 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 a1858f083eef..a70bcd72f5ad 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -25,7 +25,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 f9cab62cfde9..dd155dd4903b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -300,7 +300,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 ad868e8d195d..b1e4df1a86a0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -639,7 +639,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 Sun Oct 13 21:27:39 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: 13834046 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 3E596CF2591 for ; Sun, 13 Oct 2024 21:35:19 +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=kc99NpErVh/UoK6y3rwLruNFeVsQQgdn3AmJmUJMbmU=; b=ftXBaCAbUhHRfc9HB0nWRmfZD6 HYV8aaFT3MOo4htGeGDs21KTiLF3JpwaeXYUnXoQ4AUPUYDQfB377ccyixqhhrZCS9LGLznWRQ4ym bqre9/oasRs06uMrC+ENbQ0YQd7k/5VyO9EGDe4WMf3XL9u6px/qf/Geth2OpEvrqsJ+u6HJnaxJv Ppo1vc5AAkE+vKkgNcxIVe2EBxtw2Y3kiLuu5zuSEXxdADDXHu49W9fSoOXcHb9ZkV4Pkfvgn8y62 yST8f9TEtdfreN3bsAnuqPon1Rf2XwSDfVESNo/moJZFHtQTXXZtKZbj8MKG93dzkZF0JatQSQxqk 3yA6S82A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06F2-00000003HUE-33pO; Sun, 13 Oct 2024 21:35:08 +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 1t0689-00000003FqU-021p for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:03 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6818A5C583A; Sun, 13 Oct 2024 21:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id C6994C4CED7; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854877; bh=Wjx/+DPDuCDJsKobMzavDna+uVZd2lzCV/OOFYYHJFg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=tLkxWBVumkpwGqjS8BsRDIpzK7R4Ds8pYNgzXlkS/hryGvcUC+PKdEY3llXmt2w28 fL2z99X+c7XPUpQlovPQVn3EofcwQ0ZDI7W2PJzI7DqUOmU6pGm1Q4ve8wiFkWDWgJ H525mtkIUj3hbdHKjOv4AIj/9c9iHTziz6FHqL1ksUP5Cpm8GteGZ+nt/Aup+Y9mPp +ErsOWEoNQ6lmRe4OHLNKAd8Bc2fzA+yWw11SZisVK/ZQmmXvtHRtNX4uXe8v+taPW eppdNHvOsX3qaaY3b5GLCMOTBobMeEQgBqQLeMyPjLonEIqOTCmW/9mRESUHlZ4R8+ AmZ8SIXh0+3/w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC2C2CF258E; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:39 +0200 Subject: [PATCH v3 04/16] net: phy: Add helper for mapping RGMII link speed to clock rate MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-4-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" , "Russell King (Oracle)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=2138; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=DaDkzUPthYLXEW32SreKBO3MyQ9lanZalBFxpDCNQzE=; b=bo+RPMH3Mt3S1/zUl8ym396kld4wUMRFbTsLm5IgKWk0eKbfyTYScNWSGecqm9ZQqMjJk8ZEp qtga7k6oZDxDG2MG5OuboP6Z/O5hDkbWtDc3kFxhksvVJCx7PNcKAvX 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-20241013_142801_302949_0FC5FDC8 X-CRM114-Status: GOOD ( 18.74 ) 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 helper rgmii_clock() implemented Russel's hint during stmmac glue driver review: > We seem to have multiple cases of very similar logic in lots of stmmac > platform drivers, and I think it's about time we said no more to this. > So, what I think we should do is as follows: > > add the following helper - either in stmmac, or more generically > (phylib? - in which case its name will need changing.) > > static long stmmac_get_rgmii_clock(int speed) > { > switch (speed) { > case SPEED_10: > return 2500000; > > case SPEED_100: > return 25000000; > > case SPEED_1000: > return 125000000; > > default: > return -ENVAL; > } > } > > Then, this can become: > > long tx_clk_rate; > > ... > > tx_clk_rate = stmmac_get_rgmii_clock(speed); > if (tx_clk_rate < 0) { > dev_err(gmac->dev, "Unsupported/Invalid speed: %d\n", speed); > return; > } > > ret = clk_set_rate(gmac->tx_clk, tx_clk_rate); Suggested-by: Russell King (Oracle) Signed-off-by: Jan Petrous (OSS) Reviewed-by: Andrew Lunn --- include/linux/phy.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/linux/phy.h b/include/linux/phy.h index a98bc91a0cde..7f6d9e7533ce 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -298,6 +298,27 @@ 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. + */ +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 Sun Oct 13 21:27:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834053 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 B1FEECF2591 for ; Sun, 13 Oct 2024 21:45:14 +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=LWQav5ZF2hpRlt1ag5OdZIRr0TgFXcqeSyAEu0LVUHQ=; b=x8gAr1KCWAPv2jpNn/drn5cj+A 4JF1/nN7YMWIrfGuQ+VvYGQX/E4WdMZ7lmed6VzHp3p8QHfiHBcdxwPY26NujyE+KurNdrZCGsJ7G 11cBt7r82UJHW/w/qn50CyS4FP4Uf+swGkLgmWOgjsE23nXGSe3JuPrLkjFcVqDdvtnFWiDLsLeKS pWuF8mTXKlBOf3MtNzjoJA3Y9HiWDZZL7CTM++grSAyt/boNZHUQDqP0SZoCskcoLNgt+bojSLtbb fQiHGHfGWwRpUFjduegfxggi6JelWRxM/gBDRWjxrLOCgv9Etoze/GHyKJh4g7K8FPPopXpTR3FXy r0vmulKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06Oc-00000003ImZ-0w7K; Sun, 13 Oct 2024 21:45: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 1t068A-00000003FsD-0ikF for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AC02E5C5858; Sun, 13 Oct 2024 21:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id DC55CC4AF10; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854877; bh=EWJy9JeMXDqa/WW/41klR6vUHcsaJ/6zfX1ZyvWYcR8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=MJrbWkN6WvKGakhIwLQh5JDj7SkTTZXA2KKbSiZwJYnttgBUCBX/cVnRDqqMJYXoU zFWJ9aZN2hg2OEGWV+5WR7gKnkCLSECXheEDWlc7nbHqfoph2j4WqQLTe7mh+ypKV5 mUEpIndEb8OgV9WlDDWXIt32X0uHXyOfY3ECgyKsR30SOIRLZuSNwQrJZrwGNsvyP0 PSODiKKOfoTXytsFYCFbq9JuSxD1r2lIgEkf36ETX3w3ZcQ2fwSXGu7n17hb4i1QLK 108kOOK1+j1lq/nF/oxBsGvULZ8ZnO3Sf/dvGEyTzJRaLEZnzFJHXshoh2kfCHLENe K8c6YlMs1XZkA== 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 CCFB8CF2597; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:40 +0200 Subject: [PATCH v3 05/16] net: dwmac-dwc-qos-eth: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-5-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=1141; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=eQYl++pRYyUt/vpL0dW1HQTxgdYHPHBLmMCUh0kqWZs=; b=VtQ42Zrg7arl8w27JhC5tgzEYRnl0i1EUl8uEo2MfpalG/kxoNvP264eOmI68/QW8sMdvc04o P7JUxYyXve1BICndRSEa70tSnAJiJ3qRr8+NWOoQQqkgNW6ZF/AwMjR 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-20241013_142802_415933_793CA2AA X-CRM114-Status: GOOD ( 10.19 ) 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)" ??? 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 ec924c6c76c6..5080891c33e0 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; + long rate = 125000000; bool needs_calibration = false; 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 Sun Oct 13 21:27:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834045 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 4A3A4CF2591 for ; Sun, 13 Oct 2024 21:33:53 +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=qevU59xec9215+CoKJyuAasjSetBn49dAloKMqBRQUs=; b=p/hYiRpQzJ3Ma73ltNsuW/5aT/ AjtmIFsmjKDp2c504q/QeklshngIW93uTgTF59RPEalDh6GK2+QKlOL1luRNM86xeWhAjgxXn9loI BJPlE7xw81R9uR6Vwb5OSCt9S9JxndXyaQ4Gv+SO5YNKVtvNz8ToRwFvEDyabW3/tc8OS95uFf0RE whi4Z/KJ8zaHnQ0ZYMLoa3yCzLP5sR4DPczvTESe/UpgT67ELnPb3UCds8QOMuR1UEfQI77qwXRBB RFXxnByZOVVBRAnSIYWc+Za51AOiUxASYaAqg5t/jptxzGyiyZuytUys3IwA7fzEgL8+FJQMEWQmo EkQImO9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06Dd-00000003HDg-3ysa; Sun, 13 Oct 2024 21:33: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 1t0688-00000003FqL-3oNn for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:03 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 5A0D2A40F41; Sun, 13 Oct 2024 21:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 05D65C4CEE7; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=6KR9QSnbXLm2GTDkACRfu+5qiFlgpj//6xqn/yBtEI4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jnItob+jASN4OrTiMjjhjs9ApsWpN2QHxMxepXdUaU8oirqDIN2CTF2RnPS2h7t+K QvmIZax/0KLZgS/waf7yjA0toaDM7XLfun7XIRh6iouG8oo5nMlpQhNqNX065jctZn iv3oRzumTxG5BsA9yDX8gKFMWJc02nexb2s1+ZhH96k2xH6QYokiPOtPk7eRNdH1zI aMb/kgCJxXEfrpTxMgyyzl5jLeVdz8LHD3MgfXVW2lWYEEN82y627RNJdCfJY/Z6oZ 9+ZLKBmmAhQoxUC3O28/6mVZVtpRRcp2Mg98ze03klo6Z8JcNG9cS7Mq60Ziq1q9w7 zP/+g3sgmEtcA== 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 F1D2FCF258E; Sun, 13 Oct 2024 21:27:57 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:41 +0200 Subject: [PATCH v3 06/16] net: dwmac-imx: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-6-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=1227; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=r7RutcUnxm0xpJTwTRGxuCqWEhIZXnw4U3walnTYgvc=; b=aqB/nasOFm2hoNvJeGXa3owAVkdH7zEZnJCzQF/ipJHUEIBDDEqLG3E3u58fa1n92s0X0TW+R c/A8R8y4IXWBic+tADk52VSjA8g4YPmWIoS8zyAdBe0YwFkw+VI8oN+ 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-20241013_142801_117853_ABD290B8 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)" ??? 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 6b65420e11b5..4147b56d40e1 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 Sun Oct 13 21:27:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834047 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 53E81CF258E for ; Sun, 13 Oct 2024 21:36:46 +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=3i1OzwX6JxCiHXn9Yu1vOvfNiqxaeVvguMRfugYSze0=; b=UMkYmgKzzQPAw+0VzK7DBU5ZAU Q3Kd95zyJmapIo5Sr8zByLMqA0dBeS3Hw42MHSmn/CCgsEEKRWYeluglbm+tALpNAXmU50/5aL90f eX+Y/OlIROuAl3x41wh3cY80cGK/pmeMY87Gqsja3OmSZDgqn4ucKoZTAbBQANnHyCl6geJEgXcbH MR8JwVnzR+b8oGfBHZpKdvc149D/TfAmgAw7HsaLMkMr4MMgsSxsz2cgmNmwSNreqPJK4TtjQpACs tPKW/JKGuHmsV1cf6w8fIUjNGQa61U+2i6aCCse9BQcnDrX1pIX6q3xlG+afCKQUZ+GH9CgyWNOhR FdOwmqUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06GQ-00000003Hgn-0AaC; Sun, 13 Oct 2024 21:36:34 +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 1t0689-00000003Fqj-11V4 for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 47F6CA40F37; Sun, 13 Oct 2024 21:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 19FEDC4CEEA; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=gPcFG++PfQ700K6FAhCjWfJv6833nh6JA9KmdTuCp/g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=dzrPl/9oTuhMbJrNUMZFqvpquM9Jwh0uRIIulQBb3WJPmPcL7LRUMpqNcuIXpvWA9 tkTIBkylGPLPyN1/GiOn7LE/qav0UMOapE61XahPzfp5yq/DHw0oboCZdBrNRfCUW+ 7RZ+rrY4zFq+WnXGcA6hxm52zmwZLsQSL+hCqHUrMGpOFpx/x0WXTwmqY0juEGQDGZ bg/srsf/59UjzIGHlOw3V1tg7AjczvI8hjpaVl2hflvsEpY9ARtL4rbr+kep7Bw9nc kb1GKdjX+pry1Udl5uGrKaY5U1ZMjrrRFx3lLJdF2KulXaJk/zLAXXmqdAFYd5SlIF gxlEXf1j7C9bA== 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 0F8E4CF2592; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:42 +0200 Subject: [PATCH v3 07/16] net: dwmac-intel-plat: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-7-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=1143; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=/EHUcB38/Aogs/W9zvogEGYDlavHzuowMTsjNRYSvoI=; b=ug8gbgJY9NCTY0FNuHb79tOxqUtnpCBMmo/9nmCP4AnpZhm0/Q5t4NxQJoG7eutDr5jNON/WB 2RI0w/rDZ2jCQKWQb5u9jTno+Nn2QZ/nipAWhcn7UccQJsP+1EQS/lJ 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-20241013_142801_461064_8CF6BF9A X-CRM114-Status: GOOD ( 10.93 ) 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)" ??? Signed-off-by: Jan Petrous (OSS) --- .../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c index d68f0c4e7835..ec62ed90a47e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c @@ -31,27 +31,15 @@ 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 Sun Oct 13 21:27:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834048 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 EE5C1CF258E for ; Sun, 13 Oct 2024 21:38:05 +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=b1OwrvJh99rAYR0eSXv8TSnKokZ0sqVO/6iwuxozEYM=; b=tN9SbVurYqSsfwo49qfxlX1wtA 43qxc/86FJwoRhw+nfxb8XEzfw+V45eC/mEsE5u2z3IE0m9VeiVpadUoWySlvGRUPkVCwi7dlyIrM ABf4NFI5JUuyzx+XUpM8KGaGiN8bNJGa/h+7zfY2j+27MaG9ih8yvd8DfcJlYiQmUkjUiyPa2H3t5 0sBcE7g7K66JF/ct+qqs6v7CUYP8TbuPMCMfRwOS6uSFMlf8AX3W5G5f4KsLUP3+yskDT9VoL8YLb yC+/DD16WgJPErHPdE/KantTkdZ8KnuaIOQB1It5Huwx4uQls1cDjEUwJW1ngaMZHwtmspxK8dFQm yiuLp3Vw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06Hk-00000003HnD-30DO; Sun, 13 Oct 2024 21:37:56 +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 1t0689-00000003Fqn-1azh for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 730D6A40F22; Sun, 13 Oct 2024 21:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 2928CC4CEEE; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=zHRajnY9H8eN6PJGvRNKjSnuYQB2Ukcx8EeNRHoCbkk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jMEqTSIJRvLcJAaEQCu4UlIBFl8+tCe0SuKHhHxREv3n6G4ElTA4iUGgsFsUZrYP7 qNXtr98Qod0/yiOjY/BfCpdc8PhTcyXzANCiucsrQDPNLbjU6D4G8CGhvQ4H45KmJ3 Bb459oY2vmMS0XLIoQpZsn2Gn4feLzrJEJIhiGok69bASGHGhV1+2DBmp72h4ybSxu nxm3mT/VVX8EMmtH75Jkueu4qmujAVz0L5TA/pedq/iPN0IENUVHAJfmrfuAL+STJA dOKASIgcGFZmH6EcLZ2TrHsu+XfEEFrFIsVy3SeWcYfRk4vjZbUamE6Kz06atBKgVv ioeO54bLKCBgw== 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 20D87CF258D; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:43 +0200 Subject: [PATCH v3 08/16] net: dwmac-rk: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-8-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=1624; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=U6B9llxVwSxlc0p2LOF6M6zvdPnjMTTRfZwqZD1qOy4=; b=2UPBUVZmHJTPvpD1TJ5YdLKzbeaJCX5He7BjUTtN0eKRXqzc97ghHMI6k5ksb6MdTzu0AinR/ fr38i5oL3b4BxmW2bmPMrVz+ojAbXUPl67nMkyvCM6s2bJc8tyWyg34 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-20241013_142801_662790_D099B243 X-CRM114-Status: GOOD ( 11.04 ) 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)" ??? 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 50073bdade46..2fd650b3bc5c 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 Sun Oct 13 21:27:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834050 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 34D2BCF2591 for ; Sun, 13 Oct 2024 21:40: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=qavQC+pR16Zxu0kGC4/AJsHZlSkNZYRMRQELA7bvhtk=; b=DIomYWECClE/BslTvgB+JKVEKZ QGyCFpr917HzN5ji7zVIoII353hv1MBrwpDz2fhj79jexRZI3i4aQ/wB+jhXmoy/J8ztgSRrqn5i/ tI5ROt6znlxRw16ZRxqx5uKRUurNhvaYMminyuJda3YUrQma34RmueZFrlMHyjt3mVbeTnQr7Cs6X vKsll0vWkfzMWaX8NkBRhsR7q4Fhc0UWE++WsEFyQDfAIhspJOworLYr2F1qIncncKEMYWFWvErB7 53a+U1NV3i3NOowmi1dHR20HlYmZRinYy438REPK61rVbNMd4lUg2J6mgaYsjqp+fKOBXNBeFEmdt UDF3WTKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06KW-00000003I9P-0Xr4; Sun, 13 Oct 2024 21:40:48 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0689-00000003FqS-0Hee for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:05 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 602EBA40F44; Sun, 13 Oct 2024 21:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 3879AC4CEF1; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=Nn+g7eeRUbmuioaQ/PGNqFJ6Ggh6l4nHhAt5g4V3gMg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=cjEMFAiY7Ilnablxc1XnsahBC13AgXZcGgFq8RZLoZ4gDl0XgkDXXZVSkdNlAws3U 4sg72gY4L5PczgMuDrhy0orAioLUEnn+ntiBK/lsAM40agn7GBEY2ahfmDG2mjjoYP 1gjYdFxVs7hedeWk5zegTh0rh60rqz7fl5sGdgmybn4xdTtILM0faSrP5zD5+sf6nk wdUuumjt1rYV8KCElth6SD441pfGaiWq0o8/FpMULhXyFmcGN6S4/QDuMuUIEhxVrS xrYScGtWYKHSKAmb30AXG5KN/zfA20OSU+SKrcotQAaSYtZagJaKqZx5L/4uAtgQDK BO+GxOcej76cQ== 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 2E9D9CF2591; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:44 +0200 Subject: [PATCH v3 09/16] net: dwmac-starfive: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-9-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=1143; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=izAPXG5Zoogrdq15i39txVo0VJdx5W3UBGLtbZvPlic=; b=dWiupgAbQZP27LJq6sBgPF9PByHgqcK5ZAu9fXs+dfegW0+SH1JyL3mFhzPOblsb2pCIf/2Tj vlU/UQ34qo+AAeIRoWfzNnyaVAwUzMD0kfANP6BZ6i+X+bcK/nFiB2B 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-20241013_142801_283642_195E3000 X-CRM114-Status: GOOD ( 11.03 ) 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)" ??? 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 4e1076faee0c..d80461a721c1 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 Sun Oct 13 21:27:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834051 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 1141ACF2591 for ; Sun, 13 Oct 2024 21:42:21 +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=+Ohcgi7StZLl6vrQmBnJPvHNHPo73VJ2GsqSseXNM38=; b=tH3of0kOUHrMqpUk3bH8Vqef+J Jmasy1u6fxzI0Lw2bRjyPzx3wXBXVPqVnRgef+EFyu+V0+WS1yUnO7EImPXS+jZuL/HUm8IypbyVP x5EQ2YIWsMKzTzReTbv7KWPRBYwhoHLFemnWRqDvGH+Sf5Kq3e5YeXe75I123DK9Pz4HlexdaerC/ BCjPiwxQ9ySo3HHrkYzNn2WCgXsPxWB64NmOYIUuOOH3XPFxMSJW9wPGUq/acnGtEfjhMFGfsmCAG wRXbtmUb6r8t6w6tLd6C/sgP40L1oci7W12PmhvFkipEbtjbbN+lzFMyxFiqBjjCI56/E+tFpuq3n sYwWvs/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06Lr-00000003IFD-0LQd; Sun, 13 Oct 2024 21:42:11 +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 1t068A-00000003FsE-0jP6 for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0315F5C5870; Sun, 13 Oct 2024 21:27:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 56E2BC4CED1; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=diiek60onc/6zcNYoAIbOVHe0IJTqRiq3+4af/s32UU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Aj+ryfhfHhMdJe9WyUf7kzLfjUV5BhQVQxg47k6fnXPvRUaq7HeNCemC1UissVsH8 1yllz0pl+WRMGMl1l6DOVESi+RnAmnHt5IJirzn+JNVui62uxDxMgGTvcxKiJBHDv4 PypWhonBlp+cgBY9g+a8w2WXz7oFj1mw4BhZm40EVel6Uc793k7ILNgafXOtX2LyIt Zl5bqzi6agU7GiqU57uDjC4cVodE0hkfG+yCBbd3SNvbnuPEHPhHHecXcv/J1gFfTf hNMWCR3z57U9E8DQG6R7oiOyM2+W1YP/tM/CbjyH0WDEWpbeO7TUeHgG5ko8DA4pQB WcdvKfsYR7OWw== 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 4E74ECF258E; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:45 +0200 Subject: [PATCH v3 10/16] net: macb: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-10-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=912; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=PRjeRTjIE5v3Ge3tQ64rh8y1ujXV+WwyKhUMQqlMDjg=; b=XMjjpAcWr10q24b5yWEikm1ECcG0lB8+3Wtw+n2/TyoIkkavRyhwqpL9QSylIr/v7TcQNM8VB R/YE88B3tiYAN80kmsmhNwfgQjtVIiGZXg66lTUQJWXlW5GhsDlE7il 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-20241013_142802_410980_E7AA7952 X-CRM114-Status: UNSURE ( 9.63 ) 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)" ??? Signed-off-by: Jan Petrous (OSS) --- drivers/net/ethernet/cadence/macb_main.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index f06babec04a0..f1e481264511 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 Sun Oct 13 21:27:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834052 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 CDA6ECF2591 for ; Sun, 13 Oct 2024 21:43:45 +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=TO6blUYo9TYf6jrz5j4goFWBRS4SgHPe381SbZfifXk=; b=SL6CM/xep0l7ZFGP4r4DIOQSJI O7mbyBdCQR+eQAtRy5Al+XPYEx0UjEjIWEulIoL+mMb7cxkQTsekyyJ1sl6/PeU7S9hRxuIgJ4l59 adNo2UFHUW0eTuDAjA9E3kRCiecZtoPylskQr+GWGMl7CMIlRaPMaFzGNCTIsWng7aiKDPfLsqMBn mk6YY6GOnPjZotFwqZB3dlzl8Vu9aWAfL3As5mfGFbAQqjqimitKd3cnFXNoxH+VNSzM5+FtVpeZv GWA27NmqtwqA+rQeIe8JLGeNVaOiPMk5YNHI4vt8cL2eE4+0G5FX1UqFaDzVGafWguZlDYcWSsQST R2NG+CFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06NB-00000003IVd-400k; Sun, 13 Oct 2024 21:43:33 +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 1t068B-00000003Ft0-0ufX for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 156365C5879; Sun, 13 Oct 2024 21:27:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 71A53C4CEF9; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=DRbsWg6mtGg5289r3fCGYI0WcBuqo+O5QzBgVr1/WvQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=R+0/TgX7Us4RuqLu+ZyhjrRO7x/mDgxb3tv1JWjKg4ozLr6wY5nl1T0YB6A+JPcR6 d8um6lIyOjkr/jmjAmI/S1R1DmEcPUuC4tG4t1zO051LbmkSbqtpAZoOQQhEstCMB1 6JGXO9pNfiZ4+l1/zTJaBZqE1kE1upN0Xgk06drdwBP4xcstRuaJ6XNHNyDbH/ARar BJvIEsj8VYH7hPXbaoXQKWCF4eWyVMjnG+TmnMkrjJWMiG66DPAeiBrdzxXo+Nx6mI Q5/xF1iRUQRgQWvb7l9PUIWsXQwnXGtG38JT5lEdfEH1rG/NWS69u+1HEgVUxzAh9v W4DbQDG7F2Hrw== 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 66B79CF258D; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:46 +0200 Subject: [PATCH v3 11/16] net: xgene_enet: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-11-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=1042; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=DaBsxGLe+QPFfNqlL0firzZ6hvDDB4Cd5sKjF5BEVMA=; b=ozIF2GNrr53C8rxjd2XD5oEL3dafHpIOFC2v7R8d0/7LqNPr7ZJaJ+gnLubDPaEFkfHIfycmo 6rGVnFJiV6+AfvFAtXXCxbCYMqhx6R4Cd0lruHLZ5sMqJU94LfMVdjN 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-20241013_142803_504700_E884F461 X-CRM114-Status: GOOD ( 11.23 ) 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)" ??? 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 Sun Oct 13 21:27:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834058 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 E696FCF258E for ; Sun, 13 Oct 2024 21:52:06 +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=C8+df6E33+H/c0gF/a9eDwyRNV8j9zbu2Qya0Pbqzy8=; b=yCk84PaeC+i4cwTEbExAuJkAX3 yG3E9fMqhzsokKhU5UHGUGxVQC90WbJ0mj/4H2JaUzGFM1P8mgQgz8MmzELUOOL+9eg4zJqv7OZBj o4x8Dt68JYpK2A0o/e5odbS1JmlTeEeUoFEqpsRwc/YtPm4G/tteZW/LoX9zasLFxnkKEmbmVmq9r CvatgQQ3IIICEYgF05jLqCoP8TsV+3VchjD1sV4F5UysFKjrYTp4kDjrO+rU/IpHDupEU2EuNb49w 01xnqZxr7JMPK/6ZXRQfcuAeULBXLtIhcQ+gQxNj2XZSLFGMZWBhMI6boOk5KY0EWnT1QOxgUTMLA u0Xgs/GQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06VI-00000003JIb-2ewt; Sun, 13 Oct 2024 21:51:56 +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 1t0689-00000003Fr2-2vhu for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:09 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 9E118A40F52; Sun, 13 Oct 2024 21:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 85FEAC4CEFE; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=miuoZAxa8gH/3bOfvp1cMVTbaTxNFTSxZIfvFfwUPUM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=gpqDgtorCPHLTzB65xW4+ivkmoVlzkK71rhjOT+774g5oMj1gSxIRH6GEbqfNujWf 63FoJReOsZelpYbJYcuehpTf0Sx9tH5fMBKvR5MEN1zJL02E9MwGUVIwnw+czLiysR GTxtYPq+R5h3NhnkIJXxTLqblNjrTugsqg7ZbAA1ZlXtKoyC8GV9BqXMev4FDtA01G NzBUM8WP6pc6CvtzsKMH8NSuXzPgXOH8MDRR73ccyu8rfmQiuaWeHjY272kjS8TGP3 SUbNebZ4aEnvnNQIsH0oPKziewb1zD4WtXzr7TL+8HD2WceiQFw8qT2CdZ5wyGZpoD d+zyNHbVhu+Vw== 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 7B4E5CF2591; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:47 +0200 Subject: [PATCH v3 12/16] net: dwmac-sti: Use helper rgmii_clock MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-12-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=1868; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=JMTOl/4Rkgg8MzRxHwxEln56QmjXWHwbotmJcc4tZQA=; b=YhJIILVd9Eay9lSSnwFd64FJMwW3HOTjRBkTyLBmu9udYHtKm6H8zZSWkYwVISN+20AT+3McJ LyJfpw+HRj8BWnbs1e/dU/Jdsh+79q4Fyt735099z8GRUObyNjJiwOL 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-20241013_142802_041947_F01E0C86 X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: jan.petrous@oss.nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Jan Petrous (OSS)" ??? 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 4445cddc4cbe..0b02d079360d 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 Sun Oct 13 21:27:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834054 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 5D1FECF258E for ; Sun, 13 Oct 2024 21:46:34 +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=q8L5Leqk7BiN/JCpk+jk4FOO1IIAJv/1NZ1vlUV5hiw=; b=uL+vg9obuOUq6UHynOOc713ChN nfFmpeCr4eoEDe0VeA8MQfOHJd2I4YVfiD+e3kWNxhBnfPBUh+Yqiq66q7aBYLQ6D9y4yCT+GbOnp 5V/YeavBg9gcWWNG3xCYBkN+STJvu4M5APWpHnidZilNkr6JbzvrBXwfPCKAHbbGg5xf668KJK+7E vFlpyPbmD+6t4sK+RrsVqk9OCiNy4BTTtyuP22sVCJQuzd4KRewOgVrawxiHAaF24QCRGD7XF8EJQ fWsz6dpquq3LKZNrWXl/99gculC+Y5FP0wyF3xg73N3+5YnNt+tdeHEygWe3SfZHG7zJGVZutJz88 Q7pUo7fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06Pw-00000003Ito-1wud; Sun, 13 Oct 2024 21:46:24 +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 1t068B-00000003Ft1-16uQ for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:07 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 59BFF5C58BC; Sun, 13 Oct 2024 21:27:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 99447C4CECF; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=j2vid/vddrKcL8KvtMAcTYJxtWkvRprDqfEv2vhqPPM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=B9zhnJ8PMK0hqKiNePUWJgmAYWKx+q7S/jAGVrLUfmGGlFwQBRynd0DAVrPRd9k+W Qu1i/XIgnT0ZD+vjfeMquxcE1cM5eabmN8xNUBreD19mbAWaNHVMPEiDAd1Ml+cc4C rvWg8C65Q+Ig5P87Px0uuuOJKXQwlMMcmpkCIY/REdjyzXbzvIZOHM6UvNEVmoxM1j uuc8KkIp7nFVinhSWuzzVtzpOzEfY1yH/e1wXbFcs+8OAl+a+ekkuSkxqil6Xz3J5j OnAFiM+PogBsvytLjinxpqL4m2VcIpUYBhAtXJNl9DMDpXcRBBUO+Ds0kX0AvVJjr+ f5iClOtIPg47g== 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 8FE63CF258D; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:48 +0200 Subject: [PATCH v3 13/16] dt-bindings: net: Add DT bindings for DWMAC on NXP S32G/R SoCs MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-13-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=3644; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=fWwsO4AbuTXGq7kNfdcQgpAQMuVlAVvin9XmZ8Gr3D0=; b=GTiqwt2VDrgEdUqc9nNgz4LT9O3Opu/L7FUt31JJrYo53Dy7IFdnmfgMoJfAbbMw1nb8j1mxS 7nE1HqKtbwmC95iJr9rwGlD219cRY55h4Yjd/pnvvgYK4e55XrefJkR 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-20241013_142803_543885_98A1EE0A X-CRM114-Status: GOOD ( 13.04 ) 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. Signed-off-by: Jan Petrous (OSS) --- .../devicetree/bindings/net/nxp,s32-dwmac.yaml | 97 ++++++++++++++++++++++ .../devicetree/bindings/net/snps,dwmac.yaml | 1 + 2 files changed, 98 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..4c65994cbe8b --- /dev/null +++ b/Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml @@ -0,0 +1,97 @@ +# 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. + +properties: + compatible: + enum: + - 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 4e2ba1bf788c..f4887e9957ce 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -66,6 +66,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 Sun Oct 13 21:27:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834056 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 D5B2ECF2591 for ; Sun, 13 Oct 2024 21:49:21 +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=IXMTp3CZKdtMuTKiHtyGDjvTd6si3V348nEGYXT0DUM=; b=rYf4mMb7yFaQ3XFR8BjypSM3UX jzi2gdB5Nf0s097+Cp8l9P+yJOvPsp6nbJ//aHMk0e6NnSG/GkvNyqXIpnMx5VVdwPQ4Yyl8wbfRj 0/Zglg3pbw8cJzhMQEaMYSVnz5sLlyMcf/HMwFetcGGZlxrGOTwfhVGoYmKKF+7ULNWv6iu9cTmPI aWnWZv28/mkst0PLjckQKeQyAkyOyTVwko0YlqCdd+LH0bKOXClXf78Eo/fMPulhLAuVB34R+aKnD MV+9/6N/NVQRkY2UXh3BVXW5cYwjSMvlj8ncyTgBzqL7htxr/bqErrSjQXaKsbBRle14acbv4rhJ4 dSgyf5KA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06Sd-00000003J6z-0OED; Sun, 13 Oct 2024 21:49:11 +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 1t068B-00000003FtL-40uD for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id CC8D5A40F63; Sun, 13 Oct 2024 21:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id ADC2CC4CED5; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=qjHru+UY4tBCEH8EPGBHLu+wCoZyZ3rt3d9mCvIeL+o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=mzfGtf3AkQ9l0qz9wM1heEtnp3xdkSDIobVT3Dxr2Dh4l9d8yzsDh5bMt2z2KL1w5 oMHWbBNPh+ehEoewsuGIxFyRQBN9tuTd5W9/bik59fSoczlZcoGntLAKw5CiYkaTZU qU3Jqz2tdObOaluNEoAexUcKwgpnH1HPHq6WzRm62CFSP5NHnEekaFH3kE535agpQA CK+/QNiZh2BPZFMu2Sb8x+Ak9icf7j9w4HddbKQVmtYQnnD8NtOIObmbOUwACLE6up ydvQriK7dDplEJ+z3I+/iFs7v2DTiQrwPrDWQVsvf2lH3uKUMuLvhLhERfz/0EPDKo PPx5x1GeBCybA== 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 A32B6CF258E; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:49 +0200 Subject: [PATCH v3 14/16] net: stmmac: dwmac-s32: add basic NXP S32G/S32R glue driver MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-14-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=8131; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=YqTz7KuG2wyeLc//Yy5God8wjG4JEZGlifKU47578F0=; b=2WRoyUhSXKL2GaFHYV+xuQrefJR34ty1ASYHODFNkZcp+LgneCt5OuhU8Sjz0odw0qewK8IkV 5rEGmDuPLsiAhXO18fRpnGGjLSR3qoLtDrWhc+QZjQe3ux1GUGZkVYh 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-20241013_142804_213772_36F73267 X-CRM114-Status: GOOD ( 23.32 ) 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 | 224 ++++++++++++++++++++++++ 3 files changed, 237 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 05cc07b8f48c..a6579377bedb 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 c2f0e91f6bf8..1e87e2652c82 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..aedd6bf80684 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c @@ -0,0 +1,224 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * NXP S32G/R GMAC glue layer + * + * Copyright 2019-2024 NXP + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "stmmac_platform.h" + +#define GMAC_TX_RATE_125M 125000000 /* 125MHz */ +#define GMAC_TX_RATE_25M 25000000 /* 25MHz */ +#define GMAC_TX_RATE_2M5 2500000 /* 2.5MHz */ + +/* 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; + bool rx_clk_enabled; +}; + +static int s32_gmac_write_phy_intf_select(struct s32_priv_data *gmac) +{ + u32 intf_sel; + + switch (gmac->intf_mode) { + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: + intf_sel = PHY_INTF_SEL_RGMII; + break; + default: + dev_err(gmac->dev, "Unsupported PHY interface: %s\n", + phy_modes(gmac->intf_mode)); + return -EINVAL; + } + + writel(intf_sel, gmac->ctrl_sts); + + dev_dbg(gmac->dev, "PHY mode set to %s\n", phy_modes(gmac->intf_mode)); + + return 0; +} + +static int s32_gmac_init(struct platform_device *pdev, void *priv) +{ + struct s32_priv_data *gmac = priv; + int ret; + + ret = clk_set_rate(gmac->tx_clk, GMAC_TX_RATE_125M); + if (!ret) + ret = clk_prepare_enable(gmac->tx_clk); + + if (ret) { + dev_err(&pdev->dev, "Can't set tx clock\n"); + return ret; + } + + ret = clk_prepare_enable(gmac->rx_clk); + if (ret) + dev_dbg(&pdev->dev, "Can't set rx, clock source is disabled.\n"); + else + gmac->rx_clk_enabled = true; + + ret = s32_gmac_write_phy_intf_select(gmac); + if (ret) { + clk_disable_unprepare(gmac->tx_clk); + if (gmac->rx_clk_enabled) { + clk_disable_unprepare(gmac->rx_clk); + gmac->rx_clk_enabled = false; + } + + dev_err(&pdev->dev, "Can't set PHY interface mode\n"); + return ret; + } + + return 0; +} + +static void s32_gmac_exit(struct platform_device *pdev, void *priv) +{ + struct s32_priv_data *gmac = priv; + + clk_disable_unprepare(gmac->tx_clk); + + if (gmac->rx_clk_enabled) { + clk_disable_unprepare(gmac->rx_clk); + gmac->rx_clk_enabled = false; + } +} + +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; + + if (!gmac->rx_clk_enabled) { + ret = clk_prepare_enable(gmac->rx_clk); + if (ret) { + dev_err(gmac->dev, "Can't set rx clock\n"); + return; + } + dev_dbg(gmac->dev, "rx clock enabled\n"); + gmac->rx_clk_enabled = true; + } + + 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 s32_priv_data *gmac; + struct stmmac_resources res; + 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_new = 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 Sun Oct 13 21:27:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834057 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 643C3CF258E for ; Sun, 13 Oct 2024 21:50:44 +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=3WvScoTll17/uNtqtk2R9wQYFOMvQcEqVPMoBHzR9Ow=; b=Sr+wifYUqMobJO1+VFpJWo3iUq doeFnc7Vffjm4k5n2U33pThWOfsYyI00W7FBvnphU7e97lch3LOrLJfzVaXSpj8jr3Hv3EYMPQ+O9 MF6xGA9T9p1Cp/ww2iMridE/shyS6FEIpBWjCfyBGjhxnmtoKVjhlCcTXkJeFMNBxJGVe1dUx/DFi ppxd0iPcfGzr7yfCOm1W4reqItgxzGegBv4UFUQqatHQTuHF3GZOk4t/QkRkEckAH7LeokFzLoRTl pLba6Z7OFTbkVBoqFdoSEmo/UrZ37PQoT/IutCy126rsQcY/JNhPuba5PLxNSvND/OtWKd6Tr4kHv 1i5cjO3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06Tx-00000003JD7-2vPY; Sun, 13 Oct 2024 21:50:33 +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 1t068B-00000003FtN-45nq for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id D0F6FA40F67; Sun, 13 Oct 2024 21:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id BF1F9C4CED9; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=zAAupFSvZACbXghIFfSS4EVe26kSkFg+ybuK1orZ7RM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=EEJsw491D5rVI1FSdg0F4yFrrPIWDuBFqs28fKSIKcVwJIV59Mhazastk3oJvbHoG i/WzGL6a1F4VJz+/wfDktNY6d4szuVOwUBFPxyQs9dz3+82hH4FOaz/dlt+7qd4LMQ VnoIctukk6Y7991Qx5d1YO9bicOPGvgbdoP/WOMTnIkCSdT2DRunh0bOozBdcDeGo/ MitDy3su2vnlzWezceuR4UAjX0bs0HEILPLSF1GsswXIwDbtfyvyhwZ1teXv5+2ZJI bZd7pPEEdEv+x14ZtJ89JulwUm/cNVxaULAfL9exw0eu8/Fi9nkXwPSpspwO2AnE3a Ea1kvu/joXzbg== 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 B5BB1CF2594; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:50 +0200 Subject: [PATCH v3 15/16] MAINTAINERS: Add Jan Petrous as the NXP S32G/R DWMAC driver maintainer MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-15-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=872; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=zmHx3KNbX8A6L/euQ4+Hu4yJAQBrFW95hHmYe/45/dc=; b=RGWSZgVVXDcvhXEDq6X4N4KOzc9Vs2WUbIYIGOBAGbaN5c778ikD3JcWUboQ9SFq1FnEUqVVd wpgujQ3WsjvCRakL9q30pisG1A12E5+ILIURNsQFfyz1XMt4w6ZiiLu 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-20241013_142804_269093_17766CE2 X-CRM114-Status: UNSURE ( 9.65 ) 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. Signed-off-by: Jan Petrous (OSS) --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7387afe8f7ea..217a7edb25c7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2757,6 +2757,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,dwmac-s32.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) From patchwork Sun Oct 13 21:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13834055 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 85E6CCF2591 for ; Sun, 13 Oct 2024 21:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sfLLjFHlH9LzJMpRN2oc8uoiCZSLK9FX24kB4yl+fK4=; b=jWDk318lBgF9ceKJbVilL6fSxe S7dsZ4uwLXeB/vCPakXVThL1KDVwXTy2wF8sZ371YYGKyGi14loI5j9QIfizhQ+qNQHnRJ9iPCydp iO1K4xbW/j07krUikLGc8YhVo9Nztg6Q3rfa8uUi6vnG4puWF7UF0NMUjdMJybbErnkS1OxgYuYBq ZuI7vZCEkUhyinfnb02l2loOVr3nLDvjwNYFUmWijVheYTLqtHOoxfJF6gGNEIGYEjSCTIZWJWd22 4IOiCUVG6WQQ7zMd+fiKoSIRRl+iglhmCTHXqfo5Hn8B4hrjVeV+sVnkyKoJcPE6b++z6p601+Res QslCrcFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t06RI-00000003J1i-1wco; Sun, 13 Oct 2024 21:47:48 +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 1t068B-00000003Ft8-25mE for linux-arm-kernel@lists.infradead.org; Sun, 13 Oct 2024 21:28:07 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 737745C58D0; Sun, 13 Oct 2024 21:27:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id DD119C4AF0D; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728854878; bh=B8D4rtkDCUvIgkAJnwHDrRoK8VWaANfpHt6JnSqvkNo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=QOBQviP8pMyYkocR/dYrePt3TOxF4ryOhIhqa7EhFJ+oZKOXdFimXxr3Z8xlRkHDl 3gpA26xp/W//S5FmRR+H8heZsOICERBXxEtwI4HqDenNgdYcP2bwih8folFnqWd6If rI6ygSGPlP4WEjnmJX4Rts00i8Iqd/EGOzL0AalOubPmQ1MV2ryaCdBy1zqi7Lqek3 OJD42OnQW+EHMPPTTSZUaqE4ELQpZhpx9di5QlFxV4OOgt6xNnjyJqFhsYWjzVjHIR wwXjR0HOBzHMViLTGv//IqsRBIb40n3AOOgU57o0jaZw2Z5Dl4HQ0PWTpTlg0kl24H r8rnt5g4UVXwQ== 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 CD547CF2591; Sun, 13 Oct 2024 21:27:58 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Sun, 13 Oct 2024 23:27:51 +0200 Subject: [PATCH v3 16/16] net: stmmac: dwmac-s32: Read PTP clock rate when ready MIME-Version: 1.0 Message-Id: <20241013-upstream_s32cc_gmac-v3-16-d84b5a67b930@oss.nxp.com> References: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@oss.nxp.com> In-Reply-To: <20241013-upstream_s32cc_gmac-v3-0-d84b5a67b930@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 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 , "Jan Petrous (OSS)" , Andrei Botila , Jacob Keller X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728854875; l=1605; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=yghcsP0rT1E+KchKPuX8DbIOCwUwU33DKX66yshrGiI=; b=rlFKSP5vX/qcXmdlWd4FXmmlRdEmQ1yeJaLvdVoYW0pouWkcfUFvPcxCrMwVsedbS365JSzZB h+dQP6P/jtsBNIya5JLVNWMXWpGB7PDdgKlyqw+3OjugSO34ce4lc7a 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-20241013_142803_733658_5A29DB99 X-CRM114-Status: GOOD ( 11.74 ) 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 PTP clock is read by stmmac_platform during DT parse. On S32G/R the clock is not ready and returns 0. Postpone reading of the clock on PTP init. Co-developed-by: Andrei Botila Signed-off-by: Andrei Botila Signed-off-by: Jan Petrous (OSS) Reviewed-by: Jacob Keller --- drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c index aedd6bf80684..3daf282d8da7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c @@ -140,6 +140,18 @@ static void s32_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode) dev_err(gmac->dev, "Can't set tx clock\n"); } +static void s32_dwmac_ptp_clk_freq_config(struct stmmac_priv *priv) +{ + struct plat_stmmacenet_data *plat = priv->plat; + + if (!plat->clk_ptp_ref) + return; + + plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref); + + netdev_dbg(priv->dev, "PTP rate %lu\n", plat->clk_ptp_rate); +} + static int s32_dwmac_probe(struct platform_device *pdev) { struct plat_stmmacenet_data *plat; @@ -195,6 +207,7 @@ static int s32_dwmac_probe(struct platform_device *pdev) plat->init = s32_gmac_init; plat->exit = s32_gmac_exit; plat->fix_mac_speed = s32_fix_mac_speed; + plat->ptp_clk_freq_config = s32_dwmac_ptp_clk_freq_config; plat->bsp_priv = gmac;