linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Michail Georgios Etairidis <m.etairidis@beck-ipc.com>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"darius.augulis@teltonika.lt" <darius.augulis@teltonika.lt>
Subject: Re: [PATCH] i2c: i2c-imx: Use correct function to write to register
Date: Thu, 08 Jun 2017 18:43:48 +0200	[thread overview]
Message-ID: <1496940228.17240.10.camel@pengutronix.de> (raw)
In-Reply-To: <681500CE65202E47A192754B01DAB4671B16747DB9@SDE12.beckipc.net>

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,
> 
> 

       reply	other threads:[~2017-06-08 16:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <681500CE65202E47A192754B01DAB4671B16747DB9@SDE12.beckipc.net>
2017-06-08 16:43 ` Lucas Stach [this message]
2017-06-08 17:07 [PATCH] i2c: i2c-imx: Use correct function to write to register Michail Georgios Etairidis
  -- strict thread matches above, loose matches on Subject: below --
2017-06-09 13:28 Michail Georgios Etairidis
2017-06-19 14:46 ` Wolfram Sang
2017-06-20  8:20   ` AW: " Michail Georgios Etairidis
2017-06-20  8:28     ` Uwe Kleine-König
2017-06-20  9:23       ` Wolfram Sang
2017-06-22  8:54     ` Wolfram Sang
2017-06-19 18:54 ` Uwe Kleine-König
2017-06-20  1:50   ` Andy Duan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496940228.17240.10.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=darius.augulis@teltonika.lt \
    --cc=kernel@pengutronix.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=m.etairidis@beck-ipc.com \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).