]> git.sur5r.net Git - u-boot/commitdiff
test: regmap: add read/modify/write test
authorNeil Armstrong <narmstrong@baylibre.com>
Fri, 27 Apr 2018 09:56:15 +0000 (11:56 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 8 May 2018 13:07:40 +0000 (09:07 -0400)
Add calls to regmap_read/modify_bits/write even if the proper memory
read/write calls are not executed in sandbox.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
test/dm/regmap.c

index 5b51a9048877f1489222d4052d053aa292ef45d3..d4b86b3b03c2a61bd5b55100cf58f66fe0961f74 100644 (file)
@@ -91,3 +91,28 @@ static int dm_test_regmap_syscon(struct unit_test_state *uts)
 }
 
 DM_TEST(dm_test_regmap_syscon, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Read/Write/Modify test */
+static int dm_test_regmap_rw(struct unit_test_state *uts)
+{
+       struct udevice *dev;
+       struct regmap *map;
+       uint reg;
+
+       ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev));
+       map = syscon_get_regmap(dev);
+       ut_assertok_ptr(map);
+
+       ut_assertok(regmap_write(map, 0, 0xcacafafa));
+       ut_assertok(regmap_write(map, 3, 0x55aa2211));
+
+       ut_assertok(regmap_read(map, 0, &reg));
+       ut_assertok(regmap_read(map, 3, &reg));
+
+       ut_assertok(regmap_update_bits(map, 0, 0xff00ff00, 0x55aa2211));
+       ut_assertok(regmap_update_bits(map, 3, 0x00ff00ff, 0xcacafada));
+
+       return 0;
+}
+
+DM_TEST(dm_test_regmap_rw, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);