summaryrefslogtreecommitdiffstats
path: root/test/dm/regmap.c
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2018-10-15 09:24:13 +0200
committerSimon Glass <sjg@chromium.org>2018-11-14 09:16:27 -0800
commit45ef7f55c79f67be8bf0b4e6de549269c1fd4971 (patch)
treeb4fc9a9c59bb68f5075ae1c9127eee4e7b7c64c2 /test/dm/regmap.c
parente936397ae98b3a67ba7deaef0cc8a56f36e66b58 (diff)
downloadu-boot-45ef7f55c79f67be8bf0b4e6de549269c1fd4971.tar.gz
u-boot-45ef7f55c79f67be8bf0b4e6de549269c1fd4971.tar.xz
u-boot-45ef7f55c79f67be8bf0b4e6de549269c1fd4971.zip
test: regmap: Add test for regmap_{set, get}
Add test for regmap_{set,get} functions. Reviewed-by: Anatolij Gustschin <agust@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'test/dm/regmap.c')
-rw-r--r--test/dm/regmap.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index b28d6a6cd1..a8d7e6829e 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -116,3 +116,31 @@ static int dm_test_regmap_rw(struct unit_test_state *uts)
}
DM_TEST(dm_test_regmap_rw, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Get/Set test */
+static int dm_test_regmap_getset(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ struct regmap *map;
+ uint reg;
+ struct layout {
+ u32 val0;
+ u32 val1;
+ u32 val2;
+ u32 val3;
+ };
+
+ ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev));
+ map = syscon_get_regmap(dev);
+ ut_assertok_ptr(map);
+
+ regmap_set(map, struct layout, val0, 0xcacafafa);
+ regmap_set(map, struct layout, val3, 0x55aa2211);
+
+ ut_assertok(regmap_get(map, struct layout, val0, &reg));
+ ut_assertok(regmap_get(map, struct layout, val3, &reg));
+
+ return 0;
+}
+
+DM_TEST(dm_test_regmap_getset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);