From: "G Thomas, Rohan" <rohan.g.thomas@altera.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"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>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Richard Cochran <richardcochran@gmail.com>,
Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 4/4] net: stmmac: socfpga: Add hardware supported cross-timestamp
Date: Wed, 29 Oct 2025 22:40:18 +0530 [thread overview]
Message-ID: <90624259-de59-489a-a121-fabbbe83c773@altera.com> (raw)
In-Reply-To: <d4b1c65d-17d2-4f41-b559-9cae55993f6e@bootlin.com>
Hi Maxime,
On 10/29/2025 8:36 PM, Maxime Chevallier wrote:
> Hi Rohan,
>
> On 29/10/2025 15:41, G Thomas, Rohan wrote:
>> Hi Maxime,
>>
>> On 10/29/2025 3:20 PM, Maxime Chevallier wrote:
>>> Hi Rohan,
>>>
>>> On 29/10/2025 09:06, Rohan G Thomas via B4 Relay wrote:
>>>> From: Rohan G Thomas <rohan.g.thomas@altera.com>
>>>>
>>>> Cross timestamping is supported on Agilex5 platform with Synchronized
>>>> Multidrop Timestamp Gathering(SMTG) IP. The hardware cross-timestamp
>>>> result is made available the applications through the ioctl call
>>>> PTP_SYS_OFFSET_PRECISE, which inturn calls stmmac_getcrosststamp().
>>>>
>>>> Device time is stored in the MAC Auxiliary register. The 64-bit System
>>>> time (ARM_ARCH_COUNTER) is stored in SMTG IP. SMTG IP is an MDIO device
>>>> with 0xC - 0xF MDIO register space holds 64-bit system time.
>>>>
>>>> This commit is similar to following commit for Intel platforms:
>>>> Commit 341f67e424e5 ("net: stmmac: Add hardware supported cross-timestamp")
>>>>
>>>> Signed-off-by: Rohan G Thomas <rohan.g.thomas@altera.com>
>
> [...]
>
>>>> + /* Time sync done Indication - Interrupt method */
>>>> + if (!wait_event_interruptible_timeout(priv->tstamp_busy_wait,
>>>> + dwxgmac_cross_ts_isr(priv),
>>>> + HZ / 100)) {
>>>> + priv->plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
>>>> + return -ETIMEDOUT;
>>>
>>> Don't you need to set priv->plat->flags |= STMMAC_FLAG_INT_SNAPSHOT_EN first?
>>> Otherwise, timestamp_interrupt() in stmmac_hwtstamp() won't call wake_up()
>>> on the wait_queue.
>>>
>>
>> Thanks for pointing this out. My intention was to use the polling
>> method, but I accidentally left behind some code from experimenting with
>> the interrupt method. While reverting those changes, I missed updating
>> this part of the code. Will fix this in the next revision. Sorry for the
>> error. Currently not seeing any timeout issues with polling method on
>> XGMAC IP. Also some spurios interrupts causing stall when using
>> the interrupt method in XGMAC.
>
> So, if you use the polling method, this will likely bring this code
> even closer to what's implemented in the intel dwmac wrapper. Is this
> the same IP ?
>
AFAIK, this is an Altera specific IP. Altera was part of Intel and may
be the SMTG IP implementation was inspired by ART timer on x86 platforms
:). But for later platforms this may diverge.
Also, latest intel dwmac wrapper is using interrupt method.
> To me it looks like the only difference will be a few
> register offsets (XGMAC vs GMAC), some clock id and the mdio accesses,
> maybe it could be worth considering re-using what's been done on the
> Intel side and avoid duplication...
>
> That could be all moved to stmmac_ptp for instance, using some flag
> in the plat data to indicate if cross timestamping is supported, and
> use the core type (xgmac, gmac, etc.) for the offsets ?
>
Since SMTG or ART is a vendor specific IP, I'm not sure it is good to
move this to the stmmac_ptp. Also, not sure other ways (other than mdio
acess, gpo toggling) to implement hw cross timestamping. Open to
suggestions.
> Of course with the risk of regressing dwmac-intel.c :(
>
> Maxime
Best Regards,
Rohan
next prev parent reply other threads:[~2025-10-29 17:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 8:06 [PATCH net-next 0/4] net: stmmac: socfpga: Add Agilex5 platform support and enhancements Rohan G Thomas via B4 Relay
2025-10-29 8:06 ` [PATCH net-next 1/4] net: stmmac: socfpga: Agilex5 EMAC platform configuration Rohan G Thomas via B4 Relay
2025-10-29 13:34 ` Maxime Chevallier
2025-10-29 14:53 ` G Thomas, Rohan
2025-10-29 15:30 ` Maxime Chevallier
2025-10-29 15:32 ` Maxime Chevallier
2025-10-29 16:14 ` Russell King (Oracle)
2025-10-29 17:14 ` G Thomas, Rohan
2025-10-29 8:06 ` [PATCH net-next 2/4] net: stmmac: socfpga: Enable TBS support for Agilex5 Rohan G Thomas via B4 Relay
2025-10-29 8:06 ` [PATCH net-next 3/4] net: stmmac: socfpga: Enable TSO for Agilex5 platform Rohan G Thomas via B4 Relay
2025-10-29 8:06 ` [PATCH net-next 4/4] net: stmmac: socfpga: Add hardware supported cross-timestamp Rohan G Thomas via B4 Relay
2025-10-29 9:50 ` Maxime Chevallier
2025-10-29 14:41 ` G Thomas, Rohan
2025-10-29 15:06 ` Maxime Chevallier
2025-10-29 17:10 ` G Thomas, Rohan [this message]
2025-10-30 5:40 ` kernel test robot
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=90624259-de59-489a-a121-fabbbe83c773@altera.com \
--to=rohan.g.thomas@altera.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=s.trumtrar@pengutronix.de \
/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®