net: sun8i-emac: Make internal PHY handling more robust
authorAndre Przywara <andre.przywara@arm.com>
Wed, 21 Oct 2020 17:57:32 +0000 (23:27 +0530)
committerJagan Teki <jagan@amarulasolutions.com>
Wed, 21 Oct 2020 18:15:23 +0000 (23:45 +0530)
commit88ae8fba84d85454008e3c89fcb790f8d077d7b5
tree61f8eddcee90a9e0a7d3e67b6bd36febf5a10c50
parent7edcb4e288efb9eb4412373638dab87cd78d92ba
net: sun8i-emac: Make internal PHY handling more robust

The current implementation of sun8i_get_ephy_nodes() makes quite some
assumptions, in general relying on DT path names is a bad idea.
I think the idea of the code was to determine if we are using the
internal PHY, for which there are simpler and more robust methods:

Rewrite (and rename) the existing function to simply lookup the DT node
that "phy-handle" points to, using the device's DT node.
Then check whether the parent of that PHY node is using an "H3 internal
MDIO" compatible string. If we ever get another internal MDIO bus
implementation, we will probably need code adjustments anyway, so this
is good enough for now.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
[jagan: rebase on master]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Amit Singh Tomar <amittomer25@gmail.com> # Pine64+
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/net/sun8i_emac.c