aboutsummaryrefslogtreecommitdiff
path: root/test/dm/core.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-02-18 08:06:26 -0500
committerTom Rini <trini@konsulko.com>2021-02-18 08:06:26 -0500
commit56f1bcc4b7fbca8789cef90c30f201f5b3fff757 (patch)
treed587eafbc09d7ec51a9b12dca023ddce60507876 /test/dm/core.c
parent496f49464d90b564da5f1a2f4eecb5553e01edf9 (diff)
parent0059ef0be903a1f0a9afe5259fb2e0874f78a8ac (diff)
Merge tag 'rpi-next-2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi
- add iProc RNG2000 driver for RPi4 - add support for CM4 and RPi400
Diffstat (limited to 'test/dm/core.c')
-rw-r--r--test/dm/core.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/dm/core.c b/test/dm/core.c
index ce31d86c7d..35ca689d64 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -1180,3 +1180,33 @@ static int dm_test_all_have_seq(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_all_have_seq, UT_TESTF_SCAN_PDATA);
+
+static int dm_test_dma_offset(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ ofnode node;
+
+ /* Make sure the bus's dma-ranges aren't taken into account here */
+ node = ofnode_path("/mmio-bus@0");
+ ut_assert(ofnode_valid(node));
+ ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_BUS, node, &dev));
+ ut_asserteq_64(0, dev->dma_offset);
+
+ /* Device behind a bus with dma-ranges */
+ node = ofnode_path("/mmio-bus@0/subnode@0");
+ ut_assert(ofnode_valid(node));
+ ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_FDT, node, &dev));
+ ut_asserteq_64(-0x10000000ULL, dev->dma_offset);
+
+ /* This one has no dma-ranges */
+ node = ofnode_path("/mmio-bus@1");
+ ut_assert(ofnode_valid(node));
+ ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_BUS, node, &dev));
+ node = ofnode_path("/mmio-bus@1/subnode@0");
+ ut_assert(ofnode_valid(node));
+ ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_FDT, node, &dev));
+ ut_asserteq_64(0, dev->dma_offset);
+
+ return 0;
+}
+DM_TEST(dm_test_dma_offset, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);