Skip to content

Commit d4c4a14

Browse files
ainguraXmarquieguidleach02
authored andcommitted
driver: eth_mcux: gptp: enable pps output
Enable pps output for gptp accuracy measurements. Signed-off-by: Hake Huang <[email protected]> Signed-off-by: Xabier Marquiegui <[email protected]>
1 parent 7454a92 commit d4c4a14

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/ethernet/eth_mcux.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,11 +1051,14 @@ static void eth_mcux_init(const struct device *dev)
10511051
ENET_AddMulticastGroup(context->base, ptp_multicast);
10521052
ENET_AddMulticastGroup(context->base, ptp_peer_multicast);
10531053

1054-
context->ptp_config.channel = kENET_PtpTimerChannel1;
1054+
/* only for ERRATA_2579 */
1055+
context->ptp_config.channel = kENET_PtpTimerChannel3;
10551056
context->ptp_config.ptp1588ClockSrc_Hz =
10561057
CONFIG_ETH_MCUX_PTP_CLOCK_SRC_HZ;
10571058
context->clk_ratio = 1.0;
10581059

1060+
ENET_Ptp1588SetChannelMode(context->base, kENET_PtpTimerChannel3,
1061+
kENET_PtpChannelPulseHighonCompare, true);
10591062
ENET_Ptp1588Configure(context->base, &context->enet_handle,
10601063
&context->ptp_config);
10611064
#endif
@@ -1262,8 +1265,17 @@ static const struct ethernet_api api_funcs = {
12621265
static void eth_mcux_ptp_isr(const struct device *dev)
12631266
{
12641267
struct eth_context *context = dev->data;
1268+
int irq_lock_key = irq_lock();
1269+
enet_ptp_timer_channel_t channel;
12651270

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+
}
12661277
ENET_TimeStampIRQHandler(context->base, &context->enet_handle);
1278+
irq_unlock(irq_lock_key);
12671279
}
12681280
#endif
12691281

0 commit comments

Comments
 (0)