diff options
author | Heiko Schocher <hs@denx.de> | 2012-01-16 21:12:24 +0000 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2013-07-23 05:54:28 +0200 |
commit | 3f4978c713255c8406875fbdf23ffed1129bc44b (patch) | |
tree | c27f00ba6219d75f772167b7630bb4ebb383a271 /common/env_eeprom.c | |
parent | 385c9ef5a7215b2b0c22836fee6c692dfc8559d7 (diff) | |
download | u-boot-imx-3f4978c713255c8406875fbdf23ffed1129bc44b.zip u-boot-imx-3f4978c713255c8406875fbdf23ffed1129bc44b.tar.gz u-boot-imx-3f4978c713255c8406875fbdf23ffed1129bc44b.tar.bz2 |
i2c: common changes for multibus/multiadapter support
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>
Diffstat (limited to 'common/env_eeprom.c')
-rw-r--r-- | common/env_eeprom.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/env_eeprom.c b/common/env_eeprom.c index 45c935b..fbd459a 100644 --- a/common/env_eeprom.c +++ b/common/env_eeprom.c @@ -49,6 +49,10 @@ static int eeprom_bus_read(unsigned dev_addr, unsigned offset, #if defined(CONFIG_I2C_ENV_EEPROM_BUS) int old_bus = i2c_get_bus_num(); +#if defined(CONFIG_SYS_I2C) + if (old_bus != CONFIG_I2C_ENV_EEPROM_BUS) + i2c_set_bus_num(CONFIG_I2C_ENV_EEPROM_BUS); +#else if (gd->flags & GD_FLG_RELOC) { if (env_eeprom_bus == -1) { I2C_MUX_DEVICE *dev = NULL; @@ -68,11 +72,16 @@ static int eeprom_bus_read(unsigned dev_addr, unsigned offset, (uchar *)CONFIG_I2C_ENV_EEPROM_BUS); } #endif +#endif rcode = eeprom_read(dev_addr, offset, buffer, cnt); #if defined(CONFIG_I2C_ENV_EEPROM_BUS) +#if defined(CONFIG_SYS_I2C) + if (old_bus != CONFIG_I2C_ENV_EEPROM_BUS) +#else if (old_bus != env_eeprom_bus) +#endif i2c_set_bus_num(old_bus); #endif return rcode; @@ -85,8 +94,13 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset, #if defined(CONFIG_I2C_ENV_EEPROM_BUS) int old_bus = i2c_get_bus_num(); +#if defined(CONFIG_SYS_I2C) + if (old_bus != CONFIG_I2C_ENV_EEPROM_BUS) + i2c_set_bus_num(CONFIG_I2C_ENV_EEPROM_BUS); +#else rcode = i2c_mux_ident_muxstring_f((uchar *)CONFIG_I2C_ENV_EEPROM_BUS); #endif +#endif rcode = eeprom_write(dev_addr, offset, buffer, cnt); #if defined(CONFIG_I2C_ENV_EEPROM_BUS) i2c_set_bus_num(old_bus); |