Merge tag 'spi-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc
[deliverable/linux.git] / drivers / of / of_mdio.c
index 2574abde8d995d2e704f0852bc7a645452e13cd9..8e6c25f350403aa36ca14500210e76018737d8ff 100644 (file)
@@ -57,6 +57,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
                const __be32 *paddr;
                u32 addr;
                int len;
+               bool is_c45;
 
                /* A PHY must have a reg property in the range [0-31] */
                paddr = of_get_property(child, "reg", &len);
@@ -79,11 +80,18 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
                                mdio->irq[addr] = PHY_POLL;
                }
 
-               phy = get_phy_device(mdio, addr);
+               is_c45 = of_device_is_compatible(child,
+                                                "ethernet-phy-ieee802.3-c45");
+               phy = get_phy_device(mdio, addr, is_c45);
+
                if (!phy || IS_ERR(phy)) {
-                       dev_err(&mdio->dev, "error probing PHY at address %i\n",
-                               addr);
-                       continue;
+                       phy = phy_device_create(mdio, addr, 0, false, NULL);
+                       if (!phy || IS_ERR(phy)) {
+                               dev_err(&mdio->dev,
+                                       "error creating PHY at address %i\n",
+                                       addr);
+                               continue;
+                       }
                }
 
                /* Associate the OF node with the device structure so it
This page took 0.036605 seconds and 5 git commands to generate.