[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190508012920.13710-3-fancer.lancer@gmail.com>
Date: Wed, 8 May 2019 04:29:22 +0300
From: Serge Semin <fancer.lancer@...il.com>
To: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>
Cc: Serge Semin <Sergey.Semin@...latforms.ru>,
Vladimir Oltean <olteanv@...il.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v3 2/2] net: phy: realtek: Change TX-delay setting for RGMII modes only
It's prone to problems if delay is cleared out for other than RGMII
modes. So lets set/clear the TX-delay in the config register only
if actually RGMII-like interface mode is requested.
Signed-off-by: Serge Semin <fancer.lancer@...il.com>
---
Changelog v3
- Accept RGMII_RXID interface mode by clearing the TX_DELAY bit
in this case.
---
drivers/net/phy/realtek.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index d27f072f227b..134b5fc7926d 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -164,16 +164,27 @@ static int rtl8211c_config_init(struct phy_device *phydev)
static int rtl8211f_config_init(struct phy_device *phydev)
{
int ret;
- u16 val = 0;
+ u16 val;
ret = genphy_config_init(phydev);
if (ret < 0)
return ret;
- /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */
- if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
- phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+ /* enable TX-delay for rgmii-txid, and disable it for rgmii and
+ * rgmii-rxid. The last one might be enabled by external RXDLY pin
+ * strapping.
+ */
+ switch (phydev->interface) {
+ case PHY_INTERFACE_MODE_RGMII:
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+ val = 0;
+ break;
+ case PHY_INTERFACE_MODE_RGMII_TXID:
val = RTL8211F_TX_DELAY;
+ break;
+ default: /* the rest of the modes imply leaving delay as is. */
+ return 0;
+ }
return phy_modify_paged(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY, val);
}
--
2.21.0
Powered by blists - more mailing lists