diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-05-01 17:26:33 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-05-01 17:26:33 -0400 |
commit | 7d054817b780e664bed6701b2aa637718e1905b7 (patch) | |
tree | b6487bf6475c023485f33958410f7714d63f8c3a | |
parent | 494dbb64dc5b369cc28542f4c4d634e57b0d7f18 (diff) |
i2c-pxa: Clean transaction stop
It was reported to me that the i2c-pxa driver was not able to process
more that 50 transactions per second. Investigation revealed that the
I2C unit was busy for 20 ms after every transaction. The reason seems
to be that we forget to clear the STOP and ACKNACK bits at the end of
the transaction. According to the PXA27x developer's manual, we shall
do so.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Nicolas Pitre <nico@cam.org>
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 14e83d0aac8c..2fc3bcec24d8 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -539,6 +539,18 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c) | |||
539 | writel(icr | ICR_START | ICR_TB, _ICR(i2c)); | 539 | writel(icr | ICR_START | ICR_TB, _ICR(i2c)); |
540 | } | 540 | } |
541 | 541 | ||
542 | static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) | ||
543 | { | ||
544 | u32 icr; | ||
545 | |||
546 | /* | ||
547 | * Clear the STOP and ACK flags | ||
548 | */ | ||
549 | icr = readl(_ICR(i2c)); | ||
550 | icr &= ~(ICR_STOP | ICR_ACKNAK); | ||
551 | writel(icr, _IRC(i2c)); | ||
552 | } | ||
553 | |||
542 | /* | 554 | /* |
543 | * We are protected by the adapter bus mutex. | 555 | * We are protected by the adapter bus mutex. |
544 | */ | 556 | */ |
@@ -581,6 +593,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) | |||
581 | * The rest of the processing occurs in the interrupt handler. | 593 | * The rest of the processing occurs in the interrupt handler. |
582 | */ | 594 | */ |
583 | timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5); | 595 | timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5); |
596 | i2c_pxa_stop_message(i2c); | ||
584 | 597 | ||
585 | /* | 598 | /* |
586 | * We place the return code in i2c->msg_idx. | 599 | * We place the return code in i2c->msg_idx. |