Changeset 1190 for lm-sensors/trunk/kernel/busses/i2c-amd756.c
- Timestamp:
- 09/19/01 19:57:11 (12 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/kernel/busses/i2c-amd756.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/kernel/busses/i2c-amd756.c
r1154 r1190 80 80 81 81 /* Other settings */ 82 #define MAX_TIMEOUT 50082 #define MAX_TIMEOUT 100 83 83 84 84 /* AMD756 constants */ … … 145 145 int amd756_setup(void) 146 146 { 147 int error_return = 0;148 147 unsigned char temp; 149 148 int *num = supported; 150 149 struct pci_dev *AMD756_dev = NULL; 151 150 152 /* First check whether we can access PCI at all */153 151 if (pci_present() == 0) { 154 152 printk("i2c-amd756.o: Error: No PCI-bus found!\n"); … … 178 176 if ((temp & 128) == 0) { 179 177 printk 180 ("SMBUS: Error: HostSMBus controller I/O not enabled!\n");178 ("i2c-amd756.o: Error: SMBus controller I/O not enabled!\n"); 181 179 return(-ENODEV); 182 180 } … … 190 188 if (check_region(amd756_smba, SMB_IOSIZE)) { 191 189 printk 192 ("i2c-amd756.o: AMD756_smbregion 0x%x already in use!\n",190 ("i2c-amd756.o: SMB region 0x%x already in use!\n", 193 191 amd756_smba); 194 192 return(-ENODEV); … … 199 197 200 198 #ifdef DEBUG 201 /*202 if ((temp & 0x0E) == 8)203 printk("i2c-amd756.o: AMD756 using Interrupt 9 for SMBus.\n");204 else if ((temp & 0x0E) == 0)205 printk("i2c-amd756.o: AMD756 using Interrupt SMI# for SMBus.\n");206 else207 printk("i2c-amd756.o: AMD756: Illegal Interrupt configuration (or code out "208 "of date)!\n");209 */210 211 199 pci_read_config_byte(AMD756_dev, SMBREV, &temp); 212 200 printk("i2c-amd756.o: SMBREV = 0x%X\n", temp); … … 236 224 #define GS_HCYC_STS (1 << 4) 237 225 #define GS_TO_STS (1 << 5) 226 #define GS_SMB_STS (1 << 11) 238 227 239 228 #define GS_CLEAR_STS (GS_ABRT_STS | GS_COL_STS | GS_PRERR_STS | \ … … 243 232 #define GE_HOST_STC (1 << 3) 244 233 245 /* Another internally used function */246 234 int amd756_transaction(void) 247 235 { … … 258 246 259 247 /* Make sure the SMBus host is ready to start transmitting */ 260 /* TODO: What about SM_BSY? */ 261 if (((temp = inw_p(SMB_GLOBAL_STATUS)) & GS_HST_STS) != 0x00) { 262 #ifdef DEBUG 263 printk 264 ("i2c-amd756.o: SMBus busy (%04x). Resetting (NOT)... \n", 265 temp); 266 #endif 267 /* TODO: How to reset the AMD? 268 outb_p(temp, SMBHSTSTS); 269 */ 270 if (((temp = inw_p(SMB_GLOBAL_STATUS)) & GS_HST_STS) != 271 0x00) { 272 #ifdef DEBUG 273 printk("i2c-amd756.o: Failed! (%04x)\n", temp); 274 #endif 275 return -1; 276 } else { 277 #ifdef DEBUG 278 printk("i2c-amd756.o: Successfull!\n"); 279 #endif 248 if ((temp = inw_p(SMB_GLOBAL_STATUS)) & (GS_HST_STS | GS_SMB_STS)) { 249 #ifdef DEBUG 250 printk 251 ("i2c-amd756.o: SMBus busy (%04x). Waiting... \n", temp); 252 #endif 253 do { 254 amd756_do_pause(1); 255 temp = inw_p(SMB_GLOBAL_STATUS); 256 } while ((temp & (GS_HST_STS | GS_SMB_STS)) && 257 (timeout++ < MAX_TIMEOUT)); 258 /* If the SMBus is still busy, we give up */ 259 if (timeout >= MAX_TIMEOUT) { 260 printk("i2c-amd756.o: Busy wait timeout! (%04x)\n", 261 temp); 262 return(-1); 280 263 } 281 } 282 283 /* start the transaction by setting bit 6 */ 264 timeout = 0; 265 } 266 267 /* start the transaction by setting the start bit */ 284 268 outw_p(inw(SMB_GLOBAL_ENABLE) | GE_HOST_STC, SMB_GLOBAL_ENABLE); 285 269 … … 292 276 /* If the SMBus is still busy, we give up */ 293 277 if (timeout >= MAX_TIMEOUT) { 294 #ifdef DEBUG 295 printk("i2c-amd756.o: SMBus explicit timeout!\n"); 296 result = -1; 297 #endif 278 printk("i2c-amd756.o: Completion timeout!\n"); 279 return(-1); 298 280 } 299 281 … … 301 283 result = -1; 302 284 #ifdef DEBUG 303 printk("i2c-amd756.o: SMBus Protocol error !\n");285 printk("i2c-amd756.o: SMBus Protocol error (no response)!\n"); 304 286 #endif 305 287 } … … 325 307 outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS); 326 308 309 #ifdef DEBUG 327 310 if (((temp = inw_p(SMB_GLOBAL_STATUS)) & GS_CLEAR_STS) != 0x00) { 328 #ifdef DEBUG329 311 printk 330 312 ("i2c-amd756.o: Failed reset at end of transaction (%04x)\n", 331 313 temp); 332 #endif 333 } 334 #ifdef DEBUG 314 } 335 315 printk 336 316 ("i2c-amd756.o: Transaction (post): GS=%04x, GE=%04x, ADD=%04x, DAT=%04x\n",
