Commit 0d15463c0537806f70ea2359e32e4deb8c4766c2

Authored by Simon Glass
1 parent 8fed2eb20c

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 <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

Showing 6 changed files with 13 additions and 7 deletions Side-by-side Diff

doc/driver-model/of-plat.txt
... ... @@ -111,7 +111,7 @@
111 111 bool cap_sd_highspeed;
112 112 fdt32_t card_detect_delay;
113 113 fdt32_t clock_freq_min_max[2];
114   - struct phandle_2_cell clocks[4];
  114 + struct phandle_1_arg clocks[4];
115 115 bool disable_wp;
116 116 fdt32_t fifo_depth;
117 117 fdt32_t interrupts[3];
drivers/clk/clk-uclass.c
... ... @@ -23,7 +23,7 @@
23 23 #if CONFIG_IS_ENABLED(OF_CONTROL)
24 24 # if CONFIG_IS_ENABLED(OF_PLATDATA)
25 25 int clk_get_by_index_platdata(struct udevice *dev, int index,
26   - struct phandle_2_cell *cells, struct clk *clk)
  26 + struct phandle_1_arg *cells, struct clk *clk)
27 27 {
28 28 int ret;
29 29  
... ... @@ -61,9 +61,9 @@
61 61 };
62 62  
63 63 #if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
64   -struct phandle_2_cell;
  64 +struct phandle_1_arg;
65 65 int clk_get_by_index_platdata(struct udevice *dev, int index,
66   - struct phandle_2_cell *cells, struct clk *clk);
  66 + struct phandle_1_arg *cells, struct clk *clk);
67 67  
68 68 /**
69 69 * clock_get_by_index - Get/request a clock by integer index.
include/dt-structs.h
... ... @@ -9,7 +9,12 @@
9 9  
10 10 /* These structures may only be used in SPL */
11 11 #if CONFIG_IS_ENABLED(OF_PLATDATA)
12   -struct phandle_2_cell {
  12 +struct phandle_0_arg {
  13 + const void *node;
  14 + int id[0];
  15 +};
  16 +
  17 +struct phandle_1_arg {
13 18 const void *node;
14 19 int id;
15 20 };
tools/dtoc/dtb_platdata.py
... ... @@ -419,7 +419,8 @@
419 419 info = self.get_phandle_argc(prop, structs[name])
420 420 if info:
421 421 # For phandles, include a reference to the target
422   - self.out('\t%s%s[%d]' % (tab_to(2, 'struct phandle_2_cell'),
  422 + struct_name = 'struct phandle_%d_arg' % info.max_args
  423 + self.out('\t%s%s[%d]' % (tab_to(2, struct_name),
423 424 conv_name_to_c(prop.name),
424 425 len(prop.value) / 2))
425 426 else:
tools/dtoc/test_dtoc.py
... ... @@ -228,7 +228,7 @@
228 228 self.assertEqual('''#include <stdbool.h>
229 229 #include <libfdt.h>
230 230 struct dtd_source {
231   -\tstruct phandle_2_cell clocks[1];
  231 +\tstruct phandle_1_arg clocks[1];
232 232 };
233 233 struct dtd_target {
234 234 \tfdt32_t\t\tintval;