]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00286416 net:fec: Pinctrl PM: add net device running status check
authorFugang Duan <B38611@freescale.com>
Wed, 6 Nov 2013 05:36:23 +0000 (13:36 +0800)
committerFugang Duan <B38611@freescale.com>
Wed, 6 Nov 2013 06:00:48 +0000 (14:00 +0800)
In below case:
ifconfig eth0 down
echo mem > /sys/power/state

After resume, fec pin status set to default, which is not expected
and cost unnecessary power. So, add net device running status check
before calling Pinctrl PM APIs.

Signed-off-by: Fugang Duan <B38611@freescale.com>
drivers/net/ethernet/freescale/fec_main.c

index d48fb53eaebcfc672f06fe469b791aca5d244395..78773f7314b5ee5719a3af185a2bc64bbbdeed08 100644 (file)
@@ -2359,13 +2359,12 @@ fec_suspend(struct device *dev)
                fec_stop(ndev);
                netif_device_detach(ndev);
                fec_enet_clk_enable(ndev, false);
+               pinctrl_pm_select_sleep_state(&fep->pdev->dev);
        }
 
        if (fep->reg_phy)
                regulator_disable(fep->reg_phy);
 
-       pinctrl_pm_select_sleep_state(&fep->pdev->dev);
-
        return 0;
 }
 
@@ -2376,8 +2375,6 @@ fec_resume(struct device *dev)
        struct fec_enet_private *fep = netdev_priv(ndev);
        int ret;
 
-       pinctrl_pm_select_default_state(&fep->pdev->dev);
-
        if (fep->reg_phy) {
                ret = regulator_enable(fep->reg_phy);
                if (ret)
@@ -2385,6 +2382,7 @@ fec_resume(struct device *dev)
        }
 
        if (netif_running(ndev)) {
+               pinctrl_pm_select_default_state(&fep->pdev->dev);
                fec_enet_clk_enable(ndev, true);
                fec_restart(ndev, fep->full_duplex);
                netif_device_attach(ndev);