]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/core/util.c
pico-imx6ul: Use FS_GENERIC load command
[people/ms/u-boot.git] / drivers / core / util.c
CommitLineData
6494d708
SG
1/*
2 * Copyright (c) 2013 Google, Inc
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
766c28a5 8#include <dm/util.h>
27326c7e 9#include <libfdt.h>
6494d708
SG
10#include <vsprintf.h>
11
766c28a5 12#ifdef CONFIG_DM_WARN
6494d708
SG
13void dm_warn(const char *fmt, ...)
14{
15 va_list args;
16
17 va_start(args, fmt);
18 vprintf(fmt, args);
19 va_end(args);
20}
766c28a5 21#endif
6494d708 22
6494d708
SG
23int list_count_items(struct list_head *head)
24{
25 struct list_head *node;
26 int count = 0;
27
28 list_for_each(node, head)
29 count++;
30
31 return count;
32}
27326c7e 33
d905cf73 34bool dm_fdt_pre_reloc(const void *blob, int offset)
27326c7e
HS
35{
36 if (fdt_getprop(blob, offset, "u-boot,dm-pre-reloc", NULL))
d905cf73 37 return true;
27326c7e
HS
38
39#ifdef CONFIG_TPL_BUILD
40 if (fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
d905cf73 41 return true;
27326c7e
HS
42#elif defined(CONFIG_SPL_BUILD)
43 if (fdt_getprop(blob, offset, "u-boot,dm-spl", NULL))
d905cf73 44 return true;
27326c7e
HS
45#else
46 /*
47 * In regular builds individual spl and tpl handling both
48 * count as handled pre-relocation for later second init.
49 */
50 if (fdt_getprop(blob, offset, "u-boot,dm-spl", NULL) ||
51 fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
d905cf73 52 return true;
27326c7e
HS
53#endif
54
d905cf73 55 return false;
27326c7e 56}