Commit 1cb2323b8a457f00f50a76a3491d7f21a3c0929f
Committed by
Anatolij Gustschin
1 parent
1bbd28d215
Exists in
master
and in
54 other branches
fdt: Tidy debugging, add to fdtdec_get_int/addr()
The new debugging shows the value of integers and addresses read from the device tree and tidy up GPIO output. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 1 changed file with 19 additions and 8 deletions Side-by-side Diff
lib/fdtdec.c
... | ... | @@ -79,11 +79,16 @@ |
79 | 79 | const fdt_addr_t *cell; |
80 | 80 | int len; |
81 | 81 | |
82 | - debug("get_addr: %s\n", prop_name); | |
82 | + debug("%s: %s: ", __func__, prop_name); | |
83 | 83 | cell = fdt_getprop(blob, node, prop_name, &len); |
84 | 84 | if (cell && (len == sizeof(fdt_addr_t) || |
85 | - len == sizeof(fdt_addr_t) * 2)) | |
86 | - return fdt_addr_to_cpu(*cell); | |
85 | + len == sizeof(fdt_addr_t) * 2)) { | |
86 | + fdt_addr_t addr = fdt_addr_to_cpu(*cell); | |
87 | + | |
88 | + debug("%p\n", (void *)addr); | |
89 | + return addr; | |
90 | + } | |
91 | + debug("(not found)\n"); | |
87 | 92 | return FDT_ADDR_T_NONE; |
88 | 93 | } |
89 | 94 | |
90 | 95 | |
... | ... | @@ -93,10 +98,15 @@ |
93 | 98 | const s32 *cell; |
94 | 99 | int len; |
95 | 100 | |
96 | - debug("get_size: %s\n", prop_name); | |
101 | + debug("%s: %s: ", __func__, prop_name); | |
97 | 102 | cell = fdt_getprop(blob, node, prop_name, &len); |
98 | - if (cell && len >= sizeof(s32)) | |
99 | - return fdt32_to_cpu(cell[0]); | |
103 | + if (cell && len >= sizeof(s32)) { | |
104 | + s32 val = fdt32_to_cpu(cell[0]); | |
105 | + | |
106 | + debug("%#x (%d)\n", val, val); | |
107 | + return val; | |
108 | + } | |
109 | + debug("(not found)\n"); | |
100 | 110 | return default_val; |
101 | 111 | } |
102 | 112 | |
... | ... | @@ -328,6 +338,7 @@ |
328 | 338 | const u32 *phandle; |
329 | 339 | int lookup; |
330 | 340 | |
341 | + debug("%s: %s\n", __func__, prop_name); | |
331 | 342 | phandle = fdt_getprop(blob, node, prop_name, NULL); |
332 | 343 | if (!phandle) |
333 | 344 | return -FDT_ERR_NOTFOUND; |
... | ... | @@ -427,7 +438,7 @@ |
427 | 438 | assert(max_count > 0); |
428 | 439 | prop = fdt_get_property(blob, node, prop_name, &len); |
429 | 440 | if (!prop) { |
430 | - debug("FDT: %s: property '%s' missing\n", __func__, prop_name); | |
441 | + debug("%s: property '%s' missing\n", __func__, prop_name); | |
431 | 442 | return -FDT_ERR_NOTFOUND; |
432 | 443 | } |
433 | 444 | |
... | ... | @@ -436,7 +447,7 @@ |
436 | 447 | cell = (u32 *)prop->data; |
437 | 448 | len /= sizeof(u32) * 3; /* 3 cells per GPIO record */ |
438 | 449 | if (len > max_count) { |
439 | - debug("FDT: %s: too many GPIOs / cells for " | |
450 | + debug(" %s: too many GPIOs / cells for " | |
440 | 451 | "property '%s'\n", __func__, prop_name); |
441 | 452 | return -FDT_ERR_BADLAYOUT; |
442 | 453 | } |