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

From: Geert Uytterhoeven
Date: Tue Oct 19 2021 - 11:44:28 EST


Hi Köry,

On Tue, Oct 19, 2021 at 5:35 PM Köry Maincent <kory.maincent@xxxxxxxxxxx> wrote:
> On Tue, 19 Oct 2021 17:13:52 +0200
> Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> > > The ravb MAC is adding RX delay if RGMII_RXID is selected and TX delay
> > > if RGMII_TXID but that behavior is wrong.
> > > Indeed according to the ethernet.txt documentation the ravb configuration
> > > should be inverted:
> > > * "rgmii-rxid" (RGMII with internal RX delay provided by the PHY, the MAC
> > > should not add an RX delay in this case)
> > > * "rgmii-txid" (RGMII with internal TX delay provided by the PHY, the MAC
> > > should not add an TX delay in this case)
> > >
> > > This patch inverts the behavior, i.e adds TX delay when RGMII_RXID is
> > > selected and RX delay when RGMII_TXID is selected.
> > >
> > > Signed-off-by: Kory Maincent <kory.maincent@xxxxxxxxxxx>
> >
> > Does this fix an actual problem for you?
>
> In fact, this fix a problem for an older 4.14 Kernel on my current project.
> I wanted to push my fix in the mainline kernel also, but as you say below, now
> this code is legacy.
> Does it matter to fix legacy code?

I don't think so. If you're stuck on v4.14, you may want to backport
commit a6f51f2efa742df0 ("ravb: Add support for explicit internal
clock delay configuration"). However, you have to be careful, as
it interacts with related changes to PHY drivers, as explained in
that commit.

> > Note that in accordance with the comment above, the code section
> > below is only present to support old DTBs. Contemporary DTBs rely
> > on the now mandatory "rx-internal-delay-ps" and "tx-internal-delay-ps"
> > properties instead.
> > Hence changing this code has no effect on DTS files as supplied with
> > the kernel, but may have ill effects on DTB files in the field, which
> > rely on the current behavior.
>
> When people update the kernel version don't they update also the devicetree?

I hope they do ;-)
But we do our best to preserve backwards-compatibility with old DTBS.
If you change behavior of v4.14, it may actually introduce
backwards-incompatibility we're not aware of, as the behavior you
started to rely on never existed in mainline.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds