|
|
Log in / Subscribe / Register

ravb: Add gPTP support for Gen4

From:  Niklas Söderlund <niklas.soderlund+renesas-AT-ragnatech.se>
To:  Paul Barker <paul-AT-pbarker.dev>, Andrew Lunn <andrew+netdev-AT-lunn.ch>, "David S. Miller" <davem-AT-davemloft.net>, Eric Dumazet <edumazet-AT-google.com>, Jakub Kicinski <kuba-AT-kernel.org>, Paolo Abeni <pabeni-AT-redhat.com>, Rob Herring <robh-AT-kernel.org>, Krzysztof Kozlowski <krzk+dt-AT-kernel.org>, Conor Dooley <conor+dt-AT-kernel.org>, Richard Cochran <richardcochran-AT-gmail.com>, Geert Uytterhoeven <geert+renesas-AT-glider.be>, Magnus Damm <magnus.damm-AT-gmail.com>, Sergei Shtylyov <sergei.shtylyov-AT-gmail.com>, netdev-AT-vger.kernel.org, linux-renesas-soc-AT-vger.kernel.org, devicetree-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org
Subject:  [net-next 0/9] ravb: Add gPTP support for Gen4
Date:  Wed, 10 Jun 2026 12:24:23 +0200
Message-ID:  <20260610102432.3538432-1-niklas.soderlund+renesas@ragnatech.se>
Cc:  Niklas Söderlund <niklas.soderlund+renesas-AT-ragnatech.se>
Archive-link:  Article

Hello,

This series is the second 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.

On Gen2 and Gen3 each RAVB instance have it's own private PTP clock as 
part of the RAVB register space. For this reason the PTP functionally 
was implemented directly in the RAVB driver. For Gen4 however there is a 
system-wide PTP clock shared by all RAVB instances, and on some Gen4 
platforms with other Ethernet devices.

The RAVB Gen4 driver currently advertise PTP support to user-space, but 
the support is in fact completely broken. It tries to use RAVB private 
PTP clock, which do not exist on Gen4.

Further more the PTP clock behaved slightly different on Gen2 and Gen3.  
These decencies have been handled by adding platform specific flags 
inside the driver.

The usage of these flags have grown organically and been extended all 
over the driver as it gained new features. Adding a new third set of 
flags for Gen4 would be messy and add to the confusion.

Therefore patches 1/9 thru 7/9 refactors the usage of the PTP flags into 
optional callbacks and untangles the usage. This allows adding Gen4 
support easy as it can just implement it's own set of Gen4 specific 
callbacks without altering the driver logic.

Patch 8/9 is a small DT binding addition adding an optional phandle to 
link a RAVB device to the external PTP clock. Ideally this property 
should be mandatory, but for backward comp ability is is made optional.  
If the phandle is not set, or the PTP clock not enabled, the RAVB driver 
will continue to faction as before, but no longer advertise PTP support 
to user space.

Finally patch 9/9 adds the Gen4 specific PTP callbacks which allows the 
driver to use the external PTP clock.

For part one of this work see [1]. The two series are independent of 
each other but both are needed before a third series liking the RAVB to 
the PTP clock in the platforms device tree. I will hold posting the 
third series until all dependencies are merged. For this reason there is 
no user of the new renesas,gptp device tree property added in this 
series.

The work is tested on both Gen3 and Gen4 R-Car devices (with [1] and 
appropriate DTS). I do however not have access to any Gen2 device where 
the RAVB IP is wired to a MAC, so the small rework of the flags for Gen2 
to callbacks have only been compiled tested. If anybody have a RZ device 
where RAVB is wired and uses the Gen2 method of starting/stopping the 
PTP timer together with the DMAC please test this.

1.  https://lore.kernel.org/all/20260609215711.2960150-1-nikl...

Niklas Söderlund (9):
  net: ethernet: ravb: Remove gPTP control from WoL setup and restore
  net: ethernet: ravb: Move programming of gPTP timer interval
  net: ethernet: ravb: Simplify gPTP start and stop
  net: ethernet: ravb: Remove redundant argument to ravb_ptp_init()
  net: ethernet: ravb: Replace gPTP flags with callbacks
  net: ethernet: ravb: Add callback for gPTP probe
  net: ethernet: ravb: Add callback for gPTP clock index
  dt-bindings: net: renesas,etheravb: Add optional gPTP phandle for Gen4
  net: ethernet: ravb: Add gPTP support for Gen4

 .../bindings/net/renesas,etheravb.yaml        |  16 ++
 drivers/net/ethernet/renesas/ravb.h           |  34 ++-
 drivers/net/ethernet/renesas/ravb_main.c      | 246 ++++++++++++------
 drivers/net/ethernet/renesas/ravb_ptp.c       |  15 +-
 4 files changed, 219 insertions(+), 92 deletions(-)

-- 
2.54.0




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds