aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass2020-10-03 11:31:36 -0600
committerSimon Glass2020-10-29 14:42:18 -0600
commitfbe27a54ebbe7433bbccf242f4edda61e2c1ba3e (patch)
tree1a47ecbb74a274b162553efefc07d23eb36bc51d /test
parente41651fffda7da55f6d74afdf4b784088184c543 (diff)
dm: Add a test for of-platdata parent information
Add a simple test that we can obtain the correct parent for an I2C device. This requires updating the driver names to match the compatible strings, adding them to the devicetree and enabling a few options. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/of_platdata.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c
index e827d45ffb7..bad733fbee0 100644
--- a/test/dm/of_platdata.c
+++ b/test/dm/of_platdata.c
@@ -205,3 +205,18 @@ static int dm_test_of_platdata_phandle(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_of_platdata_phandle, UT_TESTF_SCAN_PDATA);
+
+#if CONFIG_IS_ENABLED(OF_PLATDATA_PARENT)
+/* Test that device parents are correctly set up */
+static int dm_test_of_platdata_parent(struct unit_test_state *uts)
+{
+ struct udevice *rtc, *i2c;
+
+ ut_assertok(uclass_first_device_err(UCLASS_RTC, &rtc));
+ ut_assertok(uclass_first_device_err(UCLASS_I2C, &i2c));
+ ut_asserteq_ptr(i2c, dev_get_parent(rtc));
+
+ return 0;
+}
+DM_TEST(dm_test_of_platdata_parent, UT_TESTF_SCAN_PDATA);
+#endif