aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_82599.c
diff options
context:
space:
mode:
authorPJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>2009-04-09 18:27:57 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-11 05:48:00 -0400
commit04f165ef4f18444854865d44a3359618480060af (patch)
tree6ca2e02ba2cb4b2998440496b6d3ad9b6a9e09a2 /drivers/net/ixgbe/ixgbe_82599.c
parentd3e9c56cafb98040c8601dcc784a773ac86da18b (diff)
ixgbe: Move PHY ops initialization to centralize bus accesses
When PHY operations are determined, the PHY must be identified. This identification causes bus access, and should be contained within its own routines. This also helps the 82599 PHY init paths for both SFP+ and KX/KX4 devices to be easier to maintain. Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_82599.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c70
1 files changed, 46 insertions, 24 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index beae7e012609..9a9998985004 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -148,51 +148,60 @@ u32 ixgbe_get_pcie_msix_count_82599(struct ixgbe_hw *hw)
148static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw) 148static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw)
149{ 149{
150 struct ixgbe_mac_info *mac = &hw->mac; 150 struct ixgbe_mac_info *mac = &hw->mac;
151 struct ixgbe_phy_info *phy = &hw->phy;
152 s32 ret_val;
153 151
154 /* Set the bus information prior to PHY identification */ 152 ixgbe_init_mac_link_ops_82599(hw);
155 mac->ops.get_bus_info(hw);
156 153
157 /* Call PHY identify routine to get the Cu or SFI phy type */ 154 mac->mcft_size = IXGBE_82599_MC_TBL_SIZE;
158 ret_val = phy->ops.identify(hw); 155 mac->vft_size = IXGBE_82599_VFT_TBL_SIZE;
156 mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES;
157 mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES;
158 mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES;
159 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82599(hw);
159 160
160 if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED) 161 return 0;
161 goto get_invariants_out; 162}
162 163
163 ixgbe_init_mac_link_ops_82599(hw); 164/**
165 * ixgbe_init_phy_ops_82599 - PHY/SFP specific init
166 * @hw: pointer to hardware structure
167 *
168 * Initialize any function pointers that were not able to be
169 * set during get_invariants because the PHY/SFP type was
170 * not known. Perform the SFP init if necessary.
171 *
172 **/
173s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw)
174{
175 struct ixgbe_mac_info *mac = &hw->mac;
176 struct ixgbe_phy_info *phy = &hw->phy;
177 s32 ret_val = 0;
164 178
165 /* Setup SFP module if there is one present. */ 179 /* Identify the PHY or SFP module */
166 ret_val = mac->ops.setup_sfp(hw); 180 ret_val = phy->ops.identify(hw);
181
182 /* Setup function pointers based on detected SFP module and speeds */
183 ixgbe_init_mac_link_ops_82599(hw);
167 184
168 /* If copper media, overwrite with copper function pointers */ 185 /* If copper media, overwrite with copper function pointers */
169 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { 186 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
170 mac->ops.setup_link = &ixgbe_setup_copper_link_82599; 187 mac->ops.setup_link = &ixgbe_setup_copper_link_82599;
171 mac->ops.setup_link_speed = 188 mac->ops.setup_link_speed =
172 &ixgbe_setup_copper_link_speed_82599; 189 &ixgbe_setup_copper_link_speed_82599;
173 mac->ops.get_link_capabilities = 190 mac->ops.get_link_capabilities =
174 &ixgbe_get_copper_link_capabilities_82599; 191 &ixgbe_get_copper_link_capabilities_82599;
175 } 192 }
176 193
177 /* PHY Init */ 194 /* Set necessary function pointers based on phy type */
178 switch (hw->phy.type) { 195 switch (hw->phy.type) {
179 case ixgbe_phy_tn: 196 case ixgbe_phy_tn:
180 phy->ops.check_link = &ixgbe_check_phy_link_tnx; 197 phy->ops.check_link = &ixgbe_check_phy_link_tnx;
181 phy->ops.get_firmware_version = 198 phy->ops.get_firmware_version =
182 &ixgbe_get_phy_firmware_version_tnx; 199 &ixgbe_get_phy_firmware_version_tnx;
183 break; 200 break;
184 default: 201 default:
185 break; 202 break;
186 } 203 }
187 204
188 mac->mcft_size = IXGBE_82599_MC_TBL_SIZE;
189 mac->vft_size = IXGBE_82599_VFT_TBL_SIZE;
190 mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES;
191 mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES;
192 mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES;
193 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82599(hw);
194
195get_invariants_out:
196 return ret_val; 205 return ret_val;
197} 206}
198 207
@@ -708,13 +717,24 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
708 hw->mac.ops.stop_adapter(hw); 717 hw->mac.ops.stop_adapter(hw);
709 718
710 /* Reset PHY */ 719 /* Reset PHY */
711 hw->phy.ops.reset(hw); 720 if (hw->phy.reset_disable == false) {
721 /* PHY ops must be identified and initialized prior to reset */
722
723 /* Init PHY and function pointers, perform SFP setup */
724 status = hw->phy.ops.init(hw);
725
726 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
727 goto reset_hw_out;
728
729 hw->phy.ops.reset(hw);
730 }
712 731
713 /* 732 /*
714 * Prevent the PCI-E bus from from hanging by disabling PCI-E master 733 * Prevent the PCI-E bus from from hanging by disabling PCI-E master
715 * access and verify no pending requests before reset 734 * access and verify no pending requests before reset
716 */ 735 */
717 if (ixgbe_disable_pcie_master(hw) != 0) { 736 status = ixgbe_disable_pcie_master(hw);
737 if (status != 0) {
718 status = IXGBE_ERR_MASTER_REQUESTS_PENDING; 738 status = IXGBE_ERR_MASTER_REQUESTS_PENDING;
719 hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); 739 hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
720 } 740 }
@@ -775,6 +795,7 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
775 /* Store the permanent mac address */ 795 /* Store the permanent mac address */
776 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); 796 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
777 797
798reset_hw_out:
778 return status; 799 return status;
779} 800}
780 801
@@ -1272,6 +1293,7 @@ static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
1272static struct ixgbe_phy_operations phy_ops_82599 = { 1293static struct ixgbe_phy_operations phy_ops_82599 = {
1273 .identify = &ixgbe_identify_phy_82599, 1294 .identify = &ixgbe_identify_phy_82599,
1274 .identify_sfp = &ixgbe_identify_sfp_module_generic, 1295 .identify_sfp = &ixgbe_identify_sfp_module_generic,
1296 .init = &ixgbe_init_phy_ops_82599,
1275 .reset = &ixgbe_reset_phy_generic, 1297 .reset = &ixgbe_reset_phy_generic,
1276 .read_reg = &ixgbe_read_phy_reg_generic, 1298 .read_reg = &ixgbe_read_phy_reg_generic,
1277 .write_reg = &ixgbe_write_phy_reg_generic, 1299 .write_reg = &ixgbe_write_phy_reg_generic,