[U-Boot] [PATCH v2 5/6] i2c: rcar_i2c: Set the slave address from rcar_i2c_xfer

Marek Vasut marek.vasut at gmail.com
Tue Mar 5 18:29:45 UTC 2019


On 3/5/19 12:16 PM, Ismael Luceno Cortes wrote:

Commit message is missing :-(

The patch itself is fine though. Can you fill the commit message and do
a V3 of the series ?

> Signed-off-by: Ismael Luceno <ismael.luceno at silicon-gears.com>
> ---
> 
> Notes:
>     Changes since v1:
>     - Rebased on top of patch 1050650 ("i2c: rcar_i2c: Add Gen3 SoC support")
>     - Fixed masking of return value from rcar_i2c_set_addr
> 
>  drivers/i2c/rcar_i2c.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/i2c/rcar_i2c.c b/drivers/i2c/rcar_i2c.c
> index d6b0418290..4556b115bd 100644
> --- a/drivers/i2c/rcar_i2c.c
> +++ b/drivers/i2c/rcar_i2c.c
> @@ -154,10 +154,6 @@ static int rcar_i2c_read_common(struct udevice *dev, struct i2c_msg *msg)
>  	u32 icmcr = RCAR_I2C_ICMCR_MDBS | RCAR_I2C_ICMCR_MIE;
>  	int i, ret = -EREMOTEIO;
>  
> -	ret = rcar_i2c_set_addr(dev, msg->addr, 1);
> -	if (ret)
> -		return ret;
> -
>  	for (i = 0; i < msg->len; i++) {
>  		if (msg->len - 1 == i)
>  			icmcr |= RCAR_I2C_ICMCR_FSB;
> @@ -184,10 +180,6 @@ static int rcar_i2c_write_common(struct udevice *dev, struct i2c_msg *msg)
>  	u32 icmcr = RCAR_I2C_ICMCR_MDBS | RCAR_I2C_ICMCR_MIE;
>  	int i, ret = -EREMOTEIO;
>  
> -	ret = rcar_i2c_set_addr(dev, msg->addr, 0);
> -	if (ret)
> -		return ret;
> -
>  	for (i = 0; i < msg->len; i++) {
>  		writel(msg->buf[i], priv->base + RCAR_I2C_ICRXD_ICTXD);
>  		writel(icmcr, priv->base + RCAR_I2C_ICMCR);
> @@ -211,6 +203,10 @@ static int rcar_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, int nmsgs)
>  	int ret;
>  
>  	for (; nmsgs > 0; nmsgs--, msg++) {
> +		ret = rcar_i2c_set_addr(dev, msg->addr, 1);
> +		if (ret)
> +			return ret;
> +
>  		if (msg->flags & I2C_M_RD)
>  			ret = rcar_i2c_read_common(dev, msg);
>  		else
> @@ -220,7 +216,7 @@ static int rcar_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, int nmsgs)
>  			return ret;
>  	}
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static int rcar_i2c_probe_chip(struct udevice *dev, uint addr, uint flags)
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list