aboutsummaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2021-03-14 20:14:58 +0800
committerPriyanka Jain <priyanka.jain@nxp.com>2021-04-15 14:22:17 +0530
commit534c69b09a8907799e0e5f9f85bc2f638f6c99a9 (patch)
tree5a6673af5a33182feafcd2d0a82d3c6b694a4b21 /test/dm
parentff98da06674d47ff995edd068bcbd4ae6da69f00 (diff)
downloadu-boot-534c69b09a8907799e0e5f9f85bc2f638f6c99a9.zip
u-boot-534c69b09a8907799e0e5f9f85bc2f638f6c99a9.tar.gz
u-boot-534c69b09a8907799e0e5f9f85bc2f638f6c99a9.tar.bz2
test: dm: Add a case to test ofnode_phy_is_fixed_link()
This adds a test case to test the new ofnode_phy_is_fixed_link() API. Both the new and old DT bindings are covered. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/of_extra.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dm/of_extra.c b/test/dm/of_extra.c
index b19cd37..ac2d886 100644
--- a/test/dm/of_extra.c
+++ b/test/dm/of_extra.c
@@ -36,3 +36,21 @@ static int dm_test_ofnode_read_fmap_entry(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_ofnode_read_fmap_entry, 0);
+
+static int dm_test_ofnode_phy_is_fixed_link(struct unit_test_state *uts)
+{
+ ofnode eth_node, phy_node, node;
+
+ eth_node = ofnode_path("/dsa-test/ports/port@0");
+ ut_assert(ofnode_phy_is_fixed_link(eth_node, &phy_node));
+ node = ofnode_path("/dsa-test/ports/port@0/fixed-link");
+ ut_asserteq_mem(&phy_node, &node, sizeof(ofnode));
+
+ eth_node = ofnode_path("/dsa-test/ports/port@1");
+ ut_assert(ofnode_phy_is_fixed_link(eth_node, &phy_node));
+ node = eth_node;
+ ut_asserteq_mem(&phy_node, &node, sizeof(ofnode));
+
+ return 0;
+}
+DM_TEST(dm_test_ofnode_phy_is_fixed_link, 0);