Re: [PATCH] net: renesas: Fix rgmii-id delays

From: Köry Maincent
Date: Wed Oct 20 2021 - 04:53:36 EST


Hello Geert, Thomas

On Tue, 19 Oct 2021 22:05:41 +0200
Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:

> Hi Thomas,
>
> On Tue, Oct 19, 2021 at 5:57 PM Thomas Petazzoni
> <thomas.petazzoni@xxxxxxxxxxx> wrote:
> > On Tue, 19 Oct 2021 17:41:49 +0200
> > Andrew Lunn <andrew@xxxxxxx> wrote:
> > > > When people update the kernel version don't they update also the
> > > > devicetree?
> > >
> > > DT is ABI. Driver writers should not break old blobs running on new
> > > kernels. Often the DT blob is updated with the kernel, but it is not
> > > required. It could be stored in a hard to reach place, shared with
> > > u-boot etc.
> >
> > Right, but conversely if someone reads the DT bindings that exists
> > today, specifies phy-mode = "rgmii-rxid" or phy-mmode = "rmgii-txid",
>
> Today == v5.10-rc1 and later?
>
> > this person will get incorrect behavior. Sure a behavior that is
> > backward compatible with older DTs, but a terribly wrong one when you
> > write a new DT and read the DT binding documentation. This is exactly
> > the problem that happened to us.
>
> If you write a new DT, you read the DT binding documentation, and
> "make dtbs_check" will inform you politely if you use the legacy/wrong
> DT (i.e. lacking "[rt]x-internal-delay-ps")?

Indeed this command will inform the missing required "[rt]x-internal-delay-ps".
I am not use to that command, as it seems to check all the devicetree each time
where I want only to check one.

>
> The current driver is backwards-compatible with the legacy/wrong DTB.
> The current DT bindings (as of v5.10-rc1), using "[rt]x-internal-delay-ps"
> are correct.
> Or am I missing something here?

You are correct.

>
> BTW, it's still not clear to me why the inversion would be needed.
> Cfr. Andrew's comment:
>
> | So with rgmii-rxid, what is actually passed to the PHY? Is your
> | problem you get twice the delay in one direction, and no delay in the
> | other?

Yes, it was the problem I got.
The PHY I use have RX delay enabled by default, currently the PHY driver does
not support delay configuration, therefore I let the MAC handle TX delay. I
have stumbling over that legacy/wrong DTS on the old Kernel.

Regards,
Köry