|
63 | 63 | #define MII_M1111_HWCFG_MODE_COPPER_RGMII 0xb |
64 | 64 | #define MII_M1111_HWCFG_MODE_FIBER_RGMII 0x3 |
65 | 65 | #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK 0x4 |
| 66 | +#define MII_M1111_HWCFG_MODE_COPPER_RTBI 0x9 |
66 | 67 | #define MII_M1111_HWCFG_FIBER_COPPER_AUTO 0x8000 |
67 | 68 | #define MII_M1111_HWCFG_FIBER_COPPER_RES 0x2000 |
68 | 69 |
|
@@ -269,6 +270,43 @@ static int m88e1111_config_init(struct phy_device *phydev) |
269 | 270 | return err; |
270 | 271 | } |
271 | 272 |
|
| 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 | + |
272 | 310 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); |
273 | 311 | if (err < 0) |
274 | 312 | return err; |
|
0 commit comments