diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2018-04-29 21:56:54 +0200 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2018-06-01 15:56:02 +0200 |
commit | 30a90f56c3a20da0456e09e6e665b648719b8935 (patch) | |
tree | cb89e7bcd28929b59dc90cb5cced979d9b19b090 /test | |
parent | c3c863880479edeb5b08226e622d13c91326e4a7 (diff) | |
download | u-boot-30a90f56c3a20da0456e09e6e665b648719b8935.tar.gz |
dm: core: add functions to get memory-mapped I/O addresses
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/test-fdt.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 8196844e89..552d700935 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -461,3 +461,45 @@ static int dm_test_fdt_translation(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_translation, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test devfdt_remap_addr_index() */ +static int dm_test_fdt_remap_addr_flat(struct unit_test_state *uts) +{ + struct udevice *dev; + fdt_addr_t addr; + void *paddr; + + ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); + + addr = devfdt_get_addr(dev); + ut_asserteq(0x8000, addr); + + paddr = map_physmem(addr, 0, MAP_NOCACHE); + ut_assertnonnull(paddr); + ut_asserteq_ptr(paddr, devfdt_remap_addr(dev)); + + return 0; +} +DM_TEST(dm_test_fdt_remap_addr_flat, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + +/* Test dev_remap_addr_index() */ +static int dm_test_fdt_remap_addr_live(struct unit_test_state *uts) +{ + struct udevice *dev; + fdt_addr_t addr; + void *paddr; + + ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); + + addr = dev_read_addr(dev); + ut_asserteq(0x8000, addr); + + paddr = map_physmem(addr, 0, MAP_NOCACHE); + ut_assertnonnull(paddr); + ut_asserteq_ptr(paddr, dev_remap_addr(dev)); + + return 0; +} +DM_TEST(dm_test_fdt_remap_addr_live, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); |