aboutsummaryrefslogtreecommitdiff
path: root/test/dm/ofnode.c
diff options
context:
space:
mode:
authorSimon Glass2020-01-27 08:49:46 -0700
committerSimon Glass2020-02-05 19:33:45 -0700
commitbd933bfd834364bca6cc6f3a62e4255090a5bec1 (patch)
treeaade4618c7168efe95a72e4466350513ce1549fd /test/dm/ofnode.c
parent1aada6313ca9b9e9123a4118c78558ef413e1039 (diff)
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 <sjg@chromium.org>
Diffstat (limited to 'test/dm/ofnode.c')
-rw-r--r--test/dm/ofnode.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index f1e4ed75db0..1c49eaf38bf 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);