aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2005-04-21 20:11:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-04-21 20:11:21 -0400
commit361b4ac29bc651c7612d4bf21434ae6fe06b78e4 (patch)
treea0d1b0a7f89a7d45c63b269bef5eeacf6f8dc734 /drivers/net/tg3.c
parent3e7d83bc96d59013792e5546e7832668d3adbce7 (diff)
[TG3]: Add nvram detection for 5752
Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index a94631af21cd..dbdd3ecafdc1 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -7096,6 +7096,63 @@ static void __devinit tg3_get_nvram_info(struct tg3 *tp)
7096 } 7096 }
7097} 7097}
7098 7098
7099static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp)
7100{
7101 u32 nvcfg1;
7102
7103 nvcfg1 = tr32(NVRAM_CFG1);
7104
7105 switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) {
7106 case FLASH_5752VENDOR_ATMEL_EEPROM_64KHZ:
7107 case FLASH_5752VENDOR_ATMEL_EEPROM_376KHZ:
7108 tp->nvram_jedecnum = JEDEC_ATMEL;
7109 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
7110 break;
7111 case FLASH_5752VENDOR_ATMEL_FLASH_BUFFERED:
7112 tp->nvram_jedecnum = JEDEC_ATMEL;
7113 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
7114 tp->tg3_flags2 |= TG3_FLG2_FLASH;
7115 break;
7116 case FLASH_5752VENDOR_ST_M45PE10:
7117 case FLASH_5752VENDOR_ST_M45PE20:
7118 case FLASH_5752VENDOR_ST_M45PE40:
7119 tp->nvram_jedecnum = JEDEC_ST;
7120 tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED;
7121 tp->tg3_flags2 |= TG3_FLG2_FLASH;
7122 break;
7123 }
7124
7125 if (tp->tg3_flags2 & TG3_FLG2_FLASH) {
7126 switch (nvcfg1 & NVRAM_CFG1_5752PAGE_SIZE_MASK) {
7127 case FLASH_5752PAGE_SIZE_256:
7128 tp->nvram_pagesize = 256;
7129 break;
7130 case FLASH_5752PAGE_SIZE_512:
7131 tp->nvram_pagesize = 512;
7132 break;
7133 case FLASH_5752PAGE_SIZE_1K:
7134 tp->nvram_pagesize = 1024;
7135 break;
7136 case FLASH_5752PAGE_SIZE_2K:
7137 tp->nvram_pagesize = 2048;
7138 break;
7139 case FLASH_5752PAGE_SIZE_4K:
7140 tp->nvram_pagesize = 4096;
7141 break;
7142 case FLASH_5752PAGE_SIZE_264:
7143 tp->nvram_pagesize = 264;
7144 break;
7145 }
7146 }
7147 else {
7148 /* For eeprom, set pagesize to maximum eeprom size */
7149 tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE;
7150
7151 nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS;
7152 tw32(NVRAM_CFG1, nvcfg1);
7153 }
7154}
7155
7099/* Chips other than 5700/5701 use the NVRAM for fetching info. */ 7156/* Chips other than 5700/5701 use the NVRAM for fetching info. */
7100static void __devinit tg3_nvram_init(struct tg3 *tp) 7157static void __devinit tg3_nvram_init(struct tg3 *tp)
7101{ 7158{
@@ -7128,7 +7185,11 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
7128 tw32(NVRAM_ACCESS, nvaccess | ACCESS_ENABLE); 7185 tw32(NVRAM_ACCESS, nvaccess | ACCESS_ENABLE);
7129 } 7186 }
7130 7187
7131 tg3_get_nvram_info(tp); 7188 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
7189 tg3_get_5752_nvram_info(tp);
7190 else
7191 tg3_get_nvram_info(tp);
7192
7132 tg3_get_nvram_size(tp); 7193 tg3_get_nvram_size(tp);
7133 7194
7134 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { 7195 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) {