]> git.sur5r.net Git - u-boot/blobdiff - cpu/mpc8260/i2c.c
I2C: adding new "i2c bus" Command to the I2C Subsystem.
[u-boot] / cpu / mpc8260 / i2c.c
index 335177fad61016add36745c80e3a9d2fe8c6fcb1..a96fbf841e0a90c4e4d32dc55941de539c5897c8 100644 (file)
@@ -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 */