Re: [net-next 3/9] net: ethernet: ravb: Simplify gPTP start and stop

From: Sergey Shtylyov

Date: Fri Jun 12 2026 - 13:51:14 EST


On 6/10/26 1:24 PM, Niklas Söderlund wrote:

> For devices that do not support the gPTP clock in config mode the
> somewhat oddly named flag gptp is set, compared to devices that do
> support the gPTP clock in config and operation mode where the flag
> ccc_gac is set instead. The two flags are mutually exclusive.
>
> For the gptp-flag devices (Gen2) the clock is tied to the AVB-DMAC, when
> it is stopped so is the gPTP clock. For ccc_gac-flag devices (Gen3) the
> gPTP clock is available whenever the ndev is open.
>
> Prepare to add Gen4 support which will add a third way by cleaning the
> Gen2 and Gen3 cases up a bit.
>
> Fold the gptp-flag start and stop calls into ravb_dmac_init() and
> ravb_stop_dma(), which start and stops the AVB-DMAC. There are no

s/stops/stop/.

> functional change as all call sites to the construct,

s/,/:/?

>
> if (info->gptp)
> ravb_ptp_init(ndev, priv->pdev);
>
> Are always just after a call to into ravb_dmac_init() and all call sites

s/Are/are/.

> to the to the construct,

"to the" repeated... And s/,/:/?

>
> if (info->gptp)
> ravb_ptp_stop(ndev);
>
> Are always directly followed by a call to ravb_stop_dma().

s/Are/are/.

>
> There are two special cases where the calling construct covers both the
> gptp-flag and info->ccc_gac devices, one for start and one for stop. The
> condition that it is preceded by a call to ravb_dmac_init(), or followed
> by a call to ravb_stop_dma() are however true for them too. Reworked the
> two special cases to drop the check of info->gptp.
>
> The end result is that the gPTP clock will be started or stopped for the
> gptp-flag devices in tandem with the AVB-DMAC, while the info->ccc_gac
> devices will be controlled, as before, when the ndev is opened or
> closed.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
[...]
MBR, Sergey