mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
dm: core: Inline a few ofnode functions in SPL
A recent change to unify the flattree/livetree code introduced a small
size increase in SPL on some boards. For example SPL code size for
px30-core-ctouch2-px30 increased by 40 bytes.
To address this we can take advantage of the fact that some of the ofnode
functions are only called a few times in SPL, so it is worth inlining
them.
Add new Kconfig options to control this. These functions are not inlined
for U-Boot proper, since this increases code size.
Fixes: 2ebea5eaeb
("dm: core: Combine the flattree and livetree binding code")
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -113,6 +113,22 @@ config SPL_DM_SEQ_ALIAS
|
|||||||
numbered devices (e.g. serial0 = &serial0). This feature can be
|
numbered devices (e.g. serial0 = &serial0). This feature can be
|
||||||
disabled if it is not required, to save code space in SPL.
|
disabled if it is not required, to save code space in SPL.
|
||||||
|
|
||||||
|
config SPL_DM_INLINE_OFNODE
|
||||||
|
bool "Inline some ofnode functions which are seldom used in SPL"
|
||||||
|
depends on SPL_DM
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
This applies to several ofnode functions (see ofnode.h) which are
|
||||||
|
seldom used. Inlining them can help reduce code size.
|
||||||
|
|
||||||
|
config TPL_DM_INLINE_OFNODE
|
||||||
|
bool "Inline some ofnode functions which are seldom used in TPL"
|
||||||
|
depends on TPL_DM
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
This applies to several ofnode functions (see ofnode.h) which are
|
||||||
|
seldom used. Inlining them can help reduce code size.
|
||||||
|
|
||||||
config REGMAP
|
config REGMAP
|
||||||
bool "Support register maps"
|
bool "Support register maps"
|
||||||
depends on DM
|
depends on DM
|
||||||
|
@@ -226,6 +226,7 @@ int ofnode_read_u32_array(ofnode node, const char *propname,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !CONFIG_IS_ENABLED(DM_INLINE_OFNODE)
|
||||||
bool ofnode_is_enabled(ofnode node)
|
bool ofnode_is_enabled(ofnode node)
|
||||||
{
|
{
|
||||||
if (ofnode_is_np(node)) {
|
if (ofnode_is_np(node)) {
|
||||||
@@ -255,6 +256,7 @@ ofnode ofnode_next_subnode(ofnode node)
|
|||||||
return offset_to_ofnode(
|
return offset_to_ofnode(
|
||||||
fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node)));
|
fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node)));
|
||||||
}
|
}
|
||||||
|
#endif /* !DM_INLINE_OFNODE */
|
||||||
|
|
||||||
ofnode ofnode_get_parent(ofnode node)
|
ofnode ofnode_get_parent(ofnode node)
|
||||||
{
|
{
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
/* TODO(sjg@chromium.org): Drop fdtdec.h include */
|
/* TODO(sjg@chromium.org): Drop fdtdec.h include */
|
||||||
#include <fdtdec.h>
|
#include <fdtdec.h>
|
||||||
#include <dm/of.h>
|
#include <dm/of.h>
|
||||||
|
#include <dm/of_access.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
|
|
||||||
/* Enable checks to protect against invalid calls */
|
/* Enable checks to protect against invalid calls */
|
||||||
@@ -357,17 +358,6 @@ const char *ofnode_read_string(ofnode node, const char *propname);
|
|||||||
*/
|
*/
|
||||||
int ofnode_read_u32_array(ofnode node, const char *propname,
|
int ofnode_read_u32_array(ofnode node, const char *propname,
|
||||||
u32 *out_values, size_t sz);
|
u32 *out_values, size_t sz);
|
||||||
/**
|
|
||||||
* ofnode_is_enabled() - Checks whether a node is enabled.
|
|
||||||
* This looks for a 'status' property. If this exists, then returns true if
|
|
||||||
* the status is 'okay' and false otherwise. If there is no status property,
|
|
||||||
* it returns true on the assumption that anything mentioned should be enabled
|
|
||||||
* by default.
|
|
||||||
*
|
|
||||||
* @node: node to examine
|
|
||||||
* @return false (not enabled) or true (enabled)
|
|
||||||
*/
|
|
||||||
bool ofnode_is_enabled(ofnode node);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ofnode_read_bool() - read a boolean value from a property
|
* ofnode_read_bool() - read a boolean value from a property
|
||||||
@@ -388,6 +378,49 @@ bool ofnode_read_bool(ofnode node, const char *propname);
|
|||||||
*/
|
*/
|
||||||
ofnode ofnode_find_subnode(ofnode node, const char *subnode_name);
|
ofnode ofnode_find_subnode(ofnode node, const char *subnode_name);
|
||||||
|
|
||||||
|
#if CONFIG_IS_ENABLED(DM_INLINE_OFNODE)
|
||||||
|
static inline bool ofnode_is_enabled(ofnode node)
|
||||||
|
{
|
||||||
|
if (ofnode_is_np(node)) {
|
||||||
|
return of_device_is_available(ofnode_to_np(node));
|
||||||
|
} else {
|
||||||
|
return fdtdec_get_is_enabled(gd->fdt_blob,
|
||||||
|
ofnode_to_offset(node));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ofnode ofnode_first_subnode(ofnode node)
|
||||||
|
{
|
||||||
|
assert(ofnode_valid(node));
|
||||||
|
if (ofnode_is_np(node))
|
||||||
|
return np_to_ofnode(node.np->child);
|
||||||
|
|
||||||
|
return offset_to_ofnode(
|
||||||
|
fdt_first_subnode(gd->fdt_blob, ofnode_to_offset(node)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ofnode ofnode_next_subnode(ofnode node)
|
||||||
|
{
|
||||||
|
assert(ofnode_valid(node));
|
||||||
|
if (ofnode_is_np(node))
|
||||||
|
return np_to_ofnode(node.np->sibling);
|
||||||
|
|
||||||
|
return offset_to_ofnode(
|
||||||
|
fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node)));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/**
|
||||||
|
* ofnode_is_enabled() - Checks whether a node is enabled.
|
||||||
|
* This looks for a 'status' property. If this exists, then returns true if
|
||||||
|
* the status is 'okay' and false otherwise. If there is no status property,
|
||||||
|
* it returns true on the assumption that anything mentioned should be enabled
|
||||||
|
* by default.
|
||||||
|
*
|
||||||
|
* @node: node to examine
|
||||||
|
* @return false (not enabled) or true (enabled)
|
||||||
|
*/
|
||||||
|
bool ofnode_is_enabled(ofnode node);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ofnode_first_subnode() - find the first subnode of a parent node
|
* ofnode_first_subnode() - find the first subnode of a parent node
|
||||||
*
|
*
|
||||||
@@ -405,6 +438,7 @@ ofnode ofnode_first_subnode(ofnode node);
|
|||||||
* has no more siblings)
|
* has no more siblings)
|
||||||
*/
|
*/
|
||||||
ofnode ofnode_next_subnode(ofnode node);
|
ofnode ofnode_next_subnode(ofnode node);
|
||||||
|
#endif /* DM_INLINE_OFNODE */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ofnode_get_parent() - get the ofnode's parent (enclosing ofnode)
|
* ofnode_get_parent() - get the ofnode's parent (enclosing ofnode)
|
||||||
|
Reference in New Issue
Block a user