From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25B2613C90B; Tue, 25 Jun 2024 10:01:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719309671; cv=none; b=DHjMBpyH4p+PtL+Lz9THDHeZpVA/Tcg6xLa+47Ll+9gMPBMA5Q3GD2EXZi/KEJwa8MiZa3hksJfPNOdar/HyqEfqPzs0o6gAZGeeeq+dOwdA/jJTPWaBkuP793ERUHm3NLcj+cIdSjFFvcwnFMbT3VduvTvCEEPHqCyl22C+5fE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719309671; c=relaxed/simple; bh=tXzCvU8DASeJIakOoJ6+11KIrfzse6EFDjMdN6MCh28=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EpFJKecltUMYGj1Tj6C6VfFYOCk3lFhGMiUJUCe7Dy7JJVWj38iygppjFI0Me2ReJbmhyhYLDDeIXRcdMXASyDKK1MERzWkmJC0BZ7mPIrDFucarQ2miuo9yiYrtZC3ruW4wId2eoCIh+uW/upsJ+G2T9Cniw44F6k7VQ3iX7WY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UMbFzx8P; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UMbFzx8P" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AC1FC32781; Tue, 25 Jun 2024 10:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1719309671; bh=tXzCvU8DASeJIakOoJ6+11KIrfzse6EFDjMdN6MCh28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMbFzx8PO0IjtwBdWqiHb9KVDRzz1DtCXSRCXGDWXh75y4vY+ZDVqqzVB6KmIozP/ JKFf5/U8e2A0NjMRhOmPwPluVmYiZTOCHL3t58lObM3fUVzt5SrPjjm9MHCFGJ0Y5e ZtfsdLozl9PKceus5N1U2NE/3t2EnB16HB8JZpsE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Oleksij Rempel , Wojciech Drewek , Paolo Abeni Subject: [PATCH 6.1 094/131] net: stmmac: Assign configured channel value to EXTTS event Date: Tue, 25 Jun 2024 11:34:09 +0200 Message-ID: <20240625085529.511693005@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240625085525.931079317@linuxfoundation.org> References: <20240625085525.931079317@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Oleksij Rempel commit 8851346912a1fa33e7a5966fe51f07313b274627 upstream. 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: f4da56529da60 ("net: stmmac: Add support for external trigger timestamping") Cc: stable@vger.kernel.org Signed-off-by: Oleksij Rempel Reviewed-by: Wojciech Drewek Link: https://lore.kernel.org/r/20240618073821.619751-1-o.rempel@pengutronix.de Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c @@ -176,6 +176,7 @@ static void timestamp_interrupt(struct s { u32 num_snapshot, ts_status, tsync_int; struct ptp_clock_event event; + u32 acr_value, channel; unsigned long flags; u64 ptp_time; int i; @@ -201,12 +202,15 @@ static void timestamp_interrupt(struct s num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >> GMAC_TIMESTAMP_ATSNS_SHIFT; + acr_value = readl(priv->ptpaddr + PTP_ACR); + channel = ilog2(FIELD_GET(PTP_ACR_MASK, acr_value)); + for (i = 0; i < num_snapshot; i++) { read_lock_irqsave(&priv->ptp_lock, flags); get_ptptime(priv->ptpaddr, &ptp_time); read_unlock_irqrestore(&priv->ptp_lock, flags); event.type = PTP_CLOCK_EXTTS; - event.index = 0; + event.index = channel; event.timestamp = ptp_time; ptp_clock_event(priv->ptp_clock, &event); }