[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2pf2g23ln4qcoqxidy55plysn735qtfspj6nuu6f7isqxotp2@rj6ejru5eon7>
Date: Wed, 13 Dec 2023 16:09:12 +0300
From: Serge Semin <fancer.lancer@...il.com>
To: Andrew Halaney <ahalaney@...hat.com>
Cc: Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Simon Horman <horms@...nel.org>
Subject: Re: [PATCH net v2] net: stmmac: Handle disabled MDIO busses from
devicetree
On Tue, Dec 12, 2023 at 04:18:33PM -0600, Andrew Halaney wrote:
> Many hardware configurations have the MDIO bus disabled, and are instead
> using some other MDIO bus to talk to the MAC's phy.
>
> of_mdiobus_register() returns -ENODEV in this case. Let's handle it
> gracefully instead of failing to probe the MAC.
>
> Fixes: 47dd7a540b8a ("net: add support for STMicroelectronics Ethernet controllers.")
> Signed-off-by: Andrew Halaney <ahalaney@...hat.com>
> ---
> Changes in v2:
> - Improve error handling code (Serge)
> - Fix malformed Fixes tag (Simon)
> - Link to v1: https://lore.kernel.org/r/20231211-b4-stmmac-handle-mdio-enodev-v1-1-73c20c44f8d6@redhat.com
Looking good. Thanks!
Reviewed-by: Serge Semin <fancer.lancer@...il.com>
-Serge(y)
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index fa9e7e7040b9..0542cfd1817e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -591,7 +591,11 @@ int stmmac_mdio_register(struct net_device *ndev)
> new_bus->parent = priv->device;
>
> err = of_mdiobus_register(new_bus, mdio_node);
> - if (err != 0) {
> + if (err == -ENODEV) {
> + err = 0;
> + dev_info(dev, "MDIO bus is disabled\n");
> + goto bus_register_fail;
> + } else if (err) {
> dev_err_probe(dev, err, "Cannot register the MDIO bus\n");
> goto bus_register_fail;
> }
>
> ---
> base-commit: bbd220ce4e29ed55ab079007cff0b550895258eb
> change-id: 20231211-b4-stmmac-handle-mdio-enodev-82168de68c6a
>
> Best regards,
> --
> Andrew Halaney <ahalaney@...hat.com>
>
Powered by blists - more mailing lists