Commit b81406db51a68ddd482d4ea3641dd7ad2e910771

Authored by Sergey Temerkhanov
Committed by Tom Rini
1 parent e6ac28b60b

arm: serial: Add debug UART capability to the pl01x driver

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>
[trini: Update for _debug_uart_init change]
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

Showing 1 changed file with 28 additions and 0 deletions Side-by-side Diff

drivers/serial/serial_pl01x.c
... ... @@ -367,4 +367,32 @@
367 367 };
368 368  
369 369 #endif
  370 +
  371 +#if defined(CONFIG_DEBUG_UART_PL010) || defined(CONFIG_DEBUG_UART_PL011)
  372 +
  373 +#include <debug_uart.h>
  374 +
  375 +static void _debug_uart_init(void)
  376 +{
  377 +#ifndef CONFIG_DEBUG_UART_SKIP_INIT
  378 + struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
  379 + enum pl01x_type type = CONFIG_IS_ENABLED(DEBUG_UART_PL011) ?
  380 + TYPE_PL011 : TYPE_PL010;
  381 +
  382 + pl01x_generic_serial_init(regs, type);
  383 + pl01x_generic_setbrg(regs, type,
  384 + CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
  385 +#endif
  386 +}
  387 +
  388 +static inline void _debug_uart_putc(int ch)
  389 +{
  390 + struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
  391 +
  392 + pl01x_putc(regs, ch);
  393 +}
  394 +
  395 +DEBUG_UART_FUNCS
  396 +
  397 +#endif