From: Bo Shen <voice.shen@atmel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] question about software i2c multi instance
Date: Mon, 23 Mar 2015 14:27:47 +0800 [thread overview]
Message-ID: <550FB263.5050102@atmel.com> (raw)
In-Reply-To: <550BF214.7060208@denx.de>
Hi Heiko,
On 03/20/2015 06:10 PM, Heiko Schocher wrote:
> Hello Bo,
>
> Am 20.03.2015 10:44, schrieb Bo Shen:
>> Hi Heiko,
>> After check the software i2c code, I found it can not support multi
>> instances, although it has I2C_SOFT_DECLARATIONS2,
>> I2C_SOFT_DECLARATIONS3, I2C_SOFT_DECLARATIONS4.
>> Because, when do GPIO operation, there is only one pair of
>> CONFIG_SOFT_I2C_GPIO_SCL and CONFIG_SOFT_I2C_GPIO_SDA.
>> So, if want to support multi instances, it needs to extend the GPIO
>> configuration for SCL/SDA, am I right?
>
> Prefered way should be to use DM, Przemyslaw posted patches
> for the soft-i2c driver, see
> http://lists.denx.de/pipermail/u-boot/2015-March/207641.html
>
> maybe you can try this?
Thanks for your information.
As I try to use the old version of U-Boot, it doesn't support DM well.
> If not, you are right, you must define your own
> I2C_SCL/I2C_SDA/I2C_READ/I2C_INIT
> defines, for example:
>
> # define I2C_SCL(bit) \
> do { \
> switch(I2C_ADAP_HWNR) {
> case 0:
>
> gpio_direction_output(CONFIG_SOFT_I2C_GPIO_SCL_0, bit); \
> break;
> case 1:
>
> gpio_direction_output(CONFIG_SOFT_I2C_GPIO_SCL_1, bit); \
> break;
> [...]
> I2C_GPIO_SYNC; \
> } while (0)
For this, the I2C_SCL and I2C_SDA working, however for I2C_READ, it
maybe need to modify the definition from micro to function, as the
I2C_READ can not use do {} while.
Thanks again.
> bye,
> Heiko
Best Regards,
Bo Shen
next prev parent reply other threads:[~2015-03-23 6:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-20 9:44 [U-Boot] question about software i2c multi instance Bo Shen
2015-03-20 10:10 ` Heiko Schocher
2015-03-23 6:27 ` Bo Shen [this message]
2015-03-23 8:28 ` Lukasz Majewski
2015-03-23 8:36 ` Bo Shen
2015-03-23 8:47 ` Przemyslaw Marczak
2015-03-23 9:09 ` Bo Shen
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=550FB263.5050102@atmel.com \
--to=voice.shen@atmel.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.