提交 ba9ad2af 编写于 作者: J Jean Delvare 提交者: Wolfram Sang

i2c: i801: Fix I2C Block Read on 8-Series/C220 and later

Starting with the 8-Series/C220 PCH (Lynx Point), the SMBus
controller includes a SPD EEPROM protection mechanism. Once the SPD
Write Disable bit is set, only reads are allowed to slave addresses
0x50-0x57.

However the legacy implementation of I2C Block Read since the ICH5
looks like a write, and is therefore blocked by the SPD protection
mechanism. This causes the eeprom and at24 drivers to fail.

So assume that I2C Block Read is implemented as an actual read on
these chipsets. I tested it on my Q87 chipset and it seems to work
just fine.
Signed-off-by: NJean Delvare <jdelvare@suse.de>
Tested-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
[wsa: rebased to v4.9-rc2]
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 60361601
...@@ -146,6 +146,7 @@ ...@@ -146,6 +146,7 @@
#define SMBHSTCFG_HST_EN 1 #define SMBHSTCFG_HST_EN 1
#define SMBHSTCFG_SMB_SMI_EN 2 #define SMBHSTCFG_SMB_SMI_EN 2
#define SMBHSTCFG_I2C_EN 4 #define SMBHSTCFG_I2C_EN 4
#define SMBHSTCFG_SPD_WD 0x10
/* TCO configuration bits for TCOCTL */ /* TCO configuration bits for TCOCTL */
#define TCOCTL_EN 0x0100 #define TCOCTL_EN 0x0100
...@@ -865,9 +866,16 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, ...@@ -865,9 +866,16 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
block = 1; block = 1;
break; break;
case I2C_SMBUS_I2C_BLOCK_DATA: case I2C_SMBUS_I2C_BLOCK_DATA:
/* NB: page 240 of ICH5 datasheet shows that the R/#W /*
* bit should be cleared here, even when reading */ * NB: page 240 of ICH5 datasheet shows that the R/#W
outb_p((addr & 0x7f) << 1, SMBHSTADD(priv)); * bit should be cleared here, even when reading.
* However if SPD Write Disable is set (Lynx Point and later),
* the read will fail if we don't set the R/#W bit.
*/
outb_p(((addr & 0x7f) << 1) |
((priv->original_hstcfg & SMBHSTCFG_SPD_WD) ?
(read_write & 0x01) : 0),
SMBHSTADD(priv));
if (read_write == I2C_SMBUS_READ) { if (read_write == I2C_SMBUS_READ) {
/* NB: page 240 of ICH5 datasheet also shows /* NB: page 240 of ICH5 datasheet also shows
* that DATA1 is the cmd field when reading */ * that DATA1 is the cmd field when reading */
...@@ -1573,6 +1581,8 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -1573,6 +1581,8 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
/* Disable SMBus interrupt feature if SMBus using SMI# */ /* Disable SMBus interrupt feature if SMBus using SMI# */
priv->features &= ~FEATURE_IRQ; priv->features &= ~FEATURE_IRQ;
} }
if (temp & SMBHSTCFG_SPD_WD)
dev_info(&dev->dev, "SPD Write Disable is set\n");
/* Clear special mode bits */ /* Clear special mode bits */
if (priv->features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER)) if (priv->features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册