|
37 | 37 | #include <asm/qe.h> |
38 | 38 | #include <asm/ucc.h> |
39 | 39 | #include <asm/ucc_fast.h> |
| 40 | +#include <asm/machdep.h> |
40 | 41 |
|
41 | 42 | #include "ucc_geth.h" |
42 | 43 | #include "fsl_pq_mdio.h" |
@@ -1334,7 +1335,7 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) |
1334 | 1335 | struct ucc_geth __iomem *ug_regs; |
1335 | 1336 | struct ucc_fast __iomem *uf_regs; |
1336 | 1337 | int ret_val; |
1337 | | - u32 upsmr, maccfg2, tbiBaseAddress; |
| 1338 | + u32 upsmr, maccfg2; |
1338 | 1339 | u16 value; |
1339 | 1340 |
|
1340 | 1341 | ugeth_vdbg("%s: IN", __func__); |
@@ -1389,14 +1390,20 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) |
1389 | 1390 | /* Note that this depends on proper setting in utbipar register. */ |
1390 | 1391 | if ((ugeth->phy_interface == PHY_INTERFACE_MODE_TBI) || |
1391 | 1392 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { |
1392 | | - tbiBaseAddress = in_be32(&ug_regs->utbipar); |
1393 | | - tbiBaseAddress &= UTBIPAR_PHY_ADDRESS_MASK; |
1394 | | - tbiBaseAddress >>= UTBIPAR_PHY_ADDRESS_SHIFT; |
1395 | | - value = ugeth->phydev->bus->read(ugeth->phydev->bus, |
1396 | | - (u8) tbiBaseAddress, ENET_TBI_MII_CR); |
| 1393 | + struct ucc_geth_info *ug_info = ugeth->ug_info; |
| 1394 | + struct phy_device *tbiphy; |
| 1395 | + |
| 1396 | + if (!ug_info->tbi_node) |
| 1397 | + ugeth_warn("TBI mode requires that the device " |
| 1398 | + "tree specify a tbi-handle\n"); |
| 1399 | + |
| 1400 | + tbiphy = of_phy_find_device(ug_info->tbi_node); |
| 1401 | + if (!tbiphy) |
| 1402 | + ugeth_warn("Could not get TBI device\n"); |
| 1403 | + |
| 1404 | + value = phy_read(tbiphy, ENET_TBI_MII_CR); |
1397 | 1405 | value &= ~0x1000; /* Turn off autonegotiation */ |
1398 | | - ugeth->phydev->bus->write(ugeth->phydev->bus, |
1399 | | - (u8) tbiBaseAddress, ENET_TBI_MII_CR, value); |
| 1406 | + phy_write(tbiphy, ENET_TBI_MII_CR, value); |
1400 | 1407 | } |
1401 | 1408 |
|
1402 | 1409 | init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_regs->maccfg2); |
|
0 commit comments