From: Gary Jennejohn <garyj@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2 V2] IOMUX: Add console multiplexing support.
Date: Mon, 20 Oct 2008 13:58:49 +0200 [thread overview]
Message-ID: <20081020135849.371fe4d1@ernst.jennejohn.org> (raw)
In-Reply-To: <20080914164530.0a59c6ca@peedub.jennejohn.org>
When both CONFIG_SYS_CONSOLE_IS_IN_ENV and CONFIG_NETCONSOLE are defined the
user can have stdout set to nc (netconsole).
This causes problems because u-boot will try to write to nc as soon as
GD_FLG_DEVINIT is set in gd->flags, which happens before the network devices
are initialized in net/eth.c. This results in error messages being spewed
out.
To prevent this problem set GD_FLG_DEVINIT in net/eth.c:eth_initialize(), after
the network devices have been initialized, instead of in
common/console.c:console_init_r().
Signed-off-by: Gary Jennejohn <garyj@denx.de>
---
common/console.c | 11 +++++++++++
net/eth.c | 22 ++++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/common/console.c b/common/console.c
index 6f0846f..e0d7541 100644
--- a/common/console.c
+++ b/common/console.c
@@ -447,7 +447,18 @@ int console_init_r (void)
console_setfile (stdin, inputdev);
}
+#ifdef CONFIG_NETCONSOLE
+ /*
+ * Must do this later in net/eth.c because a network device may
+ * be set as a console at boot.
+ *
+ * Note that the code is left here to make it clear that gd->flags
+ * would normally have been set at this point.
+ */
+ gd->flags |= 0;
+#else
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
+#endif /* CONFIG_NETCONSOLE */
#ifndef CONFIG_SYS_CONSOLE_INFO_QUIET
/* Print information */
diff --git a/net/eth.c b/net/eth.c
index ccd871a..6c00ff7 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -26,6 +26,10 @@
#include <net.h>
#include <miiphy.h>
+#if defined(CONFIG_NETCONSOLE) && defined(CONFIG_SYS_CONSOLE_IS_IN_ENV)
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
/*
@@ -262,6 +266,15 @@ int eth_initialize(bd_t *bis)
putc ('\n');
}
+#if defined(CONFIG_NETCONSOLE) && defined(CONFIG_SYS_CONSOLE_IS_IN_ENV)
+ /*
+ * Must do this late because a network device may be set as a
+ * console at boot. gd->flags is normally set quite early in
+ * console_init_r.
+ */
+ gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
+#endif
+
return eth_number;
}
@@ -538,6 +551,15 @@ int eth_initialize(bd_t *bis)
#if defined(CONFIG_DRIVER_TI_EMAC)
davinci_eth_miiphy_initialize(bis);
#endif
+#if defined(CONFIG_NETCONSOLE) && defined(CONFIG_SYS_CONSOLE_IS_IN_ENV)
+ /*
+ * Must do this late because a network device may be set as a
+ * console at boot. gd->flags is normally set quite early in
+ * console_init_r.
+ */
+ gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
+#endif
+
return 0;
}
#endif
--
1.5.4.3
---
Gary Jennejohn
*********************************************************************
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
*********************************************************************
next prev parent reply other threads:[~2008-10-20 11:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-14 14:45 [U-Boot] [PATCH 2/2] IOMUX: Add console multiplexing support Gary Jennejohn
2008-09-14 16:07 ` Wolfgang Denk
2008-09-14 17:19 ` Gary Jennejohn
2008-09-14 18:34 ` Wolfgang Denk
2008-09-15 8:46 ` Gary Jennejohn
2008-09-15 11:08 ` Wolfgang Denk
2008-10-20 11:58 ` Gary Jennejohn [this message]
2008-10-20 13:24 ` [U-Boot] [PATCH 2/2 V2] " Wolfgang Denk
2008-10-20 13:57 ` Gary Jennejohn
2008-10-20 16:26 ` Gary Jennejohn
2008-10-20 19:43 ` Wolfgang Denk
2008-10-20 20:13 ` Ben Warren
2008-10-21 9:45 ` Gary Jennejohn
2008-10-21 10:34 ` Wolfgang Denk
2008-10-21 11:32 ` Gary Jennejohn
2008-10-20 19:32 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081020135849.371fe4d1@ernst.jennejohn.org \
--to=garyj@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox