summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait@windriver.com>2020-08-03 22:17:36 +0300
committerSimon Glass <sjg@chromium.org>2020-08-22 08:51:43 -0600
commit6e64830f0bca623180d5d1667df02c288616ea5c (patch)
tree1a82be01f89637e9097f3d5371ab5b801c553e4c /test
parent3fe69d3764c3ca6f304c51faa6aae7a84f1fa56c (diff)
test: dm: Add test case for devfdt_get_addr_ptr
Add flat tree test case to cover devfdt_get_addr_ptr function. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/test-fdt.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index ac8ce99f51..04802deb7f 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -619,6 +619,24 @@ static int dm_test_fdt_translation(struct unit_test_state *uts)
}
DM_TEST(dm_test_fdt_translation, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+static int dm_test_fdt_get_addr_ptr_flat(struct unit_test_state *uts)
+{
+ struct udevice *gpio, *dev;
+ void *ptr;
+
+ /* Test for missing reg property */
+ ut_assertok(uclass_first_device_err(UCLASS_GPIO, &gpio));
+ ut_assertnull(devfdt_get_addr_ptr(gpio));
+
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ptr = devfdt_get_addr_ptr(dev);
+ ut_asserteq_ptr((void *)0x8000, ptr);
+
+ return 0;
+}
+DM_TEST(dm_test_fdt_get_addr_ptr_flat,
+ UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE);
+
static int dm_test_fdt_remap_addr_flat(struct unit_test_state *uts)
{
struct udevice *dev;