]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
net: macb: Fix issues with FPD off
authorKedareswara rao Appana <appana.durga.rao@xilinx.com>
Tue, 12 Sep 2017 12:55:39 +0000 (18:25 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 12 Sep 2017 14:19:45 +0000 (16:19 +0200)
After suspend/resume with FPD off
ethernet functionlaity is not working
with the existing driver.

This patch fixes this issue by implementing the
context store in the driver.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/ethernet/cadence/macb.c

index 9840f01f8508207c768e5fe8b6c3ba3af8fb6602..1b80a85a0f13b20fe63eb5deceb11fba6100ba4a 100644 (file)
@@ -3833,9 +3833,23 @@ static int __maybe_unused macb_suspend(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct net_device *netdev = platform_get_drvdata(pdev);
+       struct macb *bp = netdev_priv(netdev);
+       unsigned long flags;
 
-       if (netif_running(netdev))
-               macb_close(netdev);
+       if (!netif_running(netdev))
+               return 0;
+
+       netif_device_detach(netdev);
+       napi_disable(&bp->napi);
+       phy_stop(bp->phy_dev);
+       spin_lock_irqsave(&bp->lock, flags);
+       macb_reset_hw(bp);
+       netif_carrier_off(netdev);
+       spin_unlock_irqrestore(&bp->lock, flags);
+       if ((gem_readl(bp, DCFG5) & GEM_BIT(TSU)) &&
+           (bp->caps & MACB_CAPS_TSU))
+               macb_ptp_close(bp);
+       pm_runtime_force_suspend(dev);
 
        return 0;
 }
@@ -3844,9 +3858,19 @@ static int __maybe_unused macb_resume(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct net_device *netdev = platform_get_drvdata(pdev);
+       struct macb *bp = netdev_priv(netdev);
 
-       if (netif_running(netdev))
-               macb_open(netdev);
+       if (!netif_running(netdev))
+               return 0;
+
+       pm_runtime_force_resume(dev);
+       macb_writel(bp, NCR, MACB_BIT(MPE));
+       napi_enable(&bp->napi);
+       netif_carrier_on(netdev);
+       phy_start(bp->phy_dev);
+       bp->macbgem_ops.mog_init_rings(bp);
+       macb_init_hw(bp);
+       netif_device_attach(netdev);
 
        return 0;
 }