]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mxc_i2c: finish adding CONFIG_I2C_MULTI_BUS support
authorTroy Kisky <troy.kisky@boundarydevices.com>
Thu, 19 Jul 2012 08:18:20 +0000 (08:18 +0000)
committerHeiko Schocher <hs@denx.de>
Tue, 31 Jul 2012 05:59:41 +0000 (07:59 +0200)
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
drivers/i2c/mxc_i2c.c

index c00ead1f56bf3538782b1807f71a21efb0c1a685..73d895870196fbdec90cb2f756659a6342d469d4 100644 (file)
@@ -416,6 +416,23 @@ static int i2c_idle_bus(void *base)
        return 0;
 }
 
+#ifdef CONFIG_I2C_MULTI_BUS
+unsigned int i2c_get_bus_num(void)
+{
+       return srdata.curr_i2c_bus;
+}
+
+int i2c_set_bus_num(unsigned bus_idx)
+{
+       if (bus_idx >= ARRAY_SIZE(srdata.i2c_data))
+               return -1;
+       if (!srdata.i2c_data[bus_idx].base)
+               return -1;
+       srdata.curr_i2c_bus = bus_idx;
+       return 0;
+}
+#endif
+
 int i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len)
 {
        return bus_i2c_read(get_base(), chip, addr, alen, buf, len);