Hello Stefan, Am 23.04.2013 08:45, schrieb Stefan Roese: > Hi Dirk! > > (Added Heiko as I2C custodian to Cc) > > On 22.04.2013 13:16, Dirk Eibach wrote: >> This adds an i2c bitbang interface that can coexist with processor i2c.
Huh... missed this EMail... >> >> Signed-off-by: Dirk Eibach <eib...@gdsys.de> >> --- >> board/gdsys/common/Makefile | 2 +- >> board/gdsys/common/bb_i2c.c | 304 >> +++++++++++++++++++++++++++++++++++++++++++ >> board/gdsys/common/bb_i2c.h | 76 +++++++++++ >> 3 files changed, 381 insertions(+), 1 deletion(-) >> create mode 100644 board/gdsys/common/bb_i2c.c >> create mode 100644 board/gdsys/common/bb_i2c.h > > Just checking: Is it really not possible to use multiple different I2C > interfaces (e.g. PPC4xx I2C and GPIO bitbang I2C)? Heiko, whats the > current status here? If this is needed, we should merge the multibus/multiadapter approach finally to mainline, found here: http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=shortlog;h=refs/heads/20130416_multibus_v2 Yeah, waiting for such a chance for some years ;-) I am not happy to have boardspecific approaches here! Dirk, could you give the above sources a try? I must admit that the sources are just rebased without doing big tests on several plattforms ... but the branch compiles clean for arm and powerpc. If it works for you, we can try to bring it in the next merge window in mainline... - steps to do (for you): - port the ppc4xx i2c driver to the new framework There is an older branch, where I did this for an older version of the multibus/multiadapter approach, see here: http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=shortlog;h=refs/heads/multibus_v2_20111112 It gives you maybe an idea how to do this. - for adding a soft i2c driver you should do something like: +#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_SOFT_SPEED Your speed +#define CONFIG_SYS_I2C_SOFT_SLAVE Your slave addr +#define I2C_TRISTATE i2c_soft_tristate() +#define I2C_READ i2c_soft_read() +#define I2C_ACTIVE i2c_soft_delay() +#define I2C_SCL(bit) i2c_soft_scl(bit) +#define I2C_SDA(bit) i2c_soft_sda(bit) +#define I2C_DELAY i2c_soft_delay() +#define I2C_INIT i2c_soft_init() and in your board code define the above functions: +#if defined(CONFIG_SYS_I2C_SOFT) +#include <i2c.h> + +void i2c_soft_init(void) +{ + printf("init: %d\n", I2C_ADAP_HWNR); +} + +void i2c_soft_active(void) +{ + printf("active: %d\n", I2C_ADAP_HWNR); +} + +void i2c_soft_tristate(void) +{ + printf("tristate: %d\n", I2C_ADAP_HWNR); +} + +int i2c_soft_read(void) +{ + return 1; +} + +void i2c_soft_sda(int bit) +{ + printf("sda: %d\n", I2C_ADAP_HWNR); +} + +void i2c_soft_scl(int bit) +{ + printf("scl: %d\n", I2C_ADAP_HWNR); +} + +void i2c_soft_delay(void) +{ + printf("delay: %d\n", I2C_ADAP_HWNR); +} + +#endif You can have more than one soft i2c adapter by defining the defines I2C_SOFT_DECLARATIONS2, I2C_SOFT_DECLARATIONS3 ... and switch between them by interpreting the I2C_ADAP_HWNR in the above functions ... bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot