]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tegra: i2c: Add function to find DVC bus
authorSimon Glass <sjg@chromium.org>
Mon, 2 Apr 2012 13:19:01 +0000 (13:19 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 15 May 2012 06:31:39 +0000 (08:31 +0200)
Add tegra_i2c_get_dvc_bus_num() to obtain the I2C bus number of DVC bus.
This allows us to talk to the PMU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
arch/arm/include/asm/arch-tegra2/tegra_i2c.h
drivers/i2c/tegra_i2c.c

index 0a7d99c58581966f5da0d639ddc85b4040c04505..cfb136c466d5d712d951268e3a42abaca415a6a2 100644 (file)
@@ -154,4 +154,11 @@ struct i2c_ctlr {
 #define I2C_INT_ARBITRATION_LOST_SHIFT 2
 #define I2C_INT_ARBITRATION_LOST_MASK  (1 << I2C_INT_ARBITRATION_LOST_SHIFT)
 
+/**
+ * Returns the bus number of the DVC controller
+ *
+ * @return number of bus, or -1 if there is no DVC active
+ */
+int tegra_i2c_get_dvc_bus_num(void);
+
 #endif
index 21f689726920b131397615e791a873caaf84334a..5b6ea0e7599a28107413f045ade27475287f7dfb 100644 (file)
@@ -567,3 +567,17 @@ int i2c_set_bus_num(unsigned int bus)
        return 0;
 }
 #endif
+
+int tegra_i2c_get_dvc_bus_num(void)
+{
+       int i;
+
+       for (i = 0; i < CONFIG_SYS_MAX_I2C_BUS; i++) {
+               struct i2c_bus *bus = &i2c_controllers[i];
+
+               if (bus->inited && bus->is_dvc)
+                       return i;
+       }
+
+       return -1;
+}