diff options
author | Neil Armstrong <narmstrong@baylibre.com> | 2018-04-27 12:56:15 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-05-08 16:07:40 +0300 |
commit | e068512ca6c915325cbb6da00961adb07230f03f (patch) | |
tree | 56e96e8c0d60474a91d2655ab2b3d5d28a7edd92 /test/dm | |
parent | 285cbcf97f2b1dcadedb6835b3e9662c7fba0fe2 (diff) | |
download | u-boot-e068512ca6c915325cbb6da00961adb07230f03f.tar.xz |
test: regmap: add read/modify/write test
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>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/regmap.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/dm/regmap.c b/test/dm/regmap.c index 5b51a90488..d4b86b3b03 100644 --- a/test/dm/regmap.c +++ b/test/dm/regmap.c @@ -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, ®)); + ut_assertok(regmap_read(map, 3, ®)); + + 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); |