]> git.sur5r.net Git - u-boot/commitdiff
EXYNOS4210: Configure GPIO for uart
authorRajeshwari Shinde <rajeshwari.s@samsung.com>
Thu, 4 Jul 2013 06:59:16 +0000 (12:29 +0530)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 5 Jul 2013 08:06:55 +0000 (17:06 +0900)
This patch configures the gpio values for UART
on Origen and SMDKV310 using pinmux

Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
arch/arm/cpu/armv7/exynos/pinmux.c
board/samsung/origen/origen.c
board/samsung/smdkv310/smdkv310.c
include/configs/origen.h
include/configs/smdkv310.h

index bd499b47614ca2b1af126642931fa627d14f45ca..2042062344edfc8d599f94fddf58f9006d9d81b0 100644 (file)
@@ -408,9 +408,49 @@ static int exynos4_mmc_config(int peripheral, int flags)
        return 0;
 }
 
+static void exynos4_uart_config(int peripheral)
+{
+       struct exynos4_gpio_part1 *gpio1 =
+               (struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
+       struct s5p_gpio_bank *bank;
+       int i, start, count;
+
+       switch (peripheral) {
+       case PERIPH_ID_UART0:
+               bank = &gpio1->a0;
+               start = 0;
+               count = 4;
+               break;
+       case PERIPH_ID_UART1:
+               bank = &gpio1->a0;
+               start = 4;
+               count = 4;
+               break;
+       case PERIPH_ID_UART2:
+               bank = &gpio1->a1;
+               start = 0;
+               count = 4;
+               break;
+       case PERIPH_ID_UART3:
+               bank = &gpio1->a1;
+               start = 4;
+               count = 2;
+               break;
+       }
+       for (i = start; i < start + count; i++) {
+               s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
+               s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
+       }
+}
 static int exynos4_pinmux_config(int peripheral, int flags)
 {
        switch (peripheral) {
+       case PERIPH_ID_UART0:
+       case PERIPH_ID_UART1:
+       case PERIPH_ID_UART2:
+       case PERIPH_ID_UART3:
+               exynos4_uart_config(peripheral);
+               break;
        case PERIPH_ID_I2C0:
        case PERIPH_ID_I2C1:
        case PERIPH_ID_I2C2:
index 638e7b1edbc2e87e0714dcf5999a5dce75129de0..b7dbb911b96a376be3f4b6891e5af4c25d868bed 100644 (file)
@@ -25,6 +25,8 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/periph.h>
+#include <asm/arch/pinmux.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 struct exynos4_gpio_part1 *gpio1;
@@ -39,6 +41,50 @@ int board_init(void)
        return 0;
 }
 
+static int board_uart_init(void)
+{
+       int err;
+
+       err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("UART0 not configured\n");
+               return err;
+       }
+
+       err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("UART1 not configured\n");
+               return err;
+       }
+
+       err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("UART2 not configured\n");
+               return err;
+       }
+
+       err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("UART3 not configured\n");
+               return err;
+       }
+
+       return 0;
+}
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f(void)
+{
+       int err;
+       err = board_uart_init();
+       if (err) {
+               debug("UART init failed\n");
+               return err;
+       }
+       return err;
+}
+#endif
+
 int dram_init(void)
 {
        gd->ram_size    = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
index 81ac8f6f4a698158bb59d52fa4e7db45d985aa56..015b920ee271d37ce076f57e92da12ff587fabfb 100644 (file)
@@ -26,6 +26,8 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/periph.h>
+#include <asm/arch/pinmux.h>
 #include <asm/arch/sromc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -137,3 +139,47 @@ int board_mmc_init(bd_t *bis)
        return err;
 }
 #endif
+
+static int board_uart_init(void)
+{
+       int err;
+
+       err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("UART0 not configured\n");
+               return err;
+       }
+
+       err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("UART1 not configured\n");
+               return err;
+       }
+
+       err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("UART2 not configured\n");
+               return err;
+       }
+
+       err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("UART3 not configured\n");
+               return err;
+       }
+
+       return 0;
+}
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f(void)
+{
+       int err;
+       err = board_uart_init();
+       if (err) {
+               debug("UART init failed\n");
+               return err;
+       }
+       return err;
+}
+#endif
index e179911d0c3baf59f1cf09d12ed42b0000f28975..f71a463f4a3e20154570ec3ec092456fb3b8a0ce 100644 (file)
@@ -36,6 +36,7 @@
 #define CONFIG_ARCH_CPU_INIT
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_BOARD_EARLY_INIT_F
 
 /* Keep L2 Cache Disabled */
 #define CONFIG_L2_OFF                  1
index 5e430660f12439de595c6af35e6fcc8d0abe66f5..db781278c2f701657e86687ab245eb9be6e3564d 100644 (file)
@@ -36,6 +36,7 @@
 #define CONFIG_ARCH_CPU_INIT
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_BOARD_EARLY_INIT_F
 
 /* Mach Type */
 #define CONFIG_MACH_TYPE               MACH_TYPE_SMDKV310