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

i2c: piix4: Add support for secondary SMBus on AMD SB800 and AMD FCH chipsets

Add support for the secondary SMBus controller on the AMD SB800 and AMD FCH
chipsets.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

authored by

Rudolf Marek and committed by
Wolfram Sang
a94dd00f d63a9e85

+35 -13
+4 -3
Documentation/i2c/busses/i2c-piix4
··· 73 73 The ServerWorks Southbridges, the Intel 440MX, and the Victory66 are 74 74 identical to the PIIX4 in I2C/SMBus support. 75 75 76 - The AMD SB700 and SP5100 chipsets implement two PIIX4-compatible SMBus 77 - controllers. If your BIOS initializes the secondary controller, it will 78 - be detected by this driver as an "Auxiliary SMBus Host Controller". 76 + The AMD SB700, SB800, SP5100 and Hudson-2 chipsets implement two 77 + PIIX4-compatible SMBus controllers. If your BIOS initializes the 78 + secondary controller, it will be detected by this driver as 79 + an "Auxiliary SMBus Host Controller". 79 80 80 81 If you own Force CPCI735 motherboard or other OSB4 based systems you may need 81 82 to change the SMBus Interrupt Select register so the SMBus controller uses
+31 -10
drivers/i2c/busses/i2c-piix4.c
··· 231 231 } 232 232 233 233 static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, 234 - const struct pci_device_id *id) 234 + const struct pci_device_id *id, u8 aux) 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 = 0x2c; 238 + u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en; 239 239 240 240 /* SB800 and later SMBus does not support forcing address */ 241 241 if (force || force_addr) { ··· 245 245 } 246 246 247 247 /* Determine the address of the SMBus areas */ 248 + smb_en = (aux) ? 0x28 : 0x2c; 249 + 248 250 if (!request_region(smba_idx, 2, "smba_idx")) { 249 251 dev_err(&PIIX4_dev->dev, "SMBus base address index region " 250 252 "0x%x already in use!\n", smba_idx); ··· 272 270 dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n", 273 271 piix4_smba); 274 272 return -EBUSY; 273 + } 274 + 275 + /* Aux SMBus does not support IRQ information */ 276 + if (aux) { 277 + dev_info(&PIIX4_dev->dev, 278 + "SMBus Host Controller at 0x%x\n", piix4_smba); 279 + return piix4_smba; 275 280 } 276 281 277 282 /* Request the SMBus I2C bus config region */ ··· 606 597 dev->revision >= 0x40) || 607 598 dev->vendor == PCI_VENDOR_ID_AMD) 608 599 /* base address location etc changed in SB800 */ 609 - retval = piix4_setup_sb800(dev, id); 600 + retval = piix4_setup_sb800(dev, id, 0); 610 601 else 611 602 retval = piix4_setup(dev, id); 612 603 ··· 620 611 return retval; 621 612 622 613 /* Check for auxiliary SMBus on some AMD chipsets */ 614 + retval = -ENODEV; 615 + 623 616 if (dev->vendor == PCI_VENDOR_ID_ATI && 624 - dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS && 625 - dev->revision < 0x40) { 626 - retval = piix4_setup_aux(dev, id, 0x58); 627 - if (retval > 0) { 628 - /* Try to add the aux adapter if it exists, 629 - * piix4_add_adapter will clean up if this fails */ 630 - piix4_add_adapter(dev, retval, &piix4_aux_adapter); 617 + dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS) { 618 + if (dev->revision < 0x40) { 619 + retval = piix4_setup_aux(dev, id, 0x58); 620 + } else { 621 + /* SB800 added aux bus too */ 622 + retval = piix4_setup_sb800(dev, id, 1); 631 623 } 624 + } 625 + 626 + if (dev->vendor == PCI_VENDOR_ID_AMD && 627 + dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) { 628 + retval = piix4_setup_sb800(dev, id, 1); 629 + } 630 + 631 + if (retval > 0) { 632 + /* Try to add the aux adapter if it exists, 633 + * piix4_add_adapter will clean up if this fails */ 634 + piix4_add_adapter(dev, retval, &piix4_aux_adapter); 632 635 } 633 636 634 637 return 0;