Changeset 1093

Show
Ignore:
Timestamp:
05/26/01 23:23:40 (14 years ago)
Author:
mds
Message:

Apply tristate patch from Jesus Arias <jesus@…>

which ensures i2c Bus is tristated correctly. It isn't clear from
the datasheet if the 586's GPIO pins are open drain or not,
but if they aren't, then the driver was driving the pins high
rather than letting them get pulled high as the spec requires.
This is corrected by toggling the direction rather than the
data register to control the bus.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r1090 r1093  
    4141  Module i2c-i810: Fixed i2c_i810_init() not found in patched kernel 
    4242  Module i2c-sis5595: Allow force_addr=0xaddr; enable if not enabled. 
     43  Module i2c-via: Ensure i2c bus is tristated correctly. 
    4344  Module lm78: Recognize chipid=0x20 
    4445  Module lm87: Fix in0, in1 (2.5V and Vccp1) calculations 
  • lm-sensors/trunk/kernel/busses/i2c-via.c

    r707 r1093  
    6464static u16 pm_io_base; 
    6565 
     66/* 
     67   It does not appear from the datasheet that the GPIO pins are 
     68   open drain. So a we set a low value by setting the direction to 
     69   output and a high value by setting the direction to input and 
     70   relying on the required I2C pullup. The data value is initialized 
     71   to 0 in i2c_via_init() and never changed. 
     72*/ 
     73 
    6674static void bit_via_setscl(void *data, int state) 
    6775{ 
    68         outb(state ? inb(I2C_OUT) | I2C_SCL : inb(I2C_OUT) & ~I2C_SCL, 
    69              I2C_OUT); 
     76        outb(state ? inb(I2C_DIR) & ~I2C_SCL : inb(I2C_DIR) | I2C_SCL, 
     77             I2C_DIR); 
    7078} 
    7179 
    7280static void bit_via_setsda(void *data, int state) 
    7381{ 
    74         outb(state ? inb(I2C_OUT) | I2C_SDA : inb(I2C_OUT) & ~I2C_SDA, 
    75              I2C_OUT); 
     82        outb(state ? inb(I2C_DIR) & ~I2C_SDA : inb(I2C_DIR) | I2C_SDA, 
     83             I2C_DIR); 
    7684} 
    7785 
     
    180188        } else { 
    181189                request_region(I2C_DIR, IOSPACE, IOTEXT); 
    182                 outb(inb(I2C_DIR) | I2C_SDA | I2C_SCL, I2C_DIR); 
    183                 outb(inb(I2C_OUT) | I2C_SDA | I2C_SCL, I2C_OUT); 
     190                outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR); 
     191                outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT); 
    184192        } 
    185193 
     
    188196                return 0; 
    189197        } else { 
    190                 outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR); 
    191198                release_region(I2C_DIR, IOSPACE); 
    192199                printk