From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] i2c:gpio:s5p: I2C GPIO Software implementation
Date: Wed, 06 Jul 2011 12:08:04 +0200 [thread overview]
Message-ID: <4E143404.10704@denx.de> (raw)
In-Reply-To: <20110706113645.70178792@lmajewski.digital.local>
Hello Lukasz,
Lukasz Majewski wrote:
> On Wed, 06 Jul 2011 07:56:20 +0200
> Heiko Schocher <hs@denx.de> wrote:
>
>> Hello Mike,
>>
>> Mike Frysinger wrote:
>>> On Tuesday, July 05, 2011 08:23:41 Lukasz Majewski wrote:
>>>> This commit adds I2C software support for Samsung's S5PC110
>>>> family of processors.
>>>> The generic drivers/i2c/soft_i2c framework is used, with
>>>> routines provided by this commit.
>>> if you simply implemented the generic gpio layer (asm/gpio.h), the
>>> soft_i2c.c code already handles gluing to GPIO pins. then you
>>> wouldnt need a sep driver at all. you can see the bf561-ezkit
>>> already using this code. -mike
>> Yes, that was my thought too. No seperate i2c driver should be needed
>> here.
>>
>> bye,
>> Heiko
>
> Thanks Mike and Heiko for reply.
>
> However I've got some extra question.
>
> In the bf651-ezkit.h file I can see the I2C definition:
>
> #define CONFIG_SOFT_I2C
> #define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF0
> #define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF1
>
> My concern is about the situation when SoC needs more than one Software
> I2C run via GPIO?
>
> Please consider following scenario:
> One sensor is connected to pins 1(SCL) and 3(SDA) and another to 4(SCL)
> and 5(SDA) in a GPIO port.
>
> As fair as I've understood the software_i2c framework, it is supposed to
> run only one instance of GPIO I2C.
>
> Is there any way to "instantiate" more than one I2C GPIO interface via
> software_i2c?
It should be possible (not tested), but not very nice:
First, you have to define CONFIG_I2C_MULTI_BUS and CONFIG_SYS_MAX_I2C_BUS
Then your CONFIG_SOFT_I2C_GPIO_SDA and CONFIG_SOFT_I2C_GPIO_SCL
should look something like this:
#define CONFIG_SOFT_I2C_GPIO_SDA get_sda_pin
with
int get_sda_pin(void)
{
int busnr = i2c_get_bus_num();
switch (busnr) {
case 0:
return 3;
break;
case 1:
return 5;
break;
[...]
}
}
Cleaner would be to get the i2c multibus branch to mainline, see:
http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=shortlog;h=refs/heads/multibus_v2
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
next prev parent reply other threads:[~2011-07-06 10:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-05 12:23 [U-Boot] [PATCH] i2c:gpio:s5p: I2C GPIO Software implementation Lukasz Majewski
2011-07-05 17:47 ` Mike Frysinger
2011-07-06 5:56 ` Heiko Schocher
2011-07-06 9:36 ` Lukasz Majewski
2011-07-06 10:08 ` Heiko Schocher [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-07-05 13:49 Lukasz Majewski
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=4E143404.10704@denx.de \
--to=hs@denx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox