diff options
author | Emil Tantilov <emil.s.tantilov@intel.com> | 2011-03-18 04:18:22 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-04-13 22:21:52 -0400 |
commit | 7184b7cf555f5bc08e34994147c341abb07d1dbb (patch) | |
tree | 6273596a819234c83a8f2f3ca496920a191a58bc /drivers | |
parent | 75e3d3c6812ef2387f8dcfd86437cff00f64b68b (diff) |
ixgbe: refactor common start_hw code for 82599 and x540
Factored out the common start_hw code into a new function
ixgbe_start_hw_gen2() so that it can be used by x540 and 82599.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Acked-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Evan Swanson <evan.swanson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_82599.c | 22 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_common.c | 24 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_common.h | 1 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_x540.c | 24 |
4 files changed, 58 insertions, 13 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c index 32ad4119ff77..09934a82eb30 100644 --- a/drivers/net/ixgbe/ixgbe_82599.c +++ b/drivers/net/ixgbe/ixgbe_82599.c | |||
@@ -1740,30 +1740,28 @@ static s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val) | |||
1740 | * ixgbe_start_hw_82599 - Prepare hardware for Tx/Rx | 1740 | * ixgbe_start_hw_82599 - Prepare hardware for Tx/Rx |
1741 | * @hw: pointer to hardware structure | 1741 | * @hw: pointer to hardware structure |
1742 | * | 1742 | * |
1743 | * Starts the hardware using the generic start_hw function. | 1743 | * Starts the hardware using the generic start_hw function |
1744 | * Then performs device-specific: | 1744 | * and the generation start_hw function. |
1745 | * Clears the rate limiter registers. | 1745 | * Then performs revision-specific operations, if any. |
1746 | **/ | 1746 | **/ |
1747 | static s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw) | 1747 | static s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw) |
1748 | { | 1748 | { |
1749 | u32 q_num; | 1749 | s32 ret_val = 0; |
1750 | s32 ret_val; | ||
1751 | 1750 | ||
1752 | ret_val = ixgbe_start_hw_generic(hw); | 1751 | ret_val = ixgbe_start_hw_generic(hw); |
1752 | if (ret_val != 0) | ||
1753 | goto out; | ||
1753 | 1754 | ||
1754 | /* Clear the rate limiters */ | 1755 | ret_val = ixgbe_start_hw_gen2(hw); |
1755 | for (q_num = 0; q_num < hw->mac.max_tx_queues; q_num++) { | 1756 | if (ret_val != 0) |
1756 | IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, q_num); | 1757 | goto out; |
1757 | IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0); | ||
1758 | } | ||
1759 | IXGBE_WRITE_FLUSH(hw); | ||
1760 | 1758 | ||
1761 | /* We need to run link autotry after the driver loads */ | 1759 | /* We need to run link autotry after the driver loads */ |
1762 | hw->mac.autotry_restart = true; | 1760 | hw->mac.autotry_restart = true; |
1763 | 1761 | ||
1764 | if (ret_val == 0) | 1762 | if (ret_val == 0) |
1765 | ret_val = ixgbe_verify_fw_version_82599(hw); | 1763 | ret_val = ixgbe_verify_fw_version_82599(hw); |
1766 | 1764 | out: | |
1767 | return ret_val; | 1765 | return ret_val; |
1768 | } | 1766 | } |
1769 | 1767 | ||
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index bcd952916eb2..c66fd957578c 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -96,6 +96,30 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * ixgbe_start_hw_gen2 - Init sequence for common device family | ||
100 | * @hw: pointer to hw structure | ||
101 | * | ||
102 | * Performs the init sequence common to the second generation | ||
103 | * of 10 GbE devices. | ||
104 | * Devices in the second generation: | ||
105 | * 82599 | ||
106 | * X540 | ||
107 | **/ | ||
108 | s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw) | ||
109 | { | ||
110 | u32 i; | ||
111 | |||
112 | /* Clear the rate limiters */ | ||
113 | for (i = 0; i < hw->mac.max_tx_queues; i++) { | ||
114 | IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i); | ||
115 | IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0); | ||
116 | } | ||
117 | IXGBE_WRITE_FLUSH(hw); | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | /** | ||
99 | * ixgbe_init_hw_generic - Generic hardware initialization | 123 | * ixgbe_init_hw_generic - Generic hardware initialization |
100 | * @hw: pointer to hardware structure | 124 | * @hw: pointer to hardware structure |
101 | * | 125 | * |
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h index 508f635fc2ca..2585bf38391d 100644 --- a/drivers/net/ixgbe/ixgbe_common.h +++ b/drivers/net/ixgbe/ixgbe_common.h | |||
@@ -35,6 +35,7 @@ u32 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw); | |||
35 | s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw); | 35 | s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw); |
36 | s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw); | 36 | s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw); |
37 | s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw); | 37 | s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw); |
38 | s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw); | ||
38 | s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw); | 39 | s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw); |
39 | s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num, | 40 | s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num, |
40 | u32 pba_num_size); | 41 | u32 pba_num_size); |
diff --git a/drivers/net/ixgbe/ixgbe_x540.c b/drivers/net/ixgbe/ixgbe_x540.c index 7ce3f45cad71..295c17003d6d 100644 --- a/drivers/net/ixgbe/ixgbe_x540.c +++ b/drivers/net/ixgbe/ixgbe_x540.c | |||
@@ -226,6 +226,28 @@ mac_reset_top: | |||
226 | } | 226 | } |
227 | 227 | ||
228 | /** | 228 | /** |
229 | * ixgbe_start_hw_X540 - Prepare hardware for Tx/Rx | ||
230 | * @hw: pointer to hardware structure | ||
231 | * | ||
232 | * Starts the hardware using the generic start_hw function | ||
233 | * and the generation start_hw function. | ||
234 | * Then performs revision-specific operations, if any. | ||
235 | **/ | ||
236 | static s32 ixgbe_start_hw_X540(struct ixgbe_hw *hw) | ||
237 | { | ||
238 | s32 ret_val = 0; | ||
239 | |||
240 | ret_val = ixgbe_start_hw_generic(hw); | ||
241 | if (ret_val != 0) | ||
242 | goto out; | ||
243 | |||
244 | ret_val = ixgbe_start_hw_gen2(hw); | ||
245 | |||
246 | out: | ||
247 | return ret_val; | ||
248 | } | ||
249 | |||
250 | /** | ||
229 | * ixgbe_get_supported_physical_layer_X540 - Returns physical layer type | 251 | * ixgbe_get_supported_physical_layer_X540 - Returns physical layer type |
230 | * @hw: pointer to hardware structure | 252 | * @hw: pointer to hardware structure |
231 | * | 253 | * |
@@ -660,7 +682,7 @@ static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw) | |||
660 | static struct ixgbe_mac_operations mac_ops_X540 = { | 682 | static struct ixgbe_mac_operations mac_ops_X540 = { |
661 | .init_hw = &ixgbe_init_hw_generic, | 683 | .init_hw = &ixgbe_init_hw_generic, |
662 | .reset_hw = &ixgbe_reset_hw_X540, | 684 | .reset_hw = &ixgbe_reset_hw_X540, |
663 | .start_hw = &ixgbe_start_hw_generic, | 685 | .start_hw = &ixgbe_start_hw_X540, |
664 | .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, | 686 | .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, |
665 | .get_media_type = &ixgbe_get_media_type_X540, | 687 | .get_media_type = &ixgbe_get_media_type_X540, |
666 | .get_supported_physical_layer = | 688 | .get_supported_physical_layer = |