Skip to content

Commit f0ef433

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
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) <[email protected]> Reviewed-by: Maxime Chevallier <[email protected]> Reviewed-by: Serge Semin <[email protected]> Co-developed-by: Romain Gantois <[email protected]> Signed-off-by: Romain Gantois <[email protected]> Reviewed-by: Hariprasad Kelam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f9cdff1 commit f0ef433

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,10 @@ int stmmac_pcs_setup(struct net_device *ndev)
505505
priv = netdev_priv(ndev);
506506
mode = priv->plat->phy_interface;
507507

508-
if (priv->plat->mdio_bus_data && priv->plat->mdio_bus_data->has_xpcs) {
508+
if (priv->plat->pcs_init) {
509+
ret = priv->plat->pcs_init(priv);
510+
} else if (priv->plat->mdio_bus_data &&
511+
priv->plat->mdio_bus_data->has_xpcs) {
509512
/* Try to probe the XPCS by scanning all addresses */
510513
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
511514
xpcs = xpcs_create_mdiodev(priv->mii, addr, mode);
@@ -533,6 +536,9 @@ void stmmac_pcs_clean(struct net_device *ndev)
533536
{
534537
struct stmmac_priv *priv = netdev_priv(ndev);
535538

539+
if (priv->plat->pcs_exit)
540+
priv->plat->pcs_exit(priv);
541+
536542
if (!priv->hw->xpcs)
537543
return;
538544

include/linux/stmmac.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ struct plat_stmmacenet_data {
285285
int (*crosststamp)(ktime_t *device, struct system_counterval_t *system,
286286
void *ctx);
287287
void (*dump_debug_regs)(void *priv);
288+
int (*pcs_init)(struct stmmac_priv *priv);
289+
void (*pcs_exit)(struct stmmac_priv *priv);
288290
void *bsp_priv;
289291
struct clk *stmmac_clk;
290292
struct clk *pclk;

0 commit comments

Comments
 (0)