]> git.sur5r.net Git - u-boot/commitdiff
net: designware: Add phy supply support
authorJacob Chen <jacob2.chen@rock-chips.com>
Mon, 27 Mar 2017 08:54:17 +0000 (16:54 +0800)
committerJoe Hershberger <joe.hershberger@ni.com>
Fri, 2 Jun 2017 19:44:18 +0000 (14:44 -0500)
Some board need a regulator for gmac phy, so add this code to handle it.
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/designware.c

index e3a194c2c00e35438522d38dd134ee7788de4b36..e8569e6fef5fefdd36e874e7efc2689e559871ff 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/compiler.h>
 #include <linux/err.h>
 #include <asm/io.h>
+#include <power/regulator.h>
 #include "designware.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -661,6 +662,22 @@ int designware_eth_probe(struct udevice *dev)
        ulong ioaddr;
        int ret;
 
+#if defined(CONFIG_DM_REGULATOR)
+       struct udevice *phy_supply;
+
+       ret = device_get_supply_regulator(dev, "phy-supply",
+                                         &phy_supply);
+       if (ret) {
+               debug("%s: No phy supply\n", dev->name);
+       } else {
+               ret = regulator_set_enable(phy_supply, true);
+               if (ret) {
+                       puts("Error enabling phy supply\n");
+                       return ret;
+               }
+       }
+#endif
+
 #ifdef CONFIG_DM_PCI
        /*
         * If we are on PCI bus, either directly attached to a PCI root port,