Hi Richard,

On 10/03/20 7:02 PM, Richard Cochran wrote:
> On Tue, Mar 10, 2020 at 01:17:40PM +0530, Lokesh Vutla wrote:
>> Timer resolution is entirely dependent on the input clock frequency. 30us
>> resolution is true only if the input clock frequency of DMTIMER is 32KHz.
>> AM335x[0] and later TI SoCs provide the following 3 options as the input 
>> clocks
>> to DMTIMERs that we are concerned with:
>> - Oscillator clock (24MHz in BBB). Resolution is 42ns
> 
> That is better.  Still a bit disappointing considering that the
> resolution is coarser than the expected synchronization accuracy.
> 
>> Is this information sufficient to consider for a generic user-space solution 
>> :)
>> Or you have other opinions?
> 
> It would be useful.  I can see several moving parts:

You have got the moving parts right. Let me provide the status of each:

> 
> - A device tree snippet that configures the clock tree to select
>   TIMERx_GCLK source.

PWM omap timer already has this support for selecting the clock[0]

> 
> - Somehow arrange for the pulse to appear both as an input to CPTS
>   EXTTS and also as an output on a GPIO pin  (device tree covers this?)

Output of DMTIMER(PWM Pulse) is already connected to both CPTS EXTTS and a GPIO
pin. Just pinmux need to be configured properly to capture the pulse on the
scope. DT captures the pinmux part.

> 
> - Kernel driver work to configure the DMTIMER (?) (iirc this is missing from 
> mainline)

There is already existing pwm omap dmtimer driver. I have recently posted
updates to this driver to be able to change pwm period on the fly [1]. Hoping to
get this merged soon.

> 
> - Kernel driver work in CPTS to support PTP_EXTTS_REQUEST (and 
> PTP_PIN_SETFUNC?)

Grygorii (in CC) is already working on that. Patches will be posted soon to ML.

> 
> - User space program that:
> 
>   - configures pwm via sysfs
>   - enables CPTS PHC PIN
>   - enables and reads PTP_EXTTS_REQUESTs
>   - feeds the offsets into a servo
>   - corrects PWM period with servo adjustment via sysfs

This is the userspace program I have worked on to get the synchronization
working. Currently the servo part of the tool is in very hacky shape. Before
cleanup I wanted to get more inputs on where it can be integrated. But anyways
as you said, Ill clean it up and post it as a separate tool. We can then decide
the correct location.

> 
> (please comment/correct the above)
> 
> I agree that this would be useful.  However, this is really
> device-specific stuff and not general purpose.  Possibly we could
> publish this in linuxptp under contrib/ or something, but my feeling
> is that it really belongs in its own little project.  Does TI have a
> github or similar from which to publish?

TI does host all the public code under git.ti.com.

> 
> In any case, please do post what you have got to this list.  I am
> eager to try it out!

okay. Give me couple of days. Patches will be posted to the list.


[0]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt#n12
[1] https://patchwork.kernel.org/project/linux-omap/list/?series=248935

Thanks and regards,
Lokesh


_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to