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.
12 #include <linux/libfdt.h>
16 #include "fdt_support.h"
21 int fdtdec_get_int(const void *blob, int node, const char *prop_name,
27 debug("%s: %s: ", __func__, prop_name);
28 cell = fdt_getprop(blob, node, prop_name, &len);
29 if (cell && len >= sizeof(int)) {
30 int val = fdt32_to_cpu(cell[0]);
32 debug("%#x (%d)\n", val, val);
35 debug("(not found)\n");
39 unsigned int fdtdec_get_uint(const void *blob, int node, const char *prop_name,
40 unsigned int default_val)
45 debug("%s: %s: ", __func__, prop_name);
46 cell = fdt_getprop(blob, node, prop_name, &len);
47 if (cell && len >= sizeof(unsigned int)) {
48 unsigned int val = fdt32_to_cpu(cell[0]);
50 debug("%#x (%d)\n", val, val);
53 debug("(not found)\n");