public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/5] net: stmmac: dwmac-socfpga: Cleanup .fix_mac_speed
@ 2026-03-24  9:20 Maxime Chevallier
  2026-03-24  9:20 ` [PATCH net-next 1/5] net: stmmac: dwmac-socfpga: Move internal helpers Maxime Chevallier
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Maxime Chevallier @ 2026-03-24  9:20 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, Russell King
  Cc: Maxime Chevallier, thomas.petazzoni, Alexis Lothoré,
	Rohan G Thomas, Mun Yew Tham, netdev, linux-kernel,
	linux-arm-kernel, linux-stm32

Hi everyone,

This small series does a bit of cleanup in the dwmad-socfpga glue
driver, especially around the .fix_mac_speed() operation.

It's mostly about re-using existing helpers from the glue driver, as
well as reorganizing the code to make the local private structures a
little bit smaller.

No functionnal changes are intended, this was tested on cyclone V.

Maxime Chevallier (5):
  net: stmmac: dwmac-socfpga: Move internal helpers
  net: stmmac: dwmac-socfpga: Use the socfpga_sgmii_config() helper
  net: stmmac: dwmac-socfpga: Use the correct type for interface modes
  net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper
  net: stmmac: dwmac-sofcpga: Drop the struct device reference

 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 58 +++++++++----------
 1 file changed, 28 insertions(+), 30 deletions(-)

-- 
2.49.0


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

* [PATCH net-next 1/5] net: stmmac: dwmac-socfpga: Move internal helpers
  2026-03-24  9:20 [PATCH net-next 0/5] net: stmmac: dwmac-socfpga: Cleanup .fix_mac_speed Maxime Chevallier
@ 2026-03-24  9:20 ` Maxime Chevallier
  2026-03-24  9:48   ` Russell King (Oracle)
  2026-03-24  9:20 ` [PATCH net-next 2/5] net: stmmac: dwmac-socfpga: Use the socfpga_sgmii_config() helper Maxime Chevallier
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Maxime Chevallier @ 2026-03-24  9:20 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, Russell King
  Cc: Maxime Chevallier, thomas.petazzoni, Alexis Lothoré,
	Rohan G Thomas, Mun Yew Tham, netdev, linux-kernel,
	linux-arm-kernel, linux-stm32

This is preparatory work to allow reusing the SGMII configuration helper
and the wrapper to get the interface in the fix_mac_speed() callback.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 5f89fd968ae9..42da73b92ceb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -72,6 +72,18 @@ struct socfpga_dwmac {
 	const struct socfpga_dwmac_ops *ops;
 };
 
+static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac)
+{
+	return dwmac->plat_dat->phy_interface;
+}
+
+static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable)
+{
+	u16 val = enable ? SGMII_ADAPTER_ENABLE : SGMII_ADAPTER_DISABLE;
+
+	writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
+}
+
 static void socfpga_dwmac_fix_mac_speed(void *bsp_priv,
 					phy_interface_t interface, int speed,
 					unsigned int mode)
@@ -244,18 +256,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
 	return ret;
 }
 
