Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275069
b: refs/heads/master
c: 78f94dc
h: refs/heads/master
i:
  275067: 281d027
v: v3
  • Loading branch information
Matt Carlson authored and David S. Miller committed Nov 4, 2011
1 parent 1fa00cf commit 8d6cb5a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 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: 39b02648d251dbfa27b576d55eeab4cc62228d86
refs/heads/master: 78f94dc7b10d98cf4cf8498d98581500d910c6b7
44 changes: 23 additions & 21 deletions trunk/drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,19 +628,23 @@ static void tg3_ape_lock_init(struct tg3 *tp)
regbase = TG3_APE_PER_LOCK_GRANT;

/* Make sure the driver hasn't any stale locks. */
for (i = 0; i < 8; i++) {
if (i == TG3_APE_LOCK_GPIO)
continue;
tg3_ape_write32(tp, regbase + 4 * i, APE_LOCK_GRANT_DRIVER);
for (i = TG3_APE_LOCK_PHY0; i <= TG3_APE_LOCK_GPIO; i++) {
switch (i) {
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:
if (!tp->pci_fn)
bit = APE_LOCK_GRANT_DRIVER;
else
bit = 1 << tp->pci_fn;
}
tg3_ape_write32(tp, regbase + 4 * i, bit);
}

/* Clear the correct bit of the GPIO lock too. */
if (!tp->pci_fn)
bit = APE_LOCK_GRANT_DRIVER;
else
bit = 1 << tp->pci_fn;

tg3_ape_write32(tp, regbase + 4 * TG3_APE_LOCK_GPIO, bit);
}

static int tg3_ape_lock(struct tg3 *tp, int locknum)
Expand All @@ -658,6 +662,10 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
return 0;
case TG3_APE_LOCK_GRC:
case TG3_APE_LOCK_MEM:
if (!tp->pci_fn)
bit = APE_LOCK_REQ_DRIVER;
else
bit = 1 << tp->pci_fn;
break;
default:
return -EINVAL;
Expand All @@ -673,11 +681,6 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)

off = 4 * locknum;

if (locknum != TG3_APE_LOCK_GPIO || !tp->pci_fn)
bit = APE_LOCK_REQ_DRIVER;
else
bit = 1 << tp->pci_fn;

tg3_ape_write32(tp, req + off, bit);

/* Wait for up to 1 millisecond to acquire lock. */
Expand Down Expand Up @@ -710,6 +713,10 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
return;
case TG3_APE_LOCK_GRC:
case TG3_APE_LOCK_MEM:
if (!tp->pci_fn)
bit = APE_LOCK_GRANT_DRIVER;
else
bit = 1 << tp->pci_fn;
break;
default:
return;
Expand All @@ -720,11 +727,6 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
else
gnt = TG3_APE_PER_LOCK_GRANT;

if (locknum != TG3_APE_LOCK_GPIO || !tp->pci_fn)
bit = APE_LOCK_GRANT_DRIVER;
else
bit = 1 << tp->pci_fn;

tg3_ape_write32(tp, gnt + 4 * locknum, bit);
}

Expand Down
10 changes: 7 additions & 3 deletions trunk/drivers/net/ethernet/broadcom/tg3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2344,9 +2344,13 @@
#define APE_PER_LOCK_GRANT_DRIVER 0x00001000

/* APE convenience enumerations. */
#define TG3_APE_LOCK_GRC 1
#define TG3_APE_LOCK_MEM 4
#define TG3_APE_LOCK_GPIO 7
#define TG3_APE_LOCK_PHY0 0
#define TG3_APE_LOCK_GRC 1
#define TG3_APE_LOCK_PHY1 2
#define TG3_APE_LOCK_PHY2 3
#define TG3_APE_LOCK_MEM 4
#define TG3_APE_LOCK_PHY3 5
#define TG3_APE_LOCK_GPIO 7

#define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10

Expand Down

0 comments on commit 8d6cb5a

Please sign in to comment.