All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] I2C: Add support for new AMD SMBus devices
@ 2009-08-11  1:49 Crane Cai
  2009-09-09  8:12 ` Jean Delvare
  2009-09-09  9:10   ` Jean Delvare
  0 siblings, 2 replies; 7+ messages in thread
From: Crane Cai @ 2009-08-11  1:49 UTC (permalink / raw)
  To: Jean Delvare
  Cc: linux-kernel-gepDB1WL6pn9qxiX1TGQuw,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

AMD newer SMBus device uses the piix4 driver, and device is added by vendor ID
and class code. This method will include AMD old SMBus controller in, and need
to filter it out.

Signed-off-by: Crane Cai <crane.cai-5C7GfCeVMHo@public.gmane.org>
---
 drivers/i2c/busses/i2c-piix4.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 0249a7d..2539282 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -232,6 +232,14 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
 	unsigned short smba_idx = 0xcd6;
 	u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en = 0x2c;
 
+	/* Filter AMD old SMBus controller out */
+	if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD &&
+	    (PIIX4_dev->device <= PCI_DEVICE_ID_AMD_8111_SMBUS &&
+	     PIIX4_dev->device >= PCI_DEVICE_ID_AMD_VIPER_740B)) {
+		dev_info(&PIIX4_dev->dev, "Does not support this chip.\n");
+		return -ENODEV;
+	}
+
 	/* SB800 SMBus does not support forcing address */
 	if (force || force_addr) {
 		dev_err(&PIIX4_dev->dev, "SB800 SMBus does not support "
@@ -479,6 +487,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 +511,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
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH v2] I2C: Add support for new AMD SMBus devices
@ 2009-08-11  3:07 Crane Cai
  0 siblings, 0 replies; 7+ messages in thread
From: Crane Cai @ 2009-08-11  3:07 UTC (permalink / raw)
  Cc: linux-kernel

AMD newer SMBus device uses the piix4 driver, and device is added by vendor ID
and class code. This method will include AMD old SMBus controller in, and need
to filter it out.

Signed-off-by: Crane Cai <crane.cai@amd.com>
---
 drivers/i2c/busses/i2c-piix4.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 0249a7d..2539282 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -232,6 +232,14 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
 	unsigned short smba_idx = 0xcd6;
 	u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en = 0x2c;
 
+	/* Filter AMD old SMBus controller out */
+	if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD &&
+	    (PIIX4_dev->device <= PCI_DEVICE_ID_AMD_8111_SMBUS &&
+	     PIIX4_dev->device >= PCI_DEVICE_ID_AMD_VIPER_740B)) {
+		dev_info(&PIIX4_dev->dev, "Does not support this chip.\n");
+		return -ENODEV;
+	}
+
 	/* SB800 SMBus does not support forcing address */
 	if (force || force_addr) {
 		dev_err(&PIIX4_dev->dev, "SB800 SMBus does not support "
@@ -479,6 +487,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 +511,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
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-09-10  1:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-11  1:49 [PATCH v2] I2C: Add support for new AMD SMBus devices Crane Cai
2009-09-09  8:12 ` Jean Delvare
2009-09-09  9:10 ` Jean Delvare
2009-09-09  9:10   ` Jean Delvare
     [not found]   ` <20090909111026.21e85f54-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-09-10  1:55     ` Crane Cai
2009-09-10  1:55       ` Crane Cai
  -- strict thread matches above, loose matches on Subject: below --
2009-08-11  3:07 Crane Cai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.