diff mbox

[U-Boot] net: phy: realtek: fix enabling of the TX-delay for RTL8211F

Message ID 1503045324-23480-1-git-send-email-madalin.bucur@nxp.com
State Accepted
Commit 05b29aa0cb6875e1d91eec5ba1949e8d0c1f2618
Delegated to: Joe Hershberger
Headers show

Commit Message

Madalin Bucur Aug. 18, 2017, 8:35 a.m. UTC
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>
---
 drivers/net/phy/realtek.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

Comments

Joe Hershberger Aug. 18, 2017, 3:40 p.m. UTC | #1
On Fri, Aug 18, 2017 at 3:35 AM, Madalin Bucur <madalin.bucur@nxp.com> wrote:
> 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>
York Sun Aug. 18, 2017, 9:43 p.m. UTC | #2
On 08/18/2017 01:36 AM, Madalin Bucur wrote:
> 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>
> ---

Together with https://patchwork.ozlabs.org/patch/797657/, this fixes the 
network issue on LS1043ARDB.

Acked-by: York Sun <york.sun@nxp.com>
Joe Hershberger Sept. 7, 2017, 6:32 p.m. UTC | #3
Hi Madalin-cristian,

https://patchwork.ozlabs.org/patch/803094/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox

Patch

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 635acf5..6d917f8 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -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,