summaryrefslogtreecommitdiff
path: root/test/dm/phy.c
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2020-05-02 11:35:12 +0200
committerMarek Vasut <marek.vasut+renesas@gmail.com>2020-05-02 12:32:28 +0200
commit00c82acfe9aadaa624699e4579dace583f944449 (patch)
tree740ddbc4a240d4fe7f50bf5700d0f464f6066be8 /test/dm/phy.c
parentb13307b470f4fdfad42aa4c1adcaf1960837d0c4 (diff)
test: dm: phy: add a test item for the phy_bulk API
Add a test item for the phy_bulk API Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Frank Wunderlich <frank-w@public-files.de> Reviewed-by: Weijie Gao <weijie.gao@mediatek.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'test/dm/phy.c')
-rw-r--r--test/dm/phy.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/dm/phy.c b/test/dm/phy.c
index 21d92194b9..92455d94af 100644
--- a/test/dm/phy.c
+++ b/test/dm/phy.c
@@ -110,3 +110,36 @@ static int dm_test_phy_ops(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_phy_ops, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+static int dm_test_phy_bulk(struct unit_test_state *uts)
+{
+ struct phy_bulk phys;
+ struct udevice *parent;
+
+ /* test normal operations */
+ ut_assertok(uclass_get_device_by_name(UCLASS_SIMPLE_BUS,
+ "gen_phy_user1", &parent));
+
+ ut_assertok(generic_phy_get_bulk(parent, &phys));
+ ut_asserteq(2, phys.count);
+
+ ut_asserteq(0, generic_phy_init_bulk(&phys));
+ ut_asserteq(0, generic_phy_power_on_bulk(&phys));
+ ut_asserteq(0, generic_phy_power_off_bulk(&phys));
+ ut_asserteq(0, generic_phy_exit_bulk(&phys));
+
+ /* has a known problem phy */
+ ut_assertok(uclass_get_device_by_name(UCLASS_SIMPLE_BUS,
+ "gen_phy_user", &parent));
+
+ ut_assertok(generic_phy_get_bulk(parent, &phys));
+ ut_asserteq(3, phys.count);
+
+ ut_asserteq(0, generic_phy_init_bulk(&phys));
+ ut_asserteq(-EIO, generic_phy_power_on_bulk(&phys));
+ ut_asserteq(-EIO, generic_phy_power_off_bulk(&phys));
+ ut_asserteq(0, generic_phy_exit_bulk(&phys));
+
+ return 0;
+}
+DM_TEST(dm_test_phy_bulk, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);