Skip to content

Commit 81abb43

Browse files
Liu Yu-B13201davem330
authored andcommitted
ucc_geth: update the tbi-phy setting
Old method only set tbi-phy for eth0. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c1fb834 commit 81abb43

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

drivers/net/ucc_geth.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <asm/qe.h>
3838
#include <asm/ucc.h>
3939
#include <asm/ucc_fast.h>
40+
#include <asm/machdep.h>
4041

4142
#include "ucc_geth.h"
4243
#include "fsl_pq_mdio.h"
@@ -1334,7 +1335,7 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
13341335
struct ucc_geth __iomem *ug_regs;
13351336
struct ucc_fast __iomem *uf_regs;
13361337
int ret_val;
1337-
u32 upsmr, maccfg2, tbiBaseAddress;
1338+
u32 upsmr, maccfg2;
13381339
u16 value;
13391340

13401341
ugeth_vdbg("%s: IN", __func__);
@@ -1389,14 +1390,20 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
13891390
/* Note that this depends on proper setting in utbipar register. */
13901391
if ((ugeth->phy_interface == PHY_INTERFACE_MODE_TBI) ||
13911392
(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);
13971405
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);
14001407
}
14011408

14021409
init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_regs->maccfg2);

0 commit comments

Comments
 (0)