From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: "mkl@pengutronix.de" <mkl@pengutronix.de>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
"sean@geanix.com" <sean@geanix.com>
Cc: "wg@grandegger.com" <wg@grandegger.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>,
Joakim Zhang <qiangqing.zhang@nxp.com>
Subject: [PATCH REPOST 2/2] can: flexcan: add LPSR mode support for i.MX7D
Date: Fri, 16 Aug 2019 08:20:44 +0000 [thread overview]
Message-ID: <20190816081749.19300-3-qiangqing.zhang@nxp.com> (raw)
In-Reply-To: <20190816081749.19300-1-qiangqing.zhang@nxp.com>
For i.MX7D LPSR mode, the controller will lost power and got the
configuration state lost after system resume back. (coming i.MX8QM/QXP
will also completely power off the domain, the controller state will be
lost and needs restore).
So we need to set pinctrl state again and re-start chip to do
re-configuration after resume.
For wakeup case, it should not set pinctrl to sleep state by
pinctrl_pm_select_sleep_state.
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: Joakim Zhang <qiangqing.zhang@nxp.com>
ChangeLog:
V1->V2:
* rebase on linux-can/testing.
* move into a patch set.
---
drivers/net/can/flexcan.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index de2bf71b335b..b3edaf6a5a61 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -25,6 +25,7 @@
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
+#include <linux/pinctrl/consumer.h>
#include <linux/regmap.h>
#define DRV_NAME "flexcan"
@@ -1640,9 +1641,9 @@ static int __maybe_unused flexcan_suspend(struct device *device)
priv->in_stop_mode = true;
} else {
- err = flexcan_chip_disable(priv);
- if (err)
- return err;
+ flexcan_chip_stop(dev);
+
+ pinctrl_pm_select_sleep_state(device);
}
netif_stop_queue(dev);
netif_device_detach(dev);
@@ -1674,7 +1675,9 @@ static int __maybe_unused flexcan_resume(struct device *device)
disable_irq_wake(dev->irq);
} else {
- err = flexcan_chip_enable(priv);
+ pinctrl_pm_select_default_state(device);
+
+ err = flexcan_chip_start(dev);
if (err)
return err;
}
--
2.17.1
prev parent reply other threads:[~2019-08-16 8:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 8:20 [PATCH REPOST 0/2] can: flexcan: fix PM and wakeup issue Joakim Zhang
2019-08-16 8:20 ` [PATCH REPOST 1/2] can: flexcan: fix deadlock when using self wakeup Joakim Zhang
2019-08-20 10:25 ` Sean Nyekjaer
2019-08-20 11:24 ` Joakim Zhang
2019-08-20 11:55 ` Sean Nyekjaer
2019-08-28 13:24 ` Sean Nyekjaer
2019-08-29 7:30 ` Joakim Zhang
2019-09-05 5:57 ` Sean Nyekjaer
2019-09-05 7:10 ` Joakim Zhang
2019-09-05 13:17 ` Sean Nyekjaer
2019-09-05 15:24 ` Marc Kleine-Budde
2019-09-06 2:11 ` Joakim Zhang
2019-09-10 7:52 ` Sean Nyekjaer
2019-10-08 10:20 ` Joakim Zhang
2019-08-20 11:56 ` Joakim Zhang
2019-08-16 8:20 ` Joakim Zhang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190816081749.19300-3-qiangqing.zhang@nxp.com \
--to=qiangqing.zhang@nxp.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=sean@geanix.com \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).