From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergey Temerkhanov Date: Wed, 14 Oct 2015 09:54:23 -0700 Subject: [U-Boot] [RESEND PATCH v2 1/2] arm: serial: Add debug UART capability to the pl01x driver In-Reply-To: <1444841664-27773-1-git-send-email-s.temerkhanov@gmail.com> References: <1444841664-27773-1-git-send-email-s.temerkhanov@gmail.com> Message-ID: <1444841664-27773-2-git-send-email-s.temerkhanov@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Signed-off-by: Radha Mohan Chintakuntla Acked-by: Simon Glass --- Changes in v2: - Broke down into 2 patches - Minor changes to accomodate Kconfig options drivers/serial/serial_pl01x.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index 3a5c1d0..18c02ab 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -367,3 +367,31 @@ U_BOOT_DRIVER(serial_pl01x) = { }; #endif + +#if defined(CONFIG_DEBUG_UART_PL010) || defined(CONFIG_DEBUG_UART_PL011) + +#include + +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.1.4