diff mbox

[U-Boot,v2] net: designware: Add phy supply support

Message ID 1490604857-1956-1-git-send-email-jacob2.chen@rock-chips.com
State Accepted
Commit 6ec922fae20f791882ee455286b1fefd5372a79a
Delegated to: Joe Hershberger
Headers show

Commit Message

Jacob Chen March 27, 2017, 8:54 a.m. UTC
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>
---

 drivers/net/designware.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Joe Hershberger March 27, 2017, 6:02 p.m. UTC | #1
On Mon, Mar 27, 2017 at 3:54 AM, Jacob Chen <jacob2.chen@rock-chips.com> wrote:
> 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>
Joe Hershberger June 2, 2017, 7:47 p.m. UTC | #2
Hi Jacob,

https://patchwork.ozlabs.org/patch/743661/ was applied to u-boot-net.git.

Thanks!
-Joe
diff mbox

Patch

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index f9fb8e0..0fcd125 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -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,