Skip to contentSkip to conversation

net: davinci_emac: Add support for fixed-link PHY

PATCH Applied Neil Armstrong 3 participants 3 messages Sep 22, 2015 – Sep 23, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: davinci_emac: Add support for fixed-link PHY

In case the DaVinci Emac is directly connected to a non-mdio PHY/device, it should be possible to provide a fixed link configuration in the DT.

---
 drivers/net/ethernet/ti/davinci_emac.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +6 -2
index aeebc0a..6521dfb 100644
@@ -1861,8 +1861,12 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv)
 	pdata->no_bd_ram = of_property_read_bool(np, "ti,davinci-no-bd-ram");
 
 	priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
-	if (!priv->phy_node)
-		pdata->phy_id = NULL;
+	if (!priv->phy_node) {
+		if (!of_phy_is_fixed_link(np))
+			pdata->phy_id = NULL;
+		else if (of_phy_register_fixed_link(np) >= 0)
+			priv->phy_node = of_node_get(np);
+	}
 
 	auxdata = pdev->dev.platform_data;
 	if (auxdata) {
Signature · 1 line
1.9.1
Tested-by on v1 1/1
#1 lore raw
Quoted 5 lines · Neil Armstrong

In case the DaVinci Emac is directly connected to a non-mdio PHY/device, it should be possible to provide a fixed link configuration in the DT.

Ethernet works for me with this patch:

Quoted 25 lines
---
 drivers/net/ethernet/ti/davinci_emac.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +6 -2
index aeebc0a..6521dfb 100644
@@ -1861,8 +1861,12 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv)
 	pdata->no_bd_ram = of_property_read_bool(np, "ti,davinci-no-bd-ram");
 
 	priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
-	if (!priv->phy_node)
-		pdata->phy_id = NULL;
+	if (!priv->phy_node) {
+		if (!of_phy_is_fixed_link(np))
+			pdata->phy_id = NULL;
+		else if (of_phy_register_fixed_link(np) >= 0)
+			priv->phy_node = of_node_get(np);
+	}
 
 	auxdata = pdev->dev.platform_data;
 	if (auxdata) {
Signature · 1 line
1.9.1