arm: s5p6818: set pad functions for debug console
authorChanho Park <chanho61.park@samsung.com>
Tue, 6 Feb 2018 11:53:28 +0000 (20:53 +0900)
committerChanho Park <chanho61.park@samsung.com>
Tue, 6 Feb 2018 11:53:28 +0000 (20:53 +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: I61da0f1192d4ce55f135ae68cd56a31869ac5266
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
arch/arm/mach-nexell/serial.c

index e0846f0fd41827ba02cb0a09b6c6709b5f821815..8780e916c81fc9f7cafc28c8c221e5b8bd7a14c0 100644 (file)
@@ -12,6 +12,7 @@
 #include <serial.h>
 #include <asm/arch/nexell.h>
 #include <asm/arch/clk.h>
+#include <asm/arch/nx_gpio.h>
 
 /* baudrate rest value */
 union br_rest {
@@ -64,10 +65,50 @@ static unsigned int   const clock_in = CONFIG_S5P_SERIAL_CLOCK;
 #define RX_FIFO_COUNT_MASK     0xff
 #define RX_FIFO_FULL_MASK      (1 << 8)
 #define TX_FIFO_FULL_MASK      (1 << 24)
+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];
+
+       serial_set_pad_function(CONSOLE_PORT);
+
        sprintf(dev, "nx-uart.%d", CONFIG_S5P_SERIAL_INDEX);
 
        struct clk *clk = clk_get((const char *)dev);