Skip to contentSkip to conversation

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

PATCH Superseded Sergey Temerkhanov 2 participants 2 messages Sep 8, 2015 – Sep 9, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---

 drivers/serial/Kconfig        | 20 ++++++++++++++++++++
 drivers/serial/serial_pl01x.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
drivers/serial/Kconfig +20 -0
index ccb80d2..b471adc 100644
@@ -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
drivers/serial/serial_pl01x.c +28 -0
index e6ceaa1..5e96bf4 100644
@@ -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
Signature · 1 line
2.2.0
#1 lore raw

PATCH 1/1 arm: serial: Add debug UART capability to the pl01x driver

Hi Sergey,

Quoted 31 lines · Sergey Temerkhanov

This patch adds an ability to use pl01x as a debug UART. It must be configured like other types of debug UARTs

---

 drivers/serial/Kconfig        | 20 ++++++++++++++++++++
 drivers/serial/serial_pl01x.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
drivers/serial/Kconfig +7 -0
index ccb80d2..b471adc 100644
@@ -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

drivers/serial/Kconfig config DEBUG_UART_SHIFT · line 120

Quoted 5 lines
drivers/serial/Kconfig +2 -0
@@ -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"

spelling. Also can you please put this in a separate patch? I have another debug UART patch which might allow this to be implemented differently.

drivers/serial/Kconfig config DEBUG_UART_SHIFT · line 125

Quoted 5 lines
drivers/serial/Kconfig +5 -0
+       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

I think this one needs to go up in the choice section: prompt "Select which UART will provide the debug UART"

Quoted 46 lines
drivers/serial/Kconfig +6 -0
+       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
drivers/serial/serial_pl01x.c +28 -1
index e6ceaa1..5e96bf4 100644
@@ -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
--
Quoted 2 lines

2.2.0

Regards,
Simon