Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121699
b: refs/heads/master
c: 9c61d6b
h: refs/heads/master
i:
  121697: 63cf9ab
  121695: 919ae97
v: v3
  • Loading branch information
Matt Carlson authored and David S. Miller committed Nov 4, 2008
1 parent bd3dd6b commit cea0e38
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0a459aac9d151c2e36ec65723b9b845b24c5cbc3
refs/heads/master: 9c61d6bc56bf0a5fb1ebfcf4c168cc5ce30e153b
47 changes: 35 additions & 12 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ static int tg3_mdio_reset(struct mii_bus *bp)
return 0;
}

static void tg3_mdio_config(struct tg3 *tp)
static void tg3_mdio_config_5785(struct tg3 *tp)
{
u32 val;

Expand Down Expand Up @@ -934,8 +934,9 @@ static void tg3_mdio_start(struct tg3 *tp)
tw32_f(MAC_MI_MODE, tp->mi_mode);
udelay(80);

if (tp->tg3_flags3 & TG3_FLG3_MDIOBUS_INITED)
tg3_mdio_config(tp);
if ((tp->tg3_flags3 & TG3_FLG3_MDIOBUS_INITED) &&
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785)
tg3_mdio_config_5785(tp);
}

static void tg3_mdio_stop(struct tg3 *tp)
Expand Down Expand Up @@ -989,14 +990,20 @@ static int tg3_mdio_init(struct tg3 *tp)
if (i) {
printk(KERN_WARNING "%s: mdiobus_reg failed (0x%x)\n",
tp->dev->name, i);
mdiobus_free(tp->mdio_bus);
return i;
}

tp->tg3_flags3 |= TG3_FLG3_MDIOBUS_INITED;

phydev = tp->mdio_bus->phy_map[PHY_ADDR];

switch (phydev->phy_id) {
if (!phydev || !phydev->drv) {
printk(KERN_WARNING "%s: No PHY devices\n", tp->dev->name);
mdiobus_unregister(tp->mdio_bus);
mdiobus_free(tp->mdio_bus);
return -ENODEV;
}

switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) {
case TG3_PHY_ID_BCM50610:
phydev->interface = PHY_INTERFACE_MODE_RGMII;
if (tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE)
Expand All @@ -1011,7 +1018,10 @@ static int tg3_mdio_init(struct tg3 *tp)
break;
}

tg3_mdio_config(tp);
tp->tg3_flags3 |= TG3_FLG3_MDIOBUS_INITED;

if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785)
tg3_mdio_config_5785(tp);

return 0;
}
Expand Down Expand Up @@ -1351,12 +1361,25 @@ static int tg3_phy_init(struct tg3 *tp)
return PTR_ERR(phydev);
}

tp->tg3_flags3 |= TG3_FLG3_PHY_CONNECTED;

/* Mask with MAC supported features. */
phydev->supported &= (PHY_GBIT_FEATURES |
SUPPORTED_Pause |
SUPPORTED_Asym_Pause);
switch (phydev->interface) {
case PHY_INTERFACE_MODE_GMII:
case PHY_INTERFACE_MODE_RGMII:
phydev->supported &= (PHY_GBIT_FEATURES |
SUPPORTED_Pause |
SUPPORTED_Asym_Pause);
break;
case PHY_INTERFACE_MODE_MII:
phydev->supported &= (PHY_BASIC_FEATURES |
SUPPORTED_Pause |
SUPPORTED_Asym_Pause);
break;
default:
phy_disconnect(tp->mdio_bus->phy_map[PHY_ADDR]);
return -EINVAL;
}

tp->tg3_flags3 |= TG3_FLG3_PHY_CONNECTED;

phydev->advertising = phydev->supported;

Expand Down

0 comments on commit cea0e38

Please sign in to comment.