Skip to contentSkip to conversation

of/fdt: fix aliases with baudrate in earlycon

PATCH In review Stefan Agner 3 participants 3 messages Oct 10, 2015 – Oct 13, 2015 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of/fdt: fix aliases with baudrate in earlycon

Many boards use an alias in the stdout-path specification along with console options after a colon (e.g. serial0:115200n8). When using earlycon, this specification currently does not work. While fdt_path_offset supports alias resolution, it does not remove the console options by itself. Use the fdt_path_offset_namelen variant and provide the length of the alias to enable aliases with console options in the stdout-path.

---
Hi,

Stumbled upon this while testing 32-bit ARM earlycon support. It seems that this once already came up on the list:
https://lkml.org/lkml/2015/3/13/562

--
Stefan

 drivers/of/fdt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/of/fdt.c +4 -1
index 6e82bc42..9fc3568 100644
@@ -813,8 +813,11 @@ static int __init early_init_dt_scan_chosen_serial(void)
 	if (!p || !l)
 		return -ENOENT;
 
+	/* Remove console options if present */
+	l = strchrnul(p, ':') - p;
+
 	/* Get the node specified by stdout-path */
-	offset = fdt_path_offset(fdt, p);
+	offset = fdt_path_offset_namelen(fdt, p, l);
 	if (offset < 0)
 		return -ENODEV;
 
Signature · 1 line
2.6.1
#1 lore raw
Quoted 8 lines · Stefan Agner

Many boards use an alias in the stdout-path specification along with console options after a colon (e.g. serial0:115200n8). When using earlycon, this specification currently does not work. While fdt_path_offset supports alias resolution, it does not remove the console options by itself. Use the fdt_path_offset_namelen variant and provide the length of the alias to enable aliases with console options in the stdout-path.

Quoted 7 lines

---
Hi,

Stumbled upon this while testing 32-bit ARM earlycon support. It seems that this once already came up on the list:
https://lkml.org/lkml/2015/3/13/562

Yeah, looks like my patch got lost somewhere.
https://lkml.org/lkml/2015/4/8/604

Regards,
Peter Hurley

Quoted 12 lines
 drivers/of/fdt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/of/fdt.c +0 -0
index 6e82bc42..9fc3568 100644
@@ -813,8 +813,11 @@ static int __init early_init_dt_scan_chosen_serial(void)
 	if (!p || !l)
 		return -ENOENT;

drivers/of/fdt.c static int __init early_init_dt_scan_chosen_serial(void) · line 823

Quoted 10 lines
drivers/of/fdt.c +4 -1
 
+	/* Remove console options if present */
+	l = strchrnul(p, ':') - p;
+
 	/* Get the node specified by stdout-path */
-	offset = fdt_path_offset(fdt, p);
+	offset = fdt_path_offset_namelen(fdt, p, l);
 	if (offset < 0)
 		return -ENODEV;
 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 13 lines · Peter Hurley
Quoted 12 lines · Stefan Agner

Many boards use an alias in the stdout-path specification along with console options after a colon (e.g. serial0:115200n8). When using earlycon, this specification currently does not work. While fdt_path_offset supports alias resolution, it does not remove the console options by itself. Use the fdt_path_offset_namelen variant and provide the length of the alias to enable aliases with console options in the stdout-path.

---
Hi,

Quoted 6 lines
Quoted 3 lines

Stumbled upon this while testing 32-bit ARM earlycon support. It seems that this once already came up on the list:
https://lkml.org/lkml/2015/3/13/562

Yeah, looks like my patch got lost somewhere.
https://lkml.org/lkml/2015/4/8/604

Sorry about that. I forgot about it after getting the dtc dependency done I guess.

I've now applied this version.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html