b3cc05f
From: Mark Salter <msalter@redhat.com>
b3cc05f
Date: Wed, 25 Mar 2015 14:17:50 -0400
6b80640
Subject: [PATCH] arm64: avoid needing console= to enable serial console
b3cc05f
b3cc05f
Tell kernel to prefer one of the serial ports for console on
b3cc05f
platforms currently supported (pl011 or 8250). console= on
b3cc05f
command line will override these assumed preferences. This is
b3cc05f
just a hack to get the behavior we want from DT provided by
b3cc05f
firmware.
b3cc05f
b3cc05f
Signed-off-by: Mark Salter <msalter@redhat.com>
b3cc05f
---
b3cc05f
 arch/arm64/kernel/setup.c | 19 +++++++++++++++++++
b3cc05f
 1 file changed, 19 insertions(+)
b3cc05f
b3cc05f
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
5448a3e
index 781f4697dc26..164d618d988c 100644
b3cc05f
--- a/arch/arm64/kernel/setup.c
b3cc05f
+++ b/arch/arm64/kernel/setup.c
5448a3e
@@ -559,3 +559,22 @@ const struct seq_operations cpuinfo_op = {
b3cc05f
 	.stop	= c_stop,
b3cc05f
 	.show	= c_show
b3cc05f
 };
b3cc05f
+
b3cc05f
+/*
b3cc05f
+ * Temporary hack to avoid need for console= on command line
b3cc05f
+ */
b3cc05f
+static int __init arm64_console_setup(void)
b3cc05f
+{
b3cc05f
+	/* Allow cmdline to override our assumed preferences */
b3cc05f
+	if (console_set_on_cmdline)
b3cc05f
+		return 0;
b3cc05f
+
b3cc05f
+	if (IS_ENABLED(CONFIG_SERIAL_AMBA_PL011))
b3cc05f
+		add_preferred_console("ttyAMA", 0, "115200");
b3cc05f
+
b3cc05f
+	if (IS_ENABLED(CONFIG_SERIAL_8250))
b3cc05f
+		add_preferred_console("ttyS", 0, "115200");
b3cc05f
+
b3cc05f
+	return 0;
b3cc05f
+}
b3cc05f
+early_initcall(arm64_console_setup);