[U-Boot] [PATCH v2 18/20] tegra: i2c: Add function to find DVC bus
Simon Glass
sjg at chromium.org
Fri Jan 13 22:35:33 CET 2012
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 at chromium.org>
---
Changes in v2:
- Add patch to find DVC bus number
arch/arm/include/asm/arch-tegra2/tegra2_i2c.h | 7 +++++++
drivers/i2c/tegra2_i2c.c | 14 ++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/arch-tegra2/tegra2_i2c.h b/arch/arm/include/asm/arch-tegra2/tegra2_i2c.h
index 86f6a01..4816cc7 100644
--- a/arch/arm/include/asm/arch-tegra2/tegra2_i2c.h
+++ b/arch/arm/include/asm/arch-tegra2/tegra2_i2c.h
@@ -157,4 +157,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
diff --git a/drivers/i2c/tegra2_i2c.c b/drivers/i2c/tegra2_i2c.c
index b57a050..b42d9ac 100644
--- a/drivers/i2c/tegra2_i2c.c
+++ b/drivers/i2c/tegra2_i2c.c
@@ -549,3 +549,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;
+}
--
1.7.7.3
More information about the U-Boot
mailing list