aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b8141be56d74..c01bd861ac5e 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -9286,7 +9286,7 @@ static void __devinit tg3_get_nvram_size(struct tg3 *tp)
9286 return; 9286 return;
9287 } 9287 }
9288 } 9288 }
9289 tp->nvram_size = 0x20000; 9289 tp->nvram_size = 0x80000;
9290} 9290}
9291 9291
9292static void __devinit tg3_get_nvram_info(struct tg3 *tp) 9292static void __devinit tg3_get_nvram_info(struct tg3 *tp)
@@ -9405,33 +9405,31 @@ static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp)
9405 9405
9406static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp) 9406static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp)
9407{ 9407{
9408 u32 nvcfg1; 9408 u32 nvcfg1, protect = 0;
9409 9409
9410 nvcfg1 = tr32(NVRAM_CFG1); 9410 nvcfg1 = tr32(NVRAM_CFG1);
9411 9411
9412 /* NVRAM protection for TPM */ 9412 /* NVRAM protection for TPM */
9413 if (nvcfg1 & (1 << 27)) 9413 if (nvcfg1 & (1 << 27)) {
9414 tp->tg3_flags2 |= TG3_FLG2_PROTECTED_NVRAM; 9414 tp->tg3_flags2 |= TG3_FLG2_PROTECTED_NVRAM;
9415 protect = 1;
9416 }
9415 9417
9416 switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) { 9418 nvcfg1 &= NVRAM_CFG1_5752VENDOR_MASK;
9417 case FLASH_5755VENDOR_ATMEL_EEPROM_64KHZ: 9419 switch (nvcfg1) {
9418 case FLASH_5755VENDOR_ATMEL_EEPROM_376KHZ:
9419 tp->nvram_jedecnum = JEDEC_ATMEL;
9420 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
9421 tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE;
9422
9423 nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS;
9424 tw32(NVRAM_CFG1, nvcfg1);
9425 break;
9426 case FLASH_5752VENDOR_ATMEL_FLASH_BUFFERED:
9427 case FLASH_5755VENDOR_ATMEL_FLASH_1: 9420 case FLASH_5755VENDOR_ATMEL_FLASH_1:
9428 case FLASH_5755VENDOR_ATMEL_FLASH_2: 9421 case FLASH_5755VENDOR_ATMEL_FLASH_2:
9429 case FLASH_5755VENDOR_ATMEL_FLASH_3: 9422 case FLASH_5755VENDOR_ATMEL_FLASH_3:
9430 case FLASH_5755VENDOR_ATMEL_FLASH_4:
9431 tp->nvram_jedecnum = JEDEC_ATMEL; 9423 tp->nvram_jedecnum = JEDEC_ATMEL;
9432 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; 9424 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
9433 tp->tg3_flags2 |= TG3_FLG2_FLASH; 9425 tp->tg3_flags2 |= TG3_FLG2_FLASH;
9434 tp->nvram_pagesize = 264; 9426 tp->nvram_pagesize = 264;
9427 if (nvcfg1 == FLASH_5755VENDOR_ATMEL_FLASH_1)
9428 tp->nvram_size = (protect ? 0x3e200 : 0x80000);
9429 else if (nvcfg1 == FLASH_5755VENDOR_ATMEL_FLASH_2)
9430 tp->nvram_size = (protect ? 0x1f200 : 0x40000);
9431 else
9432 tp->nvram_size = (protect ? 0x1f200 : 0x20000);
9435 break; 9433 break;
9436 case FLASH_5752VENDOR_ST_M45PE10: 9434 case FLASH_5752VENDOR_ST_M45PE10:
9437 case FLASH_5752VENDOR_ST_M45PE20: 9435 case FLASH_5752VENDOR_ST_M45PE20:
@@ -9440,6 +9438,12 @@ static void __devinit tg3_get_5755_nvram_info(struct tg3 *tp)
9440 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; 9438 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
9441 tp->tg3_flags2 |= TG3_FLG2_FLASH; 9439 tp->tg3_flags2 |= TG3_FLG2_FLASH;
9442 tp->nvram_pagesize = 256; 9440 tp->nvram_pagesize = 256;
9441 if (nvcfg1 == FLASH_5752VENDOR_ST_M45PE10)
9442 tp->nvram_size = (protect ? 0x10000 : 0x20000);
9443 else if (nvcfg1 == FLASH_5752VENDOR_ST_M45PE20)
9444 tp->nvram_size = (protect ? 0x10000 : 0x40000);
9445 else
9446 tp->nvram_size = (protect ? 0x20000 : 0x80000);
9443 break; 9447 break;
9444 } 9448 }
9445} 9449}
@@ -9515,6 +9519,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
9515 } 9519 }
9516 tg3_enable_nvram_access(tp); 9520 tg3_enable_nvram_access(tp);
9517 9521
9522 tp->nvram_size = 0;
9523
9518 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) 9524 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
9519 tg3_get_5752_nvram_info(tp); 9525 tg3_get_5752_nvram_info(tp);
9520 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) 9526 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
@@ -9526,7 +9532,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
9526 else 9532 else
9527 tg3_get_nvram_info(tp); 9533 tg3_get_nvram_info(tp);
9528 9534
9529 tg3_get_nvram_size(tp); 9535 if (tp->nvram_size == 0)
9536 tg3_get_nvram_size(tp);
9530 9537
9531 tg3_disable_nvram_access(tp); 9538 tg3_disable_nvram_access(tp);
9532 tg3_nvram_unlock(tp); 9539 tg3_nvram_unlock(tp);