From: Chanho Park Date: Tue, 6 Feb 2018 11:53:28 +0000 (+0900) Subject: arm: s5p6818: set pad functions for debug console X-Git-Tag: submit/tizen/20180327.075642~67 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22d4eedf9da047c77fd18ebc5a8a1d3923910dcc;p=profile%2Fcommon%2Fplatform%2Fkernel%2Fu-boot-artik7.git arm: s5p6818: set pad functions for debug console 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 --- diff --git a/arch/arm/mach-nexell/serial.c b/arch/arm/mach-nexell/serial.c index e0846f0fd4..8780e916c8 100644 --- a/arch/arm/mach-nexell/serial.c +++ b/arch/arm/mach-nexell/serial.c @@ -12,6 +12,7 @@ #include #include #include +#include /* 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);