提交 5bbde4d2 编写于 作者: N Nimrod Andy 提交者: David S. Miller

net: fec: use pinctrl PM helpers

when system suspend, need to set pins to low power state to
save IO power consumption, there are three states of pinctrl:
"default", "idle" and "sleep". Currently enet supports default
and sleep state.
Signed-off-by: NFugang Duan <B38611@freescale.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ce25b68b
...@@ -1816,6 +1816,7 @@ fec_enet_open(struct net_device *ndev) ...@@ -1816,6 +1816,7 @@ fec_enet_open(struct net_device *ndev)
struct fec_enet_private *fep = netdev_priv(ndev); struct fec_enet_private *fep = netdev_priv(ndev);
int ret; int ret;
pinctrl_pm_select_default_state(&fep->pdev->dev);
ret = fec_enet_clk_enable(ndev, true); ret = fec_enet_clk_enable(ndev, true);
if (ret) if (ret)
return ret; return ret;
...@@ -1859,6 +1860,7 @@ fec_enet_close(struct net_device *ndev) ...@@ -1859,6 +1860,7 @@ fec_enet_close(struct net_device *ndev)
} }
fec_enet_clk_enable(ndev, false); fec_enet_clk_enable(ndev, false);
pinctrl_pm_select_sleep_state(&fep->pdev->dev);
fec_enet_free_buffers(ndev); fec_enet_free_buffers(ndev);
return 0; return 0;
...@@ -2162,6 +2164,9 @@ fec_probe(struct platform_device *pdev) ...@@ -2162,6 +2164,9 @@ fec_probe(struct platform_device *pdev)
fep->pause_flag |= FEC_PAUSE_FLAG_AUTONEG; fep->pause_flag |= FEC_PAUSE_FLAG_AUTONEG;
#endif #endif
/* Select default pin state */
pinctrl_pm_select_default_state(&pdev->dev);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
fep->hwp = devm_ioremap_resource(&pdev->dev, r); fep->hwp = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(fep->hwp)) { if (IS_ERR(fep->hwp)) {
...@@ -2258,6 +2263,7 @@ fec_probe(struct platform_device *pdev) ...@@ -2258,6 +2263,7 @@ fec_probe(struct platform_device *pdev)
/* Carrier starts down, phylib will bring it up */ /* Carrier starts down, phylib will bring it up */
netif_carrier_off(ndev); netif_carrier_off(ndev);
fec_enet_clk_enable(ndev, false); fec_enet_clk_enable(ndev, false);
pinctrl_pm_select_sleep_state(&pdev->dev);
ret = register_netdev(ndev); ret = register_netdev(ndev);
if (ret) if (ret)
...@@ -2317,6 +2323,7 @@ fec_suspend(struct device *dev) ...@@ -2317,6 +2323,7 @@ fec_suspend(struct device *dev)
netif_device_detach(ndev); netif_device_detach(ndev);
} }
fec_enet_clk_enable(ndev, false); fec_enet_clk_enable(ndev, false);
pinctrl_pm_select_sleep_state(&fep->pdev->dev);
if (fep->reg_phy) if (fep->reg_phy)
regulator_disable(fep->reg_phy); regulator_disable(fep->reg_phy);
...@@ -2337,6 +2344,7 @@ fec_resume(struct device *dev) ...@@ -2337,6 +2344,7 @@ fec_resume(struct device *dev)
return ret; return ret;
} }
pinctrl_pm_select_default_state(&fep->pdev->dev);
ret = fec_enet_clk_enable(ndev, true); ret = fec_enet_clk_enable(ndev, true);
if (ret) if (ret)
goto failed_clk; goto failed_clk;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册