[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PH0PR18MB4474CF9D605C4F1EAF5978A0DEE22@PH0PR18MB4474.namprd18.prod.outlook.com>
Date: Mon, 13 May 2024 10:21:21 +0000
From: Hariprasad Kelam <hkelam@...vell.com>
To: Romain Gantois <romain.gantois@...tlin.com>,
"David S. Miller"
<davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Rob Herring
<robh@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Geert Uytterhoeven
<geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Alexandre
Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Russell King
<linux@...linux.org.uk>,
Clément Léger
<clement.leger@...tlin.com>,
Serge Semin <fancer.lancer@...il.com>
CC: Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>,
"devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>,
"linux-stm32@...md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"Russell King (Oracle)"
<rmk+kernel@...linux.org.uk>,
Maxime Chevallier
<maxime.chevallier@...tlin.com>
Subject: [PATCH net-next v7 4/7] net: stmmac: introduce pcs_init/pcs_exit
stmmac operations
> From: "Russell King (Oracle)" <rmk+kernel@...linux.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@...linux.org.uk>
> Reviewed-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
> Reviewed-by: Serge Semin <fancer.lancer@...il.com>
> Co-developed-by: Romain Gantois <romain.gantois@...tlin.com>
> Signed-off-by: Romain Gantois <romain.gantois@...tlin.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 54708440e27b8..aa43117134d38 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
> 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
>
Reviewed-by: Hariprasad Kelam <hkelam@...vell.com>
Powered by blists - more mailing lists