0001
0002
0003
0004 #include <linux/pci.h>
0005 #include <linux/delay.h>
0006 #include <linux/sched.h>
0007
0008 #include "ixgbe.h"
0009 #include "ixgbe_phy.h"
0010 #include "ixgbe_x540.h"
0011
0012 #define IXGBE_X540_MAX_TX_QUEUES 128
0013 #define IXGBE_X540_MAX_RX_QUEUES 128
0014 #define IXGBE_X540_RAR_ENTRIES 128
0015 #define IXGBE_X540_MC_TBL_SIZE 128
0016 #define IXGBE_X540_VFT_TBL_SIZE 128
0017 #define IXGBE_X540_RX_PB_SIZE 384
0018
0019 static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw);
0020 static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw);
0021 static s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw);
0022 static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw);
0023
0024 enum ixgbe_media_type ixgbe_get_media_type_X540(struct ixgbe_hw *hw)
0025 {
0026 return ixgbe_media_type_copper;
0027 }
0028
0029 s32 ixgbe_get_invariants_X540(struct ixgbe_hw *hw)
0030 {
0031 struct ixgbe_mac_info *mac = &hw->mac;
0032 struct ixgbe_phy_info *phy = &hw->phy;
0033
0034
0035 phy->ops.set_phy_power = ixgbe_set_copper_phy_power;
0036
0037 mac->mcft_size = IXGBE_X540_MC_TBL_SIZE;
0038 mac->vft_size = IXGBE_X540_VFT_TBL_SIZE;
0039 mac->num_rar_entries = IXGBE_X540_RAR_ENTRIES;
0040 mac->rx_pb_size = IXGBE_X540_RX_PB_SIZE;
0041 mac->max_rx_queues = IXGBE_X540_MAX_RX_QUEUES;
0042 mac->max_tx_queues = IXGBE_X540_MAX_TX_QUEUES;
0043 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw);
0044
0045 return 0;
0046 }
0047
0048
0049
0050
0051
0052
0053
0054 s32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw, ixgbe_link_speed speed,
0055 bool autoneg_wait_to_complete)
0056 {
0057 return hw->phy.ops.setup_link_speed(hw, speed,
0058 autoneg_wait_to_complete);
0059 }
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 s32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw)
0070 {
0071 s32 status;
0072 u32 ctrl, i;
0073 u32 swfw_mask = hw->phy.phy_semaphore_mask;
0074
0075
0076 status = hw->mac.ops.stop_adapter(hw);
0077 if (status)
0078 return status;
0079
0080
0081 ixgbe_clear_tx_pending(hw);
0082
0083 mac_reset_top:
0084 status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
0085 if (status) {
0086 hw_dbg(hw, "semaphore failed with %d", status);
0087 return IXGBE_ERR_SWFW_SYNC;
0088 }
0089
0090 ctrl = IXGBE_CTRL_RST;
0091 ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
0092 IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
0093 IXGBE_WRITE_FLUSH(hw);
0094 hw->mac.ops.release_swfw_sync(hw, swfw_mask);
0095 usleep_range(1000, 1200);
0096
0097
0098 for (i = 0; i < 10; i++) {
0099 ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
0100 if (!(ctrl & IXGBE_CTRL_RST_MASK))
0101 break;
0102 udelay(1);
0103 }
0104
0105 if (ctrl & IXGBE_CTRL_RST_MASK) {
0106 status = IXGBE_ERR_RESET_FAILED;
0107 hw_dbg(hw, "Reset polling failed to complete.\n");
0108 }
0109 msleep(100);
0110
0111
0112
0113
0114
0115
0116 if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) {
0117 hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED;
0118 goto mac_reset_top;
0119 }
0120
0121
0122 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(0), 384 << IXGBE_RXPBSIZE_SHIFT);
0123
0124
0125 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
0126
0127
0128
0129
0130
0131
0132 hw->mac.num_rar_entries = IXGBE_X540_MAX_TX_QUEUES;
0133 hw->mac.ops.init_rx_addrs(hw);
0134
0135
0136 hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr);
0137
0138
0139 if (is_valid_ether_addr(hw->mac.san_addr)) {
0140
0141 hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1;
0142
0143 hw->mac.ops.set_rar(hw, hw->mac.san_mac_rar_index,
0144 hw->mac.san_addr, 0, IXGBE_RAH_AV);
0145
0146
0147 hw->mac.ops.clear_vmdq(hw, hw->mac.san_mac_rar_index,
0148 IXGBE_CLEAR_VMDQ_ALL);
0149
0150
0151 hw->mac.num_rar_entries--;
0152 }
0153
0154
0155 hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix,
0156 &hw->mac.wwpn_prefix);
0157
0158 return status;
0159 }
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169 s32 ixgbe_start_hw_X540(struct ixgbe_hw *hw)
0170 {
0171 s32 ret_val;
0172
0173 ret_val = ixgbe_start_hw_generic(hw);
0174 if (ret_val)
0175 return ret_val;
0176
0177 return ixgbe_start_hw_gen2(hw);
0178 }
0179
0180
0181
0182
0183
0184
0185
0186
0187 s32 ixgbe_init_eeprom_params_X540(struct ixgbe_hw *hw)
0188 {
0189 struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
0190 u32 eec;
0191 u16 eeprom_size;
0192
0193 if (eeprom->type == ixgbe_eeprom_uninitialized) {
0194 eeprom->semaphore_delay = 10;
0195 eeprom->type = ixgbe_flash;
0196
0197 eec = IXGBE_READ_REG(hw, IXGBE_EEC(hw));
0198 eeprom_size = (u16)((eec & IXGBE_EEC_SIZE) >>
0199 IXGBE_EEC_SIZE_SHIFT);
0200 eeprom->word_size = BIT(eeprom_size +
0201 IXGBE_EEPROM_WORD_SIZE_SHIFT);
0202
0203 hw_dbg(hw, "Eeprom params: type = %d, size = %d\n",
0204 eeprom->type, eeprom->word_size);
0205 }
0206
0207 return 0;
0208 }
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218 static s32 ixgbe_read_eerd_X540(struct ixgbe_hw *hw, u16 offset, u16 *data)
0219 {
0220 s32 status;
0221
0222 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
0223 return IXGBE_ERR_SWFW_SYNC;
0224
0225 status = ixgbe_read_eerd_generic(hw, offset, data);
0226
0227 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
0228 return status;
0229 }
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240 static s32 ixgbe_read_eerd_buffer_X540(struct ixgbe_hw *hw,
0241 u16 offset, u16 words, u16 *data)
0242 {
0243 s32 status;
0244
0245 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
0246 return IXGBE_ERR_SWFW_SYNC;
0247
0248 status = ixgbe_read_eerd_buffer_generic(hw, offset, words, data);
0249
0250 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
0251 return status;
0252 }
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262 static s32 ixgbe_write_eewr_X540(struct ixgbe_hw *hw, u16 offset, u16 data)
0263 {
0264 s32 status;
0265
0266 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
0267 return IXGBE_ERR_SWFW_SYNC;
0268
0269 status = ixgbe_write_eewr_generic(hw, offset, data);
0270
0271 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
0272 return status;
0273 }
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284 static s32 ixgbe_write_eewr_buffer_X540(struct ixgbe_hw *hw,
0285 u16 offset, u16 words, u16 *data)
0286 {
0287 s32 status;
0288
0289 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
0290 return IXGBE_ERR_SWFW_SYNC;
0291
0292 status = ixgbe_write_eewr_buffer_generic(hw, offset, words, data);
0293
0294 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
0295 return status;
0296 }
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306 static s32 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw)
0307 {
0308 u16 i;
0309 u16 j;
0310 u16 checksum = 0;
0311 u16 length = 0;
0312 u16 pointer = 0;
0313 u16 word = 0;
0314 u16 checksum_last_word = IXGBE_EEPROM_CHECKSUM;
0315 u16 ptr_start = IXGBE_PCIE_ANALOG_PTR;
0316
0317
0318
0319
0320
0321
0322
0323
0324 for (i = 0; i < checksum_last_word; i++) {
0325 if (ixgbe_read_eerd_generic(hw, i, &word)) {
0326 hw_dbg(hw, "EEPROM read failed\n");
0327 return IXGBE_ERR_EEPROM;
0328 }
0329 checksum += word;
0330 }
0331
0332
0333
0334
0335
0336 for (i = ptr_start; i < IXGBE_FW_PTR; i++) {
0337 if (i == IXGBE_PHY_PTR || i == IXGBE_OPTION_ROM_PTR)
0338 continue;
0339
0340 if (ixgbe_read_eerd_generic(hw, i, &pointer)) {
0341 hw_dbg(hw, "EEPROM read failed\n");
0342 break;
0343 }
0344
0345
0346 if (pointer == 0xFFFF || pointer == 0 ||
0347 pointer >= hw->eeprom.word_size)
0348 continue;
0349
0350 if (ixgbe_read_eerd_generic(hw, pointer, &length)) {
0351 hw_dbg(hw, "EEPROM read failed\n");
0352 return IXGBE_ERR_EEPROM;
0353 }
0354
0355
0356 if (length == 0xFFFF || length == 0 ||
0357 (pointer + length) >= hw->eeprom.word_size)
0358 continue;
0359
0360 for (j = pointer + 1; j <= pointer + length; j++) {
0361 if (ixgbe_read_eerd_generic(hw, j, &word)) {
0362 hw_dbg(hw, "EEPROM read failed\n");
0363 return IXGBE_ERR_EEPROM;
0364 }
0365 checksum += word;
0366 }
0367 }
0368
0369 checksum = (u16)IXGBE_EEPROM_SUM - checksum;
0370
0371 return (s32)checksum;
0372 }
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382 static s32 ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw,
0383 u16 *checksum_val)
0384 {
0385 s32 status;
0386 u16 checksum;
0387 u16 read_checksum = 0;
0388
0389
0390
0391
0392
0393 status = hw->eeprom.ops.read(hw, 0, &checksum);
0394 if (status) {
0395 hw_dbg(hw, "EEPROM read failed\n");
0396 return status;
0397 }
0398
0399 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
0400 return IXGBE_ERR_SWFW_SYNC;
0401
0402 status = hw->eeprom.ops.calc_checksum(hw);
0403 if (status < 0)
0404 goto out;
0405
0406 checksum = (u16)(status & 0xffff);
0407
0408
0409
0410
0411 status = ixgbe_read_eerd_generic(hw, IXGBE_EEPROM_CHECKSUM,
0412 &read_checksum);
0413 if (status)
0414 goto out;
0415
0416
0417
0418
0419 if (read_checksum != checksum) {
0420 hw_dbg(hw, "Invalid EEPROM checksum");
0421 status = IXGBE_ERR_EEPROM_CHECKSUM;
0422 }
0423
0424
0425 if (checksum_val)
0426 *checksum_val = checksum;
0427
0428 out:
0429 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
0430
0431 return status;
0432 }
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442 static s32 ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw)
0443 {
0444 s32 status;
0445 u16 checksum;
0446
0447
0448
0449
0450
0451 status = hw->eeprom.ops.read(hw, 0, &checksum);
0452 if (status) {
0453 hw_dbg(hw, "EEPROM read failed\n");
0454 return status;
0455 }
0456
0457 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
0458 return IXGBE_ERR_SWFW_SYNC;
0459
0460 status = hw->eeprom.ops.calc_checksum(hw);
0461 if (status < 0)
0462 goto out;
0463
0464 checksum = (u16)(status & 0xffff);
0465
0466
0467
0468
0469 status = ixgbe_write_eewr_generic(hw, IXGBE_EEPROM_CHECKSUM, checksum);
0470 if (status)
0471 goto out;
0472
0473 status = ixgbe_update_flash_X540(hw);
0474
0475 out:
0476 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
0477 return status;
0478 }
0479
0480
0481
0482
0483
0484
0485
0486
0487 static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw)
0488 {
0489 u32 flup;
0490 s32 status;
0491
0492 status = ixgbe_poll_flash_update_done_X540(hw);
0493 if (status == IXGBE_ERR_EEPROM) {
0494 hw_dbg(hw, "Flash update time out\n");
0495 return status;
0496 }
0497
0498 flup = IXGBE_READ_REG(hw, IXGBE_EEC(hw)) | IXGBE_EEC_FLUP;
0499 IXGBE_WRITE_REG(hw, IXGBE_EEC(hw), flup);
0500
0501 status = ixgbe_poll_flash_update_done_X540(hw);
0502 if (status == 0)
0503 hw_dbg(hw, "Flash update complete\n");
0504 else
0505 hw_dbg(hw, "Flash update time out\n");
0506
0507 if (hw->revision_id == 0) {
0508 flup = IXGBE_READ_REG(hw, IXGBE_EEC(hw));
0509
0510 if (flup & IXGBE_EEC_SEC1VAL) {
0511 flup |= IXGBE_EEC_FLUP;
0512 IXGBE_WRITE_REG(hw, IXGBE_EEC(hw), flup);
0513 }
0514
0515 status = ixgbe_poll_flash_update_done_X540(hw);
0516 if (status == 0)
0517 hw_dbg(hw, "Flash update complete\n");
0518 else
0519 hw_dbg(hw, "Flash update time out\n");
0520 }
0521
0522 return status;
0523 }
0524
0525
0526
0527
0528
0529
0530
0531
0532 static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw)
0533 {
0534 u32 i;
0535 u32 reg;
0536
0537 for (i = 0; i < IXGBE_FLUDONE_ATTEMPTS; i++) {
0538 reg = IXGBE_READ_REG(hw, IXGBE_EEC(hw));
0539 if (reg & IXGBE_EEC_FLUDONE)
0540 return 0;
0541 udelay(5);
0542 }
0543 return IXGBE_ERR_EEPROM;
0544 }
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554 s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask)
0555 {
0556 u32 swmask = mask & IXGBE_GSSR_NVM_PHY_MASK;
0557 u32 swi2c_mask = mask & IXGBE_GSSR_I2C_MASK;
0558 u32 fwmask = swmask << 5;
0559 u32 timeout = 200;
0560 u32 hwmask = 0;
0561 u32 swfw_sync;
0562 u32 i;
0563
0564 if (swmask & IXGBE_GSSR_EEP_SM)
0565 hwmask = IXGBE_GSSR_FLASH_SM;
0566
0567
0568 if (mask & IXGBE_GSSR_SW_MNG_SM)
0569 swmask |= IXGBE_GSSR_SW_MNG_SM;
0570
0571 swmask |= swi2c_mask;
0572 fwmask |= swi2c_mask << 2;
0573 for (i = 0; i < timeout; i++) {
0574
0575
0576
0577 if (ixgbe_get_swfw_sync_semaphore(hw))
0578 return IXGBE_ERR_SWFW_SYNC;
0579
0580 swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw));
0581 if (!(swfw_sync & (fwmask | swmask | hwmask))) {
0582 swfw_sync |= swmask;
0583 IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC(hw), swfw_sync);
0584 ixgbe_release_swfw_sync_semaphore(hw);
0585 usleep_range(5000, 6000);
0586 return 0;
0587 }
0588
0589
0590
0591
0592 ixgbe_release_swfw_sync_semaphore(hw);
0593 usleep_range(5000, 10000);
0594 }
0595
0596
0597
0598
0599
0600
0601 if (ixgbe_get_swfw_sync_semaphore(hw))
0602 return IXGBE_ERR_SWFW_SYNC;
0603 swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw));
0604 if (swfw_sync & (fwmask | hwmask)) {
0605 swfw_sync |= swmask;
0606 IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC(hw), swfw_sync);
0607 ixgbe_release_swfw_sync_semaphore(hw);
0608 usleep_range(5000, 6000);
0609 return 0;
0610 }
0611
0612
0613
0614
0615
0616 if (swfw_sync & swmask) {
0617 u32 rmask = IXGBE_GSSR_EEP_SM | IXGBE_GSSR_PHY0_SM |
0618 IXGBE_GSSR_PHY1_SM | IXGBE_GSSR_MAC_CSR_SM |
0619 IXGBE_GSSR_SW_MNG_SM;
0620
0621 if (swi2c_mask)
0622 rmask |= IXGBE_GSSR_I2C_MASK;
0623 ixgbe_release_swfw_sync_X540(hw, rmask);
0624 ixgbe_release_swfw_sync_semaphore(hw);
0625 return IXGBE_ERR_SWFW_SYNC;
0626 }
0627 ixgbe_release_swfw_sync_semaphore(hw);
0628
0629 return IXGBE_ERR_SWFW_SYNC;
0630 }
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640 void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask)
0641 {
0642 u32 swmask = mask & (IXGBE_GSSR_NVM_PHY_MASK | IXGBE_GSSR_SW_MNG_SM);
0643 u32 swfw_sync;
0644
0645 if (mask & IXGBE_GSSR_I2C_MASK)
0646 swmask |= mask & IXGBE_GSSR_I2C_MASK;
0647 ixgbe_get_swfw_sync_semaphore(hw);
0648
0649 swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw));
0650 swfw_sync &= ~swmask;
0651 IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC(hw), swfw_sync);
0652
0653 ixgbe_release_swfw_sync_semaphore(hw);
0654 usleep_range(5000, 6000);
0655 }
0656
0657
0658
0659
0660
0661
0662
0663 static s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw)
0664 {
0665 u32 timeout = 2000;
0666 u32 i;
0667 u32 swsm;
0668
0669
0670 for (i = 0; i < timeout; i++) {
0671
0672
0673
0674 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM(hw));
0675 if (!(swsm & IXGBE_SWSM_SMBI))
0676 break;
0677 usleep_range(50, 100);
0678 }
0679
0680 if (i == timeout) {
0681 hw_dbg(hw,
0682 "Software semaphore SMBI between device drivers not granted.\n");
0683 return IXGBE_ERR_EEPROM;
0684 }
0685
0686
0687 for (i = 0; i < timeout; i++) {
0688 swsm = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw));
0689 if (!(swsm & IXGBE_SWFW_REGSMP))
0690 return 0;
0691
0692 usleep_range(50, 100);
0693 }
0694
0695
0696
0697
0698 hw_dbg(hw, "REGSMP Software NVM semaphore not granted\n");
0699 ixgbe_release_swfw_sync_semaphore(hw);
0700 return IXGBE_ERR_EEPROM;
0701 }
0702
0703
0704
0705
0706
0707
0708
0709 static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw)
0710 {
0711 u32 swsm;
0712
0713
0714
0715 swsm = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw));
0716 swsm &= ~IXGBE_SWFW_REGSMP;
0717 IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC(hw), swsm);
0718
0719 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM(hw));
0720 swsm &= ~IXGBE_SWSM_SMBI;
0721 IXGBE_WRITE_REG(hw, IXGBE_SWSM(hw), swsm);
0722
0723 IXGBE_WRITE_FLUSH(hw);
0724 }
0725
0726
0727
0728
0729
0730
0731
0732
0733 void ixgbe_init_swfw_sync_X540(struct ixgbe_hw *hw)
0734 {
0735 u32 rmask;
0736
0737
0738
0739
0740
0741
0742
0743 ixgbe_get_swfw_sync_semaphore(hw);
0744 ixgbe_release_swfw_sync_semaphore(hw);
0745
0746
0747 rmask = IXGBE_GSSR_EEP_SM | IXGBE_GSSR_PHY0_SM |
0748 IXGBE_GSSR_PHY1_SM | IXGBE_GSSR_MAC_CSR_SM |
0749 IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_I2C_MASK;
0750
0751 ixgbe_acquire_swfw_sync_X540(hw, rmask);
0752 ixgbe_release_swfw_sync_X540(hw, rmask);
0753 }
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763 s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index)
0764 {
0765 u32 macc_reg;
0766 u32 ledctl_reg;
0767 ixgbe_link_speed speed;
0768 bool link_up;
0769
0770 if (index > 3)
0771 return IXGBE_ERR_PARAM;
0772
0773
0774
0775
0776
0777 hw->mac.ops.check_link(hw, &speed, &link_up, false);
0778 if (!link_up) {
0779 macc_reg = IXGBE_READ_REG(hw, IXGBE_MACC);
0780 macc_reg |= IXGBE_MACC_FLU | IXGBE_MACC_FSV_10G | IXGBE_MACC_FS;
0781 IXGBE_WRITE_REG(hw, IXGBE_MACC, macc_reg);
0782 }
0783
0784 ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
0785 ledctl_reg &= ~IXGBE_LED_MODE_MASK(index);
0786 ledctl_reg |= IXGBE_LED_BLINK(index);
0787 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ledctl_reg);
0788 IXGBE_WRITE_FLUSH(hw);
0789
0790 return 0;
0791 }
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801 s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index)
0802 {
0803 u32 macc_reg;
0804 u32 ledctl_reg;
0805
0806 if (index > 3)
0807 return IXGBE_ERR_PARAM;
0808
0809
0810 ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
0811 ledctl_reg &= ~IXGBE_LED_MODE_MASK(index);
0812 ledctl_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
0813 ledctl_reg &= ~IXGBE_LED_BLINK(index);
0814 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ledctl_reg);
0815
0816
0817 macc_reg = IXGBE_READ_REG(hw, IXGBE_MACC);
0818 macc_reg &= ~(IXGBE_MACC_FLU | IXGBE_MACC_FSV_10G | IXGBE_MACC_FS);
0819 IXGBE_WRITE_REG(hw, IXGBE_MACC, macc_reg);
0820 IXGBE_WRITE_FLUSH(hw);
0821
0822 return 0;
0823 }
0824 static const struct ixgbe_mac_operations mac_ops_X540 = {
0825 .init_hw = &ixgbe_init_hw_generic,
0826 .reset_hw = &ixgbe_reset_hw_X540,
0827 .start_hw = &ixgbe_start_hw_X540,
0828 .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic,
0829 .get_media_type = &ixgbe_get_media_type_X540,
0830 .enable_rx_dma = &ixgbe_enable_rx_dma_generic,
0831 .get_mac_addr = &ixgbe_get_mac_addr_generic,
0832 .get_san_mac_addr = &ixgbe_get_san_mac_addr_generic,
0833 .get_device_caps = &ixgbe_get_device_caps_generic,
0834 .get_wwn_prefix = &ixgbe_get_wwn_prefix_generic,
0835 .stop_adapter = &ixgbe_stop_adapter_generic,
0836 .get_bus_info = &ixgbe_get_bus_info_generic,
0837 .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie,
0838 .read_analog_reg8 = NULL,
0839 .write_analog_reg8 = NULL,
0840 .setup_link = &ixgbe_setup_mac_link_X540,
0841 .set_rxpba = &ixgbe_set_rxpba_generic,
0842 .check_link = &ixgbe_check_mac_link_generic,
0843 .get_link_capabilities = &ixgbe_get_copper_link_capabilities_generic,
0844 .led_on = &ixgbe_led_on_generic,
0845 .led_off = &ixgbe_led_off_generic,
0846 .init_led_link_act = ixgbe_init_led_link_act_generic,
0847 .blink_led_start = &ixgbe_blink_led_start_X540,
0848 .blink_led_stop = &ixgbe_blink_led_stop_X540,
0849 .set_rar = &ixgbe_set_rar_generic,
0850 .clear_rar = &ixgbe_clear_rar_generic,
0851 .set_vmdq = &ixgbe_set_vmdq_generic,
0852 .set_vmdq_san_mac = &ixgbe_set_vmdq_san_mac_generic,
0853 .clear_vmdq = &ixgbe_clear_vmdq_generic,
0854 .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
0855 .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,
0856 .enable_mc = &ixgbe_enable_mc_generic,
0857 .disable_mc = &ixgbe_disable_mc_generic,
0858 .clear_vfta = &ixgbe_clear_vfta_generic,
0859 .set_vfta = &ixgbe_set_vfta_generic,
0860 .fc_enable = &ixgbe_fc_enable_generic,
0861 .setup_fc = ixgbe_setup_fc_generic,
0862 .fc_autoneg = ixgbe_fc_autoneg,
0863 .set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic,
0864 .init_uta_tables = &ixgbe_init_uta_tables_generic,
0865 .setup_sfp = NULL,
0866 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing,
0867 .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing,
0868 .acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X540,
0869 .release_swfw_sync = &ixgbe_release_swfw_sync_X540,
0870 .init_swfw_sync = &ixgbe_init_swfw_sync_X540,
0871 .disable_rx_buff = &ixgbe_disable_rx_buff_generic,
0872 .enable_rx_buff = &ixgbe_enable_rx_buff_generic,
0873 .get_thermal_sensor_data = NULL,
0874 .init_thermal_sensor_thresh = NULL,
0875 .prot_autoc_read = &prot_autoc_read_generic,
0876 .prot_autoc_write = &prot_autoc_write_generic,
0877 .enable_rx = &ixgbe_enable_rx_generic,
0878 .disable_rx = &ixgbe_disable_rx_generic,
0879 };
0880
0881 static const struct ixgbe_eeprom_operations eeprom_ops_X540 = {
0882 .init_params = &ixgbe_init_eeprom_params_X540,
0883 .read = &ixgbe_read_eerd_X540,
0884 .read_buffer = &ixgbe_read_eerd_buffer_X540,
0885 .write = &ixgbe_write_eewr_X540,
0886 .write_buffer = &ixgbe_write_eewr_buffer_X540,
0887 .calc_checksum = &ixgbe_calc_eeprom_checksum_X540,
0888 .validate_checksum = &ixgbe_validate_eeprom_checksum_X540,
0889 .update_checksum = &ixgbe_update_eeprom_checksum_X540,
0890 };
0891
0892 static const struct ixgbe_phy_operations phy_ops_X540 = {
0893 .identify = &ixgbe_identify_phy_generic,
0894 .identify_sfp = &ixgbe_identify_sfp_module_generic,
0895 .init = NULL,
0896 .reset = NULL,
0897 .read_reg = &ixgbe_read_phy_reg_generic,
0898 .write_reg = &ixgbe_write_phy_reg_generic,
0899 .setup_link = &ixgbe_setup_phy_link_generic,
0900 .setup_link_speed = &ixgbe_setup_phy_link_speed_generic,
0901 .read_i2c_byte = &ixgbe_read_i2c_byte_generic,
0902 .write_i2c_byte = &ixgbe_write_i2c_byte_generic,
0903 .read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_generic,
0904 .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic,
0905 .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic,
0906 .check_overtemp = &ixgbe_tn_check_overtemp,
0907 .set_phy_power = &ixgbe_set_copper_phy_power,
0908 };
0909
0910 static const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = {
0911 IXGBE_MVALS_INIT(X540)
0912 };
0913
0914 const struct ixgbe_info ixgbe_X540_info = {
0915 .mac = ixgbe_mac_X540,
0916 .get_invariants = &ixgbe_get_invariants_X540,
0917 .mac_ops = &mac_ops_X540,
0918 .eeprom_ops = &eeprom_ops_X540,
0919 .phy_ops = &phy_ops_X540,
0920 .mbx_ops = &mbx_ops_generic,
0921 .mvals = ixgbe_mvals_X540,
0922 };