Skip to content

Commit ae092b5

Browse files
David Rivshindavem330
authored andcommitted
drivers: net: cpsw: don't ignore phy-mode if phy-handle is used
The phy-mode emac property was only being processed in the phy_id or fixed-link cases. However if phy-handle was specified instead, an error message would complain about the lack of phy_id or fixed-link, and then jump past the of_get_phy_mode(). This would result in the PHY mode defaulting to MII, regardless of what the devicetree specified. Fixes: 9e42f71 ("drivers: net: cpsw: add phy-handle parsing") Signed-off-by: David Rivshin <drivshin@allworx.com> Tested-by: Nicolas Chauvet <kwizart@gmail.com> Tested-by: Andrew Goodbody <andrew.goodbody@cambrionix.com> Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d733f75 commit ae092b5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/net/ethernet/ti/cpsw.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,11 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
20432043
slave_data->phy_node = of_parse_phandle(slave_node,
20442044
"phy-handle", 0);
20452045
parp = of_get_property(slave_node, "phy_id", &lenp);
2046-
if (of_phy_is_fixed_link(slave_node)) {
2046+
if (slave_data->phy_node) {
2047+
dev_dbg(&pdev->dev,
2048+
"slave[%d] using phy-handle=\"%s\"\n",
2049+
i, slave_data->phy_node->full_name);
2050+
} else if (of_phy_is_fixed_link(slave_node)) {
20472051
struct device_node *phy_node;
20482052
struct phy_device *phy_dev;
20492053

@@ -2080,7 +2084,9 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
20802084
snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
20812085
PHY_ID_FMT, mdio->name, phyid);
20822086
} else {
2083-
dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i);
2087+
dev_err(&pdev->dev,
2088+
"No slave[%d] phy_id, phy-handle, or fixed-link property\n",
2089+
i);
20842090
goto no_phy_slave;
20852091
}
20862092
slave_data->phy_if = of_get_phy_mode(slave_node);

0 commit comments

Comments
 (0)