Re: [PATCH net-next v2 03/10] net: ethernet: ravb: Simplify gPTP start and stop

From: Sergey Shtylyov

Date: Sat Aug 15 2026 - 14:31:14 EST


On 8/11/26 7:01 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 stop the AVB-DMAC. There are no
> functional change as all call sites to the construct:
>
> if (info->gptp)
> ravb_ptp_init(ndev, priv->pdev);
>
> are always just after a call to into ravb_dmac_init() and all call sites
> to the construct:
>
> if (info->gptp)
> ravb_ptp_stop(ndev);
>
> are always directly followed by a call to ravb_stop_dma().
>
> 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>
Reviewed-by: Sergey Shtylyov <sergei.shtylyov@xxxxxxxxx>

[...]

MBR, Sergey