diff options
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_82598.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_82598.c | 219 |
1 files changed, 140 insertions, 79 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index 9c02d6014cc4..8179e5060a18 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -37,10 +37,8 @@ | |||
37 | #define IXGBE_82598_RAR_ENTRIES 16 | 37 | #define IXGBE_82598_RAR_ENTRIES 16 |
38 | #define IXGBE_82598_MC_TBL_SIZE 128 | 38 | #define IXGBE_82598_MC_TBL_SIZE 128 |
39 | #define IXGBE_82598_VFT_TBL_SIZE 128 | 39 | #define IXGBE_82598_VFT_TBL_SIZE 128 |
40 | #define IXGBE_82598_RX_PB_SIZE 512 | ||
40 | 41 | ||
41 | static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw, | ||
42 | ixgbe_link_speed *speed, | ||
43 | bool *autoneg); | ||
44 | static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, | 42 | static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, |
45 | ixgbe_link_speed speed, | 43 | ixgbe_link_speed speed, |
46 | bool autoneg, | 44 | bool autoneg, |
@@ -156,11 +154,12 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw) | |||
156 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { | 154 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { |
157 | mac->ops.setup_link = &ixgbe_setup_copper_link_82598; | 155 | mac->ops.setup_link = &ixgbe_setup_copper_link_82598; |
158 | mac->ops.get_link_capabilities = | 156 | mac->ops.get_link_capabilities = |
159 | &ixgbe_get_copper_link_capabilities_82598; | 157 | &ixgbe_get_copper_link_capabilities_generic; |
160 | } | 158 | } |
161 | 159 | ||
162 | switch (hw->phy.type) { | 160 | switch (hw->phy.type) { |
163 | case ixgbe_phy_tn: | 161 | case ixgbe_phy_tn: |
162 | phy->ops.setup_link = &ixgbe_setup_phy_link_tnx; | ||
164 | phy->ops.check_link = &ixgbe_check_phy_link_tnx; | 163 | phy->ops.check_link = &ixgbe_check_phy_link_tnx; |
165 | phy->ops.get_firmware_version = | 164 | phy->ops.get_firmware_version = |
166 | &ixgbe_get_phy_firmware_version_tnx; | 165 | &ixgbe_get_phy_firmware_version_tnx; |
@@ -199,14 +198,35 @@ out: | |||
199 | * @hw: pointer to hardware structure | 198 | * @hw: pointer to hardware structure |
200 | * | 199 | * |
201 | * Starts the hardware using the generic start_hw function. | 200 | * Starts the hardware using the generic start_hw function. |
202 | * Then set pcie completion timeout | 201 | * Disables relaxed ordering Then set pcie completion timeout |
202 | * | ||
203 | **/ | 203 | **/ |
204 | static s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw) | 204 | static s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw) |
205 | { | 205 | { |
206 | u32 regval; | ||
207 | u32 i; | ||
206 | s32 ret_val = 0; | 208 | s32 ret_val = 0; |
207 | 209 | ||
208 | ret_val = ixgbe_start_hw_generic(hw); | 210 | ret_val = ixgbe_start_hw_generic(hw); |
209 | 211 | ||
212 | /* Disable relaxed ordering */ | ||
213 | for (i = 0; ((i < hw->mac.max_tx_queues) && | ||
214 | (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) { | ||
215 | regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i)); | ||
216 | regval &= ~IXGBE_DCA_TXCTRL_TX_WB_RO_EN; | ||
217 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(i), regval); | ||
218 | } | ||
219 | |||
220 | for (i = 0; ((i < hw->mac.max_rx_queues) && | ||
221 | (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) { | ||
222 | regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); | ||
223 | regval &= ~(IXGBE_DCA_RXCTRL_DESC_WRO_EN | | ||
224 | IXGBE_DCA_RXCTRL_DESC_HSRO_EN); | ||
225 | IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval); | ||
226 | } | ||
227 | |||
228 | hw->mac.rx_pb_size = IXGBE_82598_RX_PB_SIZE; | ||
229 | |||
210 | /* set the completion timeout for interface */ | 230 | /* set the completion timeout for interface */ |
211 | if (ret_val == 0) | 231 | if (ret_val == 0) |
212 | ixgbe_set_pcie_completion_timeout(hw); | 232 | ixgbe_set_pcie_completion_timeout(hw); |
@@ -274,37 +294,6 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw, | |||
274 | } | 294 | } |
275 | 295 | ||
276 | /** | 296 | /** |
277 | * ixgbe_get_copper_link_capabilities_82598 - Determines link capabilities | ||
278 | * @hw: pointer to hardware structure | ||
279 | * @speed: pointer to link speed | ||
280 | * @autoneg: boolean auto-negotiation value | ||
281 | * | ||
282 | * Determines the link capabilities by reading the AUTOC register. | ||
283 | **/ | ||
284 | static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw, | ||
285 | ixgbe_link_speed *speed, | ||
286 | bool *autoneg) | ||
287 | { | ||
288 | s32 status = IXGBE_ERR_LINK_SETUP; | ||
289 | u16 speed_ability; | ||
290 | |||
291 | *speed = 0; | ||
292 | *autoneg = true; | ||
293 | |||
294 | status = hw->phy.ops.read_reg(hw, MDIO_SPEED, MDIO_MMD_PMAPMD, | ||
295 | &speed_ability); | ||
296 | |||
297 | if (status == 0) { | ||
298 | if (speed_ability & MDIO_SPEED_10G) | ||
299 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; | ||
300 | if (speed_ability & MDIO_PMA_SPEED_1000) | ||
301 | *speed |= IXGBE_LINK_SPEED_1GB_FULL; | ||
302 | } | ||
303 | |||
304 | return status; | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * ixgbe_get_media_type_82598 - Determines media type | 297 | * ixgbe_get_media_type_82598 - Determines media type |
309 | * @hw: pointer to hardware structure | 298 | * @hw: pointer to hardware structure |
310 | * | 299 | * |
@@ -314,10 +303,22 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw) | |||
314 | { | 303 | { |
315 | enum ixgbe_media_type media_type; | 304 | enum ixgbe_media_type media_type; |
316 | 305 | ||
306 | /* Detect if there is a copper PHY attached. */ | ||
307 | switch (hw->phy.type) { | ||
308 | case ixgbe_phy_cu_unknown: | ||
309 | case ixgbe_phy_tn: | ||
310 | case ixgbe_phy_aq: | ||
311 | media_type = ixgbe_media_type_copper; | ||
312 | goto out; | ||
313 | default: | ||
314 | break; | ||
315 | } | ||
316 | |||
317 | /* Media type for I82598 is based on device ID */ | 317 | /* Media type for I82598 is based on device ID */ |
318 | switch (hw->device_id) { | 318 | switch (hw->device_id) { |
319 | case IXGBE_DEV_ID_82598: | 319 | case IXGBE_DEV_ID_82598: |
320 | case IXGBE_DEV_ID_82598_BX: | 320 | case IXGBE_DEV_ID_82598_BX: |
321 | /* Default device ID is mezzanine card KX/KX4 */ | ||
321 | media_type = ixgbe_media_type_backplane; | 322 | media_type = ixgbe_media_type_backplane; |
322 | break; | 323 | break; |
323 | case IXGBE_DEV_ID_82598AF_DUAL_PORT: | 324 | case IXGBE_DEV_ID_82598AF_DUAL_PORT: |
@@ -340,7 +341,7 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw) | |||
340 | media_type = ixgbe_media_type_unknown; | 341 | media_type = ixgbe_media_type_unknown; |
341 | break; | 342 | break; |
342 | } | 343 | } |
343 | 344 | out: | |
344 | return media_type; | 345 | return media_type; |
345 | } | 346 | } |
346 | 347 | ||
@@ -357,6 +358,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
357 | u32 fctrl_reg; | 358 | u32 fctrl_reg; |
358 | u32 rmcs_reg; | 359 | u32 rmcs_reg; |
359 | u32 reg; | 360 | u32 reg; |
361 | u32 rx_pba_size; | ||
360 | u32 link_speed = 0; | 362 | u32 link_speed = 0; |
361 | bool link_up; | 363 | bool link_up; |
362 | 364 | ||
@@ -387,7 +389,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
387 | 389 | ||
388 | /* Negotiate the fc mode to use */ | 390 | /* Negotiate the fc mode to use */ |
389 | ret_val = ixgbe_fc_autoneg(hw); | 391 | ret_val = ixgbe_fc_autoneg(hw); |
390 | if (ret_val) | 392 | if (ret_val == IXGBE_ERR_FLOW_CONTROL) |
391 | goto out; | 393 | goto out; |
392 | 394 | ||
393 | /* Disable any previous flow control settings */ | 395 | /* Disable any previous flow control settings */ |
@@ -405,10 +407,10 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
405 | * 2: Tx flow control is enabled (we can send pause frames but | 407 | * 2: Tx flow control is enabled (we can send pause frames but |
406 | * we do not support receiving pause frames). | 408 | * we do not support receiving pause frames). |
407 | * 3: Both Rx and Tx flow control (symmetric) are enabled. | 409 | * 3: Both Rx and Tx flow control (symmetric) are enabled. |
408 | * other: Invalid. | ||
409 | #ifdef CONFIG_DCB | 410 | #ifdef CONFIG_DCB |
410 | * 4: Priority Flow Control is enabled. | 411 | * 4: Priority Flow Control is enabled. |
411 | #endif | 412 | #endif |
413 | * other: Invalid. | ||
412 | */ | 414 | */ |
413 | switch (hw->fc.current_mode) { | 415 | switch (hw->fc.current_mode) { |
414 | case ixgbe_fc_none: | 416 | case ixgbe_fc_none: |
@@ -459,16 +461,19 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
459 | 461 | ||
460 | /* Set up and enable Rx high/low water mark thresholds, enable XON. */ | 462 | /* Set up and enable Rx high/low water mark thresholds, enable XON. */ |
461 | if (hw->fc.current_mode & ixgbe_fc_tx_pause) { | 463 | if (hw->fc.current_mode & ixgbe_fc_tx_pause) { |
462 | if (hw->fc.send_xon) { | 464 | rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(packetbuf_num)); |
463 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), | 465 | rx_pba_size >>= IXGBE_RXPBSIZE_SHIFT; |
464 | (hw->fc.low_water | IXGBE_FCRTL_XONE)); | 466 | |
465 | } else { | 467 | reg = (rx_pba_size - hw->fc.low_water) << 6; |
466 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), | 468 | if (hw->fc.send_xon) |
467 | hw->fc.low_water); | 469 | reg |= IXGBE_FCRTL_XONE; |
468 | } | 470 | |
471 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), reg); | ||
469 | 472 | ||
470 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), | 473 | reg = (rx_pba_size - hw->fc.high_water) << 6; |
471 | (hw->fc.high_water | IXGBE_FCRTH_FCEN)); | 474 | reg |= IXGBE_FCRTH_FCEN; |
475 | |||
476 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), reg); | ||
472 | } | 477 | } |
473 | 478 | ||
474 | /* Configure pause time (2 TCs per register) */ | 479 | /* Configure pause time (2 TCs per register) */ |
@@ -658,13 +663,12 @@ out: | |||
658 | return 0; | 663 | return 0; |
659 | } | 664 | } |
660 | 665 | ||
661 | |||
662 | /** | 666 | /** |
663 | * ixgbe_setup_mac_link_82598 - Set MAC link speed | 667 | * ixgbe_setup_mac_link_82598 - Set MAC link speed |
664 | * @hw: pointer to hardware structure | 668 | * @hw: pointer to hardware structure |
665 | * @speed: new link speed | 669 | * @speed: new link speed |
666 | * @autoneg: true if auto-negotiation enabled | 670 | * @autoneg: true if auto-negotiation enabled |
667 | * @autoneg_wait_to_complete: true if waiting is needed to complete | 671 | * @autoneg_wait_to_complete: true when waiting for completion is needed |
668 | * | 672 | * |
669 | * Set the link speed in the AUTOC register and restarts link. | 673 | * Set the link speed in the AUTOC register and restarts link. |
670 | **/ | 674 | **/ |
@@ -703,7 +707,8 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, | |||
703 | * ixgbe_hw This will write the AUTOC register based on the new | 707 | * ixgbe_hw This will write the AUTOC register based on the new |
704 | * stored values | 708 | * stored values |
705 | */ | 709 | */ |
706 | status = ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete); | 710 | status = ixgbe_start_mac_link_82598(hw, |
711 | autoneg_wait_to_complete); | ||
707 | } | 712 | } |
708 | 713 | ||
709 | return status; | 714 | return status; |
@@ -729,7 +734,6 @@ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, | |||
729 | /* Setup the PHY according to input speed */ | 734 | /* Setup the PHY according to input speed */ |
730 | status = hw->phy.ops.setup_link_speed(hw, speed, autoneg, | 735 | status = hw->phy.ops.setup_link_speed(hw, speed, autoneg, |
731 | autoneg_wait_to_complete); | 736 | autoneg_wait_to_complete); |
732 | |||
733 | /* Set up MAC */ | 737 | /* Set up MAC */ |
734 | ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete); | 738 | ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete); |
735 | 739 | ||
@@ -801,7 +805,6 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw) | |||
801 | else if (phy_status == IXGBE_ERR_SFP_NOT_PRESENT) | 805 | else if (phy_status == IXGBE_ERR_SFP_NOT_PRESENT) |
802 | goto no_phy_reset; | 806 | goto no_phy_reset; |
803 | 807 | ||
804 | |||
805 | hw->phy.ops.reset(hw); | 808 | hw->phy.ops.reset(hw); |
806 | } | 809 | } |
807 | 810 | ||
@@ -810,12 +813,9 @@ no_phy_reset: | |||
810 | * Prevent the PCI-E bus from from hanging by disabling PCI-E master | 813 | * Prevent the PCI-E bus from from hanging by disabling PCI-E master |
811 | * access and verify no pending requests before reset | 814 | * access and verify no pending requests before reset |
812 | */ | 815 | */ |
813 | status = ixgbe_disable_pcie_master(hw); | 816 | ixgbe_disable_pcie_master(hw); |
814 | if (status != 0) { | ||
815 | status = IXGBE_ERR_MASTER_REQUESTS_PENDING; | ||
816 | hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); | ||
817 | } | ||
818 | 817 | ||
818 | mac_reset_top: | ||
819 | /* | 819 | /* |
820 | * Issue global reset to the MAC. This needs to be a SW reset. | 820 | * Issue global reset to the MAC. This needs to be a SW reset. |
821 | * If link reset is used, it might reset the MAC when mng is using it | 821 | * If link reset is used, it might reset the MAC when mng is using it |
@@ -836,6 +836,19 @@ no_phy_reset: | |||
836 | hw_dbg(hw, "Reset polling failed to complete.\n"); | 836 | hw_dbg(hw, "Reset polling failed to complete.\n"); |
837 | } | 837 | } |
838 | 838 | ||
839 | /* | ||
840 | * Double resets are required for recovery from certain error | ||
841 | * conditions. Between resets, it is necessary to stall to allow time | ||
842 | * for any pending HW events to complete. We use 1usec since that is | ||
843 | * what is needed for ixgbe_disable_pcie_master(). The second reset | ||
844 | * then clears out any effects of those events. | ||
845 | */ | ||
846 | if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { | ||
847 | hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; | ||
848 | udelay(1); | ||
849 | goto mac_reset_top; | ||
850 | } | ||
851 | |||
839 | msleep(50); | 852 | msleep(50); |
840 | 853 | ||
841 | gheccr = IXGBE_READ_REG(hw, IXGBE_GHECCR); | 854 | gheccr = IXGBE_READ_REG(hw, IXGBE_GHECCR); |
@@ -855,15 +868,15 @@ no_phy_reset: | |||
855 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc); | 868 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc); |
856 | } | 869 | } |
857 | 870 | ||
871 | /* Store the permanent mac address */ | ||
872 | hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); | ||
873 | |||
858 | /* | 874 | /* |
859 | * Store MAC address from RAR0, clear receive address registers, and | 875 | * Store MAC address from RAR0, clear receive address registers, and |
860 | * clear the multicast table | 876 | * clear the multicast table |
861 | */ | 877 | */ |
862 | hw->mac.ops.init_rx_addrs(hw); | 878 | hw->mac.ops.init_rx_addrs(hw); |
863 | 879 | ||
864 | /* Store the permanent mac address */ | ||
865 | hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); | ||
866 | |||
867 | reset_hw_out: | 880 | reset_hw_out: |
868 | if (phy_status) | 881 | if (phy_status) |
869 | status = phy_status; | 882 | status = phy_status; |
@@ -880,6 +893,13 @@ reset_hw_out: | |||
880 | static s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq) | 893 | static s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq) |
881 | { | 894 | { |
882 | u32 rar_high; | 895 | u32 rar_high; |
896 | u32 rar_entries = hw->mac.num_rar_entries; | ||
897 | |||
898 | /* Make sure we are using a valid rar index range */ | ||
899 | if (rar >= rar_entries) { | ||
900 | hw_dbg(hw, "RAR index %d is out of range.\n", rar); | ||
901 | return IXGBE_ERR_INVALID_ARGUMENT; | ||
902 | } | ||
883 | 903 | ||
884 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar)); | 904 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar)); |
885 | rar_high &= ~IXGBE_RAH_VIND_MASK; | 905 | rar_high &= ~IXGBE_RAH_VIND_MASK; |
@@ -899,14 +919,17 @@ static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq) | |||
899 | u32 rar_high; | 919 | u32 rar_high; |
900 | u32 rar_entries = hw->mac.num_rar_entries; | 920 | u32 rar_entries = hw->mac.num_rar_entries; |
901 | 921 | ||
902 | if (rar < rar_entries) { | 922 | |
903 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar)); | 923 | /* Make sure we are using a valid rar index range */ |
904 | if (rar_high & IXGBE_RAH_VIND_MASK) { | 924 | if (rar >= rar_entries) { |
905 | rar_high &= ~IXGBE_RAH_VIND_MASK; | ||
906 | IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high); | ||
907 | } | ||
908 | } else { | ||
909 | hw_dbg(hw, "RAR index %d is out of range.\n", rar); | 925 | hw_dbg(hw, "RAR index %d is out of range.\n", rar); |
926 | return IXGBE_ERR_INVALID_ARGUMENT; | ||
927 | } | ||
928 | |||
929 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar)); | ||
930 | if (rar_high & IXGBE_RAH_VIND_MASK) { | ||
931 | rar_high &= ~IXGBE_RAH_VIND_MASK; | ||
932 | IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high); | ||
910 | } | 933 | } |
911 | 934 | ||
912 | return 0; | 935 | return 0; |
@@ -1025,13 +1048,12 @@ static s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val) | |||
1025 | } | 1048 | } |
1026 | 1049 | ||
1027 | /** | 1050 | /** |
1028 | * ixgbe_read_i2c_eeprom_82598 - Read 8 bit EEPROM word of an SFP+ module | 1051 | * ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface. |
1029 | * over I2C interface through an intermediate phy. | ||
1030 | * @hw: pointer to hardware structure | 1052 | * @hw: pointer to hardware structure |
1031 | * @byte_offset: EEPROM byte offset to read | 1053 | * @byte_offset: EEPROM byte offset to read |
1032 | * @eeprom_data: value read | 1054 | * @eeprom_data: value read |
1033 | * | 1055 | * |
1034 | * Performs byte read operation to SFP module's EEPROM over I2C interface. | 1056 | * Performs 8 byte read operation to SFP module's EEPROM over I2C interface. |
1035 | **/ | 1057 | **/ |
1036 | static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, | 1058 | static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, |
1037 | u8 *eeprom_data) | 1059 | u8 *eeprom_data) |
@@ -1064,7 +1086,7 @@ static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, | |||
1064 | sfp_stat = sfp_stat & IXGBE_I2C_EEPROM_STATUS_MASK; | 1086 | sfp_stat = sfp_stat & IXGBE_I2C_EEPROM_STATUS_MASK; |
1065 | if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS) | 1087 | if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS) |
1066 | break; | 1088 | break; |
1067 | msleep(10); | 1089 | usleep_range(10000, 20000); |
1068 | } | 1090 | } |
1069 | 1091 | ||
1070 | if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_PASS) { | 1092 | if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_PASS) { |
@@ -1105,10 +1127,12 @@ static u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw) | |||
1105 | 1127 | ||
1106 | /* Copper PHY must be checked before AUTOC LMS to determine correct | 1128 | /* Copper PHY must be checked before AUTOC LMS to determine correct |
1107 | * physical layer because 10GBase-T PHYs use LMS = KX4/KX */ | 1129 | * physical layer because 10GBase-T PHYs use LMS = KX4/KX */ |
1108 | if (hw->phy.type == ixgbe_phy_tn || | 1130 | switch (hw->phy.type) { |
1109 | hw->phy.type == ixgbe_phy_cu_unknown) { | 1131 | case ixgbe_phy_tn: |
1110 | hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, MDIO_MMD_PMAPMD, | 1132 | case ixgbe_phy_aq: |
1111 | &ext_ability); | 1133 | case ixgbe_phy_cu_unknown: |
1134 | hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, | ||
1135 | MDIO_MMD_PMAPMD, &ext_ability); | ||
1112 | if (ext_ability & MDIO_PMA_EXTABLE_10GBT) | 1136 | if (ext_ability & MDIO_PMA_EXTABLE_10GBT) |
1113 | physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T; | 1137 | physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T; |
1114 | if (ext_ability & MDIO_PMA_EXTABLE_1000BT) | 1138 | if (ext_ability & MDIO_PMA_EXTABLE_1000BT) |
@@ -1116,6 +1140,8 @@ static u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw) | |||
1116 | if (ext_ability & MDIO_PMA_EXTABLE_100BTX) | 1140 | if (ext_ability & MDIO_PMA_EXTABLE_100BTX) |
1117 | physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX; | 1141 | physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX; |
1118 | goto out; | 1142 | goto out; |
1143 | default: | ||
1144 | break; | ||
1119 | } | 1145 | } |
1120 | 1146 | ||
1121 | switch (autoc & IXGBE_AUTOC_LMS_MASK) { | 1147 | switch (autoc & IXGBE_AUTOC_LMS_MASK) { |
@@ -1184,6 +1210,38 @@ out: | |||
1184 | return physical_layer; | 1210 | return physical_layer; |
1185 | } | 1211 | } |
1186 | 1212 | ||
1213 | /** | ||
1214 | * ixgbe_set_lan_id_multi_port_pcie_82598 - Set LAN id for PCIe multiple | ||
1215 | * port devices. | ||
1216 | * @hw: pointer to the HW structure | ||
1217 | * | ||
1218 | * Calls common function and corrects issue with some single port devices | ||
1219 | * that enable LAN1 but not LAN0. | ||
1220 | **/ | ||
1221 | static void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw) | ||
1222 | { | ||
1223 | struct ixgbe_bus_info *bus = &hw->bus; | ||
1224 | u16 pci_gen = 0; | ||
1225 | u16 pci_ctrl2 = 0; | ||
1226 | |||
1227 | ixgbe_set_lan_id_multi_port_pcie(hw); | ||
1228 | |||
1229 | /* check if LAN0 is disabled */ | ||
1230 | hw->eeprom.ops.read(hw, IXGBE_PCIE_GENERAL_PTR, &pci_gen); | ||
1231 | if ((pci_gen != 0) && (pci_gen != 0xFFFF)) { | ||
1232 | |||
1233 | hw->eeprom.ops.read(hw, pci_gen + IXGBE_PCIE_CTRL2, &pci_ctrl2); | ||
1234 | |||
1235 | /* if LAN0 is completely disabled force function to 0 */ | ||
1236 | if ((pci_ctrl2 & IXGBE_PCIE_CTRL2_LAN_DISABLE) && | ||
1237 | !(pci_ctrl2 & IXGBE_PCIE_CTRL2_DISABLE_SELECT) && | ||
1238 | !(pci_ctrl2 & IXGBE_PCIE_CTRL2_DUMMY_ENABLE)) { | ||
1239 | |||
1240 | bus->func = 0; | ||
1241 | } | ||
1242 | } | ||
1243 | } | ||
1244 | |||
1187 | static struct ixgbe_mac_operations mac_ops_82598 = { | 1245 | static struct ixgbe_mac_operations mac_ops_82598 = { |
1188 | .init_hw = &ixgbe_init_hw_generic, | 1246 | .init_hw = &ixgbe_init_hw_generic, |
1189 | .reset_hw = &ixgbe_reset_hw_82598, | 1247 | .reset_hw = &ixgbe_reset_hw_82598, |
@@ -1195,7 +1253,7 @@ static struct ixgbe_mac_operations mac_ops_82598 = { | |||
1195 | .get_mac_addr = &ixgbe_get_mac_addr_generic, | 1253 | .get_mac_addr = &ixgbe_get_mac_addr_generic, |
1196 | .stop_adapter = &ixgbe_stop_adapter_generic, | 1254 | .stop_adapter = &ixgbe_stop_adapter_generic, |
1197 | .get_bus_info = &ixgbe_get_bus_info_generic, | 1255 | .get_bus_info = &ixgbe_get_bus_info_generic, |
1198 | .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie, | 1256 | .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie_82598, |
1199 | .read_analog_reg8 = &ixgbe_read_analog_reg8_82598, | 1257 | .read_analog_reg8 = &ixgbe_read_analog_reg8_82598, |
1200 | .write_analog_reg8 = &ixgbe_write_analog_reg8_82598, | 1258 | .write_analog_reg8 = &ixgbe_write_analog_reg8_82598, |
1201 | .setup_link = &ixgbe_setup_mac_link_82598, | 1259 | .setup_link = &ixgbe_setup_mac_link_82598, |
@@ -1210,18 +1268,21 @@ static struct ixgbe_mac_operations mac_ops_82598 = { | |||
1210 | .set_vmdq = &ixgbe_set_vmdq_82598, | 1268 | .set_vmdq = &ixgbe_set_vmdq_82598, |
1211 | .clear_vmdq = &ixgbe_clear_vmdq_82598, | 1269 | .clear_vmdq = &ixgbe_clear_vmdq_82598, |
1212 | .init_rx_addrs = &ixgbe_init_rx_addrs_generic, | 1270 | .init_rx_addrs = &ixgbe_init_rx_addrs_generic, |
1213 | .update_uc_addr_list = &ixgbe_update_uc_addr_list_generic, | ||
1214 | .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, | 1271 | .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, |
1215 | .enable_mc = &ixgbe_enable_mc_generic, | 1272 | .enable_mc = &ixgbe_enable_mc_generic, |
1216 | .disable_mc = &ixgbe_disable_mc_generic, | 1273 | .disable_mc = &ixgbe_disable_mc_generic, |
1217 | .clear_vfta = &ixgbe_clear_vfta_82598, | 1274 | .clear_vfta = &ixgbe_clear_vfta_82598, |
1218 | .set_vfta = &ixgbe_set_vfta_82598, | 1275 | .set_vfta = &ixgbe_set_vfta_82598, |
1219 | .fc_enable = &ixgbe_fc_enable_82598, | 1276 | .fc_enable = &ixgbe_fc_enable_82598, |
1277 | .acquire_swfw_sync = &ixgbe_acquire_swfw_sync, | ||
1278 | .release_swfw_sync = &ixgbe_release_swfw_sync, | ||
1220 | }; | 1279 | }; |
1221 | 1280 | ||
1222 | static struct ixgbe_eeprom_operations eeprom_ops_82598 = { | 1281 | static struct ixgbe_eeprom_operations eeprom_ops_82598 = { |
1223 | .init_params = &ixgbe_init_eeprom_params_generic, | 1282 | .init_params = &ixgbe_init_eeprom_params_generic, |
1224 | .read = &ixgbe_read_eerd_generic, | 1283 | .read = &ixgbe_read_eerd_generic, |
1284 | .read_buffer = &ixgbe_read_eerd_buffer_generic, | ||
1285 | .calc_checksum = &ixgbe_calc_eeprom_checksum_generic, | ||
1225 | .validate_checksum = &ixgbe_validate_eeprom_checksum_generic, | 1286 | .validate_checksum = &ixgbe_validate_eeprom_checksum_generic, |
1226 | .update_checksum = &ixgbe_update_eeprom_checksum_generic, | 1287 | .update_checksum = &ixgbe_update_eeprom_checksum_generic, |
1227 | }; | 1288 | }; |