diff options
author | Simon Glass <sjg@chromium.org> | 2017-08-29 14:15:59 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-09-15 05:27:48 -0600 |
commit | 634eba4be060af3bcba51cba2d57d217df897f31 (patch) | |
tree | ca9f0aa6f2c6a5dcedfba1092455a718def852fd /tools/dtoc/test_dtoc.py | |
parent | bc79617fdfeb4afabb94774885447dd64d7bea6c (diff) |
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 <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'tools/dtoc/test_dtoc.py')
-rw-r--r-- | tools/dtoc/test_dtoc.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index fbae927cf8..cc009b2a25 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -228,7 +228,7 @@ U_BOOT_DEVICE(pmic_at_9) = { self.assertEqual('''#include <stdbool.h> #include <libfdt.h> struct dtd_source { -\tstruct phandle_1_arg clocks[1]; +\tstruct phandle_2_arg clocks[4]; }; struct dtd_target { \tfdt32_t\t\tintval; @@ -243,7 +243,7 @@ struct dtd_target { #include <dt-structs.h> static struct dtd_target dtv_phandle_target = { -\t.intval\t\t\t= 0x1, +\t.intval\t\t\t= 0x0, }; U_BOOT_DEVICE(phandle_target) = { \t.name\t\t= "target", @@ -251,9 +251,30 @@ U_BOOT_DEVICE(phandle_target) = { \t.platdata_size\t= sizeof(dtv_phandle_target), }; +static struct dtd_target dtv_phandle2_target = { +\t.intval\t\t\t= 0x1, +}; +U_BOOT_DEVICE(phandle2_target) = { +\t.name\t\t= "target", +\t.platdata\t= &dtv_phandle2_target, +\t.platdata_size\t= sizeof(dtv_phandle2_target), +}; + +static struct dtd_target dtv_phandle3_target = { +\t.intval\t\t\t= 0x2, +}; +U_BOOT_DEVICE(phandle3_target) = { +\t.name\t\t= "target", +\t.platdata\t= &dtv_phandle3_target, +\t.platdata_size\t= sizeof(dtv_phandle3_target), +}; + static struct dtd_source dtv_phandle_source = { \t.clocks\t\t\t= { -\t\t{&dtv_phandle_target, {1}},}, +\t\t\t{&dtv_phandle_target, {}}, +\t\t\t{&dtv_phandle2_target, {11}}, +\t\t\t{&dtv_phandle3_target, {12, 13}}, +\t\t\t{&dtv_phandle_target, {}},}, }; U_BOOT_DEVICE(phandle_source) = { \t.name\t\t= "source", |