summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeil Armstrong <narmstrong@baylibre.com>2018-11-22 11:01:04 +0100
committerJagan Teki <jagan@amarulasolutions.com>2018-11-24 14:41:11 +0530
commitebe3497c9c96def46e48b57300933abe0c4c850c (patch)
tree3dd5b980b1570eddae5c225e2362a63c515ed9dc /test
parentd13801ef1d14fe46f97630b56e01200b337dad6c (diff)
downloadu-boot-ebe3497c9c96def46e48b57300933abe0c4c850c.tar.gz
u-boot-ebe3497c9c96def46e48b57300933abe0c4c850c.tar.xz
u-boot-ebe3497c9c96def46e48b57300933abe0c4c850c.zip
test: regmap: add regmap_read_poll_timeout test
Add test to regmap_read_poll_timeout() helper to check the timeout works properly but cannot test proper condition matching since read/write calls are not executed in sandbox. Tested-by: Jerome Brunet <jbrunet@baylibre.com> Acked-by: Jagan Teki <jagan@openedev.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Diffstat (limited to 'test')
-rw-r--r--test/dm/regmap.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index a8d7e6829e..9a70c159dd 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -144,3 +144,29 @@ static int dm_test_regmap_getset(struct unit_test_state *uts)
}
DM_TEST(dm_test_regmap_getset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Read polling test */
+static int dm_test_regmap_poll(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ struct regmap *map;
+ uint reg;
+ unsigned long start;
+
+ ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev));
+ map = syscon_get_regmap(dev);
+ ut_assertok_ptr(map);
+
+ start = get_timer(0);
+
+ ut_asserteq(-ETIMEDOUT,
+ regmap_read_poll_timeout(map, 0, reg,
+ (reg == 0xcacafafa),
+ 1, 5 * CONFIG_SYS_HZ));
+
+ ut_assert(get_timer(start) > (5 * CONFIG_SYS_HZ));
+
+ return 0;
+}
+
+DM_TEST(dm_test_regmap_poll, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);