Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43191
b: refs/heads/master
c: 3600d91
h: refs/heads/master
i:
  43189: 024fe3d
  43187: 2aa37fb
  43183: dbc934d
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Dec 7, 2006
1 parent 023af73 commit 6721553
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 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: 9d26e213423923c9e033ccd373705118131827c9
refs/heads/master: 3600d918d870456ea8e7bb9d47f327de5c20f3d6
39 changes: 24 additions & 15 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,12 +1558,6 @@ static void tg3_phy_copper_begin(struct tg3 *tp)

tg3_writephy(tp, MII_ADVERTISE, new_adv);
} else if (tp->link_config.speed == SPEED_INVALID) {
tp->link_config.advertising =
(ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full |
ADVERTISED_Autoneg | ADVERTISED_MII);

if (tp->tg3_flags & TG3_FLAG_10_100_ONLY)
tp->link_config.advertising &=
~(ADVERTISED_1000baseT_Half |
Expand Down Expand Up @@ -1707,25 +1701,36 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp)
return err;
}

static int tg3_copper_is_advertising_all(struct tg3 *tp)
static int tg3_copper_is_advertising_all(struct tg3 *tp, u32 mask)
{
u32 adv_reg, all_mask;
u32 adv_reg, all_mask = 0;

if (mask & ADVERTISED_10baseT_Half)
all_mask |= ADVERTISE_10HALF;
if (mask & ADVERTISED_10baseT_Full)
all_mask |= ADVERTISE_10FULL;
if (mask & ADVERTISED_100baseT_Half)
all_mask |= ADVERTISE_100HALF;
if (mask & ADVERTISED_100baseT_Full)
all_mask |= ADVERTISE_100FULL;

if (tg3_readphy(tp, MII_ADVERTISE, &adv_reg))
return 0;

all_mask = (ADVERTISE_10HALF | ADVERTISE_10FULL |
ADVERTISE_100HALF | ADVERTISE_100FULL);
if ((adv_reg & all_mask) != all_mask)
return 0;
if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY)) {
u32 tg3_ctrl;

all_mask = 0;
if (mask & ADVERTISED_1000baseT_Half)
all_mask |= ADVERTISE_1000HALF;
if (mask & ADVERTISED_1000baseT_Full)
all_mask |= ADVERTISE_1000FULL;

if (tg3_readphy(tp, MII_TG3_CTRL, &tg3_ctrl))
return 0;

all_mask = (MII_TG3_CTRL_ADV_1000_HALF |
MII_TG3_CTRL_ADV_1000_FULL);
if ((tg3_ctrl & all_mask) != all_mask)
return 0;
}
Expand Down Expand Up @@ -1885,7 +1890,8 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
/* Force autoneg restart if we are exiting
* low power mode.
*/
if (!tg3_copper_is_advertising_all(tp))
if (!tg3_copper_is_advertising_all(tp,
tp->link_config.advertising))
current_link_up = 0;
} else {
current_link_up = 0;
Expand Down Expand Up @@ -10156,7 +10162,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)

if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) &&
!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
u32 bmsr, adv_reg, tg3_ctrl;
u32 bmsr, adv_reg, tg3_ctrl, mask;

tg3_readphy(tp, MII_BMSR, &bmsr);
if (!tg3_readphy(tp, MII_BMSR, &bmsr) &&
Expand All @@ -10180,7 +10186,10 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
MII_TG3_CTRL_ENABLE_AS_MASTER);
}

if (!tg3_copper_is_advertising_all(tp)) {
mask = (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full);
if (!tg3_copper_is_advertising_all(tp, mask)) {
tg3_writephy(tp, MII_ADVERTISE, adv_reg);

if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY))
Expand Down

0 comments on commit 6721553

Please sign in to comment.