All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] i2c: fix SDA contention in read_byte()
Date: Mon, 12 Jul 2010 12:14:39 +0800	[thread overview]
Message-ID: <4C3A96AF.9080109@wytron.com.tw> (raw)
In-Reply-To: <4C3409F6.9000902@emk-elektronik.de>

Reinhard Meyer wrote:
> Whenever possible by the hardware, I make I2C_SDA/SCL(1) do a tri-state and
> I2C_TRISTATE and I2C_ACTIVE are empty.

Dear Mike,

I traced the i2c-gpio.c of linux and realized that there are potential 
bus contention with the current soft_i2c.c if the ports are not 
open-drained.

Reinhard suggested a solution, which was similar to what linux driver 
does. So I would withdraw my SDA patch.

For our i2c gpio framework, I added these changes and tested on my 
boards. Please check if it works on yours.

# ifndef I2C_ACTIVE
#  define I2C_ACTIVE do {} while (0)
# endif

# ifndef I2C_TRISTATE
#  define I2C_TRISTATE do {} while (0)
# endif

# ifndef I2C_SDA
#  define I2C_SDA(bit) \
	if (bit) {						\
		gpio_direction_input(CONFIG_SOFT_I2C_GPIO_SDA);	\
	} else {						\
		gpio_direction_output(CONFIG_SOFT_I2C_GPIO_SDA, 0);\
	}
# endif

I didn't tristate SCL(1) because it cannot be tristated on some nios2 
boards. As soft_i2c of u-boot didn't support clock stretching, it 
shouldn't matter.

Best regards,
Thomas

  reply	other threads:[~2010-07-12  4:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06  6:14 [U-Boot] [PATCH] i2c: fix SDA contention in read_byte() Thomas Chou
2010-07-07  4:45 ` Andrew Dyer
2010-07-07  5:00   ` Reinhard Meyer
2010-07-12  4:14     ` Thomas Chou [this message]
2010-07-12  5:00       ` Reinhard Meyer
2010-07-12  5:51         ` Thomas Chou
2010-07-12  6:49           ` Reinhard Meyer
2010-07-14  1:29             ` Thomas Chou
2010-07-14  6:31               ` Reinhard Meyer
2010-07-21 17:40       ` Mike Frysinger
2010-07-22  2:47         ` Thomas Chou
2010-07-11 22:55   ` Mike Frysinger
2010-07-12  3:47     ` Andrew Dyer

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=4C3A96AF.9080109@wytron.com.tw \
    --to=thomas@wytron.com.tw \
    --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.