armv7/s5p4418: set pad functions for debug console
authorChanho Park <chanho61.park@samsung.com>
Mon, 29 Jan 2018 12:07:41 +0000 (21:07 +0900)
committerChanho Park <chanho61.park@samsung.com>
Mon, 29 Jan 2018 12:07:41 +0000 (21:07 +0900)
This patch adds to initialize gpio pad functions according to debug
console serial IDs. Actually, the debug console has been initialized
from bl1 stage. However, to change the bl1 binary only for the debug
console seemed to be not necessary. For a developer who want to use
a different debug console IDs, we also initialize the GPIO pad
functions in the u-boot stage.

Change-Id: Iac1c7dd0e75f4ca1f2b88978c0ecb5c8739a8486
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
arch/arm/cpu/armv7/s5p4418/cpu.c

index 2fe6ac46cd26ca520fa4af2b26c919ce110f58e2..332e98119cbfe41781b27a7f8520bee9d07d12cf 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/arch/clk.h>
 #include <asm/arch/reset.h>
 #include <asm/arch/tieoff.h>
+#include <asm/arch/nx_gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -41,11 +42,51 @@ static void cpu_soc_init(void)
 }
 
 #ifdef CONFIG_PL011_SERIAL
+static void serial_set_pad_function(int index)
+{
+       switch (index) {
+       case 0:
+               /* gpiod-14, gpiod-18 */
+               nx_gpio_set_pad_function(3, 14, 1);
+               nx_gpio_set_pad_function(3, 18, 1);
+               break;
+       case 1:
+               /* gpiod-15, gpiod-19, gpioc-5, gpioc-6 */
+               nx_gpio_set_pad_function(3, 15, 1);
+               nx_gpio_set_pad_function(3, 19, 1);
+               nx_gpio_set_pad_function(2, 5, 2);
+               nx_gpio_set_pad_function(2, 6, 2);
+               break;
+       case 2:
+               /* gpiod-16, gpiod-20 */
+               nx_gpio_set_pad_function(3, 16, 1);
+               nx_gpio_set_pad_function(3, 20, 1);
+               break;
+       case 3:
+               /* gpiod-17, gpiod-21 */
+               nx_gpio_set_pad_function(3, 17, 1);
+               nx_gpio_set_pad_function(3, 21, 1);
+               break;
+       case 4:
+               /* gpiob-28, gpiob-29 */
+               nx_gpio_set_pad_function(1, 28, 3);
+               nx_gpio_set_pad_function(1, 29, 3);
+               break;
+       case 5:
+               /* gpiob-30, gpiob-31 */
+               nx_gpio_set_pad_function(1, 30, 3);
+               nx_gpio_set_pad_function(1, 31, 3);
+               break;
+       }
+}
+
 static void serial_device_init(void)
 {
        char dev[10];
        int id;
 
+       serial_set_pad_function(CONFIG_CONS_INDEX);
+
        sprintf(dev, "nx-uart.%d", CONFIG_CONS_INDEX);
        id = RESET_ID_UART0 + CONFIG_CONS_INDEX;