From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A374A3A1E73; Wed, 18 Mar 2026 16:37:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851876; cv=none; b=mWeanMJmV3d3tXE5wCNEOCElTA2JodXWnBEVNwBf5trEPhRkZL4S88uxvx7w/tEnVFq7WRkKfyEmdEjN+0O7avggPKYvrF7GO4GRPedMWXwb7t5ESR4Y8bXvetTDEsujpZHjlJmUWGpW/9YLGoH4mn6qBbp8xnF8jf6hE/SQqLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851876; c=relaxed/simple; bh=qXfofFT/trjhnPdhGlUBXmgmmTY9bSQeDk+832YPFio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M84PktO0+0doJGDFYCGj9JRMuvXre6hSuJQs2ApoLfxDQtFQS9yqsXB6FMociks8sGDMUB0gO95vL0z+nMmuDdroI3fD8PFj09rDMeKui6wLJcmrQXwQZfeidfueZ85GXGZpvYz6QUwfnL7s41dMyK136UH1VLdelg/lrRQ32zM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GstVF2XO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GstVF2XO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15412C2BC87; Wed, 18 Mar 2026 16:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851876; bh=qXfofFT/trjhnPdhGlUBXmgmmTY9bSQeDk+832YPFio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GstVF2XOOimo5nwYNyngBHe+JUGCtpZjNkJn3FkMko6UgBPp1TwANQ1kauNFGpyOo O6t/yebg79VawFRxauDhMVsLQQiyip4dRUqoCV+qu6ToydlL8Y6+ne3HbWG0UgJAi/ yx5rU23ylppi9hmmq2M8dVB/5eAbc/gm1QgMCeVXio4csMCFvsFvqGJDVF0OD6sj3B gTyxpMk+tSW0YiI+tShk9Qp5H52dN5CYTp3BS70DFxW01HE+ppsvFnNUL5HL68YBKt /ZhXY+O6/vQ4D9Y2u/y73HKwFb59+b/44DEcQDmQT6rlaWBZz6uPUJOOW3JTSih/MI +edr4WplBhdkA== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 01/13] net: macb: rename macb_default_usrio to at91_default_usrio as not all platforms have mii mode control in usrio Date: Wed, 18 Mar 2026 16:37:32 +0000 Message-ID: <20260318-proximity-playoff-d9a0c84ed6a9@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=10810; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=EKLjoCWb4dd6fnjRibapsUL7p5viCWSXvbtWmX4ncIU=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlyQM187R+5+cWyowNLSPyd/GE1b+uBedcdNlupPp coOLy4xd5SyMIhxMciKKbIk3u5rkVr/x2WHc89bmDmsTCBDGLg4BWAifYcZGc4e+XVp+qelbhaa fiZfP/UELlhe90jp6oYD5lkZN3OOeWQyMqyaNtWq7NcBnZIHHqvv/Y/TO+X994+565fCWRedeT+ 0BXMAAA== X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley Calling this structure macb_default_usrio is misleading, I believe, as it implies that it should be used if your platform has nothing special to do in usrio. Since usrio is platform dependent, the default here is probably for each usrio to do nothing, with the macb documentation I have access to prescribing no standard behaviour here. We noticed that this was problematic because on mpfs, a bit that macb_default_usrio sets to deal with the MII mode actually changes the source for the tsu_clk to something with how the majority of mpfs devices are actually configured! Rename it to at91_default_usrio, since that's where the values actually come from for these. I have no idea if any of the other platforms that use the default actually copied at91's usrio configuration or if they have usrio configurations where what the driver does has no impact. Gate touching these bits behind a capability, like the clken refclock usrio knob, so that platforms without the MII mode stuff can avoid running this code. Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb.h | 1 + drivers/net/ethernet/cadence/macb_main.c | 108 +++++++++++++---------- 2 files changed, 63 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index 87414a2ddf6e3..8cb0b3778ee9e 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -779,6 +779,7 @@ #define MACB_CAPS_DMA_PTP BIT(22) #define MACB_CAPS_RSC BIT(23) #define MACB_CAPS_NO_LSO BIT(24) +#define MACB_CAPS_USRIO_HAS_MII BIT(25) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 5bc35f651ebd2..778d2115f66fc 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4613,13 +4613,15 @@ static int macb_init(struct platform_device *pdev) =20 if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) { val =3D 0; - if (phy_interface_mode_is_rgmii(bp->phy_interface)) - val =3D bp->usrio->rgmii; - else if (bp->phy_interface =3D=3D PHY_INTERFACE_MODE_RMII && - (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII)) - val =3D bp->usrio->rmii; - else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII)) - val =3D bp->usrio->mii; + if (bp->caps & MACB_CAPS_USRIO_HAS_MII) { + if (phy_interface_mode_is_rgmii(bp->phy_interface)) + val =3D bp->usrio->rgmii; + else if (bp->phy_interface =3D=3D PHY_INTERFACE_MODE_RMII && + (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII)) + val =3D bp->usrio->rmii; + else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII)) + val =3D bp->usrio->mii; + } =20 if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN) val |=3D bp->usrio->refclk; @@ -4637,13 +4639,6 @@ static int macb_init(struct platform_device *pdev) return 0; } =20 -static const struct macb_usrio_config macb_default_usrio =3D { - .mii =3D MACB_BIT(MII), - .rmii =3D MACB_BIT(RMII), - .rgmii =3D GEM_BIT(RGMII), - .refclk =3D MACB_BIT(CLKEN), -}; - #if defined(CONFIG_OF) /* 1518 rounded up */ #define AT91ETHER_MAX_RBUFF_SZ 0x600 @@ -5218,6 +5213,13 @@ static int eyeq5_init(struct platform_device *pdev) return ret; } =20 +static const struct macb_usrio_config at91_default_usrio =3D { + .mii =3D MACB_BIT(MII), + .rmii =3D MACB_BIT(RMII), + .rgmii =3D GEM_BIT(RGMII), + .refclk =3D MACB_BIT(CLKEN), +}; + static const struct macb_usrio_config sama7g5_usrio =3D { .mii =3D 0, .rmii =3D 1, @@ -5228,104 +5230,114 @@ static const struct macb_usrio_config sama7g5_usr= io =3D { =20 static const struct macb_config fu540_c000_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | - MACB_CAPS_GEM_HAS_PTP, + MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D fu540_c000_clk_init, .init =3D fu540_c000_init, .jumbo_max_len =3D 10240, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config at91sam9260_config =3D { - .caps =3D MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, + .caps =3D MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII= | + MACB_CAPS_USRIO_HAS_MII, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config sama5d3macb_config =3D { .caps =3D MACB_CAPS_SG_DISABLED | - MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, + MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | + MACB_CAPS_USRIO_HAS_MII, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config pc302gem_config =3D { - .caps =3D MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, + .caps =3D MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config sama5d2_config =3D { - .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_JUMBO, + .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_JUMBO | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, .jumbo_max_len =3D 10240, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config sama5d29_config =3D { - .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_GEM_HAS_PTP, + .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_GEM_HAS_PTP | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config sama5d3_config =3D { .caps =3D MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE | - MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_JUMBO, + MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_JUMBO | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, .jumbo_max_len =3D 10240, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config sama5d4_config =3D { - .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, + .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 4, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config emac_config =3D { - .caps =3D MACB_CAPS_NEEDS_RSTONUBR | MACB_CAPS_MACB_IS_EMAC, + .caps =3D MACB_CAPS_NEEDS_RSTONUBR | MACB_CAPS_MACB_IS_EMAC | + MACB_CAPS_USRIO_HAS_MII, .clk_init =3D at91ether_clk_init, .init =3D at91ether_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config np4_config =3D { .caps =3D MACB_CAPS_USRIO_DISABLED, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config zynqmp_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | - MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH, + MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D init_reset_optional, .jumbo_max_len =3D 10240, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config zynq_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF | - MACB_CAPS_NEEDS_RSTONUBR, + MACB_CAPS_NEEDS_RSTONUBR | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config mpfs_config =3D { @@ -5335,7 +5347,7 @@ static const struct macb_config mpfs_config =3D { .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D init_reset_optional, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, .max_tx_length =3D 4040, /* Cadence Erratum 1686 */ .jumbo_max_len =3D 4040, }; @@ -5343,7 +5355,8 @@ static const struct macb_config mpfs_config =3D { static const struct macb_config sama7g5_gem_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_CLK_HW_CHG | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | - MACB_CAPS_MIIONRGMII | MACB_CAPS_GEM_HAS_PTP, + MACB_CAPS_MIIONRGMII | MACB_CAPS_GEM_HAS_PTP | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, @@ -5353,7 +5366,8 @@ static const struct macb_config sama7g5_gem_config = =3D { static const struct macb_config sama7g5_emac_config =3D { .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_MIIONRGMII | - MACB_CAPS_GEM_HAS_PTP, + MACB_CAPS_GEM_HAS_PTP | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, @@ -5364,12 +5378,13 @@ static const struct macb_config versal_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_RD_PREFETCH | MACB_CAPS_NEED_TSUCLK | MACB_CAPS_QUEUE_DISABLE | - MACB_CAPS_QBV, + MACB_CAPS_QBV | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D init_reset_optional, .jumbo_max_len =3D 10240, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config eyeq5_config =3D { @@ -5380,17 +5395,18 @@ static const struct macb_config eyeq5_config =3D { .clk_init =3D macb_clk_init, .init =3D eyeq5_init, .jumbo_max_len =3D 10240, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config raspberrypi_rp1_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_CLK_HW_CHG | MACB_CAPS_JUMBO | - MACB_CAPS_GEM_HAS_PTP, + MACB_CAPS_GEM_HAS_PTP | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, .jumbo_max_len =3D 10240, }; =20 @@ -5431,7 +5447,7 @@ static const struct macb_config default_gem_config = =3D { .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &macb_default_usrio, + .usrio =3D NULL, .jumbo_max_len =3D 10240, }; =20 --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F9232E92BA; Wed, 18 Mar 2026 16:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851882; cv=none; b=oIddwiyCbNn8XzkdzSuNqgrGEDkpGnWMHi54lZ+KvzEA1mJShn18U8y4sj//oVrLd0pWsbSsWAr5/h1f412k1782CU/3KVR+Zx5+a6Fc+Ow0+ZOFN+VTXJIYrZu+5uZGk3fIU5R1crzqilhjaZj+p73b5qC+Ip/GcxOhyaLRl4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851882; c=relaxed/simple; bh=5Jkuep/vLlDigVeWmTs/DhOngIlPtkb5pESGRVTgEIQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YR60iJlSyAwjjYZAQJ4zMAe9/OjCd4RZg2gbvyJgAQMWMgCaA76EoZSxYBXRHuTOeOnbjqUxxri5iQs2IJnrooGmM2DgVtgZMDmL3qP3PwlFxuY4+9+LZBNx5fPh0LrxscajtvOBSsgRH+BKDWwzSGykn3y4tLr1TnpBRNP4cEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R11D7cUG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R11D7cUG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9F06C19421; Wed, 18 Mar 2026 16:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851882; bh=5Jkuep/vLlDigVeWmTs/DhOngIlPtkb5pESGRVTgEIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R11D7cUGj838U+xpeXLlsCxJr/XekmKgJJk7HqS7714JcjbIuT2usuSxRrk1l43BI Su39Mbs0abv0vo87tP+pPSCKBO/h1SmhQfaRKiqf6DHT9vv+QVtS1a3ll36TMh7L3D zrUJg7H1VyI21u5VvZBL4Diuwf5B6jrehPFq/zfkRd85mJwddWeUowGXwDCjvafU+7 JGJgjHqitfv0OqBuhp4C3DpRaRvaLlUteUC0KuYctOfOYOZxJoRc/gg5Clc/tCuOFK JiNfpJ3v1IJdY/nT/Ur8jratU0RDcFq8XpN0pYT2FReNy9Bk9Ao6nIL/N1Dzxc5RbM R00vY3LUFE11A== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 02/13] net: macb: split USRIO_HAS_CLKEN capability in two Date: Wed, 18 Mar 2026 16:37:33 +0000 Message-ID: <20260318-produce-canopener-0b61c538fabf@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3502; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=TDcEt4gO7nw+FrU/aV4qA0N2hA+cJ3rWCHECrYVPXVw=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlwIcI4IO3397/mXHPze10UbH99d8XL9m10NeR8lE u6k7np0rKOUhUGMi0FWTJEl8XZfi9T6Py47nHvewsxhZQIZwsDFKQATWevCyLChjFklz2BpwMkL 8coc2Z55HPpiUilXS6Kfrvea9+d2UhUjw+PQ34euWJZ399xSa2IrN77x7/DGg6ICrkefNT+Tjw8 +wA0A X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley While trying to rework the internal/external refclk selection on sama7g5, Ryan and I noticed that the sama7g5 was "overloading" the meaning of MACB_CAPS_USRIO_HAS_CLKEN, using it differently to how it was originally intended. Originally, on the macb hardware on sam9620 et al, MACB_CAPS_USRIO_HAS_CLKEN represented the hardware having a bit that needed to be set to turn on the input clock to the transceivers. The sama7g5 doesn't have this bit, so for some reason the decision was made to reuse this capability flag to control selection of internal/external references. Split the caps in two, so that capabilities do what they say on the tin, and allow reworking the refclk selection handling without impacting the older devices that use MACB_CAPS_USRIO_CLKEN for its original purpose. Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb.h | 2 ++ drivers/net/ethernet/cadence/macb_main.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index 8cb0b3778ee9e..baf48f02d7e27 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -780,6 +780,7 @@ #define MACB_CAPS_RSC BIT(23) #define MACB_CAPS_NO_LSO BIT(24) #define MACB_CAPS_USRIO_HAS_MII BIT(25) +#define MACB_CAPS_USRIO_HAS_REFCLK_SOURCE BIT(26) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 @@ -1211,6 +1212,7 @@ struct macb_usrio_config { u32 rmii; u32 rgmii; u32 refclk; + u32 clken; u32 hdfctlen; }; =20 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 778d2115f66fc..d908850c59498 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4357,7 +4357,7 @@ static void macb_configure_caps(struct macb *bp, } =20 if (refclk_ext) - bp->caps |=3D MACB_CAPS_USRIO_HAS_CLKEN; + bp->caps |=3D MACB_CAPS_USRIO_HAS_REFCLK_SOURCE; =20 dev_dbg(&bp->pdev->dev, "Cadence caps 0x%08x\n", bp->caps); } @@ -4624,6 +4624,9 @@ static int macb_init(struct platform_device *pdev) } =20 if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN) + val |=3D bp->usrio->clken; + + if (bp->caps & MACB_CAPS_USRIO_HAS_REFCLK_SOURCE) val |=3D bp->usrio->refclk; =20 macb_or_gem_writel(bp, USRIO, val); @@ -5217,7 +5220,7 @@ static const struct macb_usrio_config at91_default_us= rio =3D { .mii =3D MACB_BIT(MII), .rmii =3D MACB_BIT(RMII), .rgmii =3D GEM_BIT(RGMII), - .refclk =3D MACB_BIT(CLKEN), + .clken =3D MACB_BIT(CLKEN), }; =20 static const struct macb_usrio_config sama7g5_usrio =3D { @@ -5355,6 +5358,7 @@ static const struct macb_config mpfs_config =3D { static const struct macb_config sama7g5_gem_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_CLK_HW_CHG | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | + MACB_CAPS_USRIO_HAS_REFCLK_SOURCE | MACB_CAPS_MIIONRGMII | MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, @@ -5365,7 +5369,8 @@ static const struct macb_config sama7g5_gem_config = =3D { =20 static const struct macb_config sama7g5_emac_config =3D { .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | - MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_MIIONRGMII | + MACB_CAPS_MIIONRGMII | + MACB_CAPS_USRIO_HAS_REFCLK_SOURCE | MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C9EA1E89C; Wed, 18 Mar 2026 16:38:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851888; cv=none; b=SayCEDbA0wjQ+W7KshnpuMm1uYcw5THzYZxQgbzSCWNqwABdP2WXSmjrNwInFwhKio0iTGAwU3+IOdPlcjD/2geGGISgK1/y6L8qOOqDAn1I5DFP4Pb0bix4qHYjkij0ifAXREDkw4wbKP/JNCLFqh9m8RicIoUNNzjwiX5lsyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851888; c=relaxed/simple; bh=amkx/ONsWMzstbyqhsVJJD8kT0eG2xoRPQ4khwRvdAg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QNardPzRTtX2ndeMLIBLZlqKQszFfceOfhjNV7StUFdExAgnGkwWoL8uC/FY+oC/uYAo7KdqHXQEVdyxYcQkmWqd+UXYJWdUiSH5tQa2WsFgAe7FyW5+zdXSplPlzFLXZ/6QMhjzTjvrgCHnnJREbMov0k1KLiMpOS9eIDdBGe0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i3OFa3Za; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i3OFa3Za" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A0D5C2BCB0; Wed, 18 Mar 2026 16:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851887; bh=amkx/ONsWMzstbyqhsVJJD8kT0eG2xoRPQ4khwRvdAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i3OFa3Za6rrrUEIBwsbLbwdoJH2kYPRsXYGAhywxJe1IHfXHr6vokXtDCvkTSIBNc L8k04HBq+UayWM1sP90woWLew407rZnbY7qC4IqhKWqREt81Q/SKWykL+gyX9ZcSp4 yINvhqJx9Veg1UT9Sb1O+S+RArSsQaivpSLN6ivxEl2zWX7nOsTr9m7quObz5VKkle WaOIkYLfk7IJ+JggB7e3ozUUwlbJVwl2v1TY9L/uoPur6r+oXE4dOiqAu6BEqPBOLt qzzhUso6d1a+iHeBI7E0N/Slo/RaK0NNtCYA9p1v68as5QWFvwqVK2FZWmJe7FGbYX UtPu+zLGVKZdA== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 03/13] dt-bindings: net: cdns,macb: replace cdns,refclk-ext with cdns,refclk-source Date: Wed, 18 Mar 2026 16:37:34 +0000 Message-ID: <20260318-mobilize-rule-d4a704468218@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3141; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=ylmEwtCLpeHVLaNpcJoaSjYuiY5zyWKQ8QvX+HMWzDw=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlzccv/2lBnhc/xPqEQv3lz89pL4BetHjVOdHh9jW HrVJTixqqOUhUGMi0FWTJEl8XZfi9T6Py47nHvewsxhZQIZwsDFKQAT0ZFh+J98oMH+kVxowq28 5z+c7vpEOKnMqnzFbxOzJ5v7/PzUOS6MDO9CJLWEHxq7s7f6mnxuCPqspNH/n0n/mp0M87Z7ASm 5TAA= X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley Ryan added cdns,refclk-ext with the intent of decoupling the source of the reference clock on sama7g5 (and related platforms) from the compatible. Unfortunately, the default for sama7g5-emac is an external reference clock, so this property had no effect there, so that compatibility with older devicetrees is preserved. Replace cdns,refclk-ext with one that supports both default states and therefore is usable for sama7g5-emac. For now, limit it to only the platforms that have USRIO controlled reference clock selection, but this could be generalised in the future. The existing property only works on devices that are compatible with sama7g5-gem, so mark it deprecated, and limit its use to that specific scenario. Signed-off-by: Conor Dooley Reviewed-by: Rob Herring (Arm) --- .../devicetree/bindings/net/cdns,macb.yaml | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documen= tation/devicetree/bindings/net/cdns,macb.yaml index cb14c35ba9969..f6df793c4af65 100644 --- a/Documentation/devicetree/bindings/net/cdns,macb.yaml +++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml @@ -122,10 +122,23 @@ properties: =20 cdns,refclk-ext: type: boolean + deprecated: true + description: | + This selects if the REFCLK for RMII is provided by an external source. + For RGMII mode this selects if the 125MHz REF clock is provided by an= external + source. + + This property has been replaced by cdns,refclk-source, as it only wor= ks + for devices that use an internal reference clock by default. + + cdns,refclk-source: + $ref: /schemas/types.yaml#/definitions/string + enum: + - internal + - external description: - This selects if the REFCLK for RMII is provided by an external sourc= e. - For RGMII mode this selects if the 125MHz REF clock is provided by a= n external - source. + Select whether or not the refclk for RGMII or RMII is provided by an + internal or external source. The default is device specific. =20 cdns,rx-watermark: $ref: /schemas/types.yaml#/definitions/uint32 @@ -196,6 +209,43 @@ allOf: required: - phys =20 + - if: + not: + properties: + compatible: + contains: + enum: + - microchip,sama7g5-gem + - microchip,sama7g5-emac + then: + properties: + cdns,refclk-source: false + + - if: + not: + properties: + compatible: + contains: + const: microchip,sama7g5-gem + then: + properties: + cdns,refclk-ext: false + + - if: + properties: + compatible: + contains: + enum: + - microchip,sama7g5-emac + then: + properties: + cdns,refclk-source: + default: external + else: + properties: + cdns,refclk-source: + default: internal + unevaluatedProperties: false =20 examples: --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8353F1E89C; Wed, 18 Mar 2026 16:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851893; cv=none; b=PyelcbXEZf0KkmwaFkJpBVSmyrnsF4S8WDvulh9uCdTFOdh7dzhs4R+lG7FHM7H2vBJ0hn0sFhB5NB68k+v1DQ3exAwtH8dWQ70RtgeTFsBBDVFuOv25twSuk+tNzoeJ7uAADJ7R3ca4cuqeDgMuqAtGuoPzC0CWBQpbItI7nKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851893; c=relaxed/simple; bh=d+MyLOiuyfRC+NF64EIUpcY9qyHiXTVHxjTblw4Yz08=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gv25/6WFCfPvuRdb8u+H4c6pMYLy05cD2FRXHBtaZsLnEwrYg1DGTQylF/UIyivf49m8WIc1SKr/bOyZWBJwxho+itJ19F3xPId+vcFPt3t0dEnaX6nC40ctt7QkcnliUI/HCuGk6fJJjFZE/G8Cy/LczLknxaJ0lY4T/ymmQ/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fkn7TpiM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fkn7TpiM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D2B9C19421; Wed, 18 Mar 2026 16:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851893; bh=d+MyLOiuyfRC+NF64EIUpcY9qyHiXTVHxjTblw4Yz08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fkn7TpiMaIaZ+pYbCX/aj3GoQOkJbxIDRMWdK8jZWd2tmzSIKxFKRf/WUeg/qzNL9 ZfEh3ddIuvqicK5qekRI0XmL3QtZCUd4WJBGQkJbwiCxdtrgY2WMSgYeT4bNXb63Us IX2owusTSjn6RhjEv3cYmaRXOgNjiAbu4XQ0ALlVo49KvHidjKbPX3LzLp//14ngEP C0D57H/kbnr4Kd9s7X+Q0d9t2EkATNAl1FJvGGSiVeLIscsNJMWSNj1gHcgZvoPYM/ LsAx9j2eqwVFj9SkcxuiBKICJ/dsNdlCYp2JK77zxFK9USaGmObYzjxwgpSqj0YfEl C5wy0opPY1pPQ== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 04/13] net: macb: rework usrio refclk selection code Date: Wed, 18 Mar 2026 16:37:35 +0000 Message-ID: <20260318-legal-bottling-12622a38d98a@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5400; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=2bAmm8yzB8brPeFan+juq3/KVYptD7voFpcvqp+7QWc=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlzMza4sM2s6/0w2Z17Axdk/TR7bCn3VL1Bw3FuWk P3iIfvPjlIWBjEuBlkxRZbE230tUuv/uOxw7nkLM4eVCWQIAxenAExkQgHD//p75xsXJHbNNNt1 1XjW3MZ/TH2zJTeGNOZJ3la7t1FQr4Thf8khrSmNV6ZH6GreK1Kfsy7JWcVmg6abxh5f9uWT/y8 O4gMA X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley The USRIO based refclk selection code abuses a capability flag to set the refclk to an external source based on match data/compatible on sama7g5-emac and use an internal source for the gmac. Ryan previously added a property in an attempt to decouple the refclk source from the compatible, because this is not fixed by compatible and there's variance based on the choices made by board designers. Originally when Ryan added it, he removed the capability flag entirely from match data, but this changed the default for the sama7g5-emac and the removal had to be reverted for these devices. Because these devices default to an external refclk, and the current property is only capable of communicating external refclks, there's no way to make the sama7g5-emac use an internal refclk. Additionally, this property has no limiting based on compatible, and if used on a platform with an external refclk that is not controlled by USRIO the capability would be erroneously set. Because of the reuse of the at91_default_usrio struct by non-at91 devices, this could cause the refclk bit to be set in error, on a system where the refclk is externally provided without usrio settings being required. Change the new capability flag so that it actually represents the hardware being capable of controlling the refclk source via USRIO, and move the selection of default behaviour into the macb_usrio_config struct provided as part of match data. Modify the devicetree code to support a new property, "cdns,refclk-source" which will support devices with either default, retaining support for "cdns,refclk-external" for compatibility reasons. Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb.h | 1 + drivers/net/ethernet/cadence/macb_main.c | 55 ++++++++++++++++++------ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index baf48f02d7e27..9cd565cb87e4c 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -1214,6 +1214,7 @@ struct macb_usrio_config { u32 refclk; u32 clken; u32 hdfctlen; + bool refclk_default_external; }; =20 struct macb_config { diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index d908850c59498..1f9e46cf7e1cb 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4318,12 +4318,8 @@ static const struct net_device_ops macb_netdev_ops = =3D { static void macb_configure_caps(struct macb *bp, const struct macb_config *dt_conf) { - struct device_node *np =3D bp->pdev->dev.of_node; - bool refclk_ext; u32 dcfg; =20 - refclk_ext =3D of_property_read_bool(np, "cdns,refclk-ext"); - if (dt_conf) bp->caps =3D dt_conf->caps; =20 @@ -4356,9 +4352,6 @@ static void macb_configure_caps(struct macb *bp, } } =20 - if (refclk_ext) - bp->caps |=3D MACB_CAPS_USRIO_HAS_REFCLK_SOURCE; - dev_dbg(&bp->pdev->dev, "Cadence caps 0x%08x\n", bp->caps); } =20 @@ -4626,8 +4619,36 @@ static int macb_init(struct platform_device *pdev) if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN) val |=3D bp->usrio->clken; =20 - if (bp->caps & MACB_CAPS_USRIO_HAS_REFCLK_SOURCE) - val |=3D bp->usrio->refclk; + if (bp->caps & MACB_CAPS_USRIO_HAS_REFCLK_SOURCE) { + const char *prop; + bool refclk_ext; + int ret; + + /* Default to whatever was set in the match data for + * this device. There's two properties for refclk + * control, but the boolean one is deprecated so is + * a lower priority to check, no device should have + * both. + */ + refclk_ext =3D bp->usrio->refclk_default_external; + + ret =3D of_property_read_string(pdev->dev.of_node, + "cdns,refclk-source", &prop); + if (!ret) { + if (!strcmp(prop, "external")) + refclk_ext =3D true; + else + refclk_ext =3D false; + } else { + ret =3D of_property_read_bool(pdev->dev.of_node, + "cdns,refclk-ext"); + if (ret) + refclk_ext =3D true; + } + + if (refclk_ext) + val |=3D bp->usrio->refclk; + } =20 macb_or_gem_writel(bp, USRIO, val); } @@ -5223,11 +5244,21 @@ static const struct macb_usrio_config at91_default_= usrio =3D { .clken =3D MACB_BIT(CLKEN), }; =20 -static const struct macb_usrio_config sama7g5_usrio =3D { +static const struct macb_usrio_config sama7g5_gem_usrio =3D { .mii =3D 0, .rmii =3D 1, .rgmii =3D 2, .refclk =3D BIT(2), + .refclk_default_external =3D false, + .hdfctlen =3D BIT(6), +}; + +static const struct macb_usrio_config sama7g5_emac_usrio =3D { + .mii =3D 0, + .rmii =3D 1, + .rgmii =3D 2, + .refclk =3D BIT(2), + .refclk_default_external =3D true, .hdfctlen =3D BIT(6), }; =20 @@ -5364,7 +5395,7 @@ static const struct macb_config sama7g5_gem_config = =3D { .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &sama7g5_usrio, + .usrio =3D &sama7g5_gem_usrio, }; =20 static const struct macb_config sama7g5_emac_config =3D { @@ -5376,7 +5407,7 @@ static const struct macb_config sama7g5_emac_config = =3D { .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &sama7g5_usrio, + .usrio =3D &sama7g5_emac_usrio, }; =20 static const struct macb_config versal_config =3D { --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 727CA35F193; Wed, 18 Mar 2026 16:38:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851899; cv=none; b=R9el/5C3U10MtKQM/vMNXXvTos9kZi/mvvYS3vc697Zw86xcSCcaK7flqNib6ijvnlb1x6pzQO61ujgN55LwLdRsaEk/d8umQxgLUU1mBmwd/dlCn5II39CW+Br+6Lu8K3Pm1E3vvAUrFBpV2HI4MKSD03NUyCLilpUwfiqfBYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851899; c=relaxed/simple; bh=hLF9AXo3lnRxCyN0gi/H0Xuz7Ot4l/b2adjyOOaaEI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fk7hdtaZquCMYMcprejHv1RZ6IitpF1yM7B2jeZ6vZKatX9FvAxfxIxRFYwkWUReqhPodfp7kj7kk7Zfa+pGzUDYxGtepEpnvjwLFG0v3a4Mt7Y1TKWBHhpYjoS0o7hkyyZApuxTE5dvs8rPv8NbQk3TRsMncLQs+VJt+yOj5U0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RNfQrjyv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RNfQrjyv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C160CC19421; Wed, 18 Mar 2026 16:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851899; bh=hLF9AXo3lnRxCyN0gi/H0Xuz7Ot4l/b2adjyOOaaEI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RNfQrjyvgBvtGHNPRo0OANz7BA29qWKQlchsp/bqemK0aECOmY8tq4f+iS+a9PGR4 MwjTxo2T7qsCvgLRzBuxzrnpjjBRloM2x4D2hWjG2Yd1REMceziX2FblGMQUQ30e9s 2W3eApiKQz5bkB6NnzS2+nXXuR+GoGD02oqb4/Py9/2MdUXz220l6oxyZh2E6qbset yvty6VkgxhEp/uRyNG4SoBe4trazcYpEq7R91YhL2OYXQvI1SUjWnMotOcCIkVo/m/ npSXFQWpnFEPYVuXO1gZua3TUxquUqyeMuSR0uTnPS6dWVAkfhlJnM+oHjMLATYumW oNexBO0QQngSw== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 05/13] net: macb: np4 doesn't need a usrio pointer Date: Wed, 18 Mar 2026 16:37:36 +0000 Message-ID: <20260318-quarters-idealism-e45402bd5fed@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=785; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=F9UBzeUId/kao0gPpAeZyIh8nfmZqgwg0AfcGoyheCk=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlx8mCM8kYNLeVfI0Qs3X+bzM+wTKT9ctPqkXbrP6 181pX1XOkpZGMS4GGTFFFkSb/e1SK3/47LDuectzBxWJpAhDFycAjCRM1YM/2Prs0VOlm3T73gr 9kH07nV1/p/ZX6WXc5zUcJr35deUh4cY/sqvdHLptvRKmME+xeWxG090hMSfjWeOq2U804rcUb/ 1JTMA X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley USRIO is disabled on this platform, having a pointer to a usrio config structure doesn't actually do anything other than look weird. Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 1f9e46cf7e1cb..414a8fa3f99d9 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5349,7 +5349,6 @@ static const struct macb_config np4_config =3D { .caps =3D MACB_CAPS_USRIO_DISABLED, .clk_init =3D macb_clk_init, .init =3D macb_init, - .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config zynqmp_config =3D { --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1345736B07B; Wed, 18 Mar 2026 16:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851905; cv=none; b=fpybxaYnXzZf8gMrClQFwh5WHqUlLzmpCc34VEiDKMXYN1N2fCwQBDBvZk3Q2JAsXXvh+tsOn8clccMRygjNZE2dNtx0FghjAQ/aAVvpl5yndIyb7CC2kHgXSgnLRb7xsKm/td6h6TNhYsF149waFkDMWtFZ27i7RKYip0vr9LA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851905; c=relaxed/simple; bh=ljysWJaHe8TEOROZCjjrq6HOXubs9dLzcABTz31qQqc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=knn6uLwdsP4zIABWgJj+MSWkC5ggRB+QAvRyUzEptr+lAlzsxpCWF5M06+go26pvw8NOCdCBWi4eoNLpCSa5HYyHIg6b8/JAxfL/2Lx1joOFLLejVQ5P+j4U5qEoX8i3q5qb2mjJywA13Fbv1dKsC9+E/xVXuZPRkrp0QExyEko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Pt1+/bFS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Pt1+/bFS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72D26C2BC87; Wed, 18 Mar 2026 16:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851904; bh=ljysWJaHe8TEOROZCjjrq6HOXubs9dLzcABTz31qQqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pt1+/bFSyPfyR7EfakLUiHH7YcT8rL+LonjflK7Ac4b71qiNoQOTA66oNgr0FZqo3 MZ/M69ixXjkOTSl5t7D8g5Ag5sioFfI15HaP4lZvE/+Nz2zLWm3v89mzvtheCh85M6 LtR81UlxyBFXd4U49IG9NQvJa7L9gtGeZ71CA1bK8m7Sipc96Usw/ja/cI94OIJYmz 9W0fmQmYm8hz3Jk+KSAMw3x7JUtN/Sfxh1nGhU0Ne05eSljL1V/TZd2qia9xhkaVN1 UIIeQ+2z3Mz8+EKKHRcy66fDbwaI5DGFd/F0nQNGYVyuldnHF6YENI/HsLNzsHoo0e cMpH2O+FzCNaQ== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 06/13] net: macb: add mpfs specific usrio configuration Date: Wed, 18 Mar 2026 16:37:37 +0000 Message-ID: <20260318-reversal-void-f83a66086cf4@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2759; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=RSFyKfnVzDv/pOh5f8+B27Gurr5waqnAxeJRhx9T438=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rly8U7M26a3s1VtuvrKNgdLa9laPD8oECFbtfCKn2 xzXYzmlo5SFQYyLQVZMkSXxdl+L1Po/Ljuce97CzGFlAhnCwMUpABPRTmZkeHeJ+ZTnDIfnKQEH 9e2PPVj9PUDQxs7m/4uNz86KNQX+dWX4H75j9qzrx840K04uv1F99/Da5CW+KYkyGVvn+alVNDw 7xQ4A X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley On mpfs the driver needs to make sure the tsu clock source is not the fabric, as this requires that the hardware is in Timer Adjust mode, which is not compatible with the linux driver trying to control the hardware. It is unlikely that this will be set, as the peripheral is reset during probe, but if the resets are not provided in devicetree it's probable that this bit is set incorrectly, as U-Boot's macb driver has the same issue with using usrio settings for at91 platforms as the default. Fixes: 8aad66aa59be5 ("net: macb: add polarfire soc reset support") Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb.h | 2 ++ drivers/net/ethernet/cadence/macb_main.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index 9cd565cb87e4c..cdb9fb2218c6f 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -781,6 +781,7 @@ #define MACB_CAPS_NO_LSO BIT(24) #define MACB_CAPS_USRIO_HAS_MII BIT(25) #define MACB_CAPS_USRIO_HAS_REFCLK_SOURCE BIT(26) +#define MACB_CAPS_USRIO_HAS_TSUCLK_SOURCE BIT(27) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 @@ -1214,6 +1215,7 @@ struct macb_usrio_config { u32 refclk; u32 clken; u32 hdfctlen; + u32 tsu_source; bool refclk_default_external; }; =20 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 414a8fa3f99d9..b476bc9663ecd 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4650,6 +4650,9 @@ static int macb_init(struct platform_device *pdev) val |=3D bp->usrio->refclk; } =20 + if (bp->caps & MACB_CAPS_USRIO_HAS_TSUCLK_SOURCE) + val |=3D bp->usrio->tsu_source; + macb_or_gem_writel(bp, USRIO, val); } =20 @@ -5244,6 +5247,10 @@ static const struct macb_usrio_config at91_default_u= srio =3D { .clken =3D MACB_BIT(CLKEN), }; =20 +static const struct macb_usrio_config mpfs_usrio =3D { + .tsu_source =3D 0, +}; + static const struct macb_usrio_config sama7g5_gem_usrio =3D { .mii =3D 0, .rmii =3D 1, @@ -5376,11 +5383,12 @@ static const struct macb_config zynq_config =3D { static const struct macb_config mpfs_config =3D { .caps =3D MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | - MACB_CAPS_GEM_HAS_PTP, + MACB_CAPS_GEM_HAS_PTP | + MACB_CAPS_USRIO_HAS_TSUCLK_SOURCE, .dma_burst_length =3D 16, .clk_init =3D macb_clk_init, .init =3D init_reset_optional, - .usrio =3D &at91_default_usrio, + .usrio =3D &mpfs_usrio, .max_tx_length =3D 4040, /* Cadence Erratum 1686 */ .jumbo_max_len =3D 4040, }; --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8171626B2D2; Wed, 18 Mar 2026 16:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851910; cv=none; b=csZl6BIpyDyBsMLL3REgXCZpinIxLynq8+1I69H8z1Us1VEHpBxiStnqV9PSN8+EaggbldGBrmJh2t27frGaFfHM8KKRjihpdF+tJIZxPEAaBVBfT04wteUcRDY0+MbQYEp2gvp91Gkreg1PjcmAqcsd6v42YPGfbIV4/PM4AuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851910; c=relaxed/simple; bh=XKo6oEcfxrAO5a6uL1jOlJ673A3wAiggYrYhD1OOv/s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WCZBNot8hhoz5Nle2GKYh+zLI6HHB71brwz8hNeHLvhQe4WGIlnrpJZgwwe148S7yRXsFS9Xdy1Zv8dKqGxYh+FZIAZCb04WDJlteKNSOLQGgoNW1YQawIfxYiGq5ziK1PRtuMIiikPJAtG4zjS05e1aihWBqeLsC9EaH6ozWNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZOTU+wyk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZOTU+wyk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22AC3C2BCAF; Wed, 18 Mar 2026 16:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851910; bh=XKo6oEcfxrAO5a6uL1jOlJ673A3wAiggYrYhD1OOv/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZOTU+wykhR1t2yBz7HLBWylJ8vzW13aWPZ5+cme2mPJx4PzhYH8SLecjV2v0jYSMM rCnbFdysf6KC+y4tEV9Qr5vGbZHvEoaZdwRK1vzjvswF6RM/zMnBBr28UJIyZ7+EX4 yqzkpIHW1E5bYHEAb4Eh4pofVFQssXnWJmAUKDyPGmSAnCU7e/cfMxjLqxFhNR9hWC 0/JqErQPkkNySNiaGwV3usP08phJzQciOGuCJA4moYNO6xNeCtXN5TB7M/bBZHEUHs 99gpoP7vKnuJnBErpGbXBsW6RX67vegDO8QlkpoH3QYCM53lDLo4eQhSO7bcJjEwKv mH4G1JlHs9a4g== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 07/13] net: macb: warn on pclk use as a tsu_clk fallback Date: Wed, 18 Mar 2026 16:37:38 +0000 Message-ID: <20260318-greeting-tipper-70bbe3e4f5d2@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3276; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=NwKelKp1tigxckCA+KrqnMxOmrCbE/r2GTIcp/cWLQA=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlw6dNsuYFtacMqq7q//1V4qRC1xWLXjl59nRwRT5 cVQD8X9HaUsDGJcDLJiiiyJt/tapNb/cdnh3PMWZg4rE8gQBi5OAZjIuShGhs1Hfp3gPfGZp1L8 9r4Xi9qTXH5mVOaUZV6Z6bdTfJfyRmNGhmnxkvsuzdzd96Rq+1n9OsEX/64UrBBcVrdFv/2o16Y nyzkB X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley The Candence GEM IP has a configuration parameter which determines the source of the clock used for the timestamp unit (if it is enabled), switching it between using the pclk and a dedicated input. When ptp support was added to the macb driver, a new tsu_clk was added to represent the dedicated input. While this is understandable, I think it is bug prone and that the tsu_clk should represent whatever clock is used for the timestamper and not just that specific input. >From a driver point of view, the benefit of taking the conceptual approach is avoiding misconfiguring the driver when the hardware supports ptp (and it is set as a capability in the relevant per-device structure) but no tsu_clk is provided in devicetree. At the moment, the timestamper will be registered and programmed with an increment that reflects the pclk in these cases, but will malfunction if the pclk and tsu_clk frequencies do not match. Obviously, this means the devicetree incorrectly represents the hardware, but this change in approach would make the driver more resilient without meaningfully impacting correctly described users. Out of the devices that claim MACB_CAPS_GEM_HAS_PTP the fu540, mpfs, sama5d2 and sama7g5-emac (but not sama7g5-gem) are at risk of having this problem with the in-kernel devicetrees. mpfs and sama7g5-emac have been confirmed to be incorrect, and sama5d2 is correct. It may be that the other platforms actually do use the pclk for the timestamper (either by supplying pclk to the tsu_clk input of the IP, or by having the IP block configured to use pclk instead of the tsu_clk input), but at least two are wrong, as they do not use pclk for the tsu_clk, so the driver is registering the ptp clock incorrectly. Add a warning if no tsu_clk is provided on a platform that uses the timerstamper, to encourage people to specifically provide a tsu_clk and avoid silently registering the timerstamper with the wrong clock. If the pclk is actually used, it can be provided as a tsu_clk for improved clarity in devicetrees. While this changes the meaning of the devicetree property, it is backwards compatible as there's no functional change for platforms that didn't provide a tsu_clk and the changed meaning of providing a tsu_clk in the devicetree does not impact platforms that already provided one as the decision about the tsu clock source is at IP instantiation time rather than at runtime, so there's no driver behaviour that needs to change based on the input to the IP used for the timestamping unit. Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index b476bc9663ecd..6b37598ac57cd 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3534,6 +3534,7 @@ static unsigned int gem_get_tsu_rate(struct macb *bp) else if (!IS_ERR(bp->pclk)) { tsu_clk =3D bp->pclk; tsu_rate =3D clk_get_rate(tsu_clk); + dev_warn(&bp->pdev->dev, "devicetree missing tsu_clk, using pclk as fall= back\n"); } else return -ENOTSUPP; return tsu_rate; --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EE893BED06; Wed, 18 Mar 2026 16:38:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851916; cv=none; b=BVjUV2iM4+5DT+V9DzMyx75cb1U20en2H20ODaDIYwDL34qmLWGomgZSY1s759yW4IPxOpYm1NEm3n9QqweBwVDxmq+lHDYRG0IlmdBDKlvq99Ply0jKM+TG5Eg6oGd4elnkV/BmyeDRhiSBYcC+YNQHjgcKQmx/CLQbqRKwjQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851916; c=relaxed/simple; bh=l0HWcNcVkVo9YLSrRqspDdP84/kdc2LHA5rpvVoVGqQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l/Tpt1qlHWCk3r0Xt+dexFaC7P/yZQdODdE7UmG8uyUoY7C0Xjq+ra7TfkdDKnONXssIsoMu7wAc1V56lgyob6hGlAFO/zCCe1bNvCRH5BOjJdTiSJtaN7gmEjjgf6zt6JNogumZ+3uOrOHzdwAjBiX/9lfuzT+Rj6zAu255d4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AkLHLtID; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AkLHLtID" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7CE1C2BCAF; Wed, 18 Mar 2026 16:38:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851916; bh=l0HWcNcVkVo9YLSrRqspDdP84/kdc2LHA5rpvVoVGqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AkLHLtIDUQIcR2f35rUx0ynntzvhUqWnX0VejtaIQfCBp4uwxqQ1L2gf0dpXF6/Nn tdtHZHVK/kSEZidI+iHSEtDrAr6jOKAtyqiglrDAXxosW+Y8GM4pJVK+5uE122EztP VbowwyDnuUwuiuGl+ePXAURXYRyxLk1aRZLijSNvbnXRn0lKyhqUswGOZDaNlvyoxi FNOU51U0197+BQJB3uW87xqZpwxdva29it6s701LUCrH6sAOIRhsUjT+ccW60PHT4P T/lnJyPZAIZAnpjcdc0PqTOtByr5xiqQYAl5/hW1vJSvjCOwFmKwmatgO7toRd7zx1 Z/4yzhyu5yRGw== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 08/13] net: macb: clean up tsu clk rate acquisition Date: Wed, 18 Mar 2026 16:37:39 +0000 Message-ID: <20260318-doable-precise-3952562ac964@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1291; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=pBzsAzv0f5XjXC1axq0Olq90oNiYo0A1zmrCQdWDjrw=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlzaPCHYT3DXL+nzPRp1L578ODU9dFqEkpHUg7pZW 3+6iEmqdpSyMIhxMciKKbIk3u5rkVr/x2WHc89bmDmsTCBDGLg4BWAiQWyMDL/SrsSz9T8oc/Lc 7HJvY+iMe7WfxMV09uQYTFhvHvfwrxUjwzPZqDVn0o66VF1PSZJJeO+9pSupqnWDfOfCl4461s8 u8QIA X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley tsu_clk is grabbed during probe, so doesn't need to be re-grabbed here. pclk is mandatory, probe will fail if it is err/NULL, so there's no need to check it here or have a !pclk 3rd arm. Simplify gem_get_tsu_rate() to account for these facts. Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb_main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 6b37598ac57cd..38e75c2e097bf 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3527,16 +3527,14 @@ static unsigned int gem_get_tsu_rate(struct macb *b= p) struct clk *tsu_clk; unsigned int tsu_rate; =20 - tsu_clk =3D devm_clk_get(&bp->pdev->dev, "tsu_clk"); - if (!IS_ERR(tsu_clk)) - tsu_rate =3D clk_get_rate(tsu_clk); - /* try pclk instead */ - else if (!IS_ERR(bp->pclk)) { + if (!IS_ERR_OR_NULL(bp->tsu_clk)) { + tsu_rate =3D clk_get_rate(bp->tsu_clk); + } else { tsu_clk =3D bp->pclk; tsu_rate =3D clk_get_rate(tsu_clk); dev_warn(&bp->pdev->dev, "devicetree missing tsu_clk, using pclk as fall= back\n"); - } else - return -ENOTSUPP; + } + return tsu_rate; } =20 --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 080413C5DB0; Wed, 18 Mar 2026 16:38:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851922; cv=none; b=E1/cLNqeypvO/9ACqQYiZN2A7druOc0PR9dQi7cAkBP8f0wckMHXurF5W/TNnBsIUoXPBHJL814jGnWhvshbMl1MHR1d6uSjjYopX4x8CSwJMFsyjqXyKR7SLx7aIa3VWWr8apdSCGGGvF3gKdaeft54QGkXOXfXkWmsHCK+1DY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851922; c=relaxed/simple; bh=gjHC8nKBbyN/J7nUktQURQT8MLrY5TCbtclmLfjJxcY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cktNEwN43b3PJdu0v3OMTnTBQKLrfXIL0cbf+uwHvB0TwXz93iHs9dlCVK3+0HoT3QZwpJY7rKWcjy8UC7xAK+h0nvohx2YILrjN3tSKtniWXV6dByEarO9He7uGij/N9gz1+V2ymmmGSlShv2NAeiBllN9E8i5RmF0KDiccFx4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S/FKct6+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S/FKct6+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7823DC2BCB2; Wed, 18 Mar 2026 16:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851921; bh=gjHC8nKBbyN/J7nUktQURQT8MLrY5TCbtclmLfjJxcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/FKct6+uK+T5Tfm5J8abXN6B2PFfJyBjsDFx4A5VbcORHRuI5TwGXnhQhk2Vyfp4 gCSu1s0vr49Y6T6FxWP+l63sxrbo+GlzYbtXmFZLCgU3PQS85P6sjtRKEn6eKnwJnP DeNzS8TcTHDf3pJwsvcd+9rmmM2O7Lk1kcVM3xtHwRvo1nRkd02wCXh9yMe+qd6xmy QHPlwPgxCMeUjLrsFX1c63Xu5MuHmIZQsHz4M/S76YPAdrMjAtpl8tuvOmkbRQP7BQ TIdOq1W/bsnwS/XN71qoM1DrIydNUhRDzmA1FmjRtlKHDzrILTjfjAhmQO6vwmX34i vo2aTjY1Tc27Q== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com, Krzysztof Kozlowski Subject: [PATCH net-next v4 09/13] dt-bindings: net: macb: add property indicating timer adjust mode Date: Wed, 18 Mar 2026 16:37:40 +0000 Message-ID: <20260318-overdue-rotten-0edf34901a3d@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2116; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=g/wRNKNLFPT+82I0uxzexOCw4Xbz/Y2VsmMJeulMEF0=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rly6LfIuj32O8wEvx7OSbabC1dvdlVOWHsiQ8Fghy qw5+5BaRykLgxgXg6yYIkvi7b4WqfV/XHY497yFmcPKBDKEgYtTACaS4MXwV27HlyWqCYyNx7sL Pk7lz54Xe/nHJ+upqrtFJzZwKa8MP8zwv+7fpGqmvgnnUpNCtgQbNLe3Pwyb5TAp/kVG1pp3E2q 7OQA= X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley The GEM IP has two methods for modifying the ptp timer. The first of these, named "increment mode", relies on software controlling the timer by setting tsu_timer_incr and tsu_timer_incr_sub_nsec and performing once-off adjustments via the tsu_timer_adjust register. This is what the macb driver uses. The second mechanism, "timer adjust mode" uses the gem_tsu_inc_ctrl and gem_tsu_ms signals to control the timer. These modes are not intended to be used in parallel, but both can be possible on the same device and which mode is used cannot be determined from the compatible on all devices, because some users of the GEM IP are SoC FPGAs that permit configuring how the IP is wired up. Add a property to indicate that gem_tsu_inc_ctrl and gem_tsu_ms are wired up for timer adjust mode. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Conor Dooley --- .../devicetree/bindings/net/cdns,macb.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documen= tation/devicetree/bindings/net/cdns,macb.yaml index f6df793c4af65..b9caa7e5ef328 100644 --- a/Documentation/devicetree/bindings/net/cdns,macb.yaml +++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml @@ -150,6 +150,12 @@ properties: that need to be filled, before the forwarding process is activated. Width of the SRAM is platform dependent, and can be 4, 8 or 16 bytes. =20 + cdns,timer-adjust: + type: boolean + description: + Set when the hardware is operating in timer-adjust mode, where the t= imer + is controlled by the gem_tsu_inc_ctrl and gem_tsu_ms inputs. + '#address-cells': const: 1 =20 @@ -199,6 +205,15 @@ allOf: properties: reg: maxItems: 1 + - if: + not: + properties: + compatible: + contains: + const: microchip,mpfs-macb + then: + properties: + cdns,timer-adjust: false =20 - if: properties: --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D92A23EF659; Wed, 18 Mar 2026 16:38:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851927; cv=none; b=n2q19E8UqF5ExXd5gHMf2UCNa0tpma3nEf70cMGYvdZjaBhWvXbwlMLawPhk2v/gQs5AoS76MrvjWlNIhfJxAQRRL7Qv2sLfnq5SGhR9yYaQujF2NKIcWKZLmo2yLYL2DmwCqmyO1V6l+FjV3xBYyYOQcVr6WGKyUyULhJS7Mc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851927; c=relaxed/simple; bh=9DLc73kRovjX7PmKOfMC6v7DvLF8VkwF6ivlc5RlT3Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y9dJFPyE3z3cEn66MIyLlL5OyTO+M0cH77kj6zQUh5tHZQrNuv0pVARG/bVaBoWVZZWoJSc1k/+9ZyXYexo+4/mPCbBmgkM8qoCScAbKjMlm4Anm9qvyjxm88NU++ai5ElQB7mSMhSGfU9OSR5auKggzGaWP87E5Nd/AfIXmZsM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YIOHMbPJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YIOHMbPJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FFC3C19421; Wed, 18 Mar 2026 16:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851927; bh=9DLc73kRovjX7PmKOfMC6v7DvLF8VkwF6ivlc5RlT3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YIOHMbPJf94NLNUV9jBhDq41CqmoAepK1RX00vXTypZdd1Gf/FXdTqWm+vWLDl/Dc z5HZrY53xhay2S8W2IlAc42Oprs3LMHYhN1SSKUmrLI1+Qtm/9frgSpmvy2NsH2uw3 HeUtp/DW4zBd/LAMS1FqxkwOnm/tmY2Sw8+jwQghQxKzIUmv6fa++lojdsEtg3/Xjy lg0i3TCZ5CTPJWplenL3FZsND6BhFUW+OW/DdWh2qGd3hWlcESXSPOxysSu7XGBqz0 5WJU2rnPtXAd/v05vFNmVtOV/1M/OxHRzOgmeAulaENRNxEcw8u8QXvRhaCVlIJfU0 tONegjVjLtA8A== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 10/13] net: macb: timer adjust mode is not supported Date: Wed, 18 Mar 2026 16:37:41 +0000 Message-ID: <20260318-armless-generic-9845d484aca1@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1214; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=OqQujPb90kYRx/KgLbRe0CGbTbZ7JG8YWaMugKJ3peY=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlyK+v2e34jRK2GFxczui4m7r0TEORfH88Rvk5v+P OhXxxqPjlIWBjEuBlkxRZbE230tUuv/uOxw7nkLM4eVCWQIAxenAExEby/D/9Km8GvK54x0bmxi OhdTdYFlt3b2B7XkFq4j57JfmAk83MXwh+f2hZZnh3OtsmtMv9vueLa9saIl62WFk/cDw6d+M+c EsgIA X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Conor Dooley The ptp portion of this driver controls the tsu's timer using the controls for "increment mode", which is not compatible with the hardware trying to control it via the gem_tsu_inc_ctrl and gem_tsu_ms inputs in "timer adjust mode". Abort probe if the property signalling that the relevant signals have been wired up is present. Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 38e75c2e097bf..3e0ab23e9b9b0 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5577,6 +5577,13 @@ static int macb_probe(struct platform_device *pdev) =20 bp->usrio =3D macb_config->usrio; =20 + if (of_property_read_bool(bp->pdev->dev.of_node, "cdns,timer-adjust") && + IS_ENABLED(CONFIG_MACB_USE_HWSTAMP)) { + dev_err(&pdev->dev, "Timer adjust mode is not supported\n"); + err =3D -EINVAL; + goto err_out_free_netdev; + } + /* By default we set to partial store and forward mode for zynqmp. * Disable if not set in devicetree. */ --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58DB1392C40; Wed, 18 Mar 2026 16:38:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851933; cv=none; b=BDvW2VivdMhiFJw2T7dzWgiagxtIp6G5alXIsXQ92GO5dN9TcSPXYUt5tWeeU742a6oS9uiCD2rqMbYO67S4UkktMVruEHOtY//SILWWwt8ibyhfVwiJYE9ubQPpKRmQev5faM3tngghUMkDtpJE5XcAzTfCu6LGJERVYNSqAYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851933; c=relaxed/simple; bh=i7QiZWLKSiDuy+JWZoWlsnw6MxIl6xp8yCXQ6R5f7pk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PCEb9Cl79H6E/zB2yp3iLCBX/IrL2t5jkiBdhyLY+SMPrkZy0bt3gv/WFeLm87sV6LHttPKKg32A2XuRwAZCCZw1mVJQo1Tbn+yEcSdNlcEFZIKQqcwueO3y83CkX1rXju4f/0J8ZoTbnAft2o2bmX/LhIQZD8RoiW2arjoX+HE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OnOzb99I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OnOzb99I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F363BC2BCAF; Wed, 18 Mar 2026 16:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851933; bh=i7QiZWLKSiDuy+JWZoWlsnw6MxIl6xp8yCXQ6R5f7pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OnOzb99IJdzWRWPppb1WwQY3nqJoJLbNJyKhbBRYNPyDj33oM8Y7KNUf++z49F4tr 08LHUHNmcTR34Lz24Rvg6IjBI7XmMfwWPebLtOTS/+cQUVoCqa0cuVRrA1IrzWHthQ 7ijkzOPszVg/blmXINrMkRgEZ0Z/FYBsLG3Ly6IeRcrPteuFrWThhrPYcToEWoPveP cc054tjPLMUZwlfn8y/l/SD+oivRZsZCQhddLh0TFijA0XGitHIgtmC/R4BeRfOijJ KW5GsXXQQdiYj6ikQz86p38VDC2tXca1d4A1ugycXVQSEre4WR4AzGlF/Ymte6v/LA M3OpsC7l75SNg== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 11/13] net: macb: runtime detect MACB_CAPS_USRIO_DISABLED Date: Wed, 18 Mar 2026 16:37:42 +0000 Message-ID: <20260318-fifth-getaway-2e50f7a71eed@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=2022; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=Bd2gbW7fOvjC1AVjUN6Hv9MmZ1hZns7eUKZVvI7xatU=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlx+2fahvr/SaZ1sdZuHf+XuE5m/v7Rf1bf7a8I30 26No5tdRykLgxgXg6yYIkvi7b4WqfV/XHY497yFmcPKBDKEgYtTACbi18Twh3fVy7Muuh4BX9g5 u+63V0yYsFdh9dPEHP/L0pKL9tvmXGVk6LY57tLFzTlRJsX050+ry48uNj92eLdpwtaX786eDr7 6iQUA X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable From: Th=C3=A9o Lebrun DCFG1 (design config 1 register) carries a bit indicating whether User I/O feature has been enabled or not. The MACB/GEM driver has a cap flag indicating that HW has the feature disabled (default is enabled). Add the missing connection between DCFG1 bit and MACB_CAPS_USRIO_DISABLED. Indirect impact: avoid useless writel() on USERIO register; this is not an important fix because USERIO is anyway read-only when feature is disabled. If for some reason a compatible sets USRIO_DISABLED but DCFG1 indicates it is enabled, we still keep the disabled capability flag. This ensures we don't break "cdns,np4-macb" that sets the flag from compatible match data. Signed-off-by: Th=C3=A9o Lebrun Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb.h | 2 ++ drivers/net/ethernet/cadence/macb_main.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cad= ence/macb.h index cdb9fb2218c6f..bc025719f6008 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -518,6 +518,8 @@ #define GEM_IRQCOR_SIZE 1 #define GEM_DBWDEF_OFFSET 25 #define GEM_DBWDEF_SIZE 3 +#define GEM_USERIO_OFFSET 9 +#define GEM_USERIO_SIZE 1 #define GEM_NO_PCS_OFFSET 0 #define GEM_NO_PCS_SIZE 1 =20 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 3e0ab23e9b9b0..b11ef703575b0 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4330,6 +4330,8 @@ static void macb_configure_caps(struct macb *bp, bp->caps |=3D MACB_CAPS_ISR_CLEAR_ON_WRITE; if (GEM_BFEXT(NO_PCS, dcfg) =3D=3D 0) bp->caps |=3D MACB_CAPS_PCS; + if (!(dcfg & GEM_BIT(USERIO))) + bp->caps |=3D MACB_CAPS_USRIO_DISABLED; dcfg =3D gem_readl(bp, DCFG12); if (GEM_BFEXT(HIGH_SPEED, dcfg) =3D=3D 1) bp->caps |=3D MACB_CAPS_HIGH_SPEED; --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D7BD3FB7D2; Wed, 18 Mar 2026 16:38:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851939; cv=none; b=i/MQd+ujB0v5p0MtcmIdyfku0fPvfPPsMNvHDszMDemZm1GrV0gn5y5MgL9SL2MSYfvHrYhJ8oGUmymrzjOec3sasXNVQDckoBlvVrF1p6k+Z/O1rumQPveuYqGFLabOrnHyEqmHM/MkCI+DSUNLDRLZ+eGuRvusgRaOjrHM69o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851939; c=relaxed/simple; bh=8dYY/An492/r9LNR1y5PaEYTe8NEViY49aooNEVBQSk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bWbrL8KUBaouH1JMFJALi3/9qxW7VqGS5GU7g3hMjpqiIyzXQ03jk/JbAk5hmilpWrxXiwLHnI7NbaOLNezjTOzfdQrVprMrltHuQ2dQ3rde8YIosyZGvrQfdKSP80j3ke+oXP28t2WCmFZRnDitSZEJqgdc68LbSOL0/zN3r4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j3jcQyin; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j3jcQyin" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A381FC2BC87; Wed, 18 Mar 2026 16:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851939; bh=8dYY/An492/r9LNR1y5PaEYTe8NEViY49aooNEVBQSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j3jcQyinjnnUVd8oODV26S6DW4s+A8TA+VHAhbeYtk6kGxpnNDsPeHfxlgbKugSPf bvtKhcExITElvWVPNc5nJfGgfzK6hw3jDqCIB+u+4bFBm7HpzKq6A/7Iq2HgH0FBOK AVTKnvTYzFEtIxwfltPGpmY0ijhrJUKmw12XuiPd8JM6puem5zTU25t2jOr48i8vxD wxmvhTHXwVYW54R/kcxQ8E6fuyXzYrqH2dPuQ4TsdXB2QhbNLl2buuyQfzeHYYglLV HFthY33mIIZ8bNiwif6Dla27rHBr4k+iJ47wWNXZ196Phj4ZGTezDp2wrjra7HTghL qRDD9Qz6AouLg== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 12/13] net: macb: set MACB_CAPS_USRIO_DISABLED if no usrio config is provided Date: Wed, 18 Mar 2026 16:37:43 +0000 Message-ID: <20260318-argue-pouring-3405e33e7600@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=1255; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=qqeBZ/4pnx5PRuyO5kmFQgJF981C+Tje2OakbZeONrc=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlz+LnBCtc0thu3divRVNRb7J2xnZREPubHcJ+2Th 2aAbqdyRykLgxgXg6yYIkvi7b4WqfV/XHY497yFmcPKBDKEgYtTACZybjfD/3rLzy+vJF5ovuCt kLbBNcB2X9u9Q6cPzWfeOevvXRvZ1w8YGZ7ri/Kv8dApUWldf/P4V4fqbJMtt60FJ72Ye+rTVKk dXtwA X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable From: Th=C3=A9o Lebrun bp->usrio is copied directly from dt_conf->usrio in macb_probe(). If dt_conf->usrio is NULL, we do not want to land in USRIO write codepaths which dereference bp->usrio. Inherit automatically MACB_CAPS_USRIO_DISABLED to avoid those. This means a macb_config that wants to disable usrio can simply drop its .usrio field, rather than add the disabled capability explicitly. Nit: drop the dt_conf NULL check because the pointer is always valid. Signed-off-by: Th=C3=A9o Lebrun Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index b11ef703575b0..1a6cdc223625f 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4319,8 +4319,10 @@ static void macb_configure_caps(struct macb *bp, { u32 dcfg; =20 - if (dt_conf) - bp->caps =3D dt_conf->caps; + bp->caps =3D dt_conf->caps; + + if (!dt_conf->usrio) + bp->caps |=3D MACB_CAPS_USRIO_DISABLED; =20 if (hw_is_gem(bp->regs, bp->native_io)) { bp->caps |=3D MACB_CAPS_MACB_IS_GEM; --=20 2.51.0 From nobody Mon Apr 6 16:48:29 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49FDD3DA7FC; Wed, 18 Mar 2026 16:39:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851945; cv=none; b=aiIjd1Vq+gX8XDPJjNhnMyTxUTTcFHXnuoOKwAlBlWsWRe2di1aUBEawvyvKGHKgeZRme1efSvaoMgEll4Yh8MFOANxudWHv9P8Oht2HEMJ4pl4pC0UEOJCqVDvtYULMQ/AWH844L6e0FtExXv8FsAQ6Sdq0rPI0HZa6O+jV9cA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851945; c=relaxed/simple; bh=ty3BaLqgypDODOt527YqpORivtFzZVbC17L+oACIbBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k5doaSX9bsqCwU0HOtRxlv8r0UqFyriZLjK859XpShZyIY9V0Gbj5mvaBeFgy77tXCtf9M8vuwureK77fBnRYqVKkoD7zacBrS2P7wIZAwqjMyAhSn3BZVK7cPoK09Q7txg08l4J0foTyAWphRp5WETzXLLFrYFGw1UqH8mZYJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iW2o1/xu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iW2o1/xu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E8BAC2BCB0; Wed, 18 Mar 2026 16:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773851944; bh=ty3BaLqgypDODOt527YqpORivtFzZVbC17L+oACIbBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iW2o1/xuWOXG4BWuNImRR249QnTbcjd7z9JV/+4E89Ww7+jcJBfItklHSx1n8PSSN JtBWRcXwquOntnwp/pM4+ojVasfuDT3FogrQdqsgq22kxvXLGRqt0HwRjFCfhHGRIP /Ibh21aDl881WPs/foKjuic6Fcgff2AehiHl8Lz4DtYLxy4TuXKklOxpdb+5Skw0mk ErLY4wOLkFqHHv03+KlFBy+obgFDkcmzLhspK1lyh+piEsYwosDAyESPXOSaQT/OO+ TzlVStABXjXIlBPRzN9OnudRXmXeQZGznbNcMjY0yzMpJK3HvccWoW4c8EhONKvpmZ sLtQG9adm0+ig== From: Conor Dooley To: netdev@vger.kernel.org Cc: conor@kernel.org, Conor Dooley , Valentina.FernandezAlanis@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Daire McNamara , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nicolas Ferre , Claudiu Beznea , Richard Cochran , Samuel Holland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Ryan.Wanner@microchip.com Subject: [PATCH net-next v4 13/13] net: macb: drop usrio pointer on EyeQ5 config Date: Wed, 18 Mar 2026 16:37:44 +0000 Message-ID: <20260318-coral-zipfile-97030dc1ba84@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260318-surpass-puzzle-f94b46aa8808@spud> References: <20260318-surpass-puzzle-f94b46aa8808@spud> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=1029; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=GR05m7UpiUtffl9Qoho4kMHi+CKCpZaBmj1C+O7OOnM=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJm7rlzW/KdlOG+j7PvjN5mnlvS+mJf2qca1Z1FFUMzqm z9iJvtd7ChlYRDjYpAVU2RJvN3XIrX+j8sO5563MHNYmUCGMHBxCsBEZjMyMkzJ9j7QO3kd54zT vboJy+a7hXfEr7mkVxc68fPkN6kb7k1j+F+WEsVR/S68aZvHnmT3ngWC59cyhnlq+kZcdeoV1BA 7ywsA X-Developer-Key: i=conor.dooley@microchip.com; a=openpgp; fpr=F9ECA03CF54F12CD01F1655722E2C55B37CF380C Content-Transfer-Encoding: quoted-printable From: Th=C3=A9o Lebrun USRIO is disabled on this platform, drop its inherited usrio config. We will end up with MACB_CAPS_USRIO_DISABLED on this platform: - We have no config->usrio so macb_configure_caps() deduces that the feature is disabled. - Anecdotally, we would also land in the runtime detection codepath that reads DCFG1. Signed-off-by: Th=C3=A9o Lebrun Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 1a6cdc223625f..2033994bb1d7e 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5441,7 +5441,6 @@ static const struct macb_config eyeq5_config =3D { .clk_init =3D macb_clk_init, .init =3D eyeq5_init, .jumbo_max_len =3D 10240, - .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config raspberrypi_rp1_config =3D { --=20 2.51.0