mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
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>
This commit is contained in:
parent
e936397ae9
commit
45ef7f55c7
1 changed files with 28 additions and 0 deletions
|
@ -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);
|
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, ®));
|
||||||
|
ut_assertok(regmap_get(map, struct layout, val3, ®));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DM_TEST(dm_test_regmap_getset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue