aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale/fec.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-06-26 23:45:21 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-28 00:22:05 -0400
commit5fa9c0fe3ec0a008352d4a4fb8d972a437183404 (patch)
tree576bb2ec1ab0a6cd26cf170785f33b230b0db61e /drivers/net/ethernet/freescale/fec.c
parent2ca9b2aa0d5a43e954789e0da675a826b83932b7 (diff)
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 @@
49#include <linux/of_gpio.h> 49#include <linux/of_gpio.h>
50#include <linux/of_net.h> 50#include <linux/of_net.h>
51#include <linux/pinctrl/consumer.h> 51#include <linux/pinctrl/consumer.h>
52#include <linux/regulator/consumer.h>
52 53
53#include <asm/cacheflush.h> 54#include <asm/cacheflush.h>
54 55
@@ -1546,6 +1547,7 @@ fec_probe(struct platform_device *pdev)
1546 const struct of_device_id *of_id; 1547 const struct of_device_id *of_id;
1547 static int dev_id; 1548 static int dev_id;
1548 struct pinctrl *pinctrl; 1549 struct pinctrl *pinctrl;
1550 struct regulator *reg_phy;
1549 1551
1550 of_id = of_match_device(fec_dt_ids, &pdev->dev); 1552 of_id = of_match_device(fec_dt_ids, &pdev->dev);
1551 if (of_id) 1553 if (of_id)
@@ -1632,6 +1634,16 @@ fec_probe(struct platform_device *pdev)
1632 clk_prepare_enable(fep->clk_ahb); 1634 clk_prepare_enable(fep->clk_ahb);
1633 clk_prepare_enable(fep->clk_ipg); 1635 clk_prepare_enable(fep->clk_ipg);
1634 1636
1637 reg_phy = devm_regulator_get(&pdev->dev, "phy");
1638 if (!IS_ERR(reg_phy)) {
1639 ret = regulator_enable(reg_phy);
1640 if (ret) {
1641 dev_err(&pdev->dev,
1642 "Failed to enable phy regulator: %d\n", ret);
1643 goto failed_regulator;
1644 }
1645 }
1646
1635 fec_reset_phy(pdev); 1647 fec_reset_phy(pdev);
1636 1648
1637 ret = fec_enet_init(ndev); 1649 ret = fec_enet_init(ndev);
@@ -1655,6 +1667,7 @@ failed_register:
1655 fec_enet_mii_remove(fep); 1667 fec_enet_mii_remove(fep);
1656failed_mii_init: 1668failed_mii_init:
1657failed_init: 1669failed_init:
1670failed_regulator:
1658 clk_disable_unprepare(fep->clk_ahb); 1671 clk_disable_unprepare(fep->clk_ahb);
1659 clk_disable_unprepare(fep->clk_ipg); 1672 clk_disable_unprepare(fep->clk_ipg);
1660failed_pin: 1673failed_pin: