Subject: Re: [PATCH 2/3] net: ethernet: ixp4xx: Support device tree probing

From: Andrew Lunn <[email-masked]>
Date: Tue, 20 Apr 2021 03:35:48 +0200

> +	phy_np = of_parse_phandle(np, "phy-handle", 0);
> +	if (phy_np) {
> +		ret = of_property_read_u32(phy_np, "reg", &val);
> +		if (ret) {
> +			dev_err(dev, "cannot find phy reg\n");
> +			return NULL;
> +		}
> +		of_node_put(phy_np);
> +	} else {
> +		dev_err(dev, "cannot find phy instance\n");
> +		val = 0;
> +	}
> +	plat->phy = val;

phy-handle can point to a PHY on any bus. You should not assume it is
the devices own bus. Once you have phy_np call of_phy_find_device()
which gives you the actual phy device. Please don't let the
limitations of the current platform data limit you from implementing
this correctly.

      Andrew