-static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac)
-{
-	return dwmac->plat_dat->phy_interface;
-}
-
-static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable)
-{
-	u16 val = enable ? SGMII_ADAPTER_ENABLE : SGMII_ADAPTER_DISABLE;
-
-	writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
-}
-
 static int socfpga_set_phy_mode_common(int phymode, u32 *val)
 {
 	switch (phymode) {
-- 
2.49.0


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

* [PATCH net-next 2/5] net: stmmac: dwmac-socfpga: Use the socfpga_sgmii_config() helper
  2026-03-24  9:20 [PATCH net-next 0/5] net: stmmac: dwmac-socfpga: Cleanup .fix_mac_speed Maxime Chevallier
  2026-03-24  9:20 ` [PATCH net-next 1/5] net: stmmac: dwmac-socfpga: Move internal helpers Maxime Chevallier
@ 2026-03-24  9:20 ` Maxime Chevallier
  2026-03-24  9:48   ` Russell King (Oracle)
  2026-03-24  9:20 ` [PATCH net-next 3/5] net: stmmac: dwmac-socfpga: Use the correct type for interface modes Maxime Chevallier
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Maxime Chevallier @ 2026-03-24  9:20 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, Russell King
  Cc: Maxime Chevallier, thomas.petazzoni, Alexis Lothoré,
	Rohan G Thomas, Mun Yew Tham, netdev, linux-kernel,
	linux-arm-kernel, linux-stm32

Use the existing socfpga_sgmii_config() helper in
socfpga_dwmac_fix_mac_speed(), instead of re-coding the register access.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 42da73b92ceb..ed6448c0ad2a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -95,8 +95,7 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv,
 	u32 val;
 
 	if (sgmii_adapter_base)
-		writew(SGMII_ADAPTER_DISABLE,
-		       sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
+		socfpga_sgmii_config(dwmac, false);
 
 	if (splitter_base) {
 		val = readl(splitter_base + EMAC_SPLITTER_CTRL_REG);
@@ -121,8 +120,7 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv,
 	if ((priv->plat->phy_interface == PHY_INTERFACE_MODE_SGMII ||
 	     priv->plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) &&
 	     sgmii_adapter_base)
-		writew(SGMII_ADAPTER_ENABLE,
-		       sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
+		socfpga_sgmii_config(dwmac, true);
 }
 
 static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev)
-- 
2.49.0


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

* [PATCH net-next 3/5] net: stmmac: dwmac-socfpga: Use the correct type for interface modes
  2026-03-24  9:20 [PATCH net-next 0/5] net: stmmac: dwmac-socfpga: Cleanup .fix_mac_speed Maxime Chevallier
  2026-03-24  9:20 ` [PATCH net-next 1/5] net: stmmac: dwmac-socfpga: Move internal helpers Maxime Chevallier
  2026-03-24  9:20 ` [PATCH net-next 2/5] net: stmmac: dwmac-socfpga: Use the socfpga_sgmii_config() helper Maxime Chevallier
@ 2026-03-24  9:20 ` Maxime Chevallier
  2026-03-24  9:49   ` Russell King (Oracle)
  2026-03-24  9:20 ` [PATCH net-next 4/5] net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper Maxime Chevallier
  2026-03-24  9:21 ` [PATCH net-next 5/5] net: stmmac: dwmac-sofcpga: Drop the struct device reference Maxime Chevallier
  4 siblings, 1 reply; 11+ messages in thread
From: Maxime Chevallier @ 2026-03-24  9:20 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, Russell King
  Cc: Maxime Chevallier, thomas.petazzoni, Alexis Lothoré,
	Rohan G Thomas, Mun Yew Tham, netdev, linux-kernel,
	linux-arm-kernel, linux-stm32

The internal helper socfpga_get_plat_phymode() returns an int where we
actually return a PHY_INTERFACE_MODE_xxx, use the correct type for this.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index ed6448c0ad2a..629074dbbc15 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -72,7 +72,7 @@ struct socfpga_dwmac {
 	const struct socfpga_dwmac_ops *ops;
 };
 
-static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac)
+static phy_interface_t socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac)
 {
 	return dwmac->plat_dat->phy_interface;
 }
@@ -386,7 +386,7 @@ static int smtg_crosststamp(ktime_t *device, struct system_counterval_t *system,
 static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
 {
 	struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
-	int phymode = socfpga_get_plat_phymode(dwmac);
+	phy_interface_t phymode = socfpga_get_plat_phymode(dwmac);
 	u32 reg_offset = dwmac->reg_offset;
 	u32 reg_shift = dwmac->reg_shift;
 	u32 ctrl, val, module;
@@ -444,7 +444,7 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
 static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac)
 {
 	struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
-	int phymode = socfpga_get_plat_phymode(dwmac);
+	phy_interface_t phymode = socfpga_get_plat_phymode(dwmac);
 	u32 reg_offset = dwmac->reg_offset;
 	u32 reg_shift = dwmac->reg_shift;
 	u32 ctrl, val, module;
-- 
2.49.0


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

* [PATCH net-next 4/5] net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper
  2026-03-24  9:20 [PATCH net-next 0/5] net: stmmac: dwmac-socfpga: Cleanup .fix_mac_speed Maxime Chevallier
                   ` (2 preceding siblings ...)
  2026-03-24  9:20 ` [PATCH net-next 3/5] net: stmmac: dwmac-socfpga: Use the correct type for interface modes Maxime Chevallier
@ 2026-03-24  9:20 ` Maxime Chevallier
  2026-03-24  9:51   ` Russell King (Oracle)
  2026-03-24  9:21 ` [PATCH net-next 5/5] net: stmmac: dwmac-sofcpga: Drop the struct device reference Maxime Chevallier
  4 siblings, 1 reply; 11+ messages in thread
From: Maxime Chevallier @ 2026-03-24  9:20 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, Russell King
  Cc: Maxime Chevallier, thomas.petazzoni, Alexis Lothoré,
	Rohan G Thomas, Mun Yew Tham, netdev, linux-kernel,
	linux-arm-kernel, linux-stm32

We enable/disable the sgmii_adapter in the .fix_mac_speed() ops based on
the phy_mode used in the plat_data. We currently get it with :

socfpga_dwmac
  ->dev
    ->drv_data
      ->netdev
        ->priv
	  ->stmmac_priv
	    ->plat
	      ->phy_interface

where we can get it with :

socfpga_dwmac
  ->plat_data
    ->phy_interface (done by socfpga_get_plat_phymode)

Use that helper here.

Note that we are also being passed a phy_interface_t from the
.fix_mac_speed() callback, provided by phylink.

We can handle that in the future when dynamic interface selection is
supported. We'd need to guarantee that we have a Lynx PCS to handle it.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 629074dbbc15..ae40de2ed8eb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -89,9 +89,9 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv,
 					unsigned int mode)
 {
 	struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)bsp_priv;
-	struct stmmac_priv *priv = netdev_priv(dev_get_drvdata(dwmac->dev));
-	void __iomem *splitter_base = dwmac->splitter_base;
 	void __iomem *sgmii_adapter_base = dwmac->sgmii_adapter_base;
+	phy_interface_t phymode = socfpga_get_plat_phymode(dwmac);
+	void __iomem *splitter_base = dwmac->splitter_base;
 	u32 val;
 
 	if (sgmii_adapter_base)
@@ -117,9 +117,8 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv,
 		writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG);
 	}
 
-	if ((priv->plat->phy_interface == PHY_INTERFACE_MODE_SGMII ||
-	     priv->plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) &&
-	     sgmii_adapter_base)
+	if ((phymode == PHY_INTERFACE_MODE_SGMII ||
+	     phymode == PHY_INTERFACE_MODE_1000BASEX) && sgmii_adapter_base)
 		socfpga_sgmii_config(dwmac, true);
 }
 
-- 
2.49.0


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

* [PATCH net-next 5/5] net: stmmac: dwmac-sofcpga: Drop the struct device reference
  2026-03-24  9:20 [PATCH net-next 0/5] net: stmmac: dwmac-socfpga: Cleanup .fix_mac_speed Maxime Chevallier
                   ` (3 preceding siblings ...)
  2026-03-24  9:20 ` [PATCH net-next 4/5] net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper Maxime Chevallier
@ 2026-03-24  9:21 ` Maxime Chevallier
  2026-03-24  9:53   ` Russell King (Oracle)
  4 siblings, 1 reply; 11+ messages in thread
From: Maxime Chevallier @ 2026-03-24  9:21 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, Russell King
  Cc: Maxime Chevallier, thomas.petazzoni, Alexis Lothoré,
	Rohan G Thomas, Mun Yew Tham, netdev, linux-kernel,
	linux-arm-kernel, linux-stm32

We keep a reference to our the struct device in the socfpga_dwmac priv
structure, but now it's only ever used to produce logs in the
.set_phy_mode() ops, that are specific to this driver.

When we call that ops, we always have a ref to the struct device around,
so let's pass it to .set_phy_mode(). We can now discard that reference
from struct socfpga_dwmac.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c   | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index ae40de2ed8eb..1d7f0a57d288 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -53,14 +53,14 @@
 
 struct socfpga_dwmac;
 struct socfpga_dwmac_ops {
-	int (*set_phy_mode)(struct socfpga_dwmac *dwmac_priv);
+	int (*set_phy_mode)(struct socfpga_dwmac *dwmac_priv,
+			    struct device *dev);
 	void (*setup_plat_dat)(struct socfpga_dwmac *dwmac_priv);
 };
 
 struct socfpga_dwmac {
 	u32	reg_offset;
 	u32	reg_shift;
-	struct	device *dev;
 	struct plat_stmmacenet_data *plat_dat;
 	struct regmap *sys_mgr_base_addr;
 	struct reset_control *stmmac_rst;
@@ -243,7 +243,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
 	dwmac->reg_offset = reg_offset;
 	dwmac->reg_shift = reg_shift;
 	dwmac->sys_mgr_base_addr = sys_mgr_base_addr;
-	dwmac->dev = dev;
 	of_node_put(np_sgmii_adapter);
 
 	return 0;
@@ -382,7 +381,8 @@ static int smtg_crosststamp(ktime_t *device, struct system_counterval_t *system,
 	return 0;
 }
 
-static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
+static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac,
+				     struct device *dev)
 {
 	struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
 	phy_interface_t phymode = socfpga_get_plat_phymode(dwmac);
@@ -391,7 +391,7 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
 	u32 ctrl, val, module;
 
 	if (socfpga_set_phy_mode_common(phymode, &val)) {
-		dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
+		dev_err(dev, "bad phy mode %d\n", phymode);
 		return -EINVAL;
 	}
 
@@ -440,7 +440,8 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
 	return 0;
 }
 
-static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac)
+static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac,
+				      struct device *dev)
 {
 	struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
 	phy_interface_t phymode = socfpga_get_plat_phymode(dwmac);
@@ -552,7 +553,7 @@ static int socfpga_dwmac_init(struct device *dev, void *bsp_priv)
 {
 	struct socfpga_dwmac *dwmac = bsp_priv;
 
-	return dwmac->ops->set_phy_mode(dwmac);
+	return dwmac->ops->set_phy_mode(dwmac, dev);
 }
 
 static void socfpga_gen5_setup_plat_dat(struct socfpga_dwmac *dwmac)
-- 
2.49.0


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

* Re: [PATCH net-next 1/5] net: stmmac: dwmac-socfpga: Move internal helpers
  2026-03-24  9:20 ` [PATCH net-next 1/5] net: stmmac: dwmac-socfpga: Move internal helpers Maxime Chevallier
@ 2026-03-24  9:48   ` Russell King (Oracle)
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King (Oracle) @ 2026-03-24  9:48 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, thomas.petazzoni,
	Alexis Lothoré, Rohan G Thomas, Mun Yew Tham, netdev,
	linux-kernel, linux-arm-kernel, linux-stm32

On Tue, Mar 24, 2026 at 10:20:56AM +0100, Maxime Chevallier wrote:
> This is preparatory work to allow reusing the SGMII configuration helper
> and the wrapper to get the interface in the fix_mac_speed() callback.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
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] 11+ messages in thread

* Re: [PATCH net-next 2/5] net: stmmac: dwmac-socfpga: Use the socfpga_sgmii_config() helper
  2026-03-24  9:20 ` [PATCH net-next 2/5] net: stmmac: dwmac-socfpga: Use the socfpga_sgmii_config() helper Maxime Chevallier
@ 2026-03-24  9:48   ` Russell King (Oracle)
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King (Oracle) @ 2026-03-24  9:48 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, thomas.petazzoni,
	Alexis Lothoré, Rohan G Thomas, Mun Yew Tham, netdev,
	linux-kernel, linux-arm-kernel, linux-stm32

On Tue, Mar 24, 2026 at 10:20:57AM +0100, Maxime Chevallier wrote:
> Use the existing socfpga_sgmii_config() helper in
> socfpga_dwmac_fix_mac_speed(), instead of re-coding the register access.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
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] 11+ messages in thread

* Re: [PATCH net-next 3/5] net: stmmac: dwmac-socfpga: Use the correct type for interface modes
  2026-03-24  9:20 ` [PATCH net-next 3/5] net: stmmac: dwmac-socfpga: Use the correct type for interface modes Maxime Chevallier
@ 2026-03-24  9:49   ` Russell King (Oracle)
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King (Oracle) @ 2026-03-24  9:49 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, thomas.petazzoni,
	Alexis Lothoré, Rohan G Thomas, Mun Yew Tham, netdev,
	linux-kernel, linux-arm-kernel, linux-stm32

On Tue, Mar 24, 2026 at 10:20:58AM +0100, Maxime Chevallier wrote:
> The internal helper socfpga_get_plat_phymode() returns an int where we
> actually return a PHY_INTERFACE_MODE_xxx, use the correct type for this.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
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] 11+ messages in thread

* Re: [PATCH net-next 4/5] net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper
  2026-03-24  9:20 ` [PATCH net-next 4/5] net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper Maxime Chevallier
@ 2026-03-24  9:51   ` Russell King (Oracle)
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King (Oracle) @ 2026-03-24  9:51 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, thomas.petazzoni,
	Alexis Lothoré, Rohan G Thomas, Mun Yew Tham, netdev,
	linux-kernel, linux-arm-kernel, linux-stm32

On Tue, Mar 24, 2026 at 10:20:59AM +0100, Maxime Chevallier wrote:
> We enable/disable the sgmii_adapter in the .fix_mac_speed() ops based on
> the phy_mode used in the plat_data. We currently get it with :
> 
> socfpga_dwmac
>   ->dev
>     ->drv_data
>       ->netdev
>         ->priv
> 	  ->stmmac_priv
> 	    ->plat
> 	      ->phy_interface
> 
> where we can get it with :
> 
> socfpga_dwmac
>   ->plat_data
>     ->phy_interface (done by socfpga_get_plat_phymode)
> 
> Use that helper here.
> 
> Note that we are also being passed a phy_interface_t from the
> .fix_mac_speed() callback, provided by phylink.
> 
> We can handle that in the future when dynamic interface selection is
> supported. We'd need to guarantee that we have a Lynx PCS to handle it.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Nice cleanup!

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
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] 11+ messages in thread

* Re: [PATCH net-next 5/5] net: stmmac: dwmac-sofcpga: Drop the struct device reference
  2026-03-24  9:21 ` [PATCH net-next 5/5] net: stmmac: dwmac-sofcpga: Drop the struct device reference Maxime Chevallier
@ 2026-03-24  9:53   ` Russell King (Oracle)
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King (Oracle) @ 2026-03-24  9:53 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, thomas.petazzoni,
	Alexis Lothoré, Rohan G Thomas, Mun Yew Tham, netdev,
	linux-kernel, linux-arm-kernel, linux-stm32

On Tue, Mar 24, 2026 at 10:21:00AM +0100, Maxime Chevallier wrote:
> We keep a reference to our the struct device in the socfpga_dwmac priv
> structure, but now it's only ever used to produce logs in the
> .set_phy_mode() ops, that are specific to this driver.
> 
> When we call that ops, we always have a ref to the struct device around,
> so let's pass it to .set_phy_mode(). We can now discard that reference
> from struct socfpga_dwmac.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
>  .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c   | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> index ae40de2ed8eb..1d7f0a57d288 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> @@ -53,14 +53,14 @@
>  
>  struct socfpga_dwmac;
>  struct socfpga_dwmac_ops {
> -	int (*set_phy_mode)(struct socfpga_dwmac *dwmac_priv);
> +	int (*set_phy_mode)(struct socfpga_dwmac *dwmac_priv,
> +			    struct device *dev);

As you're changing the signature of this method, would it be more
sensible to put "struct device *dev" as the first arg, rather than
swapping the order below:

> @@ -552,7 +553,7 @@ static int socfpga_dwmac_init(struct device *dev, void *bsp_priv)
>  {
>  	struct socfpga_dwmac *dwmac = bsp_priv;
>  
> -	return dwmac->ops->set_phy_mode(dwmac);
> +	return dwmac->ops->set_phy_mode(dwmac, dev);

?

In either case:

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
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] 11+ messages in thread

end of thread, other threads:[~2026-03-24  9:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24  9:20 [PATCH net-next 0/5] net: stmmac: dwmac-socfpga: Cleanup .fix_mac_speed Maxime Chevallier
2026-03-24  9:20 ` [PATCH net-next 1/5] net: stmmac: dwmac-socfpga: Move internal helpers Maxime Chevallier
2026-03-24  9:48   ` Russell King (Oracle)
2026-03-24  9:20 ` [PATCH net-next 2/5] net: stmmac: dwmac-socfpga: Use the socfpga_sgmii_config() helper Maxime Chevallier
2026-03-24  9:48   ` Russell King (Oracle)
2026-03-24  9:20 ` [PATCH net-next 3/5] net: stmmac: dwmac-socfpga: Use the correct type for interface modes Maxime Chevallier
2026-03-24  9:49   ` Russell King (Oracle)
2026-03-24  9:20 ` [PATCH net-next 4/5] net: stmmac: dwmac-socfpga: get the phy_mode with the dedicated helper Maxime Chevallier
2026-03-24  9:51   ` Russell King (Oracle)
2026-03-24  9:21 ` [PATCH net-next 5/5] net: stmmac: dwmac-sofcpga: Drop the struct device reference Maxime Chevallier
2026-03-24  9:53   ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox