diff mbox

[U-Boot,v2,1/2] arm: serial: Add debug UART capability to the pl01x driver

Message ID 1441827340-23490-2-git-send-email-s.temerkhanov@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Sergey Temerkhanov Sept. 9, 2015, 7:35 p.m. UTC
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(+)

Comments

Simon Glass Sept. 10, 2015, 2:45 a.m. UTC | #1
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 mbox

Patch

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