From: Tom Rini Date: Mon, 22 Feb 2021 12:32:40 -0500 Subject: [PATCH 1/3] mdio-uclass.c: support fixed-link subnodes In-Reply-To: <20201005131518.10289-2-rasmus.villemoes@prevas.dk> References: <20201005131518.10289-1-rasmus.villemoes@prevas.dk> <20201005131518.10289-2-rasmus.villemoes@prevas.dk> Message-ID: <20210222173240.GB10169@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Oct 05, 2020 at 03:15:16PM +0200, Rasmus Villemoes wrote: > 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 at 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 at 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 > Reviewed-by: Heiko Schocher Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: