Changeset 2792 for lm-sensors/trunk/kernel/busses/i2c-i801.c
- Timestamp:
- 12/08/04 05:55:45 (8 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/kernel/busses/i2c-i801.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/kernel/busses/i2c-i801.c
r2791 r2792 30 30 82801EB 24D3 (HW PEC supported, 32 byte buffer not supported) 31 31 6300ESB 25A4 ("") 32 ICH6 266A 32 ICH6 266A ("") 33 33 This driver supports several versions of Intel's I/O Controller Hubs (ICH). 34 34 For SMBus support, they are similar to the PIIX4 and are part 35 35 of Intel's '810' and other chipsets. 36 36 See the doc/busses/i2c-i801 file for details. 37 I2C Block Read and Process Call are not supported. 37 I2C Block Read supported for ICH5 and higher. 38 Block Process Call are not supported. 38 39 */ 39 40 … … 96 97 #define I801_PROC_CALL 0x10 /* later chips only, unimplemented */ 97 98 #define I801_BLOCK_DATA 0x14 98 #define I801_I2C_BLOCK_DATA 0x18 /* unimplemented*/99 #define I801_I2C_BLOCK_DATA 0x18 /* ich4 and later */ 99 100 #define I801_BLOCK_LAST 0x34 100 101 #define I801_I2C_BLOCK_LAST 0x38 /* unimplemented */ 101 102 #define I801_START 0x40 102 #define I801_PEC_EN 0x80 /* ICH4 only*/103 #define I801_PEC_EN 0x80 /* ich4 and later */ 103 104 104 105 /* insmod parameters */ … … 118 119 static unsigned short i801_smba; 119 120 static struct pci_dev *I801_dev; 120 static int isich4; 121 static int isich4; /* is PEC supported? */ 122 static int isich5; /* is i2c block read supported? */ 121 123 122 124 static int i801_setup(struct pci_dev *dev) … … 137 139 else 138 140 isich4 = 0; 141 isich5 = isich4 && dev->device != PCI_DEVICE_ID_INTEL_82801DB_3; 139 142 140 143 /* Determine the address of the SMBus areas */ … … 276 279 pci_write_config_byte(I801_dev, SMBHSTCFG, 277 280 hostc | SMBHSTCFG_I2C_EN); 278 } else {281 } else if (!isich5) { 279 282 dev_err(I801_dev, 280 283 "I2C_SMBUS_I2C_BLOCK_READ unsupported!\n"); … … 302 305 if (i == len && read_write == I2C_SMBUS_READ) 303 306 smbcmd = I801_BLOCK_LAST; 307 else if (command == I2C_SMBUS_I2C_BLOCK_DATA && 308 read_write == I2C_SMBUS_READ) 309 smbcmd = I801_I2C_BLOCK_DATA; 304 310 else 305 311 smbcmd = I801_BLOCK_DATA; … … 370 376 371 377 if (i == 1 && read_write == I2C_SMBUS_READ) { 372 len = inb_p(SMBHSTDAT0); 373 if (len < 1) 374 len = 1; 375 if (len > 32) 376 len = 32; 377 data->block[0] = len; 378 if (command != I2C_SMBUS_I2C_BLOCK_DATA) { 379 len = inb_p(SMBHSTDAT0); 380 if (len < 1) 381 len = 1; 382 if (len > 32) 383 len = 32; 384 data->block[0] = len; 385 } else { 386 /* if slave returns < 32 bytes transaction will fail */ 387 data->block[0] = 32; 388 } 378 389 } 379 390 … … 418 429 result = 0; 419 430 END: 420 if (command == I2C_SMBUS_I2C_BLOCK_DATA) { 431 if (command == I2C_SMBUS_I2C_BLOCK_DATA && 432 read_write == I2C_SMBUS_WRITE) { 421 433 /* restore saved configuration register value */ 422 434 pci_write_config_byte(I801_dev, SMBHSTCFG, hostc); … … 553 565 : 0) 554 566 #endif 567 | (isich5 ? I2C_FUNC_SMBUS_READ_I2C_BLOCK 568 : 0) 555 569 ; 556 570 }
