netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/3] net: stmmac: convert meson8b to use stmmac_get_phy_intf_sel()
@ 2025-11-10 14:42 Russell King (Oracle)
  2025-11-10 14:42 ` [PATCH net-next v2 1/3] net: stmmac: meson8b: use PHY_INTF_SEL_x Russell King (Oracle)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2025-11-10 14:42 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jerome Brunet, Kevin Hilman, linux-amlogic,
	linux-arm-kernel, linux-stm32, Martin Blumenstingl,
	Maxime Coquelin, Neil Armstrong, netdev, Paolo Abeni

This series splits out meson8b from the previous 16 patch series
as that now has r-b tags.

This series converts meson8b to use stmmac_get_phy_intf_sel(). This
driver is not converted to the set_phy_intf_sel() method as it is
unclear whether there are ordering dependencies that would prevent
it. I would appreciate the driver author looking in to whether this
conversion is possible.

Technically v2, since these changes were posted as part of the 16
patch series. No changes other than r-b tags added.

 .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c    | 30 ++++++++--------------
 1 file changed, 10 insertions(+), 20 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next v2 1/3] net: stmmac: meson8b: use PHY_INTF_SEL_x
  2025-11-10 14:42 [PATCH net-next v2 0/3] net: stmmac: convert meson8b to use stmmac_get_phy_intf_sel() Russell King (Oracle)
@ 2025-11-10 14:42 ` Russell King (Oracle)
  2025-11-10 14:42 ` [PATCH net-next v2 2/3] net: stmmac: meson8b: use phy_intf_sel directly Russell King (Oracle)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2025-11-10 14:42 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jerome Brunet, Kevin Hilman, linux-amlogic,
	linux-arm-kernel, linux-stm32, Martin Blumenstingl,
	Maxime Coquelin, Neil Armstrong, netdev, Paolo Abeni

Use PHY_INTF_SEL_x definitions for phy_intf_sel bitfield.

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
index a50782994b97..f485b9b858bf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
@@ -26,8 +26,8 @@
 #define PRG_ETH0_RGMII_MODE		BIT(0)
 
 #define PRG_ETH0_EXT_PHY_MODE_MASK	GENMASK(2, 0)
-#define PRG_ETH0_EXT_RGMII_MODE		1
-#define PRG_ETH0_EXT_RMII_MODE		4
+#define PRG_ETH0_EXT_RGMII_MODE		PHY_INTF_SEL_RGMII
+#define PRG_ETH0_EXT_RMII_MODE		PHY_INTF_SEL_RMII
 
 /* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */
 #define PRG_ETH0_CLK_M250_SEL_MASK	GENMASK(4, 4)
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next v2 2/3] net: stmmac: meson8b: use phy_intf_sel directly
  2025-11-10 14:42 [PATCH net-next v2 0/3] net: stmmac: convert meson8b to use stmmac_get_phy_intf_sel() Russell King (Oracle)
  2025-11-10 14:42 ` [PATCH net-next v2 1/3] net: stmmac: meson8b: use PHY_INTF_SEL_x Russell King (Oracle)
