mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Merge tag 'dm-pull-10apr20-take2' of git://git.denx.de/u-boot-dm
Functions for reading indexed values from device tree Enhancements to 'dm' command Log test enhancements and syslog driver DM change to read parent ofdata before children Minor fixes
This commit is contained in:
@@ -80,18 +80,21 @@ struct driver_info;
|
||||
*/
|
||||
enum {
|
||||
/* Normal remove, remove all devices */
|
||||
DM_REMOVE_NORMAL = 1 << 0,
|
||||
DM_REMOVE_NORMAL = 1 << 0,
|
||||
|
||||
/* Remove devices with active DMA */
|
||||
DM_REMOVE_ACTIVE_DMA = DM_FLAG_ACTIVE_DMA,
|
||||
DM_REMOVE_ACTIVE_DMA = DM_FLAG_ACTIVE_DMA,
|
||||
|
||||
/* Remove devices which need some final OS preparation steps */
|
||||
DM_REMOVE_OS_PREPARE = DM_FLAG_OS_PREPARE,
|
||||
DM_REMOVE_OS_PREPARE = DM_FLAG_OS_PREPARE,
|
||||
|
||||
/* Add more use cases here */
|
||||
|
||||
/* Remove devices with any active flag */
|
||||
DM_REMOVE_ACTIVE_ALL = DM_REMOVE_ACTIVE_DMA | DM_REMOVE_OS_PREPARE,
|
||||
DM_REMOVE_ACTIVE_ALL = DM_REMOVE_ACTIVE_DMA | DM_REMOVE_OS_PREPARE,
|
||||
|
||||
/* Don't power down any attached power domains */
|
||||
DM_REMOVE_NO_PD = 1 << 1,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -234,6 +234,25 @@ struct device_node *of_find_node_by_phandle(phandle handle);
|
||||
*/
|
||||
int of_read_u32(const struct device_node *np, const char *propname, u32 *outp);
|
||||
|
||||
/**
|
||||
* of_read_u32_index() - Find and read a 32-bit value from a multi-value
|
||||
* property
|
||||
*
|
||||
* Search for a property in a device node and read a 32-bit value from
|
||||
* it.
|
||||
*
|
||||
* @np: device node from which the property value is to be read.
|
||||
* @propname: name of the property to be searched.
|
||||
* @index: index of the u32 in the list of values
|
||||
* @outp: pointer to return value, modified only if return value is 0.
|
||||
*
|
||||
* @return 0 on success, -EINVAL if the property does not exist,
|
||||
* -ENODATA if property does not have a value, and -EOVERFLOW if the
|
||||
* property data isn't large enough.
|
||||
*/
|
||||
int of_read_u32_index(const struct device_node *np, const char *propname,
|
||||
int index, u32 *outp);
|
||||
|
||||
/**
|
||||
* of_read_u64() - Find and read a 64-bit integer from a property
|
||||
*
|
||||
|
||||
@@ -202,6 +202,18 @@ static inline ofnode ofnode_null(void)
|
||||
*/
|
||||
int ofnode_read_u32(ofnode node, const char *propname, u32 *outp);
|
||||
|
||||
/**
|
||||
* ofnode_read_u32_index() - Read a 32-bit integer from a multi-value property
|
||||
*
|
||||
* @ref: valid node reference to read property from
|
||||
* @propname: name of the property to read from
|
||||
* @index: index of the integer to return
|
||||
* @outp: place to put value (if found)
|
||||
* @return 0 if OK, -ve on error
|
||||
*/
|
||||
int ofnode_read_u32_index(ofnode node, const char *propname, int index,
|
||||
u32 *outp);
|
||||
|
||||
/**
|
||||
* ofnode_read_s32() - Read a 32-bit integer from a property
|
||||
*
|
||||
@@ -226,6 +238,19 @@ static inline int ofnode_read_s32(ofnode node, const char *propname,
|
||||
*/
|
||||
u32 ofnode_read_u32_default(ofnode ref, const char *propname, u32 def);
|
||||
|
||||
/**
|
||||
* ofnode_read_u32_index_default() - Read a 32-bit integer from a multi-value
|
||||
* property
|
||||
*
|
||||
* @ref: valid node reference to read property from
|
||||
* @propname: name of the property to read from
|
||||
* @index: index of the integer to return
|
||||
* @def: default value to return if the property has no value
|
||||
* @return property value, or @def if not found
|
||||
*/
|
||||
u32 ofnode_read_u32_index_default(ofnode ref, const char *propname, int index,
|
||||
u32 def);
|
||||
|
||||
/**
|
||||
* ofnode_read_s32_default() - Read a 32-bit integer from a property
|
||||
*
|
||||
|
||||
@@ -66,6 +66,32 @@ int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp);
|
||||
int dev_read_u32_default(const struct udevice *dev, const char *propname,
|
||||
int def);
|
||||
|
||||
/**
|
||||
* dev_read_u32_index() - read an indexed 32-bit integer from a device's DT
|
||||
* property
|
||||
*
|
||||
* @dev: device to read DT property from
|
||||
* @propname: name of the property to read from
|
||||
* @index: index of the integer to return
|
||||
* @outp: place to put value (if found)
|
||||
* @return 0 if OK, -ve on error
|
||||
*/
|
||||
int dev_read_u32_index(struct udevice *dev, const char *propname, int index,
|
||||
u32 *outp);
|
||||
|
||||
/**
|
||||
* dev_read_u32_index_default() - read an indexed 32-bit integer from a device's
|
||||
* DT property
|
||||
*
|
||||
* @dev: device to read DT property from
|
||||
* @propname: name of the property to read from
|
||||
* @index: index of the integer to return
|
||||
* @def: default value to return if the property has no value
|
||||
* @return property value, or @def if not found
|
||||
*/
|
||||
u32 dev_read_u32_index_default(struct udevice *dev, const char *propname,
|
||||
int index, u32 def);
|
||||
|
||||
/**
|
||||
* dev_read_s32() - read a signed 32-bit integer from a device's DT property
|
||||
*
|
||||
@@ -621,6 +647,20 @@ static inline int dev_read_u32_default(const struct udevice *dev,
|
||||
return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
|
||||
}
|
||||
|
||||
static inline int dev_read_u32_index(struct udevice *dev,
|
||||
const char *propname, int index, u32 *outp)
|
||||
{
|
||||
return ofnode_read_u32_index(dev_ofnode(dev), propname, index, outp);
|
||||
}
|
||||
|
||||
static inline u32 dev_read_u32_index_default(struct udevice *dev,
|
||||
const char *propname, int index,
|
||||
u32 def)
|
||||
{
|
||||
return ofnode_read_u32_index_default(dev_ofnode(dev), propname, index,
|
||||
def);
|
||||
}
|
||||
|
||||
static inline int dev_read_s32(const struct udevice *dev,
|
||||
const char *propname, s32 *outp)
|
||||
{
|
||||
|
||||
@@ -42,31 +42,4 @@ static inline void dm_dump_devres(void)
|
||||
/* Dump out a list of drivers */
|
||||
void dm_dump_drivers(void);
|
||||
|
||||
/**
|
||||
* Check if an of node should be or was bound before relocation.
|
||||
*
|
||||
* Devicetree nodes can be marked as needed to be bound
|
||||
* in the loader stages via special devicetree properties.
|
||||
*
|
||||
* Before relocation this function can be used to check if nodes
|
||||
* are required in either SPL or TPL stages.
|
||||
*
|
||||
* After relocation and jumping into the real U-Boot binary
|
||||
* it is possible to determine if a node was bound in one of
|
||||
* SPL/TPL stages.
|
||||
*
|
||||
* There are 4 settings currently in use
|
||||
* - u-boot,dm-pre-proper: U-Boot proper pre-relocation only
|
||||
* - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
|
||||
* Existing platforms only use it to indicate nodes needed in
|
||||
* SPL. Should probably be replaced by u-boot,dm-spl for
|
||||
* existing platforms.
|
||||
* - u-boot,dm-spl: SPL and U-Boot pre-relocation
|
||||
* - u-boot,dm-tpl: TPL and U-Boot pre-relocation
|
||||
* @node: of node
|
||||
*
|
||||
* Returns true if node is needed in SPL/TL, false otherwise.
|
||||
*/
|
||||
bool dm_ofnode_pre_reloc(ofnode node);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -117,11 +117,11 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
|
||||
#define log_io(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
|
||||
#else
|
||||
#define _LOG_MAX_LEVEL LOGL_INFO
|
||||
#define log_err(_fmt...) log_nop(LOG_CATEGORY, LOGL_ERR, ##_fmt)
|
||||
#define log_warning(_fmt...) log_nop(LOG_CATEGORY, LOGL_WARNING, ##_fmt)
|
||||
#define log_notice(_fmt...) log_nop(LOG_CATEGORY, LOGL_NOTICE, ##_fmt)
|
||||
#define log_info(_fmt...) log_nop(LOG_CATEGORY, LOGL_INFO, ##_fmt)
|
||||
#define log_debug(_fmt...) log_nop(LOG_CATEGORY, LOGL_DEBUG, ##_fmt)
|
||||
#define log_err(_fmt, ...) printf(_fmt, ##__VA_ARGS__)
|
||||
#define log_warning(_fmt, ...) printf(_fmt, ##__VA_ARGS__)
|
||||
#define log_notice(_fmt, ...) printf(_fmt, ##__VA_ARGS__)
|
||||
#define log_info(_fmt, ...) printf(_fmt, ##__VA_ARGS__)
|
||||
#define log_debug(_fmt, ...) debug(_fmt, ##__VA_ARGS__)
|
||||
#define log_content(_fmt...) log_nop(LOG_CATEGORY, \
|
||||
LOGL_DEBUG_CONTENT, ##_fmt)
|
||||
#define log_io(_fmt...) log_nop(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
|
||||
|
||||
16
include/test/log.h
Normal file
16
include/test/log.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
*
|
||||
* Tests for logging functions
|
||||
*/
|
||||
|
||||
#ifndef __TEST_LOG_H__
|
||||
#define __TEST_LOG_H__
|
||||
|
||||
#include <test/test.h>
|
||||
|
||||
/* Declare a new logging test */
|
||||
#define LOG_TEST(_name) UNIT_TEST(_name, 0, log_test)
|
||||
|
||||
#endif /* __TEST_LOG_H__ */
|
||||
@@ -30,6 +30,7 @@ int do_ut_compression(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
|
||||
int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
int do_ut_env(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
int do_ut_lib(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
int do_ut_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
int do_ut_optee(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
|
||||
@@ -105,6 +105,22 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes);
|
||||
} \
|
||||
}
|
||||
|
||||
/* Assert that two 64 int expressions are equal */
|
||||
#define ut_asserteq_64(expr1, expr2) { \
|
||||
u64 _val1 = (expr1), _val2 = (expr2); \
|
||||
\
|
||||
if (_val1 != _val2) { \
|
||||
ut_failf(uts, __FILE__, __LINE__, __func__, \
|
||||
#expr1 " == " #expr2, \
|
||||
"Expected %#llx (%lld), got %#llx (%lld)", \
|
||||
(unsigned long long)_val1, \
|
||||
(unsigned long long)_val1, \
|
||||
(unsigned long long)_val2, \
|
||||
(unsigned long long)_val2); \
|
||||
return CMD_RET_FAILURE; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Assert that two string expressions are equal */
|
||||
#define ut_asserteq_str(expr1, expr2) { \
|
||||
const char *_val1 = (expr1), *_val2 = (expr2); \
|
||||
|
||||
Reference in New Issue
Block a user