From 87f2744e6cdb7fad1d68177d7c51b7382beb4f2d Mon Sep 17 00:00:00 2001 From: "Daniel P. Carvalho" Date: Mon, 21 Sep 2026 19:38:27 -0300 Subject: [PATCH] arch/arm/stm32h5: fail the PHY initialization when the reset times out. The driver has the same code as the one of the STM32H7. When the PHY did not clear the reset bit in time, stm32_phyinit() returned the result of the last MDIO read. The bus reads all ones when the PHY does not answer yet, and that read succeeds, so the function returned OK and the driver went on with its default of 10 Mbps and half duplex, while the PHY could negotiate 100 Mbps and full duplex. Return -ETIMEDOUT, so that bringing the interface up fails and the failure is not hidden. It builds for nucleo-h563zi:netnsh, but it was not tested on hardware. Signed-off-by: Daniel P. Carvalho Assisted-by: Claude:claude-sonnet-5 --- arch/arm/src/stm32h5/stm32_ethernet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/src/stm32h5/stm32_ethernet.c b/arch/arm/src/stm32h5/stm32_ethernet.c index 37d84506e08..e9bdd23d830 100644 --- a/arch/arm/src/stm32h5/stm32_ethernet.c +++ b/arch/arm/src/stm32h5/stm32_ethernet.c @@ -3230,7 +3230,7 @@ static int stm32_phyinit(struct stm32_ethmac_s *priv) if (to <= 0) { nerr("ERROR: Phy reset timeout\n"); - return ret; + return -ETIMEDOUT; } else {