drivers: nxp_enet: Check link state in iface init
Still mark the iface as down after ethernet_init, but then actually check the link state and initialize carrier appropriately This fixes the case where, the phy driver doesn't give a callback after iface init due to the link already being up, there was no change from the phy driver perspective, so callback wouldn't happen, and therefore the interface could remain marked as down after boot even if carrier is up. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
parent
0da16f7ec6
commit
c1398250e9
1 changed files with 10 additions and 0 deletions
|
|
@ -502,6 +502,8 @@ static void eth_nxp_enet_iface_init(struct net_if *iface)
|
|||
const struct device *dev = net_if_get_device(iface);
|
||||
struct nxp_enet_mac_data *data = dev->data;
|
||||
const struct nxp_enet_mac_config *config = dev->config;
|
||||
const struct device *phy_dev = config->phy_dev;
|
||||
struct phy_link_state state;
|
||||
|
||||
net_if_set_link_addr(iface, data->mac_addr,
|
||||
sizeof(data->mac_addr),
|
||||
|
|
@ -518,6 +520,14 @@ static void eth_nxp_enet_iface_init(struct net_if *iface)
|
|||
ethernet_init(iface);
|
||||
net_if_carrier_off(iface);
|
||||
|
||||
/* In case the phy driver doesn't report a state change due to link being up
|
||||
* before calling phy_configure, we should check the state ourself, and then do a
|
||||
* pseudo-callback
|
||||
*/
|
||||
phy_get_link_state(phy_dev, &state);
|
||||
|
||||
nxp_enet_phy_cb(phy_dev, &state, (void *)dev);
|
||||
|
||||
config->irq_config_func();
|
||||
|
||||
nxp_enet_driver_cb(config->mdio, NXP_ENET_MDIO, NXP_ENET_INTERRUPT_ENABLED, NULL);
|
||||
|
|
|
|||
Loading…
Reference in a new issue