diff options
author | Eric Anholt <eric@anholt.net> | 2006-11-30 15:56:52 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2006-11-30 15:57:02 -0800 |
commit | 8c44556408601db2be799b5ac5c4da1d92886d31 (patch) | |
tree | bb1d80fa64ffe194d3763c927fbda925ba5bc3db | |
parent | 28401b25cc5c1afb272e506cef196ba3a1258bd3 (diff) |
Preserve some GPIO bits that the docs tell us to.
-rw-r--r-- | src/i810_reg.h | 2 | ||||
-rw-r--r-- | src/i830_i2c.c | 27 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/i810_reg.h b/src/i810_reg.h index e9319344..7312f8a4 100644 --- a/src/i810_reg.h +++ b/src/i810_reg.h @@ -281,12 +281,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # define GPIO_CLOCK_VAL_MASK (1 << 2) # define GPIO_CLOCK_VAL_OUT (1 << 3) # define GPIO_CLOCK_VAL_IN (1 << 4) +# define GPIO_CLOCK_PULLUP_DISABLE (1 << 5) # define GPIO_DATA_DIR_MASK (1 << 8) # define GPIO_DATA_DIR_IN (0 << 9) # define GPIO_DATA_DIR_OUT (1 << 9) # define GPIO_DATA_VAL_MASK (1 << 10) # define GPIO_DATA_VAL_OUT (1 << 11) # define GPIO_DATA_VAL_IN (1 << 12) +# define GPIO_DATA_PULLUP_DISABLE (1 << 13) /* p317, 319 */ diff --git a/src/i830_i2c.c b/src/i830_i2c.c index ea828ffb..973ca615 100644 --- a/src/i830_i2c.c +++ b/src/i830_i2c.c @@ -283,6 +283,8 @@ static Bool first = TRUE; static void i830I2CPutBits(I2CBusPtr b, int clock, int data) { + CARD32 reserved = 0; + #if I2C_DEBUG int cur_clock, cur_data; char *debug = ""; @@ -310,7 +312,7 @@ i830I2CPutBits(I2CBusPtr b, int clock, int data) } ErrorF("Setting I2C 0x%08x to: %c %c (at: %c %c)%s\n", - b->DriverPrivate.uval, + (int)b->DriverPrivate.uval, clock ? '^' : 'v', data ? '^' : 'v', cur_clock ? '^' : 'v', @@ -318,15 +320,22 @@ i830I2CPutBits(I2CBusPtr b, int clock, int data) debug); #endif + if (!IS_I830(pI830) && !IS_845G(pI830)) { + /* On most chips, these bits must be preserved in software. */ + reserved = INREG(b->DriverPrivate.uval) & + (GPIO_DATA_PULLUP_DISABLE | GPIO_CLOCK_PULLUP_DISABLE); + } + OUTREG(b->DriverPrivate.uval, - (data ? GPIO_DATA_VAL_OUT : 0) | - (clock ? GPIO_CLOCK_VAL_OUT : 0) | - GPIO_CLOCK_DIR_OUT | - GPIO_DATA_DIR_OUT | - GPIO_CLOCK_DIR_MASK | - GPIO_CLOCK_VAL_MASK | - GPIO_DATA_DIR_MASK | - GPIO_DATA_VAL_MASK); + reserved | + (data ? GPIO_DATA_VAL_OUT : 0) | + (clock ? GPIO_CLOCK_VAL_OUT : 0) | + GPIO_CLOCK_DIR_OUT | + GPIO_DATA_DIR_OUT | + GPIO_CLOCK_DIR_MASK | + GPIO_CLOCK_VAL_MASK | + GPIO_DATA_DIR_MASK | + GPIO_DATA_VAL_MASK); } #endif |