lkml.org 
[lkml]   [2014]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 2/3] i2c: Add driver for Cadence I2C controller
On Thu, Apr 03, 2014 at 10:59:26AM -0700, Soren Brinkmann wrote:
> Add a driver for the Cadence I2C controller. This controller is for
> example found in Xilinx Zynq.
>
> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
> Tested-by: Michal Simek <michal.simek@xilinx.com>
> Reviewed-by: Harini Katakam <harinik@xilinx.com>

Only minor stuff, but since you resend anyhow because of 400kHz issue...

> +static void cdns_i2c_mrecv(struct cdns_i2c *id)
> +{
> + unsigned int ctrl_reg;
> + unsigned int isr_status;
> +
> + id->p_recv_buf = id->p_msg->buf;
> + id->recv_count = id->p_msg->len;
> +
> + /* Put the controller in master receive mode and clear the FIFO */
> + ctrl_reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
> + ctrl_reg |= CDNS_I2C_CR_RW | CDNS_I2C_CR_CLR_FIFO;
> +
> + if ((id->p_msg->flags & I2C_M_RECV_LEN) == I2C_M_RECV_LEN)

'if (id->p_msg->flags & I2C_M_RECV_LEN)' is enough.

> + /* Report the other error interrupts to application as EIO */
> + if (id->err_status & (CDNS_I2C_IXR_RX_UNF |
> + CDNS_I2C_IXR_TX_OVF |
> + CDNS_I2C_IXR_RX_OVF |
> + CDNS_I2C_IXR_NACK)) {
> + cdns_i2c_master_reset(adap);
> + return -EIO;
> + }

NACK is returned as -ENXIO. Check 'Documentation/i2c/fault-codes' for
standard patterns. I'd think the rest is EIO, though.

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-04-04 17:01    [W:0.075 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site