lkml.org 
[lkml]   [2024]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH net-next v5 4/7] net: stmmac: introduce pcs_init/pcs_exit stmmac operations
    From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>

    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>
    Co-developed-by: Romain Gantois <romain.gantois@bootlin.com>
    Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
    ---
    drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++++-
    include/linux/stmmac.h | 2 ++
    2 files changed, 9 insertions(+), 1 deletion(-)

    diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
    index af8ad9768da10..1c788caea0cfb 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);
    @@ -531,6 +534,9 @@ int stmmac_pcs_setup(struct net_device *ndev)

    void stmmac_pcs_clean(struct stmmac_priv *priv)
    {
    + 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 dfa1828cd756a..4a24a246c617d 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;
    --
    2.44.0


    \
     
     \ /
      Last update: 2024-05-27 18:08    [W:3.481 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site