Skip to content

Commit bc98698

Browse files
decsnycfriedt
authored andcommitted
drivers: eth_nxp_enet: Fix power mode control
The driver should not take the whole interface down and re-initialize on every low power entry and exit. This is a lot of latency for no real gain as far as I can tell. We can just do as the reference manual actually says which is to set the sleep enable bit to put the module to sleep while still being able to detect magic packets for wake on LAN. Also, the only platform that this power action was "enabled" for was kinetis, but that platform does not have any power management enabled in Zephyr. Which means this code was never getting called even with all the PM configs on. So basically this code is dead code. But it could be useful for other platform, such as RT, so there's no reason not to remove the dependency on kinetis and let it be used for any of the platform as long as PM_DEVICE is enabled (hence the imply). Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
1 parent 5d7035a commit bc98698

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

drivers/ethernet/Kconfig.nxp_enet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ config ETH_NXP_ENET
1212
depends on DT_HAS_NXP_ENET_MAC_ENABLED
1313
select NOCACHE_MEMORY if CPU_HAS_DCACHE
1414
select ARM_MPU if CPU_CORTEX_M7
15-
select NET_POWER_MANAGEMENT if (PM_DEVICE && SOC_FAMILY_KINETIS)
15+
imply NET_POWER_MANAGEMENT
1616
select ETH_DSA_SUPPORT_DEPRECATED
1717
select PINCTRL
1818
select HWINFO if $(dt_compat_any_has_prop,$(DT_COMPAT_NXP_ENET_MAC),$(DT_NXP_UNIQUE_MAC_PROP),True)

drivers/ethernet/eth_nxp_enet.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -799,14 +799,11 @@ static int eth_nxp_enet_device_pm_action(const struct device *dev, enum pm_devic
799799
return ret;
800800
}
801801

802-
ENET_Reset(data->base);
803-
ENET_Down(data->base);
804-
clock_control_off(config->clock_dev, (clock_control_subsys_t)config->clock_subsys);
802+
ENET_EnableSleepMode(data->base, true);
805803
} else if (action == PM_DEVICE_ACTION_RESUME) {
806804
LOG_DBG("Resuming");
807805

808-
clock_control_on(config->clock_dev, (clock_control_subsys_t)config->clock_subsys);
809-
eth_nxp_enet_init(dev);
806+
ENET_EnableSleepMode(data->base, false);
810807
net_if_resume(data->iface);
811808
} else {
812809
return -ENOTSUP;

0 commit comments

Comments
 (0)