Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143919
b: refs/heads/master
c: 62cedd1
h: refs/heads/master
i:
  143917: 09bcddb
  143915: be0552e
  143911: 3c7eeb1
  143903: 0b18f4b
v: v3
  • Loading branch information
Matt Carlson authored and David S. Miller committed Apr 20, 2009
1 parent 6ea7c58 commit 1a3f7f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 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: c40af84a6726f63e35740d26f841992e8f31f92c
refs/heads/master: 62cedd11f63c99efd2962fb69763a09e2778f6e6
26 changes: 17 additions & 9 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2190,7 +2190,14 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp,
if (!(tmp & EEPROM_ADDR_COMPLETE))
return -EBUSY;

*val = tr32(GRC_EEPROM_DATA);
tmp = tr32(GRC_EEPROM_DATA);

/*
* The data will always be opposite the native endian
* format. Perform a blind byteswap to compensate.
*/
*val = swab32(tmp);

return 0;
}

Expand Down Expand Up @@ -10663,7 +10670,13 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp,

memcpy(&data, buf + i, 4);

tw32(GRC_EEPROM_DATA, be32_to_cpu(data));
/*
* The SEEPROM interface expects the data to always be opposite
* the native endian format. We accomplish this by reversing
* all the operations that would have been performed on the
* data from a call to tg3_nvram_read_be32().
*/
tw32(GRC_EEPROM_DATA, swab32(be32_to_cpu(data)));

val = tr32(GRC_EEPROM_ADDR);
tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE);
Expand Down Expand Up @@ -12443,13 +12456,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
/* Next, try NVRAM. */
if (!tg3_nvram_read_be32(tp, mac_offset + 0, &hi) &&
!tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) {
dev->dev_addr[0] = ((hi >> 16) & 0xff);
dev->dev_addr[1] = ((hi >> 24) & 0xff);
dev->dev_addr[2] = ((lo >> 0) & 0xff);
dev->dev_addr[3] = ((lo >> 8) & 0xff);
dev->dev_addr[4] = ((lo >> 16) & 0xff);
dev->dev_addr[5] = ((lo >> 24) & 0xff);

memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2);
memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo));
}
/* Finally just fetch it out of the MAC control regs. */
else {
Expand Down

0 comments on commit 1a3f7f7

Please sign in to comment.