drivers: net: cpsw: don't ignore phy-mode if phy-handle is used
authorDavid Rivshin <drivshin@allworx.com>
Thu, 28 Apr 2016 01:38:26 +0000 (21:38 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Apr 2016 21:27:30 +0000 (17:27 -0400)
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: 9e42f715264f ("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>
drivers/net/ethernet/ti/cpsw.c

index 5903448e8ee95ee09d8e8b2d684421d4512a9773..712bc6d75f219005f2eb881d3f1527e0e5d9584c 100644 (file)
@@ -2043,7 +2043,11 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
                slave_data->phy_node = of_parse_phandle(slave_node,
                                                        "phy-handle", 0);
                parp = of_get_property(slave_node, "phy_id", &lenp);
-               if (of_phy_is_fixed_link(slave_node)) {
+               if (slave_data->phy_node) {
+                       dev_dbg(&pdev->dev,
+                               "slave[%d] using phy-handle=\"%s\"\n",
+                               i, slave_data->phy_node->full_name);
+               } else if (of_phy_is_fixed_link(slave_node)) {
                        struct device_node *phy_node;
                        struct phy_device *phy_dev;
 
@@ -2080,7 +2084,9 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
                        snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
                                 PHY_ID_FMT, mdio->name, phyid);
                } else {
-                       dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i);
+                       dev_err(&pdev->dev,
+                               "No slave[%d] phy_id, phy-handle, or fixed-link property\n",
+                               i);
                        goto no_phy_slave;
                }
                slave_data->phy_if = of_get_phy_mode(slave_node);
This page took 0.02767 seconds and 5 git commands to generate.