]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: stmmac: dwmac-mediatek: enable Ethernet power domain
authorBiao Huang <biao.huang@mediatek.com>
Mon, 3 Jun 2019 01:58:03 +0000 (09:58 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Jun 2019 00:03:14 +0000 (17:03 -0700)
add Ethernet power on/off operations in init/exit flow.

Signed-off-by: Biao Huang <biao.huang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c

index 126b66bb73a62a8e1c7dc6cdcd6541501c745183..b84269edd1b4bbf7b16b9ec246333f2a57a91f09 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_net.h>
+#include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <linux/stmmac.h>
 
@@ -298,6 +299,9 @@ static int mediatek_dwmac_init(struct platform_device *pdev, void *priv)
                return ret;
        }
 
+       pm_runtime_enable(&pdev->dev);
+       pm_runtime_get_sync(&pdev->dev);
+
        return 0;
 }
 
@@ -307,6 +311,9 @@ static void mediatek_dwmac_exit(struct platform_device *pdev, void *priv)
        const struct mediatek_dwmac_variant *variant = plat->variant;
 
        clk_bulk_disable_unprepare(variant->num_clks, plat->clks);
+
+       pm_runtime_put_sync(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
 }
 
 static int mediatek_dwmac_probe(struct platform_device *pdev)