diff mbox series

[U-Boot,v2,2/2] test: regmap: add read/modify/write test

Message ID 1524822975-22120-3-git-send-email-narmstrong@baylibre.com
State Accepted
Commit e068512ca6c915325cbb6da00961adb07230f03f
Delegated to: Tom Rini
Headers show
Series regmap: add regmap_update_bits and sandbox R/W test | expand

Commit Message

Neil Armstrong April 27, 2018, 9:56 a.m. UTC
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>
---
 test/dm/regmap.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Simon Glass April 30, 2018, 11:13 p.m. UTC | #1
On 27 April 2018 at 03:56, Neil Armstrong <narmstrong@baylibre.com> wrote:
> 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>
> ---
>  test/dm/regmap.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini May 8, 2018, 5:17 p.m. UTC | #2
On Fri, Apr 27, 2018 at 11:56:15AM +0200, Neil Armstrong wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index 7f66058..42f17c6 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -80,3 +80,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);