diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2014-05-28 09:44:42 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-06-01 22:22:42 +0200 |
commit | 3c95de674496e08d3b373f85af4aa59c23ddb8d6 (patch) | |
tree | 52b61accc660d2a0eed134564a52098df6241cd9 /drivers/i2c | |
parent | 386babf8e2f7dd483f88e5c0c4c761346b750185 (diff) | |
download | linux-3c95de674496e08d3b373f85af4aa59c23ddb8d6.tar.gz linux-3c95de674496e08d3b373f85af4aa59c23ddb8d6.tar.bz2 linux-3c95de674496e08d3b373f85af4aa59c23ddb8d6.zip |
i2c: rcar: refactor status bit handling
The old macros made it harder to see what was actually happening.
Replace them with something more readable.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-rcar.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 42005ccd3254..07256a6b56fa 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -87,6 +87,9 @@ #define RCAR_IRQ_RECV (MNRE | MALE | MSTE | MATE | MDRE) #define RCAR_IRQ_STOP (MSTE) +#define RCAR_IRQ_ACK_SEND (~(MAT | MDE)) +#define RCAR_IRQ_ACK_RECV (~(MAT | MDR)) + /* * flags */ @@ -268,27 +271,18 @@ scgd_find: * status functions */ -#define rcar_i2c_status_clear(priv) rcar_i2c_status_bit_clear(priv, 0xffffffff) -static void rcar_i2c_status_bit_clear(struct rcar_i2c_priv *priv, u32 bit) -{ - rcar_i2c_write(priv, ICMSR, ~bit); -} - static int rcar_i2c_prepare_msg(struct rcar_i2c_priv *priv) { int read = !!rcar_i2c_is_recv(priv); rcar_i2c_write(priv, ICMAR, (priv->msg->addr << 1) | read); - rcar_i2c_status_clear(priv); + rcar_i2c_write(priv, ICMSR, 0); rcar_i2c_write(priv, ICMCR, RCAR_BUS_PHASE_START); rcar_i2c_write(priv, ICMIER, read ? RCAR_IRQ_RECV : RCAR_IRQ_SEND); return 0; } -#define rcar_i2c_send_restart(priv) rcar_i2c_status_bit_clear(priv, (MAT | MDE)) -#define rcar_i2c_recv_restart(priv) rcar_i2c_status_bit_clear(priv, (MAT | MDR)) - /* * interrupt functions */ @@ -348,7 +342,7 @@ static int rcar_i2c_irq_send(struct rcar_i2c_priv *priv, u32 msr) return ID_DONE; } - rcar_i2c_send_restart(priv); + rcar_i2c_write(priv, ICMSR, RCAR_IRQ_ACK_SEND); return 0; } @@ -389,7 +383,7 @@ static int rcar_i2c_irq_recv(struct rcar_i2c_priv *priv, u32 msr) else rcar_i2c_write(priv, ICMCR, RCAR_BUS_PHASE_DATA); - rcar_i2c_recv_restart(priv); + rcar_i2c_write(priv, ICMSR, RCAR_IRQ_ACK_RECV); return 0; } @@ -452,7 +446,7 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) out: if (rcar_i2c_flags_has(priv, ID_DONE)) { rcar_i2c_write(priv, ICMIER, 0); - rcar_i2c_status_clear(priv); + rcar_i2c_write(priv, ICMSR, 0); wake_up(&priv->wait); } |