Patchwork [U-Boot] Enable serial console only before booting

login
register
mail settings
Submitter Frederic Leroy
Date July 7, 2013, 11:42 a.m.
Message ID <1373197354-18721-1-git-send-email-fredo@starox.org>
Download mbox | patch
Permalink /patch/257321/
State Changes Requested
Delegated to: Tom Rini
Headers show

Comments

Frederic Leroy - July 7, 2013, 11:42 a.m.
When netconsole is active, some boards fail to boot.
This patch enables only the serial console before
control is handed over to another operating system.

Signed-off-by: Frédéric Leroy <fredo@starox.org>
---

Sorry for the noise, I tend to post faster than my own swadow ...

Changes in v2 :

- remove unused argument from console_set_serial_unconditionally call
- fix platforms where CONFIG_CONSOLE_MUX is not defined

 common/cmd_bootm.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 15f4599..e75c692 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -62,6 +62,18 @@ 
 #include <linux/lzo.h>
 #endif /* CONFIG_LZO */
 
+#if defined(CONFIG_NETCONSOLE)
+#include <iomux.h>
+void console_set_serial_unconditionally(void)
+{
+#if defined(CONFIG_CONSOLE_MUX)
+	iomux_doenv(stdin, "serial");
+	iomux_doenv(stdout, "serial");
+	iomux_doenv(stderr, "serial");
+#endif
+}
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifndef CONFIG_SYS_BOOTM_LEN
@@ -577,6 +589,7 @@  static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,
 			 * Stop the ethernet stack if NetConsole could have
 			 * left it up
 			 */
+			console_set_serial_unconditionally();
 			eth_halt();
 #endif
 			arch_preboot_os();
@@ -645,6 +658,7 @@  int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #ifdef CONFIG_NETCONSOLE
 	/* Stop the ethernet stack if NetConsole could have left it up */
+	console_set_serial_unconditionally();
 	eth_halt();
 #endif
 
@@ -1849,6 +1863,7 @@  static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #ifdef CONFIG_NETCONSOLE
 	/* Stop the ethernet stack if NetConsole could have left it up */
+	console_set_serial_unconditionally();
 	eth_halt();
 #endif