net: stmmac: dwmac-rk: add pd_gmac support for rk3399

Add the gmac power domain support for rk3399, in order to save more
power consumption.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David Wu 2016-09-02 01:50:01 +08:00 committed by David S. Miller
parent 45383f528f
commit 2c896fb02e
1 changed files with 9 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/pm_runtime.h>
#include "stmmac_platform.h" #include "stmmac_platform.h"
@ -883,11 +884,19 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
if (ret) if (ret)
return ret; return ret;
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
return 0; return 0;
} }
static void rk_gmac_powerdown(struct rk_priv_data *gmac) static void rk_gmac_powerdown(struct rk_priv_data *gmac)
{ {
struct device *dev = &gmac->pdev->dev;
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
phy_power_on(gmac, false); phy_power_on(gmac, false);
gmac_clk_enable(gmac, false); gmac_clk_enable(gmac, false);
} }