Skip to contentSkip to conversation

p4b_smbus quirk update

PATCH New Dominik Brodowski 2 participants 3 messages May 19, 2005 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 p4b_smbus quirk update

Hi,

The p4b_smbus.c module located in lm_sensors-2.7.0/prog/hotplug does not work for 2.5. kernels. Also, the code can be simplified much if enabling the SMBus device is done as a "pci quirk" in drivers/pci/quirks.c in the linux kernel sources. A patch for linux-kernel 2.5.59 is attached below. However, it _might_ be wise to add a check so that only Asus mainboards are affected.

Dominik

drivers/pci/quirks.c +21 -0
diff -ruN linux-original/drivers/pci/quirks.c linux/drivers/pci/quirks.c
@@ -535,6 +535,21 @@
 	}
 }
 
+static void __devinit quirk_p4b_smbus(struct pci_dev *dev)
+{
+	u16 val;
+	pci_read_config_word(dev, 0xF2, &val);
+	if (val & 0x8) {
+		pci_write_config_word(dev, 0xF2, val & (~0x8));
+		pci_read_config_word(dev, 0xF2, &val);
+		if(val & 0x8) 
+			printk(KERN_INFO "PCI: Fixup to enable i801 SMBus device failed - 0x%x", val);
+		else
+			printk(KERN_INFO "PCI: Fixup to enable i801 SMBus successful! - 0x%x\n", val);
+	}
+	return;
+}
+
 /*
  *  The main table of quirks.
  */
@@ -604,6 +619,12 @@
 
 	{ PCI_FIXUP_FINAL,	PCI_VENDOR_ID_CYRIX,	PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master },
 	
+	/*
+	 * on Asus P4B boards, the i801SMBus device is disabled.
+	 */
+	{ PCI_FIXUP_HEADER,	PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82801BA_0,	quirk_p4b_smbus },
+	{ PCI_FIXUP_HEADER,	PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82801DB_0,	quirk_p4b_smbus },
+
 
 	{ 0 }
 };
#1 lore raw

PATCH 1/1 p4b_smbus quirk update

That's a good idea.
Did you submit it to the kernel?
If it gets in let us know.
thanks

Quoted 49 lines · Dominik Brodowski

Hi,

The p4b_smbus.c module located in lm_sensors-2.7.0/prog/hotplug does not work for 2.5. kernels. Also, the code can be simplified much if enabling the SMBus device is done as a "pci quirk" in drivers/pci/quirks.c in the linux kernel sources. A patch for linux-kernel 2.5.59 is attached below. However, it _might_ be wise to add a check so that only Asus mainboards are affected.

Dominik

diff -ruN linux-original/drivers/pci/quirks.c linux/drivers/pci/quirks.c

drivers/pci/quirks.c +21 -0
@@ -535,6 +535,21 @@
 	}
 }
 
+static void __devinit quirk_p4b_smbus(struct pci_dev *dev)
+{
+	u16 val;
+	pci_read_config_word(dev, 0xF2, &val);
+	if (val & 0x8) {
+		pci_write_config_word(dev, 0xF2, val & (~0x8));
+		pci_read_config_word(dev, 0xF2, &val);
+		if(val & 0x8) 
+			printk(KERN_INFO "PCI: Fixup to enable i801 SMBus device failed - 0x%x", val);
+		else
+			printk(KERN_INFO "PCI: Fixup to enable i801 SMBus successful! - 0x%x\n", val);
+	}
+	return;
+}
+
 /*
  *  The main table of quirks.
  */
@@ -604,6 +619,12 @@
 
 	{ PCI_FIXUP_FINAL,	PCI_VENDOR_ID_CYRIX,	PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master },
 
+	/*
+	 * on Asus P4B boards, the i801SMBus device is disabled.
+	 */
+	{ PCI_FIXUP_HEADER,	PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82801BA_0,	quirk_p4b_smbus },
+	{ PCI_FIXUP_HEADER,	PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82801DB_0,	quirk_p4b_smbus },
+
 
 	{ 0 }
 };
#2 lore raw

PATCH 1/1 p4b_smbus quirk update

In reply to Dominik Brodowski
Quoted 4 lines · Mark D. Studebaker

That's a good idea.
Did you submit it to the kernel?
If it gets in let us know.
thanks

Merged in 2.5.69-bk11.

Dominik

Quoted 11 lines
Quoted 10 lines · Dominik Brodowski

Hi,

The p4b_smbus.c module located in lm_sensors-2.7.0/prog/hotplug does not work for 2.5. kernels. Also, the code can be simplified much if enabling the
SMBus device is done as a "pci quirk" in drivers/pci/quirks.c in the linux kernel sources. A patch for linux-kernel 2.5.59 is attached below. However, it _might_ be wise to add a check so that only Asus mainboards are affected.

Quoted 1 line
Quoted 1 line

Dominik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20030517/085ae645/attachment.bin