RE: [net-next 0/3] ptp: Add driver for R-Car Gen4 gPTP timer

From: Michael Dege

Date: Wed Jun 10 2026 - 01:03:22 EST


Hello Niklas,

Thank you for your effort to clean this driver up.

> -----Original Message-----
> From: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
> Sent: Tuesday, June 9, 2026 11:57 PM
> To: Rob Herring <robh@xxxxxxxxxx>; Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>; Conor Dooley
> <conor+dt@xxxxxxxxxx>; Geert Uytterhoeven <geert+renesas@xxxxxxxxx>; magnus.damm
> <magnus.damm@xxxxxxxxx>; Richard Cochran <richardcochran@xxxxxxxxx>; Andrew Lunn
> <andrew+netdev@xxxxxxx>; DavidS. Miller <davem@xxxxxxxxxxxxx>; Eric Dumazet <edumazet@xxxxxxxxxx>;
> Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>; linux-renesas-soc@xxxxxxxxxxxxxxx;
> devicetree@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx
> Cc: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
> Subject: [net-next 0/3] ptp: Add driver for R-Car Gen4 gPTP timer
>
> Hello,
>
> This series is the first part cleaning up how PTP timer support is implemented on R-Car Gen4.
> Currently there is partial support for it in some of the Ethernet devices that can use it, but not
> all.
>
> The partial support have been implemented by hacking the gPTP module directly into the first Ethernet
> device driver that used it, RTSN for V4H and RSWITCH for S4. This is understandable as earlier R-Car
> generations had a dedicated gPTP timer for each Ethernet device, but on
> Gen4 there is a single system-wide PTP timer shared by all.
>
> The current implementation makes it impossible for other Ethernet devices on the platform to use the
> PTP timer without messing around with other Ethernet device drivers.
>
> The effort to clean this up starts with this series which adds the system-wide gPTP timer as its own
> driver and device tree node.
>
> This series will then be followed by work to add proper PTP support to the R-Car RAVB Gen4 driver,
> which currently advertises to user-space it supports PTP but which implementation is broken and does
> not work.
>
> This will in turn be followed by work to the RTSN and RSWITCH drivers will be be switched from its
> current partial support by mapping the gPTP address space directly to instead use this driver.
>
> While having both this driver and the "direct accessing of registers by the user driver" in operation
> at the same time works, but it is not recommended. It works by chance due to how both the RTSN and
> RSWITCH drivers internal workings.
>
> For this reason this new solution will only be enabled on platforms after all user's of the gPTP clock
> have moved to only use the new centralized timer.
>
> For some platforms this is straight forward, such as V4H Sparrow Hawk, which only have the RAVB
> Ethernet interface. This platform currently have no users of the PTP timer, but still advertise it
> supports it. This and the soon to be posted RAVB patches solves that.
>
> As the RAVB patches depends on this series the device tree node for the gPTP clock is added in this
> series but will be enabled and linked to consumers in the RAVB gPTP series for platforms where it will
> not conflict with RTSN and RSWITCH. And further enabled as more of this is cleaned up.
>
> The gPTP driver itself is heavily influence by the existing partial support for gPTP in the RTSN and
> RSWITCH drivers and the Renesas BSP.
>
> Niklas Söderlund (3):
> dt-bindings: ptp: renesas,rcar-gen4-gptp: Add binding for R-Car Gen4
> ptp: Add driver for R-Car Gen4
> arm64: dts: renesas: r8a779g0: Add gPTP node
>
> .../bindings/ptp/renesas,rcar-gen4-gptp.yaml | 64 +++++
> MAINTAINERS | 7 +
> arch/arm64/boot/dts/renesas/r8a779g0.dtsi | 9 +
> drivers/ptp/Kconfig | 12 +
> drivers/ptp/Makefile | 1 +
> drivers/ptp/ptp_rcar_gen4.c | 219 ++++++++++++++++++
> 6 files changed, 312 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/ptp/renesas,rcar-gen4-gptp.yaml
> create mode 100644 drivers/ptp/ptp_rcar_gen4.c
>
> --
> 2.54.0
>
Are you aware, that Gen5 is on the horizon? The first patches for X5H have been up-streamed. X5H will
be using the same gPTP driver. I think it would be a good idea to make this driver generic, meaning
leave out the references to Gen4. What do you think?

Best regards,

Michael