aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/early_printk.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kernel/early_printk.c')
-rw-r--r--arch/arm64/kernel/early_printk.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c
index 0bb7436c57dc..ac974f48a7a2 100644
--- a/arch/arm64/kernel/early_printk.c
+++ b/arch/arm64/kernel/early_printk.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <linux/amba/serial.h> 26#include <linux/amba/serial.h>
27#include <linux/serial_reg.h>
27 28
28static void __iomem *early_base; 29static void __iomem *early_base;
29static void (*printch)(char ch); 30static void (*printch)(char ch);
@@ -51,6 +52,26 @@ static void smh_printch(char ch)
51 : : "r" (&ch) : "x0", "x1", "memory"); 52 : : "r" (&ch) : "x0", "x1", "memory");
52} 53}
53 54
55/*
56 * 8250/16550 (8-bit aligned registers) single character TX.
57 */
58static void uart8250_8bit_printch(char ch)
59{
60 while (!(readb_relaxed(early_base + UART_LSR) & UART_LSR_THRE))
61 ;
62 writeb_relaxed(ch, early_base + UART_TX);
63}
64
65/*
66 * 8250/16550 (32-bit aligned registers) single character TX.
67 */
68static void uart8250_32bit_printch(char ch)
69{
70 while (!(readl_relaxed(early_base + (UART_LSR << 2)) & UART_LSR_THRE))
71 ;
72 writel_relaxed(ch, early_base + (UART_TX << 2));
73}
74
54struct earlycon_match { 75struct earlycon_match {
55 const char *name; 76 const char *name;
56 void (*printch)(char ch); 77 void (*printch)(char ch);
@@ -59,6 +80,8 @@ struct earlycon_match {
59static const struct earlycon_match earlycon_match[] __initconst = { 80static const struct earlycon_match earlycon_match[] __initconst = {
60 { .name = "pl011", .printch = pl011_printch, }, 81 { .name = "pl011", .printch = pl011_printch, },
61 { .name = "smh", .printch = smh_printch, }, 82 { .name = "smh", .printch = smh_printch, },
83 { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, },
84 { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, },
62 {} 85 {}
63}; 86};
64 87