diff options
author | Heiko Schocher <hs@denx.de> | 2008-10-15 09:34:45 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-10-18 21:54:01 +0200 |
commit | 799b784aa00cb03a352847ab9f9acdde79b72d21 (patch) | |
tree | b5f312814dbc1a8a30bdeec41c06dd793f70a69d /drivers | |
parent | 0809ea2f4340ab2047400c7d3d3047f97987d0fd (diff) | |
download | u-boot-imx-799b784aa00cb03a352847ab9f9acdde79b72d21.zip u-boot-imx-799b784aa00cb03a352847ab9f9acdde79b72d21.tar.gz u-boot-imx-799b784aa00cb03a352847ab9f9acdde79b72d21.tar.bz2 |
i2c: add CONFIG_I2C_MULTI_BUS for soft_i2c and mpc8260 i2c driver.
Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/soft_i2c.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c index 23db2ee..57736da 100644 --- a/drivers/i2c/soft_i2c.c +++ b/drivers/i2c/soft_i2c.c @@ -68,6 +68,10 @@ DECLARE_GLOBAL_DATA_PTR; #define PRINTD(fmt,args...) #endif +#if defined(CONFIG_I2C_MULTI_BUS) +static unsigned int i2c_bus_num __attribute__ ((section ("data"))) = 0; +#endif /* CONFIG_I2C_MULTI_BUS */ + /*----------------------------------------------------------------------- * Local functions */ @@ -230,6 +234,38 @@ static int write_byte(uchar data) return(nack); /* not a nack is an ack */ } +#if defined(CONFIG_I2C_MULTI_BUS) +/* + * Functions for multiple I2C bus handling + */ +unsigned int i2c_get_bus_num(void) +{ + return i2c_bus_num; +} + +int i2c_set_bus_num(unsigned int bus) +{ + if (bus >= CFG_MAX_I2C_BUS) + return -1; + i2c_bus_num = bus; + + return 0; +} + +/* TODO: add 100/400k switching */ +unsigned int i2c_get_bus_speed(void) +{ + return CFG_I2C_SPEED; +} + +int i2c_set_bus_speed(unsigned int speed) +{ + if (speed != CFG_I2C_SPEED) + return -1; + + return 0; +} +#endif /*----------------------------------------------------------------------- * if ack == I2C_ACK, ACK the byte so can continue reading, else |