* [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups
@ 2025-04-23 10:46 Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 1/3] net: stmmac: socfpga: Enable internal GMII when using 1000BaseX Maxime Chevallier
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Maxime Chevallier @ 2025-04-23 10:46 UTC (permalink / raw)
To: davem, Andrew Lunn, Russell King, Jakub Kicinski, Eric Dumazet,
Paolo Abeni
Cc: Maxime Chevallier, netdev, linux-kernel, thomas.petazzoni,
Simon Horman, Alexis Lothoré
Hello everyone,
This small series sorts-out 1000BaseX support and does a bit of cleanup
for the Lynx conversion.
Patch 1 makes sure that we set the right phy_mode when working in
1000BaseX mode, so that the internal GMII is configured correctly.
Patch 2 removes a check for phy_device upon calling fix_mac_speed(). As
the SGMII adapter may be chained to a Lynx PCS, checking for a
phy_device to be attached to the netdev before enabling the SGMII
adapter doesn't make sense, as we won't have a downstream PHY when using
1000BaseX.
Patch 3 cleans an unused field from the PCS conversion.
Changes in V2:
- Added Russell's review tags
- Reworked patch 2 to check for phy_interface when configuring the
adapter, as suggested by Russell.
V1: https://lore.kernel.org/netdev/20250422094701.49798-1-maxime.chevallier@bootlin.com/
Maxime Chevallier (3):
net: stmmac: socfpga: Enable internal GMII when using 1000BaseX
net: stmmac: socfpga: Don't check for phy to enable the SGMII adapter
net: stmmac: socfpga: Remove unused pcs-mdiodev field
.../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v2 1/3] net: stmmac: socfpga: Enable internal GMII when using 1000BaseX
2025-04-23 10:46 [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups Maxime Chevallier
@ 2025-04-23 10:46 ` Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 2/3] net: stmmac: socfpga: Don't check for phy to enable the SGMII adapter Maxime Chevallier
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Maxime Chevallier @ 2025-04-23 10:46 UTC (permalink / raw)
To: davem, Andrew Lunn, Russell King, Jakub Kicinski, Eric Dumazet,
Paolo Abeni
Cc: Maxime Chevallier, netdev, linux-kernel, thomas.petazzoni,
Simon Horman, Alexis Lothoré, Russell King (Oracle)
Dwmac Socfpga may be used with an instance of a Lynx / Altera TSE PCS,
in which case it gains support for 1000BaseX.
It appears that the PCS is wired to the MAC through an internal GMII
bus. Make sure that we enable the GMII_MII mode for the internal MAC when
using 1000BaseX.
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
V2: Added Russell's r'd-by tag
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 59f90b123c5b..027356033e5e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -256,6 +256,7 @@ static int socfpga_set_phy_mode_common(int phymode, u32 *val)
case PHY_INTERFACE_MODE_MII:
case PHY_INTERFACE_MODE_GMII:
case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_1000BASEX:
*val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
break;
case PHY_INTERFACE_MODE_RMII:
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net v2 2/3] net: stmmac: socfpga: Don't check for phy to enable the SGMII adapter
2025-04-23 10:46 [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 1/3] net: stmmac: socfpga: Enable internal GMII when using 1000BaseX Maxime Chevallier
@ 2025-04-23 10:46 ` Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 3/3] net: stmmac: socfpga: Remove unused pcs-mdiodev field Maxime Chevallier
2025-04-23 13:06 ` [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups Maxime Chevallier
3 siblings, 0 replies; 5+ messages in thread
From: Maxime Chevallier @ 2025-04-23 10:46 UTC (permalink / raw)
To: davem, Andrew Lunn, Russell King, Jakub Kicinski, Eric Dumazet,
Paolo Abeni
Cc: Maxime Chevallier, netdev, linux-kernel, thomas.petazzoni,
Simon Horman, Alexis Lothoré
The SGMII adapter needs to be enabled for both Cisco SGMII and 1000BaseX
operations. It doesn't make sense to check for an attached phydev here,
as we simply might not have any, in particular if we're using the
1000BaseX interface mode.
Make so that we only re-enable the SGMII adapter when it's present, and
when we use a phy_mode that is handled by said adapter.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
V2: - Following Russell's review, added a check for the phy_interface.
- Had to rename some variables around, following the naming
conventions for that driver
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 027356033e5e..c832a41c1747 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -62,14 +62,13 @@ struct socfpga_dwmac {
struct mdio_device *pcs_mdiodev;
};
-static void socfpga_dwmac_fix_mac_speed(void *priv, int speed, unsigned int mode)
+static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, int speed,
+ unsigned int mode)
{
- struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv;
+ 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;
- struct device *dev = dwmac->dev;
- struct net_device *ndev = dev_get_drvdata(dev);
- struct phy_device *phy_dev = ndev->phydev;
u32 val;
if (sgmii_adapter_base)
@@ -96,7 +95,9 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, int speed, unsigned int mode
writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG);
}
- if (phy_dev && sgmii_adapter_base)
+ 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);
}
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net v2 3/3] net: stmmac: socfpga: Remove unused pcs-mdiodev field
2025-04-23 10:46 [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 1/3] net: stmmac: socfpga: Enable internal GMII when using 1000BaseX Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 2/3] net: stmmac: socfpga: Don't check for phy to enable the SGMII adapter Maxime Chevallier
@ 2025-04-23 10:46 ` Maxime Chevallier
2025-04-23 13:06 ` [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups Maxime Chevallier
3 siblings, 0 replies; 5+ messages in thread
From: Maxime Chevallier @ 2025-04-23 10:46 UTC (permalink / raw)
To: davem, Andrew Lunn, Russell King, Jakub Kicinski, Eric Dumazet,
Paolo Abeni
Cc: Maxime Chevallier, netdev, linux-kernel, thomas.petazzoni,
Simon Horman, Alexis Lothoré, Russell King (Oracle)
When dwmac-socfpga was converted to using the Lynx PCS (previously
referred to in the driver as the Altera TSE PCS), the
lynx_pcs_create_mdiodev() was used to create the pcs instance.
As this function didn't exist in the early versions of the series, a
local mdiodev object was stored for PCS creation. It was never used, but
still made it into the driver, so remove it.
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
V2: Added Russell's r'd-by tag
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index c832a41c1747..72b50f6d72f4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -59,7 +59,6 @@ struct socfpga_dwmac {
void __iomem *sgmii_adapter_base;
bool f2h_ptp_ref_clk;
const struct socfpga_dwmac_ops *ops;
- struct mdio_device *pcs_mdiodev;
};
static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, int speed,
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups
2025-04-23 10:46 [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups Maxime Chevallier
` (2 preceding siblings ...)
2025-04-23 10:46 ` [PATCH net v2 3/3] net: stmmac: socfpga: Remove unused pcs-mdiodev field Maxime Chevallier
@ 2025-04-23 13:06 ` Maxime Chevallier
3 siblings, 0 replies; 5+ messages in thread
From: Maxime Chevallier @ 2025-04-23 13:06 UTC (permalink / raw)
To: davem, Andrew Lunn, Russell King, Jakub Kicinski, Eric Dumazet,
Paolo Abeni
Cc: netdev, linux-kernel, thomas.petazzoni, Simon Horman,
Alexis Lothoré
On Wed, 23 Apr 2025 12:46:42 +0200
Maxime Chevallier <maxime.chevallier@bootlin.com> wrote:
Hi,
> Hello everyone,
>
> This small series sorts-out 1000BaseX support and does a bit of cleanup
> for the Lynx conversion.
>
> Patch 1 makes sure that we set the right phy_mode when working in
> 1000BaseX mode, so that the internal GMII is configured correctly.
>
> Patch 2 removes a check for phy_device upon calling fix_mac_speed(). As
> the SGMII adapter may be chained to a Lynx PCS, checking for a
> phy_device to be attached to the netdev before enabling the SGMII
> adapter doesn't make sense, as we won't have a downstream PHY when using
> 1000BaseX.
>
> Patch 3 cleans an unused field from the PCS conversion.
I mixed-up my command while generating this series, it targets net-next
and not net...
I'll respin tomorrow with the proper destination tree, sorry about that.
Maxime
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-23 13:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23 10:46 [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 1/3] net: stmmac: socfpga: Enable internal GMII when using 1000BaseX Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 2/3] net: stmmac: socfpga: Don't check for phy to enable the SGMII adapter Maxime Chevallier
2025-04-23 10:46 ` [PATCH net v2 3/3] net: stmmac: socfpga: Remove unused pcs-mdiodev field Maxime Chevallier
2025-04-23 13:06 ` [PATCH net v2 0/3] net: stmmac: socfpga: 1000BaseX support and cleanups Maxime Chevallier
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).