On an i2c bus, scl and sda are pulled high through pull-up resistors. Thus,
turning off the output drivers is enough to get a logical 1 when necessary
and allows the salve to pull down the nets to do clock stretching or to
generate ACK conditions. This patch does just that: output drivers are tuned off
if a logical 1 is to be driven on the sda or scl line.

Signed-off-by: Jean-Hugues Deschenes <jean-hugues.desche...@octasic.com>
Index: igb-5.2.9.4-ori/src/igb_main.c
===================================================================
--- igb-5.2.9.4-ori.orig/src/igb_main.c 2014-11-26 11:20:27.395762986 -0500
+++ igb-5.2.9.4-ori/src/igb_main.c      2014-11-26 13:04:30.845271718 -0500
@@ -1657,12 +1657,9 @@
        s32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS);
 
        if (state)
-               i2cctl |= E1000_I2C_DATA_OUT;
+               i2cctl |= E1000_I2C_DATA_OUT | E1000_I2C_DATA_OE_N;
        else
-               i2cctl &= ~E1000_I2C_DATA_OUT;
-
-       i2cctl &= ~E1000_I2C_DATA_OE_N;
-       i2cctl |= E1000_I2C_CLK_OE_N;
+               i2cctl &= ~E1000_I2C_DATA_OUT & ~E1000_I2C_DATA_OE_N;
 
        E1000_WRITE_REG(hw, E1000_I2CPARAMS, i2cctl);
        E1000_WRITE_FLUSH(hw);
@@ -1681,13 +1678,11 @@
        struct e1000_hw *hw = &adapter->hw;
        s32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS);
 
-       if (state) {
-               i2cctl |= E1000_I2C_CLK_OUT;
-               i2cctl &= ~E1000_I2C_CLK_OE_N;
-       } else {
-               i2cctl &= ~E1000_I2C_CLK_OUT;
-               i2cctl &= ~E1000_I2C_CLK_OE_N;
-       }
+       if (state)
+               i2cctl |= E1000_I2C_CLK_OUT | E1000_I2C_CLK_OE_N;
+       else
+               i2cctl &= ~E1000_I2C_CLK_OUT & ~E1000_I2C_CLK_OE_N;
+
        E1000_WRITE_REG(hw, E1000_I2CPARAMS, i2cctl);
        E1000_WRITE_FLUSH(hw);
 }


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to