Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320515
b: refs/heads/master
c: 8151ad5
h: refs/heads/master
i:
  320513: 4f9fbe1
  320511: b066fb5
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Jul 30, 2012
1 parent 981dfa9 commit 420ff44
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8253947e2cdfb14717c9212b751b7aec9ea9ef5e
refs/heads/master: 8151ad576d34a5ec1f1068edf25f3b7c47f6edab
37 changes: 37 additions & 0 deletions trunk/drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,12 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
else
bit = 1 << tp->pci_fn;
break;
case TG3_APE_LOCK_PHY0:
case TG3_APE_LOCK_PHY1:
case TG3_APE_LOCK_PHY2:
case TG3_APE_LOCK_PHY3:
bit = APE_LOCK_REQ_DRIVER;
break;
default:
return -EINVAL;
}
Expand Down Expand Up @@ -723,6 +729,12 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
else
bit = 1 << tp->pci_fn;
break;
case TG3_APE_LOCK_PHY0:
case TG3_APE_LOCK_PHY1:
case TG3_APE_LOCK_PHY2:
case TG3_APE_LOCK_PHY3:
bit = APE_LOCK_GRANT_DRIVER;
break;
default:
return;
}
Expand Down Expand Up @@ -1052,6 +1064,8 @@ static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
udelay(80);
}

tg3_ape_lock(tp, tp->phy_ape_lock);

*val = 0x0;

frame_val = ((tp->phy_addr << MI_COM_PHY_ADDR_SHIFT) &
Expand Down Expand Up @@ -1086,6 +1100,8 @@ static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
udelay(80);
}

tg3_ape_unlock(tp, tp->phy_ape_lock);

return ret;
}

Expand All @@ -1105,6 +1121,8 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
udelay(80);
}

tg3_ape_lock(tp, tp->phy_ape_lock);

frame_val = ((tp->phy_addr << MI_COM_PHY_ADDR_SHIFT) &
MI_COM_PHY_ADDR_MASK);
frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
Expand Down Expand Up @@ -1135,6 +1153,8 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
udelay(80);
}

tg3_ape_unlock(tp, tp->phy_ape_lock);

return ret;
}

Expand Down Expand Up @@ -13648,6 +13668,23 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
tg3_flag_set(tp, PAUSE_AUTONEG);
tp->link_config.flowctrl = FLOW_CTRL_TX | FLOW_CTRL_RX;

if (tg3_flag(tp, ENABLE_APE)) {
switch (tp->pci_fn) {
case 0:
tp->phy_ape_lock = TG3_APE_LOCK_PHY0;
break;
case 1:
tp->phy_ape_lock = TG3_APE_LOCK_PHY1;
break;
case 2:
tp->phy_ape_lock = TG3_APE_LOCK_PHY2;
break;
case 3:
tp->phy_ape_lock = TG3_APE_LOCK_PHY3;
break;
}
}

if (tg3_flag(tp, USE_PHYLIB))
return tg3_phy_init(tp);

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/ethernet/broadcom/tg3.h
Original file line number Diff line number Diff line change
Expand Up @@ -3107,6 +3107,7 @@ struct tg3 {
int old_link;

u8 phy_addr;
u8 phy_ape_lock;

/* PHY info */
u32 phy_id;
Expand Down

0 comments on commit 420ff44

Please sign in to comment.