Commit f0ef433f authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski

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: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Co-developed-by: default avatarRomain Gantois <romain.gantois@bootlin.com>
Signed-off-by: default avatarRomain Gantois <romain.gantois@bootlin.com>
Reviewed-by: default avatarHariprasad Kelam <hkelam@marvell.com>
Link: https://lore.kernel.org/r/20240513-rzn1-gmac1-v7-4-6acf58b5440d@bootlin.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f9cdff1b
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment