summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale/fec.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-06-27 03:45:21 +0000
committerDavid S. Miller <davem@davemloft.net>2012-06-27 21:22:05 -0700
commit5fa9c0fe3ec0a008352d4a4fb8d972a437183404 (patch)
tree576bb2ec1ab0a6cd26cf170785f33b230b0db61e /drivers/net/ethernet/freescale/fec.c
parent2ca9b2aa0d5a43e954789e0da675a826b83932b7 (diff)
downloadlinux-5fa9c0fe3ec0a008352d4a4fb8d972a437183404.tar.gz
linux-5fa9c0fe3ec0a008352d4a4fb8d972a437183404.tar.bz2
linux-5fa9c0fe3ec0a008352d4a4fb8d972a437183404.zip
net: fec: enable regulator for fec phy
If bootloader or platform initialization code does not enable the power supply to fec phy, we need to do it in fec driver before calling fec_reset_phy to have the phy powered on. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale/fec.c')
-rw-r--r--drivers/net/ethernet/freescale/fec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index e868a377c898..4dce9e3ac83a 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -49,6 +49,7 @@
#include <linux/of_gpio.h>
#include <linux/of_net.h>
#include <linux/pinctrl/consumer.h>
+#include <linux/regulator/consumer.h>
#include <asm/cacheflush.h>
@@ -1546,6 +1547,7 @@ fec_probe(struct platform_device *pdev)
const struct of_device_id *of_id;
static int dev_id;
struct pinctrl *pinctrl;
+ struct regulator *reg_phy;
of_id = of_match_device(fec_dt_ids, &pdev->dev);
if (of_id)
@@ -1632,6 +1634,16 @@ fec_probe(struct platform_device *pdev)
clk_prepare_enable(fep->clk_ahb);
clk_prepare_enable(fep->clk_ipg);
+ reg_phy = devm_regulator_get(&pdev->dev, "phy");
+ if (!IS_ERR(reg_phy)) {
+ ret = regulator_enable(reg_phy);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "Failed to enable phy regulator: %d\n", ret);
+ goto failed_regulator;
+ }
+ }
+
fec_reset_phy(pdev);
ret = fec_enet_init(ndev);
@@ -1655,6 +1667,7 @@ failed_register:
fec_enet_mii_remove(fep);
failed_mii_init:
failed_init:
+failed_regulator:
clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg);
failed_pin: