Re: [PATCH net-next v3] net: phy: micrel: Add support for PTP_PF_PEROUT for lan8841

From: Jakub Kicinski
Date: Fri Mar 10 2023 - 19:38:35 EST


On Tue, 7 Mar 2023 22:44:02 +0100 Horatiu Vultur wrote:
> Lan8841 has 10 GPIOs and it has 2 events(EVENT_A and EVENT_B). It is
> possible to assigned the 2 events to any of the GPIOs, but a GPIO can
> have only 1 event at a time.
> These events are used to generate periodic signals. It is possible to
> configure the length, the start time and the period of the signal by
> configuring the event.
> Currently the SW uses only EVENT_A to generate the perout.
>
> 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 small 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 -L 6,2
> testptp -p 1000000000 -w 200000000

AFAICT enabling a new output will steal the event from the previous one.
Is this normal / expected? Should you be checking if any output is
active and refuse to enable another GPIO if so?

Richard, does the patch look good to you?