summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorShengzhou Liu <Shengzhou.Liu@freescale.com>2015-04-24 16:57:17 +0800
committerJoe Hershberger <joe.hershberger@ni.com>2015-05-19 13:33:21 -0500
commit793ea947703899c36a51c30e477466c49a8e9657 (patch)
treef9501194fd99ab0a5e8c06aefa57397db5f42f3f /drivers/net
parentf566c9949fbdce2e09a900c5343ca9986e5ba360 (diff)
downloadu-boot-imx-793ea947703899c36a51c30e477466c49a8e9657.zip
u-boot-imx-793ea947703899c36a51c30e477466c49a8e9657.tar.gz
u-boot-imx-793ea947703899c36a51c30e477466c49a8e9657.tar.bz2
net/phy: refactor RTL8211F initialization
RTL8211F needs to enalbe TXDLY for RGMII during phy initialization, so move it to rtl8211f_config for early initialization. Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com> cc: Joe Hershberger <joe.hershberger@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/phy/realtek.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 2e152c9..79452a8 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -40,6 +40,7 @@
#define MIIM_RTL8211F_PHYSTAT_LINK 0x0004
#define MIIM_RTL8211F_PAGE_SELECT 0x1f
+#define MIIM_RTL8211F_TX_DELAY 0x100
/* RealTek RTL8211x */
static int rtl8211x_config(struct phy_device *phydev)
@@ -60,6 +61,29 @@ static int rtl8211x_config(struct phy_device *phydev)
return 0;
}
+static int rtl8211f_config(struct phy_device *phydev)
+{
+ u16 reg;
+
+ 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);
+ 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);
+ }
+
+ genphy_config_aneg(phydev);
+
+ return 0;
+}
+
static int rtl8211x_parse_status(struct phy_device *phydev)
{
unsigned int speed;
@@ -159,13 +183,6 @@ static int rtl8211f_parse_status(struct phy_device *phydev)
phydev->speed = SPEED_10;
}
- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
- /* enable TXDLY */
- phy_write(phydev, MDIO_DEVAD_NONE,
- MIIM_RTL8211F_PAGE_SELECT, 0xd08);
- phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
- }
-
return 0;
}
@@ -226,7 +243,7 @@ static struct phy_driver RTL8211F_driver = {
.uid = 0x1cc916,
.mask = 0xffffff,
.features = PHY_GBIT_FEATURES,
- .config = &rtl8211x_config,
+ .config = &rtl8211f_config,
.startup = &rtl8211f_startup,
.shutdown = &genphy_shutdown,
};