2018-05-07 05:58:06 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-02-27 06:59:18 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Google, Inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2018-10-11 13:06:57 +08:00
|
|
|
#include <dm/ofnode.h>
|
2017-06-22 15:50:01 +08:00
|
|
|
#include <dm/util.h>
|
2018-03-05 00:20:11 +08:00
|
|
|
#include <linux/libfdt.h>
|
2014-02-27 06:59:18 +08:00
|
|
|
#include <vsprintf.h>
|
|
|
|
|
2017-06-22 15:50:01 +08:00
|
|
|
#ifdef CONFIG_DM_WARN
|
2014-02-27 06:59:18 +08:00
|
|
|
void dm_warn(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
|
|
|
vprintf(fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
}
|
2017-06-22 15:50:01 +08:00
|
|
|
#endif
|
2014-02-27 06:59:18 +08:00
|
|
|
|
|
|
|
int list_count_items(struct list_head *head)
|
|
|
|
{
|
|
|
|
struct list_head *node;
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
list_for_each(node, head)
|
|
|
|
count++;
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
2017-02-19 02:46:21 +08:00
|
|
|
|
2018-10-11 13:06:57 +08:00
|
|
|
bool dm_ofnode_pre_reloc(ofnode node)
|
|
|
|
{
|
2019-02-11 19:49:57 +08:00
|
|
|
#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD)
|
|
|
|
/* for SPL and TPL the remaining nodes after the fdtgrep 1st pass
|
|
|
|
* had property dm-pre-reloc or u-boot,dm-spl/tpl.
|
|
|
|
* They are removed in final dtb (fdtgrep 2nd pass)
|
|
|
|
*/
|
|
|
|
return true;
|
|
|
|
#else
|
2018-10-11 13:06:57 +08:00
|
|
|
if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
|
|
|
|
return true;
|
2019-05-22 01:19:12 +08:00
|
|
|
if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
|
|
|
|
return true;
|
2018-10-11 13:06:57 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* In regular builds individual spl and tpl handling both
|
|
|
|
* count as handled pre-relocation for later second init.
|
|
|
|
*/
|
|
|
|
if (ofnode_read_bool(node, "u-boot,dm-spl") ||
|
|
|
|
ofnode_read_bool(node, "u-boot,dm-tpl"))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
2019-02-11 19:49:57 +08:00
|
|
|
#endif
|
2018-10-11 13:06:57 +08:00
|
|
|
}
|