mirror of https://gitee.com/openkylin/linux.git
net: stmmac: restore pinstate in pm resume.
This patch adds code to restore default pinstate of the pins when it comes back from low power state. Without this patch the state of the pins would be unknown and the driver would not work. This patch also adds code to put the pins in to sleep state when the driver enters low power state. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
33a23e2237
commit
db88f10ad6
|
@ -43,6 +43,7 @@
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/prefetch.h>
|
#include <linux/prefetch.h>
|
||||||
|
#include <linux/pinctrl/consumer.h>
|
||||||
#ifdef CONFIG_STMMAC_DEBUG_FS
|
#ifdef CONFIG_STMMAC_DEBUG_FS
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
|
@ -2864,6 +2865,7 @@ int stmmac_suspend(struct net_device *ndev)
|
||||||
priv->hw->mac->pmt(priv->ioaddr, priv->wolopts);
|
priv->hw->mac->pmt(priv->ioaddr, priv->wolopts);
|
||||||
else {
|
else {
|
||||||
stmmac_set_mac(priv->ioaddr, false);
|
stmmac_set_mac(priv->ioaddr, false);
|
||||||
|
pinctrl_pm_select_sleep_state(priv->device);
|
||||||
/* Disable clock in case of PWM is off */
|
/* Disable clock in case of PWM is off */
|
||||||
clk_disable_unprepare(priv->stmmac_clk);
|
clk_disable_unprepare(priv->stmmac_clk);
|
||||||
}
|
}
|
||||||
|
@ -2890,6 +2892,7 @@ int stmmac_resume(struct net_device *ndev)
|
||||||
if (device_may_wakeup(priv->device)) {
|
if (device_may_wakeup(priv->device)) {
|
||||||
priv->hw->mac->pmt(priv->ioaddr, 0);
|
priv->hw->mac->pmt(priv->ioaddr, 0);
|
||||||
} else {
|
} else {
|
||||||
|
pinctrl_pm_select_default_state(priv->device);
|
||||||
/* enable the clk prevously disabled */
|
/* enable the clk prevously disabled */
|
||||||
clk_prepare_enable(priv->stmmac_clk);
|
clk_prepare_enable(priv->stmmac_clk);
|
||||||
/* reset the phy so that it's ready */
|
/* reset the phy so that it's ready */
|
||||||
|
|
Loading…
Reference in New Issue