Re: [PATCH] i2c: i2c-imx: Use correct function to write to register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michail,

which kernel is this based on? The change doesn't seem to match the
prototype of imx_i2c_read_reg() and imx_i2c_write_reg() of the upstream
kernel.

Also please fix your mailer to send patches in plain text instead of
HTML.

Regards,
Lucas

Am Donnerstag, den 08.06.2017, 18:34 +0200 schrieb Michail Georgios
Etairidis:
> The i2c-imx driver incorrectly uses readb()/writeb() to read and write
> to the appropriate registers when performing a repeated start. The
> appropriate imx_i2c_read_reg()/imx_i2c_write_reg() functions should be
> used instead. Performing a repeated start results to a kernel panic.
> 
>  
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c
> b/drivers/i2c/busses/i2c-imx.c
> 
> index 95ed1718..988bb620 100644
> 
> --- a/drivers/i2c/busses/i2c-imx.c
> 
> +++ b/drivers/i2c/busses/i2c-imx.c
> 
> @@ -734,9 +734,9 @@ static int i2c_imx_dma_read(struct imx_i2c_struct
> *i2c_imx,
> 
>                                 * the first read operation, otherwise
> the first read cost
> 
>                                 * one extra clock cycle.
> 
>                                 */
> 
> -                              temp = readb(i2c_imx->base +
> IMX_I2C_I2CR);
> 
> +                             temp = imx_i2c_read_reg(i2c_imx->base +
> IMX_I2C_I2CR);
> 
>                                temp |= I2CR_MTX;
> 
> -                              writeb(temp, i2c_imx->base +
> IMX_I2C_I2CR);
> 
> +                             imx_i2c_write_reg(temp, i2c_imx->base +
> IMX_I2C_I2CR);
> 
>                }
> 
>                msgs->buf[msgs->len-1] = imx_i2c_read_reg(i2c_imx,
> IMX_I2C_I2DR);
> 
> @@ -857,9 +857,9 @@ static int i2c_imx_read(struct imx_i2c_struct
> *i2c_imx, struct i2c_msg *msgs, bo
> 
>                                                                 * the
> first read operation, otherwise the first read cost
> 
>                                                                 * one
> extra clock cycle.
> 
>                                                                 */
> 
> -                                                              temp =
> readb(i2c_imx->base + IMX_I2C_I2CR);
> 
> +                                                             temp =
> imx_i2c_read_reg(i2c_imx->base + IMX_I2C_I2CR);
> 
>                                                                temp |=
> I2CR_MTX;
> 
> -
> writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
> 
> +
> imx_i2c_write_reg(temp, i2c_imx->base + IMX_I2C_I2CR);
> 
>                                                }
> 
>                                } else if (i == (msgs->len - 2)) {
> 
> 
> dev_dbg(&i2c_imx->adapter.dev,
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux