summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-08-07 07:24:09 -0600
committerSimon Glass <sjg@chromium.org>2021-09-25 09:46:15 -0600
commitf0ab8f9fbe73f2243a959641c909314494b771b6 (patch)
tree14610d0f4a178d8a0b1f7f287241776b2aab3ecd /test
parent4ee0cc89dbbeb2d6b08e702afc1332f7dec8a38f (diff)
downloadu-boot-f0ab8f9fbe73f2243a959641c909314494b771b6.tar.gz
clk: Rename clk_get_by_driver_info()
This is actually a misnomer now, since the phandle info may contain a driver_info index or a udevice index. Rename it to use the word 'phandle', which seems more accurate. Add a comment while we are here. Also add a test for this function. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/of_platdata.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c
index 0463cf0b43..c4a2d11410 100644
--- a/test/dm/of_platdata.c
+++ b/test/dm/of_platdata.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
+#include <clk.h>
#include <dm.h>
#include <dt-structs.h>
#include <dm/test.h>
@@ -222,3 +223,21 @@ static int dm_test_of_plat_parent(struct unit_test_state *uts)
}
DM_TEST(dm_test_of_plat_parent, UT_TESTF_SCAN_PDATA);
#endif
+
+/* Test clocks with of-platdata */
+static int dm_test_of_plat_clk(struct unit_test_state *uts)
+{
+ struct dtd_sandbox_clk_test *plat;
+ struct udevice *dev;
+ struct clk clk;
+
+ ut_assertok(uclass_first_device_err(UCLASS_MISC, &dev));
+ ut_asserteq_str("sandbox_clk_test", dev->name);
+ plat = dev_get_plat(dev);
+
+ ut_assertok(clk_get_by_phandle(dev, &plat->clocks[0], &clk));
+ ut_asserteq_str("sandbox_fixed_clock", clk.dev->name);
+
+ return 0;
+}
+DM_TEST(dm_test_of_plat_clk, UT_TESTF_SCAN_PDATA);