aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-04-15 08:09:52 -0400
committerTom Rini <trini@konsulko.com>2022-04-15 08:10:32 -0400
commit7f418ea59852945eeb9e5d2555d306f09643d555 (patch)
tree069dbaf3a1f62b68251189e9acdbd9affcbd98c5 /test
parent239fe55a6ce516f329687c0680428ca2acfc73ca (diff)
parent0154e6de37e8bbaac837939391f6d4a8f0b3fd18 (diff)
downloadu-boot-7f418ea59852945eeb9e5d2555d306f09643d555.zip
u-boot-7f418ea59852945eeb9e5d2555d306f09643d555.tar.gz
u-boot-7f418ea59852945eeb9e5d2555d306f09643d555.tar.bz2
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net
- DM9000 DM support - tftp server bug fix - mdio ofnode support functions - Various phy fixes and improvements. [trini: Fixup merge conflicts in drivers/net/phy/ethernet_id.c drivers/net/phy/phy.c include/phy.h]
Diffstat (limited to 'test')
-rw-r--r--test/dm/mdio.c18
-rw-r--r--test/dm/mdio_mux.c16
-rw-r--r--test/dm/ofnode.c22
3 files changed, 39 insertions, 17 deletions
diff --git a/test/dm/mdio.c b/test/dm/mdio.c
index 64347e1..f863c52 100644
--- a/test/dm/mdio.c
+++ b/test/dm/mdio.c
@@ -38,18 +38,18 @@ static int dm_test_mdio(struct unit_test_state *uts)
ut_assertnonnull(ops->read);
ut_assertnonnull(ops->write);
- ut_assertok(ops->write(dev, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
- SANDBOX_PHY_REG, TEST_REG_VALUE));
- reg = ops->read(dev, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
- SANDBOX_PHY_REG);
+ ut_assertok(dm_mdio_write(dev, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
+ SANDBOX_PHY_REG, TEST_REG_VALUE));
+ reg = dm_mdio_read(dev, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
+ SANDBOX_PHY_REG);
ut_asserteq(reg, TEST_REG_VALUE);
- ut_assert(ops->read(dev, SANDBOX_PHY_ADDR + 1, MDIO_DEVAD_NONE,
- SANDBOX_PHY_REG) != 0);
+ ut_assert(dm_mdio_read(dev, SANDBOX_PHY_ADDR + 1, MDIO_DEVAD_NONE,
+ SANDBOX_PHY_REG) != 0);
- ut_assertok(ops->reset(dev));
- reg = ops->read(dev, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
- SANDBOX_PHY_REG);
+ ut_assertok(dm_mdio_reset(dev));
+ reg = dm_mdio_read(dev, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
+ SANDBOX_PHY_REG);
ut_asserteq(reg, 0);
return 0;
diff --git a/test/dm/mdio_mux.c b/test/dm/mdio_mux.c
index 950f385..bfe3518 100644
--- a/test/dm/mdio_mux.c
+++ b/test/dm/mdio_mux.c
@@ -57,22 +57,22 @@ static int dm_test_mdio_mux(struct unit_test_state *uts)
* is selected to the selection #. Just reading that register from
* either of the child buses should return the id of the child bus
*/
- reg = ops->read(mdio_ch0, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
- SANDBOX_PHY_REG_CNT - 1);
+ reg = dm_mdio_read(mdio_ch0, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
+ SANDBOX_PHY_REG_CNT - 1);
ut_asserteq(reg, 0);
- reg = ops->read(mdio_ch1, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
- SANDBOX_PHY_REG_CNT - 1);
+ reg = dm_mdio_read(mdio_ch1, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
+ SANDBOX_PHY_REG_CNT - 1);
ut_asserteq(reg, 1);
mmops->select(mux, MDIO_MUX_SELECT_NONE, 5);
- reg = ops_parent->read(mdio, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
- SANDBOX_PHY_REG_CNT - 1);
+ reg = dm_mdio_read(mdio, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
+ SANDBOX_PHY_REG_CNT - 1);
ut_asserteq(reg, 5);
mmops->deselect(mux, 5);
- reg = ops_parent->read(mdio, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
- SANDBOX_PHY_REG_CNT - 1);
+ reg = dm_mdio_read(mdio, SANDBOX_PHY_ADDR, MDIO_DEVAD_NONE,
+ SANDBOX_PHY_REG_CNT - 1);
ut_asserteq(reg, (u16)MDIO_MUX_SELECT_NONE);
return 0;
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index dab0480..61ae1db 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -447,3 +447,25 @@ static int dm_test_ofnode_string_err(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_ofnode_string_err, UT_TESTF_LIVE_TREE);
+
+static int dm_test_ofnode_get_phy(struct unit_test_state *uts)
+{
+ ofnode eth_node, phy_node;
+ phy_interface_t mode;
+ u32 reg;
+
+ eth_node = ofnode_path("/phy-test-eth");
+ ut_assert(ofnode_valid(eth_node));
+
+ mode = ofnode_read_phy_mode(eth_node);
+ ut_assert(mode == PHY_INTERFACE_MODE_2500BASEX);
+
+ phy_node = ofnode_get_phy_node(eth_node);
+ ut_assert(ofnode_valid(phy_node));
+
+ reg = ofnode_read_u32_default(phy_node, "reg", -1U);
+ ut_asserteq_64(0x1, reg);
+
+ return 0;
+}
+DM_TEST(dm_test_ofnode_get_phy, 0);