Skip to contentSkip to conversation

serial: atmel_usart: Support to enable an early debug UART

PATCH New Wenyou Yang 2 participants 5 messages Oct 17, 2016 – Oct 28, 2016 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

v3 cover serial: atmel_usart: Support to enable an early debug UART

The patch set is to add support to enable an early debug UART for debugging. And add ATMEL_USART option to enable the Atmel usartdriver from Kconfig.

Changes in v3:
- Collect Reviewed-by tag.
- Collect Reviewed-by tag.

Changes in v2:
- Collect Reviewed-by tag.

Wenyou Yang (2):
serial: Kconfig: Add ATMEL_USART option
serial: atmel_usart: Support enable an early debug UART

 drivers/serial/Kconfig       | 14 ++++++++++++++
 drivers/serial/atmel_usart.c | 22 ++++++++++++++++++++++
 2 files changed, 36 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/2 serial: Kconfig: Add ATMEL_USART option

Add ATMEL_USART option to support to enable the Atmel usart driver from Kconfig.

---

Changes in v3:
- Collect Reviewed-by tag.

Changes in v2: None

 drivers/serial/Kconfig | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/serial/Kconfig +7 -0
index 541cf2e..9e48902 100644
@@ -296,6 +296,13 @@ config AR933X_UART
 	  tree binding to operate, please refer to the document at
 	  doc/device-tree-bindings/serial/qca,ar9330-uart.txt.
 
+config ATMEL_USART
+	bool "Atmel USART support"
+	help
+	  Select this to enable USART support for Atmel SoCs. It can be
+	  configured in the device tree, and input clock frequency can
+	  be got from the clk node.
+
 config FSL_LPUART
 	bool "Freescale LPUART support"
 	help
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 1/2 serial: Kconfig: Add ATMEL_USART option

Dear Wenyou Yang,

Quoted 7 lines · Wenyou Yang

Add ATMEL_USART option to support to enable the Atmel usart driver from Kconfig.

---

Quoted 7 lines

Changes in v3:
- Collect Reviewed-by tag.

Changes in v2: None

drivers/serial/Kconfig | 7 +++++++

1 file changed, 7 insertions(+)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

#3 lore raw

PATCH v3 2/2 serial: atmel_usart: Support enable an early debug UART

In reply to Wenyou Yang

Add support to enable an early debug UART for debugging.

---

Changes in v3:
- Collect Reviewed-by tag.

Changes in v2:
- Collect Reviewed-by tag.

 drivers/serial/Kconfig       |  7 +++++++
 drivers/serial/atmel_usart.c | 22 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)
drivers/serial/Kconfig +7 -0
index 9e48902..507a27d 100644
@@ -98,6 +98,13 @@ config DEBUG_UART_AR933X
 	  driver will be available until the real driver model serial is
 	  running.
 
+config DEBUG_UART_ATMEL
+	bool "Atmel USART"
+	help
+	  Select this to enable a debug UART using the atmel usart driver. You
+	  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_NS16550
 	bool "ns16550"
 	help
drivers/serial/atmel_usart.c +22 -0
index e450135..7674f97 100644
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <watchdog.h>
 #include <serial.h>
+#include <debug_uart.h>
 #include <linux/compiler.h>
 
 #include <asm/io.h>
@@ -226,3 +227,24 @@ U_BOOT_DRIVER(serial_atmel) = {
 	.priv_auto_alloc_size	= sizeof(struct atmel_serial_priv),
 };
 #endif
+
+#ifdef CONFIG_DEBUG_UART_ATMEL
+static inline void _debug_uart_init(void)
+{
+	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_DEBUG_UART_BASE;
+
+	atmel_serial_setbrg_internal(usart, 0, CONFIG_BAUDRATE);
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_DEBUG_UART_BASE;
+
+	while (!(readl(&usart->csr) & USART3_BIT(TXRDY)))
+		;
+
+	writel(ch, &usart->thr);
+}
+
+DEBUG_UART_FUNCS
+#endif
Signature · 1 line
2.7.4
#4 lore raw

PATCH v3 2/2 serial: atmel_usart: Support enable an early debug UART

Dear Wenyou Yang,

Quoted 10 lines · Wenyou Yang

Add support to enable an early debug UART for debugging.

---

Changes in v3:
- Collect Reviewed-by tag.

Quoted 6 lines

Changes in v2:
- Collect Reviewed-by tag.

drivers/serial/Kconfig | 7 +++++++
drivers/serial/atmel_usart.c | 22 ++++++++++++++++++++++

2 files changed, 29 insertions(+)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann