From 0d15463c0537806f70ea2359e32e4deb8c4766c2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 29 Aug 2017 14:15:56 -0600 Subject: dtoc: Rename the phandle struct Rather than naming the phandle struct according to the number of cells it uses (e.g. struct phandle_2_cell) name it according to the number of arguments it has (e.g. struct phandle_1_arg). This is a more intuitive naming. Signed-off-by: Simon Glass Tested-by: Kever Yang --- include/dt-structs.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/dt-structs.h') diff --git a/include/dt-structs.h b/include/dt-structs.h index 0732c442ff8..2ed997115ae 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -9,7 +9,12 @@ /* These structures may only be used in SPL */ #if CONFIG_IS_ENABLED(OF_PLATDATA) -struct phandle_2_cell { +struct phandle_0_arg { + const void *node; + int id[0]; +}; + +struct phandle_1_arg { const void *node; int id; }; -- cgit v1.2.3 From bc79617fdfeb4afabb94774885447dd64d7bea6c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 29 Aug 2017 14:15:58 -0600 Subject: dtoc: Put phandle args in an array We want to support more than one phandle argument. It makes sense to use an array for this rather than discrete struct members. Adjust the code to support this. Rename the member to 'arg' instead of 'id'. Signed-off-by: Simon Glass Tested-by: Kever Yang --- include/dt-structs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/dt-structs.h') diff --git a/include/dt-structs.h b/include/dt-structs.h index 2ed997115ae..9ab4e2524d1 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -11,12 +11,12 @@ #if CONFIG_IS_ENABLED(OF_PLATDATA) struct phandle_0_arg { const void *node; - int id[0]; + int arg[0]; }; struct phandle_1_arg { const void *node; - int id; + int arg[1]; }; #include #endif -- cgit v1.2.3 From 634eba4be060af3bcba51cba2d57d217df897f31 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 29 Aug 2017 14:15:59 -0600 Subject: dtoc: Support properties containing multiple phandle values At present dtoc has a very simplistic view of phandles. It assumes that a property has only a single phandle with a single argument (i.e. two cells per property). This is not true in many cases. Enhance the implementation to scan all phandles in a property and to use the correct number of arguments (which can be 0, 1, 2 or more) when generating the C code. For the struct definitions, use a struct which can hold the maximum number of arguments used by the property. Signed-off-by: Simon Glass Tested-by: Kever Yang --- include/dt-structs.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/dt-structs.h') diff --git a/include/dt-structs.h b/include/dt-structs.h index 9ab4e2524d1..76979e73e17 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -18,6 +18,11 @@ struct phandle_1_arg { const void *node; int arg[1]; }; + +struct phandle_2_arg { + const void *node; + int arg[2]; +}; #include #endif -- cgit v1.2.3 From b145b45b0ce26028d9ad6ea8277c052c3c87ea56 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 29 Aug 2017 14:16:00 -0600 Subject: dtoc: Rename the auto-generated dt-structs.h file The filename of the auto-generated file is the same as the file that includes it. Even though the form is in the generated/ subdirectory, this could be confused. Rename the generated file to something that makes it clear it is auto-generated. Signed-off-by: Simon Glass Tested-by: Kever Yang --- include/dt-structs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/dt-structs.h') diff --git a/include/dt-structs.h b/include/dt-structs.h index 76979e73e17..c0f56951b53 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -23,7 +23,7 @@ struct phandle_2_arg { const void *node; int arg[2]; }; -#include +#include #endif #endif -- cgit v1.2.3