summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Kiselev <bigunclemax@gmail.com>2024-01-20 19:26:24 +0300
committerAndre Przywara <andre.przywara@arm.com>2024-01-29 14:30:59 +0000
commit2bfab76f4c73536717f6c6cda2dcb2a60bb25ece (patch)
treeaa22b83349d698c93e1b42a575ddd864cc399095
parent1cca1011cb4e0f43ba42763a9cbf203df38dd862 (diff)
net: sun8i-emac: Add support for fixed-link phy
Make the "phy-handle" property optional, which allows support for a fixed-link phy configuration. Thus if the "phy-handle" is present in a DT, then driver will work as before. Otherwise, phyaddr initialization will not be necessary, as it is not needed in case of a fixed-link config. Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
-rw-r--r--drivers/net/sun8i_emac.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index a12f7e32e8f..8bff4fe9a9e 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -833,11 +833,8 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev)
priv->use_internal_phy = false;
offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "phy-handle");
- if (offset < 0) {
- debug("%s: Cannot find PHY address\n", __func__);
- return -EINVAL;
- }
- priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
+ if (offset >= 0)
+ priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
pdata->phy_interface = dev_read_phy_mode(dev);
debug("phy interface %d\n", pdata->phy_interface);