Skip to content

Commit c7c06a1

Browse files
acooksWolfram Sang
authored andcommitted
i2c: piix4: Fix port selection for AMD Family 16h Model 30h
Family 16h Model 30h SMBus controller needs the same port selection fix as described and fixed in commit 0fe1619 ("i2c: piix4: Fix SMBus port selection for AMD Family 17h chips") commit 6befa3f ("i2c: piix4: Support alternative port selection register") also fixed the port selection for Hudson2, but unfortunately this is not the exact same device and the AMD naming and PCI Device IDs aren't particularly helpful here. The SMBus port selection register is common to the following Families and models, as documented in AMD's publicly available BIOS and Kernel Developer Guides: 50742 - Family 15h Model 60h-6Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) 55072 - Family 15h Model 70h-7Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) 52740 - Family 16h Model 30h-3Fh (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) The Hudson2 PCI Device ID (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) is shared between Bolton FCH and Family 16h Model 30h, but the location of the SmBus0Sel port selection bits are different: 51192 - Bolton Register Reference Guide We distinguish between Bolton and Family 16h Model 30h using the PCI Revision ID: Bolton is device 0x780b, revision 0x15 Family 16h Model 30h is device 0x780b, revision 0x1F Family 15h Model 60h and 70h are both device 0x790b, revision 0x4A. The following additional public AMD BKDG documents were checked and do not share the same port selection register: 42301 - Family 15h Model 00h-0Fh doesn't mention any 42300 - Family 15h Model 10h-1Fh doesn't mention any 49125 - Family 15h Model 30h-3Fh doesn't mention any 48751 - Family 16h Model 00h-0Fh uses the previously supported index register SB800_PIIX4_PORT_IDX_ALT at 0x2e Signed-off-by: Andrew Cooks <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Cc: [email protected] [v4.6+] Signed-off-by: Wolfram Sang <[email protected]>
1 parent c486dcd commit c7c06a1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/i2c/busses/i2c-piix4.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
#define SB800_PIIX4_PORT_IDX_MASK 0x06
9292
#define SB800_PIIX4_PORT_IDX_SHIFT 1
9393

94-
/* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
94+
/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
9595
#define SB800_PIIX4_PORT_IDX_KERNCZ 0x02
9696
#define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18
9797
#define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3
@@ -358,18 +358,16 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
358358
/* Find which register is used for port selection */
359359
if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD ||
360360
PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) {
361-
switch (PIIX4_dev->device) {
362-
case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS:
361+
if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS ||
362+
(PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
363+
PIIX4_dev->revision >= 0x1F)) {
363364
piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ;
364365
piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ;
365366
piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ;
366-
break;
367-
case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS:
368-
default:
367+
} else {
369368
piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT;
370369
piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK;
371370
piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT;
372-
break;
373371
}
374372
} else {
375373
if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2,

0 commit comments

Comments
 (0)