Skip to content

Commit de52a12

Browse files
dcskidmoJeff Kirsher
authored andcommitted
ixgbe: Add function ixgbe_reset_pipeline_82599
This patch adds a function that forces a full pipeline reset. This function will be used in following patches to completely reset the PHY during resets. Signed-off-by: Don Skidmore <[email protected]> Tested-by: Phil Schmitt <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 505e371 commit de52a12

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,6 +2080,50 @@ static s32 ixgbe_read_eeprom_82599(struct ixgbe_hw *hw,
20802080
return ret_val;
20812081
}
20822082

2083+
/**
2084+
* ixgbe_reset_pipeline_82599 - perform pipeline reset
2085+
*
2086+
* @hw: pointer to hardware structure
2087+
*
2088+
* Reset pipeline by asserting Restart_AN together with LMS change to ensure
2089+
* full pipeline reset. Note - We must hold the SW/FW semaphore before writing
2090+
* to AUTOC, so this function assumes the semaphore is held.
2091+
**/
2092+
s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
2093+
{
2094+
s32 i, autoc_reg, ret_val;
2095+
s32 anlp1_reg = 0;
2096+
2097+
autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
2098+
autoc_reg |= IXGBE_AUTOC_AN_RESTART;
2099+
2100+
/* Write AUTOC register with toggled LMS[2] bit and Restart_AN */
2101+
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg ^ IXGBE_AUTOC_LMS_1G_AN);
2102+
2103+
/* Wait for AN to leave state 0 */
2104+
for (i = 0; i < 10; i++) {
2105+
usleep_range(4000, 8000);
2106+
anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1);
2107+
if (anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)
2108+
break;
2109+
}
2110+
2111+
if (!(anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)) {
2112+
hw_dbg(hw, "auto negotiation not completed\n");
2113+
ret_val = IXGBE_ERR_RESET_FAILED;
2114+
goto reset_pipeline_out;
2115+
}
2116+
2117+
ret_val = 0;
2118+
2119+
reset_pipeline_out:
2120+
/* Write AUTOC register with original LMS field and Restart_AN */
2121+
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2122+
IXGBE_WRITE_FLUSH(hw);
2123+
2124+
return ret_val;
2125+
}
2126+
20832127
static struct ixgbe_mac_operations mac_ops_82599 = {
20842128
.init_hw = &ixgbe_init_hw_generic,
20852129
.reset_hw = &ixgbe_reset_hw_82599,

drivers/net/ethernet/intel/ixgbe/ixgbe_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
107107

108108
void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int num_pb,
109109
u32 headroom, int strategy);
110+
s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
110111

111112
#define IXGBE_I2C_THERMAL_SENSOR_ADDR 0xF8
112113
#define IXGBE_EMC_INTERNAL_DATA 0x00

0 commit comments

Comments
 (0)