|
@@ -28,9 +28,6 @@
|
|
|
|
|
|
#include "e1000.h"
|
|
|
|
|
|
-static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw);
|
|
|
-static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw);
|
|
|
-static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
|
|
|
static s32 e1000_wait_autoneg(struct e1000_hw *hw);
|
|
|
static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
|
|
|
u16 *data, bool read, bool page_set);
|
|
@@ -791,7 +788,7 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
|
|
|
if (ret_val)
|
|
|
return ret_val;
|
|
|
/* Commit the changes. */
|
|
|
- ret_val = e1000e_commit_phy(hw);
|
|
|
+ ret_val = phy->ops.commit(hw);
|
|
|
if (ret_val) {
|
|
|
e_dbg("Error committing the PHY changes\n");
|
|
|
return ret_val;
|
|
@@ -847,10 +844,12 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
|
|
|
}
|
|
|
|
|
|
/* Commit the changes. */
|
|
|
- ret_val = e1000e_commit_phy(hw);
|
|
|
- if (ret_val) {
|
|
|
- e_dbg("Error committing the PHY changes\n");
|
|
|
- return ret_val;
|
|
|
+ if (phy->ops.commit) {
|
|
|
+ ret_val = phy->ops.commit(hw);
|
|
|
+ if (ret_val) {
|
|
|
+ e_dbg("Error committing the PHY changes\n");
|
|
|
+ return ret_val;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (phy->type == e1000_phy_82578) {
|
|
@@ -894,10 +893,12 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)
|
|
|
msleep(100);
|
|
|
|
|
|
/* disable lplu d0 during driver init */
|
|
|
- ret_val = e1000_set_d0_lplu_state(hw, false);
|
|
|
- if (ret_val) {
|
|
|
- e_dbg("Error Disabling LPLU D0\n");
|
|
|
- return ret_val;
|
|
|
+ if (hw->phy.ops.set_d0_lplu_state) {
|
|
|
+ ret_val = hw->phy.ops.set_d0_lplu_state(hw, false);
|
|
|
+ if (ret_val) {
|
|
|
+ e_dbg("Error Disabling LPLU D0\n");
|
|
|
+ return ret_val;
|
|
|
+ }
|
|
|
}
|
|
|
/* Configure mdi-mdix settings */
|
|
|
ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &data);
|
|
@@ -1195,7 +1196,7 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
|
|
|
* depending on user settings.
|
|
|
*/
|
|
|
e_dbg("Forcing Speed and Duplex\n");
|
|
|
- ret_val = e1000_phy_force_speed_duplex(hw);
|
|
|
+ ret_val = hw->phy.ops.force_speed_duplex(hw);
|
|
|
if (ret_val) {
|
|
|
e_dbg("Error Forcing Speed and Duplex\n");
|
|
|
return ret_val;
|
|
@@ -1325,9 +1326,11 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
|
|
|
return ret_val;
|
|
|
|
|
|
/* Reset the phy to commit changes. */
|
|
|
- ret_val = e1000e_commit_phy(hw);
|
|
|
- if (ret_val)
|
|
|
- return ret_val;
|
|
|
+ if (hw->phy.ops.commit) {
|
|
|
+ ret_val = hw->phy.ops.commit(hw);
|
|
|
+ if (ret_val)
|
|
|
+ return ret_val;
|
|
|
+ }
|
|
|
|
|
|
if (phy->autoneg_wait_to_complete) {
|
|
|
e_dbg("Waiting for forced speed/duplex link on M88 phy.\n");
|
|
@@ -1961,7 +1964,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
|
|
|
phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX);
|
|
|
|
|
|
if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) {
|
|
|
- ret_val = e1000_get_cable_length(hw);
|
|
|
+ ret_val = hw->phy.ops.get_cable_length(hw);
|
|
|
if (ret_val)
|
|
|
return ret_val;
|
|
|
|
|
@@ -2025,7 +2028,7 @@ s32 e1000e_get_phy_info_igp(struct e1000_hw *hw)
|
|
|
|
|
|
if ((data & IGP01E1000_PSSR_SPEED_MASK) ==
|
|
|
IGP01E1000_PSSR_SPEED_1000MBPS) {
|
|
|
- ret_val = e1000_get_cable_length(hw);
|
|
|
+ ret_val = phy->ops.get_cable_length(hw);
|
|
|
if (ret_val)
|
|
|
return ret_val;
|
|
|
|
|
@@ -2165,17 +2168,17 @@ s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw)
|
|
|
|
|
|
phy->ops.release(hw);
|
|
|
|
|
|
- return e1000_get_phy_cfg_done(hw);
|
|
|
+ return phy->ops.get_cfg_done(hw);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * e1000e_get_cfg_done - Generic configuration done
|
|
|
+ * e1000e_get_cfg_done_generic - Generic configuration done
|
|
|
* @hw: pointer to the HW structure
|
|
|
*
|
|
|
* Generic function to wait 10 milli-seconds for configuration to complete
|
|
|
* and return success.
|
|
|
**/
|
|
|
-s32 e1000e_get_cfg_done(struct e1000_hw *hw)
|
|
|
+s32 e1000e_get_cfg_done_generic(struct e1000_hw *hw)
|
|
|
{
|
|
|
mdelay(10);
|
|
|
|
|
@@ -2265,38 +2268,6 @@ s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-/* Internal function pointers */
|
|
|
-
|
|
|
-/**
|
|
|
- * e1000_get_phy_cfg_done - Generic PHY configuration done
|
|
|
- * @hw: pointer to the HW structure
|
|
|
- *
|
|
|
- * Return success if silicon family did not implement a family specific
|
|
|
- * get_cfg_done function.
|
|
|
- **/
|
|
|
-static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw)
|
|
|
-{
|
|
|
- if (hw->phy.ops.get_cfg_done)
|
|
|
- return hw->phy.ops.get_cfg_done(hw);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * e1000_phy_force_speed_duplex - Generic force PHY speed/duplex
|
|
|
- * @hw: pointer to the HW structure
|
|
|
- *
|
|
|
- * When the silicon family has not implemented a forced speed/duplex
|
|
|
- * function for the PHY, simply return 0.
|
|
|
- **/
|
|
|
-static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
|
|
|
-{
|
|
|
- if (hw->phy.ops.force_speed_duplex)
|
|
|
- return hw->phy.ops.force_speed_duplex(hw);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* e1000e_get_phy_type_from_id - Get PHY type from id
|
|
|
* @phy_id: phy_id read from the phy
|
|
@@ -2804,43 +2775,6 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw)
|
|
|
usleep_range(1000, 2000);
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * e1000e_commit_phy - Soft PHY reset
|
|
|
- * @hw: pointer to the HW structure
|
|
|
- *
|
|
|
- * Performs a soft PHY reset on those that apply. This is a function pointer
|
|
|
- * entry point called by drivers.
|
|
|
- **/
|
|
|
-s32 e1000e_commit_phy(struct e1000_hw *hw)
|
|
|
-{
|
|
|
- if (hw->phy.ops.commit)
|
|
|
- return hw->phy.ops.commit(hw);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * e1000_set_d0_lplu_state - Sets low power link up state for D0
|
|
|
- * @hw: pointer to the HW structure
|
|
|
- * @active: boolean used to enable/disable lplu
|
|
|
- *
|
|
|
- * Success returns 0, Failure returns 1
|
|
|
- *
|
|
|
- * The low power link up (lplu) state is set to the power management level D0
|
|
|
- * and SmartSpeed is disabled when active is true, else clear lplu for D0
|
|
|
- * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
|
|
|
- * is used during Dx states where the power conservation is most important.
|
|
|
- * During driver activity, SmartSpeed should be enabled so performance is
|
|
|
- * maintained. This is a function pointer entry point called by drivers.
|
|
|
- **/
|
|
|
-static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
|
|
|
-{
|
|
|
- if (hw->phy.ops.set_d0_lplu_state)
|
|
|
- return hw->phy.ops.set_d0_lplu_state(hw, active);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* __e1000_read_phy_reg_hv - Read HV PHY register
|
|
|
* @hw: pointer to the HW structure
|