On Thu, May 12, 2022 at 10:35 AM Rasmus Villemoes
<rasmus.villem...@prevas.dk> wrote:
>
> Similar to what was done for the FEC driver in commit
> 89b5bd54c1a4 (net: fec: Allow the PHY node to be retrieved), make sure
> the PHY is associated with the right device tree node, so that phy
> specific DT properties is accessible by the phy driver.
>
> This is required on a custom iMX8MP board with a ti,dp83867 phy
> sitting in front of the eqos interface.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villem...@prevas.dk>
> ---
> drivers/net/dwc_eth_qos.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
> index 27b3f98e0e..af35960b42 100644
> --- a/drivers/net/dwc_eth_qos.c
> +++ b/drivers/net/dwc_eth_qos.c
> @@ -1078,9 +1078,11 @@ static int eqos_start(struct udevice *dev)
> * don't need to reconnect/reconfigure again
> */
> if (!eqos->phy) {
> + ofnode phy_node = ofnode_null();
> int addr = -1;
> +
> #ifdef CONFIG_DM_ETH_PHY
> - addr = eth_phy_get_addr(dev);
> + addr = eth_phy_get_node_and_addr(dev, &phy_node);
> #endif
> eqos->phy = phy_connect(eqos->mii, addr, dev,
> eqos->config->interface(dev));
> @@ -1088,6 +1090,8 @@ static int eqos_start(struct udevice *dev)
> pr_err("phy_connect() failed");
> goto err_stop_resets;
> }
> + if (ofnode_valid(phy_node))
> + eqos->phy->node = phy_node;
>
> if (eqos->max_speed) {
> ret = phy_set_supported(eqos->phy, eqos->max_speed);
> --
> 2.31.1
>
Reviewed-by: Ramon Fried <rfried....@gmail.com>