|
@@ -42,12 +42,21 @@ int fdt_serial_init(void)
|
|
|
int pos, noff = -1, len, coff, rc;
|
|
|
void *fdt = sbi_scratch_thishart_arg1_ptr();
|
|
|
|
|
|
- /* Find offset of node pointed by stdout-path */
|
|
|
+ /* Find offset of node pointed to by stdout-path */
|
|
|
coff = fdt_path_offset(fdt, "/chosen");
|
|
|
if (-1 < coff) {
|
|
|
prop = fdt_getprop(fdt, coff, "stdout-path", &len);
|
|
|
- if (prop && len)
|
|
|
- noff = fdt_path_offset(fdt, prop);
|
|
|
+ if (prop && len) {
|
|
|
+ const char *sep, *start = prop;
|
|
|
+
|
|
|
+ /* The device path may be followed by ':' */
|
|
|
+ sep = strchr(start, ':');
|
|
|
+ if (sep)
|
|
|
+ noff = fdt_path_offset_namelen(fdt, prop,
|
|
|
+ sep - start);
|
|
|
+ else
|
|
|
+ noff = fdt_path_offset(fdt, prop);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/* First check DT node pointed by stdout-path */
|