summaryrefslogtreecommitdiff
path: root/common/env_eeprom.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-07-24 09:22:28 -0400
committerTom Rini <trini@ti.com>2013-07-24 09:50:24 -0400
commitc2120fbfbc4d1f6953228f86be8bdbf38bacfdab (patch)
tree14cd8ec9a0a61f7113149be38d79808cd5e955f8 /common/env_eeprom.c
parente85427fd66a21b39145a47e67871a8863c0e5591 (diff)
parentecbd7e1ec7280d90d151a99691f74b892588cadd (diff)
downloadu-boot-imx-c2120fbfbc4d1f6953228f86be8bdbf38bacfdab.zip
u-boot-imx-c2120fbfbc4d1f6953228f86be8bdbf38bacfdab.tar.gz
u-boot-imx-c2120fbfbc4d1f6953228f86be8bdbf38bacfdab.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-i2c
The sandburst-specific i2c drivers have been deleted, conflict was just over the SPDX conversion. Conflicts: board/sandburst/common/ppc440gx_i2c.c board/sandburst/common/ppc440gx_i2c.h Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'common/env_eeprom.c')
-rw-r--r--common/env_eeprom.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index f5882bc..149370f 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -33,24 +33,8 @@ 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 (gd->flags & GD_FLG_RELOC) {
- if (env_eeprom_bus == -1) {
- I2C_MUX_DEVICE *dev = NULL;
- dev = i2c_mux_ident_muxstring(
- (uchar *)CONFIG_I2C_ENV_EEPROM_BUS);
- if (dev != NULL)
- env_eeprom_bus = dev->busid;
- else
- printf("error adding env eeprom bus.\n");
- }
- if (old_bus != env_eeprom_bus) {
- i2c_set_bus_num(env_eeprom_bus);
- old_bus = env_eeprom_bus;
- }
- } else {
- rcode = i2c_mux_ident_muxstring_f(
- (uchar *)CONFIG_I2C_ENV_EEPROM_BUS);
- }
+ if (old_bus != CONFIG_I2C_ENV_EEPROM_BUS)
+ i2c_set_bus_num(CONFIG_I2C_ENV_EEPROM_BUS);
#endif
rcode = eeprom_read(dev_addr, offset, buffer, cnt);
@@ -59,6 +43,7 @@ static int eeprom_bus_read(unsigned dev_addr, unsigned offset,
if (old_bus != env_eeprom_bus)
i2c_set_bus_num(old_bus);
#endif
+
return rcode;
}
@@ -69,9 +54,12 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
int old_bus = i2c_get_bus_num();
- rcode = i2c_mux_ident_muxstring_f((uchar *)CONFIG_I2C_ENV_EEPROM_BUS);
+ if (old_bus != CONFIG_I2C_ENV_EEPROM_BUS)
+ i2c_set_bus_num(CONFIG_I2C_ENV_EEPROM_BUS);
#endif
+
rcode = eeprom_write(dev_addr, offset, buffer, cnt);
+
#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
i2c_set_bus_num(old_bus);
#endif