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