Re: [PATCH v2 4/7] net: dsa: b53: Add PHC clock support

From: Florian Fainelli
Date: Tue Nov 09 2021 - 13:08:51 EST


On 11/9/21 1:50 AM, Martin Kaistra wrote:
> The BCM53128 switch has an internal clock, which can be used for
> timestamping. Add support for it.
>
> The 32-bit free running clock counts nanoseconds. In order to account
> for the wrap-around at 999999999 (0x3B9AC9FF) while using the cycle
> counter infrastructure, we need to set a 30bit mask and use the
> overflow_point property.
>
> Enable the Broadsync HD timestamping feature in b53_ptp_init() for PTPv2
> Ethertype (0x88f7).
>
> Signed-off-by: Martin Kaistra <martin.kaistra@xxxxxxxxxxxxx>
> ---

[snip]

> struct b53_mib_desc {
> u8 size;
> @@ -1131,12 +1132,24 @@ static int b53_setup(struct dsa_switch *ds)
> b53_disable_port(ds, port);
> }
>
> + if (dev->broadsync_hd) {
> + ret = b53_ptp_init(dev);
> + if (ret) {
> + dev_err(ds->dev, "failed to initialize PTP\n");
> + return ret;
> + }

Can you fold the check for dev->broadsync_hd within b53_ptp_init() as
requested before? And likewise for b53_ptp_exit.
--
Florian