mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wojciech Drewek <wojciech.drewek@intel.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: <stable@vger.kernel.org>, <kernel@pengutronix.de>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Tan Tee Min <tee.min.tan@intel.com>,
	"Wong Vee Khee" <vee.khee.wong@linux.intel.com>
Subject: Re: [PATCH net v1 1/1] net: stmmac: Assign configured channel value to EXTTS event
Date: Tue, 18 Jun 2024 15:07:58 +0200	[thread overview]
Message-ID: <65081be3-0097-49bb-a28a-f50c733d6eca@intel.com> (raw)
In-Reply-To: <20240618073821.619751-1-o.rempel@pengutronix.de>



On 18.06.2024 09:38, Oleksij Rempel wrote:
> 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 <o.rempel@pengutronix.de>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
> index f05bd757dfe52..5ef52ef2698fb 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
> @@ -218,6 +218,7 @@ static void timestamp_interrupt(struct stmmac_priv *priv)
>  {
>  	u32 num_snapshot, ts_status, tsync_int;
>  	struct ptp_clock_event event;
> +	u32 acr_value, channel;
>  	unsigned long flags;
>  	u64 ptp_time;
>  	int i;
> @@ -243,12 +244,15 @@ static void timestamp_interrupt(struct stmmac_priv *priv)
>  	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);
>  	}

  reply	other threads:[~2024-06-18 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18  7:38 Oleksij Rempel
2024-06-18 13:07 ` Wojciech Drewek [this message]
2024-06-20  9:55 ` Paolo Abeni
2024-06-20 10:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65081be3-0097-49bb-a28a-f50c733d6eca@intel.com \
    --to=wojciech.drewek@intel.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=joabreu@synopsys.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tee.min.tan@intel.com \
    --cc=vee.khee.wong@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®