drivers: ethernet: stm32: stop hal before config

make sure the hal is stopped, before
configuring the link. The phy can change the
speed without notifying a link down in between.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
Fin Maaß 2025-06-11 10:54:20 +02:00 committed by Benjamin Cabé
commit 242d348fca

View file

@ -1128,12 +1128,15 @@ static void phy_link_state_changed(const struct device *phy_dev, struct phy_link
ARG_UNUSED(phy_dev);
/* The hal also needs to be stopped before changing the MAC config.
* The speed can change without receiving a link down callback before.
*/
eth_stm32_hal_stop(dev);
if (state->is_up) {
set_mac_config(dev, state);
eth_stm32_hal_start(dev);
net_eth_carrier_on(dev_data->iface);
} else {
eth_stm32_hal_stop(dev);
net_eth_carrier_off(dev_data->iface);
}
}