summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-03-09 00:41:48 +0100
committerWolfgang Denk <wd@denx.de>2009-03-09 00:41:48 +0100
commit014c595f12d4f7e14cb10188f856465b2d41718f (patch)
tree9130a01fbb5499975530a20a559dbaba9a1f2a89 /drivers
parent9c2d63ec0e9520948b6d598ea32e9aa4e0de847f (diff)
parentf70fd13e2fe4cf58e251271c27f9c06e141d7f9a (diff)
downloadu-boot-014c595f12d4f7e14cb10188f856465b2d41718f.tar.gz
u-boot-014c595f12d4f7e14cb10188f856465b2d41718f.tar.xz
u-boot-014c595f12d4f7e14cb10188f856465b2d41718f.zip
Merge branch 'master' of git://git.denx.de/u-boot-mpc83xx
Conflicts: lib_ppc/board.c Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/fsl_i2c.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index ce646fd7ed..6ab7d3d9fc 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -42,6 +42,9 @@ DECLARE_GLOBAL_DATA_PTR;
#define CONFIG_SYS_SPD_BUS_NUM 0
#endif
static unsigned int i2c_bus_num __attribute__ ((section (".data"))) = CONFIG_SYS_SPD_BUS_NUM;
+#if defined(CONFIG_I2C_MUX)
+static unsigned int i2c_bus_num_mux __attribute__ ((section ("data"))) = 0;
+#endif
static unsigned int i2c_bus_speed[2] = {CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SPEED};
@@ -369,6 +372,19 @@ i2c_probe(uchar chip)
int i2c_set_bus_num(unsigned int bus)
{
+#if defined(CONFIG_I2C_MUX)
+ if (bus < CONFIG_SYS_MAX_I2C_BUS) {
+ i2c_bus_num = bus;
+ } else {
+ int ret;
+
+ ret = i2x_mux_select_mux(bus);
+ if (ret)
+ return ret;
+ i2c_bus_num = 0;
+ }
+ i2c_bus_num_mux = bus;
+#else
#ifdef CONFIG_SYS_I2C2_OFFSET
if (bus > 1) {
#else
@@ -378,7 +394,7 @@ int i2c_set_bus_num(unsigned int bus)
}
i2c_bus_num = bus;
-
+#endif
return 0;
}
@@ -396,7 +412,11 @@ int i2c_set_bus_speed(unsigned int speed)
unsigned int i2c_get_bus_num(void)
{
+#if defined(CONFIG_I2C_MUX)
+ return i2c_bus_num_mux;
+#else
return i2c_bus_num;
+#endif
}
unsigned int i2c_get_bus_speed(void)