drivers: ethernet: esp32: move net_if_carrier_off()
move net_if_carrier_off() before
phy_link_callback_set() to ensure the carrier is
not truned off, when the link is already up.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
diff --git a/drivers/ethernet/eth_esp32.c b/drivers/ethernet/eth_esp32.c
index 59977d3..c3fe850 100644
--- a/drivers/ethernet/eth_esp32.c
+++ b/drivers/ethernet/eth_esp32.c
@@ -375,14 +375,14 @@
ethernet_init(iface);
if (device_is_ready(eth_esp32_phy_dev)) {
+ /* Do not start the interface until PHY link is up */
+ net_if_carrier_off(iface);
+
phy_link_callback_set(eth_esp32_phy_dev, phy_link_state_changed,
(void *)dev);
} else {
LOG_ERR("PHY device not ready");
}
-
- /* Do not start the interface until PHY link is up */
- net_if_carrier_off(iface);
}
static const struct ethernet_api eth_esp32_api = {