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