
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...
bye, Heiko