summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2008-10-15 09:39:47 +0200
committerWolfgang Denk <wd@denx.de>2008-10-18 21:54:02 +0200
commit67b23a322848d828a5e45c0567b72762bfde7abf (patch)
tree8dc26375504482eaa0e9600a6a52a6bb047dccf3 /cpu
parentc24853644ddd2dd2e4246b5854a93e6254a14092 (diff)
I2C: adding new "i2c bus" Command to the I2C Subsystem.
With this Command it is possible to add new I2C Busses, which are behind 1 .. n I2C Muxes. Details see README. Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'cpu')
-rw-r--r--cpu/mpc8260/i2c.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/cpu/mpc8260/i2c.c b/cpu/mpc8260/i2c.c
index 335177fad6..a96fbf841e 100644
--- a/cpu/mpc8260/i2c.c
+++ b/cpu/mpc8260/i2c.c
@@ -780,10 +780,23 @@ unsigned int i2c_get_bus_num(void)
int i2c_set_bus_num(unsigned int bus)
{
+#if defined(CONFIG_I2C_MUX)
+ if (bus < CFG_MAX_I2C_BUS) {
+ i2c_bus_num = bus;
+ } else {
+ int ret;
+
+ ret = i2x_mux_select_mux(bus);
+ if (ret == 0)
+ i2c_bus_num = bus;
+ else
+ return ret;
+ }
+#else
if (bus >= CFG_MAX_I2C_BUS)
return -1;
i2c_bus_num = bus;
-
+#endif
return 0;
}
/* TODO: add 100/400k switching */