Skip to content

Commit

Permalink
net: gmac_rockchip: Add phy supply support
Browse files Browse the repository at this point in the history
Some board need a regulator for gmac phy, so add this code to handle it.

Change-Id: Icf787e48d3519c0f7b03d772c776e118bc2c256f
Signed-off-by: Jacob Chen <[email protected]>
  • Loading branch information
wzyy2 committed Mar 15, 2017
1 parent 55a96bc commit e205b79
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions drivers/net/gmac_rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <asm/arch/grf_rk3288.h>
#include <dm/pinctrl.h>
#include <dt-bindings/clock/rk3288-cru.h>
#include <power/regulator.h>
#include "designware.h"

DECLARE_GLOBAL_DATA_PTR;
Expand Down Expand Up @@ -79,6 +80,22 @@ static int gmac_rockchip_probe(struct udevice *dev)
struct clk clk;
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

ret = clk_get_by_index(dev, 0, &clk);
if (ret)
return ret;
Expand Down

0 comments on commit e205b79

Please sign in to comment.