This series adds support for an userpace utility to sync a pwm with PTP clock. This can be used only on a specific hardware configutaion: - A PTP supporting IP that is not capable of generating PPS signal - A PWM signal that is connected to the above PTP hardware - On every rising edge of PWM, PTP hardware should be able to send the current timestamp to userspace. - This PWM signal can be used as a PPS signal that is synchronized to PTP clock.
There are already 2 existing proven solutions to generate a PPS on BeagleBoneBlack: - [0]: Changing the PWM registers directly in userspce - [1]: Changing the PWM registers directly in CPTS driver Neither of the above solutions are accceptable in upstream as the PWM accesses are not legitimate in the both of them. The userspace utility that this series introduces is highly derived from the above two solutions and making legitimate calls. I am sure there must be few things I might be missing while implementing it, any feedback on it is much appreciated :) Following dependencies are needed in kernel for testing: - Grygorii's series to support HW_TS_PUSH[2] - Add pwm node in BBB DT. All dependencies are available at[3]. [0] https://usermanual.wiki/Document/SetupGuide.632280828.pdf https://github.com/t-tibor/msc_thesis [1] https://git.ti.com/cgit/processor-sdk/processor-sdk-linux/commit/drivers/net/ethernet/ti/cpts.c?h=processor-sdk-linux-4.19.y&id=5e1a483eddc1b8dfd6df7183fa9216224aecae11 [2] https://patchwork.kernel.org/project/linux-omap/list/?series=259523 [3] https://github.com/lokeshvutla/linux.git devel/bbb-pps-generation Lokesh Vutla (3): phc: Add helper apis to control external timestamps on ptp device pwm: Add helper apis to control pwm phc2pwm: Introduce an utility to sync pwm with PTP clock makefile | 8 +- phc.c | 48 +++++++++++ phc.h | 29 +++++++ phc2pwm.c | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ pwm.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++++ pwm.h | 80 +++++++++++++++++++ 6 files changed, 618 insertions(+), 3 deletions(-) create mode 100644 phc2pwm.c create mode 100644 pwm.c create mode 100644 pwm.h -- 2.23.0 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel