diff options
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 154 |
1 files changed, 108 insertions, 46 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f8bb5b737eb8..2de1ab6278d5 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -10853,6 +10853,33 @@ static void __devinit tg3_get_nvram_info(struct tg3 *tp) | |||
10853 | } | 10853 | } |
10854 | } | 10854 | } |
10855 | 10855 | ||
10856 | static void __devinit tg3_nvram_get_pagesize(struct tg3 *tp, u32 nvmcfg1) | ||
10857 | { | ||
10858 | switch (nvmcfg1 & NVRAM_CFG1_5752PAGE_SIZE_MASK) { | ||
10859 | case FLASH_5752PAGE_SIZE_256: | ||
10860 | tp->nvram_pagesize = 256; | ||
10861 | break; | ||
10862 | case FLASH_5752PAGE_SIZE_512: | ||
10863 | tp->nvram_pagesize = 512; | ||
10864 | break; | ||
10865 | case FLASH_5752PAGE_SIZE_1K: | ||
10866 | tp->nvram_pagesize = 1024; | ||
10867 | break; | ||
10868 | case FLASH_5752PAGE_SIZE_2K: | ||
10869 | tp->nvram_pagesize = 2048; | ||
10870 | break; | ||
10871 | case FLASH_5752PAGE_SIZE_4K: | ||
10872 | tp->nvram_pagesize = 4096; | ||
10873 | break; | ||
10874 | case FLASH_5752PAGE_SIZE_264: | ||
10875 | tp->nvram_pagesize = 264; | ||
10876 | break; | ||
10877 | case FLASH_5752PAGE_SIZE_528: | ||
10878 | tp->nvram_pagesize = 528; | ||
10879 | break; | ||
10880 | } | ||
10881 | } | ||
10882 | |||
10856 | static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp) | 10883 | static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp) |
10857 | { | 10884 | { |
10858 | u32 nvcfg1; | 10885 | u32 nvcfg1; |
@@ -10884,26 +10911,7 @@ static void __devinit tg3_get_5752_nvram_info(struct tg3 *tp) | |||
10884 | } | 10911 | } |
10885 | 10912 | ||
10886 | if (tp->tg3_flags2 & TG3_FLG2_FLASH) { | 10913 | if (tp->tg3_flags2 & TG3_FLG2_FLASH) { |
10887 | switch (nvcfg1 & NVRAM_CFG1_5752PAGE_SIZE_MASK) { | 10914 | tg3_nvram_get_pagesize(tp, nvcfg1); |
10888 | case FLASH_5752PAGE_SIZE_256: | ||
10889 | tp->nvram_pagesize = 256; | ||
10890 | break; | ||
10891 | case FLASH_5752PAGE_SIZE_512: | ||
10892 | tp->nvram_pagesize = 512; | ||
10893 | break; | ||
10894 | case FLASH_5752PAGE_SIZE_1K: | ||
10895 | tp->nvram_pagesize = 1024; | ||
10896 | break; | ||
10897 | case FLASH_5752PAGE_SIZE_2K: | ||
10898 | tp->nvram_pagesize = 2048; | ||
10899 | break; | ||
10900 | case FLASH_5752PAGE_SIZE_4K: | ||
10901 | tp->nvram_pagesize = 4096; | ||
10902 | break; | ||
10903 | case FLASH_5752PAGE_SIZE_264: | ||
10904 | tp->nvram_pagesize = 264; | ||
10905 | break; | ||
10906 | } | ||
10907 | } else { | 10915 | } else { |
10908 | /* For eeprom, set pagesize to maximum eeprom size */ | 10916 | /* For eeprom, set pagesize to maximum eeprom size */ |
10909 | tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE; | 10917 | tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE; |
@@ -11156,34 +11164,84 @@ static void __devinit tg3_get_57780_nvram_info(struct tg3 *tp) | |||
11156 | return; | 11164 | return; |
11157 | } | 11165 | } |
11158 | 11166 | ||
11159 | switch (nvcfg1 & NVRAM_CFG1_5752PAGE_SIZE_MASK) { | 11167 | tg3_nvram_get_pagesize(tp, nvcfg1); |
11160 | case FLASH_5752PAGE_SIZE_256: | 11168 | if (tp->nvram_pagesize != 264 && tp->nvram_pagesize != 528) |
11161 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; | 11169 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; |
11162 | tp->nvram_pagesize = 256; | 11170 | } |
11163 | break; | 11171 | |
11164 | case FLASH_5752PAGE_SIZE_512: | 11172 | |
11165 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; | 11173 | static void __devinit tg3_get_5717_nvram_info(struct tg3 *tp) |
11166 | tp->nvram_pagesize = 512; | 11174 | { |
11167 | break; | 11175 | u32 nvcfg1; |
11168 | case FLASH_5752PAGE_SIZE_1K: | 11176 | |
11169 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; | 11177 | nvcfg1 = tr32(NVRAM_CFG1); |
11170 | tp->nvram_pagesize = 1024; | 11178 | |
11171 | break; | 11179 | switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) { |
11172 | case FLASH_5752PAGE_SIZE_2K: | 11180 | case FLASH_5717VENDOR_ATMEL_EEPROM: |
11173 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; | 11181 | case FLASH_5717VENDOR_MICRO_EEPROM: |
11174 | tp->nvram_pagesize = 2048; | 11182 | tp->nvram_jedecnum = JEDEC_ATMEL; |
11175 | break; | 11183 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; |
11176 | case FLASH_5752PAGE_SIZE_4K: | 11184 | tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE; |
11177 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; | 11185 | |
11178 | tp->nvram_pagesize = 4096; | 11186 | nvcfg1 &= ~NVRAM_CFG1_COMPAT_BYPASS; |
11179 | break; | 11187 | tw32(NVRAM_CFG1, nvcfg1); |
11180 | case FLASH_5752PAGE_SIZE_264: | 11188 | return; |
11181 | tp->nvram_pagesize = 264; | 11189 | case FLASH_5717VENDOR_ATMEL_MDB011D: |
11190 | case FLASH_5717VENDOR_ATMEL_ADB011B: | ||
11191 | case FLASH_5717VENDOR_ATMEL_ADB011D: | ||
11192 | case FLASH_5717VENDOR_ATMEL_MDB021D: | ||
11193 | case FLASH_5717VENDOR_ATMEL_ADB021B: | ||
11194 | case FLASH_5717VENDOR_ATMEL_ADB021D: | ||
11195 | case FLASH_5717VENDOR_ATMEL_45USPT: | ||
11196 | tp->nvram_jedecnum = JEDEC_ATMEL; | ||
11197 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; | ||
11198 | tp->tg3_flags2 |= TG3_FLG2_FLASH; | ||
11199 | |||
11200 | switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) { | ||
11201 | case FLASH_5717VENDOR_ATMEL_MDB021D: | ||
11202 | case FLASH_5717VENDOR_ATMEL_ADB021B: | ||
11203 | case FLASH_5717VENDOR_ATMEL_ADB021D: | ||
11204 | tp->nvram_size = TG3_NVRAM_SIZE_256KB; | ||
11205 | break; | ||
11206 | default: | ||
11207 | tp->nvram_size = TG3_NVRAM_SIZE_128KB; | ||
11208 | break; | ||
11209 | } | ||
11182 | break; | 11210 | break; |
11183 | case FLASH_5752PAGE_SIZE_528: | 11211 | case FLASH_5717VENDOR_ST_M_M25PE10: |
11184 | tp->nvram_pagesize = 528; | 11212 | case FLASH_5717VENDOR_ST_A_M25PE10: |
11213 | case FLASH_5717VENDOR_ST_M_M45PE10: | ||
11214 | case FLASH_5717VENDOR_ST_A_M45PE10: | ||
11215 | case FLASH_5717VENDOR_ST_M_M25PE20: | ||
11216 | case FLASH_5717VENDOR_ST_A_M25PE20: | ||
11217 | case FLASH_5717VENDOR_ST_M_M45PE20: | ||
11218 | case FLASH_5717VENDOR_ST_A_M45PE20: | ||
11219 | case FLASH_5717VENDOR_ST_25USPT: | ||
11220 | case FLASH_5717VENDOR_ST_45USPT: | ||
11221 | tp->nvram_jedecnum = JEDEC_ST; | ||
11222 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; | ||
11223 | tp->tg3_flags2 |= TG3_FLG2_FLASH; | ||
11224 | |||
11225 | switch (nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK) { | ||
11226 | case FLASH_5717VENDOR_ST_M_M25PE20: | ||
11227 | case FLASH_5717VENDOR_ST_A_M25PE20: | ||
11228 | case FLASH_5717VENDOR_ST_M_M45PE20: | ||
11229 | case FLASH_5717VENDOR_ST_A_M45PE20: | ||
11230 | tp->nvram_size = TG3_NVRAM_SIZE_256KB; | ||
11231 | break; | ||
11232 | default: | ||
11233 | tp->nvram_size = TG3_NVRAM_SIZE_128KB; | ||
11234 | break; | ||
11235 | } | ||
11185 | break; | 11236 | break; |
11237 | default: | ||
11238 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM; | ||
11239 | return; | ||
11186 | } | 11240 | } |
11241 | |||
11242 | tg3_nvram_get_pagesize(tp, nvcfg1); | ||
11243 | if (tp->nvram_pagesize != 264 && tp->nvram_pagesize != 528) | ||
11244 | tp->tg3_flags3 |= TG3_FLG3_NO_NVRAM_ADDR_TRANS; | ||
11187 | } | 11245 | } |
11188 | 11246 | ||
11189 | /* Chips other than 5700/5701 use the NVRAM for fetching info. */ | 11247 | /* Chips other than 5700/5701 use the NVRAM for fetching info. */ |
@@ -11228,6 +11286,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) | |||
11228 | tg3_get_5906_nvram_info(tp); | 11286 | tg3_get_5906_nvram_info(tp); |
11229 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) | 11287 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) |
11230 | tg3_get_57780_nvram_info(tp); | 11288 | tg3_get_57780_nvram_info(tp); |
11289 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) | ||
11290 | tg3_get_5717_nvram_info(tp); | ||
11231 | else | 11291 | else |
11232 | tg3_get_nvram_info(tp); | 11292 | tg3_get_nvram_info(tp); |
11233 | 11293 | ||
@@ -13074,8 +13134,10 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
13074 | tw32_f(NVRAM_CMD, NVRAM_CMD_RESET); | 13134 | tw32_f(NVRAM_CMD, NVRAM_CMD_RESET); |
13075 | else | 13135 | else |
13076 | tg3_nvram_unlock(tp); | 13136 | tg3_nvram_unlock(tp); |
13077 | } | 13137 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { |
13078 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 13138 | if (tr32(TG3_CPMU_STATUS) & TG3_CPMU_STATUS_PCIE_FUNC) |
13139 | mac_offset = 0xcc; | ||
13140 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | ||
13079 | mac_offset = 0x10; | 13141 | mac_offset = 0x10; |
13080 | 13142 | ||
13081 | /* First try to get it from MAC address mailbox. */ | 13143 | /* First try to get it from MAC address mailbox. */ |