diff options
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 8f16a47bcaf9..c31699d8df3a 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -122,7 +122,12 @@ static unsigned long i801_smba; | |||
122 | static unsigned char i801_original_hstcfg; | 122 | static unsigned char i801_original_hstcfg; |
123 | static struct pci_driver i801_driver; | 123 | static struct pci_driver i801_driver; |
124 | static struct pci_dev *I801_dev; | 124 | static struct pci_dev *I801_dev; |
125 | static int isich4; | 125 | |
126 | #define FEATURE_SMBUS_PEC (1 << 0) | ||
127 | #define FEATURE_BLOCK_BUFFER (1 << 1) | ||
128 | #define FEATURE_BLOCK_PROC (1 << 2) | ||
129 | #define FEATURE_I2C_BLOCK_READ (1 << 3) | ||
130 | static unsigned int i801_features; | ||
126 | 131 | ||
127 | static int i801_transaction(int xact) | 132 | static int i801_transaction(int xact) |
128 | { | 133 | { |
@@ -409,7 +414,8 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
409 | data->block[0] = 32; /* max for reads */ | 414 | data->block[0] = 32; /* max for reads */ |
410 | } | 415 | } |
411 | 416 | ||
412 | if (isich4 && i801_set_block_buffer_mode() == 0 ) | 417 | if ((i801_features & FEATURE_BLOCK_BUFFER) |
418 | && i801_set_block_buffer_mode() == 0) | ||
413 | result = i801_block_transaction_by_block(data, read_write, | 419 | result = i801_block_transaction_by_block(data, read_write, |
414 | hwpec); | 420 | hwpec); |
415 | else | 421 | else |
@@ -435,7 +441,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
435 | int block = 0; | 441 | int block = 0; |
436 | int ret, xact = 0; | 442 | int ret, xact = 0; |
437 | 443 | ||
438 | hwpec = isich4 && (flags & I2C_CLIENT_PEC) | 444 | hwpec = (i801_features & FEATURE_SMBUS_PEC) && (flags & I2C_CLIENT_PEC) |
439 | && size != I2C_SMBUS_QUICK | 445 | && size != I2C_SMBUS_QUICK |
440 | && size != I2C_SMBUS_I2C_BLOCK_DATA; | 446 | && size != I2C_SMBUS_I2C_BLOCK_DATA; |
441 | 447 | ||
@@ -523,9 +529,9 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
523 | static u32 i801_func(struct i2c_adapter *adapter) | 529 | static u32 i801_func(struct i2c_adapter *adapter) |
524 | { | 530 | { |
525 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 531 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
526 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 532 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | |
527 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK | 533 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK | |
528 | | (isich4 ? I2C_FUNC_SMBUS_PEC : 0); | 534 | ((i801_features & FEATURE_SMBUS_PEC) ? I2C_FUNC_SMBUS_PEC : 0); |
529 | } | 535 | } |
530 | 536 | ||
531 | static const struct i2c_algorithm smbus_algorithm = { | 537 | static const struct i2c_algorithm smbus_algorithm = { |
@@ -565,6 +571,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
565 | int err; | 571 | int err; |
566 | 572 | ||
567 | I801_dev = dev; | 573 | I801_dev = dev; |
574 | i801_features = 0; | ||
568 | switch (dev->device) { | 575 | switch (dev->device) { |
569 | case PCI_DEVICE_ID_INTEL_82801DB_3: | 576 | case PCI_DEVICE_ID_INTEL_82801DB_3: |
570 | case PCI_DEVICE_ID_INTEL_82801EB_3: | 577 | case PCI_DEVICE_ID_INTEL_82801EB_3: |
@@ -575,10 +582,9 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
575 | case PCI_DEVICE_ID_INTEL_ICH8_5: | 582 | case PCI_DEVICE_ID_INTEL_ICH8_5: |
576 | case PCI_DEVICE_ID_INTEL_ICH9_6: | 583 | case PCI_DEVICE_ID_INTEL_ICH9_6: |
577 | case PCI_DEVICE_ID_INTEL_TOLAPAI_1: | 584 | case PCI_DEVICE_ID_INTEL_TOLAPAI_1: |
578 | isich4 = 1; | 585 | i801_features |= FEATURE_SMBUS_PEC; |
586 | i801_features |= FEATURE_BLOCK_BUFFER; | ||
579 | break; | 587 | break; |
580 | default: | ||
581 | isich4 = 0; | ||
582 | } | 588 | } |
583 | 589 | ||
584 | err = pci_enable_device(dev); | 590 | err = pci_enable_device(dev); |