diff options
Diffstat (limited to 'drivers/net/cxgb3/t3_hw.c')
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index eaa7a2e89a30..d83f075ef2d7 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -438,23 +438,23 @@ static const struct adapter_info t3_adap_info[] = { | |||
438 | {2, 0, 0, 0, | 438 | {2, 0, 0, 0, |
439 | F_GPIO2_OEN | F_GPIO4_OEN | | 439 | F_GPIO2_OEN | F_GPIO4_OEN | |
440 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, | 440 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, |
441 | SUPPORTED_OFFLOAD, | 441 | 0, |
442 | &mi1_mdio_ops, "Chelsio PE9000"}, | 442 | &mi1_mdio_ops, "Chelsio PE9000"}, |
443 | {2, 0, 0, 0, | 443 | {2, 0, 0, 0, |
444 | F_GPIO2_OEN | F_GPIO4_OEN | | 444 | F_GPIO2_OEN | F_GPIO4_OEN | |
445 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, | 445 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, |
446 | SUPPORTED_OFFLOAD, | 446 | 0, |
447 | &mi1_mdio_ops, "Chelsio T302"}, | 447 | &mi1_mdio_ops, "Chelsio T302"}, |
448 | {1, 0, 0, 0, | 448 | {1, 0, 0, 0, |
449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | | 449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | |
450 | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, | 450 | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, |
451 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, | 451 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
452 | &mi1_mdio_ext_ops, "Chelsio T310"}, | 452 | &mi1_mdio_ext_ops, "Chelsio T310"}, |
453 | {2, 0, 0, 0, | 453 | {2, 0, 0, 0, |
454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | | 454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | |
455 | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | | 455 | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | |
456 | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, | 456 | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, |
457 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, | 457 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
458 | &mi1_mdio_ext_ops, "Chelsio T320"}, | 458 | &mi1_mdio_ext_ops, "Chelsio T320"}, |
459 | }; | 459 | }; |
460 | 460 | ||
@@ -681,7 +681,8 @@ enum { | |||
681 | SF_ERASE_SECTOR = 0xd8, /* erase sector */ | 681 | SF_ERASE_SECTOR = 0xd8, /* erase sector */ |
682 | 682 | ||
683 | FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */ | 683 | FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */ |
684 | FW_VERS_ADDR = 0x77ffc /* flash address holding FW version */ | 684 | FW_VERS_ADDR = 0x77ffc, /* flash address holding FW version */ |
685 | FW_MIN_SIZE = 8 /* at least version and csum */ | ||
685 | }; | 686 | }; |
686 | 687 | ||
687 | /** | 688 | /** |
@@ -935,7 +936,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size) | |||
935 | const u32 *p = (const u32 *)fw_data; | 936 | const u32 *p = (const u32 *)fw_data; |
936 | int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; | 937 | int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; |
937 | 938 | ||
938 | if (size & 3) | 939 | if ((size & 3) || size < FW_MIN_SIZE) |
939 | return -EINVAL; | 940 | return -EINVAL; |
940 | if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR) | 941 | if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR) |
941 | return -EFBIG; | 942 | return -EFBIG; |
@@ -2899,6 +2900,9 @@ static int mc7_init(struct mc7 *mc7, unsigned int mc7_clock, int mem_type) | |||
2899 | struct adapter *adapter = mc7->adapter; | 2900 | struct adapter *adapter = mc7->adapter; |
2900 | const struct mc7_timing_params *p = &mc7_timings[mem_type]; | 2901 | const struct mc7_timing_params *p = &mc7_timings[mem_type]; |
2901 | 2902 | ||
2903 | if (!mc7->size) | ||
2904 | return 0; | ||
2905 | |||
2902 | val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); | 2906 | val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); |
2903 | slow = val & F_SLOW; | 2907 | slow = val & F_SLOW; |
2904 | width = G_WIDTH(val); | 2908 | width = G_WIDTH(val); |
@@ -3099,8 +3103,10 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params) | |||
3099 | do { /* wait for uP to initialize */ | 3103 | do { /* wait for uP to initialize */ |
3100 | msleep(20); | 3104 | msleep(20); |
3101 | } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts); | 3105 | } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts); |
3102 | if (!attempts) | 3106 | if (!attempts) { |
3107 | CH_ERR(adapter, "uP initialization timed out\n"); | ||
3103 | goto out_err; | 3108 | goto out_err; |
3109 | } | ||
3104 | 3110 | ||
3105 | err = 0; | 3111 | err = 0; |
3106 | out_err: | 3112 | out_err: |
@@ -3200,7 +3206,7 @@ static void __devinit mc7_prep(struct adapter *adapter, struct mc7 *mc7, | |||
3200 | mc7->name = name; | 3206 | mc7->name = name; |
3201 | mc7->offset = base_addr - MC7_PMRX_BASE_ADDR; | 3207 | mc7->offset = base_addr - MC7_PMRX_BASE_ADDR; |
3202 | cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); | 3208 | cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); |
3203 | mc7->size = mc7_calc_size(cfg); | 3209 | mc7->size = mc7->size = G_DEN(cfg) == M_DEN ? 0 : mc7_calc_size(cfg); |
3204 | mc7->width = G_WIDTH(cfg); | 3210 | mc7->width = G_WIDTH(cfg); |
3205 | } | 3211 | } |
3206 | 3212 | ||
@@ -3227,6 +3233,7 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai) | |||
3227 | V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1)); | 3233 | V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1)); |
3228 | t3_write_reg(adapter, A_T3DBG_GPIO_EN, | 3234 | t3_write_reg(adapter, A_T3DBG_GPIO_EN, |
3229 | ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL); | 3235 | ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL); |
3236 | t3_write_reg(adapter, A_MC5_DB_SERVER_INDEX, 0); | ||
3230 | 3237 | ||
3231 | if (adapter->params.rev == 0 || !uses_xaui(adapter)) | 3238 | if (adapter->params.rev == 0 || !uses_xaui(adapter)) |
3232 | val |= F_ENRGMII; | 3239 | val |= F_ENRGMII; |
@@ -3243,15 +3250,17 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai) | |||
3243 | } | 3250 | } |
3244 | 3251 | ||
3245 | /* | 3252 | /* |
3246 | * Reset the adapter. PCIe cards lose their config space during reset, PCI-X | 3253 | * Reset the adapter. |
3254 | * Older PCIe cards lose their config space during reset, PCI-X | ||
3247 | * ones don't. | 3255 | * ones don't. |
3248 | */ | 3256 | */ |
3249 | int t3_reset_adapter(struct adapter *adapter) | 3257 | int t3_reset_adapter(struct adapter *adapter) |
3250 | { | 3258 | { |
3251 | int i; | 3259 | int i, save_and_restore_pcie = |
3260 | adapter->params.rev < T3_REV_B2 && is_pcie(adapter); | ||
3252 | uint16_t devid = 0; | 3261 | uint16_t devid = 0; |
3253 | 3262 | ||
3254 | if (is_pcie(adapter)) | 3263 | if (save_and_restore_pcie) |
3255 | pci_save_state(adapter->pdev); | 3264 | pci_save_state(adapter->pdev); |
3256 | t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE); | 3265 | t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE); |
3257 | 3266 | ||
@@ -3269,7 +3278,7 @@ int t3_reset_adapter(struct adapter *adapter) | |||
3269 | if (devid != 0x1425) | 3278 | if (devid != 0x1425) |
3270 | return -1; | 3279 | return -1; |
3271 | 3280 | ||
3272 | if (is_pcie(adapter)) | 3281 | if (save_and_restore_pcie) |
3273 | pci_restore_state(adapter->pdev); | 3282 | pci_restore_state(adapter->pdev); |
3274 | return 0; | 3283 | return 0; |
3275 | } | 3284 | } |
@@ -3323,7 +3332,13 @@ int __devinit t3_prep_adapter(struct adapter *adapter, | |||
3323 | p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size); | 3332 | p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size); |
3324 | p->ntimer_qs = p->cm_size >= (128 << 20) || | 3333 | p->ntimer_qs = p->cm_size >= (128 << 20) || |
3325 | adapter->params.rev > 0 ? 12 : 6; | 3334 | adapter->params.rev > 0 ? 12 : 6; |
3335 | } | ||
3336 | |||
3337 | adapter->params.offload = t3_mc7_size(&adapter->pmrx) && | ||
3338 | t3_mc7_size(&adapter->pmtx) && | ||
3339 | t3_mc7_size(&adapter->cm); | ||
3326 | 3340 | ||
3341 | if (is_offload(adapter)) { | ||
3327 | adapter->params.mc5.nservers = DEFAULT_NSERVERS; | 3342 | adapter->params.mc5.nservers = DEFAULT_NSERVERS; |
3328 | adapter->params.mc5.nfilters = adapter->params.rev > 0 ? | 3343 | adapter->params.mc5.nfilters = adapter->params.rev > 0 ? |
3329 | DEFAULT_NFILTERS : 0; | 3344 | DEFAULT_NFILTERS : 0; |