Changeset 2459 for lm-sensors/trunk/prog/hotplug/p4b_smbus.c
- Timestamp:
- 04/20/04 19:42:48 (9 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/prog/hotplug/p4b_smbus.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/prog/hotplug/p4b_smbus.c
r1975 r2459 2 2 * p4b_smbus.c 3 3 * 4 * Initialize the I801SMBus device on ASUS P4B Bords4 * Initialize the SMBus device on ICH2/2-M/4/4-M (82801BA/BAM/DB/DBM) 5 5 */ 6 6 /* … … 42 42 * 43 43 * June 21, 2002, added support for the ICH4, code clean up -- Klaus 44 * 45 * Apr 13, 2004, modified for ICH4-M (82801DBM) -- Axel Thimm <Axel.Thimm@ATrpms.net> 46 * bugfix: register F2/bit 8 on ICH2* is bit 0 on ICH4* 44 47 */ 45 48 … … 88 91 89 92 #define ICH2 0x2440 93 #define ICH2_M 0x244c 90 94 #define ICH2_SMBUS 0x2443 91 95 92 96 #define ICH4 0x24c0 97 #define ICH4_M 0x24cc 93 98 #define ICH4_SMBUS 0x24c3 94 99 … … 103 108 /* 104 109 * Checks whether SMBus is enabled and turns it on in case they are not. 105 * It's done by clearing Bit 8 and 3 in i801 config space F2h, PCI-Device 0x8086:0x2440(ICH2)/0x24c0(ICH4) 110 * It's done by modifying the i801 function disable register, F2h. 111 * ICH2(-M): PCI-Device 0x8086:0x2440(0x244c) 112 * Bit 3: Disables SMBus Host Controller function. 113 * Bit 8: allows SMBus I/O space to be accessible when Bit 3 is set. 114 * ICH4(-M): PCI-Device 0x8086:0x24c0(0x24cc) 115 * Bit 3: Disables SMBus Host Controller function. 116 * Bit 0: allows SMBus I/O space to be accessible when Bit 3 is set. 106 117 */ 107 118 static int 108 i801smbus_enable(struct pci_dev *dev ){119 i801smbus_enable(struct pci_dev *dev, u16 testmask, u16 mask){ 109 120 u16 val = 0; 110 121 111 122 pci_read_config_word(dev, 0xF2, &val); 112 123 DBG("i801smbus: i801smbus config byte reading 0x%X.\n", val); 113 if (val & 0x008) {114 pci_write_config_word(dev, 0xF2, val & 0xfef7);124 if (val & testmask) { 125 pci_write_config_word(dev, 0xF2, val & mask); 115 126 pci_read_config_word(dev, 0xF2, &val); 116 if(val & 0x008)127 if(val & testmask) 117 128 { 118 129 DBG("i801smbus: i801smbus config byte locked:-(\n"); … … 186 197 struct pci_dev *dev = NULL; 187 198 int ret = 0; 199 u16 testmask = 0, mask = 0; 188 200 189 201 DBG("i801smbus: init_module().\n"); … … 213 225 214 226 /* Are we operating a i801 chipset */ 215 dev = pci_find_device(0x8086, ICH2, NULL); 216 if (NULL == dev) 217 { 218 dev = pci_find_device(0x8086, ICH4, NULL); 219 if (NULL == dev) 220 { 221 printk("i801smbus: INTEL ICH2/4 (82801AB/DB) not found.\n"); 222 return -ENODEV ; 223 } 224 else 225 { 226 printk("i801smbus: found Intel ICH4 (82801DB).\n"); 227 } 227 if ((dev = pci_find_device(0x8086, ICH2, NULL)) != 0) 228 { 229 printk("i801smbus: found Intel ICH2 (82801BA).\n"); 230 testmask = 0x008; 231 mask = 0xfef7; 232 } 233 else if ((dev = pci_find_device(0x8086, ICH2_M, NULL)) != 0) 234 { 235 printk("i801smbus: found Intel ICH2-M (82801BAM).\n"); 236 testmask = 0x008; 237 mask = 0xfef7; 238 } 239 else if ((dev = pci_find_device(0x8086, ICH4, NULL)) != 0) 240 { 241 printk("i801smbus: found Intel ICH4 (82801DB).\n"); 242 testmask = 0x008; 243 mask = 0xfff6; 244 } 245 else if ((dev = pci_find_device(0x8086, ICH4_M, NULL)) != 0) 246 { 247 printk("i801smbus: found Intel ICH4-M (82801DBM).\n"); 248 testmask = 0x008; 249 mask = 0xfff6; 228 250 } 229 251 else 230 252 { 231 printk("i801smbus: found Intel ICH2 (82801AB).\n"); 253 printk("i801smbus: INTEL ICH2/2-M/4/4-M (82801BA/BAM/DB/DBM) not found.\n"); 254 return -ENODEV ; 232 255 } 233 256 … … 236 259 237 260 238 if ( (ret = i801smbus_enable(dev )) )261 if ( (ret = i801smbus_enable(dev, testmask, mask)) ) 239 262 { 240 263 printk("i801smbus: Unable to turn on i801smbus device - sorry!\n");
