drivers: net: cpsw: Add support for fixed-link PHY
authorMarkus Brunner <systemprogrammierung.brunner@gmail.com>
Tue, 3 Nov 2015 21:09:51 +0000 (22:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Nov 2015 01:57:26 +0000 (20:57 -0500)
Add support for a fixed-link devicetree sub-node in case the the
cpsw MAC is directly connected to a non-mdio PHY/device.

Signed-off-by: Markus Brunner <systemprogrammierung.brunner@gmail.com>
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/devicetree/bindings/net/cpsw.txt
drivers/net/ethernet/ti/cpsw.c

index 4efca560adda4b22f0498f123f053650e4427da5..9853f8e7096613e990c28cc545b39ab7f26afddc 100644 (file)
@@ -48,6 +48,11 @@ Optional properties:
 - mac-address          : See ethernet.txt file in the same directory
 - phy-handle           : See ethernet.txt file in the same directory
 
+Slave sub-nodes:
+- fixed-link           : See fixed-link.txt file in the same directory
+                         Either the properties phy_id and phy-mode,
+                         or the sub-node fixed-link can be specified
+
 Note: "ti,hwmods" field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
 Future plan is to migrate hwmod data base contents into device tree
index 040fbc1e55080a4d025df2a2fae888da6151008c..48b92c9de12a5af4f75ab6b48b4ffd39a77d6ed5 100644 (file)
@@ -2037,6 +2037,19 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
                        continue;
 
                priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
+               if (of_phy_is_fixed_link(slave_node)) {
+                       struct phy_device *pd;
+
+                       ret = of_phy_register_fixed_link(slave_node);
+                       if (ret)
+                               return ret;
+                       pd = of_phy_find_device(slave_node);
+                       if (!pd)
+                               return -ENODEV;
+                       snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
+                                PHY_ID_FMT, pd->bus->id, pd->phy_id);
+                       goto no_phy_slave;
+               }
                parp = of_get_property(slave_node, "phy_id", &lenp);
                if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
                        dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);