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

login
register
mail settings
Submitter Frederic Leroy
Date July 7, 2013, 10:25 a.m.
Message ID <1373192736-5014-1-git-send-email-fredo@starox.org>
Download mbox | patch
Permalink /patch/257319/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

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

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

Hello,

I am facing the same problem with LaCie kirkwood boards.
I took a simple approach for fixing this issue.
This works for me ...
Any comments are welcome :)

Frédéric

 common/cmd_bootm.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Wolfgang Denk - July 7, 2013, 10:31 p.m.
Dear Frédéric Leroy,

In message <1373192736-5014-1-git-send-email-fredo@starox.org> you wrote:
> When netconsole is active, some boards fail to boot.
> This patch enables only the serial console before
> control is handed by another operating system.

I really hate adding such fixes without understanding the exact nature
of the problem.

Could you please be so kind and explain in which way booting fails
when netconsole is active?  On what exactly the "some boards" are that
fail that way?  And why this does not appear to be a problem on other
boards? (or is it?)  And thy the "some boards" cannot be fixed in such
a way to behave as the rest of the boards (where it's not a problem) ?
Tom Rini - Sept. 5, 2013, 1:43 p.m.
On Sun, Jul 07, 2013 at 12:25:36PM +0200, Fr??d??ric Leroy wrote:

> When netconsole is active, some boards fail to boot.
> This patch enables only the serial console before
> control is handed by another operating system.
> 
> Signed-off-by: Fr??d??ric Leroy <fredo@starox.org>
> ---
> 
> Hello,
> 
> I am facing the same problem with LaCie kirkwood boards.
> I took a simple approach for fixing this issue.
> This works for me ...
> Any comments are welcome :)
> 

Can you please re-base this to mainline and re-post?  Also, can you
expand on the comments in the commit message to explain the problem with
netconsole and thus why this fixes it?

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 15f4599..81e8322 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -62,6 +62,17 @@ 
 #include <linux/lzo.h>
 #endif /* CONFIG_LZO */
 
+
+#if defined(CONFIG_NETCONSOLE)
+#include <iomux.h>
+void console_set_serial_unconditionally(void)
+{
+	iomux_doenv(stdin, "serial");
+	iomux_doenv(stdout, "serial");
+	iomux_doenv(stderr, "serial");
+}
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifndef CONFIG_SYS_BOOTM_LEN
@@ -577,6 +588,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("nc");
 			eth_halt();
 #endif
 			arch_preboot_os();
@@ -645,6 +657,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("nc");
 	eth_halt();
 #endif
 
@@ -1849,6 +1862,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("nc");
 	eth_halt();
 #endif