IEEE1588 / PTP hardware timestamp support on SAMA5D2 Xplained Ultra

For SAMA5D2 Xplained, SAMA5D3 Xplained and SAMA5D4 Xplained

Moderator: nferre

claatsch
Posts: 3
Joined: Thu Nov 02, 2017 9:09 pm

IEEE1588 / PTP hardware timestamp support on SAMA5D2 Xplained Ultra

Thu Nov 02, 2017 9:21 pm

Hello,

We are currently evaluating the SAMA5D2 IC using the SAMA5D2 Xplained Ultra Development board. One of our main focus areas is to be able to use the setup as a IEEE1588/PTP slave device with hardware timestamping support (provided by the MACB mac device). We are running the "newest" AT91-Linux Kernel (4.9.52) (linux4sam_5.7) but ethtool doesn't seem to register the MAC as having hardware timestamping support.

When I looked into the driver source code for the Cadence MACB driver for the 4.9x kernel, I noticed it has no mention of anything to do with PTP/hardware timestamping support but that Kernel 4.12 and above do mention those functions in the source code (http://elixir.free-electrons.com/linux/ ... nce/macb.h).

Has anyone tried to or have any idea on how to get hardware time stamping to work with the MACB driver? I've read online that the Xilinx Zynq also uses the MACB and some were able to get it to work so I was hoping there was some information out there about a new driver, patch, etc.

Any thoughts/ideas would be greatly appreciated.
Thanks,

Christopher Laatsch
KeyW Corporation
blue_z
Location: USA
Posts: 1547
Joined: Thu Apr 19, 2007 10:15 pm

Re: IEEE1588 / PTP hardware timestamp support on SAMA5D2 Xplained Ultra

Fri Nov 03, 2017 1:30 am

claatsch wrote:... but that Kernel 4.12 and above do mention those functions in the source code (http://elixir.free-electrons.com/linux/ ... nce/macb.h).
All you found are the register definitions; there's no Linux driver code that utilizes those registers in that version. The driver reports that it only supports timestamps in software.

claatsch wrote:Has anyone tried to or have any idea on how to get hardware time stamping to work with the MACB driver? I've read online that the Xilinx Zynq also uses the MACB and some were able to get it to work so I was hoping there was some information out there about a new driver, patch, etc.
A simple google search turns up this (fourth version) patch.
Linux kernel version 4.13 onward has a configuration option for "Enable IEEE 1588 Precision Time Protocol (PTP) support for MACB" .

Regards
claatsch
Posts: 3
Joined: Thu Nov 02, 2017 9:09 pm

Re: IEEE1588 / PTP hardware timestamp support on SAMA5D2 Xplained Ultra

Mon Nov 06, 2017 6:30 pm

blue_z,

Thank you very much for taking the time to reply to my initial post. I appreciate you clearing up my ignorance on the difference between "register definitions" and "functions" in the driver code.

I was able to build an get kernel 4.13 (as you had mentioned) to run on our target SAMA5D2 but when I used ethtool to check the timestamping capabilities of the hardware ("ethtool -T eth0) it does not show anything regarding hardware time stamping capability which brings me to my questions:

1) Is it accurate to say that with 4.13 and later, the macb "driver reports that it only supports timestamps in software", as you have stated below or should it show "hardware support"? I'm not knowledgeable enough on the macb driver (or any for that matter) and am looking to you for some guidance.
2) If it doesn't report "hardware timestamp" capability, how can I be assured that the actual hardware inside the D2 is being used properly? We are looking at using the LinuxPTP application or PTPd on the software end (I have no bias towards either...just whichever works better).

Also, in regards to the "patch" you reference, I assume we don't have to do anything with this if using 4.13 or later kernel?

Again, thanks very much for your time and patience on this matter.
Chris
Thanks,

Christopher Laatsch
KeyW Corporation
blue_z
Location: USA
Posts: 1547
Joined: Thu Apr 19, 2007 10:15 pm

Re: IEEE1588 / PTP hardware timestamp support on SAMA5D2 Xplained Ultra

Mon Nov 06, 2017 11:32 pm

claatsch wrote:1) Is it accurate to say that with 4.13 and later, the macb "driver reports that it only supports timestamps in software", as you have stated below or should it show "hardware support"?
Driver capabilities will depend on the kernel version and configuration.

claatsch wrote:2) If it doesn't report "hardware timestamp" capability, how can I be assured that the actual hardware inside the D2 is being used properly?
You fail to mention whether you (used `make menuconfig` and) enabled CONFIG_MACB_USE_HWSTAMP, and if you verified the configuration.

claatsch wrote:Also, in regards to the "patch" you reference, I assume we don't have to do anything with this if using 4.13 or later kernel?
That patch apparently was applied to the upcoming 4.14, for which release candidate #8 was issued yesterday. PTP support in the Cadence driver seems to be a work in progress. Kernel version 4.14 adds more PTP support (than 4.13) with a new macb_ptp.c module.

Regards
claatsch
Posts: 3
Joined: Thu Nov 02, 2017 9:09 pm

Re: IEEE1588 / PTP hardware timestamp support on SAMA5D2 Xplained Ultra

Wed Nov 08, 2017 3:01 am

blue_Z,

Once again, I appreciate your response. I appreciate the clarification about which version of the kernel the patch was for.

In regards to your question, I did use 'make menuconfig' when compiling the kernel and did verify that 'CONFIG_MACB_USE_HWSTAMP=y' was set after saving the .config file (I assume this is what you were refering to when you mentioned to verify?).

In the meantime, I pulled down the latest 4.14 kernel (-rc7 when I got it the other day) and compiled it thinking that it might finally have support for the MACB timestamping. Unfortunately, no luck on that....gave me the same behavior as when I tried 4.13. I think you are quite right in saying that the MACB driver seems to be a constant work in progress. I was hoping that in my ignorance I missed a step or something and it would be an easy fix.

Just out of curiosity, would you have any idea if there is any changes necessary to the device tree in order to support the timestamping? I assume that this would fall out during the compilation process but I figured I'd bring it up and see if you had any further thoughts since you seem to be very knowledgeable on these things.

Thanks again for the help,
Chris
Thanks,

Christopher Laatsch
KeyW Corporation
blue_z
Location: USA
Posts: 1547
Joined: Thu Apr 19, 2007 10:15 pm

Re: IEEE1588 / PTP hardware timestamp support on SAMA5D2 Xplained Ultra

Thu Nov 09, 2017 1:13 am

claatsch wrote:Unfortunately, no luck on that....gave me the same behavior as when I tried 4.13.
You may have to start performing some debugging to understand exactly what features of the driver that you're trying to use. Get the source code for ethtool (or whatever you're using to test), and determine the code path of what you're testing. Try to determine where the decision of "not available" is returned.
You can also use the shell command `strace ethtool ...` to see what syscalls are made.
Insert some printk() statements in the driver to reveal what is going on.
The salient document seems to be Documentation/networking/timestamping.txt

claatsch wrote:Just out of curiosity, would you have any idea if there is any changes necessary to the device tree in order to support the timestamping?
Good question. There does not seem to be any requirement.
claatsch wrote:I assume that this would fall out during the compilation process ...
No, the Device Tree blob is processed during kernel boot. Omissions in the DT would have to be noticed during runtime.

Regards

Return to “SAMA5 Xplained”

Who is online

Users browsing this forum: No registered users and 1 guest