summaryrefslogtreecommitdiff
path: root/drivers/i2c/s3c24x0_i2c.c
diff options
context:
space:
mode:
authorRajeshwari Shinde <rajeshwari.s@samsung.com>2012-07-23 21:23:54 +0000
committerHeiko Schocher <hs@denx.de>2012-07-31 08:03:03 +0200
commit178239de194a0e84d07b8e48fb74cb156f654d75 (patch)
tree35f2d7f837f946f6a274fdcfad0c5b0c66912924 /drivers/i2c/s3c24x0_i2c.c
parentab7e52bb240c15ad4426cad64396589beadc9f04 (diff)
downloadu-boot-imx-178239de194a0e84d07b8e48fb74cb156f654d75.zip
u-boot-imx-178239de194a0e84d07b8e48fb74cb156f654d75.tar.gz
u-boot-imx-178239de194a0e84d07b8e48fb74cb156f654d75.tar.bz2
I2C: Add support for Multi channel
This adds multiple i2c channel support for I2C. Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/i2c/s3c24x0_i2c.c')
-rw-r--r--drivers/i2c/s3c24x0_i2c.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index 26c0755..9bc4c7f 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -158,6 +158,33 @@ static void i2c_ch_init(struct s3c24x0_i2c *i2c, int speed, int slaveadd)
writel(I2C_MODE_MT | I2C_TXRX_ENA, &i2c->iicstat);
}
+/*
+ * MULTI BUS I2C support
+ */
+
+#ifdef CONFIG_I2C_MULTI_BUS
+int i2c_set_bus_num(unsigned int bus)
+{
+ struct s3c24x0_i2c *i2c;
+
+ if ((bus < 0) || (bus >= CONFIG_MAX_I2C_NUM)) {
+ debug("Bad bus: %d\n", bus);
+ return -1;
+ }
+
+ g_current_bus = bus;
+ i2c = get_base_i2c();
+ i2c_ch_init(i2c, CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
+ return 0;
+}
+
+unsigned int i2c_get_bus_num(void)
+{
+ return g_current_bus;
+}
+#endif
+
void i2c_init(int speed, int slaveadd)
{
struct s3c24x0_i2c *i2c;