]> Pileus Git - ~andy/linux/blobdiff - drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
Merge tag 'for-linus-Jun-21-2012' of git://oss.sgi.com/xfs/xfs
[~andy/linux] / drivers / net / ethernet / intel / ixgbe / ixgbe_phy.c
index bf9f82f4b1aebc517a8710b266f0031b94dcd2f8..24117709d6a2164ec47f92b045f3be48fdda3ad5 100644 (file)
@@ -1582,13 +1582,21 @@ static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data)
  **/
 static void ixgbe_raise_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl)
 {
-       *i2cctl |= IXGBE_I2C_CLK_OUT;
-
-       IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl);
-       IXGBE_WRITE_FLUSH(hw);
+       u32 i = 0;
+       u32 timeout = IXGBE_I2C_CLOCK_STRETCHING_TIMEOUT;
+       u32 i2cctl_r = 0;
 
-       /* SCL rise time (1000ns) */
-       udelay(IXGBE_I2C_T_RISE);
+       for (i = 0; i < timeout; i++) {
+               *i2cctl |= IXGBE_I2C_CLK_OUT;
+               IXGBE_WRITE_REG(hw, IXGBE_I2CCTL, *i2cctl);
+               IXGBE_WRITE_FLUSH(hw);
+               /* SCL rise time (1000ns) */
+               udelay(IXGBE_I2C_T_RISE);
+
+               i2cctl_r = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
+               if (i2cctl_r & IXGBE_I2C_CLK_IN)
+                       break;
+       }
 }
 
 /**