summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2020-10-05 16:15:16 +0300
committerTom Rini <trini@konsulko.com>2021-02-22 02:46:41 +0300
commitbdf319273b4a752664c089fbffee5bb2024c8586 (patch)
tree50436e04043b99e921e95f6738bd962afaaef0bc /net
parent397ecc30b8fa23d0b4fda52cb1aeee1b8e9d07b8 (diff)
downloadu-boot-bdf319273b4a752664c089fbffee5bb2024c8586.tar.xz
mdio-uclass.c: support fixed-link subnodes
When trying to port our mpc8309-based board to DM_ETH, on top of Heiko's patches, I found that nothing in mdio-uclass.c seems to support the use of a fixed-link subnode of the ethernet DT node. That is, the ethernet node looks like enet0: ethernet@2000 { device_type = "network"; compatible = "ucc_geth"; ... fixed-link { reg = <0xffffffff>; speed = <100>; full-duplex; }; but the current code expects there to be phy-handle property. Adding that, i.e. phy-handle = <&enet0phy>; enet0phy: fixed-link { just makes the code break a few lines later since a fixed-link node doesn't have a reg property. Ignoring the dtc complaint and adding a dummy reg property, we of course hit "can't find MDIO bus for node ethernet@2000" since indeed, the parent node of the phy node does not represent an MDIO bus. So that's obviously the wrong path. Now, in linux, it seems that the fixed link case is treated specially; in the of_phy_get_and_connect() which roughly corresponds to dm_eth_connect_phy_handle() we have if (of_phy_is_fixed_link(np)) { ret = of_phy_register_fixed_link(np); ... } else { phy_np = of_parse_phandle(np, "phy-handle", 0); ... } phy = of_phy_connect(dev, phy_np, hndlr, 0, iface); And U-Boot's phy_connect() does have support for fixed-link subnodes. Calling phy_connect() directly with NULL bus and a dummy address does seem to make the ethernet work. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'net')
-rw-r--r--net/mdio-uclass.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c
index 697e5f838d..5da984ca3f 100644
--- a/net/mdio-uclass.c
+++ b/net/mdio-uclass.c
@@ -139,6 +139,12 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev,
struct ofnode_phandle_args phandle = {.node = ofnode_null()};
int i;
+ if (CONFIG_IS_ENABLED(PHY_FIXED) &&
+ ofnode_valid(dev_read_subnode(ethdev, "fixed-link"))) {
+ phy = phy_connect(NULL, -1, ethdev, interface);
+ goto out;
+ }
+
for (i = 0; i < PHY_HANDLE_STR_CNT; i++)
if (!dev_read_phandle_with_args(ethdev, phy_handle_str[i], NULL,
0, 0, &phandle))
@@ -168,6 +174,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev,
phy = dm_mdio_phy_connect(mdiodev, phy_addr, ethdev, interface);
+out:
if (phy)
phy->node = phandle.node;