From nobody Fri Apr 3 01:29:33 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 7C127313545; Wed, 25 Mar 2026 16:28: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=1774456136; cv=none; b=HjL4Xr4tCJZhxEhXzhKN0rWAGwmsUdJYb8jx6RHCUz1BpJY/iX8gDkBw43zYMou99RBS/9+off0AdQ+w72AUSvy5zW2qKNKt9rDW5I24aXiw3kCu1oKZ9k7UBywx+hY4GasdTsgh6eezhBQ81Tue3nZ5fgYJ0wCpHBjNaCCJcvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456136; c=relaxed/simple; bh=/GOCQoMgSCnMdAsfootrNAXNB36Qw+5kApOdsouWTrg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IjAQ69HhZo6omhVRRRfrZOHNfglNfCkER32CjQguIkyedHVzieMIbfZG6wyOuTKqnkvq6zlnNiD9m86gRAkKDAoufamqSIrjfbm5O1cTb6hDmeKEo22VWELr6smTqAaK9xJcOl2zxReXM+thCJDozKBerdP2/6al8Pi19I7YNRg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mhjsYCkm; 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="mhjsYCkm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B359EC19423; Wed, 25 Mar 2026 16:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456136; bh=/GOCQoMgSCnMdAsfootrNAXNB36Qw+5kApOdsouWTrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhjsYCkmXPLXlS5hIkSmVNAP9VL07zgHD3Zvx6um6gLb2T2EbGKWBzhhpiCdDkwVH CNs2Ur2EP9voDypZrBSYCRQ6CFQQAdpJvPSVxamUi/yL5mcEI0BFoHdmdRXwdSB+cs KuZu840UFgZhQqrjUl/EKSqeUYRVNYCiyg7LdYmIDmeEqhA/WJ5xlx8l/v62l73tad Hka8/Ac9LcvCV7kEKxQ8H02tV1euEgPYX451LKp9Uu2syurqtOLP0OVoOuiLvk3DjA 56mhXsAm+NYKqfnYtDZnOCJDa72GqgVIOaQOYQHcbAnqIcrQHxJRcuH1+CbQHITQ7p RG+WSwXdWHw8A== 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, Kevin Hao Subject: [PATCH net-next v5 01/14] Revert "net: macb: Clean up the .usrio settings in macb_config instances" Date: Wed, 25 Mar 2026 16:28:05 +0000 Message-ID: <20260325-rundown-unrushed-dd82c9f5c56c@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=5036; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=wNAu33LueieiL9BYBWizySOKUamk9hJkFHlIq4AwGik=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeE0M1P3X3Lq4yPVBftIztQarf4oTjyQv+SL0ovecz eJJfG+dO0pZGMS4GGTFFFkSb/e1SK3/47LDuectzBxWJpAhDFycAjARPmVGhuvZOTemRWg/+3KW y/zZ35tNDjWPLmVvfDbhlaBPiezMpwmMDB2zt82KDGoImPDn8fx3/Kn9ixYdb9Z+EzRNpX1HgYP GRC4A 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 Commit 0ae998c4efd69 ("net: macb: Clean up the .usrio settings in macb_config instances") was a misguided attempt to clean up the driver that actually just propagated problematic code. The default for usrio is actually no usrio, and already there are issues with people using the problematically named "macb_default_usrio" on platforms where the usrio does not have this so-called default behaviour. usrio is platform specific and using the default at91 usrio settings should be opt-in only. Revert the "cleanup" patch. Signed-off-by: Conor Dooley --- drivers/net/ethernet/cadence/macb_main.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 1cb49252abf5a..a48160da6e672 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5513,31 +5513,37 @@ static const struct macb_config fu540_c000_config = =3D { .clk_init =3D fu540_c000_clk_init, .init =3D fu540_c000_init, .jumbo_max_len =3D 10240, + .usrio =3D &macb_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, + .usrio =3D &macb_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, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config pc302gem_config =3D { .caps =3D MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, .dma_burst_length =3D 16, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config sama5d2_config =3D { .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_JUMBO, .dma_burst_length =3D 16, .jumbo_max_len =3D 10240, + .usrio =3D &macb_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, .dma_burst_length =3D 16, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config sama5d3_config =3D { @@ -5545,21 +5551,25 @@ static const struct macb_config sama5d3_config =3D { MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | MACB_CAPS_JUMBO, .dma_burst_length =3D 16, .jumbo_max_len =3D 10240, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config sama5d4_config =3D { .caps =3D MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, .dma_burst_length =3D 4, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config emac_config =3D { .caps =3D MACB_CAPS_NEEDS_RSTONUBR | MACB_CAPS_MACB_IS_EMAC, .clk_init =3D at91ether_clk_init, .init =3D at91ether_init, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config np4_config =3D { .caps =3D MACB_CAPS_USRIO_DISABLED, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config zynqmp_config =3D { @@ -5569,12 +5579,14 @@ static const struct macb_config zynqmp_config =3D { .dma_burst_length =3D 16, .init =3D init_reset_optional, .jumbo_max_len =3D 10240, + .usrio =3D &macb_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, .dma_burst_length =3D 16, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config mpfs_config =3D { @@ -5583,6 +5595,7 @@ static const struct macb_config mpfs_config =3D { MACB_CAPS_GEM_HAS_PTP, .dma_burst_length =3D 16, .init =3D init_reset_optional, + .usrio =3D &macb_default_usrio, .max_tx_length =3D 4040, /* Cadence Erratum 1686 */ .jumbo_max_len =3D 4040, }; @@ -5611,6 +5624,7 @@ static const struct macb_config versal_config =3D { .dma_burst_length =3D 16, .init =3D init_reset_optional, .jumbo_max_len =3D 10240, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config eyeq5_config =3D { @@ -5620,6 +5634,7 @@ static const struct macb_config eyeq5_config =3D { .dma_burst_length =3D 16, .init =3D eyeq5_init, .jumbo_max_len =3D 10240, + .usrio =3D &macb_default_usrio, }; =20 static const struct macb_config raspberrypi_rp1_config =3D { @@ -5628,6 +5643,7 @@ static const struct macb_config raspberrypi_rp1_confi= g =3D { MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_EEE, .dma_burst_length =3D 16, + .usrio =3D &macb_default_usrio, .jumbo_max_len =3D 10240, }; =20 @@ -5675,6 +5691,7 @@ static const struct macb_config default_gem_config = =3D { MACB_CAPS_JUMBO | MACB_CAPS_GEM_HAS_PTP, .dma_burst_length =3D 16, + .usrio =3D &macb_default_usrio, .jumbo_max_len =3D 10240, }; =20 @@ -5761,7 +5778,7 @@ static int macb_probe(struct platform_device *pdev) bp->wol =3D 0; device_set_wakeup_capable(&pdev->dev, 1); =20 - bp->usrio =3D macb_config->usrio ? : &macb_default_usrio; + bp->usrio =3D macb_config->usrio; =20 /* By default we set to partial store and forward mode for zynqmp. * Disable if not set in devicetree. --=20 2.53.0 From nobody Fri Apr 3 01:29:33 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 65865275AE4; Wed, 25 Mar 2026 16:29: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=1774456142; cv=none; b=M79V6EWIc5Maq78J4Tlah1cEufycuIV/D73L491ppaeeIXmi3lQbm+azrO880ApsQ4LcNbelM7Pzgc3cD2kIJJpK9v1S/E7lczny57YKlOh8Cs5DRJ3GERhgnG++GEMvmY+JqGIz2E08mJF96DKyK86VCzHaUM8jNTQqMqt8asw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456142; c=relaxed/simple; bh=sIsBFeb3KZOx+9CaK6nReqYaT2Bs7FjZ70XRq/nm1LQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N0+d9rAsfChi9AFB+3oGUC77VLmc7k61wwKRdTX+oMOExZFW50jWdS3KN5iLwdQQGwPDUlmV8JFVyzeb/bd0PKT8CT5DWkrIjO5lIy/AegyP+LGBAO0bDROCTIyd21rzgOSPQV78zmX567iDMGST0xv00WbvnqO1KtvtPmnx4Cs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g3YD66HM; 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="g3YD66HM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91272C4CEF7; Wed, 25 Mar 2026 16:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456142; bh=sIsBFeb3KZOx+9CaK6nReqYaT2Bs7FjZ70XRq/nm1LQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g3YD66HM5yTpZewBdW9bOuwy4S5lmiW9H19JeLXXBNWTnAQsIbmhQcpD/8Q0KEHwg JD+Jdn5Xu3lBukFpO8ELGoRBEoMsgJPD+GK/htrX1JPbEukkHDt27gHniq5+9aUdo1 4Aywc/dVWGrKOC1EzpkSAcSOoW6Jo/CqGDdQ/Xj2cHgIFAcBQ2T8Pjz4/sQMaXhvtP bfMHaWZzpa7qr8zOWLCaRB8tekbrV//j4359kH+JhfZsGUISGDe+xDE5xQzhpDZCEi CsCvhY03pxoC8vBlSjQJiZX4gE8MW+td18kqNCMsAVf3Ws6jopZnaFpWvtJIgmtoXW QLg1uwlytxXUQ== 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, Kevin Hao Subject: [PATCH net-next v5 02/14] net: macb: rename macb_default_usrio to at91_default_usrio as not all platforms have mii mode control in usrio Date: Wed, 25 Mar 2026 16:28:06 +0000 Message-ID: <20260325-landowner-preformed-2922ce736337@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=10230; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=CeO2TghHg4sCYeNQ+bvHpMtUsEKz3Xd7QRxVowdYzU0=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeE2TebQWnji/af7r2jcr8vT7g26Eee4qEVI9/mi/v UJx0XHhjlIWBjEuBlkxRZbE230tUuv/uOxw7nkLM4eVCWQIAxenAEzE5Akjw5IHq6t5H6afy/r2 21Pe6q6n/fwrE0XaTtaH6/w+vV+qt5zhn+nyY9LJl04FebxO/Cm3tHruew/lI1N6wm7vVf1pb+n YxwMA 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 c69828b27dae6..32217de5e0730 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -786,6 +786,7 @@ #define MACB_CAPS_RSC BIT(23) #define MACB_CAPS_NO_LSO BIT(24) #define MACB_CAPS_EEE BIT(25) +#define MACB_CAPS_USRIO_HAS_MII BIT(26) =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 a48160da6e672..05a2df6e3e41d 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4884,13 +4884,15 @@ static int macb_init_dflt(struct platform_device *p= dev) =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; @@ -4917,13 +4919,6 @@ static int macb_init(struct platform_device *pdev, return macb_init_dflt(pdev); } =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 @@ -5498,6 +5493,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, @@ -5508,85 +5510,95 @@ static const struct macb_usrio_config sama7g5_usrio= =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, - .usrio =3D &macb_default_usrio, + .caps =3D MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII= | + MACB_CAPS_USRIO_HAS_MII, + .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, - .usrio =3D &macb_default_usrio, + MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII | + MACB_CAPS_USRIO_HAS_MII, + .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, - .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, .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, - .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, .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, - .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, - .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, .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, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config mpfs_config =3D { @@ -5595,7 +5607,7 @@ static const struct macb_config mpfs_config =3D { MACB_CAPS_GEM_HAS_PTP, .dma_burst_length =3D 16, .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, }; @@ -5603,7 +5615,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, .usrio =3D &sama7g5_usrio, }; @@ -5611,7 +5624,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, .usrio =3D &sama7g5_usrio, }; @@ -5620,11 +5634,12 @@ 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, .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 { @@ -5634,16 +5649,17 @@ static const struct macb_config eyeq5_config =3D { .dma_burst_length =3D 16, .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_EEE, + MACB_CAPS_EEE | + MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, .jumbo_max_len =3D 10240, }; =20 @@ -5691,7 +5707,7 @@ static const struct macb_config default_gem_config = =3D { MACB_CAPS_JUMBO | MACB_CAPS_GEM_HAS_PTP, .dma_burst_length =3D 16, - .usrio =3D &macb_default_usrio, + .usrio =3D &at91_default_usrio, .jumbo_max_len =3D 10240, }; =20 --=20 2.53.0 From nobody Fri Apr 3 01:29:33 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 414DB3F7874; Wed, 25 Mar 2026 16:29:08 +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=1774456148; cv=none; b=QRJfPAA8o9fUtTCzJo8kT0/0c+nZlAboaE2y/iv9twGY2arohehRmhccRUzsVMz6k4AN+3+ghMNs9dzXlKs7y8mDVxwNABwTeTIA4wI6ryDQI9ONYXcuiljBaj4u8CjrV755VwJ/LcJ1bU5QEs28IAz9VVtdWhnC65l/MxHngkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456148; c=relaxed/simple; bh=jyd3EFZzWSq4QB4qpE3EwZc6Fw6cuxDBKBxVJfFLpk0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GDldmqoQxGrNUVBJu0WzMpa9eLiZFEmeEVu6BV1EMkNhVA/+mUtp2pwMNFelen+hbys4hKMNNRtB66e19mcdvlgWCVT7Ws397nrDnp0JHHQWzp63zQflcpHsLMd5hXy6JOgPwKZSqZPfT34feNiMngFWKlT0hwdiFcmNM3E0M78= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DvZ5jh0B; 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="DvZ5jh0B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FCF8C2BCB0; Wed, 25 Mar 2026 16:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456147; bh=jyd3EFZzWSq4QB4qpE3EwZc6Fw6cuxDBKBxVJfFLpk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DvZ5jh0BGnUEeFwkk64qIx3GOzxT0Br3un3UhzHl+r3XrNZeGvzgcprDDeTYjGOR7 KMDYJyEOPM7e/Ib2nQbtdUjhxNAzVNBf9Zg6+pIZl4irJT7uJFxCUQ+N72JheyOWjS 5bHdJZNnCWWiwOQUqKXJFDMVPulSjYKtS7XF3284u5Mn0AvIoWm6e4xLgZbV0vsF8/ JyhhGnO8YKrq6tfc47NzPV3ssVx2ESzuw9VosqKydA8wzrXXf+eYK2mfs4fEQ4cCIf m1npXKp/dKWy/PsbllZ6WHhjEdbA3gabWWQzmROUt/ABORLKKQJ2Gx/+fmFuRKygqc tvb0X2zhy/UUg== 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, Kevin Hao Subject: [PATCH net-next v5 03/14] net: macb: split USRIO_HAS_CLKEN capability in two Date: Wed, 25 Mar 2026 16:28:07 +0000 Message-ID: <20260325-gradient-grading-b23b9e6ef9ff@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=3507; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=jDBDApYWtlPJyWp/8XUU5y95F7rynxZ3GbEw8hdT/gY=; b=kA0DAAoWeLQxh6CCYtIByyZiAGnEDTWjcD1cQB+gKRpx1v8lFcVSElEwiP5f9w7ghpL2Y9vtI oh1BAAWCgAdFiEEYduOhBqv/ES4Q4zteLQxh6CCYtIFAmnEDTUACgkQeLQxh6CCYtIR3gD+LNNo UTkPW2l91njGiMcn9mI4r3Qf4wA4qvUJQ5hRiToBAIotn7RZKqq67pLpyIM7GHwWTu+SOAwdu/x OexFpvkcP 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 32217de5e0730..35b7129d7c1ee 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -787,6 +787,7 @@ #define MACB_CAPS_NO_LSO BIT(24) #define MACB_CAPS_EEE BIT(25) #define MACB_CAPS_USRIO_HAS_MII BIT(26) +#define MACB_CAPS_USRIO_HAS_REFCLK_SOURCE BIT(27) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 @@ -1226,6 +1227,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 05a2df6e3e41d..859d03502666a 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4615,7 +4615,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); } @@ -4895,6 +4895,9 @@ static int macb_init_dflt(struct platform_device *pde= v) } =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); @@ -5497,7 +5500,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 { @@ -5615,6 +5618,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, @@ -5623,7 +5627,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.53.0 From nobody Fri Apr 3 01:29:33 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 313E53F99FA; Wed, 25 Mar 2026 16:29: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=1774456154; cv=none; b=tCye8tUx85rOyiSwRz14bLdGYDHACqmNvdSMVDdv8MfL3exS1mvxXZS30YIUl9TICt8ED6PUJtiAY2mYmvcXU7vJ2cJ2gSF0Nj1VtVtq/mTRkT5Oqk29u0RzvsgpW447zpIrmMhfXtn0vnvMp+jIHZzt6mY/CNAHYTK4f+Bz5Mk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456154; c=relaxed/simple; bh=tPzeJ8v456m2d30UqE73B+UaLtNZYD7FTrsxSwqJZFU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V9NqRlZZTywNM9vj1bo6IqI6anbtbSKBw2mU1thI1GtLReu0812m/UY6VFuPBEkJXA8+AN2in8J+Seykoo3MQtmqK1l0QF6Hj1VTqa2MECjST667nIFgw/7LRK6fmlG/B5zB9ilzJaJahwgMJnwl0D5FQ2xqRzqgkNd4/yne38M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s9/qQCEV; 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="s9/qQCEV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D3B0C19423; Wed, 25 Mar 2026 16:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456153; bh=tPzeJ8v456m2d30UqE73B+UaLtNZYD7FTrsxSwqJZFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s9/qQCEVLFbmPvNpERJrwz34LiGRHyf+wBv5b4IFmOPsydwwoYAIkT+n+qT9W/idh 38nIKQbaKClV4Hq4ngTp0RSLqSrxxr+VaCPhsvaVkkATzYP9uKOYpfsN/36iAJjwoT eSDiL71bYElvrdyRduA/Nq7UMzop1RMmPqyS+eWtwBEqNIziofKcuJ54geUWJ6toAv TrENIsMFkgY7N9Kwu4Pk6FaxhAOfugGJycF6DQYuBTxMCw3VMcpUR5UcdXVYbXZmIc Kusm0RE44pvfTnjpjzudhB5jnV059ZfAYrJJZBHIejFsB4/h2+n2Ta13ecSVaumXpw b3UwBh8aGGmAA== 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, Kevin Hao Subject: [PATCH net-next v5 04/14] dt-bindings: net: cdns,macb: replace cdns,refclk-ext with cdns,refclk-source Date: Wed, 25 Mar 2026 16:28:08 +0000 Message-ID: <20260325-savior-untainted-03057ee0a917@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=3148; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=YuZA+9uk1ysSY/NdJLuuoPLcf0q4cp5LYDFkeULhb80=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeE07fxsurH4u2hT09IVDXFnKih7xKc6PzIV+PbyhY /3c6IJhRykLgxgXg6yYIkvi7b4WqfV/XHY497yFmcPKBDKEgYtTACbiEcTwV/jll+PbTz2tOfLt dtKd/fm6WXIdP57Z5ucaBHlfVeDc+p/hD0+Hp9gz83c50mtjHlTevO7y9umR3IZ304QWeTytaF+ RxQYA 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 --- .../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 feb1683858374..50490acbb6fc4 100644 --- a/Documentation/devicetree/bindings/net/cdns,macb.yaml +++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml @@ -130,10 +130,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 @@ -215,6 +228,43 @@ allOf: properties: mdio: false =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.53.0 From nobody Fri Apr 3 01:29:33 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 D46C13FB043; Wed, 25 Mar 2026 16:29: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=1774456159; cv=none; b=fMbysx0HvGuKpn0I5/0iPV+mFzKQm/b5f1gPxdV1ml2CPKWyxchAGLeomGs8xyJhE2aXYGdMb7KC77yZ4LjlzGmy6FP3fV66DcN5i+tUrteOhxj6glUBnO3lZSdm1iVR/q5Xdt+lobeaIyHkGftik2gpNnX8OuLnnzXcvy3eiOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456159; c=relaxed/simple; bh=mignoRYRLHHjX6SoWI2N00JC2HYzX1D05cl4aW7C2tI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vDMLRArMe+YP24KnAsOX9lKS+4Gv5BkBos2u6dlhH6Z01MiXFWhnhUuhbl5IdBqx8uOYevgcI42WGCJjnBEB//RiKQp4nB1lgkUfr5PjqvYhA4XHLd7GQmLajqWSJxs6aH6eV8TXc7BJpx3YFlFI6MVTWsBKxLjXCHB4yMA2/uc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lZWaqqXR; 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="lZWaqqXR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AF36C4CEF7; Wed, 25 Mar 2026 16:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456159; bh=mignoRYRLHHjX6SoWI2N00JC2HYzX1D05cl4aW7C2tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lZWaqqXRtM1Zpz9+5WAz2NTimIltca+VqNPf+FXtspLv6JsN2gzoUPPiGu1l8Hj5F sYs1w/+geL4GAmvsxiyCujjqRhgdKTZtNe9Gp2cMWdvkAPACTV4bv/fcu7Vf/qgKcw 6KUkuebGc/jBeeCfVqRygmS7ov7tBZM9VpbJW/ZDBzG+QcV4wsrWtQERCme7VVpMBx p+Y0hAWOXcYe80cTdYrEhKmhTBEPHxr0asNWWRYsQLkD9HeEs8N0sNGKP2N0VFceaa FOWBEPdHgtkaur44vdZmUFhODtuhwTkz+x5LM3QTzdX+HaGKhIVg9tli/fSb6b8SqH WfkQXhA+7gUew== 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, Kevin Hao Subject: [PATCH net-next v5 05/14] net: macb: rework usrio refclk selection code Date: Wed, 25 Mar 2026 16:28:09 +0000 Message-ID: <20260325-tarantula-bullring-6ac44b39dd52@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=5438; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=ycgYzkRjtwYgivLvrVnZHFBsUBSJrE0ZCfPhkRXsTQU=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeE3vRe5euGKW3gUfX+YzIv2XViwN1G29t++ldIPBm ngN5XyHjlIWBjEuBlkxRZbE230tUuv/uOxw7nkLM4eVCWQIAxenAEyk6gvD/1oRd8sNOavC1lSm PZytqNT1Vk48Nue2WvXLv/VXHj4T5GT4w/snN2qiCpfscbnLIS7belgOqgm0fG2Szby2xLx87iV TBgA= 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 35b7129d7c1ee..1bdbe66b05590 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -1229,6 +1229,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 859d03502666a..a436521460683 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4576,12 +4576,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 @@ -4614,9 +4610,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 @@ -4897,8 +4890,36 @@ static int macb_init_dflt(struct platform_device *pd= ev) 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); } @@ -5503,11 +5524,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 @@ -5622,7 +5653,7 @@ static const struct macb_config sama7g5_gem_config = =3D { MACB_CAPS_MIIONRGMII | MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, - .usrio =3D &sama7g5_usrio, + .usrio =3D &sama7g5_gem_usrio, }; =20 static const struct macb_config sama7g5_emac_config =3D { @@ -5632,7 +5663,7 @@ static const struct macb_config sama7g5_emac_config = =3D { MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_USRIO_HAS_MII, .dma_burst_length =3D 16, - .usrio =3D &sama7g5_usrio, + .usrio =3D &sama7g5_emac_usrio, }; =20 static const struct macb_config versal_config =3D { --=20 2.53.0 From nobody Fri Apr 3 01:29:33 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 05B073FB07D; Wed, 25 Mar 2026 16:29:25 +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=1774456166; cv=none; b=Ea4DjJkuqOz2tQ3z3F8Ln7zKizZuexKlKv9xkIWm1ztE8hjuuZ+1fJsg7eCzv+dVlZ+iPelbhUt3rAJSMlhVKoT6DSQKxNceTXhA/emzUSBcsS0h+wO545+DN85DCz1AIIR9Vo1LBFd8ZNiygHnrCnwjjkeS98dYkSU2sMROE/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456166; c=relaxed/simple; bh=Sn9HaRfi1ZPnZhiBsOsyXdj1yYXuqAPKpgTQlpo/qxk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qJRF06nGAR92K/yEUKAnjPdYxm6rAEsiIbyNnLU44Yz+tbFj5SSPez6pr5xaPZevQjY+xLKq1SB621Q2X0oGEvoQnCfcdMewIYq8ZDn5PpehVP7Xt/iMSJKa4nTAQPdSTb+U3aLeUn5VbB/WolMc419A8Pm0kEIrz5/EqBSpVA8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gyZoEQh/; 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="gyZoEQh/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 093EFC4CEF7; Wed, 25 Mar 2026 16:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456165; bh=Sn9HaRfi1ZPnZhiBsOsyXdj1yYXuqAPKpgTQlpo/qxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gyZoEQh/MqFa3DZ7+PBz0skpBv9yN2/LxiWlHj1mnnnoqAuI2xmuYuMD4TRoK0XDd 5GrknwmTirExjtxscjBos+YON8HbteB1NtpcnKWrnjtIqffbnG0V0dbEgudgHzh2zI afEVe65mHfMQob+6Dmo2x/Bhn3KE34LhXEAtu3R50skaCT/cePUMeuq75PtUaocGsp NNtBGm8y1ARXKWHNYWD4zkDqOKhuoKgD3BdiZStjcw3dTQI4/1wYizlIWlK1wECCqW xoNrN97U5mcc8s4MxdjMxWWsGMxLID5OBYBi3+My8s+myPseqWX64S9dxmKvYdoiT8 bAwLyOUSiBitA== 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, Kevin Hao Subject: [PATCH net-next v5 06/14] net: macb: np4 doesn't need a usrio pointer Date: Wed, 25 Mar 2026 16:28:10 +0000 Message-ID: <20260325-passover-rimless-73c19c67d94b@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=786; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=LNJYyIg9j07IeOpXCUTvA6g7fWFWRRaU24pBhU1Ggbo=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeM0e9xb8ujNFYPOCJczHZu58rnjXTq+cZ2uhjXnIr xCteRFFHaUsDGJcDLJiiiyJt/tapNb/cdnh3PMWZg4rE8gQBi5OAZjInF8Mf0Wlu1eycMSezr3Z X3H9Yfa2gILboiqTztYF51dekv57R5WR4YNGisCduWsunay3/VjE/sbvvIG5sO/ln5EPRBWdO3Q l2AE= 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 a436521460683..a1f8a6d9554fb 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5613,7 +5613,6 @@ static const struct macb_config emac_config =3D { =20 static const struct macb_config np4_config =3D { .caps =3D MACB_CAPS_USRIO_DISABLED, - .usrio =3D &at91_default_usrio, }; =20 static const struct macb_config zynqmp_config =3D { --=20 2.53.0 From nobody Fri Apr 3 01:29:33 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 EE6A03FB7D4; Wed, 25 Mar 2026 16:29:31 +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=1774456172; cv=none; b=lpWSkMwJx9NhOU+ccnDvlC3IFCnOaDwaEBB/cM0n4KjMnbJLQ8+LMaMPJU79ua4T8RWKgwmpaUNUKbDxPe599yB/cgbls2SOe2c878jE4Q6BdjPvNZEwp0rUKp7SDhDZAFmK+z5oXLiWbYHJhzLsTjPKlkNTEi+Zyi21AC15cco= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456172; c=relaxed/simple; bh=MCaDxoDiVDGdtO65h0jv11dtwY7d5m9e6N7qyqE+O5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rfeuM7MeNOl0Rg7iA3XVpQuI6LvLTmCs98bL/e/wzk2vjiny0gtdzmmmjM8x3AfKU6IRKnWJo7FXDPrvPFEyTXj4TFJOkYGLPZBvhPdPXx/xdGuSV6Q5mN0kv/iDbYWSKJ+D8uEjAG9avgVBvu09ZDTZPLIBYL5hU5u2p8vQSVo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sw3YZeNR; 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="Sw3YZeNR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBF43C19423; Wed, 25 Mar 2026 16:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456171; bh=MCaDxoDiVDGdtO65h0jv11dtwY7d5m9e6N7qyqE+O5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sw3YZeNRAlld5uS8I1piZg3WRSBgcQg+Hj5TzOdmBqklhlTgd0Z8WxcaRcctPNR4T YtgWw9WeQVKjptA/Pw5dt7LW68xH9Npol2pIXqbazM8498WyHZSpzu1Rb4ebSmUV5b yoXfOzJ1hAkNpeF00MtW9osNv6yWMigBvez09IrVlRk+MgkqcrsCSFAx+K5qL9ZsKm XgZNgbWq28IifnjluiW2wqX+UfORUtaSonvokMGWso6NUcEOSlumL2UrUxSwcOJ5dg tfccuLqhCBe6mcQxqpb+kWtSPLMeP832t9LkDdCefPg/yu6HDwsWKfwKst6YFsXeMr KHkNbH47VoSkw== 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, Kevin Hao Subject: [PATCH net-next v5 07/14] net: macb: add mpfs specific usrio configuration Date: Wed, 25 Mar 2026 16:28:11 +0000 Message-ID: <20260325-excavate-jester-798e7cfe02b5@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=2732; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=Szw1FnKs8om3BmObDQ4lrRqwtQtqKNPlW7gKJuQIDEo=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeM1ar3yeudJx0t3wogYZTYN76RGRDNL5yTyv1jdNk l8l/smlo5SFQYyLQVZMkSXxdl+L1Po/Ljuce97CzGFlAhnCwMUpABNJ2cPIsJjrt6rrA/Yb1QKJ 3xISmVcvfq2/Mj1+a8KC2B+njV1X2DH8Dy7OP/XBZ9PLWkV7jw+nXk66aNZ4bv/fx3opt74fE3c 24QUA 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 1bdbe66b05590..8e5305f9a7545 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -788,6 +788,7 @@ #define MACB_CAPS_EEE BIT(25) #define MACB_CAPS_USRIO_HAS_MII BIT(26) #define MACB_CAPS_USRIO_HAS_REFCLK_SOURCE BIT(27) +#define MACB_CAPS_USRIO_HAS_TSUCLK_SOURCE BIT(28) =20 /* LSO settings */ #define MACB_LSO_UFO_ENABLE 0x01 @@ -1229,6 +1230,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 a1f8a6d9554fb..4e5967e6ffbe5 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4921,6 +4921,9 @@ static int macb_init_dflt(struct platform_device *pde= v) 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 @@ -5524,6 +5527,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, @@ -5637,10 +5644,11 @@ 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, .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.53.0 From nobody Fri Apr 3 01:29:33 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 58A553F9F59; Wed, 25 Mar 2026 16:29:37 +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=1774456177; cv=none; b=oc55xkZpzz8WlKAa9XE9Dew8u6mrZdDMOTF/pX1HDh/OiX2m9uiUN/rU0Y9uyitPDw+GnSyhDV+vSXf/dWn6Z9eIyGEJc6aKDQDVFdhzY4Ctbccef5MlhxyrE52Nd8VqUGVpBwr1ux/0r7r6zfnQfCo8NteSvbgdaxHpYKiaGyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456177; c=relaxed/simple; bh=sDKThMtcyv96eXzde374X1AAM94GvTAWHU4orvZhEwU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nBt5aXiysX3n3JEBkTqN0gcwcqIy12d6KNtQHzLTdiO1mQ6YbpxTarUcpsk8eLlak0x+Nrvjp//gCZ1Kbh+8WJ8GoL9G2UVEmZ13bSl9s34MKw+UsyP64ebLHwwXkaNTKZfBe7bQH/18DFwWJMttsu0wN0+yV80Q9aWYEaI/Gag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MS6uB1MX; 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="MS6uB1MX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B98A2C4CEF7; Wed, 25 Mar 2026 16:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456177; bh=sDKThMtcyv96eXzde374X1AAM94GvTAWHU4orvZhEwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MS6uB1MX2q9Paw6Kikz5NNoqJupOFaj5jDJWZhAgnnC81BSka69lhSE4A1UbpFONM BGGgoYiWk7oUX7Xj2M5MvPh+2RWetfUBE2uhxvIRIQStdj+XePpoiThICHLB3TYp4M WZ2ifKnyqqQiZ7Xwt616WmuqRBwOrTe/Ia0LRZsC6QClIMGGr5OnqS69SwgOblf52/ JDDRKL6ioCWBkY/PPkZvsx2oQDvLgG8kFOyy+bgylY4g8FKg2XyUjTvLRJpdqj/eiA 848IuWYQCxe+Yp0GzFnViHeUHuS77Tssx+OTY0yQAXaIrZMyZE+uzoAzbiLTLZGVJF ukiwetmSFy+SQ== 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, Kevin Hao Subject: [PATCH net-next v5 08/14] net: macb: warn on pclk use as a tsu_clk fallback Date: Wed, 25 Mar 2026 16:28:12 +0000 Message-ID: <20260325-dust-revision-368053e82d0e@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=4hRMpr9HKqtdLE/ntrih5qOpiY9u0EHTozFQCcK6pdI=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeM2aCr9v1wvVbpZf+I7/849DjGvFm1KeHi6tbHtfZ jT12vo/HaUsDGJcDLJiiiyJt/tapNb/cdnh3PMWZg4rE8gQBi5OAZhI2R6G/15cZoGH1m1pf9TW uOqN1rxbv+MqdjxPqmFaVNCgMe9f9U5GhjNum4O894qYGuzLO7z21/QjwXaif0MYtoipB1mfzIy 4yAAA 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 4e5967e6ffbe5..492abe1e33b3a 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3772,6 +3772,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.53.0 From nobody Fri Apr 3 01:29:33 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 C2C083F9F56; Wed, 25 Mar 2026 16:29:43 +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=1774456183; cv=none; b=JoENjfGEIYJnRinLfbKz6LE9Inz0boQvSwQbTEisEXxDxmTb56ZQM2dX5sjbxhzafJsbF0piJT/VHv/fSKW021NXXGfAi8cSLSG5I+bg4No2DEfn2tCKgtV5Oe5/iBTdtkXFnwzvpu5F7Bs4G6aJ8ht0f1+MtQnoOWgs8Mec7ac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456183; c=relaxed/simple; bh=ZcOLtYKae+2Rnp55wBNFsnZiamfl2XYukwL2390q/wM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pbA4dcQr4hyNYkachgvVM8eM/7CA61DKv/pg5gKc3ZFYiVd8TMXIrg6Ean6u6Q+zTqFG8JH9GGSDqipmxFY+uV3SNq3bfhBX1/P09IEecwYf42GHjKyixRSnNHp1d1p+edoOSWuWqe+va3BtzJbZPfObQMS4bJkajv05nxpFXNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WFWY9/5d; 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="WFWY9/5d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97043C19423; Wed, 25 Mar 2026 16:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456183; bh=ZcOLtYKae+2Rnp55wBNFsnZiamfl2XYukwL2390q/wM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WFWY9/5dsndrjfbk/fjs64LRLg1pisMxM7P7TPkrZ+U4y41CIYPTq6+488nZZ2fTn ApzzTvu3A20vz2lnxJN74G9IlOF2tsDDUqZeWcspwDEVKnATakD+nKFXXe1EdaTOQs RESmmkhtNz01CaG7ybFWrK+yxc2mb3eE8R7XfG69uCtUnPiUUlPZoeFcvIcXbLSAqI XjmoyuFixhIi+SMqpp8pZCfWehlBirF+5xl6B5Flx0kbxhl/kTSHASZ3igtP8eZSD3 jQDFxmGlEQvDLc2IJR5hXjlCf5FBRpUPcIHXD7jiA4gZEovnsPmjj5kid+4g74wkWP Gm4FbttoWS3Yg== 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, Kevin Hao Subject: [PATCH net-next v5 09/14] net: macb: clean up tsu clk rate acquisition Date: Wed, 25 Mar 2026 16:28:13 +0000 Message-ID: <20260325-hazing-penniless-14ba803efbb6@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=1kpPbARU/zhfeCpg9eoWhZjN9mLcjx7s+d9CyHanEvo=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeM3uVv9uXzfDNupG+jIH79Oz3R8ezfWZ2vlPSLF0n 3b1xtYdHaUsDGJcDLJiiiyJt/tapNb/cdnh3PMWZg4rE8gQBi5OAZhI/FdGhtZrJ7nDI9ymXrHf Ux629OeJP1veJeS90AgvF3w2qVGfTYLhf/Q9DoaXU99P/Meq9ot3n9lOs1D2b9s0vx4LFeO5NG9 lJisA 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 492abe1e33b3a..b28fb771e03ba 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3765,16 +3765,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.53.0 From nobody Fri Apr 3 01:29:33 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 5FC2B3FD156; Wed, 25 Mar 2026 16:29:49 +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=1774456189; cv=none; b=B8K4UbNAQkimPwiWkahZ+8OMkIDpDYYaU/5o5kLh3aCmJ2L94B38WqhFKXyd3XNGaItrOHfX1iLcJ50s0kinPj2I6k8G1EbMkUTCwSg/adhPjr3PuP6CuMPS+shCGlEk9nI21yY8to5SXQ2uHvYE9ygMQbgENopJfO6i485A9qo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456189; c=relaxed/simple; bh=djigdiiWtg5Ve5KXosHk2GFYWy4trdHi+BpBld8PyFQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dbztoOINacbybJy7aOOQnBWfI7Z9tSG4/1g38JgLQTtQ00lTVMv3zNdvCCaVj0mng641rdDKhEG4WVn0/V5W4+CR64/T+wEtjmwpHXH6evMEt/AA3yjHjSJpghIQUrm7PAoZn0zGVmKeLzbwjas4M3A3AW3Jfh2AY2JxmxP7W40= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nNUDHwPv; 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="nNUDHwPv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74340C4CEF7; Wed, 25 Mar 2026 16:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456189; bh=djigdiiWtg5Ve5KXosHk2GFYWy4trdHi+BpBld8PyFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nNUDHwPvLt7vwM1JGqjK0eft5SREZLSN3w90el4jsWOtsVnpv99o+6aN9KM+iDu9/ 1b3TIaXgNyCQ6Ji7yJRPyoGrslQJBxztTPGYs2oezcnbk1u7Q14odTn7IlI3RtdB5i CCvi7dGKL1tmoJBeKCcmEI3KhUbGHgFyEkR2x7TZyibYoWuCrdHxUQjmQMTd2bH0x8 /FUpUGkZLa9HG/1xTC1WCKEJIEBM7HmRUd4enMB/hn5X/ZD582f6DRwlniMxFz9R/6 Mpeye4BBtDogFUZSdty6wit+T96xoVljx1t7DSMu8mVmRJNr6ZV9vXgHtsmz9fh024 fFsKx4dJW+vNw== 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, Kevin Hao , Krzysztof Kozlowski Subject: [PATCH net-next v5 10/14] dt-bindings: net: macb: add property indicating timer adjust mode Date: Wed, 25 Mar 2026 16:28:14 +0000 Message-ID: <20260325-daily-entitle-3640f7254da4@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=PRhIJTmaVKMM0MQHK+yqnhr39wQYhs54BbhF9Smsdok=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeM2Xz190RHr6nlUFK5/P8vOq3avWVaUrntvhv7JpO q9f0j6pjlIWBjEuBlkxRZbE230tUuv/uOxw7nkLM4eVCWQIAxenAExk/1VGhot8a1tPrf902l8z 9xmrXIXI+fU3trmvdap/suTo/3930xMZ/td8sPAM29q9KcmTY/nGmrb96ov0zm46/CrpB5vakfp rfnwA 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 50490acbb6fc4..2c8c080a3d881 100644 --- a/Documentation/devicetree/bindings/net/cdns,macb.yaml +++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml @@ -158,6 +158,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 @@ -207,6 +213,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.53.0 From nobody Fri Apr 3 01:29:33 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 D31C63FFABA; Wed, 25 Mar 2026 16:29:55 +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=1774456196; cv=none; b=Jl7Q5sfAPJ30fkJYo+3M3kFIHevozb2ch2nHBRb4aW751chOqttPFYMA2JXuG8IdCXNGnJT/lFNnJWAXsTEVNg4Adlg0j+vgRAD3pmLOc0gF4ot2/134n+ODAkQbRqD3TLxiM/aoOhVXddwrAS3DQiPTfgS5f5S9zzHx1mldb8Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456196; c=relaxed/simple; bh=DVwy/SiED1aUxG3GP52kN89RSs8GgqpP4611q2+C8S4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uYbGHlfoOfR+16MV/tmKOOHRr517Y+lRAc3KeFAjJ5139cBu4m4Pd2bXyuc0rUlMKZpxfidl8jBX0ZPp21u9ZcdwPLtXiWmyqe7Ib1baY33YWpUp40aWGXXsilVLBO3g1sOloAy00alWojxzOV5VXmo0/jVG6dhctXYJx4Mp7mg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HPc/4aTD; 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="HPc/4aTD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D603C19423; Wed, 25 Mar 2026 16:29:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456194; bh=DVwy/SiED1aUxG3GP52kN89RSs8GgqpP4611q2+C8S4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HPc/4aTDLITG0PNefDLdDWiTkQObOQxOwedpjrYDouUexkm1Ukh3SegG+qh8xfFRw yZHIBiq6eb/HqmBnTRyFqULAmHI/B66dr14N1tBbFqUG3d3/u9T4aGaVKQ5raLiBcq CVpmBI3U7iIudADuyAgU54pSqfX1VyPLjM2q5AzKRc7ANVOdao/qIkrFcZ/J0g0lOF 5GRDW7mCXodlVAFx9e35PV+gcz0DCR2YRMC+m8slG/dqZwhyQy/wy67lenV+nVY7jm N/BS//AXLAmDEuTyfVml6nwqRrqslBxOCbkrI0B00pQiPYySdgcPb3kFy4iWbWYciS Tacf5F0sMHIfQ== 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, Kevin Hao Subject: [PATCH net-next v5 11/14] net: macb: timer adjust mode is not supported Date: Wed, 25 Mar 2026 16:28:15 +0000 Message-ID: <20260325-facebook-chop-cf792c53f1da@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=im8X4CvHY/qWpTRXmAP5CqBJbYe51EIu9ctXDYbqxgw=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeM1rp67OPT7jieVu+R6hYxpTKkoEJZ69f57+ZdW5+ bO/lVTu6yhlYRDjYpAVU2RJvN3XIrX+j8sO5563MHNYmUCGMHBxCsBEjuox/NP+FhPBefNM3PrF Tikl3z893qFcU6OSfPFw65IYxtUyFRsYGR4FTWJbo3DPROyB8otIRxPPG4Emp4/73zzvoFOV++D 8BQYA 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 b28fb771e03ba..58d89b9e2f08e 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5838,6 +5838,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.53.0 From nobody Fri Apr 3 01:29:33 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 324DD3F788E; Wed, 25 Mar 2026 16:30:00 +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=1774456201; cv=none; b=lqK43kzza6X/OhznfjJmuLGpozkEGdY9DaCBj8vxjK/8CCJ3+YebcvzAEXJ/ofNNhRmQW1cQM5Kd7Rj0FX6Ec3XUVzYXxtgafOrJhm0wSFX5owwTXjf/rb8yf1PR+Zxe30qHJyZg/hw2taVIbRX6R/V+4P83nTFuMrLXdAiFSEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456201; c=relaxed/simple; bh=8wFQT0scIZH4MoUOnJP+cg31O9j6k3cRCJbdld+VpGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c8BXpFdrj4bhtlYnegqJI16sVdmET/0tu6YYKh0nfgaSkM0wOWvwlotHruJNsPmNlWJ0Z7Q5eoVpiOFGTOpPhMIOgz3debS7VR+cnqvDl5FLB5LxLpfv3dI4blyv9Uz69GzofdeOnZZqhvPZtB536XBZicuZ4rm/W24Zasg4teI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OdwSgWBv; 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="OdwSgWBv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BB96C2BCB0; Wed, 25 Mar 2026 16:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456200; bh=8wFQT0scIZH4MoUOnJP+cg31O9j6k3cRCJbdld+VpGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OdwSgWBvgGBOmPe+dNJnjV4t34qvmdH8AHx1XYdA1Sox/Wtcpp+9i/KQctVOBXmpD SacGnBJkzucQTgg1Gf1TCv0ebJsC9+//YtyDQzoNWQyqPWHYfr0FqehCxftP3rCu9a LW9VLTCbLs1/TXIpxPj9Dy23qzig5baukpNkMwflRSul4uNPCmuclrm+XHE70/8pNr ezlRe5JeKeRE4qOaMCFKILuggxfhVJNbSyplXYQhsIZenQorCNS2Wu8cZiO60YSZzP 3OSdL7r7GsYMrrbOpGba+iJd5CTT8yRh4IZaFJBe7zuVTYJRTz9ZbfUdcbOlK+OnRH DFK+t7oiuZCLw== 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, Kevin Hao Subject: [PATCH net-next v5 12/14] net: macb: runtime detect MACB_CAPS_USRIO_DISABLED Date: Wed, 25 Mar 2026 16:28:16 +0000 Message-ID: <20260325-compactly-glue-f426a2e68904@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=NgI/Gdg2EZ/vK6ibYq/phTDUhc8w3AlLuS5OcuYYPjI=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeM3Fzpk1/ptRdej3Ppez2nwZR/kvS1cua0+1npH5e Xb2/Lh1HaUsDGJcDLJiiiyJt/tapNb/cdnh3PMWZg4rE8gQBi5OAZgI1wNGhoknijZ277QNEter ZUp1Ofvyizfb7ZDg159Nt59/sCs7LpuRoW1nnFzC89VR+jOW9P8PXe71b8Vq/f1HahsYb/72yFa bxAIA 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 8e5305f9a7545..16527dbab875d 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -524,6 +524,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 58d89b9e2f08e..b9791bbbec8bf 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4588,6 +4588,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.53.0 From nobody Fri Apr 3 01:29:33 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 27734401498; Wed, 25 Mar 2026 16:30:06 +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=1774456207; cv=none; b=tH0ceFubhmA5CDNVKNBns8sEyzIxQ3RYVJq2SRlIx5FsxpD7UXX+JkpNYPDamWHRf3dJxFxtM/ZJibUjPOQ8cJPk/+vnjDWPwZWaan8DlY2tp/qDgftfMG1VdJuG7OgXozHQm3EMPQTDOZ+/NKYLAMwXaxUrNrcVDVTfX5Lyxao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456207; c=relaxed/simple; bh=SI/nbinYmlv3ClOdOqznxnr/ym+iNX3LvdqOnIkrfeM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZQ+cV+MdG16FikcNABzYWaY6v7gabOn+MJ2Q4F0pojRSiax3nKF7O2gPLfumPbLpHL3VEz1M9wn7bE2vjth8iGnPFmSHacbEXkbfcqFhl9zn2m6K085Eaj9gZf9gJD/Hx/LTU2kLLm8RWpPs/ushWSQamsouTGagcLHPvGJdsME= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eHn/zBJs; 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="eHn/zBJs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A28CC19423; Wed, 25 Mar 2026 16:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456206; bh=SI/nbinYmlv3ClOdOqznxnr/ym+iNX3LvdqOnIkrfeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eHn/zBJs7vzQAN7B5DQNCZUjQ4lyOWZnuSCYnWAbKPdHuFIcLJ3vbjwIf/7fSyLk1 V+OSH3jweZ9DR1PetGAKSKtiUFdKcopIlN0UP7A+XUyA1nvLlWCNSete1rhs7BAN31 +ouqSX4OPTHEJZAub6aRwWV2RvBJ4wIcmotlNgB5QA97+HIW75iLW+c0eehdcWzD4t q8+f09QY798P4VwHNcMZK6iXVlhijXLuDb16W56LNQkWN8oN6fd+/FCFJL98Sm0gTF Xc8Gq3eAmpoa2X9tYyzU6iNkGiWyMgPtQQFJ5ZuyLxn2s6q0gGo7ycA5vFKL/7eEj7 Qsdiq/ROGL55g== 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, Kevin Hao Subject: [PATCH net-next v5 13/14] net: macb: set MACB_CAPS_USRIO_DISABLED if no usrio config is provided Date: Wed, 25 Mar 2026 16:28:17 +0000 Message-ID: <20260325-husband-cape-ec4945b9184c@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=wWQAgoUtn0mz+g0O0PGK24RiTXGyZCFOTNhrOE5r3kY=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeM2/7rnyJl5+UuW/7c0d5bNDy2pbTimn/v8lffRxq ElFzrrEjlIWBjEuBlkxRZbE230tUuv/uOxw7nkLM4eVCWQIAxenAEzk5TSGfyaCsw4yK9xgO7lF 8vnMh31Ll88waJEIsd/948iLm+v2ffBjZFg+SbI8dZrw0XP6pR8bfjKy3ZSU1d/R4VG6JN6aYd0 3U0YA 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 b9791bbbec8bf..9befb268ed79e 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4577,8 +4577,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.53.0 From nobody Fri Apr 3 01:29:33 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 8662E3F788E; Wed, 25 Mar 2026 16:30: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=1774456213; cv=none; b=eTizVROjuwlwNO/xIzRoQkWHLF2AveaAqyP4ihUBsiQSVUn9+zqa5zFZCZTXcch+IA9yfOCf+IGKSNDzVxAo+eYtWZeLjzq5XSDory/OJy1PzYzdtsfBngNzljyptOQe+gJ+TYDYU0XtEwHLTTebVln67USEDRG3UT3BIPnNARw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456213; c=relaxed/simple; bh=oW12N519I0kw0CyJPWIc3UJsn8XZap0iK40b96AjYO4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ImHAtk43PRLHr6RUcMoprlbhOAxk4utv8B344LYBwQQlLbEq3Xs/1sdAn93cSuUEQk/zY0wlOS0IjEp42nNwbWShvWYF/s0Y4h7TDNWLCA7XXQWek3usSIIhQ3p/YNRo6aWgKGcd3JW8LB/3Nkq3HmLQbwYPLoFw7tTCtmj9p5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V0Enm9LU; 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="V0Enm9LU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CD29C2BCB1; Wed, 25 Mar 2026 16:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456212; bh=oW12N519I0kw0CyJPWIc3UJsn8XZap0iK40b96AjYO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V0Enm9LUCor7mkbEYMlAspxh+4ssXfuyMAB4T80S4vBA79yXJ4uDnxdcipaQX5fow inH6fah38iAnVXp8C8Sy2EZ2UEr7zA9EyHQrLwJ/5LX2dG2T1sqRJvlB6vz6QcomrH oWurYSCQjYWWSoJYIpLnKRAARXhcu+YcYCNMirusBEbK6giYgwxKvG0wc/MEzCnebH D17xoDPb0sCPzruPSixZDfIKDD+BsAtg52WZWzVDWKvsjQQhORapqPvP2uYesv91EF AiFt6hrRsNg3jh4EYgd4cVjO1ijyXAUCKH4SYCDn+1E5ZjeJHUuazrNY3Sj538kY6j gpYLygGCVp+ug== 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, Kevin Hao Subject: [PATCH net-next v5 14/14] net: macb: drop usrio pointer on EyeQ5 config Date: Wed, 25 Mar 2026 16:28:18 +0000 Message-ID: <20260325-stillness-undertake-d83054057b8d@spud> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325-unsterile-flail-4c7729750dc4@spud> References: <20260325-unsterile-flail-4c7729750dc4@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=1026; i=conor.dooley@microchip.com; h=from:subject:message-id; bh=YLNmb5rNBu+3WxSgWsYJIDPAPqu1Vv3xiiURVvdAoto=; b=owGbwMvMwCVWscWwfUFT0iXG02pJDJlHeC3Emjm1Hs1pF9lfnDEt3PIeQ2dw5PYA5RmzL/zZG u0+/0hlRykLgxgXg6yYIkvi7b4WqfV/XHY497yFmcPKBDKEgYtTACayfinDP2v+biUjYfY1PmJy zbJhEQtW7Xa3+ih6rmvpvanvMuYK/GH4K/hl5+ErJ09ZMseIRMbffJGtN/egWL3BcmOj3eKiswO /sAEA 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 9befb268ed79e..12e2b2f4aaf88 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5695,7 +5695,6 @@ static const struct macb_config eyeq5_config =3D { .dma_burst_length =3D 16, .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.53.0