summaryrefslogtreecommitdiff
path: root/test/dm/ofnode.c
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2022-07-30 15:52:14 -0600
committerTom Rini <[email protected]>2022-08-12 08:14:24 -0400
commit55f7990bfeb92c172065d5b53c59d5306cc554ca (patch)
treef032ae3da89230bf5f6365bf37125211d1149e15 /test/dm/ofnode.c
parent39e42be12b9456e604ac3e228973b1cb1136864c (diff)
dm: core: Add support for writing u32 with ofnode
Add a new function to write an integer to an ofnode (live tree or flat tree). Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'test/dm/ofnode.c')
-rw-r--r--test/dm/ofnode.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index bd598d23e44..f80993f8927 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -585,3 +585,19 @@ static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts)
}
DM_TEST(dm_test_ofnode_livetree_writing,
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_LIVE_OR_FLAT);
+
+static int dm_test_ofnode_u32(struct unit_test_state *uts)
+{
+ ofnode node;
+
+ node = ofnode_path("/lcd");
+ ut_assert(ofnode_valid(node));
+ ut_asserteq(1366, ofnode_read_u32_default(node, "xres", 123));
+ ut_assertok(ofnode_write_u32(node, "xres", 1367));
+ ut_asserteq(1367, ofnode_read_u32_default(node, "xres", 123));
+ ut_assertok(ofnode_write_u32(node, "xres", 1366));
+
+ return 0;
+}
+DM_TEST(dm_test_ofnode_u32,
+ UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_LIVE_OR_FLAT);