aboutsummaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/early_printk.c
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2013-05-03 14:24:48 +0100
committerJon Medhurst <tixy@linaro.org>2013-05-03 14:24:48 +0100
commit8417d689429075fe59d92af4036e25424b13ea9c (patch)
treef0d341e6eae1cd5c4ca6180aeb29a00e21ff8a8e /arch/arm64/kernel/early_printk.c
parent83e4a8b0fe64a97fc92f436c7eff09569352c5ed (diff)
parentcee7bd6c72b15e357eb375a178532851c72e789c (diff)
Merge branch 'tracking-armlt-arm64' into integration-linux-vexpresstracking-integration-linux-vexpress-lsk-20130505.0
Conflicts: drivers/clk/versatile/Makefile
Diffstat (limited to 'arch/arm64/kernel/early_printk.c')
-rw-r--r--arch/arm64/kernel/early_printk.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c
index 7e320a2edb9..ac974f48a7a 100644
--- a/arch/arm64/kernel/early_printk.c
+++ b/arch/arm64/kernel/early_printk.c
@@ -24,6 +24,7 @@
#include <linux/io.h>
#include <linux/amba/serial.h>
+#include <linux/serial_reg.h>
static void __iomem *early_base;
static void (*printch)(char ch);
@@ -40,6 +41,37 @@ static void pl011_printch(char ch)
;
}
+/*
+ * Semihosting-based debug console
+ */
+static void smh_printch(char ch)
+{
+ asm volatile("mov x1, %0\n"
+ "mov x0, #3\n"
+ "hlt 0xf000\n"
+ : : "r" (&ch) : "x0", "x1", "memory");
+}
+
+/*
+ * 8250/16550 (8-bit aligned registers) single character TX.
+ */
+static void uart8250_8bit_printch(char ch)
+{
+ while (!(readb_relaxed(early_base + UART_LSR) & UART_LSR_THRE))
+ ;
+ writeb_relaxed(ch, early_base + UART_TX);
+}
+
+/*
+ * 8250/16550 (32-bit aligned registers) single character TX.
+ */
+static void uart8250_32bit_printch(char ch)
+{
+ while (!(readl_relaxed(early_base + (UART_LSR << 2)) & UART_LSR_THRE))
+ ;
+ writel_relaxed(ch, early_base + (UART_TX << 2));
+}
+
struct earlycon_match {
const char *name;
void (*printch)(char ch);
@@ -47,6 +79,9 @@ struct earlycon_match {
static const struct earlycon_match earlycon_match[] __initconst = {
{ .name = "pl011", .printch = pl011_printch, },
+ { .name = "smh", .printch = smh_printch, },
+ { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, },
+ { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, },
{}
};