aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-i801.c4
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.c1
-rw-r--r--drivers/i2c/busses/i2c-mpc.c11
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c31
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c4
-rw-r--r--drivers/i2c/chips/isp1301_omap.c42
-rw-r--r--drivers/i2c/chips/menelaus.c3
7 files changed, 51 insertions, 45 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 8f5c686123b8..289816db52ae 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -272,11 +272,11 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
272 /* Make sure the SMBus host is ready to start transmitting */ 272 /* Make sure the SMBus host is ready to start transmitting */
273 temp = inb_p(SMBHSTSTS); 273 temp = inb_p(SMBHSTSTS);
274 if (i == 1) { 274 if (i == 1) {
275 /* Erronenous conditions before transaction: 275 /* Erroneous conditions before transaction:
276 * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ 276 * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */
277 errmask = 0x9f; 277 errmask = 0x9f;
278 } else { 278 } else {
279 /* Erronenous conditions during transaction: 279 /* Erroneous conditions during transaction:
280 * Failed, Bus_Err, Dev_Err, Intr */ 280 * Failed, Bus_Err, Dev_Err, Intr */
281 errmask = 0x1e; 281 errmask = 0x1e;
282 } 282 }
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 440342bc62e1..ace644e21b14 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -490,6 +490,7 @@ iop3xx_i2c_probe(struct platform_device *pdev)
490 memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); 490 memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
491 new_adapter->id = I2C_HW_IOP3XX; 491 new_adapter->id = I2C_HW_IOP3XX;
492 new_adapter->owner = THIS_MODULE; 492 new_adapter->owner = THIS_MODULE;
493 new_adapter->class = I2C_CLASS_HWMON;
493 new_adapter->dev.parent = &pdev->dev; 494 new_adapter->dev.parent = &pdev->dev;
494 new_adapter->nr = pdev->id; 495 new_adapter->nr = pdev->id;
495 496
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 851c3ed513d0..d8de4ac88b7d 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -105,6 +105,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
105 schedule(); 105 schedule();
106 if (time_after(jiffies, orig_jiffies + timeout)) { 106 if (time_after(jiffies, orig_jiffies + timeout)) {
107 pr_debug("I2C: timeout\n"); 107 pr_debug("I2C: timeout\n");
108 writeccr(i2c, 0);
108 result = -EIO; 109 result = -EIO;
109 break; 110 break;
110 } 111 }
@@ -116,10 +117,12 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
116 result = wait_event_interruptible_timeout(i2c->queue, 117 result = wait_event_interruptible_timeout(i2c->queue,
117 (i2c->interrupt & CSR_MIF), timeout * HZ); 118 (i2c->interrupt & CSR_MIF), timeout * HZ);
118 119
119 if (unlikely(result < 0)) 120 if (unlikely(result < 0)) {
120 pr_debug("I2C: wait interrupted\n"); 121 pr_debug("I2C: wait interrupted\n");
121 else if (unlikely(!(i2c->interrupt & CSR_MIF))) { 122 writeccr(i2c, 0);
123 } else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
122 pr_debug("I2C: wait timeout\n"); 124 pr_debug("I2C: wait timeout\n");
125 writeccr(i2c, 0);
123 result = -ETIMEDOUT; 126 result = -ETIMEDOUT;
124 } 127 }
125 128
@@ -172,7 +175,6 @@ static void mpc_i2c_start(struct mpc_i2c *i2c)
172static void mpc_i2c_stop(struct mpc_i2c *i2c) 175static void mpc_i2c_stop(struct mpc_i2c *i2c)
173{ 176{
174 writeccr(i2c, CCR_MEN); 177 writeccr(i2c, CCR_MEN);
175 writeccr(i2c, 0);
176} 178}
177 179
178static int mpc_write(struct mpc_i2c *i2c, int target, 180static int mpc_write(struct mpc_i2c *i2c, int target,
@@ -261,6 +263,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
261 while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { 263 while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) {
262 if (signal_pending(current)) { 264 if (signal_pending(current)) {
263 pr_debug("I2C: Interrupted\n"); 265 pr_debug("I2C: Interrupted\n");
266 writeccr(i2c, 0);
264 return -EINTR; 267 return -EINTR;
265 } 268 }
266 if (time_after(jiffies, orig_jiffies + HZ)) { 269 if (time_after(jiffies, orig_jiffies + HZ)) {
@@ -362,7 +365,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)
362 365
363 fail_add: 366 fail_add:
364 if (i2c->irq != 0) 367 if (i2c->irq != 0)
365 free_irq(i2c->irq, NULL); 368 free_irq(i2c->irq, i2c);
366 fail_irq: 369 fail_irq:
367 iounmap(i2c->base); 370 iounmap(i2c->base);
368 fail_map: 371 fail_map:
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 251154ae5d97..bb7bf68a7fb6 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -107,6 +107,21 @@ struct mv64xxx_i2c_data {
107 * 107 *
108 ***************************************************************************** 108 *****************************************************************************
109 */ 109 */
110
111/* Reset hardware and initialize FSM */
112static void
113mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
114{
115 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET);
116 writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)),
117 drv_data->reg_base + MV64XXX_I2C_REG_BAUD);
118 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR);
119 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR);
120 writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
121 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
122 drv_data->state = MV64XXX_I2C_STATE_IDLE;
123}
124
110static void 125static void
111mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) 126mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
112{ 127{
@@ -203,7 +218,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
203 drv_data->state, status, drv_data->msg->addr, 218 drv_data->state, status, drv_data->msg->addr,
204 drv_data->msg->flags); 219 drv_data->msg->flags);
205 drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; 220 drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
206 drv_data->state = MV64XXX_I2C_STATE_IDLE; 221 mv64xxx_i2c_hw_init(drv_data);
207 drv_data->rc = -EIO; 222 drv_data->rc = -EIO;
208 } 223 }
209} 224}
@@ -367,6 +382,7 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
367 "mv64xxx: I2C bus locked, block: %d, " 382 "mv64xxx: I2C bus locked, block: %d, "
368 "time_left: %d\n", drv_data->block, 383 "time_left: %d\n", drv_data->block,
369 (int)time_left); 384 (int)time_left);
385 mv64xxx_i2c_hw_init(drv_data);
370 } 386 }
371 } else 387 } else
372 spin_unlock_irqrestore(&drv_data->lock, flags); 388 spin_unlock_irqrestore(&drv_data->lock, flags);
@@ -443,19 +459,6 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = {
443 * 459 *
444 ***************************************************************************** 460 *****************************************************************************
445 */ 461 */
446static void __devinit
447mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
448{
449 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET);
450 writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)),
451 drv_data->reg_base + MV64XXX_I2C_REG_BAUD);
452 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR);
453 writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR);
454 writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
455 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
456 drv_data->state = MV64XXX_I2C_STATE_IDLE;
457}
458
459static int __devinit 462static int __devinit
460mv64xxx_i2c_map_regs(struct platform_device *pd, 463mv64xxx_i2c_map_regs(struct platform_device *pd,
461 struct mv64xxx_i2c_data *drv_data) 464 struct mv64xxx_i2c_data *drv_data)
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index e4540fcf6476..c44ada5f4292 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -39,8 +39,8 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#include <asm/arch/regs-gpio.h> 41#include <asm/arch/regs-gpio.h>
42#include <asm/arch/regs-iic.h> 42#include <asm/plat-s3c/regs-iic.h>
43#include <asm/arch/iic.h> 43#include <asm/plat-s3c/iic.h>
44 44
45/* i2c controller state */ 45/* i2c controller state */
46 46
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
index 9fafadb92510..fe04e46991aa 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -18,8 +18,6 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21#undef DEBUG
22#undef VERBOSE
23 21
24#include <linux/kernel.h> 22#include <linux/kernel.h>
25#include <linux/module.h> 23#include <linux/module.h>
@@ -44,7 +42,7 @@
44 42
45 43
46#define DRIVER_VERSION "24 August 2004" 44#define DRIVER_VERSION "24 August 2004"
47#define DRIVER_NAME (isp1301_driver.name) 45#define DRIVER_NAME (isp1301_driver.driver.name)
48 46
49MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver"); 47MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
50MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
@@ -55,6 +53,7 @@ struct isp1301 {
55 void (*i2c_release)(struct device *dev); 53 void (*i2c_release)(struct device *dev);
56 54
57 int irq; 55 int irq;
56 int irq_type;
58 57
59 u32 last_otg_ctrl; 58 u32 last_otg_ctrl;
60 unsigned working:1; 59 unsigned working:1;
@@ -63,7 +62,7 @@ struct isp1301 {
63 62
64 /* use keventd context to change the state for us */ 63 /* use keventd context to change the state for us */
65 struct work_struct work; 64 struct work_struct work;
66 65
67 unsigned long todo; 66 unsigned long todo;
68# define WORK_UPDATE_ISP 0 /* update ISP from OTG */ 67# define WORK_UPDATE_ISP 0 /* update ISP from OTG */
69# define WORK_UPDATE_OTG 1 /* update OTG from ISP */ 68# define WORK_UPDATE_OTG 1 /* update OTG from ISP */
@@ -94,7 +93,7 @@ struct isp1301 {
94 93
95/* board-specific PM hooks */ 94/* board-specific PM hooks */
96 95
97#include <asm/arch/gpio.h> 96#include <asm/gpio.h>
98#include <asm/arch/mux.h> 97#include <asm/arch/mux.h>
99#include <asm/mach-types.h> 98#include <asm/mach-types.h>
100 99
@@ -291,7 +290,7 @@ static void power_up(struct isp1301 *isp)
291{ 290{
292 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); 291 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
293 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); 292 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG);
294 293
295 /* do this only when cpu is driving transceiver, 294 /* do this only when cpu is driving transceiver,
296 * so host won't see a low speed device... 295 * so host won't see a low speed device...
297 */ 296 */
@@ -799,7 +798,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
799 /* role is host */ 798 /* role is host */
800 } else { 799 } else {
801 if (!(otg_ctrl & OTG_ID)) { 800 if (!(otg_ctrl & OTG_ID)) {
802 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 801 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
803 OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; 802 OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ;
804 } 803 }
805 804
@@ -1100,9 +1099,9 @@ static u8 isp1301_clear_latch(struct isp1301 *isp)
1100} 1099}
1101 1100
1102static void 1101static void
1103isp1301_work(void *data) 1102isp1301_work(struct work_struct *work)
1104{ 1103{
1105 struct isp1301 *isp = data; 1104 struct isp1301 *isp = container_of(work, struct isp1301, work);
1106 int stop; 1105 int stop;
1107 1106
1108 /* implicit lock: we're the only task using this device */ 1107 /* implicit lock: we're the only task using this device */
@@ -1244,7 +1243,7 @@ static int isp1301_detach_client(struct i2c_client *i2c)
1244 * - DEVICE mode, for when there's a B/Mini-B (device) connector 1243 * - DEVICE mode, for when there's a B/Mini-B (device) connector
1245 * 1244 *
1246 * As a rule, you won't have an isp1301 chip unless it's there to 1245 * As a rule, you won't have an isp1301 chip unless it's there to
1247 * support the OTG mode. Other modes help testing USB controllers 1246 * support the OTG mode. Other modes help testing USB controllers
1248 * in isolation from (full) OTG support, or maybe so later board 1247 * in isolation from (full) OTG support, or maybe so later board
1249 * revisions can help to support those feature. 1248 * revisions can help to support those feature.
1250 */ 1249 */
@@ -1260,9 +1259,9 @@ static int isp1301_otg_enable(struct isp1301 *isp)
1260 * a few more interrupts than are strictly needed. 1259 * a few more interrupts than are strictly needed.
1261 */ 1260 */
1262 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1261 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1263 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); 1262 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
1264 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1263 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1265 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); 1264 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
1266 1265
1267 dev_info(&isp->client.dev, "ready for dual-role USB ...\n"); 1266 dev_info(&isp->client.dev, "ready for dual-role USB ...\n");
1268 1267
@@ -1306,9 +1305,9 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host)
1306 1305
1307 dev_info(&isp->client.dev, "A-Host sessions ok\n"); 1306 dev_info(&isp->client.dev, "A-Host sessions ok\n");
1308 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1307 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1309 INTR_ID_GND); 1308 INTR_ID_GND);
1310 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1309 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1311 INTR_ID_GND); 1310 INTR_ID_GND);
1312 1311
1313 /* If this has a Mini-AB connector, this mode is highly 1312 /* If this has a Mini-AB connector, this mode is highly
1314 * nonstandard ... but can be handy for testing, especially with 1313 * nonstandard ... but can be handy for testing, especially with
@@ -1368,9 +1367,9 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
1368 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); 1367 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
1369 1368
1370 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1369 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1371 INTR_SESS_VLD); 1370 INTR_SESS_VLD);
1372 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1371 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1373 INTR_VBUS_VLD); 1372 INTR_VBUS_VLD);
1374 dev_info(&isp->client.dev, "B-Peripheral sessions ok\n"); 1373 dev_info(&isp->client.dev, "B-Peripheral sessions ok\n");
1375 dump_regs(isp, __FUNCTION__); 1374 dump_regs(isp, __FUNCTION__);
1376 1375
@@ -1494,7 +1493,7 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind)
1494 if (!isp) 1493 if (!isp)
1495 return 0; 1494 return 0;
1496 1495
1497 INIT_WORK(&isp->work, isp1301_work, isp); 1496 INIT_WORK(&isp->work, isp1301_work);
1498 init_timer(&isp->timer); 1497 init_timer(&isp->timer);
1499 isp->timer.function = isp1301_timer; 1498 isp->timer.function = isp1301_timer;
1500 isp->timer.data = (unsigned long) isp; 1499 isp->timer.data = (unsigned long) isp;
@@ -1572,13 +1571,14 @@ fail1:
1572 /* IRQ wired at M14 */ 1571 /* IRQ wired at M14 */
1573 omap_cfg_reg(M14_1510_GPIO2); 1572 omap_cfg_reg(M14_1510_GPIO2);
1574 isp->irq = OMAP_GPIO_IRQ(2); 1573 isp->irq = OMAP_GPIO_IRQ(2);
1575 omap_request_gpio(2); 1574 if (gpio_request(2, "isp1301") == 0)
1576 omap_set_gpio_direction(2, 1); 1575 gpio_direction_input(2);
1577 omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE); 1576 isp->irq_type = IRQF_TRIGGER_FALLING;
1578 } 1577 }
1579 1578
1579 isp->irq_type |= IRQF_SAMPLE_RANDOM;
1580 status = request_irq(isp->irq, isp1301_irq, 1580 status = request_irq(isp->irq, isp1301_irq,
1581 IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp); 1581 isp->irq_type, DRIVER_NAME, isp);
1582 if (status < 0) { 1582 if (status < 0) {
1583 dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", 1583 dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n",
1584 isp->irq, status); 1584 isp->irq, status);
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c
index 48a7e2f0bdd3..d9c92c5e0077 100644
--- a/drivers/i2c/chips/menelaus.c
+++ b/drivers/i2c/chips/menelaus.c
@@ -1,4 +1,3 @@
1#define DEBUG
2/* 1/*
3 * Copyright (C) 2004 Texas Instruments, Inc. 2 * Copyright (C) 2004 Texas Instruments, Inc.
4 * 3 *
@@ -933,7 +932,7 @@ static int menelaus_set_time(struct device *dev, struct rtc_time *t)
933 return status; 932 return status;
934 status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday)); 933 status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday));
935 if (status < 0) { 934 if (status < 0) {
936 dev_err(&the_menelaus->client->dev, "rtc write reg %02x", 935 dev_err(&the_menelaus->client->dev, "rtc write reg %02x "
937 "err %d\n", MENELAUS_RTC_WKDAY, status); 936 "err %d\n", MENELAUS_RTC_WKDAY, status);
938 return status; 937 return status;
939 } 938 }