diff options
author | Dong Aisheng <b29396@freescale.com> | 2012-08-03 22:33:08 +0800 |
---|---|---|
committer | Dong Aisheng <b29396@freescale.com> | 2012-08-06 14:52:48 +0800 |
commit | 43ac1c3cbfa629ebbeb2efc5e41d2b5a9fc67323 (patch) | |
tree | 3af618c0c43dd8dc335c172471545955378ea566 /drivers/net | |
parent | 985dfc4e80820598b35b1b348a4c23b64b035ff3 (diff) |
ENGR00217318-3 flexcan: only enter stop mode when device is up
The flexcan is still in disable mode during suspend if it's still
not up. We do not need to enter stop mode if find the device is not
up since the stop mode does not work well in disable mode(remote wakeup
does not work).
Using disable mode for suspend if it's not up.
Signed-off-by: Dong Aisheng <b29396@freescale.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/can/flexcan.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 1d1c224c8854..920b8a01f9cb 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1091,15 +1091,16 @@ static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) if (netif_running(dev)) { netif_stop_queue(dev); netif_device_detach(dev); - } - priv->can.state = CAN_STATE_SLEEPING; + /* enter stop mode if device is up */ + flexcan_enter_stop(priv); - flexcan_enter_stop(priv); + ret = irq_set_irq_wake(dev->irq, 1); + if (ret) + return ret; + } - ret = irq_set_irq_wake(dev->irq, 1); - if (ret) - return ret; + priv->can.state = CAN_STATE_SLEEPING; return 0; } @@ -1110,15 +1111,15 @@ static int flexcan_resume(struct platform_device *pdev) struct flexcan_priv *priv = netdev_priv(dev); int ret; - ret = irq_set_irq_wake(dev->irq, 0); - if (ret) - return ret; - - flexcan_exit_stop(priv); - priv->can.state = CAN_STATE_ERROR_ACTIVE; if (netif_running(dev)) { + ret = irq_set_irq_wake(dev->irq, 0); + if (ret) + return ret; + + flexcan_exit_stop(priv); + netif_device_attach(dev); netif_start_queue(dev); } |