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

Kory Maincent
2021-10-19T14:57:31Z

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
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>
---
drivers/net/ethernet/renesas/ravb_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 0f85f2d97b18..89cd88e5b450 100644
--- 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 */
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;
}
}
--
2.25.1