CONFIG: SMDK5250: I2C: Enable I2C
authorRajeshwari Shinde <rajeshwari.s@samsung.com>
Mon, 23 Jul 2012 21:23:55 +0000 (21:23 +0000)
committerHeiko Schocher <hs@denx.de>
Tue, 31 Jul 2012 06:03:19 +0000 (08:03 +0200)
This enables I2C support on smdk5250.
Pinmux setting moved to board file to avoid repeated setting of
gpio lines.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
board/samsung/smdk5250/smdk5250.c
include/configs/smdk5250.h

index 3b078da65d86ab2174f2b14b64a43a307ea51fe9..fae7d6f0ed64325071becb758647129f6aef3e66 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <i2c.h>
 #include <netdev.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/gpio.h>
@@ -172,9 +173,36 @@ static int board_uart_init(void)
        return 0;
 }
 
+#ifdef CONFIG_SYS_I2C_INIT_BOARD
+static int board_i2c_init(void)
+{
+       int i, err;
+
+       for (i = 0; i < CONFIG_MAX_I2C_NUM; i++) {
+               err = exynos_pinmux_config((PERIPH_ID_I2C0 + i),
+                                               PINMUX_FLAG_NONE);
+               if (err) {
+                       debug("I2C%d not configured\n", (PERIPH_ID_I2C0 + i));
+                       return err;
+               }
+       }
+       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+       return 0;
+}
+#endif
+
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 int board_early_init_f(void)
 {
-       return board_uart_init();
+       int err;
+       err = board_uart_init();
+       if (err) {
+               debug("UART init failed\n");
+               return err;
+       }
+#ifdef CONFIG_SYS_I2C_INIT_BOARD
+       err = board_i2c_init();
+#endif
+       return err;
 }
 #endif
index d47881bcb27c31bbe5eecc680c9b730577e36987..eb1466c52bd38a40afa0fceffe31cb801803115b 100644 (file)
 
 #define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
+/* I2C */
+#define CONFIG_SYS_I2C_INIT_BOARD
+#define CONFIG_HARD_I2C
+#define CONFIG_CMD_I2C
+#define CONFIG_SYS_I2C_SPEED   100000          /* 100 Kbps */
+#define CONFIG_DRIVER_S3C24X0_I2C
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_MAX_I2C_NUM     8
+#define CONFIG_SYS_I2C_SLAVE    0x0
+
 /* Ethernet Controllor Driver */
 #ifdef CONFIG_CMD_NET
 #define CONFIG_SMC911X