@@ -1051,11 +1051,14 @@ static void eth_mcux_init(const struct device *dev)
1051
1051
ENET_AddMulticastGroup (context -> base , ptp_multicast );
1052
1052
ENET_AddMulticastGroup (context -> base , ptp_peer_multicast );
1053
1053
1054
- context -> ptp_config .channel = kENET_PtpTimerChannel1 ;
1054
+ /* only for ERRATA_2579 */
1055
+ context -> ptp_config .channel = kENET_PtpTimerChannel3 ;
1055
1056
context -> ptp_config .ptp1588ClockSrc_Hz =
1056
1057
CONFIG_ETH_MCUX_PTP_CLOCK_SRC_HZ ;
1057
1058
context -> clk_ratio = 1.0 ;
1058
1059
1060
+ ENET_Ptp1588SetChannelMode (context -> base , kENET_PtpTimerChannel3 ,
1061
+ kENET_PtpChannelPulseHighonCompare , true);
1059
1062
ENET_Ptp1588Configure (context -> base , & context -> enet_handle ,
1060
1063
& context -> ptp_config );
1061
1064
#endif
@@ -1262,8 +1265,17 @@ static const struct ethernet_api api_funcs = {
1262
1265
static void eth_mcux_ptp_isr (const struct device * dev )
1263
1266
{
1264
1267
struct eth_context * context = dev -> data ;
1268
+ int irq_lock_key = irq_lock ();
1269
+ enet_ptp_timer_channel_t channel ;
1265
1270
1271
+ /* clear channel */
1272
+ for (channel = kENET_PtpTimerChannel1 ; channel <= kENET_PtpTimerChannel4 ; channel ++ ) {
1273
+ if (ENET_Ptp1588GetChannelStatus (context -> base , channel )) {
1274
+ ENET_Ptp1588ClearChannelStatus (context -> base , channel );
1275
+ }
1276
+ }
1266
1277
ENET_TimeStampIRQHandler (context -> base , & context -> enet_handle );
1278
+ irq_unlock (irq_lock_key );
1267
1279
}
1268
1280
#endif
1269
1281
0 commit comments