summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/include/asm/arch-tegra/i2c.h24
-rw-r--r--drivers/i2c/tegra_i2c.c30
2 files changed, 54 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-tegra/i2c.h b/arch/arm/include/asm/arch-tegra/i2c.h
index 25fb21d3fc8..458cd5ef60b 100644
--- a/arch/arm/include/asm/arch-tegra/i2c.h
+++ b/arch/arm/include/asm/arch-tegra/i2c.h
@@ -168,4 +168,28 @@ struct i2c_ctlr {
#define I2C_INT_NO_ACK_RANGE 3 : 3
#define I2C_INT_ARBITRATION_LOST_RANGE 2 : 2
+/**
+ * Low level, hopefully temporary, functions to write values to the
+ * Tegra DVC I2C controller. These are used by T30 init, when running
+ * on the AVP CPU, before the Cortex-A9s are up. It is not easy to
+ * have the i2c infrastructure up that early, but we still want to put
+ * this code in the driver
+ */
+
+/**
+ * Write an address (with config) to the DVC I2C
+ *
+ * @param addr Address to write
+ * @param config Config to write
+ */
+void tegra_i2c_ll_write_addr(uint addr, uint config);
+
+/**
+ * Write a data word (with config) to the DVC I2C
+ *
+ * @param data Data to write
+ * @param config Config to write
+ */
+void tegra_i2c_ll_write_data(uint data, uint config);
+
#endif
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index c51dd906927..3a94116831b 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -32,6 +32,9 @@
#include <asm/arch/pinmux.h>
#include <fdt_decode.h>
+/* TODO(sjg): This driver has not been tested with Tegra3 yet */
+#ifdef CONFIG_TEGRA2
+
DECLARE_GLOBAL_DATA_PTR;
static unsigned int i2c_bus_num;
@@ -623,3 +626,30 @@ int i2c_set_bus_num(unsigned int bus)
return 0;
}
#endif
+
+#else /* not CONFIG_TEGRA2 */
+
+/* Not implemented for now */
+int i2c_init_board(void)
+{
+ printf("i2c support is not available on T30\n");
+ return -1;
+}
+
+#endif /* CONFIG_TEGRA2 */
+
+void tegra_i2c_ll_write_addr(uint addr, uint config)
+{
+ struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+ writel(addr, &reg->cmd_addr0);
+ writel(config, &reg->cnfg);
+}
+
+void tegra_i2c_ll_write_data(uint data, uint config)
+{
+ struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+ writel(data, &reg->cmd_data1);
+ writel(config, &reg->cnfg);
+}