2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-02-26 22:59:18 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Google, Inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2018-10-11 05:06:57 +00:00
|
|
|
#include <dm/ofnode.h>
|
2017-06-22 07:50:01 +00:00
|
|
|
#include <dm/util.h>
|
2018-03-04 16:20:11 +00:00
|
|
|
#include <linux/libfdt.h>
|
2014-02-26 22:59:18 +00:00
|
|
|
#include <vsprintf.h>
|
|
|
|
|
2017-06-22 07:50:01 +00:00
|
|
|
#ifdef CONFIG_DM_WARN
|
2014-02-26 22:59:18 +00:00
|
|
|
void dm_warn(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
|
|
|
vprintf(fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
}
|
2017-06-22 07:50:01 +00:00
|
|
|
#endif
|
2014-02-26 22:59:18 +00: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-18 18:46:21 +00:00
|
|
|
|
2018-10-11 05:06:57 +00:00
|
|
|
bool dm_ofnode_pre_reloc(ofnode node)
|
|
|
|
{
|
2019-02-11 11:49:57 +00: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 05:06:57 +00:00
|
|
|
if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
|
|
|
|
return true;
|
2019-05-21 17:19:12 +00:00
|
|
|
if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
|
|
|
|
return true;
|
2018-10-11 05:06:57 +00: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 11:49:57 +00:00
|
|
|
#endif
|
2018-10-11 05:06:57 +00:00
|
|
|
}
|