From bd933bfd834364bca6cc6f3a62e4255090a5bec1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 27 Jan 2020 08:49:46 -0700 Subject: dm: core: Add ofnode_get_chosen_prop() Add a function to read a property from the chosen node, providing access to its length. Update ofnode_get_chosen_string() to make use of it. Signed-off-by: Simon Glass --- test/dm/ofnode.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index f1e4ed7..1c49eaf 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -88,7 +88,9 @@ DM_TEST(dm_test_ofnode_read, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); static int dm_test_ofnode_read_chosen(struct unit_test_state *uts) { const char *str; + const u32 *val; ofnode node; + int size; str = ofnode_read_chosen_string("setting"); ut_assertnonnull(str); @@ -102,6 +104,12 @@ static int dm_test_ofnode_read_chosen(struct unit_test_state *uts) node = ofnode_get_chosen_node("setting"); ut_assert(!ofnode_valid(node)); + val = ofnode_read_chosen_prop("int-values", &size); + ut_assertnonnull(val); + ut_asserteq(8, size); + ut_asserteq(0x1937, fdt32_to_cpu(val[0])); + ut_asserteq(72993, fdt32_to_cpu(val[1])); + return 0; } DM_TEST(dm_test_ofnode_read_chosen, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -- cgit v1.1