1dea4eb
From ce7a9e482dcf66d155e74b39ada1708cf6d9cb25 Mon Sep 17 00:00:00 2001
984fc80
From: Mark Salter <msalter@redhat.com>
984fc80
Date: Wed, 25 Mar 2015 14:17:50 -0400
2aa3606
Subject: [PATCH] arm64: avoid needing console= to enable serial console
984fc80
984fc80
Tell kernel to prefer one of the serial ports for console on
984fc80
platforms currently supported (pl011 or 8250). console= on
984fc80
command line will override these assumed preferences. This is
984fc80
just a hack to get the behavior we want from DT provided by
984fc80
firmware.
984fc80
984fc80
Signed-off-by: Mark Salter <msalter@redhat.com>
984fc80
---
1dea4eb
 arch/arm64/kernel/setup.c | 20 ++++++++++++++++++++
1dea4eb
 1 file changed, 20 insertions(+)
984fc80
984fc80
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
1dea4eb
index 9dc67769b6a4..dfac33b47423 100644
984fc80
--- a/arch/arm64/kernel/setup.c
984fc80
+++ b/arch/arm64/kernel/setup.c
1dea4eb
@@ -417,3 +417,22 @@ static int __init register_kernel_offset_dumper(void)
1275020
 	return 0;
1275020
 }
1dea4eb
 __initcall(register_kernel_offset_dumper);
984fc80
+
984fc80
+/*
984fc80
+ * Temporary hack to avoid need for console= on command line
984fc80
+ */
984fc80
+static int __init arm64_console_setup(void)
984fc80
+{
984fc80
+	/* Allow cmdline to override our assumed preferences */
984fc80
+	if (console_set_on_cmdline)
984fc80
+		return 0;
984fc80
+
984fc80
+	if (IS_ENABLED(CONFIG_SERIAL_AMBA_PL011))
984fc80
+		add_preferred_console("ttyAMA", 0, "115200");
984fc80
+
984fc80
+	if (IS_ENABLED(CONFIG_SERIAL_8250))
984fc80
+		add_preferred_console("ttyS", 0, "115200");
984fc80
+
984fc80
+	return 0;
984fc80
+}
984fc80
+early_initcall(arm64_console_setup);
1275020
-- 
1275020
2.5.0
1275020