Commit 3e303f748cf57fb23e8ec95ab7eac0074be50e2b
fdt_support: Add multi-serial support for stdout fixup
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> Acked-by: Gerald Van Baren <vanbaren@cideas.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Showing 1 changed file with 21 additions and 1 deletions Side-by-side Diff
... | ... | @@ -22,6 +22,7 @@ |
22 | 22 | */ |
23 | 23 | |
24 | 24 | #include <common.h> |
25 | +#include <stdio_dev.h> | |
25 | 26 | #include <linux/ctype.h> |
26 | 27 | #include <linux/types.h> |
27 | 28 | #include <asm/global_data.h> |
... | ... | @@ -90,6 +91,23 @@ |
90 | 91 | } |
91 | 92 | |
92 | 93 | #ifdef CONFIG_OF_STDOUT_VIA_ALIAS |
94 | + | |
95 | +#ifdef CONFIG_SERIAL_MULTI | |
96 | +static void fdt_fill_multisername(char *sername, size_t maxlen) | |
97 | +{ | |
98 | + const char *outname = stdio_devices[stdout]->name; | |
99 | + | |
100 | + if (strcmp(outname, "serial") > 0) | |
101 | + strncpy(sername, outname, maxlen); | |
102 | + | |
103 | + /* eserial? */ | |
104 | + if (strcmp(outname + 1, "serial") > 0) | |
105 | + strncpy(sername, outname + 1, maxlen); | |
106 | +} | |
107 | +#else | |
108 | +static inline void fdt_fill_multisername(char *sername, size_t maxlen) {} | |
109 | +#endif /* CONFIG_SERIAL_MULTI */ | |
110 | + | |
93 | 111 | static int fdt_fixup_stdout(void *fdt, int chosenoff) |
94 | 112 | { |
95 | 113 | int err = 0; |
... | ... | @@ -98,7 +116,9 @@ |
98 | 116 | char sername[9] = { 0 }; |
99 | 117 | const char *path; |
100 | 118 | |
101 | - sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1); | |
119 | + fdt_fill_multisername(sername, sizeof(sername) - 1); | |
120 | + if (!sername[0]) | |
121 | + sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1); | |
102 | 122 | |
103 | 123 | err = node = fdt_path_offset(fdt, "/aliases"); |
104 | 124 | if (node >= 0) { |
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae
-
mentioned in commit 9f29ae