diff options
author | Dong Aisheng <aisheng.dong@nxp.com> | 2016-03-04 16:11:40 +0800 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2016-03-04 22:17:15 +0800 |
commit | 0eb2a24ff42eace4289e8d131cbc5aac66dbcd80 (patch) | |
tree | b20efd2dbca0024ce632efbbe0867c8fc2c6e09f | |
parent | 06291d2c21c80adf139e7c1b46eb4441c7dcf81d (diff) |
MLK-12478-1 can: flexcan: add LPSR mode support
For MX7D LPSR mode, the controller will lost power and got the
configuration state lost after system resume back.
So we need to set pinctrl state again and re-start chip to do
re-configuration after resume.
For wakeup case, we also need re-configure the chip in case the state
got lost. For interface is not up before suspend case, we don't need
re-configure as it will be configured by user later by interface up.
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
(cherry picked from commit c26587d5ba9e30fce318c2fea516e9e4a6bde9ca)
-rw-r--r-- | drivers/net/can/flexcan.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 6268b1be0718..e635702f679e 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1376,7 +1376,6 @@ static int __maybe_unused flexcan_suspend(struct device *device) { struct net_device *dev = dev_get_drvdata(device); struct flexcan_priv *priv = netdev_priv(dev); - int err = 0; if (netif_running(dev)) { netif_stop_queue(dev); @@ -1389,12 +1388,14 @@ static int __maybe_unused flexcan_suspend(struct device *device) enable_irq_wake(dev->irq); flexcan_enter_stop_mode(priv); } else { - err = flexcan_chip_disable(priv); + flexcan_chip_stop(dev); } } priv->can.state = CAN_STATE_SLEEPING; - return err; + pinctrl_pm_select_sleep_state(device); + + return 0; } static int __maybe_unused flexcan_resume(struct device *device) @@ -1403,6 +1404,8 @@ static int __maybe_unused flexcan_resume(struct device *device) struct flexcan_priv *priv = netdev_priv(dev); int err = 0; + pinctrl_pm_select_default_state(device); + priv->can.state = CAN_STATE_ERROR_ACTIVE; if (netif_running(dev)) { netif_device_attach(dev); @@ -1411,9 +1414,9 @@ static int __maybe_unused flexcan_resume(struct device *device) if (device_may_wakeup(device)) { disable_irq_wake(dev->irq); flexcan_exit_stop_mode(priv); - } else { - err = flexcan_chip_enable(priv); } + + err = flexcan_chip_start(dev); } return err; |