upstream u-boot with additional patches for our devices/boards: https://lists.denx.de/pipermail/u-boot/2017-March/282789.html (AXP crashes) ; Gbit ethernet patch for some LIME2 revisions ; with SPI flash support
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
u-boot/common/common_fit.c

62 lines
1.3 KiB

/*
* Copyright (C) 2016 Google, Inc
* Written by Simon Glass <sjg@chromium.org>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <errno.h>
#include <image.h>
#include <libfdt.h>
#include <spl.h>
ulong fdt_getprop_u32(const void *fdt, int node, const char *prop)
{
const u32 *cell;
int len;
cell = fdt_getprop(fdt, node, prop, &len);
if (!cell || len != sizeof(*cell))
return FDT_ERROR;
return fdt32_to_cpu(*cell);
}
/*
* Iterate over all /configurations subnodes and call a platform specific
* function to find the matching configuration.
* Returns the node offset or a negative error number.
*/
int fit_find_config_node(const void *fdt)
{
const char *name;
int conf, node, len;
conf = fdt_path_offset(fdt, FIT_CONFS_PATH);
if (conf < 0) {
debug("%s: Cannot find /configurations node: %d\n", __func__,
conf);
return -EINVAL;
}
for (node = fdt_first_subnode(fdt, conf);
node >= 0;
node = fdt_next_subnode(fdt, node)) {
name = fdt_getprop(fdt, node, "description", &len);
if (!name) {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("%s: Missing FDT description in DTB\n",
__func__);
#endif
return -EINVAL;
}
if (board_fit_config_name_match(name))
continue;
debug("Selecting config '%s'", name);
return node;
}
return -ENOENT;
}