From fbe27a54ebbe7433bbccf242f4edda61e2c1ba3e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 3 Oct 2020 11:31:36 -0600 Subject: 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 --- test/dm/of_platdata.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') 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 -- cgit v1.2.3