Skip to content

Commit 8851346

Browse files
oleremPaolo Abeni
authored and
Paolo Abeni
committed
net: stmmac: Assign configured channel value to EXTTS event
Assign the configured channel value to the EXTTS event in the timestamp interrupt handler. Without assigning the correct channel, applications like ts2phc will refuse to accept the event, resulting in errors such as: ... ts2phc[656.834]: config item end1.ts2phc.pin_index is 0 ts2phc[656.834]: config item end1.ts2phc.channel is 3 ts2phc[656.834]: config item end1.ts2phc.extts_polarity is 2 ts2phc[656.834]: config item end1.ts2phc.extts_correction is 0 ... ts2phc[656.862]: extts on unexpected channel ts2phc[658.141]: extts on unexpected channel ts2phc[659.140]: extts on unexpected channel Fixes: f4da565 ("net: stmmac: Add support for external trigger timestamping") Cc: [email protected] Signed-off-by: Oleksij Rempel <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 0f74d0c commit 8851346

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ static void timestamp_interrupt(struct stmmac_priv *priv)
218218
{
219219
u32 num_snapshot, ts_status, tsync_int;
220220
struct ptp_clock_event event;
221+
u32 acr_value, channel;
221222
unsigned long flags;
222223
u64 ptp_time;
223224
int i;
@@ -243,12 +244,15 @@ static void timestamp_interrupt(struct stmmac_priv *priv)
243244
num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >>
244245
GMAC_TIMESTAMP_ATSNS_SHIFT;
245246

247+
acr_value = readl(priv->ptpaddr + PTP_ACR);
248+
channel = ilog2(FIELD_GET(PTP_ACR_MASK, acr_value));
249+
246250
for (i = 0; i < num_snapshot; i++) {
247251
read_lock_irqsave(&priv->ptp_lock, flags);
248252
get_ptptime(priv->ptpaddr, &ptp_time);
249253
read_unlock_irqrestore(&priv->ptp_lock, flags);
250254
event.type = PTP_CLOCK_EXTTS;
251-
event.index = 0;
255+
event.index = channel;
252256
event.timestamp = ptp_time;
253257
ptp_clock_event(priv->ptp_clock, &event);
254258
}

0 commit comments

Comments
 (0)