summaryrefslogtreecommitdiff
path: root/arch/blackfin/cpu
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2013-03-14 15:13:30 +0800
committerSonic Zhang <sonic.zhang@analog.com>2013-05-13 16:26:27 +0800
commitd68e7faac08be5424c748c0ead9b07dd00a43cc1 (patch)
tree36802a9eba480bced70240c1efbbec87a832ded2 /arch/blackfin/cpu
parent50aadcc560560f7365bb6373d4db1375522c4fe3 (diff)
downloadu-boot-imx-d68e7faac08be5424c748c0ead9b07dd00a43cc1.zip
u-boot-imx-d68e7faac08be5424c748c0ead9b07dd00a43cc1.tar.gz
u-boot-imx-d68e7faac08be5424c748c0ead9b07dd00a43cc1.tar.bz2
blackfin: Add memory virtual console to blackfin serial driver.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Diffstat (limited to 'arch/blackfin/cpu')
-rw-r--r--arch/blackfin/cpu/serial.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 89290d6..c453a03 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -351,4 +351,62 @@ void _serial_early_init(void)
}
#endif
-#endif
+#elif defined(CONFIG_UART_MEM)
+
+char serial_logbuf[CONFIG_UART_MEM];
+char *serial_logbuf_head = serial_logbuf;
+
+int serial_mem_init(void)
+{
+ serial_logbuf_head = serial_logbuf;
+ return 0;
+}
+
+void serial_mem_setbrg(void)
+{
+}
+
+int serial_mem_tstc(void)
+{
+ return 0;
+}
+
+int serial_mem_getc(void)
+{
+ return 0;
+}
+
+void serial_mem_putc(const char c)
+{
+ *serial_logbuf_head = c;
+ if (++serial_logbuf_head == serial_logbuf + CONFIG_UART_MEM)
+ serial_logbuf_head = serial_logbuf;
+}
+
+void serial_mem_puts(const char *s)
+{
+ while (*s)
+ serial_putc(*s++);
+}
+
+struct serial_device bfin_serial_mem_device = {
+ .name = "bfin_uart_mem",
+ .start = serial_mem_init,
+ .setbrg = serial_mem_setbrg,
+ .getc = serial_mem_getc,
+ .tstc = serial_mem_tstc,
+ .putc = serial_mem_putc,
+ .puts = serial_mem_puts,
+};
+
+
+__weak struct serial_device *default_serial_console(void)
+{
+ return &bfin_serial_mem_device;
+}
+
+void bfin_serial_initialize(void)
+{
+ serial_register(&bfin_serial_mem_device);
+}
+#endif /* CONFIG_UART_MEM */