提交 7d054817 编写于 作者: J Jean Delvare 提交者: Jean Delvare

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: NJean Delvare <khali@linux-fr.org>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Nicolas Pitre <nico@cam.org>
上级 494dbb64
......@@ -539,6 +539,18 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
writel(icr | ICR_START | ICR_TB, _ICR(i2c));
}
static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
{
u32 icr;
/*
* Clear the STOP and ACK flags
*/
icr = readl(_ICR(i2c));
icr &= ~(ICR_STOP | ICR_ACKNAK);
writel(icr, _IRC(i2c));
}
/*
* We are protected by the adapter bus mutex.
*/
......@@ -581,6 +593,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
* The rest of the processing occurs in the interrupt handler.
*/
timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5);
i2c_pxa_stop_message(i2c);
/*
* We place the return code in i2c->msg_idx.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册