All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang, Wenyou <Wenyou.Yang@Microchip.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] i2c: at91_i2c: Wait for TXRDY after sending the first byte
Date: Thu, 30 Nov 2017 09:14:08 +0800	[thread overview]
Message-ID: <0f911812-78d8-03d7-f7a4-10cb430eb790@Microchip.com> (raw)
In-Reply-To: <20171129032524.14431-2-alan@softiron.com>



On 2017/11/29 11:25, Alan Ott wrote:
> The driver must wait for TXRDY after each byte is pushed into
> the i2c FIFO before pushing the next byte. Previously this was
> not done for the first byte, causing a race condition with zeros
> sometimes being sent for the next byte (which is typically the
> first actual data byte).
>
> Signed-off-by: Alan Ott <alan@softiron.com>
> ---
Acked-by:  Wenyou Yang <wenyou.yang@microchip.com>

Thank you for your patch.

>   drivers/i2c/at91_i2c.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c
> index d394044..20d0929 100644
> --- a/drivers/i2c/at91_i2c.c
> +++ b/drivers/i2c/at91_i2c.c
> @@ -72,6 +72,8 @@ static int at91_i2c_xfer_msg(struct at91_i2c_bus *bus, struct i2c_msg *msg)
>   
>   	} else {
>   		writel(msg->buf[0], &reg->thr);
> +		ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY);
> +
>   		for (i = 1; !ret && (i < msg->len); i++) {
>   			writel(msg->buf[i], &reg->thr);
>   			ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY);

Best Regards,
Wenyou Yang

  reply	other threads:[~2017-11-30  1:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29  3:25 [U-Boot] [PATCH 0/2] Fix the I2C on SAMA5D3 Alan Ott
2017-11-29  3:25 ` [U-Boot] [PATCH 1/2] i2c: at91_i2c: Wait for TXRDY after sending the first byte Alan Ott
2017-11-30  1:14   ` Yang, Wenyou [this message]
2017-12-07  8:26   ` Heiko Schocher
2017-12-07 12:21   ` Heiko Schocher
2017-11-29  3:25 ` [U-Boot] [PATCH 2/2] i2c: at91_i2c: remove the .probe_chip function Alan Ott
2017-11-30  1:20   ` Yang, Wenyou
2017-12-07  8:26   ` Heiko Schocher
2017-12-07 12:22   ` Heiko Schocher

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=0f911812-78d8-03d7-f7a4-10cb430eb790@Microchip.com \
    --to=wenyou.yang@microchip.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.