Skip to content

Commit

Permalink
drivers: eth: mcux: Fix PTP clock init priority dependency
Browse files Browse the repository at this point in the history
The net_core device initialization has a subtle dependency
on the PTP clock initialization. Adding a Kconfig and set
it to a priority level less than net_core. This will ensure
the initialization sequence.

Fixes zephyrproject-rtos#38571

Signed-off-by: David Leach <[email protected]>
  • Loading branch information
dleach02 authored and carlescufi committed Sep 17, 2021
1 parent 81595ed commit fb51926
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions drivers/ethernet/Kconfig.mcux
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ config ETH_MCUX_PTP_CLOCK_SRC_HZ
Set the frequency in Hz sourced to the PTP timer.
If the value is set properly, the timer will be accurate.

config ETH_MCUX_PTP_CLOCK_INIT_PRIO
int
default 85
help
MCUX PTP Clock initialization priority level. There is
a dependency from the network stack that this device
initializes before network stack (NET_INIT_PRIO).

endif # PTP_CLOCK_MCUX

endif # ETH_MCUX
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_mcux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,6 @@ static int ptp_mcux_init(const struct device *port)

DEVICE_DEFINE(mcux_ptp_clock_0, PTP_CLOCK_NAME, ptp_mcux_init,
NULL, &ptp_mcux_0_context, NULL, POST_KERNEL,
CONFIG_APPLICATION_INIT_PRIORITY, &api);
CONFIG_ETH_MCUX_PTP_CLOCK_INIT_PRIO, &api);

#endif /* CONFIG_PTP_CLOCK_MCUX */

0 comments on commit fb51926

Please sign in to comment.