From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] fdt_support: Add multi-serial support for stdout fixup
Date: Wed, 10 Jun 2009 00:41:00 +0400 [thread overview]
Message-ID: <20090609204100.GB22606@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090609204030.GA21015@oksana.dev.rtsoft.ru>
Currently fdt_fixup_stdout() is using hard-coded CONFIG_CONS_INDEX
constant. With multi-serial support, the CONS_INDEX may no longer
represent actual console, so we should try to extract port number
from the current stdio device name instead of always hard-coding the
constant value.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
common/fdt_support.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index ec6cff1..d9f4693 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -22,6 +22,7 @@
*/
#include <common.h>
+#include <devices.h>
#include <linux/ctype.h>
#include <linux/types.h>
#include <asm/global_data.h>
@@ -90,6 +91,23 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
}
#ifdef CONFIG_OF_STDOUT_VIA_ALIAS
+
+#ifdef CONFIG_SERIAL_MULTI
+static void fdt_fill_multisername(char *sername, size_t maxlen)
+{
+ const char *outname = stdio_devices[stdout]->name;
+
+ if (strcmp(outname, "serial") > 0)
+ strncpy(sername, outname, maxlen);
+
+ /* eserial? */
+ if (strcmp(outname + 1, "serial") > 0)
+ strncpy(sername, outname + 1, maxlen);
+}
+#else
+static inline void fdt_fill_multisername(char *sername, size_t maxlen) {}
+#endif /* CONFIG_SERIAL_MULTI */
+
static int fdt_fixup_stdout(void *fdt, int chosenoff)
{
int err = 0;
@@ -98,7 +116,9 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)
char sername[9] = { 0 };
const char *path;
- sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
+ fdt_fill_multisername(sername, sizeof(sername) - 1);
+ if (!sername[0])
+ sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
err = node = fdt_path_offset(fdt, "/aliases");
if (node >= 0) {
--
1.6.3.1
next prev parent reply other threads:[~2009-06-09 20:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 20:40 [U-Boot] [PATCH 0/5] Some patches for MPC8569E-MDS Anton Vorontsov
2009-06-09 20:40 ` [U-Boot] [PATCH 1/5] mpc85xx: Add multi-serial support for MPC8569E-MDS boards Anton Vorontsov
2009-06-09 20:41 ` Anton Vorontsov [this message]
2009-06-09 20:41 ` [U-Boot] [PATCH 3/5] mpc85xx: Add eSDHC " Anton Vorontsov
2009-06-09 20:41 ` [U-Boot] [PATCH 4/5] mpc85xx: Add eLBC NAND " Anton Vorontsov
2009-06-09 20:41 ` [U-Boot] [PATCH 5/5] mpc85xx: Setup QE pinmux for SPI Flash on " Anton Vorontsov
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=20090609204100.GB22606@oksana.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--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