Commit 198a40b9f64d3c08b0303dd346ff4addca4c7e88

Authored by Rajeshwari Shinde
Committed by Minkyu Kang
1 parent 6e50e5ca02

EXYNOS4210: Configure GPIO for uart

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>

Showing 5 changed files with 134 additions and 0 deletions Side-by-side Diff

arch/arm/cpu/armv7/exynos/pinmux.c
... ... @@ -408,9 +408,49 @@
408 408 return 0;
409 409 }
410 410  
  411 +static void exynos4_uart_config(int peripheral)
  412 +{
  413 + struct exynos4_gpio_part1 *gpio1 =
  414 + (struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
  415 + struct s5p_gpio_bank *bank;
  416 + int i, start, count;
  417 +
  418 + switch (peripheral) {
  419 + case PERIPH_ID_UART0:
  420 + bank = &gpio1->a0;
  421 + start = 0;
  422 + count = 4;
  423 + break;
  424 + case PERIPH_ID_UART1:
  425 + bank = &gpio1->a0;
  426 + start = 4;
  427 + count = 4;
  428 + break;
  429 + case PERIPH_ID_UART2:
  430 + bank = &gpio1->a1;
  431 + start = 0;
  432 + count = 4;
  433 + break;
  434 + case PERIPH_ID_UART3:
  435 + bank = &gpio1->a1;
  436 + start = 4;
  437 + count = 2;
  438 + break;
  439 + }
  440 + for (i = start; i < start + count; i++) {
  441 + s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
  442 + s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
  443 + }
  444 +}
411 445 static int exynos4_pinmux_config(int peripheral, int flags)
412 446 {
413 447 switch (peripheral) {
  448 + case PERIPH_ID_UART0:
  449 + case PERIPH_ID_UART1:
  450 + case PERIPH_ID_UART2:
  451 + case PERIPH_ID_UART3:
  452 + exynos4_uart_config(peripheral);
  453 + break;
414 454 case PERIPH_ID_I2C0:
415 455 case PERIPH_ID_I2C1:
416 456 case PERIPH_ID_I2C2:
board/samsung/origen/origen.c
... ... @@ -25,6 +25,8 @@
25 25 #include <asm/arch/cpu.h>
26 26 #include <asm/arch/gpio.h>
27 27 #include <asm/arch/mmc.h>
  28 +#include <asm/arch/periph.h>
  29 +#include <asm/arch/pinmux.h>
28 30  
29 31 DECLARE_GLOBAL_DATA_PTR;
30 32 struct exynos4_gpio_part1 *gpio1;
... ... @@ -38,6 +40,50 @@
38 40 gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
39 41 return 0;
40 42 }
  43 +
  44 +static int board_uart_init(void)
  45 +{
  46 + int err;
  47 +
  48 + err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
  49 + if (err) {
  50 + debug("UART0 not configured\n");
  51 + return err;
  52 + }
  53 +
  54 + err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
  55 + if (err) {
  56 + debug("UART1 not configured\n");
  57 + return err;
  58 + }
  59 +
  60 + err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
  61 + if (err) {
  62 + debug("UART2 not configured\n");
  63 + return err;
  64 + }
  65 +
  66 + err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
  67 + if (err) {
  68 + debug("UART3 not configured\n");
  69 + return err;
  70 + }
  71 +
  72 + return 0;
  73 +}
  74 +
  75 +#ifdef CONFIG_BOARD_EARLY_INIT_F
  76 +int board_early_init_f(void)
  77 +{
  78 + int err;
  79 + err = board_uart_init();
  80 + if (err) {
  81 + debug("UART init failed\n");
  82 + return err;
  83 + }
  84 + return err;
  85 +}
  86 +#endif
41 87  
42 88 int dram_init(void)
43 89 {
board/samsung/smdkv310/smdkv310.c
... ... @@ -26,6 +26,8 @@
26 26 #include <asm/arch/cpu.h>
27 27 #include <asm/arch/gpio.h>
28 28 #include <asm/arch/mmc.h>
  29 +#include <asm/arch/periph.h>
  30 +#include <asm/arch/pinmux.h>
29 31 #include <asm/arch/sromc.h>
30 32  
31 33 DECLARE_GLOBAL_DATA_PTR;
... ... @@ -134,6 +136,50 @@
134 136 s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_UP);
135 137 }
136 138 err = s5p_mmc_init(2, 4);
  139 + return err;
  140 +}
  141 +#endif
  142 +
  143 +static int board_uart_init(void)
  144 +{
  145 + int err;
  146 +
  147 + err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE);
  148 + if (err) {
  149 + debug("UART0 not configured\n");
  150 + return err;
  151 + }
  152 +
  153 + err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE);
  154 + if (err) {
  155 + debug("UART1 not configured\n");
  156 + return err;
  157 + }
  158 +
  159 + err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE);
  160 + if (err) {
  161 + debug("UART2 not configured\n");
  162 + return err;
  163 + }
  164 +
  165 + err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
  166 + if (err) {
  167 + debug("UART3 not configured\n");
  168 + return err;
  169 + }
  170 +
  171 + return 0;
  172 +}
  173 +
  174 +#ifdef CONFIG_BOARD_EARLY_INIT_F
  175 +int board_early_init_f(void)
  176 +{
  177 + int err;
  178 + err = board_uart_init();
  179 + if (err) {
  180 + debug("UART init failed\n");
  181 + return err;
  182 + }
137 183 return err;
138 184 }
139 185 #endif
include/configs/origen.h
... ... @@ -36,6 +36,7 @@
36 36 #define CONFIG_ARCH_CPU_INIT
37 37 #define CONFIG_DISPLAY_CPUINFO
38 38 #define CONFIG_DISPLAY_BOARDINFO
  39 +#define CONFIG_BOARD_EARLY_INIT_F
39 40  
40 41 /* Keep L2 Cache Disabled */
41 42 #define CONFIG_L2_OFF 1
include/configs/smdkv310.h
... ... @@ -36,6 +36,7 @@
36 36 #define CONFIG_ARCH_CPU_INIT
37 37 #define CONFIG_DISPLAY_CPUINFO
38 38 #define CONFIG_DISPLAY_BOARDINFO
  39 +#define CONFIG_BOARD_EARLY_INIT_F
39 40  
40 41 /* Mach Type */
41 42 #define CONFIG_MACH_TYPE MACH_TYPE_SMDKV310