* [PATCH net v2] net: stmmac: Handle disabled MDIO busses from devicetree
@ 2023-12-12 22:18 Andrew Halaney
2023-12-13 13:09 ` Serge Semin
2023-12-14 11:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Halaney @ 2023-12-12 22:18 UTC (permalink / raw)
To: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Giuseppe Cavallaro
Cc: Andrew Lunn, Serge Semin, netdev, linux-stm32, linux-arm-kernel,
linux-kernel, Simon Horman, Andrew Halaney
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@redhat.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
---
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@redhat.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: stmmac: Handle disabled MDIO busses from devicetree
2023-12-12 22:18 [PATCH net v2] net: stmmac: Handle disabled MDIO busses from devicetree Andrew Halaney
@ 2023-12-13 13:09 ` Serge Semin
2023-12-14 11:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Serge Semin @ 2023-12-13 13:09 UTC (permalink / raw)
To: Andrew Halaney
Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Giuseppe Cavallaro,
Andrew Lunn, netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Simon Horman
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@redhat.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@gmail.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@redhat.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: stmmac: Handle disabled MDIO busses from devicetree
2023-12-12 22:18 [PATCH net v2] net: stmmac: Handle disabled MDIO busses from devicetree Andrew Halaney
2023-12-13 13:09 ` Serge Semin
@ 2023-12-14 11:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-14 11:10 UTC (permalink / raw)
To: Andrew Halaney
Cc: alexandre.torgue, joabreu, davem, edumazet, kuba, pabeni,
mcoquelin.stm32, peppe.cavallaro, andrew, fancer.lancer, netdev,
linux-stm32, linux-arm-kernel, linux-kernel, horms
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 12 Dec 2023 16:18:33 -0600 you 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@redhat.com>
>
> [...]
Here is the summary with links:
- [net,v2] net: stmmac: Handle disabled MDIO busses from devicetree
https://git.kernel.org/netdev/net/c/e23c0d21ce92
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-14 11:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12 22:18 [PATCH net v2] net: stmmac: Handle disabled MDIO busses from devicetree Andrew Halaney
2023-12-13 13:09 ` Serge Semin
2023-12-14 11:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).