@ 2025-11-10 14:42 ` Russell King (Oracle)
  2025-11-10 14:42 ` [PATCH net-next v2 3/3] net: stmmac: meson8b: use stmmac_get_phy_intf_sel() Russell King (Oracle)
  2025-11-12  2:00 ` [PATCH net-next v2 0/3] net: stmmac: convert meson8b to " patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2025-11-10 14:42 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jerome Brunet, Kevin Hilman, linux-amlogic,
	linux-arm-kernel, linux-stm32, Martin Blumenstingl,
	Maxime Coquelin, Neil Armstrong, netdev, Paolo Abeni

Rearrange meson_axg_set_phy_mode() to use phy_intf_sel directly,
converting it to the register field for meson8b_dwmac_mask_bits().

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c  | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
index f485b9b858bf..865cd6166134 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
@@ -26,8 +26,6 @@
 #define PRG_ETH0_RGMII_MODE		BIT(0)
 
 #define PRG_ETH0_EXT_PHY_MODE_MASK	GENMASK(2, 0)
-#define PRG_ETH0_EXT_RGMII_MODE		PHY_INTF_SEL_RGMII
-#define PRG_ETH0_EXT_RMII_MODE		PHY_INTF_SEL_RMII
 
 /* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */
 #define PRG_ETH0_CLK_M250_SEL_MASK	GENMASK(4, 4)
@@ -238,21 +236,19 @@ static int meson8b_set_phy_mode(struct meson8b_dwmac *dwmac)
 
 static int meson_axg_set_phy_mode(struct meson8b_dwmac *dwmac)
 {
+	int phy_intf_sel;
+
 	switch (dwmac->phy_mode) {
 	case PHY_INTERFACE_MODE_RGMII:
 	case PHY_INTERFACE_MODE_RGMII_RXID:
 	case PHY_INTERFACE_MODE_RGMII_ID:
 	case PHY_INTERFACE_MODE_RGMII_TXID:
 		/* enable RGMII mode */
-		meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
-					PRG_ETH0_EXT_PHY_MODE_MASK,
-					PRG_ETH0_EXT_RGMII_MODE);
+		phy_intf_sel = PHY_INTF_SEL_RGMII;
 		break;
 	case PHY_INTERFACE_MODE_RMII:
 		/* disable RGMII mode -> enables RMII mode */
-		meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
-					PRG_ETH0_EXT_PHY_MODE_MASK,
-					PRG_ETH0_EXT_RMII_MODE);
+		phy_intf_sel = PHY_INTF_SEL_RMII;
 		break;
 	default:
 		dev_err(dwmac->dev, "fail to set phy-mode %s\n",
@@ -260,6 +256,10 @@ static int meson_axg_set_phy_mode(struct meson8b_dwmac *dwmac)
 		return -EINVAL;
 	}
 
+	meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_EXT_PHY_MODE_MASK,
+				FIELD_PREP(PRG_ETH0_EXT_PHY_MODE_MASK,
+					   phy_intf_sel));
+
 	return 0;
 }
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next v2 3/3] net: stmmac: meson8b: use stmmac_get_phy_intf_sel()
  2025-11-10 14:42 [PATCH net-next v2 0/3] net: stmmac: convert meson8b to use stmmac_get_phy_intf_sel() Russell King (Oracle)
  2025-11-10 14:42 ` [PATCH net-next v2 1/3] net: stmmac: meson8b: use PHY_INTF_SEL_x Russell King (Oracle)
  2025-11-10 14:42 ` [PATCH net-next v2 2/3] net: stmmac: meson8b: use phy_intf_sel directly Russell King (Oracle)
@ 2025-11-10 14:42 ` Russell King (Oracle)
  2025-11-12  2:00 ` [PATCH net-next v2 0/3] net: stmmac: convert meson8b to " patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2025-11-10 14:42 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jerome Brunet, Kevin Hilman, linux-amlogic,
	linux-arm-kernel, linux-stm32, Martin Blumenstingl,
	Maxime Coquelin, Neil Armstrong, netdev, Paolo Abeni

Use stmmac_get_phy_intf_sel() to decode the PHY interface mode to the
phy_intf_sel value, validate the result and use that to set the
control register to select the operating mode for the DWMAC core.

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../ethernet/stmicro/stmmac/dwmac-meson8b.c    | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
index 865cd6166134..e4d5c41294f4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
@@ -238,22 +238,12 @@ static int meson_axg_set_phy_mode(struct meson8b_dwmac *dwmac)
 {
 	int phy_intf_sel;
 
-	switch (dwmac->phy_mode) {
-	case PHY_INTERFACE_MODE_RGMII:
-	case PHY_INTERFACE_MODE_RGMII_RXID:
-	case PHY_INTERFACE_MODE_RGMII_ID:
-	case PHY_INTERFACE_MODE_RGMII_TXID:
-		/* enable RGMII mode */
-		phy_intf_sel = PHY_INTF_SEL_RGMII;
-		break;
-	case PHY_INTERFACE_MODE_RMII:
-		/* disable RGMII mode -> enables RMII mode */
-		phy_intf_sel = PHY_INTF_SEL_RMII;
-		break;
-	default:
+	phy_intf_sel = stmmac_get_phy_intf_sel(dwmac->phy_mode);
+	if (phy_intf_sel != PHY_INTF_SEL_RGMII &&
+	    phy_intf_sel != PHY_INTF_SEL_RMII) {
 		dev_err(dwmac->dev, "fail to set phy-mode %s\n",
 			phy_modes(dwmac->phy_mode));
-		return -EINVAL;
+		return phy_intf_sel < 0 ? phy_intf_sel : -EINVAL;
 	}
 
 	meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_EXT_PHY_MODE_MASK,
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2 0/3] net: stmmac: convert meson8b to use stmmac_get_phy_intf_sel()
  2025-11-10 14:42 [PATCH net-next v2 0/3] net: stmmac: convert meson8b to use stmmac_get_phy_intf_sel() Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2025-11-10 14:42 ` [PATCH net-next v2 3/3] net: stmmac: meson8b: use stmmac_get_phy_intf_sel() Russell King (Oracle)
@ 2025-11-12  2:00 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-12  2:00 UTC (permalink / raw)
  To: Russell King
  Cc: andrew, hkallweit1, alexandre.torgue, andrew+netdev, davem,
	edumazet, kuba, jbrunet, khilman, linux-amlogic, linux-arm-kernel,
	linux-stm32, martin.blumenstingl, mcoquelin.stm32, neil.armstrong,
	netdev, pabeni

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 10 Nov 2025 14:42:26 +0000 you wrote:
> This series splits out meson8b from the previous 16 patch series
> as that now has r-b tags.
> 
> This series converts meson8b to use stmmac_get_phy_intf_sel(). This
> driver is not converted to the set_phy_intf_sel() method as it is
> unclear whether there are ordering dependencies that would prevent
> it. I would appreciate the driver author looking in to whether this
> conversion is possible.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/3] net: stmmac: meson8b: use PHY_INTF_SEL_x
    https://git.kernel.org/netdev/net-next/c/12f42597ab14
  - [net-next,v2,2/3] net: stmmac: meson8b: use phy_intf_sel directly
    https://git.kernel.org/netdev/net-next/c/52d639da6fee
  - [net-next,v2,3/3] net: stmmac: meson8b: use stmmac_get_phy_intf_sel()
    https://git.kernel.org/netdev/net-next/c/da3d1501235d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-12  2:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 14:42 [PATCH net-next v2 0/3] net: stmmac: convert meson8b to use stmmac_get_phy_intf_sel() Russell King (Oracle)
2025-11-10 14:42 ` [PATCH net-next v2 1/3] net: stmmac: meson8b: use PHY_INTF_SEL_x Russell King (Oracle)
2025-11-10 14:42 ` [PATCH net-next v2 2/3] net: stmmac: meson8b: use phy_intf_sel directly Russell King (Oracle)
2025-11-10 14:42 ` [PATCH net-next v2 3/3] net: stmmac: meson8b: use stmmac_get_phy_intf_sel() Russell King (Oracle)
2025-11-12  2:00 ` [PATCH net-next v2 0/3] net: stmmac: convert meson8b to " patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).