diff options
author | Shane Huang <shane.huang@amd.com> | 2014-01-22 17:05:46 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-01-24 11:48:51 -0500 |
commit | 032f708bc4f6da868ec49dac48ddf3670d8035d3 (patch) | |
tree | a07fe98709ce0f981ce7aecf2def498cb6c3a4dc /drivers | |
parent | 3aacd625f20129f5a41ea3ff3b5353b0e4dabd01 (diff) |
i2c: piix4: Add support for AMD ML and CZ SMBus changes
The locations of SMBus register base address and enablement bit are changed
from AMD ML, which need this patch to be supported.
Signed-off-by: Shane Huang <shane.huang@amd.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/Kconfig | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-piix4.c | 28 |
2 files changed, 24 insertions, 5 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 6bcdea5856af..f5ed03164d86 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -152,6 +152,7 @@ config I2C_PIIX4 | |||
152 | ATI SB700/SP5100 | 152 | ATI SB700/SP5100 |
153 | ATI SB800 | 153 | ATI SB800 |
154 | AMD Hudson-2 | 154 | AMD Hudson-2 |
155 | AMD ML | ||
155 | AMD CZ | 156 | AMD CZ |
156 | Serverworks OSB4 | 157 | Serverworks OSB4 |
157 | Serverworks CSB5 | 158 | Serverworks CSB5 |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index a028617b8f13..f71b4d381c00 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -22,7 +22,7 @@ | |||
22 | Intel PIIX4, 440MX | 22 | Intel PIIX4, 440MX |
23 | Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100 | 23 | Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100 |
24 | ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800 | 24 | ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800 |
25 | AMD Hudson-2, CZ | 25 | AMD Hudson-2, ML, CZ |
26 | SMSC Victory66 | 26 | SMSC Victory66 |
27 | 27 | ||
28 | Note: we assume there can only be one device, with one or more | 28 | Note: we assume there can only be one device, with one or more |
@@ -235,7 +235,8 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, | |||
235 | { | 235 | { |
236 | unsigned short piix4_smba; | 236 | unsigned short piix4_smba; |
237 | unsigned short smba_idx = 0xcd6; | 237 | unsigned short smba_idx = 0xcd6; |
238 | u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en; | 238 | u8 smba_en_lo, smba_en_hi, smb_en, smb_en_status; |
239 | u8 i2ccfg, i2ccfg_offset = 0x10; | ||
239 | 240 | ||
240 | /* SB800 and later SMBus does not support forcing address */ | 241 | /* SB800 and later SMBus does not support forcing address */ |
241 | if (force || force_addr) { | 242 | if (force || force_addr) { |
@@ -245,7 +246,15 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, | |||
245 | } | 246 | } |
246 | 247 | ||
247 | /* Determine the address of the SMBus areas */ | 248 | /* Determine the address of the SMBus areas */ |
248 | smb_en = (aux) ? 0x28 : 0x2c; | 249 | if ((PIIX4_dev->vendor == PCI_VENDOR_ID_AMD && |
250 | PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS && | ||
251 | PIIX4_dev->revision >= 0x41) || | ||
252 | (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD && | ||
253 | PIIX4_dev->device == 0x790b && | ||
254 | PIIX4_dev->revision >= 0x49)) | ||
255 | smb_en = 0x00; | ||
256 | else | ||
257 | smb_en = (aux) ? 0x28 : 0x2c; | ||
249 | 258 | ||
250 | if (!request_region(smba_idx, 2, "smba_idx")) { | 259 | if (!request_region(smba_idx, 2, "smba_idx")) { |
251 | dev_err(&PIIX4_dev->dev, "SMBus base address index region " | 260 | dev_err(&PIIX4_dev->dev, "SMBus base address index region " |
@@ -258,13 +267,22 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, | |||
258 | smba_en_hi = inb_p(smba_idx + 1); | 267 | smba_en_hi = inb_p(smba_idx + 1); |
259 | release_region(smba_idx, 2); | 268 | release_region(smba_idx, 2); |
260 | 269 | ||
261 | if ((smba_en_lo & 1) == 0) { | 270 | if (!smb_en) { |
271 | smb_en_status = smba_en_lo & 0x10; | ||
272 | piix4_smba = smba_en_hi << 8; | ||
273 | if (aux) | ||
274 | piix4_smba |= 0x20; | ||
275 | } else { | ||
276 | smb_en_status = smba_en_lo & 0x01; | ||
277 | piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0; | ||
278 | } | ||
279 | |||
280 | if (!smb_en_status) { | ||
262 | dev_err(&PIIX4_dev->dev, | 281 | dev_err(&PIIX4_dev->dev, |
263 | "Host SMBus controller not enabled!\n"); | 282 | "Host SMBus controller not enabled!\n"); |
264 | return -ENODEV; | 283 | return -ENODEV; |
265 | } | 284 | } |
266 | 285 | ||
267 | piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0; | ||
268 | if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) | 286 | if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) |
269 | return -ENODEV; | 287 | return -ENODEV; |
270 | 288 | ||