EXYNOS5: I2C: Add FDT and non-FDT support for I2C
authorAmar <amarendra.xt@samsung.com>
Thu, 4 Apr 2013 06:27:06 +0000 (02:27 -0400)
committerMinkyu Kang <mk7.kang@samsung.com>
Mon, 24 Jun 2013 02:25:19 +0000 (11:25 +0900)
This patch updates the function board_i2c_init() to add support for both
FDT and non-FDT for I2C, and initialise the I2C channels.

Signed-off-by: Amar <amarendra.xt@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
drivers/i2c/s3c24x0_i2c.c

index 46d25061ee6456a02a2780f5c363788f407981d2..3fc1c5b03b55c356b6f99b9371c4e9800546a169 100644 (file)
@@ -515,11 +515,12 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
                 len) != 0);
 }
 
-#ifdef CONFIG_OF_CONTROL
 void board_i2c_init(const void *blob)
 {
+       int i;
+#ifdef CONFIG_OF_CONTROL
        int node_list[CONFIG_MAX_I2C_NUM];
-       int count, i;
+       int count;
 
        count = fdtdec_find_aliases_for_id(blob, "i2c",
                COMPAT_SAMSUNG_S3C2440_I2C, node_list,
@@ -539,8 +540,15 @@ void board_i2c_init(const void *blob)
                bus->bus_num = i2c_busses++;
                exynos_pinmux_config(bus->id, 0);
        }
+#else
+       for (i = 0; i < CONFIG_MAX_I2C_NUM; i++) {
+               exynos_pinmux_config((PERIPH_ID_I2C0 + i),
+                                    PINMUX_FLAG_NONE);
+       }
+#endif
 }
 
+#ifdef CONFIG_OF_CONTROL
 static struct s3c24x0_i2c_bus *get_bus(unsigned int bus_idx)
 {
        if (bus_idx < i2c_busses)