Leon Scheid
Posts: 1
Joined: Tue Dec 22, 2020 7:56 am

Hardware Timestamping (PTP/1588) on CM4

Tue Dec 22, 2020 8:21 am

Hello,

Are there any device drivers availible to enable hardware timestamping on the new CM4?
I've compiled a 5.4 kernel with PTP_1588_CLOCK and NETWORK_PHY_TIMESTAMPING enabled but ethtool -T eth0 only shows software timestamping.

Thanks for any help!
Leon Scheid

philphil
Posts: 2
Joined: Tue Aug 20, 2019 7:10 am

Re: Hardware Timestamping (PTP/1588) on CM4

Wed Feb 10, 2021 4:10 pm

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
edit: it's in the pipeline https://github.com/raspberrypi/linux/issues/4151
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Hi!

Trying to figure this out aswell - some more official documentation would be appreciated.

Where I can't really answer your question (but I think it's a no), I can maybe elaborate on your question such that other people don't waste their time trying to figure out more.


From what I understand reading the CM4 and CM4IO datasheets the mentioned SYNC_IN and SYNC_OUT pins on the CM4 are intended to be used to make proper use of the 1588 "support" - but it actually requires an implementation of some sort.

https://datasheets.raspberrypi.org/cm4/ ... asheet.pdf
https://datasheets.raspberrypi.org/cm4i ... asheet.pdf

As I would assume the SYNC pins are to be routed to a hardware clock, to be implemented either on the CM4 itself using interrupts (or such) or using some external clock controller.
The former would mean writing that (kernel) code to use a hardware timer and IRQs, optimally(?) in the default bcmgenet ethernet driver.

https://github.com/raspberrypi/linux/search?q=bcmgenet
https://github.com/raspberrypi/linux/search?q=BCM5421 (I don't see a bcm54210XY device with such support)

Which would be somewhat funny, because the used bcm54210PE PHY for which no documentation is publicly available would seem to have on-chip timestamping or a clock ("IEEE 1588v2 compliant – One-step or two-step clock – On-chip timestamping"); that is, a hardware clock?

https://www.broadcom.com/products/ether ... t/bcm54210

Intermezzo-question: is it actually a typo in the datasheet: BCM54210PE ? broadcom does not list such a Gigabit phy https://www.broadcom.com/products/ether ... igabit-phy

According to IEEE802.3-2018 90.4.1.1 (page 5760) has a nice graphic regarding Time Synchronization Service Interface (TSSI) whereas indeed there are two signal lines from (almost) the PHY going to what is called the TimeSync Client (that is, SYNC_IN/OUT which are not connected by default on the CM4).
Without reading it all... IEEE802.3-etc defines xMII functions telling the (almost) PHY to generate said timestamp signals (which I assume are the hardware support features which ethernet devices have as according to ethtool -T).
So.. I don't know if the bcm PHY triggers any and all relevant packages (which according to IEEE802.3-.... shouldn't necessarily be so) without the system requesting to in which case all that would remain to be done is implementing the clock as suggested above.
But I would guess that's not the case - in which case the generic bcm phy driver requires said implementation aswell.

https://ieeexplore.ieee.org/document/8457469 (get it for free... 8k pages, 200MB)

I wouldn't think that the statement in the CM4 datasheet "Gigabit Ethernet PHY supporting IEEE 1588" is clear enough of the point that there is only theoretical support (for the moment being) without a clear way of actually getting that IEEE 1588 support.

I would further think some official documentation and/or information can be expected on this (because IEEE1588 support can be a deciding factor to use CM4s in the first place), be it the general idea of how to get the PTPv2 support, or maybe the status of any non-public developments or a build configuration to actually enable the promised PTPv2 support.

So please, Raspberry Pi Foundation, would you be so kind to openly communicate on this matter and if you expect the public to implement the IEEE 1588 support, to provide the documentation on the BCM54210PE at least? Then I could consider implementing this even if I have no idea yet how.

Please correct me if I'm wrong.

edit: and, if the bcm54210pe would have indeed have a hardware clock along with an clock output signal the question would be why the CM4 does not have this signal - which would be somewhat relevant to have, at least in some use cases.
edit2: some relevant kernel documentation
https://www.kernel.org/doc/html/latest/ ... e-driversl
https://www.kernel.org/doc/html/latest/ ... g/phy.html
https://www.kernel.org/doc/html/latest/ ... i/ptp.html
https://www.kernel.org/doc/html/latest/ ... hy/phy.htm

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1697
Joined: Sat Sep 10, 2011 11:43 am

Re: Hardware Timestamping (PTP/1588) on CM4

Thu Feb 25, 2021 10:01 am

Please continue any discussion of this through the GitHub page (just so we don't have split information)

https://github.com/raspberrypi/linux/issues/4151

Going to lock this just to make sure this stays here!
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

Return to “Troubleshooting”