From nobody Tue Apr 7 15:28:04 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 D4FF433555F; Thu, 26 Feb 2026 11:03:46 +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=1772103826; cv=none; b=a5Vr8GZX954JvkKwOuR7Bso5gEydTgp5prA3H7YtertdC3hr1lBsRaIRnM+I/L91hdVqqKVDQF0M+0N7Yw1kWnGa+vY3Lf4Apl2e65RKzs1CCUS6CnXnpRBxR7nod0aSpqDVRepgMMehfMwvPTue64KVlxMJOWg+LrR/Ty9mxRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772103826; c=relaxed/simple; bh=phQfqbyabbOdNqjOuj7NK2iAIoyPl/OhSuvCTIyQ0qo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=syA2lTeNe4W7pOR1gQWypF+rIHlRWgytlkEabzTxNf/WVw0Nebw4x9BLs/L0F/zxBa8CmC+4Svw9zTmC7Dp3bXn9gh+l620UIrZhmx5cY+z+Hghm4d0sIxiCDTNabo9ynJdQk1O2PS3QKcely57T7mWTG9xQhUw3BKMMxR5UysM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V4MlhLGi; 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="V4MlhLGi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC173C19422; Thu, 26 Feb 2026 11:03:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772103826; bh=phQfqbyabbOdNqjOuj7NK2iAIoyPl/OhSuvCTIyQ0qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4MlhLGiCDU2UEPxMRw+USykYsQpETX9z3k+qEG+CJYRUewxa4mpJjOC3lfBFo8xH 5GdmM2pBxpu/V6i+UBEm62Ss7zBNtEVQwZReO9jjGPohBD5teUZf9nJ9IC2N/JCVQ5 aeZ7X9T5axbqW6KKE3DeqHlUwjn5KdPD7H2L/CXj/yZysEd2KXNbJ5HqgppQi3Omdp iHrVvIERFvshZPz3kyvey1xBznsFW3TdA7L8Cy6dP3YIOoJzjBD/gz20RHLGE1crC4 n7Qn8ly8+vD5muNoNL6BAYAPo/nZVjrnZiwk3Fow6UfCfE+4EVcboWzXF1K6zv4piM ukjFxiTBMfHVw== 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, Neil Armstrong , Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= Subject: [PATCH net-next v2 1/8] riscv: dts: microchip: add tsu clock to macb on mpfs Date: Thu, 26 Feb 2026 11:03:16 +0000 Message-ID: <20260226-briskly-severity-69c2988e8dc8@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260226-snowshoe-amusable-6716d4ddea11@spud> References: <20260226-snowshoe-amusable-6716d4ddea11@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=3466; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=YBmcAd9qnWn/x3Gu0jOv29xyhvfqaOmflkLzzges9dc=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJkLNMoY0jNXFK98wBMobtnKtZbpHcfT4Ps15x/z7VzIE VIcM/9jRykLgxgXg6yYIkvi7b4WqfV/XHY497yFmcPKBDaEi1MAJhL2lOG/J3uF6xe+cON/yXdW 6M3efKrhtpzlfQ1Z4ak2J20nZHL0M/wV37Q3YGvYDbcnCS1hUdx+h4U/HtZdcm3qufilChtW7br OBwA= 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 In increment mode, the tsu clock for the macb is provided separately to the pck, usually the same clock as the reference to the rtc provided by an off-chip oscillator. pclk is 150 MHz typically, and the reference is either 100 MHz or 125 MHz, so having the tsu clock is required for correct rate selection. Signed-off-by: Conor Dooley --- arch/riscv/boot/dts/microchip/Makefile.orig | 26 +++++++++++++++++++++ arch/riscv/boot/dts/microchip/mpfs.dtsi | 8 +++---- 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 arch/riscv/boot/dts/microchip/Makefile.orig diff --git a/arch/riscv/boot/dts/microchip/Makefile.orig b/arch/riscv/boot/= dts/microchip/Makefile.orig new file mode 100644 index 0000000000000..e94f4096fd401 --- /dev/null +++ b/arch/riscv/boot/dts/microchip/Makefile.orig @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0 +<<<<<<< HEAD +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-beaglev-fire.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-disco-kit.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-icicle-kit.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-icicle-kit-prod.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-m100pfsevp.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-polarberry.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-sev-kit.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-tysom-m.dtb +||||||| constructed fake ancestor +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-beaglev-fire.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-icicle-kit.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-m100pfsevp.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-polarberry.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-sev-kit.dtb +dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) +=3D mpfs-tysom-m.dtb +=3D=3D=3D=3D=3D=3D=3D +dtb-$(CONFIG_ARCH_MICROCHIP) +=3D mpfs-beaglev-fire.dtb +dtb-$(CONFIG_ARCH_MICROCHIP) +=3D mpfs-icicle-kit.dtb +dtb-$(CONFIG_ARCH_MICROCHIP) +=3D mpfs-m100pfsevp.dtb +dtb-$(CONFIG_ARCH_MICROCHIP) +=3D mpfs-polarberry.dtb +dtb-$(CONFIG_ARCH_MICROCHIP) +=3D mpfs-sev-kit.dtb +dtb-$(CONFIG_ARCH_MICROCHIP) +=3D mpfs-tysom-m.dtb +>>>>>>> riscv: dts: microchip: remove POLARFIRE mention in Makefile +dtb-$(CONFIG_ARCH_MICROCHIP) +=3D pic64gx-curiosity-kit.dtb diff --git a/arch/riscv/boot/dts/microchip/mpfs.dtsi b/arch/riscv/boot/dts/= microchip/mpfs.dtsi index 5c2963e269b83..ccd7c2e4724f4 100644 --- a/arch/riscv/boot/dts/microchip/mpfs.dtsi +++ b/arch/riscv/boot/dts/microchip/mpfs.dtsi @@ -448,8 +448,8 @@ mac0: ethernet@20110000 { interrupt-parent =3D <&plic>; interrupts =3D <64>, <65>, <66>, <67>, <68>, <69>; local-mac-address =3D [00 00 00 00 00 00]; - clocks =3D <&clkcfg CLK_MAC0>, <&clkcfg CLK_AHB>; - clock-names =3D "pclk", "hclk"; + clocks =3D <&clkcfg CLK_MAC0>, <&clkcfg CLK_AHB>, <&refclk>; + clock-names =3D "pclk", "hclk", "tsu_clk"; resets =3D <&mss_top_sysreg CLK_MAC0>; status =3D "disabled"; }; @@ -462,8 +462,8 @@ mac1: ethernet@20112000 { interrupt-parent =3D <&plic>; interrupts =3D <70>, <71>, <72>, <73>, <74>, <75>; local-mac-address =3D [00 00 00 00 00 00]; - clocks =3D <&clkcfg CLK_MAC1>, <&clkcfg CLK_AHB>; - clock-names =3D "pclk", "hclk"; + clocks =3D <&clkcfg CLK_MAC1>, <&clkcfg CLK_AHB>, <&refclk>; + clock-names =3D "pclk", "hclk", "tsu_clk"; resets =3D <&mss_top_sysreg CLK_MAC1>; status =3D "disabled"; }; --=20 2.51.0 From nobody Tue Apr 7 15:28:04 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 57DC13242D6; Thu, 26 Feb 2026 11:03:52 +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=1772103832; cv=none; b=RrSm4cjuswg7hrHiuUXYHZYIM0E6S3pjch/R++khL/AQ7NWzfPqIF1QyvntIoNKbOwhbSE4QENtqdkwuuOokA+5druONr5QfxrEM6G7yPAWjIy5VbRUnd8EQ23/fBxa1zHRuM51/AcJvU0oTN7eWDOFBSwABvr6bZJ5lJ0FxISw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772103832; c=relaxed/simple; bh=E9amaoOmm7pX/DMUDHqpi4Pk9R8Itnc0dfb42Qcgnlw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fhOB5vUkdf/gl22WOdQlMjQhU7R8wcud59bcXrCJ+mYmSZCUrzj7IWMLeCTZZwVGq9QL4R19zPhKnrWhvU463j1uIwun0QYuSrdKMBX8ZTYyZG9SeN1GZX0wC86yBOzXsAs8OV++62blz62da+VD/bWWnbYCgWuLy0xQXhR5x3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mr/Euy6/; 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="Mr/Euy6/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3738C116C6; Thu, 26 Feb 2026 11:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772103831; bh=E9amaoOmm7pX/DMUDHqpi4Pk9R8Itnc0dfb42Qcgnlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mr/Euy6/6+bqBGD3riPJhZEFTrLG6oV2cLAdW7rExTnNYEHQ8ZUChdbRXNOvrS8D2 wMhENL/ydrY+6k7i2drb8sB3ngzV1THRB/ke2V0/vQegMnq9PLvEyZbT4bad6AE0rs olXpIK86nXUnAoqpj7ll35Y0EnSNbTVh7X/bVYqKVzBjDNHpbAkhsbgsx00hcXqxvD vy1OaA8+9CSIir4cKd+kjlEmuVF14JvtSOkKbpv3V/apCT94/GRCLXBmCLjza9fCCk Dq/y+ne2oDeMiVkvEiGGjHbrHbQYKeMBJtdJ23dJ3G4T3h/vDZnkddLBhlxBY3FSU+ BhR6RyOMpgZog== 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, Neil Armstrong , Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= Subject: [PATCH net-next v2 2/8] net: macb: rename macb_default_usrio to at91_default_usrio as not all platforms have mii mode control in usrio Date: Thu, 26 Feb 2026 11:03:17 +0000 Message-ID: <20260226-enjoyer-shock-e17f9dc7cbdb@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260226-snowshoe-amusable-6716d4ddea11@spud> References: <20260226-snowshoe-amusable-6716d4ddea11@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=T9yy5Dq8adCJAfqRKnWHBtETHfilLNLHomuKtk1AoxY=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJkLNMqfWO/jmVHsO1ei6E513TWOHX9rm/dHCsQq3anX2 hT672hYRykLgxgXg6yYIkvi7b4WqfV/XHY497yFmcPKBDKEgYtTACbCfI6R4dnlDqW5cvZvS9/1 NBT4Lmo4eHRC6qRPW7ccCap3+SmRZMTIcLDVtbV3UaiEUuzJhLWdDctDl70Q/cxhEcTLt1Om9Zg sMwA= 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 dependant, 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 Tue Apr 7 15:28:04 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 E878E314B6B; Thu, 26 Feb 2026 11:03:57 +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=1772103838; cv=none; b=iFk7kgEyOHcU6DC853UicEEGqIG9DRIFtgkqTGK0107gPApE7OmytWG89AmaLpOfyoIisyoyuHtuXbTf5+F22fuvR15OrG0kKfV4vwje0N4HzyyZ7fbJeO+BpqheDvUvcJHEWkC16jwkWTw5CaH8eP1/OfjnjQX02T8lTZzR9/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772103838; c=relaxed/simple; bh=gCnpueCUTyu07waHpq7nu6PTRZfJXR3EGhkw9ZM+/bw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rebWwsZn/42R8uB6JHFtnY4xAv3xsp3/IavwIpG+M17h72SJNzTup8jrl3Tg1QN39HG9lSK76iYIGwQdnXWoAKgh9sQl7guHUSd20k7Z69A3RC9+Aeuw+d/PDfnPF4QmY5gad4QCWTIaoDuE6FiFuve5/euvjXbqsEq3QjIgh+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HsouwWvo; 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="HsouwWvo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A557C19423; Thu, 26 Feb 2026 11:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772103837; bh=gCnpueCUTyu07waHpq7nu6PTRZfJXR3EGhkw9ZM+/bw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HsouwWvobVKDxezQCD+XbTxcM+ndewpB+KFiy78v15I9+SCwrRXK+3nDJ1JcFXsdn gda+mhuyzdEta0JkEl47xVy5nII0q4LeF0yxIVzfT/MkxLwV9QDUGRlVeNQs1Efrok QPkxW5XhkCiHDvQ5sZ5Tz7ErecxmP1M64nPOuKhMqeeuIyF2RD/dqO6XgUamgGfB2/ mmFFSusZ6awJhrXAONd7HpV5crDNzg/Pdzbx8rtaEUacDZWYlv9BldaL40ngskDk3N V3rkMu46GQx60ut+9GynTCeMxDUToKi5nCvT4irRGYUSLMe5tzfJ/iRvrUuREHz7pV k+7IC11hUM/JQ== 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, Neil Armstrong , Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= Subject: [PATCH net-next v2 3/8] net: macb: np4 doesn't need a usrio pointer Date: Thu, 26 Feb 2026 11:03:18 +0000 Message-ID: <20260226-penny-steersman-639cb0817c7c@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260226-snowshoe-amusable-6716d4ddea11@spud> References: <20260226-snowshoe-amusable-6716d4ddea11@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=820; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=4mwnK4Cru/aMA40im7P98cvEdQM5//cBujdDVwQ8uN0=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJkLNMrfHPrcabRzr2xCx87Vyp5a6SVrumXj/2na1Imeb phmV320o5SFQYyLQVZMkSXxdl+L1Po/Ljuce97CzGFlAhnCwMUpABN5/ZThn2Gh0rzsEuavHqfU VRN9pu1/EG/nWueS1/7n+Fw7ZkPFfob//ikyS5ieXDmu2KDwJXfTb/+ZARaiYneXqqYXn38hzOT GDgA= 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 778d2115f66fc..ddbb0c327b303 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5315,7 +5315,7 @@ 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, + .usrio =3D NULL, }; =20 static const struct macb_config zynqmp_config =3D { --=20 2.51.0 From nobody Tue Apr 7 15:28:04 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 BA9E2336EDB; Thu, 26 Feb 2026 11:04:03 +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=1772103843; cv=none; b=LhXaePrarsGZmBrYT0yMzIkn9iHiwdW8e/GX+rJcmDHRFco8D0GeqSrRkMYO3J9GmYBvIxJ2fAoJ338acMG3aILVgk/0e5irLreRrYps4zTXNua9mVMbKnngjaFJRFja/GU0Jf3FUY4zH8ngVei76q3ULDJHKdvE5B8okmNXr1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772103843; c=relaxed/simple; bh=cRLy02UueWkhYtPAXqzBTz1JMrUCbuvc3pWwyLTa2RQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=COsS9DWRv9LXChHym9tNTVpiekAMM03ESvnwZr16FivuKxr6Tl+aUizyUyGqiWbsri/IjYzmS0o0mAIdKQqD5mn0PrJ7jxOH4ONRTXpw1s/AkRxLH1IprCxexpwweY4XblTYKF69UGivJhVHivw7BaXlW6K7Jh9RDqqUi8zdzkQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AgsAhSG5; 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="AgsAhSG5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1075FC116C6; Thu, 26 Feb 2026 11:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772103843; bh=cRLy02UueWkhYtPAXqzBTz1JMrUCbuvc3pWwyLTa2RQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgsAhSG5LlZBGa6F6Ms0QXLm4aksoIvTotknOrr7O721zePHDEvwBY27NDHEpcWH0 Cfd/DSM1PFDTbCAEuFBG8DbPdtcx7AYEVKse4r3ombyjyWLn0kZX7AN1Hu7d5Ncehb hPrjMVKefihFZXdtoGoLnJb/z8dJuPmnmPW2AQes+qiFRxTBPzO/EwAJIJzAVEP5tE vuNHlN9oD9DFAJQQ+3h9Fc+g9yAA1FYPuMnxLoDpnH6CHyLVIvW384WDXZICf64Iz5 ZoW3KutaArRsluYmqtmH8WeqxMH/bYbkeqVYnvcqjqz6lgePJXtw45NR36YWOBhDyY nWkP3bLeoWCDg== 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, Neil Armstrong , Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= Subject: [PATCH net-next v2 4/8] dt-bindings: net: macb: add property indicating timer adjust mode Date: Thu, 26 Feb 2026 11:03:19 +0000 Message-ID: <20260226-sprung-universal-b3568492b3f0@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260226-snowshoe-amusable-6716d4ddea11@spud> References: <20260226-snowshoe-amusable-6716d4ddea11@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=1946; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=h9iZgeoyt6LhJ0dyrZChFn6X/fZvC/7atHi56cOprkc=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJkLNMqLKxUv/BQNs1XyMVogt8VwwX3nLzv4ymWZLU898 7y8VL2yo5SFQYyLQVZMkSXxdl+L1Po/Ljuce97CzGFlAhnCwMUpABPZocnIcL+48M76bJPAm7xx SYcqTk6/nNsovqBsdWNEgIn19TMT9zL8r1XZpfWj/XkKb74+31LukJjIpBX/5bk6r7z+vr7J4Co zJwA= 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. 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 cb14c35ba9969..292279499d9e6 100644 --- a/Documentation/devicetree/bindings/net/cdns,macb.yaml +++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml @@ -120,6 +120,12 @@ properties: power-domains: maxItems: 1 =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. + cdns,refclk-ext: type: boolean description: @@ -186,6 +192,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 Tue Apr 7 15:28:04 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 33EDE332ECC; Thu, 26 Feb 2026 11:04:09 +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=1772103849; cv=none; b=t7aJzdkj3q0/0D3NuLXNdyJzWKDoe5r72REuGQKLcxB2ENN0zw264Y3DhY+dImHKLDT2YahI2ZD9zetMEctfEauRGSGbivgVPAjPI1ea/zgE52vmkcIsIPM2n9KIDTj8KT2mKuIUSU0PGo6unEkZ8yPtSW25gubasvVYluUJ/eM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772103849; c=relaxed/simple; bh=eeYz6zI8m7LMZepqFrVEA7MQyer3DvTEMH8GCtn3pmI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qkjKabwNgCM6erDohXK6Z0i+8F8C8WJ/akBJxPaiPJ3+jCflE5Xjzx+ZJOuwWfrEhqi8EqRejxx6khc1GqOGyl8vzH/kol2A8YwkhCdbwB9CR2u/J894yAmGAKeBBxaFVyZz8OMmZV1m0eW7FIKr5kMM2z1MdcDnAbVs4GF0CZg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NoU8M3tb; 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="NoU8M3tb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC113C19422; Thu, 26 Feb 2026 11:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772103849; bh=eeYz6zI8m7LMZepqFrVEA7MQyer3DvTEMH8GCtn3pmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NoU8M3tbmKgO4ru/+HbIjF0dJZKZwCsfpCcEULrgHAHMfAjUrlbT2LbzzwQwo9PdQ UkEy4TwZX73nGKnP57QUrzk0KOYyRNPjn2gKfnqWHPKTcBdV4jiO7CQMt36E22wRvF 9wa5NJESCGPU0+XBjAwl+ElS2KPvyBpby7qaSsENMtZpWk4wmmu/q0HX+CNLIJnScN JgaAMx3mPIHo1s2XfBcwGnmkOcN4vYC5nwAPEjZ79tAExtDW9rskZbv/swUdJ2aveX YbklJJh3/qTRXVCS0WUYgzLLPAuEOV0iXzqVQDxuFivrJ2XCRVbv/t0frp6pbIInxw 7gun6YIW9uoBA== 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, Neil Armstrong , Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= Subject: [PATCH net-next v2 5/8] net: macb: timer adjust mode is not supported Date: Thu, 26 Feb 2026 11:03:20 +0000 Message-ID: <20260226-dollop-maturing-9e3c83192ee5@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260226-snowshoe-amusable-6716d4ddea11@spud> References: <20260226-snowshoe-amusable-6716d4ddea11@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=1194; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=KRrduA/pCBBIY5BCiuiQyuvVljzb1F3SRIwOIkFLtvg=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJkLNMqn1wXsTEopsHuprm2yJW2yfGLGgY3d109kRpRmm RzyaOruKGVhEONikBVTZEm83dcitf6Pyw7nnrcwc1iZQIYwcHEKwESev2NkmNoYsPpnlInajFud /66LMaZ+jl6rc+6A8owje/00lIofZzEyvLp65MGOr97211dU6AvLXD5TzzY94tSkFxt3sxVb5vD fYwYA 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index ddbb0c327b303..fa55e6e7036f2 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5535,6 +5535,12 @@ 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"); + 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 Tue Apr 7 15:28:04 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 383582E2679; Thu, 26 Feb 2026 11:04:14 +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=1772103855; cv=none; b=k6cWAFs3fSo3f5ecmlHGNTm57DImTzjarXNQx+72BQpNxhG8TvnM0jrf2aZxmEWbYjNxeLtaz1za6oOYhmktWoAUb3DiHIeoyeVGJ0zHah0/EAeaKeQC55UN75/6CwKu3aji2OEpytCDqT1oQNMUDIa1Bxw2Z+wHzrFue3zs6OY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772103855; c=relaxed/simple; bh=i7L/N76H8SB0KejhBMqYjBa0HiXaFQo6XPzbFFF6+Jc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S5kPwr7Ex79VWkAVhZem+R5jEgGgG+zBdkcTh9q0SOoS6qVuDXfWZTxApV2voBXnIR1zijaLTMQBC5BAHLJqyhvs7UXW1zX5Fj77/wXd/ahvx/XEsc2XX0QkYnuC6kCvT1JFrk62J2zRcKMssMnaIrMHkJ1Qpy1Cjgd5PFAcAio= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QlfX5CKc; 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="QlfX5CKc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72316C116C6; Thu, 26 Feb 2026 11:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772103854; bh=i7L/N76H8SB0KejhBMqYjBa0HiXaFQo6XPzbFFF6+Jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QlfX5CKcvedHtyZUcXQLbYGcbh4Rf+Os8zmh368uAo0M/wtRV8FRZyM90hSKvWFFR zmf7U245riwqe3Tp1jWRR+0wIpKTocJkDse9WjCdDjdaxUIse1VK909/nawqFtFJvz pF88dKuKoBPeawBscU5pV9xSzrw0zE5Be/kZfog4k5DlLfsDlvRrMv3TsrXR9qb9Rb iV6efiqsdYGSnI5zwkiJ+Hl723Wai8eC9gtQfY9HvfwLOx5LXvDng+Kaqngs4M2Ln2 GvltaQzcmZRIBsLrs8I18HJAFzNuaLKd03PqT1/p5tb2zzWj7J56Wizg+Shsc4wl8e 8X7XZCgHvGi9g== 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, Neil Armstrong , Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= Subject: [PATCH net-next v2 6/8] net: macb: add mpfs specific usrio configuration Date: Thu, 26 Feb 2026 11:03:21 +0000 Message-ID: <20260226-undergo-aim-acae5e1ce48c@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260226-snowshoe-amusable-6716d4ddea11@spud> References: <20260226-snowshoe-amusable-6716d4ddea11@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=2699; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=y91dFQ2ZoMKWlp5ZpGzJrrZ9hbr9du1y0KV8vMwT6Rg=; b=kA0DAAoWeLQxh6CCYtIByyZiAGmgKHijYtkcyQ1V8ITW/d/e2iNn8sIMpKNOvHc9RmD+w+r05 Yh1BAAWCgAdFiEEYduOhBqv/ES4Q4zteLQxh6CCYtIFAmmgKHgACgkQeLQxh6CCYtLmGQD/ch58 9M29LIDrXKybkOm8p34mRdO86b1FvCtbIpjX+a0BALqqJgAbgptyFPM3NL4rQVEjgVxqBOdTrkz ftJgIhYkC 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. 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 8cb0b3778ee9e..04961658a21c2 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_TSUCLK_SOURCE BIT(25) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 @@ -1212,6 +1213,7 @@ struct macb_usrio_config { u32 rgmii; u32 refclk; u32 hdfctlen; + u32 tsu_source; }; =20 struct macb_config { diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index fa55e6e7036f2..ca141f8935d48 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4626,6 +4626,9 @@ static int macb_init(struct platform_device *pdev) if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN) 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 @@ -5220,6 +5223,10 @@ static const struct macb_usrio_config at91_default_u= srio =3D { .refclk =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_usrio =3D { .mii =3D 0, .rmii =3D 1, @@ -5343,11 +5350,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 Tue Apr 7 15:28:04 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 BFA0F2E2679; Thu, 26 Feb 2026 11:04:20 +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=1772103860; cv=none; b=P+XmxxWF+iXjGU4WoAtSd1MtLkYIBpKC+jzhlUqBzP67GVin3XJBZ0QphaiPLfGDagUWhxkYfHiBKV0EFtffHYgBG8wWRIYC8ZKHpp+WJt7qch0GhnR7Xk412Vh1LTatduLcpV6PMo2FkZ0GjQrZ2SR+mkMF/bHVE8tXVHDR4kU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772103860; c=relaxed/simple; bh=AZyqWxB8IUDeUfwf7KTkklB/ywiMAc2oAo1jnQG57wQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nQat3yw64NakCUu8HSsJfEk22b7TFrfVmQE2zYuMOexXpNUIp3rdzfVYZdXTZ1gNQTOcWQWUEhU6hPInyH1rtBA68D36QNQ8PPqnUS5w3Xa9duWoZSd/3QXT9HCeLye8Tjasy8yJ7WDvuNKehlHwzi6lzh19I6vLcB2Srrxlqlk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=puaJ6vN5; 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="puaJ6vN5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2965EC2BC87; Thu, 26 Feb 2026 11:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772103860; bh=AZyqWxB8IUDeUfwf7KTkklB/ywiMAc2oAo1jnQG57wQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=puaJ6vN5bb0wkvN2tH14Dl/RZZbEeYLSDSck7yfnYwUIZDwI5HN6UvYp44EUnl5BJ gwysPDUb45yKtO0TUtXQyxVJ7xdls3yQwkkInLWrBx4tikklo8BgYkLPxxNjg1yfIa BslI9zaX4K4V05Z4Xt40jbthmhZsas89XSnyqkUFrqsmgDjfA85bS4D/BlSvD82BxZ mmBisrDM2MtWsJCmBvGKjMEMwaFnUyO7GG/EpFTjSIbY0a0q0vx2djiYdO7Vmsh36Z sEyFOiEbeigLCsv4UYiyMorw7lZ4mnNEdiooLVjIQiTP+Gs+ouvzv2gURmpI5s3y0M 1KTfTqT0B62ag== 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, Neil Armstrong , Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= Subject: [PATCH net-next v2 7/8] net: macb: warn on pclk use as a tsu_clk fallback Date: Thu, 26 Feb 2026 11:03:22 +0000 Message-ID: <20260226-crouton-gratitude-4bdbe2aa98dc@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260226-snowshoe-amusable-6716d4ddea11@spud> References: <20260226-snowshoe-amusable-6716d4ddea11@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=2993; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=ItmiQ5vlNC1QS/7ZhO15GpA5CWwDTt/eS2Bem3qx+yc=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJkLNCpi4nWvLmkzCD+0YN2f45pMnEyf9aZ/fnxy6bajJ goZy4xMO0pZGMS4GGTFFFkSb/e1SK3/47LDuectzBxWJpAhDFycAjARywSGf4rWy2unnLRs/dPw 5bTcz58O1kUfAl5b7Pi2VXhW5/WFC04x/M9mNp/dck1n9+7p5U1vlx0WcDn1RFX96JzV5yS+fjV QvcELAA== 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 understanble, I think it is bug prone and that the tsu_clk should represent whatever clock is used for the timerstamper and not just that specific input. >From a devicetree point of view, it doesn't really matter if the tsu_clk represents a physical clock or a conceptual clock, because the clock configuration is determined when the IP is instantiated not at runtime. >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. 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. It may be that these 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 mpfs is wrong though, it does 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 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. 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 ca141f8935d48..5c24ea146d63d 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 Tue Apr 7 15:28:04 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 749E9337117; Thu, 26 Feb 2026 11:04:26 +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=1772103866; cv=none; b=AP2KK8zSU4strrAXyNJ6qLDCsu6kX7bJIfqzxPPmTiA5SLZNakHQW/sLXX3sLPx49QHpZJYKmWD1mtYXCknKUvkA0mlrHYg5tmtJd21HbchitWqOtKvyTtm7r1XD0C+X530n0JDnCgUoEnpS+AuT8Qj8Z2s0H8z5YHXHa4c8b3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772103866; c=relaxed/simple; bh=2jj3tlUPwNJyQbcAlJb/OigLgav3z1nU51BP4RvIQIg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OWGD+xq211ypyy7y9pcIlDYZK0DPYdEuuwz4ED88WEegthzB0+jabY7X59qWEr3Kkn1Y5baZ4+1Dnx1PXcAxBpKZv7hW+9KV69mH3tzJocHJzW63HrjgLXR8k8NK+6RE6sk2WgT1eg1UgtqWTjNYtYVkuGj5JJuoHe5t+h45LO0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GckSiqhb; 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="GckSiqhb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D38D5C116C6; Thu, 26 Feb 2026 11:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772103866; bh=2jj3tlUPwNJyQbcAlJb/OigLgav3z1nU51BP4RvIQIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GckSiqhb0AxxsgsyCythZCvx+sJjErEC+mAIzuC/u+lef3vKn3Vtu/nRBzGxCv7VF e91X1p0Ym8p6+kVuwLdrZwO0vu6ADhv/ZbYJyKsyu0N0tuyNSHUBZ28ElCrPMCdtRD XKvcAkdervGCuLf9svjgDwJ7ATR87loTVGyQ212Qivs/0SfmoNINYD+A3FBW+gQaPF e84QK7c5Ww6RwPbm3C+e3aUkwfqlaJbTdshkq6ybWIxkobxVH3hhwFIKrWKOXfpV5V +uae31yqWuhal4LJs877VDNkN4qJNiZIdjGaJO7I6p/cpTBIjH+SYQBtTaujv5cQsb sdIg6EIEF2v3A== 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, Neil Armstrong , Dave Stevenson , Sean Anderson , Vineeth Karumanchi , Abin Joseph , =?UTF-8?q?Th=C3=A9o=20Lebrun?= Subject: [PATCH net-next v2 8/8] net: macb: clean up tsu clk rate acquisition Date: Thu, 26 Feb 2026 11:03:23 +0000 Message-ID: <20260226-mammary-relearn-bab7519111c0@spud> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260226-snowshoe-amusable-6716d4ddea11@spud> References: <20260226-snowshoe-amusable-6716d4ddea11@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=apFAb9W0Y5znFJfOtey/gSV/AiSmELU+MiBfWgmgUMI=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJkLNCoMcy6v374hpsdCOEh8VmxBX0T3hknf5+WmVgrti /59T3NTRykLgxgXg6yYIkvi7b4WqfV/XHY497yFmcPKBDKEgYtTACbC5MjwzyavVtNw0eIYg4Kp smejfnH965skt67qziItoQxBq2ub3Bj+53PZVMzbt2rKx4+XjuwQM5B+Wiso0PZi+d213z1l47L ruQE= 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 5c24ea146d63d..f5ec283ddb497 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