Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Shane Huang and committed by
Wolfram Sang
032f708b 3aacd625

+25 -6
+1 -1
Documentation/i2c/busses/i2c-piix4
··· 13 13 * AMD SP5100 (SB700 derivative found on some server mainboards) 14 14 Datasheet: Publicly available at the AMD website 15 15 http://support.amd.com/us/Embedded_TechDocs/44413.pdf 16 - * AMD Hudson-2, CZ 16 + * AMD Hudson-2, ML, CZ 17 17 Datasheet: Not publicly available 18 18 * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge 19 19 Datasheet: Publicly available at the SMSC website http://www.smsc.com
+1
drivers/i2c/busses/Kconfig
··· 152 152 ATI SB700/SP5100 153 153 ATI SB800 154 154 AMD Hudson-2 155 + AMD ML 155 156 AMD CZ 156 157 Serverworks OSB4 157 158 Serverworks CSB5
+23 -5
drivers/i2c/busses/i2c-piix4.c
··· 22 22 Intel PIIX4, 440MX 23 23 Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100 24 24 ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800 25 - AMD Hudson-2, CZ 25 + AMD Hudson-2, ML, CZ 26 26 SMSC Victory66 27 27 28 28 Note: we assume there can only be one device, with one or more ··· 235 235 { 236 236 unsigned short piix4_smba; 237 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 241 /* SB800 and later SMBus does not support forcing address */ 241 242 if (force || force_addr) { ··· 246 245 } 247 246 248 247 /* Determine the address of the SMBus areas */ 249 - smb_en = (aux) ? 0x28 : 0x2c; 248 + if ((PIIX4_dev->vendor == PCI_VENDOR_ID_AMD && 249 + PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS && 250 + PIIX4_dev->revision >= 0x41) || 251 + (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD && 252 + PIIX4_dev->device == 0x790b && 253 + PIIX4_dev->revision >= 0x49)) 254 + smb_en = 0x00; 255 + else 256 + smb_en = (aux) ? 0x28 : 0x2c; 250 257 251 258 if (!request_region(smba_idx, 2, "smba_idx")) { 252 259 dev_err(&PIIX4_dev->dev, "SMBus base address index region " ··· 267 258 smba_en_hi = inb_p(smba_idx + 1); 268 259 release_region(smba_idx, 2); 269 260 270 - if ((smba_en_lo & 1) == 0) { 261 + if (!smb_en) { 262 + smb_en_status = smba_en_lo & 0x10; 263 + piix4_smba = smba_en_hi << 8; 264 + if (aux) 265 + piix4_smba |= 0x20; 266 + } else { 267 + smb_en_status = smba_en_lo & 0x01; 268 + piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0; 269 + } 270 + 271 + if (!smb_en_status) { 271 272 dev_err(&PIIX4_dev->dev, 272 273 "Host SMBus controller not enabled!\n"); 273 274 return -ENODEV; 274 275 } 275 276 276 - piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0; 277 277 if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) 278 278 return -ENODEV; 279 279