aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc/cpu
diff options
context:
space:
mode:
authorFrancois Retief <fgretief@spaceteq.co.za>2015-10-29 12:55:34 +0200
committerFrancois Retief <fgretief@spaceteq.co.za>2015-11-13 10:23:33 +0200
commite43ce3fca755d79635899b658a97f3c4a7dbf220 (patch)
treeab287ecdb45c987e51109090e0ae56abc911a405 /arch/sparc/cpu
parent5786071e4a3b9091940580c208e27d21fdc269cf (diff)
downloadu-boot-e43ce3fca755d79635899b658a97f3c4a7dbf220.zip
u-boot-e43ce3fca755d79635899b658a97f3c4a7dbf220.tar.gz
u-boot-e43ce3fca755d79635899b658a97f3c4a7dbf220.tar.bz2
sparc: leon3: Add debug_uart support to LEON3 serial driver.
Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>
Diffstat (limited to 'arch/sparc/cpu')
-rw-r--r--arch/sparc/cpu/leon3/cpu_init.c5
-rw-r--r--arch/sparc/cpu/leon3/serial.c27
2 files changed, 30 insertions, 2 deletions
diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c
index 40d1751..b140da3 100644
--- a/arch/sparc/cpu/leon3/cpu_init.c
+++ b/arch/sparc/cpu/leon3/cpu_init.c
@@ -13,6 +13,7 @@
#include <ambapp.h>
#include <grlib/irqmp.h>
#include <grlib/gptimer.h>
+#include <debug_uart.h>
#include <config.h>
@@ -50,7 +51,9 @@ struct {
*/
void cpu_init_f(void)
{
-
+#ifdef CONFIG_DEBUG_UART
+ debug_uart_init();
+#endif
}
/* Routine called from start.S,
diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index cefb9d2..66b3773 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -28,8 +28,10 @@ static int leon3_serial_init(void)
/* find UART */
if (ambapp_apb_find(&ambapp_plb, VENDOR_GAISLER, GAISLER_APBUART,
- CONFIG_SYS_GRLIB_APBUART_INDEX, &apbdev) != 1)
+ CONFIG_SYS_GRLIB_APBUART_INDEX, &apbdev) != 1) {
+ panic("%s: apbuart not found!\n", __func__);
return -1; /* didn't find hardware */
+ }
/* found apbuart, let's init .. */
uart = (ambapp_dev_apbuart *) apbdev.address;
@@ -145,3 +147,26 @@ __weak struct serial_device *default_serial_console(void)
{
return &leon3_serial_drv;
}
+
+#ifdef CONFIG_DEBUG_UART_APBUART
+
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+ ambapp_dev_apbuart *uart = (ambapp_dev_apbuart *)CONFIG_DEBUG_UART_BASE;
+ uart->scaler = (((CONFIG_DEBUG_UART_CLOCK*10) / (CONFIG_BAUDRATE*8)) - 5)/10;
+ uart->ctrl = APBUART_CTRL_RE | APBUART_CTRL_TE;
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+ ambapp_dev_apbuart *uart = (ambapp_dev_apbuart *)CONFIG_DEBUG_UART_BASE;
+ while (!(readl(&uart->status) & APBUART_STATUS_THE))
+ WATCHDOG_RESET();
+ writel(ch, &uart->data);
+}
+
+DEBUG_UART_FUNCS
+
+#endif