Skip to content

Commit 0da16f7

Browse files
decsnymmahadevan108
authored andcommitted
drivers: nxp_enet: put phy cb before iface init
This commit moves one function before another, to make the diff of the next commit clearer of what it's doing. Signed-off-by: Declan Snyder <[email protected]>
1 parent 049b243 commit 0da16f7

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

drivers/ethernet/nxp_enet/eth_nxp_enet.c

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -243,32 +243,6 @@ static int eth_nxp_enet_tx(const struct device *dev, struct net_pkt *pkt)
243243
return ret;
244244
}
245245

246-
static void eth_nxp_enet_iface_init(struct net_if *iface)
247-
{
248-
const struct device *dev = net_if_get_device(iface);
249-
struct nxp_enet_mac_data *data = dev->data;
250-
const struct nxp_enet_mac_config *config = dev->config;
251-
252-
net_if_set_link_addr(iface, data->mac_addr,
253-
sizeof(data->mac_addr),
254-
NET_LINK_ETHERNET);
255-
256-
if (data->iface == NULL) {
257-
data->iface = iface;
258-
}
259-
260-
#if defined(CONFIG_NET_DSA)
261-
dsa_register_master_tx(iface, &eth_nxp_enet_tx);
262-
#endif
263-
264-
ethernet_init(iface);
265-
net_if_carrier_off(data->iface);
266-
267-
config->irq_config_func();
268-
269-
nxp_enet_driver_cb(config->mdio, NXP_ENET_MDIO, NXP_ENET_INTERRUPT_ENABLED, NULL);
270-
}
271-
272246
static enum ethernet_hw_caps eth_nxp_enet_get_capabilities(const struct device *dev)
273247
{
274248
#if defined(CONFIG_ETH_NXP_ENET_1G)
@@ -523,6 +497,31 @@ static void nxp_enet_phy_cb(const struct device *phy,
523497
}
524498
}
525499

500+
static void eth_nxp_enet_iface_init(struct net_if *iface)
501+
{
502+
const struct device *dev = net_if_get_device(iface);
503+
struct nxp_enet_mac_data *data = dev->data;
504+
const struct nxp_enet_mac_config *config = dev->config;
505+
506+
net_if_set_link_addr(iface, data->mac_addr,
507+
sizeof(data->mac_addr),
508+
NET_LINK_ETHERNET);
509+
510+
if (data->iface == NULL) {
511+
data->iface = iface;
512+
}
513+
514+
#if defined(CONFIG_NET_DSA)
515+
dsa_register_master_tx(iface, &eth_nxp_enet_tx);
516+
#endif
517+
518+
ethernet_init(iface);
519+
net_if_carrier_off(iface);
520+
521+
config->irq_config_func();
522+
523+
nxp_enet_driver_cb(config->mdio, NXP_ENET_MDIO, NXP_ENET_INTERRUPT_ENABLED, NULL);
524+
}
526525

527526
static int nxp_enet_phy_init(const struct device *dev)
528527
{

0 commit comments

Comments
 (0)