[U-Boot] [PATCH] arm: serial: Add debug UART capability to the pl01x driver
Sergey Temerkhanov
s.temerkhanov at gmail.com
Tue Sep 8 20:14:19 CEST 2015
This patch adds an ability to use pl01x as a debug UART. It must
be configured like other types of debug UARTs
Signed-off-by: Sergey Temerkhanov <s.temerkhanov at gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla at cavium.com>
---
drivers/serial/Kconfig | 20 ++++++++++++++++++++
drivers/serial/serial_pl01x.c | 28 ++++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index ccb80d2..b471adc 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -77,6 +77,13 @@ config DEBUG_UART_S5P
will need to provide parameters to make this work. The driver will
be available until the real driver-model serial is running.
+config DEBUG_UART_PL01X
+ bool "pl01x"
+ help
+ Select this to enable a debug UART using the pl01x 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
@@ -109,6 +116,19 @@ config DEBUG_UART_SHIFT
value. Use this value to specify the shift to use, where 0=byte
registers, 2=32-bit word registers, etc.
+config DEBUG_UART_SKIP_INIT
+ bool "Skip UART initialition"
+ help
+ Select this if the UART you want to use for debug output is already
+ initialized by the time U-Boot starts its execution.
+
+config DEBUG_UART_PL011
+ bool "PL011 UART type"
+ depends on DEBUG_UART_PL01X
+ help
+ Select this if the UART you want to use for debug output is of type
+ PL011.
+
config ROCKCHIP_SERIAL
bool "Rockchip on-chip UART support"
depends on ARCH_UNIPHIER && DM_SERIAL
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index e6ceaa1..5e96bf4 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -391,3 +391,31 @@ U_BOOT_DRIVER(serial_pl01x) = {
};
#endif
+
+#ifdef CONFIG_DEBUG_UART_PL01X
+
+#include <debug_uart.h>
+
+void debug_uart_init(void)
+{
+#ifndef CONFIG_DEBUG_UART_SKIP_INIT
+ struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
+ enum pl01x_type type = CONFIG_IS_ENABLED(DEBUG_UART_PL011) ?
+ TYPE_PL011 : TYPE_PL010;
+
+ pl01x_generic_serial_init(regs, type);
+ pl01x_generic_setbrg(regs, type,
+ CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
+#endif
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+ struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
+
+ pl01x_putc(regs, ch);
+}
+
+DEBUG_UART_FUNCS
+
+#endif
--
2.2.0
More information about the U-Boot
mailing list