of: add do_fixup_by_compatible with u32 and string version
PATCH 1/1 of: add do_fixup_by_compatible with u32 and string version
--- common/oftree.c | 27 +++++++++++++++++++++++++++ include/of.h | 6 ++++++ 2 files changed, 33 insertions(+)
common/oftree.c +27 -0
@@ -229,6 +229,33 @@ void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path,do_fixup_by_path (fdt, path, prop, &val,sizeof (val), create); } +void do_fixup_by_compatible (struct fdt_header *fdt,const char *compatible, +const char *prop,const void *val,int len,int create) +{ +int off =-1 ; + + off =fdt_node_offset_by_compatible (fdt,-1 , compatible); +while (off != -FDT_ERR_NOTFOUND ) { +if (create || (fdt_get_property (fdt, off, prop,0 ) !=NULL )) +fdt_setprop (fdt, off, prop, val, len); + off =fdt_node_offset_by_compatible (fdt, off, compatible); + } +} + +void do_fixup_by_compatible_u32 (struct fdt_header *fdt,const char *compatible, +const char *prop,u32 val,int create) +{ + val =cpu_to_fdt32 (val); +do_fixup_by_compatible (fdt, compatible, prop, &val,4 , create); +} + +void do_fixup_by_compatible_string (struct fdt_header *fdt,const char *compatible, +const char *prop,const char *val,int create) +{ +do_fixup_by_compatible (fdt, compatible, prop, val,strlen (val) +1 , + create); +} +int fdt_get_path_or_create (struct fdt_header *fdt,const char *path) {int nodeoffset;
include/of.h +6 -0
@@ -17,6 +17,12 @@ void do_fixup_by_path(struct fdt_header *fdt, const char *path, const char *prop const void *val, int len, int create);void do_fixup_by_path_u32 (struct fdt_header *fdt,const char *path,const char *prop,u32 val,int create); +void do_fixup_by_compatible (struct fdt_header *fdt,const char *compatible, +const char *prop,const void *val,int len,int create); +void do_fixup_by_compatible_u32 (struct fdt_header *fdt,const char *compatible, +const char *prop,u32 val,int create); +void do_fixup_by_compatible_string (struct fdt_header *fdt,const char *compatible, +const char *prop,const char *val,int create);int fdt_get_path_or_create (struct fdt_header *fdt,const char *path);#ifdef CONFIG_FDT int fdt_initrd (void *fdt,ulong initrd_start,ulong initrd_end,int force);
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/oftree.c | 27 +++++++++++++++++++++++++++ include/of.h | 6 ++++++ 2 files changed, 33 insertions(+)common/oftree.c +2
-0@@ -229,6 +229,33 @@ void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path,do_fixup_by_path (fdt, path, prop, &val,sizeof (val), create); } +void do_fixup_by_compatible (struct fdt_header *fdt,const char *compatible, +const char *prop,const void *val,int len,int create)
common/oftree.c void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path, · line 243
Quoted 10 lines
common/oftree.c +10
-0+{ +int off =-1 ; + + off =fdt_node_offset_by_compatible (fdt,-1 , compatible); +while (off != -FDT_ERR_NOTFOUND ) { +if (create || (fdt_get_property (fdt, off, prop,0 ) !=NULL )) +fdt_setprop (fdt, off, prop, val, len); + off =fdt_node_offset_by_compatible (fdt, off, compatible); + } +}
IMO we shouldn't increase the dependency on libfdt. The fdt format is a nice storage format, but it sucks for modifying the tree.
I created some patches to get rid of libfdt entirely yesterday. They are not complete yet, but removing libfdt has some nice effects:
- Smaller binaries
- No more parallel universes of fdt and internal trees. This currently makes the devicetree code messy
- I trimmed down the overhead of unflattening/flattening significantly. It still adds some overhead to do it, but manipulating the tree is a factor of 50 faster which means once you have multiple manipulations of the tree it reduces the overhead to a net win.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 33 lines · Sascha Hauer
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/oftree.c | 27 +++++++++++++++++++++++++++ include/of.h | 6 ++++++ 2 files changed, 33 insertions(+)common/oftree.c +2
-0@@ -229,6 +229,33 @@ void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path,do_fixup_by_path (fdt, path, prop, &val,sizeof (val), create); } +void do_fixup_by_compatible (struct fdt_header *fdt,const char *compatible, +const char *prop,const void *val,int len,int create)common/oftree.c void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path, · line 243
Quoted 10 lines
common/oftree.c +10
-0+{ +int off =-1 ; + + off =fdt_node_offset_by_compatible (fdt,-1 , compatible); +while (off != -FDT_ERR_NOTFOUND ) { +if (create || (fdt_get_property (fdt, off, prop,0 ) !=NULL )) +fdt_setprop (fdt, off, prop, val, len); + off =fdt_node_offset_by_compatible (fdt, off, compatible); + } +}IMO we shouldn't increase the dependency on libfdt. The fdt format is a nice storage format, but it sucks for modifying the tree.
I created some patches to get rid of libfdt entirely yesterday. They are not complete yet, but removing libfdt has some nice effects:
Quoted 7 lines
- Smaller binaries
- No more parallel universes of fdt and internal trees. This currently makes the devicetree code messy
- I trimmed down the overhead of unflattening/flattening significantly. It still adds some overhead to do it, but manipulating the tree is a factor of 50 faster which means once you have multiple manipulations of the tree it reduces the overhead to a net win.
ok will this be availlable for next release ok ohterwise can we have this patch first so we can have the fixuo support for highbank
Best Regards,
J.
Quoted 8 lines
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 41 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 33 lines · Sascha Hauer
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- common/oftree.c | 27 +++++++++++++++++++++++++++ include/of.h | 6 ++++++ 2 files changed, 33 insertions(+)common/oftree.c +2
-0@@ -229,6 +229,33 @@ void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path,do_fixup_by_path (fdt, path, prop, &val,sizeof (val), create); } +void do_fixup_by_compatible (struct fdt_header *fdt,const char *compatible, +const char *prop,const void *val,int len,int create)common/oftree.c void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path, · line 243
Quoted 10 lines
common/oftree.c +10
-0+{ +int off =-1 ; + + off =fdt_node_offset_by_compatible (fdt,-1 , compatible); +while (off != -FDT_ERR_NOTFOUND ) { +if (create || (fdt_get_property (fdt, off, prop,0 ) !=NULL )) +fdt_setprop (fdt, off, prop, val, len); + off =fdt_node_offset_by_compatible (fdt, off, compatible); + } +}IMO we shouldn't increase the dependency on libfdt. The fdt format is a nice storage format, but it sucks for modifying the tree.
I created some patches to get rid of libfdt entirely yesterday. They are not complete yet, but removing libfdt has some nice effects:Quoted 7 lines
- Smaller binaries
- No more parallel universes of fdt and internal trees. This currently makes the devicetree code messy
- I trimmed down the overhead of unflattening/flattening significantly. It still adds some overhead to do it, but manipulating the tree is a factor of 50 faster which means once you have multiple manipulations of the tree it reduces the overhead to a net win.
Quoted 2 lines
ok will this be availlable for next release ok ohterwise can we have this patch first so we can have the fixuo support for highbank
I applied this one and the highbank patches using it. I have to rework My devicetree series anyway, so it will be too late to merge this to -next before the march release.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox