mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-08 08:16:59 +02:00
fdt: Drop ifdefs in fdtdec_prepare_fdt()
This function is a bit messy with several #ifdefs. Convert them to use C for the conditions. Rewrite the function comment since most of it is stale. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
c662d0b722
commit
b62d34937a
32
lib/fdtdec.c
32
lib/fdtdec.c
@ -13,6 +13,7 @@
|
|||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
|
#include <spl.h>
|
||||||
#include <env.h>
|
#include <env.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fdtdec.h>
|
#include <fdtdec.h>
|
||||||
@ -586,30 +587,31 @@ int fdtdec_get_chosen_node(const void *blob, const char *name)
|
|||||||
return fdt_path_offset(blob, prop);
|
return fdt_path_offset(blob, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This function is a little odd in that it accesses global data. At some
|
* fdtdec_prepare_fdt() - Check we have a valid fdt available to control U-Boot
|
||||||
* point if the architecture board.c files merge this will make more sense.
|
*
|
||||||
* Even now, it is common code.
|
* If not, a message is printed to the console if the console is ready.
|
||||||
|
*
|
||||||
|
* Return: 0 if all ok, -ENOENT if not
|
||||||
*/
|
*/
|
||||||
static int fdtdec_prepare_fdt(void)
|
static int fdtdec_prepare_fdt(void)
|
||||||
{
|
{
|
||||||
if (!gd->fdt_blob || ((uintptr_t)gd->fdt_blob & 3) ||
|
if (!gd->fdt_blob || ((uintptr_t)gd->fdt_blob & 3) ||
|
||||||
fdt_check_header(gd->fdt_blob)) {
|
fdt_check_header(gd->fdt_blob)) {
|
||||||
#ifdef CONFIG_SPL_BUILD
|
if (spl_phase() <= PHASE_SPL) {
|
||||||
puts("Missing DTB\n");
|
puts("Missing DTB\n");
|
||||||
#else
|
} else {
|
||||||
printf("No valid device tree binary found at %p\n",
|
printf("No valid device tree binary found at %p\n",
|
||||||
gd->fdt_blob);
|
gd->fdt_blob);
|
||||||
# ifdef DEBUG
|
if (_DEBUG && gd->fdt_blob) {
|
||||||
if (gd->fdt_blob) {
|
printf("fdt_blob=%p\n", gd->fdt_blob);
|
||||||
printf("fdt_blob=%p\n", gd->fdt_blob);
|
|
||||||
print_buffer((ulong)gd->fdt_blob, gd->fdt_blob, 4,
|
print_buffer((ulong)gd->fdt_blob, gd->fdt_blob, 4,
|
||||||
32, 0);
|
32, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# endif
|
return -ENOENT;
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user