Skip to content

Commit a94dd00

Browse files
ruikruikWolfram Sang
authored andcommitted
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>
1 parent d63a9e8 commit a94dd00

2 files changed

Lines changed: 35 additions & 13 deletions

File tree

‎Documentation/i2c/busses/i2c-piix4‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ this driver on those mainboards.
7373
The ServerWorks Southbridges, the Intel 440MX, and the Victory66 are
7474
identical to the PIIX4 in I2C/SMBus support.
7575

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".
7980

8081
If you own Force CPCI735 motherboard or other OSB4 based systems you may need
8182
to change the SMBus Interrupt Select register so the SMBus controller uses

‎drivers/i2c/busses/i2c-piix4.c‎

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,11 @@ static int piix4_setup(struct pci_dev *PIIX4_dev,
231231
}
232232

233233
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)
235235
{
236236
unsigned short piix4_smba;
237237
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;
239239

240240
/* SB800 and later SMBus does not support forcing address */
241241
if (force || force_addr) {
@@ -245,6 +245,8 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
245245
}
246246

247247
/* Determine the address of the SMBus areas */
248+
smb_en = (aux) ? 0x28 : 0x2c;
249+
248250
if (!request_region(smba_idx, 2, "smba_idx")) {
249251
dev_err(&PIIX4_dev->dev, "SMBus base address index region "
250252
"0x%x already in use!\n", smba_idx);
@@ -272,6 +274,13 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
272274
return -EBUSY;
273275
}
274276

277+
/* Aux SMBus does not support IRQ information */
278+
if (aux) {
279+
dev_info(&PIIX4_dev->dev,
280+
"SMBus Host Controller at 0x%x\n", piix4_smba);
281+
return piix4_smba;
282+
}
283+
275284
/* Request the SMBus I2C bus config region */
276285
if (!request_region(piix4_smba + i2ccfg_offset, 1, "i2ccfg")) {
277286
dev_err(&PIIX4_dev->dev, "SMBus I2C bus config region "
@@ -597,7 +606,7 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
597606
dev->revision >= 0x40) ||
598607
dev->vendor == PCI_VENDOR_ID_AMD)
599608
/* base address location etc changed in SB800 */
600-
retval = piix4_setup_sb800(dev, id);
609+
retval = piix4_setup_sb800(dev, id, 0);
601610
else
602611
retval = piix4_setup(dev, id);
603612

@@ -611,17 +620,29 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
611620
return retval;
612621

613622
/* Check for auxiliary SMBus on some AMD chipsets */
623+
retval = -ENODEV;
624+
614625
if (dev->vendor == PCI_VENDOR_ID_ATI &&
615-
dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
616-
dev->revision < 0x40) {
617-
retval = piix4_setup_aux(dev, id, 0x58);
618-
if (retval > 0) {
619-
/* Try to add the aux adapter if it exists,
620-
* piix4_add_adapter will clean up if this fails */
621-
piix4_add_adapter(dev, retval, &piix4_aux_adapter);
626+
dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS) {
627+
if (dev->revision < 0x40) {
628+
retval = piix4_setup_aux(dev, id, 0x58);
629+
} else {
630+
/* SB800 added aux bus too */
631+
retval = piix4_setup_sb800(dev, id, 1);
622632
}
623633
}
624634

635+
if (dev->vendor == PCI_VENDOR_ID_AMD &&
636+
dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) {
637+
retval = piix4_setup_sb800(dev, id, 1);
638+
}
639+
640+
if (retval > 0) {
641+
/* Try to add the aux adapter if it exists,
642+
* piix4_add_adapter will clean up if this fails */
643+
piix4_add_adapter(dev, retval, &piix4_aux_adapter);
644+
}
645+
625646
return 0;
626647
}
627648

0 commit comments

Comments
 (0)