I2C: Add support for new AMD SMBus devices
PATCH 1/1 I2C: Add support for new AMD SMBus devices
Use driver to detect SMBus devices with Vendor ID AMD and class code is SMBus.
--- drivers/i2c/busses/i2c-piix4.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-piix4.c +7 -2
@@ -479,6 +479,10 @@ static struct pci_device_id piix4_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) }, +/* AMD Generic, PCI class code and Vendor ID for SMBus */ + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_ANY_ID), + .class = PCI_CLASS_SERIAL_SMBUS << 8, + .class_mask = 0xffffff }, { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4) }, { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS,
@@ -499,9 +503,10 @@ static int __devinit piix4_probe(struct pci_dev *dev, {int retval; -if ((dev->vendor ==PCI_VENDOR_ID_ATI ) && +if (((dev->vendor ==PCI_VENDOR_ID_ATI ) && (dev->device ==PCI_DEVICE_ID_ATI_SBX00_SMBUS ) && - (dev->revision >=0x40 )) + (dev->revision >=0x40 )) || + dev->vendor ==PCI_VENDOR_ID_AMD )/* base address location etc changed in SB800 */ retval =piix4_setup_sb800 (dev, id);else
Signature · 1 line
1.6.0.4
Hi Crane,
Quoted 12 lines · Crane Cai
Use driver to detect SMBus devices with Vendor ID AMD and class code is SMBus.
Signed-off-by Crane Cai <[email protected]>--- drivers/i2c/busses/i2c-piix4.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-piix4.c +0
-0
drivers/i2c/busses/i2c-piix4.c static struct pci_device_id piix4_ids[] = { · line 485
Quoted 7 lines
drivers/i2c/busses/i2c-piix4.c +4
-0@@ -479,6 +479,10 @@ static struct pci_device_id piix4_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) }, +/* AMD Generic, PCI class code and Vendor ID for SMBus */ + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_ANY_ID), + .class = PCI_CLASS_SERIAL_SMBUS << 8, + .class_mask = 0xffffff },
Hmm, this seems a little too broad. In particular the AMD 8111 SMBus 2.0 device [1022:746a] would match, while we know it isn't compatible with the Intel PIIX4 (it has its own driver: i2c-amd8111).
As much as I would like not having to add PCI IDs to the driver with every new chipset released by AMD, this doesn't sound realistic in practice, I fear. I suspect you will have to list devices individually, just as we do for all other vendors.
Quoted 16 lines
drivers/i2c/busses/i2c-piix4.c +3
-2{PCI_DEVICE (PCI_VENDOR_ID_SERVERWORKS , PCI_DEVICE_ID_SERVERWORKS_OSB4) }, { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS,@@ -499,9 +503,10 @@ static int __devinit piix4_probe(struct pci_dev *dev, {int retval; -if ((dev->vendor ==PCI_VENDOR_ID_ATI ) && +if (((dev->vendor ==PCI_VENDOR_ID_ATI ) && (dev->device ==PCI_DEVICE_ID_ATI_SBX00_SMBUS ) && - (dev->revision >=0x40 )) + (dev->revision >=0x40 )) || + dev->vendor ==PCI_VENDOR_ID_AMD )/* base address location etc changed in SB800 */ retval =piix4_setup_sb800 (dev, id);else
Signature · 1 line
Jean Delvare
Hi Jean,
Quoted 27 lines · Jean Delvare
Hi Crane,
Quoted 12 lines · Crane Cai
Use driver to detect SMBus devices with Vendor ID AMD and class code is SMBus.
Signed-off-by Crane Cai <[email protected]>--- drivers/i2c/busses/i2c-piix4.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-piix4.c +0
-0drivers/i2c/busses/i2c-piix4.c static struct pci_device_id piix4_ids[] = { · line 485
Quoted 7 lines
drivers/i2c/busses/i2c-piix4.c +4
-0@@ -479,6 +479,10 @@ static struct pci_device_id piix4_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) }, +/* AMD Generic, PCI class code and Vendor ID for SMBus */ + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_ANY_ID), + .class = PCI_CLASS_SERIAL_SMBUS << 8, + .class_mask = 0xffffff },Hmm, this seems a little too broad. In particular the AMD 8111 SMBus 2.0 device [1022:746a] would match, while we know it isn't compatible with the Intel PIIX4 (it has its own driver: i2c-amd8111).
Quoted 4 lines
As much as I would like not having to add PCI IDs to the driver with every new chipset released by AMD, this doesn't sound realistic in practice, I fear. I suspect you will have to list devices individually, just as we do for all other vendors.
Thank you for your useful comments. I think in serveral years SMBus controller hardware core will not change its interface. That's why we try to avoid frequently add device ID in driver. But we forget outdate chips you mentioned. Here is the solution for it: As we know device ID number is increaseed by its manufacture year, we can filter out outdate chips by the feature. If in future hardware interface changed (almost zero in factor), we also can use this method to filter new chips out. code clips as this:
pci_dev->device > PCI_DEVICE_ID_AMD_8111_SMBUS2 && pci_dev->device < PCI_DEVICE_ID_AMD_FEATURE_ONE
All this code clips will be in piix4_setup_sb800 branch, and if filtered out, it return with NODEV. It will not affect your driver main function, and will not avoid other driver's PCI probing.
Do you approve this solution? If you approve, I will resend a new patch for it.
Signature · 2 lines
Best Regards, - Crane