dtoc: Put phandle args in an array
authorSimon Glass <sjg@chromium.org>
Tue, 29 Aug 2017 20:15:58 +0000 (14:15 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 15 Sep 2017 11:27:48 +0000 (05:27 -0600)
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 <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
drivers/clk/clk-uclass.c
include/dt-structs.h
tools/dtoc/dtb_platdata.py
tools/dtoc/test_dtoc.py

index 8b40326efa2c60036f14473a9ea27ed4ed22f9b4..83ba13374c78a36acb25c45107c781df82a40925 100644 (file)
@@ -32,7 +32,7 @@ int clk_get_by_index_platdata(struct udevice *dev, int index,
        ret = uclass_get_device(UCLASS_CLK, 0, &clk->dev);
        if (ret)
                return ret;
-       clk->id = cells[0].id;
+       clk->id = cells[0].arg[0];
 
        return 0;
 }
index 2ed997115aee5e6e56a9fb4fbc0f0740bd27b5ca..9ab4e2524d1884342410557168647f1e2a937224 100644 (file)
 #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 <generated/dt-structs.h>
 #endif
index c0a3ae692bc5913689e351ba1a19ce76edcc6c9e..1920a59f821055f0cd5eccbe9ca01fed92fb458d 100644 (file)
@@ -467,7 +467,7 @@ class DtbPlatdata(object):
                         id_num = fdt_util.fdt32_to_cpu(id_cell)
                         target_node = self._fdt.phandle_to_node[phandle]
                         name = conv_name_to_c(target_node.name)
-                        vals.append('{&%s%s, %d}' % (VAL_PREFIX, name, id_num))
+                        vals.append('{&%s%s, {%d}}' % (VAL_PREFIX, name, id_num))
                     for val in vals:
                         self.buf('\n\t\t%s,' % val)
                 else:
index aa617a649c83ea2e6b0435d0c238e146db51e0b7..fbae927cf8fcb9e5a002113590848cfcb788bfd0 100644 (file)
@@ -253,7 +253,7 @@ U_BOOT_DEVICE(phandle_target) = {
 
 static struct dtd_source dtv_phandle_source = {
 \t.clocks\t\t\t= {
-\t\t{&dtv_phandle_target, 1},},
+\t\t{&dtv_phandle_target, {1}},},
 };
 U_BOOT_DEVICE(phandle_source) = {
 \t.name\t\t= "source",