aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r--drivers/i2c/busses/i2c-i801.c6
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c1
-rw-r--r--drivers/i2c/busses/i2c-isa.c10
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c33
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c2
-rw-r--r--drivers/i2c/busses/i2c-parport.h12
6 files changed, 34 insertions, 30 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index ac3eafa8aac0..1c752ddc10e2 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -468,8 +468,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
468 return -1; 468 return -1;
469 } 469 }
470 470
471 if (hwpec) 471 outb_p(hwpec, SMBAUXCTL); /* enable/disable hardware PEC */
472 outb_p(1, SMBAUXCTL); /* enable hardware PEC */
473 472
474 if(block) 473 if(block)
475 ret = i801_block_transaction(data, read_write, size, hwpec); 474 ret = i801_block_transaction(data, read_write, size, hwpec);
@@ -478,9 +477,6 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
478 ret = i801_transaction(); 477 ret = i801_transaction();
479 } 478 }
480 479
481 if (hwpec)
482 outb_p(0, SMBAUXCTL); /* disable hardware PEC */
483
484 if(block) 480 if(block)
485 return ret; 481 return ret;
486 if(ret) 482 if(ret)
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 1a587253d716..87fae937e666 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -725,6 +725,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
725 strcpy(adap->name, "IBM IIC"); 725 strcpy(adap->name, "IBM IIC");
726 i2c_set_adapdata(adap, dev); 726 i2c_set_adapdata(adap, dev);
727 adap->id = I2C_HW_OCP; 727 adap->id = I2C_HW_OCP;
728 adap->class = I2C_CLASS_HWMON;
728 adap->algo = &iic_algo; 729 adap->algo = &iic_algo;
729 adap->client_register = NULL; 730 adap->client_register = NULL;
730 adap->client_unregister = NULL; 731 adap->client_unregister = NULL;
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
index 03672c9ca409..9f2ffef4d812 100644
--- a/drivers/i2c/busses/i2c-isa.c
+++ b/drivers/i2c/busses/i2c-isa.c
@@ -92,15 +92,13 @@ int i2c_isa_add_driver(struct i2c_driver *driver)
92 int res; 92 int res;
93 93
94 /* Add the driver to the list of i2c drivers in the driver core */ 94 /* Add the driver to the list of i2c drivers in the driver core */
95 driver->driver.name = driver->name;
96 driver->driver.owner = driver->owner;
97 driver->driver.bus = &i2c_bus_type; 95 driver->driver.bus = &i2c_bus_type;
98 driver->driver.probe = i2c_isa_device_probe; 96 driver->driver.probe = i2c_isa_device_probe;
99 driver->driver.remove = i2c_isa_device_remove; 97 driver->driver.remove = i2c_isa_device_remove;
100 res = driver_register(&driver->driver); 98 res = driver_register(&driver->driver);
101 if (res) 99 if (res)
102 return res; 100 return res;
103 dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->name); 101 dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->driver.name);
104 102
105 /* Now look for clients */ 103 /* Now look for clients */
106 driver->attach_adapter(&isa_adapter); 104 driver->attach_adapter(&isa_adapter);
@@ -124,14 +122,14 @@ int i2c_isa_del_driver(struct i2c_driver *driver)
124 if ((res = driver->detach_client(client))) { 122 if ((res = driver->detach_client(client))) {
125 dev_err(&isa_adapter.dev, "Failed, driver " 123 dev_err(&isa_adapter.dev, "Failed, driver "
126 "%s not unregistered!\n", 124 "%s not unregistered!\n",
127 driver->name); 125 driver->driver.name);
128 return res; 126 return res;
129 } 127 }
130 } 128 }
131 129
132 /* Get the driver off the core list */ 130 /* Get the driver off the core list */
133 driver_unregister(&driver->driver); 131 driver_unregister(&driver->driver);
134 dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->name); 132 dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->driver.name);
135 133
136 return 0; 134 return 0;
137} 135}
@@ -176,7 +174,7 @@ static void __exit i2c_isa_exit(void)
176 list_for_each_safe(item, _n, &isa_adapter.clients) { 174 list_for_each_safe(item, _n, &isa_adapter.clients) {
177 client = list_entry(item, struct i2c_client, list); 175 client = list_entry(item, struct i2c_client, list);
178 dev_err(&isa_adapter.dev, "Driver %s still has an active " 176 dev_err(&isa_adapter.dev, "Driver %s still has an active "
179 "ISA client at 0x%x\n", client->driver->name, 177 "ISA client at 0x%x\n", client->driver->driver.name,
180 client->addr); 178 client->addr);
181 } 179 }
182 if (client != NULL) 180 if (client != NULL)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 81031eb51056..22781d84f79f 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * drivers/i2c/busses/i2c-mv64xxx.c
3 *
4 * Driver for the i2c controller on the Marvell line of host bridges for MIPS 2 * Driver for the i2c controller on the Marvell line of host bridges for MIPS
5 * and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0). 3 * and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0).
6 * 4 *
@@ -65,7 +63,6 @@ enum {
65 MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK, 63 MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK,
66 MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK, 64 MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK,
67 MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA, 65 MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA,
68 MV64XXX_I2C_STATE_ABORTING,
69}; 66};
70 67
71/* Driver actions */ 68/* Driver actions */
@@ -85,6 +82,7 @@ struct mv64xxx_i2c_data {
85 int irq; 82 int irq;
86 u32 state; 83 u32 state;
87 u32 action; 84 u32 action;
85 u32 aborting;
88 u32 cntl_bits; 86 u32 cntl_bits;
89 void __iomem *reg_base; 87 void __iomem *reg_base;
90 u32 reg_base_p; 88 u32 reg_base_p;
@@ -122,12 +120,6 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
122 return; 120 return;
123 } 121 }
124 122
125 if (drv_data->state == MV64XXX_I2C_STATE_ABORTING) {
126 drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
127 drv_data->state = MV64XXX_I2C_STATE_IDLE;
128 return;
129 }
130
131 /* The status from the ctlr [mostly] tells us what to do next */ 123 /* The status from the ctlr [mostly] tells us what to do next */
132 switch (status) { 124 switch (status) {
133 /* Start condition interrupt */ 125 /* Start condition interrupt */
@@ -148,14 +140,16 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
148 /* FALLTHRU */ 140 /* FALLTHRU */
149 case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */ 141 case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */
150 case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */ 142 case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */
151 if (drv_data->bytes_left > 0) { 143 if ((drv_data->bytes_left == 0)
144 || (drv_data->aborting
145 && (drv_data->byte_posn != 0))) {
146 drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
147 drv_data->state = MV64XXX_I2C_STATE_IDLE;
148 } else {
152 drv_data->action = MV64XXX_I2C_ACTION_SEND_DATA; 149 drv_data->action = MV64XXX_I2C_ACTION_SEND_DATA;
153 drv_data->state = 150 drv_data->state =
154 MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK; 151 MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK;
155 drv_data->bytes_left--; 152 drv_data->bytes_left--;
156 } else {
157 drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
158 drv_data->state = MV64XXX_I2C_STATE_IDLE;
159 } 153 }
160 break; 154 break;
161 155
@@ -184,7 +178,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
184 } 178 }
185 drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA; 179 drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA;
186 180
187 if (drv_data->bytes_left == 1) 181 if ((drv_data->bytes_left == 1) || drv_data->aborting)
188 drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_ACK; 182 drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_ACK;
189 break; 183 break;
190 184
@@ -320,6 +314,7 @@ mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data,
320 drv_data->msg = msg; 314 drv_data->msg = msg;
321 drv_data->byte_posn = 0; 315 drv_data->byte_posn = 0;
322 drv_data->bytes_left = msg->len; 316 drv_data->bytes_left = msg->len;
317 drv_data->aborting = 0;
323 drv_data->rc = 0; 318 drv_data->rc = 0;
324 drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | 319 drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK |
325 MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; 320 MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN;
@@ -359,17 +354,19 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
359 } 354 }
360 355
361 if (abort && drv_data->block) { 356 if (abort && drv_data->block) {
362 drv_data->state = MV64XXX_I2C_STATE_ABORTING; 357 drv_data->aborting = 1;
363 spin_unlock_irqrestore(&drv_data->lock, flags); 358 spin_unlock_irqrestore(&drv_data->lock, flags);
364 359
365 time_left = wait_event_timeout(drv_data->waitq, 360 time_left = wait_event_timeout(drv_data->waitq,
366 !drv_data->block, 361 !drv_data->block,
367 msecs_to_jiffies(drv_data->adapter.timeout)); 362 msecs_to_jiffies(drv_data->adapter.timeout));
368 363
369 if (time_left <= 0) { 364 if ((time_left <= 0) && drv_data->block) {
370 drv_data->state = MV64XXX_I2C_STATE_IDLE; 365 drv_data->state = MV64XXX_I2C_STATE_IDLE;
371 dev_err(&drv_data->adapter.dev, 366 dev_err(&drv_data->adapter.dev,
372 "mv64xxx: I2C bus locked\n"); 367 "mv64xxx: I2C bus locked, block: %d, "
368 "time_left: %d\n", drv_data->block,
369 (int)time_left);
373 } 370 }
374 } else 371 } else
375 spin_unlock_irqrestore(&drv_data->lock, flags); 372 spin_unlock_irqrestore(&drv_data->lock, flags);
@@ -510,7 +507,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
510 goto exit_kfree; 507 goto exit_kfree;
511 } 508 }
512 509
513 strncpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", 510 strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter",
514 I2C_NAME_SIZE); 511 I2C_NAME_SIZE);
515 512
516 init_waitqueue_head(&drv_data->waitq); 513 init_waitqueue_head(&drv_data->waitq);
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 4d18e6e5f159..2d80eb26f688 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -30,6 +30,7 @@
30 nForce3 Pro150 MCP 00D4 30 nForce3 Pro150 MCP 00D4
31 nForce3 250Gb MCP 00E4 31 nForce3 250Gb MCP 00E4
32 nForce4 MCP 0052 32 nForce4 MCP 0052
33 nForce4 MCP-04 0034
33 34
34 This driver supports the 2 SMBuses that are included in the MCP of the 35 This driver supports the 2 SMBuses that are included in the MCP of the
35 nForce2/3/4 chipsets. 36 nForce2/3/4 chipsets.
@@ -257,6 +258,7 @@ static struct pci_device_id nforce2_ids[] = {
257 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) }, 258 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) },
258 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS) }, 259 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS) },
259 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS) }, 260 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS) },
261 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS) },
260 { 0 } 262 { 0 }
261}; 263};
262 264
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h
index f63a53779281..d702e5e0388d 100644
--- a/drivers/i2c/busses/i2c-parport.h
+++ b/drivers/i2c/busses/i2c-parport.h
@@ -80,6 +80,14 @@ static struct adapter_parm adapter_parm[] = {
80 .setscl = { 0x01, DATA, 1 }, 80 .setscl = { 0x01, DATA, 1 },
81 .getsda = { 0x10, STAT, 1 }, 81 .getsda = { 0x10, STAT, 1 },
82 }, 82 },
83 /* type 6: Barco LPT->DVI (K5800236) adapter */
84 {
85 .setsda = { 0x02, DATA, 1 },
86 .setscl = { 0x01, DATA, 1 },
87 .getsda = { 0x20, STAT, 0 },
88 .getscl = { 0x40, STAT, 0 },
89 .init = { 0xfc, DATA, 0 },
90 },
83}; 91};
84 92
85static int type; 93static int type;
@@ -91,4 +99,6 @@ MODULE_PARM_DESC(type,
91 " 2 = Velleman K8000 adapter\n" 99 " 2 = Velleman K8000 adapter\n"
92 " 3 = ELV adapter\n" 100 " 3 = ELV adapter\n"
93 " 4 = ADM1032 evaluation board\n" 101 " 4 = ADM1032 evaluation board\n"
94 " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"); 102 " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"
103 " 6 = Barco LPT->DVI (K5800236) adapter\n"
104);