Skip to content

Commit 5f8cbc1

Browse files
Liu Yu-B13201davem330
authored andcommitted
phy: add RTBI mode for m88e1111
Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 81abb43 commit 5f8cbc1

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

drivers/net/phy/marvell.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#define MII_M1111_HWCFG_MODE_COPPER_RGMII 0xb
6464
#define MII_M1111_HWCFG_MODE_FIBER_RGMII 0x3
6565
#define MII_M1111_HWCFG_MODE_SGMII_NO_CLK 0x4
66+
#define MII_M1111_HWCFG_MODE_COPPER_RTBI 0x9
6667
#define MII_M1111_HWCFG_FIBER_COPPER_AUTO 0x8000
6768
#define MII_M1111_HWCFG_FIBER_COPPER_RES 0x2000
6869

@@ -269,6 +270,43 @@ static int m88e1111_config_init(struct phy_device *phydev)
269270
return err;
270271
}
271272

273+
if (phydev->interface == PHY_INTERFACE_MODE_RTBI) {
274+
temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
275+
if (temp < 0)
276+
return temp;
277+
temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
278+
err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
279+
if (err < 0)
280+
return err;
281+
282+
temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
283+
if (temp < 0)
284+
return temp;
285+
temp &= ~(MII_M1111_HWCFG_MODE_MASK | MII_M1111_HWCFG_FIBER_COPPER_RES);
286+
temp |= 0x7 | MII_M1111_HWCFG_FIBER_COPPER_AUTO;
287+
err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
288+
if (err < 0)
289+
return err;
290+
291+
/* soft reset */
292+
err = phy_write(phydev, MII_BMCR, BMCR_RESET);
293+
if (err < 0)
294+
return err;
295+
do
296+
temp = phy_read(phydev, MII_BMCR);
297+
while (temp & BMCR_RESET);
298+
299+
temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
300+
if (temp < 0)
301+
return temp;
302+
temp &= ~(MII_M1111_HWCFG_MODE_MASK | MII_M1111_HWCFG_FIBER_COPPER_RES);
303+
temp |= MII_M1111_HWCFG_MODE_COPPER_RTBI | MII_M1111_HWCFG_FIBER_COPPER_AUTO;
304+
err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
305+
if (err < 0)
306+
return err;
307+
}
308+
309+
272310
err = phy_write(phydev, MII_BMCR, BMCR_RESET);
273311
if (err < 0)
274312
return err;

0 commit comments

Comments
 (0)