Skip to contentSkip to conversation

sky2: Hold phy lock when accessing phy registers

PATCH In review Mike McCormack 1 participant 1 message Oct 12, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 sky2: Hold phy lock when accessing phy registers

The phy lock should be held around gm_phy_read.

This is probably another theoretical problem, however
we should do this for consistency purposes.

---
 drivers/net/sky2.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/sky2.c +2 -0
index 67c8478..0e1a4bc 100644
@@ -830,6 +830,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
 	if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev == 0 && port == 1) {
 		/* WA DEV_472 -- looks like crossed wires on port 2 */
 		/* clear GMAC 1 Control reset */
+		spin_lock_bh(&sky2->phy_lock);
 		sky2_write8(hw, SK_REG(0, GMAC_CTRL), GMC_RST_CLR);
 		do {
 			sky2_write8(hw, SK_REG(1, GMAC_CTRL), GMC_RST_SET);
@@ -837,6 +838,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
 		} while (gm_phy_read(hw, 1, PHY_MARV_ID0) != PHY_MARV_ID0_VAL ||
 			 gm_phy_read(hw, 1, PHY_MARV_ID1) != PHY_MARV_ID1_Y2 ||
 			 gm_phy_read(hw, 1, PHY_MARV_INT_MASK) != 0);
+		spin_unlock_bh(&sky2->phy_lock);
 	}
 
 	sky2_read16(hw, SK_REG(port, GMAC_IRQ_SRC));
Signature · 1 line
1.5.6.5