diff mbox series

[V2,4/8] net: phy: realtek: add rx delay support for RTL8211F

Message ID 20200503144120.30038-4-peng.fan@nxp.com
State New
Headers show
Series [V2,1/8] net: eth-uclass: add return value check | expand

Commit Message

Peng Fan May 3, 2020, 2:41 p.m. UTC
From: Fugang Duan <fugang.duan at nxp.com>

Add RX delay enable support for RTL8211F PHY.

Reviewed-by: Ye Li <ye.li at nxp.com>
Signed-off-by: Fugang Duan <fugang.duan at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/net/phy/realtek.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Stefano Babic May 11, 2020, 10:19 a.m. UTC | #1
> From: Fugang Duan <fugang.duan at nxp.com>
> Add RX delay enable support for RTL8211F PHY.
> Reviewed-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Fugang Duan <fugang.duan at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 8f1d759632..8f0a897a46 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -56,6 +56,7 @@ 
 
 #define MIIM_RTL8211F_PAGE_SELECT      0x1f
 #define MIIM_RTL8211F_TX_DELAY		0x100
+#define MIIM_RTL8211F_RX_DELAY		0x8
 #define MIIM_RTL8211F_LCR		0x10
 
 static int rtl8211f_phy_extread(struct phy_device *phydev, int addr,
@@ -183,6 +184,16 @@  static int rtl8211f_config(struct phy_device *phydev)
 		reg &= ~MIIM_RTL8211F_TX_DELAY;
 
 	phy_write(phydev, MDIO_DEVAD_NONE, 0x11, reg);
+
+	/* enable RX-delay for rgmii-id and rgmii-rxid, otherwise disable it */
+	reg = phy_read(phydev, MDIO_DEVAD_NONE, 0x15);
+	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+	    phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+		reg |= MIIM_RTL8211F_RX_DELAY;
+	else
+		reg &= ~MIIM_RTL8211F_RX_DELAY;
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x15, reg);
+
 	/* restore to default page 0 */
 	phy_write(phydev, MDIO_DEVAD_NONE,
 		  MIIM_RTL8211F_PAGE_SELECT, 0x0);