public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/7] fdt_support: Add multi-serial support for stdout fixup
@ 2009-08-19 18:37 Anton Vorontsov
  2009-09-16  4:18 ` Kumar Gala
  0 siblings, 1 reply; 9+ messages in thread
From: Anton Vorontsov @ 2009-08-19 18:37 UTC (permalink / raw)
  To: u-boot

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 89164a1..e01303a 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <stdio_dev.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.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 0/7] Some patches for MPC8569E-MDS
@ 2009-10-15 13:46 Anton Vorontsov
  2009-10-15 13:47 ` [U-Boot] [PATCH 1/7] fdt_support: Add multi-serial support for stdout fixup Anton Vorontsov
  0 siblings, 1 reply; 9+ messages in thread
From: Anton Vorontsov @ 2009-10-15 13:46 UTC (permalink / raw)
  To: u-boot

Hello Kumar,

Just resending rebased MPC8569E-MDS patches with your comments
addressed, plus there some fixes in eSDHC patch for pilot boards
(BCSR registers changed).

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-10-27  2:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-19 18:37 [U-Boot] [PATCH 1/7] fdt_support: Add multi-serial support for stdout fixup Anton Vorontsov
2009-09-16  4:18 ` Kumar Gala
2009-09-16 12:59   ` Jerry Van Baren
2009-09-16 15:17     ` Anton Vorontsov
2009-09-16 15:27       ` Jerry Van Baren
  -- strict thread matches above, loose matches on Subject: below --
2009-10-15 13:46 [U-Boot] [PATCH 0/7] Some patches for MPC8569E-MDS Anton Vorontsov
2009-10-15 13:47 ` [U-Boot] [PATCH 1/7] fdt_support: Add multi-serial support for stdout fixup Anton Vorontsov
2009-10-22 14:24   ` Kumar Gala
2009-10-22 14:47     ` Jerry Van Baren
2009-10-27  2:39   ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox