diff options
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 16 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-piix4.c | 47 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sibyte.c | 6 |
3 files changed, 52 insertions, 17 deletions
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 18beb0ad7bf3..a076129de7e8 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -99,7 +99,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
99 | u32 x; | 99 | u32 x; |
100 | int result = 0; | 100 | int result = 0; |
101 | 101 | ||
102 | if (i2c->irq == 0) | 102 | if (i2c->irq == NO_IRQ) |
103 | { | 103 | { |
104 | while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) { | 104 | while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) { |
105 | schedule(); | 105 | schedule(); |
@@ -329,10 +329,9 @@ static int fsl_i2c_probe(struct platform_device *pdev) | |||
329 | return -ENOMEM; | 329 | return -ENOMEM; |
330 | 330 | ||
331 | i2c->irq = platform_get_irq(pdev, 0); | 331 | i2c->irq = platform_get_irq(pdev, 0); |
332 | if (i2c->irq < 0) { | 332 | if (i2c->irq < 0) |
333 | result = -ENXIO; | 333 | i2c->irq = NO_IRQ; /* Use polling */ |
334 | goto fail_get_irq; | 334 | |
335 | } | ||
336 | i2c->flags = pdata->device_flags; | 335 | i2c->flags = pdata->device_flags; |
337 | init_waitqueue_head(&i2c->queue); | 336 | init_waitqueue_head(&i2c->queue); |
338 | 337 | ||
@@ -344,7 +343,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) | |||
344 | goto fail_map; | 343 | goto fail_map; |
345 | } | 344 | } |
346 | 345 | ||
347 | if (i2c->irq != 0) | 346 | if (i2c->irq != NO_IRQ) |
348 | if ((result = request_irq(i2c->irq, mpc_i2c_isr, | 347 | if ((result = request_irq(i2c->irq, mpc_i2c_isr, |
349 | IRQF_SHARED, "i2c-mpc", i2c)) < 0) { | 348 | IRQF_SHARED, "i2c-mpc", i2c)) < 0) { |
350 | printk(KERN_ERR | 349 | printk(KERN_ERR |
@@ -367,12 +366,11 @@ static int fsl_i2c_probe(struct platform_device *pdev) | |||
367 | return result; | 366 | return result; |
368 | 367 | ||
369 | fail_add: | 368 | fail_add: |
370 | if (i2c->irq != 0) | 369 | if (i2c->irq != NO_IRQ) |
371 | free_irq(i2c->irq, i2c); | 370 | free_irq(i2c->irq, i2c); |
372 | fail_irq: | 371 | fail_irq: |
373 | iounmap(i2c->base); | 372 | iounmap(i2c->base); |
374 | fail_map: | 373 | fail_map: |
375 | fail_get_irq: | ||
376 | kfree(i2c); | 374 | kfree(i2c); |
377 | return result; | 375 | return result; |
378 | }; | 376 | }; |
@@ -384,7 +382,7 @@ static int fsl_i2c_remove(struct platform_device *pdev) | |||
384 | i2c_del_adapter(&i2c->adap); | 382 | i2c_del_adapter(&i2c->adap); |
385 | platform_set_drvdata(pdev, NULL); | 383 | platform_set_drvdata(pdev, NULL); |
386 | 384 | ||
387 | if (i2c->irq != 0) | 385 | if (i2c->irq != NO_IRQ) |
388 | free_irq(i2c->irq, i2c); | 386 | free_irq(i2c->irq, i2c); |
389 | 387 | ||
390 | iounmap(i2c->base); | 388 | iounmap(i2c->base); |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index fdc9ad805e35..ac9165968587 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -104,10 +104,31 @@ MODULE_PARM_DESC(force_addr, | |||
104 | static int piix4_transaction(void); | 104 | static int piix4_transaction(void); |
105 | 105 | ||
106 | static unsigned short piix4_smba; | 106 | static unsigned short piix4_smba; |
107 | static int srvrworks_csb5_delay; | ||
107 | static struct pci_driver piix4_driver; | 108 | static struct pci_driver piix4_driver; |
108 | static struct i2c_adapter piix4_adapter; | 109 | static struct i2c_adapter piix4_adapter; |
109 | 110 | ||
110 | static struct dmi_system_id __devinitdata piix4_dmi_table[] = { | 111 | static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = { |
112 | { | ||
113 | .ident = "Sapphire AM2RD790", | ||
114 | .matches = { | ||
115 | DMI_MATCH(DMI_BOARD_VENDOR, "SAPPHIRE Inc."), | ||
116 | DMI_MATCH(DMI_BOARD_NAME, "PC-AM2RD790"), | ||
117 | }, | ||
118 | }, | ||
119 | { | ||
120 | .ident = "DFI Lanparty UT 790FX", | ||
121 | .matches = { | ||
122 | DMI_MATCH(DMI_BOARD_VENDOR, "DFI Inc."), | ||
123 | DMI_MATCH(DMI_BOARD_NAME, "LP UT 790FX"), | ||
124 | }, | ||
125 | }, | ||
126 | { } | ||
127 | }; | ||
128 | |||
129 | /* The IBM entry is in a separate table because we only check it | ||
130 | on Intel-based systems */ | ||
131 | static struct dmi_system_id __devinitdata piix4_dmi_ibm[] = { | ||
111 | { | 132 | { |
112 | .ident = "IBM", | 133 | .ident = "IBM", |
113 | .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), }, | 134 | .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), }, |
@@ -122,8 +143,20 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, | |||
122 | 143 | ||
123 | dev_info(&PIIX4_dev->dev, "Found %s device\n", pci_name(PIIX4_dev)); | 144 | dev_info(&PIIX4_dev->dev, "Found %s device\n", pci_name(PIIX4_dev)); |
124 | 145 | ||
146 | if ((PIIX4_dev->vendor == PCI_VENDOR_ID_SERVERWORKS) && | ||
147 | (PIIX4_dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5)) | ||
148 | srvrworks_csb5_delay = 1; | ||
149 | |||
150 | /* On some motherboards, it was reported that accessing the SMBus | ||
151 | caused severe hardware problems */ | ||
152 | if (dmi_check_system(piix4_dmi_blacklist)) { | ||
153 | dev_err(&PIIX4_dev->dev, | ||
154 | "Accessing the SMBus on this system is unsafe!\n"); | ||
155 | return -EPERM; | ||
156 | } | ||
157 | |||
125 | /* Don't access SMBus on IBM systems which get corrupted eeproms */ | 158 | /* Don't access SMBus on IBM systems which get corrupted eeproms */ |
126 | if (dmi_check_system(piix4_dmi_table) && | 159 | if (dmi_check_system(piix4_dmi_ibm) && |
127 | PIIX4_dev->vendor == PCI_VENDOR_ID_INTEL) { | 160 | PIIX4_dev->vendor == PCI_VENDOR_ID_INTEL) { |
128 | dev_err(&PIIX4_dev->dev, "IBM system detected; this module " | 161 | dev_err(&PIIX4_dev->dev, "IBM system detected; this module " |
129 | "may corrupt your serial eeprom! Refusing to load " | 162 | "may corrupt your serial eeprom! Refusing to load " |
@@ -230,10 +263,14 @@ static int piix4_transaction(void) | |||
230 | outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT); | 263 | outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT); |
231 | 264 | ||
232 | /* We will always wait for a fraction of a second! (See PIIX4 docs errata) */ | 265 | /* We will always wait for a fraction of a second! (See PIIX4 docs errata) */ |
233 | do { | 266 | if (srvrworks_csb5_delay) /* Extra delay for SERVERWORKS_CSB5 */ |
267 | msleep(2); | ||
268 | else | ||
269 | msleep(1); | ||
270 | |||
271 | while ((timeout++ < MAX_TIMEOUT) && | ||
272 | ((temp = inb_p(SMBHSTSTS)) & 0x01)) | ||
234 | msleep(1); | 273 | msleep(1); |
235 | temp = inb_p(SMBHSTSTS); | ||
236 | } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT)); | ||
237 | 274 | ||
238 | /* If the SMBus is still busy, we give up */ | 275 | /* If the SMBus is still busy, we give up */ |
239 | if (timeout >= MAX_TIMEOUT) { | 276 | if (timeout >= MAX_TIMEOUT) { |
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c index 8fbbdb4c2f35..114634da6c6e 100644 --- a/drivers/i2c/busses/i2c-sibyte.c +++ b/drivers/i2c/busses/i2c-sibyte.c | |||
@@ -132,14 +132,14 @@ static const struct i2c_algorithm i2c_sibyte_algo = { | |||
132 | /* | 132 | /* |
133 | * registering functions to load algorithms at runtime | 133 | * registering functions to load algorithms at runtime |
134 | */ | 134 | */ |
135 | int __init i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed) | 135 | static int __init i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed) |
136 | { | 136 | { |
137 | struct i2c_algo_sibyte_data *adap = i2c_adap->algo_data; | 137 | struct i2c_algo_sibyte_data *adap = i2c_adap->algo_data; |
138 | 138 | ||
139 | /* register new adapter to i2c module... */ | 139 | /* Register new adapter to i2c module... */ |
140 | i2c_adap->algo = &i2c_sibyte_algo; | 140 | i2c_adap->algo = &i2c_sibyte_algo; |
141 | 141 | ||
142 | /* Set the frequency to 100 kHz */ | 142 | /* Set the requested frequency. */ |
143 | csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ)); | 143 | csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ)); |
144 | csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL)); | 144 | csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL)); |
145 | 145 | ||