aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igc/igc_base.c
diff options
context:
space:
mode:
authorSasha Neftin <sasha.neftin@intel.com>2018-10-11 03:17:34 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-10-17 16:56:55 -0400
commit4eb8080143a9d9fd513bacc65b2466c57983aaae (patch)
tree32923ea729cb92f3afbf68e7ca1698ed7db0b2ef /drivers/net/ethernet/intel/igc/igc_base.c
parent5586838fe9ced0980e210b39d635ff3842297448 (diff)
igc: Add setup link functionality
Add link establishment methods Add auto negotiation methods Add read MAC address method Signed-off-by: Sasha Neftin <sasha.neftin@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igc/igc_base.c')
-rw-r--r--drivers/net/ethernet/intel/igc/igc_base.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igc/igc_base.c b/drivers/net/ethernet/intel/igc/igc_base.c
index 55faef987479..832da609d9a7 100644
--- a/drivers/net/ethernet/intel/igc/igc_base.c
+++ b/drivers/net/ethernet/intel/igc/igc_base.c
@@ -178,6 +178,29 @@ static s32 igc_init_nvm_params_base(struct igc_hw *hw)
178} 178}
179 179
180/** 180/**
181 * igc_setup_copper_link_base - Configure copper link settings
182 * @hw: pointer to the HW structure
183 *
184 * Configures the link for auto-neg or forced speed and duplex. Then we check
185 * for link, once link is established calls to configure collision distance
186 * and flow control are called.
187 */
188static s32 igc_setup_copper_link_base(struct igc_hw *hw)
189{
190 s32 ret_val = 0;
191 u32 ctrl;
192
193 ctrl = rd32(IGC_CTRL);
194 ctrl |= IGC_CTRL_SLU;
195 ctrl &= ~(IGC_CTRL_FRCSPD | IGC_CTRL_FRCDPX);
196 wr32(IGC_CTRL, ctrl);
197
198 ret_val = igc_setup_copper_link(hw);
199
200 return ret_val;
201}
202
203/**
181 * igc_init_mac_params_base - Init MAC func ptrs. 204 * igc_init_mac_params_base - Init MAC func ptrs.
182 * @hw: pointer to the HW structure 205 * @hw: pointer to the HW structure
183 */ 206 */
@@ -200,6 +223,9 @@ static s32 igc_init_mac_params_base(struct igc_hw *hw)
200 if (mac->type == igc_i225) 223 if (mac->type == igc_i225)
201 dev_spec->clear_semaphore_once = true; 224 dev_spec->clear_semaphore_once = true;
202 225
226 /* physical interface link setup */
227 mac->ops.setup_physical_interface = igc_setup_copper_link_base;
228
203 return 0; 229 return 0;
204} 230}
205 231
@@ -242,6 +268,8 @@ static s32 igc_init_phy_params_base(struct igc_hw *hw)
242 if (ret_val) 268 if (ret_val)
243 return ret_val; 269 return ret_val;
244 270
271 igc_check_for_link_base(hw);
272
245 /* Verify phy id and set remaining function pointers */ 273 /* Verify phy id and set remaining function pointers */
246 switch (phy->id) { 274 switch (phy->id) {
247 case I225_I_PHY_ID: 275 case I225_I_PHY_ID:
@@ -258,10 +286,22 @@ out:
258 286
259static s32 igc_get_invariants_base(struct igc_hw *hw) 287static s32 igc_get_invariants_base(struct igc_hw *hw)
260{ 288{
289 struct igc_mac_info *mac = &hw->mac;
261 u32 link_mode = 0; 290 u32 link_mode = 0;
262 u32 ctrl_ext = 0; 291 u32 ctrl_ext = 0;
263 s32 ret_val = 0; 292 s32 ret_val = 0;
264 293
294 switch (hw->device_id) {
295 case IGC_DEV_ID_I225_LM:
296 case IGC_DEV_ID_I225_V:
297 mac->type = igc_i225;
298 break;
299 default:
300 return -IGC_ERR_MAC_INIT;
301 }
302
303 hw->phy.media_type = igc_media_type_copper;
304
265 ctrl_ext = rd32(IGC_CTRL_EXT); 305 ctrl_ext = rd32(IGC_CTRL_EXT);
266 link_mode = ctrl_ext & IGC_CTRL_EXT_LINK_MODE_MASK; 306 link_mode = ctrl_ext & IGC_CTRL_EXT_LINK_MODE_MASK;
267 307