summaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-01-17 16:11:08 -0700
committerBin Meng <bmeng.cn@gmail.com>2016-01-24 12:07:19 +0800
commitac94b7bcbed9a5ee71f6fb9a507c72abf601cb8a (patch)
tree8158f7f6868c310d114e0336413f75d239850a00 /test/dm
parent907eed2ce36db8407d56edc305c32b0923934322 (diff)
downloadu-boot-imx-ac94b7bcbed9a5ee71f6fb9a507c72abf601cb8a.zip
u-boot-imx-ac94b7bcbed9a5ee71f6fb9a507c72abf601cb8a.tar.gz
u-boot-imx-ac94b7bcbed9a5ee71f6fb9a507c72abf601cb8a.tar.bz2
dm: syscon: Allow finding devices by driver data
We have a way to find a regmap by its syscon driver data value. Add the same for syscon itself. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/syscon.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/dm/syscon.c b/test/dm/syscon.c
index 3642481..c40f5fc 100644
--- a/test/dm/syscon.c
+++ b/test/dm/syscon.c
@@ -29,3 +29,20 @@ static int dm_test_syscon_base(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_syscon_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test system controller finding */
+static int dm_test_syscon_by_driver_data(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+
+ ut_assertok(syscon_get_by_driver_data(SYSCON0, &dev));
+ ut_asserteq(SYSCON0, dev->driver_data);
+
+ ut_assertok(syscon_get_by_driver_data(SYSCON1, &dev));
+ ut_asserteq(SYSCON1, dev->driver_data);
+
+ ut_asserteq(-ENODEV, syscon_get_by_driver_data(2, &dev));
+
+ return 0;
+}
+DM_TEST(dm_test_syscon_by_driver_data, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);