Message ID | 1441827340-23490-2-git-send-email-s.temerkhanov@gmail.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
On 9 September 2015 at 13:35, Sergey Temerkhanov <s.temerkhanov@gmail.com> wrote: > 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@gmail.com> > Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> > > --- > > 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(+) Acked-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index e6ceaa1..e83a44c 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -391,3 +391,31 @@ U_BOOT_DRIVER(serial_pl01x) = { }; #endif + +#if defined(CONFIG_DEBUG_UART_PL010) || defined(CONFIG_DEBUG_UART_PL011) + +#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