Changeset 1077
- Timestamp:
- 04/21/01 23:57:40 (12 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 2 modified
-
CHANGES (modified) (1 diff)
-
kernel/busses/i2c-sis5595.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/CHANGES
r1076 r1077 37 37 Module i2c-i801: Chip detection cleanup 38 38 Module i2c-i810: Fixed i2c_i810_init() not found in patched kernel 39 Module i2c-sis5595: Allow force_addr=0xaddr; enable if not enabled. 39 40 Module lm78: Recognize chipid=0x20 40 41 Module lm87: Fix in0, in1 (2.5V and Vccp1) calculations -
lm-sensors/trunk/kernel/busses/i2c-sis5595.c
r943 r1077 40 40 #include <linux/init.h> 41 41 42 /* Length of ISA address segment */ 43 #define SIS5595_EXTENT 8 42 44 /* SIS5595 SMBus registers */ 43 45 #define SMB_STS_LO 0x00 … … 58 60 #define SMB_INDEX 0x38 59 61 #define SMB_DAT 0x39 62 #define SIS5595_ENABLE_REG 0x40 60 63 #define ACPI_BASE 0x90 61 64 … … 72 75 73 76 /* insmod parameters */ 77 78 /* If force_addr is set to anything different from 0, we forcibly enable 79 the device at the given address. */ 80 static int force_addr = 0; 81 MODULE_PARM(force_addr, "i"); 82 MODULE_PARM_DESC(force_addr, 83 "Initialize the base address of the i2c controller"); 74 84 75 85 #ifdef MODULE … … 140 150 int sis5595_setup(void) 141 151 { 142 int error_return = 0;143 152 u16 a; 153 u8 val; 144 154 struct pci_dev *SIS5595_dev; 145 155 … … 147 157 if (pci_present() == 0) { 148 158 printk("i2c-sis5595.o: Error: No PCI-bus found!\n"); 149 error_return = -ENODEV; 150 goto END; 159 return -ENODEV; 151 160 } 152 161 … … 157 166 SIS5595_dev))) { 158 167 printk("i2c-sis5595.o: Error: Can't detect SIS5595!\n"); 159 error_return = -ENODEV; 160 goto END; 168 return -ENODEV; 161 169 } 162 170 163 171 /* Determine the address of the SMBus areas */ 164 172 pci_read_config_word(SIS5595_dev, ACPI_BASE, &sis5595_base); 165 if(sis5595_base == 0) { 166 printk("i2c-sis5595.o: ACPI base address uninitialized - upgrade BIOS?\n"); 167 error_return = -ENODEV; 168 goto END; 169 } 170 173 if(sis5595_base == 0 && force_addr == 0) { 174 printk("i2c-sis5595.o: ACPI base address uninitialized - upgrade BIOS or use force_addr=0xaddr\n"); 175 return -ENODEV; 176 } 177 178 if(force_addr) 179 sis5595_base = force_addr & ~(SIS5595_EXTENT - 1); 171 180 #ifdef DEBUG 172 181 printk("ACPI Base address: %04x\n", sis5595_base); … … 179 188 sis5595_base + SMB_INDEX, 180 189 sis5595_base + SMB_INDEX + 1); 181 error_return = -ENODEV; 182 goto END; 190 return -ENODEV; 191 } 192 193 if(force_addr) { 194 printk("i2c-sis5595.o: forcing ISA address 0x%04X\n", sis5595_base); 195 if (PCIBIOS_SUCCESSFUL != 196 pci_write_config_word(SIS5595_dev, ACPI_BASE, sis5595_base)) 197 return -ENODEV; 198 if (PCIBIOS_SUCCESSFUL != 199 pci_read_config_word(SIS5595_dev, ACPI_BASE, &a)) 200 return -ENODEV; 201 if ((a & ~(SIS5595_EXTENT - 1)) != sis5595_base) { 202 /* doesn't work for some chips! */ 203 printk("i2c-sis5595.o: force address failed - not supported?\n"); 204 return -ENODEV; 205 } 206 } 207 208 if (PCIBIOS_SUCCESSFUL != 209 pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val)) 210 return -ENODEV; 211 if((val & 0x80) == 0) { 212 printk("sis5595.o: enabling ACPI\n"); 213 if (PCIBIOS_SUCCESSFUL != 214 pci_write_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, 215 val | 0x80)) 216 return -ENODEV; 217 if (PCIBIOS_SUCCESSFUL != 218 pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val)) 219 return -ENODEV; 220 if((val & 0x80) == 0) { /* doesn't work for some chips? */ 221 printk("sis5595.o: ACPI enable failed - not supported?\n"); 222 return -ENODEV; 223 } 183 224 } 184 225 185 226 /* Everything is happy, let's grab the memory and set things up. */ 186 227 request_region(sis5595_base + SMB_INDEX, 2, "sis5595-smbus"); 187 188 END: 189 return error_return; 228 return(0); 190 229 } 191 230
