Skip to content

Commit 032f708

Browse files
Shane HuangWolfram Sang
authored andcommitted
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
1 parent 3aacd62 commit 032f708

3 files changed

Lines changed: 25 additions & 6 deletions

File tree

‎Documentation/i2c/busses/i2c-piix4‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Supported adapters:
1313
* AMD SP5100 (SB700 derivative found on some server mainboards)
1414
Datasheet: Publicly available at the AMD website
1515
http://support.amd.com/us/Embedded_TechDocs/44413.pdf
16-
* AMD Hudson-2, CZ
16+
* AMD Hudson-2, ML, CZ
1717
Datasheet: Not publicly available
1818
* Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge
1919
Datasheet: Publicly available at the SMSC website http://www.smsc.com

‎drivers/i2c/busses/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ config I2C_PIIX4
152152
ATI SB700/SP5100
153153
ATI SB800
154154
AMD Hudson-2
155+
AMD ML
155156
AMD CZ
156157
Serverworks OSB4
157158
Serverworks CSB5

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
Intel PIIX4, 440MX
2323
Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100
2424
ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800
25-
AMD Hudson-2, CZ
25+
AMD Hudson-2, ML, CZ
2626
SMSC Victory66
2727
2828
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,
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;
238+
u8 smba_en_lo, smba_en_hi, smb_en, smb_en_status;
239+
u8 i2ccfg, i2ccfg_offset = 0x10;
239240

240241
/* SB800 and later SMBus does not support forcing address */
241242
if (force || force_addr) {
@@ -245,7 +246,15 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
245246
}
246247

247248
/* 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;
249258

250259
if (!request_region(smba_idx, 2, "smba_idx")) {
251260
dev_err(&PIIX4_dev->dev, "SMBus base address index region "
@@ -258,13 +267,22 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
258267
smba_en_hi = inb_p(smba_idx + 1);
259268
release_region(smba_idx, 2);
260269

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) {
262281
dev_err(&PIIX4_dev->dev,
263282
"Host SMBus controller not enabled!\n");
264283
return -ENODEV;
265284
}
266285

267-
piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
268286
if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
269287
return -ENODEV;
270288

0 commit comments

Comments
 (0)