diff options
author | Wolfgang Denk <wd@denx.de> | 2009-10-27 20:56:31 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-10-27 20:56:31 +0100 |
commit | 98cecb610f3fa53aa7d825a634d35ef9cf6c5487 (patch) | |
tree | f9a153be5ec31919981e4d53e5ee274cffa3d15b /common | |
parent | a747a7f31059b9069e97c78bba5496409c33aa05 (diff) | |
parent | 3fca80375981fe83d4674a0267183b469a1ea7ff (diff) | |
download | u-boot-imx-98cecb610f3fa53aa7d825a634d35ef9cf6c5487.zip u-boot-imx-98cecb610f3fa53aa7d825a634d35ef9cf6c5487.tar.gz u-boot-imx-98cecb610f3fa53aa7d825a634d35ef9cf6c5487.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
Diffstat (limited to 'common')
-rw-r--r-- | 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 9adaeb3..f89a3ee 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) { |