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

Geert Uytterhoeven
2021-10-19T15:14:12Z

Hi Kory,

Thanks for your patch!

On Tue, Oct 19, 2021 at 4:57 PM Kory Maincent <kory.maincent@bootlin.com> wrote:
> Invert the configuration of the RGMII delay selected by RGMII_RXID and
> RGMII_TXID.
>
> 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

Do you mean ethernet-controller.yaml?

> 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@bootlin.com>

Does this fix an actual problem for you?

> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2114,13 +2114,13 @@ static void ravb_parse_delay_mode(struct device_node *np, struct net_device *nde
> /* Fall back to legacy rgmii-*id behavior */

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.

> if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
> priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) {
> - priv->rxcidm = 1;
> + priv->txcidm = 1;
> priv->rgmii_override = 1;
> }
>
> if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
> priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) {
> - priv->txcidm = 1;
> + priv->rxcidm = 1;
> priv->rgmii_override = 1;
> }
> }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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