diff options
author | PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com> | 2009-04-09 18:27:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-11 05:48:00 -0400 |
commit | 04f165ef4f18444854865d44a3359618480060af (patch) | |
tree | 6ca2e02ba2cb4b2998440496b6d3ad9b6a9e09a2 /drivers/net/ixgbe/ixgbe_82598.c | |
parent | d3e9c56cafb98040c8601dcc784a773ac86da18b (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_82598.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_82598.c | 77 |
1 files changed, 52 insertions, 25 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index 1e1d8b79f9e..a8151f25a4d 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -75,18 +75,49 @@ static u16 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw) | |||
75 | static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) | 75 | static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) |
76 | { | 76 | { |
77 | struct ixgbe_mac_info *mac = &hw->mac; | 77 | struct ixgbe_mac_info *mac = &hw->mac; |
78 | |||
79 | /* Call PHY identify routine to get the phy type */ | ||
80 | ixgbe_identify_phy_generic(hw); | ||
81 | |||
82 | mac->mcft_size = IXGBE_82598_MC_TBL_SIZE; | ||
83 | mac->vft_size = IXGBE_82598_VFT_TBL_SIZE; | ||
84 | mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES; | ||
85 | mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES; | ||
86 | mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES; | ||
87 | mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw); | ||
88 | |||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * ixgbe_init_phy_ops_82598 - PHY/SFP specific init | ||
94 | * @hw: pointer to hardware structure | ||
95 | * | ||
96 | * Initialize any function pointers that were not able to be | ||
97 | * set during get_invariants because the PHY/SFP type was | ||
98 | * not known. Perform the SFP init if necessary. | ||
99 | * | ||
100 | **/ | ||
101 | s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw) | ||
102 | { | ||
103 | struct ixgbe_mac_info *mac = &hw->mac; | ||
78 | struct ixgbe_phy_info *phy = &hw->phy; | 104 | struct ixgbe_phy_info *phy = &hw->phy; |
79 | s32 ret_val = 0; | 105 | s32 ret_val = 0; |
80 | u16 list_offset, data_offset; | 106 | u16 list_offset, data_offset; |
81 | 107 | ||
82 | /* Set the bus information prior to PHY identification */ | 108 | /* Identify the PHY */ |
83 | mac->ops.get_bus_info(hw); | 109 | phy->ops.identify(hw); |
84 | 110 | ||
85 | /* Call PHY identify routine to get the phy type */ | 111 | /* Overwrite the link function pointers if copper PHY */ |
86 | ixgbe_identify_phy_generic(hw); | 112 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { |
113 | mac->ops.setup_link = &ixgbe_setup_copper_link_82598; | ||
114 | mac->ops.setup_link_speed = | ||
115 | &ixgbe_setup_copper_link_speed_82598; | ||
116 | mac->ops.get_link_capabilities = | ||
117 | &ixgbe_get_copper_link_capabilities_82598; | ||
118 | } | ||
87 | 119 | ||
88 | /* PHY Init */ | 120 | switch (hw->phy.type) { |
89 | switch (phy->type) { | ||
90 | case ixgbe_phy_tn: | 121 | case ixgbe_phy_tn: |
91 | phy->ops.check_link = &ixgbe_check_phy_link_tnx; | 122 | phy->ops.check_link = &ixgbe_check_phy_link_tnx; |
92 | phy->ops.get_firmware_version = | 123 | phy->ops.get_firmware_version = |
@@ -106,8 +137,8 @@ static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) | |||
106 | 137 | ||
107 | /* Check to see if SFP+ module is supported */ | 138 | /* Check to see if SFP+ module is supported */ |
108 | ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, | 139 | ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, |
109 | &list_offset, | 140 | &list_offset, |
110 | &data_offset); | 141 | &data_offset); |
111 | if (ret_val != 0) { | 142 | if (ret_val != 0) { |
112 | ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED; | 143 | ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED; |
113 | goto out; | 144 | goto out; |
@@ -117,21 +148,6 @@ static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) | |||
117 | break; | 148 | break; |
118 | } | 149 | } |
119 | 150 | ||
120 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { | ||
121 | mac->ops.setup_link = &ixgbe_setup_copper_link_82598; | ||
122 | mac->ops.setup_link_speed = | ||
123 | &ixgbe_setup_copper_link_speed_82598; | ||
124 | mac->ops.get_link_capabilities = | ||
125 | &ixgbe_get_copper_link_capabilities_82598; | ||
126 | } | ||
127 | |||
128 | mac->mcft_size = IXGBE_82598_MC_TBL_SIZE; | ||
129 | mac->vft_size = IXGBE_82598_VFT_TBL_SIZE; | ||
130 | mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES; | ||
131 | mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES; | ||
132 | mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES; | ||
133 | mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw); | ||
134 | |||
135 | out: | 151 | out: |
136 | return ret_val; | 152 | return ret_val; |
137 | } | 153 | } |
@@ -719,14 +735,23 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw) | |||
719 | } | 735 | } |
720 | 736 | ||
721 | /* Reset PHY */ | 737 | /* Reset PHY */ |
722 | if (hw->phy.reset_disable == false) | 738 | if (hw->phy.reset_disable == false) { |
739 | /* PHY ops must be identified and initialized prior to reset */ | ||
740 | |||
741 | /* Init PHY and function pointers, perform SFP setup */ | ||
742 | status = hw->phy.ops.init(hw); | ||
743 | if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) | ||
744 | goto reset_hw_out; | ||
745 | |||
723 | hw->phy.ops.reset(hw); | 746 | hw->phy.ops.reset(hw); |
747 | } | ||
724 | 748 | ||
725 | /* | 749 | /* |
726 | * Prevent the PCI-E bus from from hanging by disabling PCI-E master | 750 | * Prevent the PCI-E bus from from hanging by disabling PCI-E master |
727 | * access and verify no pending requests before reset | 751 | * access and verify no pending requests before reset |
728 | */ | 752 | */ |
729 | if (ixgbe_disable_pcie_master(hw) != 0) { | 753 | status = ixgbe_disable_pcie_master(hw); |
754 | if (status != 0) { | ||
730 | status = IXGBE_ERR_MASTER_REQUESTS_PENDING; | 755 | status = IXGBE_ERR_MASTER_REQUESTS_PENDING; |
731 | hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); | 756 | hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); |
732 | } | 757 | } |
@@ -773,6 +798,7 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw) | |||
773 | /* Store the permanent mac address */ | 798 | /* Store the permanent mac address */ |
774 | hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); | 799 | hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); |
775 | 800 | ||
801 | reset_hw_out: | ||
776 | return status; | 802 | return status; |
777 | } | 803 | } |
778 | 804 | ||
@@ -1157,6 +1183,7 @@ static struct ixgbe_eeprom_operations eeprom_ops_82598 = { | |||
1157 | static struct ixgbe_phy_operations phy_ops_82598 = { | 1183 | static struct ixgbe_phy_operations phy_ops_82598 = { |
1158 | .identify = &ixgbe_identify_phy_generic, | 1184 | .identify = &ixgbe_identify_phy_generic, |
1159 | .identify_sfp = &ixgbe_identify_sfp_module_generic, | 1185 | .identify_sfp = &ixgbe_identify_sfp_module_generic, |
1186 | .init = &ixgbe_init_phy_ops_82598, | ||
1160 | .reset = &ixgbe_reset_phy_generic, | 1187 | .reset = &ixgbe_reset_phy_generic, |
1161 | .read_reg = &ixgbe_read_phy_reg_generic, | 1188 | .read_reg = &ixgbe_read_phy_reg_generic, |
1162 | .write_reg = &ixgbe_write_phy_reg_generic, | 1189 | .write_reg = &ixgbe_write_phy_reg_generic, |