net: phy: micrel: lan8814: Add support for PTP_PF_PEROUT
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Mon, 8 Apr 2024 06:44:32 +0000 (08:44 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 9 Apr 2024 11:34:03 +0000 (13:34 +0200)
commit9e63941b8976c45f1ce42b5e0e45070ee24b22eb
treead074dde00fba44561be09ea61b578bafa2e9f80
parent9f6b3a498174843f5a9fb573d084bbad381f40f6
net: phy: micrel: lan8814: Add support for PTP_PF_PEROUT

Lan8814 has 24 GPIOs but only 2 GPIOs (GPIO 0 and GPIO 1) can be
configured to generate period signals. And there are 2 events (EVENT_A
and EVENT_B) but these events are hardcoded to the GPIO 0 and GPIO 1.
These events are used to generate period signals. It is possible to
configure the length, the start time and the period of the signal by
configuring the event.

These events are generated by comparing the target time with the PHC
time. In case the PHC time is changed to a value bigger than the target
time + reload time, then it would generate only 1 event and then it
would stop because target time + reload time is smaller than PHC time.
Therefore it is required to change also the target time every time when
the PHC is changed. The same will apply also when the PHC time is
changed to a smaller value.

This was tested using:
testptp -i 1 -L 1,2
testptp -i 1 -p 1000000000 -w 200000000

Acked-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Divya Koppera <divya.koppera@microchip.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/phy/micrel.c