]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: freescale: fec: Fix ethtool -d runtime PM
authorAndrew Lunn <andrew@lunn.ch>
Thu, 2 Jan 2020 14:33:34 +0000 (15:33 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Jan 2020 00:38:09 +0000 (16:38 -0800)
In order to dump the FECs registers the clocks have to be ticking,
otherwise a data abort occurs.  Add calls to runtime PM so they are
enabled and later disabled.

Fixes: 229950af2928 ("net: fec: optimize the clock management to save power")
Reported-by: Chris Healy <Chris.Healy@zii.aero>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c

index 05c1899f6628990e14e167e338fcc435c2ecea52..9294027e9d909836cf211c3955d75bc81c97de15 100644 (file)
@@ -2199,8 +2199,14 @@ static void fec_enet_get_regs(struct net_device *ndev,
 {
        struct fec_enet_private *fep = netdev_priv(ndev);
        u32 __iomem *theregs = (u32 __iomem *)fep->hwp;
+       struct device *dev = &fep->pdev->dev;
        u32 *buf = (u32 *)regbuf;
        u32 i, off;
+       int ret;
+
+       ret = pm_runtime_get_sync(dev);
+       if (ret < 0)
+               return;
 
        regs->version = fec_enet_register_version;
 
@@ -2216,6 +2222,9 @@ static void fec_enet_get_regs(struct net_device *ndev,
                off >>= 2;
                buf[off] = readl(&theregs[off]);
        }
+
+       pm_runtime_mark_last_busy(dev);
+       pm_runtime_put_autosuspend(dev);
 }
 
 static int fec_enet_get_ts_info(struct net_device *ndev,