Changeset 1133
- Timestamp:
- 06/17/01 23:11:59 (12 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 2 modified
-
CHANGES (modified) (1 diff)
-
kernel/busses/i2c-ali15x3.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/CHANGES
r1131 r1133 17 17 18 18 ----------------------------------------------------------------------------- 19 20 2.6.1 (2001????) 21 Module i2c-ali15x3: Allow force_addr=0xaddr; enable if not enabled. 19 22 20 23 2.6.0 (20010612) -
lm-sensors/trunk/kernel/busses/i2c-ali15x3.c
r949 r1133 125 125 #define ALI15X3_STS_ERR 0xE0 /* all the bad error bits */ 126 126 127 128 /* If force_addr is set to anything different from 0, we forcibly enable 129 the device at the given address. */ 130 static int force_addr = 0; 131 MODULE_PARM(force_addr, "i"); 132 MODULE_PARM_DESC(force_addr, 133 "Initialize the base address of the i2c controller"); 127 134 128 135 #ifdef MODULE … … 181 188 int ali15x3_setup(void) 182 189 { 183 int error_return = 0;190 u16 a; 184 191 unsigned char temp; 185 192 … … 189 196 if (pci_present() == 0) { 190 197 printk("i2c-ali15x3.o: Error: No PCI-bus found!\n"); 191 error_return = -ENODEV; 192 goto END; 198 return -ENODEV; 193 199 } 194 200 … … 199 205 if (ALI15X3_dev == NULL) { 200 206 printk("i2c-ali15x3.o: Error: Can't detect ali15x3!\n"); 201 error_return = -ENODEV; 202 goto END; 207 return -ENODEV; 203 208 } 204 209 … … 223 228 pci_read_config_word(ALI15X3_dev, SMBBA, &ali15x3_smba); 224 229 ali15x3_smba &= (0xffff & ~(ALI15X3_SMB_IOSIZE - 1)); 225 if (ali15x3_smba == 0 ) {226 printk 227 ("i2c-ali15x3.o: ALI15X3_smb region uninitialized - upgrade BIOS ?\n");228 error_return =-ENODEV;229 } 230 231 if (error_return == -ENODEV)232 goto END;230 if (ali15x3_smba == 0 && force_addr == 0) { 231 printk 232 ("i2c-ali15x3.o: ALI15X3_smb region uninitialized - upgrade BIOS or use force_addr=0xaddr\n"); 233 return -ENODEV; 234 } 235 236 if(force_addr) 237 ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1); 233 238 234 239 if (check_region(ali15x3_smba, ALI15X3_SMB_IOSIZE)) { … … 236 241 ("i2c-ali15x3.o: ALI15X3_smb region 0x%x already in use!\n", 237 242 ali15x3_smba); 238 error_return = -ENODEV; 239 } 240 241 if (error_return == -ENODEV) 242 goto END; 243 243 return -ENODEV; 244 } 245 246 if(force_addr) { 247 printk("i2c-ali15x3.o: forcing ISA address 0x%04X\n", ali15x3_smba); 248 if (PCIBIOS_SUCCESSFUL != 249 pci_write_config_word(ALI15X3_dev, SMBBA, ali15x3_smba)) 250 return -ENODEV; 251 if (PCIBIOS_SUCCESSFUL != 252 pci_read_config_word(ALI15X3_dev, SMBBA, &a)) 253 return -ENODEV; 254 if ((a & ~(ALI15X3_SMB_IOSIZE - 1)) != ali15x3_smba) { 255 /* make sure it works */ 256 printk("i2c-ali15x3.o: force address failed - not supported?\n"); 257 return -ENODEV; 258 } 259 } 244 260 /* check if whole device is enabled */ 245 261 pci_read_config_byte(ALI15X3_dev, SMBCOM, &temp); 246 262 if ((temp & 1) == 0) { 247 printk 248 ("SMBUS: Error: SMB device not enabled - upgrade BIOS?\n"); 249 error_return = -ENODEV; 250 goto END; 263 printk("i2c-ali15x3: enabling SMBus device\n"); 264 pci_write_config_byte(ALI15X3_dev, SMBCOM, temp | 0x01); 251 265 } 252 266 … … 254 268 pci_read_config_byte(ALI15X3_dev, SMBHSTCFG, &temp); 255 269 if ((temp & 1) == 0) { 256 printk 257 ("SMBUS: Error: Host SMBus controller not enabled - upgrade BIOS?\n"); 258 error_return = -ENODEV; 259 goto END; 270 printk("i2c-ali15x3: enabling SMBus controller\n"); 271 pci_write_config_byte(ALI15X3_dev, SMBHSTCFG, temp | 0x01); 260 272 } 261 273 … … 279 291 #endif /* DEBUG */ 280 292 281 END: 282 return error_return; 293 return 0; 283 294 } 284 295
