aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-04-20 02:57:14 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-21 04:41:00 -0400
commitdf259d8cba7d7880dc04d34c7a6e0ce15fbc9644 (patch)
tree21382c9803303c424e9a87d552754960f6b5706e /drivers/net
parent624f8e5082efd0348ccf7e3d3f4bfc41efead26c (diff)
tg3: Handle NVRAM absent cases
Some 57780 ASIC revision parts do not have NVRAM. Code the driver so that it is tolerant of this configuration. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/tg3.c36
-rw-r--r--drivers/net/tg3.h1
2 files changed, 33 insertions, 4 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index e4fa02c7927..9b04954b694 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8544,6 +8544,9 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8544 u32 i, offset, len, b_offset, b_count; 8544 u32 i, offset, len, b_offset, b_count;
8545 __be32 val; 8545 __be32 val;
8546 8546
8547 if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM)
8548 return -EINVAL;
8549
8547 if (tp->link_config.phy_is_low_power) 8550 if (tp->link_config.phy_is_low_power)
8548 return -EAGAIN; 8551 return -EAGAIN;
8549 8552
@@ -8609,7 +8612,8 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8609 if (tp->link_config.phy_is_low_power) 8612 if (tp->link_config.phy_is_low_power)
8610 return -EAGAIN; 8613 return -EAGAIN;
8611 8614
8612 if (eeprom->magic != TG3_EEPROM_MAGIC) 8615 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
8616 eeprom->magic != TG3_EEPROM_MAGIC)
8613 return -EINVAL; 8617 return -EINVAL;
8614 8618
8615 offset = eeprom->offset; 8619 offset = eeprom->offset;
@@ -9206,6 +9210,9 @@ static int tg3_test_nvram(struct tg3 *tp)
9206 __be32 *buf; 9210 __be32 *buf;
9207 int i, j, k, err = 0, size; 9211 int i, j, k, err = 0, size;
9208 9212
9213 if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM)
9214 return 0;
9215
9209 if (tg3_nvram_read(tp, 0, &magic) != 0) 9216 if (tg3_nvram_read(tp, 0, &magic) != 0)
9210 return -EIO; 9217 return -EIO;
9211 9218
@@ -10188,7 +10195,8 @@ static void __devinit tg3_get_nvram_size(struct tg3 *tp)
10188{ 10195{
10189 u32 val; 10196 u32 val;
10190 10197
10191 if (tg3_nvram_read(tp, 0, &val) != 0) 10198 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
10199 tg3_nvram_read(tp, 0, &val) != 0)
10192 return; 10200 return;
10193 10201
10194 /* Selfboot format */ 10202 /* Selfboot format */
@@ -10570,6 +10578,7 @@ static void __devinit tg3_get_57780_nvram_info(struct tg3 *tp)
10570 } 10578 }
10571 break; 10579 break;
10572 default: 10580 default:
10581 tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM;
10573 return; 10582 return;
10574 } 10583 }
10575 10584
@@ -11370,7 +11379,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
11370 unsigned int i; 11379 unsigned int i;
11371 u32 magic; 11380 u32 magic;
11372 11381
11373 if (tg3_nvram_read(tp, 0x0, &magic)) 11382 if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
11383 tg3_nvram_read(tp, 0x0, &magic))
11374 goto out_not_found; 11384 goto out_not_found;
11375 11385
11376 if (magic == TG3_EEPROM_MAGIC) { 11386 if (magic == TG3_EEPROM_MAGIC) {
@@ -11462,6 +11472,15 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
11462out_not_found: 11472out_not_found:
11463 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) 11473 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
11464 strcpy(tp->board_part_number, "BCM95906"); 11474 strcpy(tp->board_part_number, "BCM95906");
11475 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 &&
11476 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57780)
11477 strcpy(tp->board_part_number, "BCM57780");
11478 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 &&
11479 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57760)
11480 strcpy(tp->board_part_number, "BCM57760");
11481 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 &&
11482 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57790)
11483 strcpy(tp->board_part_number, "BCM57790");
11465 else 11484 else
11466 strcpy(tp->board_part_number, "none"); 11485 strcpy(tp->board_part_number, "none");
11467} 11486}
@@ -11672,6 +11691,14 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
11672{ 11691{
11673 u32 val; 11692 u32 val;
11674 11693
11694 if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) {
11695 tp->fw_ver[0] = 's';
11696 tp->fw_ver[1] = 'b';
11697 tp->fw_ver[2] = '\0';
11698
11699 return;
11700 }
11701
11675 if (tg3_nvram_read(tp, 0, &val)) 11702 if (tg3_nvram_read(tp, 0, &val))
11676 return; 11703 return;
11677 11704
@@ -12459,7 +12486,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
12459 } 12486 }
12460 if (!addr_ok) { 12487 if (!addr_ok) {
12461 /* Next, try NVRAM. */ 12488 /* Next, try NVRAM. */
12462 if (!tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && 12489 if (!(tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) &&
12490 !tg3_nvram_read_be32(tp, mac_offset + 0, &hi) &&
12463 !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { 12491 !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) {
12464 memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2); 12492 memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2);
12465 memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo)); 12493 memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo));
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index ca71a49a3fd..afbabf283c5 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2636,6 +2636,7 @@ struct tg3 {
2636#define TG3_FLG3_CLKREQ_BUG 0x00000800 2636#define TG3_FLG3_CLKREQ_BUG 0x00000800
2637#define TG3_FLG3_PHY_ENABLE_APD 0x00001000 2637#define TG3_FLG3_PHY_ENABLE_APD 0x00001000
2638#define TG3_FLG3_5755_PLUS 0x00002000 2638#define TG3_FLG3_5755_PLUS 0x00002000
2639#define TG3_FLG3_NO_NVRAM 0x00004000
2639 2640
2640 struct timer_list timer; 2641 struct timer_list timer;
2641 u16 timer_counter; 2642 u16 timer_counter;