]> git.sur5r.net Git - u-boot/commitdiff
net: phy: realtek: fix enabling of the TX-delay for RTL8211F
authorMadalin Bucur <madalin.bucur@nxp.com>
Fri, 18 Aug 2017 08:35:24 +0000 (11:35 +0300)
committerJoe Hershberger <joe.hershberger@ni.com>
Thu, 7 Sep 2017 18:23:52 +0000 (13:23 -0500)
The old logic always enabled the TX-delay when the phy-mode was set to
PHY_INTERFACE_MODE_RGMII. With this patch we enable the TX delay for
PHY_INTERFACE_MODE_RGMII_ID and PHY_INTERFACE_MODE_RGMII_TXID and
disable it for PHY_INTERFACE_MODE_RGMII.

Based on a similar change made in the Linux Realtek PHY driver
by Martin Blumenstingl <martin.blumenstingl@googlemail.com>.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: York Sun <york.sun@nxp.com>
drivers/net/phy/realtek.c

index 635acf5844e3e73c89b751a6f820b6949fb6affb..6d917f86f44d21537ffdd228316ec7e9ee86f9dc 100644 (file)
@@ -95,17 +95,21 @@ static int rtl8211f_config(struct phy_device *phydev)
 
        phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
 
-       if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
-               /* enable TXDLY */
-               phy_write(phydev, MDIO_DEVAD_NONE,
-                         MIIM_RTL8211F_PAGE_SELECT, 0xd08);
-               reg = phy_read(phydev, MDIO_DEVAD_NONE, 0x11);
+       phy_write(phydev, MDIO_DEVAD_NONE,
+                 MIIM_RTL8211F_PAGE_SELECT, 0xd08);
+       reg = phy_read(phydev, MDIO_DEVAD_NONE, 0x11);
+
+       /* 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)
                reg |= MIIM_RTL8211F_TX_DELAY;
-               phy_write(phydev, MDIO_DEVAD_NONE, 0x11, reg);
-               /* restore to default page 0 */
-               phy_write(phydev, MDIO_DEVAD_NONE,
-                         MIIM_RTL8211F_PAGE_SELECT, 0x0);
-       }
+       else
+               reg &= ~MIIM_RTL8211F_TX_DELAY;
+
+       phy_write(phydev, MDIO_DEVAD_NONE, 0x11, reg);
+       /* restore to default page 0 */
+       phy_write(phydev, MDIO_DEVAD_NONE,
+                 MIIM_RTL8211F_PAGE_SELECT, 0x0);
 
        /* Set green LED for Link, yellow LED for Active */
        phy_write(phydev, MDIO_DEVAD_NONE,