Skip to content

Commit 6133406

Browse files
pgreenwaJeff Kirsher
authored andcommitted
ixgbe: Acquire PHY semaphore before device reset
A recent firmware change fixed an issue to acquire the PHY semaphore before accessing PHY registers. This led to a case where SW can issue a device reset clearing the MDIO registers. This patch makes SW acquire the PHY semaphore before issuing a device reset. Signed-off-by: Paul Greenwalt <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 4c042a8 commit 6133406

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ s32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw)
9595
{
9696
s32 status;
9797
u32 ctrl, i;
98+
u32 swfw_mask = hw->phy.phy_semaphore_mask;
9899

99100
/* Call adapter stop to disable tx/rx and clear interrupts */
100101
status = hw->mac.ops.stop_adapter(hw);
@@ -105,10 +106,17 @@ s32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw)
105106
ixgbe_clear_tx_pending(hw);
106107

107108
mac_reset_top:
109+
status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
110+
if (status) {
111+
hw_dbg(hw, "semaphore failed with %d", status);
112+
return IXGBE_ERR_SWFW_SYNC;
113+
}
114+
108115
ctrl = IXGBE_CTRL_RST;
109116
ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
110117
IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
111118
IXGBE_WRITE_FLUSH(hw);
119+
hw->mac.ops.release_swfw_sync(hw, swfw_mask);
112120
usleep_range(1000, 1200);
113121

114122
/* Poll for reset bit to self-clear indicating reset is complete */

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3318,6 +3318,7 @@ static s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw)
33183318
u32 ctrl = 0;
33193319
u32 i;
33203320
bool link_up = false;
3321+
u32 swfw_mask = hw->phy.phy_semaphore_mask;
33213322

33223323
/* Call adapter stop to disable Tx/Rx and clear interrupts */
33233324
status = hw->mac.ops.stop_adapter(hw);
@@ -3363,9 +3364,16 @@ static s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw)
33633364
ctrl = IXGBE_CTRL_RST;
33643365
}
33653366

3367+
status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
3368+
if (status) {
3369+
hw_dbg(hw, "semaphore failed with %d", status);
3370+
return IXGBE_ERR_SWFW_SYNC;
3371+
}
3372+
33663373
ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
33673374
IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
33683375
IXGBE_WRITE_FLUSH(hw);
3376+
hw->mac.ops.release_swfw_sync(hw, swfw_mask);
33693377
usleep_range(1000, 1200);
33703378

33713379
/* Poll for reset bit to self-clear meaning reset is complete */

0 commit comments

Comments
 (0)