summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-05-13 10:25:15 +0300
committerJakub Kicinski <kuba@kernel.org>2024-05-14 03:19:59 +0300
commitf0ef433fc264b70a415257dba126acbe3fda666b (patch)
treead82afcff7ba55fb330f94b69267dc746308daa8
parentf9cdff1bdacc947bcd182ea69d94b9f5b32ff328 (diff)
downloadlinux-f0ef433fc264b70a415257dba126acbe3fda666b.tar.xz
net: stmmac: introduce pcs_init/pcs_exit stmmac operations
Introduce a mechanism whereby platforms can create their PCS instances prior to the network device being published to userspace, but after some of the core stmmac initialisation has been completed. This means that the data structures that platforms need will be available. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Serge Semin <fancer.lancer@gmail.com> Co-developed-by: Romain Gantois <romain.gantois@bootlin.com> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com> Reviewed-by: Hariprasad Kelam <hkelam@marvell.com> Link: https://lore.kernel.org/r/20240513-rzn1-gmac1-v7-4-6acf58b5440d@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c8
-rw-r--r--include/linux/stmmac.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 54708440e27b..aa43117134d3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -505,7 +505,10 @@ int stmmac_pcs_setup(struct net_device *ndev)
priv = netdev_priv(ndev);
mode = priv->plat->phy_interface;
- if (priv->plat->mdio_bus_data && priv->plat->mdio_bus_data->has_xpcs) {
+ if (priv->plat->pcs_init) {
+ ret = priv->plat->pcs_init(priv);
+ } else if (priv->plat->mdio_bus_data &&
+ priv->plat->mdio_bus_data->has_xpcs) {
/* Try to probe the XPCS by scanning all addresses */
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
xpcs = xpcs_create_mdiodev(priv->mii, addr, mode);
@@ -533,6 +536,9 @@ void stmmac_pcs_clean(struct net_device *ndev)
{
struct stmmac_priv *priv = netdev_priv(ndev);
+ if (priv->plat->pcs_exit)
+ priv->plat->pcs_exit(priv);
+
if (!priv->hw->xpcs)
return;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index dfa1828cd756..4a24a246c617 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -285,6 +285,8 @@ struct plat_stmmacenet_data {
int (*crosststamp)(ktime_t *device, struct system_counterval_t *system,
void *ctx);
void (*dump_debug_regs)(void *priv);
+ int (*pcs_init)(struct stmmac_priv *priv);
+ void (*pcs_exit)(struct stmmac_priv *priv);
void *bsp_priv;
struct clk *stmmac_clk;
struct clk *pclk;