Commit 1653c2f2 authored by Linus Torvalds's avatar Linus Torvalds

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
parents b8c82b6a f275a465
...@@ -183,6 +183,15 @@ static void bcm2835_i2c_start_transfer(struct bcm2835_i2c_dev *i2c_dev) ...@@ -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); 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: * Note about I2C_C_CLEAR on error:
* The I2C_C_CLEAR on errors will take some time to resolve -- if you were in * 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[], ...@@ -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, time_left = wait_for_completion_timeout(&i2c_dev->completion,
adap->timeout); adap->timeout);
bcm2835_i2c_finish_transfer(i2c_dev);
if (!time_left) { if (!time_left) {
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C,
BCM2835_I2C_C_CLEAR); BCM2835_I2C_C_CLEAR);
......
...@@ -382,8 +382,10 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) ...@@ -382,8 +382,10 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
* Check for the message size against FIFO depth and set the * Check for the message size against FIFO depth and set the
* 'hold bus' bit if it is greater than FIFO depth. * '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; ctrl_reg |= CDNS_I2C_CR_HOLD;
else
ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET); cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
...@@ -440,8 +442,11 @@ static void cdns_i2c_msend(struct cdns_i2c *id) ...@@ -440,8 +442,11 @@ static void cdns_i2c_msend(struct cdns_i2c *id)
* Check for the message size against FIFO depth and set the * Check for the message size against FIFO depth and set the
* 'hold bus' bit if it is greater than FIFO depth. * '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; ctrl_reg |= CDNS_I2C_CR_HOLD;
else
ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET); cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
/* Clear the interrupts in interrupt status register. */ /* Clear the interrupts in interrupt status register. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment