diff options
author | Tony Lindgren <tony@atomide.com> | 2008-11-21 16:39:47 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-11-21 16:39:47 -0500 |
commit | c1a473bde4c06e8e6996ce3a33121b7a9a86b4b9 (patch) | |
tree | d8374eea9645de1bf59481e28a3d02e10c350b01 /drivers/i2c/busses/i2c-omap.c | |
parent | 43469d8e2aaecc61403d1527dda7441fba8c0e50 (diff) |
i2c-omap: Clean-up i2c-omap
Minor sparse, checkpatch and formatting clean-up. Also update copyrights.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/i2c/busses/i2c-omap.c')
-rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 195c3d1a725e..4aeebad8ec93 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -2,13 +2,16 @@ | |||
2 | * TI OMAP I2C master mode driver | 2 | * TI OMAP I2C master mode driver |
3 | * | 3 | * |
4 | * Copyright (C) 2003 MontaVista Software, Inc. | 4 | * Copyright (C) 2003 MontaVista Software, Inc. |
5 | * Copyright (C) 2004 Texas Instruments. | ||
6 | * | ||
7 | * Updated to work with multiple I2C interfaces on 24xx by | ||
8 | * Tony Lindgren <tony@atomide.com> and Imre Deak <imre.deak@nokia.com> | ||
9 | * Copyright (C) 2005 Nokia Corporation | 5 | * Copyright (C) 2005 Nokia Corporation |
6 | * Copyright (C) 2004 - 2007 Texas Instruments. | ||
10 | * | 7 | * |
11 | * Cleaned up by Juha Yrjölä <juha.yrjola@nokia.com> | 8 | * Originally written by MontaVista Software, Inc. |
9 | * Additional contributions by: | ||
10 | * Tony Lindgren <tony@atomide.com> | ||
11 | * Imre Deak <imre.deak@nokia.com> | ||
12 | * Juha Yrjölä <juha.yrjola@solidboot.com> | ||
13 | * Syed Khasim <x0khasim@ti.com> | ||
14 | * Nishant Menon <nm@ti.com> | ||
12 | * | 15 | * |
13 | * This program is free software; you can redistribute it and/or modify | 16 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by | 17 | * it under the terms of the GNU General Public License as published by |
@@ -33,8 +36,7 @@ | |||
33 | #include <linux/completion.h> | 36 | #include <linux/completion.h> |
34 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
35 | #include <linux/clk.h> | 38 | #include <linux/clk.h> |
36 | 39 | #include <linux/io.h> | |
37 | #include <asm/io.h> | ||
38 | 40 | ||
39 | /* timeout waiting for the controller to respond */ | 41 | /* timeout waiting for the controller to respond */ |
40 | #define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000)) | 42 | #define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000)) |
@@ -204,7 +206,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev) | |||
204 | dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); | 206 | dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); |
205 | omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0); | 207 | omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0); |
206 | if (dev->rev1) { | 208 | if (dev->rev1) { |
207 | iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */ | 209 | iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */ |
208 | } else { | 210 | } else { |
209 | omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate); | 211 | omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate); |
210 | 212 | ||
@@ -321,9 +323,9 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) | |||
321 | 323 | ||
322 | /* Enable interrupts */ | 324 | /* Enable interrupts */ |
323 | omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, | 325 | omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, |
324 | (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY | | 326 | (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY | |
325 | OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK | | 327 | OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK | |
326 | OMAP_I2C_IE_AL) | ((dev->fifo_size) ? | 328 | OMAP_I2C_IE_AL) | ((dev->fifo_size) ? |
327 | (OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0)); | 329 | (OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0)); |
328 | return 0; | 330 | return 0; |
329 | } | 331 | } |
@@ -389,8 +391,10 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, | |||
389 | w |= OMAP_I2C_CON_XA; | 391 | w |= OMAP_I2C_CON_XA; |
390 | if (!(msg->flags & I2C_M_RD)) | 392 | if (!(msg->flags & I2C_M_RD)) |
391 | w |= OMAP_I2C_CON_TRX; | 393 | w |= OMAP_I2C_CON_TRX; |
394 | |||
392 | if (!dev->b_hw && stop) | 395 | if (!dev->b_hw && stop) |
393 | w |= OMAP_I2C_CON_STP; | 396 | w |= OMAP_I2C_CON_STP; |
397 | |||
394 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w); | 398 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w); |
395 | 399 | ||
396 | /* | 400 | /* |
@@ -468,7 +472,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
468 | 472 | ||
469 | omap_i2c_unidle(dev); | 473 | omap_i2c_unidle(dev); |
470 | 474 | ||
471 | if ((r = omap_i2c_wait_for_bb(dev)) < 0) | 475 | r = omap_i2c_wait_for_bb(dev); |
476 | if (r < 0) | ||
472 | goto out; | 477 | goto out; |
473 | 478 | ||
474 | for (i = 0; i < num; i++) { | 479 | for (i = 0; i < num; i++) { |
@@ -561,7 +566,7 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id) | |||
561 | return IRQ_HANDLED; | 566 | return IRQ_HANDLED; |
562 | } | 567 | } |
563 | #else | 568 | #else |
564 | #define omap_i2c_rev1_isr 0 | 569 | #define omap_i2c_rev1_isr NULL |
565 | #endif | 570 | #endif |
566 | 571 | ||
567 | static irqreturn_t | 572 | static irqreturn_t |