1 // SPDX-License-Identifier: GPL-2.0+
4 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
6 * Based on lib/fdtdec.c:
7 * Copyright (c) 2011 The Chromium OS Authors.
13 #include <linux/libfdt.h>
17 #include "fdt_support.h"
22 int fdtdec_get_int(const void *blob, int node, const char *prop_name,
28 debug("%s: %s: ", __func__, prop_name);
29 cell = fdt_getprop(blob, node, prop_name, &len);
30 if (cell && len >= sizeof(int)) {
31 int val = fdt32_to_cpu(cell[0]);
33 debug("%#x (%d)\n", val, val);
36 debug("(not found)\n");
40 unsigned int fdtdec_get_uint(const void *blob, int node, const char *prop_name,
41 unsigned int default_val)
46 debug("%s: %s: ", __func__, prop_name);
47 cell = fdt_getprop(blob, node, prop_name, &len);
48 if (cell && len >= sizeof(unsigned int)) {
49 unsigned int val = fdt32_to_cpu(cell[0]);
51 debug("%#x (%d)\n", val, val);
54 debug("(not found)\n");
58 int fdtdec_get_child_count(const void *blob, int node)
63 fdt_for_each_subnode(subnode, blob, node)