]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
exynos: Add debug UART support for Samsung S5P serial
authorSimon Glass <sjg@chromium.org>
Fri, 3 Jul 2015 00:15:54 +0000 (18:15 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 06:17:14 +0000 (08:17 +0200)
Add a debug UART implementation for this serial driver. It does not set up
pinmux automatically - this must be done before calling debug_uart_init().

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/serial/Kconfig
drivers/serial/serial_s5p.c

index b5a91b707ed72374d7ebf3a0beb9f6f31379a006..fd126a825f29b8abedfb70de752a327e1bf516cb 100644 (file)
@@ -53,6 +53,13 @@ config DEBUG_EFI_CONSOLE
          U-Boot when running on top of EFI (Extensive Firmware Interface).
          This is a type of BIOS used by PCs.
 
+config DEBUG_UART_S5P
+       bool "Samsung S5P"
+       help
+         Select this to enable a debug UART using the serial_s5p driver. You
+         will need to provide parameters to make this work. The driver will
+         be available until the real driver-model serial is running.
+
 endchoice
 
 config DEBUG_UART_BASE
index 7abec53f80e38b73fea0a8908550bb4c66d49bfd..4a553a37b8f55d1aff2fd2ceda4aa8c798696548 100644 (file)
@@ -200,3 +200,28 @@ U_BOOT_DRIVER(serial_s5p) = {
        .ops    = &s5p_serial_ops,
        .flags = DM_FLAG_PRE_RELOC,
 };
+
+#ifdef CONFIG_DEBUG_UART_S5P
+
+#include <debug_uart.h>
+
+void debug_uart_init(void)
+{
+       struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
+
+       s5p_serial_init(uart);
+       s5p_serial_baud(uart, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+       struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
+
+       while (readl(&uart->ufstat) & TX_FIFO_FULL);
+
+       writeb(ch, &uart->utxh);
+}
+
+DEBUG_UART_FUNCS
+
+#endif