summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorSerge Semin <fancer.lancer@gmail.com>2019-05-09 00:51:17 +0300
committerDavid S. Miller <davem@davemloft.net>2019-05-08 16:31:38 -0700
commit1da7756e6616c7795c8a104fde0a66f212ef659d (patch)
tree5c03f29d13b1e3bb61f055428b3148dd7157384d /drivers/net
parentf81dadbcf7fd067baf184b63c179fc392bdb226e (diff)
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. This only concerns rtl8211f chips. Signed-off-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/phy/realtek.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index cfbc0ca61123..761ce3b1e7bd 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -161,12 +161,23 @@ static int rtl8211c_config_init(struct phy_device *phydev)
static int rtl8211f_config_init(struct phy_device *phydev)
{
- u16 val = 0;
+ u16 val;
- /* 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-{id,txid}, and disable it for rgmii and
+ * rgmii-rxid. The RX-delay can be enabled by the external RXDLY pin.
+ */
+ switch (phydev->interface) {
+ case PHY_INTERFACE_MODE_RGMII:
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+ val = 0;
+ break;
+ case PHY_INTERFACE_MODE_RGMII_ID:
+ 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);
}