2 * Copyright (C) 2016 Google, Inc
5 * SPDX-License-Identifier: GPL-2.0+
14 ulong fdt_getprop_u32(const void *fdt, int node, const char *prop)
19 cell = fdt_getprop(fdt, node, prop, &len);
20 if (!cell || len != sizeof(*cell))
23 return fdt32_to_cpu(*cell);
27 * Iterate over all /configurations subnodes and call a platform specific
28 * function to find the matching configuration.
29 * Returns the node offset or a negative error number.
31 int fit_find_config_node(const void *fdt)
35 const char *dflt_conf_name;
36 const char *dflt_conf_desc = NULL;
37 int dflt_conf_node = -ENOENT;
39 conf = fdt_path_offset(fdt, FIT_CONFS_PATH);
41 debug("%s: Cannot find /configurations node: %d\n", __func__,
46 dflt_conf_name = fdt_getprop(fdt, conf, "default", &len);
48 for (node = fdt_first_subnode(fdt, conf);
50 node = fdt_next_subnode(fdt, node)) {
51 name = fdt_getprop(fdt, node, "description", &len);
53 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
54 printf("%s: Missing FDT description in DTB\n",
61 const char *node_name = fdt_get_name(fdt, node, NULL);
62 if (strcmp(dflt_conf_name, node_name) == 0) {
63 dflt_conf_node = node;
64 dflt_conf_desc = name;
68 if (board_fit_config_name_match(name))
71 debug("Selecting config '%s'", name);
76 if (dflt_conf_node != -ENOENT) {
77 debug("Selecting default config '%s'", dflt_conf_desc);
78 return dflt_conf_node;