mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-20 09:34:44 +08:00
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Two more driver bugfixes" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: bcm2835: Clear current buffer pointers and counts after a transfer i2c: cadence: Fix the hold bit setting
This commit is contained in:
commit
1653c2f2da
@ -183,6 +183,15 @@ static void bcm2835_i2c_start_transfer(struct bcm2835_i2c_dev *i2c_dev)
|
||||
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, c);
|
||||
}
|
||||
|
||||
static void bcm2835_i2c_finish_transfer(struct bcm2835_i2c_dev *i2c_dev)
|
||||
{
|
||||
i2c_dev->curr_msg = NULL;
|
||||
i2c_dev->num_msgs = 0;
|
||||
|
||||
i2c_dev->msg_buf = NULL;
|
||||
i2c_dev->msg_buf_remaining = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note about I2C_C_CLEAR on error:
|
||||
* The I2C_C_CLEAR on errors will take some time to resolve -- if you were in
|
||||
@ -283,6 +292,9 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
||||
|
||||
time_left = wait_for_completion_timeout(&i2c_dev->completion,
|
||||
adap->timeout);
|
||||
|
||||
bcm2835_i2c_finish_transfer(i2c_dev);
|
||||
|
||||
if (!time_left) {
|
||||
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C,
|
||||
BCM2835_I2C_C_CLEAR);
|
||||
|
@ -382,8 +382,10 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
|
||||
* Check for the message size against FIFO depth and set the
|
||||
* 'hold bus' bit if it is greater than FIFO depth.
|
||||
*/
|
||||
if (id->recv_count > CDNS_I2C_FIFO_DEPTH)
|
||||
if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
|
||||
ctrl_reg |= CDNS_I2C_CR_HOLD;
|
||||
else
|
||||
ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
|
||||
|
||||
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
|
||||
|
||||
@ -440,8 +442,11 @@ static void cdns_i2c_msend(struct cdns_i2c *id)
|
||||
* Check for the message size against FIFO depth and set the
|
||||
* 'hold bus' bit if it is greater than FIFO depth.
|
||||
*/
|
||||
if (id->send_count > CDNS_I2C_FIFO_DEPTH)
|
||||
if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
|
||||
ctrl_reg |= CDNS_I2C_CR_HOLD;
|
||||
else
|
||||
ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
|
||||
|
||||
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
|
||||
|
||||
/* Clear the interrupts in interrupt status register. */
|
||||
|
Loading…
Reference in New Issue
Block a user