From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: "mkl@pengutronix.de" <mkl@pengutronix.de>,
"sean@geanix.com" <sean@geanix.com>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Cc: dl-linux-imx <linux-imx@nxp.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [PATCH V2 4/4] can: flexcan: add LPSR mode support
Date: Wed, 4 Dec 2019 02:25:30 +0000 [thread overview]
Message-ID: <DB7PR04MB46186030E16AE49DB8503246E65D0@DB7PR04MB4618.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20191127055334.1476-5-qiangqing.zhang@nxp.com>
Hi Marc,
You may have missed this patch, any comments about it?
Best Regards,
Joakim Zhang
> -----Original Message-----
> From: Joakim Zhang <qiangqing.zhang@nxp.com>
> Sent: 2019年11月27日 13:57
> To: mkl@pengutronix.de; sean@geanix.com; linux-can@vger.kernel.org
> Cc: dl-linux-imx <linux-imx@nxp.com>; netdev@vger.kernel.org; Joakim Zhang
> <qiangqing.zhang@nxp.com>
> Subject: [PATCH V2 4/4] can: flexcan: add LPSR mode support
>
> 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: no change.
> ---
> drivers/net/can/flexcan.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index
> d178146b3da5..d1509cffdd24 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
> @@ -26,6 +26,7 @@
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/pinctrl/consumer.h>
> #include <linux/regmap.h>
>
> #define DRV_NAME "flexcan"
> @@ -1707,7 +1708,7 @@ 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;
> + int err;
>
> if (netif_running(dev)) {
> /* if wakeup is enabled, enter stop mode @@ -1719,25 +1720,27
> @@ static int __maybe_unused flexcan_suspend(struct device *device)
> if (err)
> return err;
> } else {
> - err = flexcan_chip_disable(priv);
> + flexcan_chip_stop(dev);
> +
> + err = pm_runtime_force_suspend(device);
> if (err)
> return err;
>
> - err = pm_runtime_force_suspend(device);
> + pinctrl_pm_select_sleep_state(device);
> }
> netif_stop_queue(dev);
> netif_device_detach(dev);
> }
> priv->can.state = CAN_STATE_SLEEPING;
>
> - return err;
> + return 0;
> }
>
> static int __maybe_unused flexcan_resume(struct device *device) {
> struct net_device *dev = dev_get_drvdata(device);
> struct flexcan_priv *priv = netdev_priv(dev);
> - int err = 0;
> + int err;
>
> priv->can.state = CAN_STATE_ERROR_ACTIVE;
> if (netif_running(dev)) {
> @@ -1749,15 +1752,19 @@ static int __maybe_unused
> flexcan_resume(struct device *device)
> if (err)
> return err;
> } else {
> + pinctrl_pm_select_default_state(device);
> +
> err = pm_runtime_force_resume(device);
> if (err)
> return err;
>
> - err = flexcan_chip_enable(priv);
> + err = flexcan_chip_start(dev);
> + if (err)
> + return err;
> }
> }
>
> - return err;
> + return 0;
> }
>
> static int __maybe_unused flexcan_runtime_suspend(struct device *device)
> --
> 2.17.1
next prev parent reply other threads:[~2019-12-04 2:25 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 5:56 [PATCH V2 0/4] can: flexcan: fixes for stop mode Joakim Zhang
2019-11-27 5:56 ` [PATCH V2 1/4] can: flexcan: fix deadlock when using self wakeup Joakim Zhang
2019-11-27 9:58 ` Sean Nyekjaer
2019-12-03 17:25 ` Marc Kleine-Budde
2019-12-03 17:42 ` Marc Kleine-Budde
2019-12-04 1:58 ` Joakim Zhang
2019-12-04 8:31 ` Marc Kleine-Budde
2019-12-04 8:35 ` Joakim Zhang
2019-11-27 5:56 ` [PATCH V2 2/4] can: flexcan: try to exit stop mode during probe stage Joakim Zhang
2019-11-27 9:58 ` Sean Nyekjaer
2019-12-03 18:14 ` Marc Kleine-Budde
2019-12-04 2:22 ` Joakim Zhang
2019-12-04 8:45 ` Marc Kleine-Budde
2019-12-04 9:58 ` Joakim Zhang
2019-12-05 8:46 ` Joakim Zhang
2019-12-05 9:21 ` Sean Nyekjaer
2019-12-05 11:04 ` Joakim Zhang
2019-12-05 11:11 ` Sean Nyekjaer
2019-12-05 11:19 ` Joakim Zhang
2019-12-05 11:32 ` Sean Nyekjaer
2019-12-07 20:32 ` Marc Kleine-Budde
2019-12-08 10:47 ` Sean Nyekjaer
2019-12-08 10:56 ` Marc Kleine-Budde
2019-11-27 5:56 ` [PATCH V2 3/4] can: flexcan: change the way of stop mode acknowledgment Joakim Zhang
2019-11-27 9:58 ` Sean Nyekjaer
2019-12-03 18:21 ` Marc Kleine-Budde
2019-12-04 2:23 ` Joakim Zhang
2019-11-27 5:56 ` [PATCH V2 4/4] can: flexcan: add LPSR mode support Joakim Zhang
2019-12-04 2:25 ` Joakim Zhang [this message]
2019-12-04 8:59 ` Marc Kleine-Budde
2019-12-04 9:58 ` Joakim Zhang
2019-12-04 9:20 ` Marc Kleine-Budde
2019-12-04 9:59 ` Joakim Zhang
2019-12-04 10:58 ` Joakim Zhang
2019-11-27 6:12 ` [PATCH V2 0/4] can: flexcan: fixes for stop mode Sean Nyekjaer
2019-11-27 8:12 ` Sean Nyekjaer
2019-11-27 9:36 ` Joakim Zhang
2019-11-27 9:48 ` Joakim Zhang
2019-11-27 9:52 ` Sean Nyekjaer
2019-11-27 9:58 ` Joakim Zhang
2019-11-27 9:59 ` Sean Nyekjaer
2019-11-27 10:04 ` Joakim Zhang
2019-12-03 10:16 ` Joakim Zhang
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=DB7PR04MB46186030E16AE49DB8503246E65D0@DB7PR04MB4618.eurprd04.prod.outlook.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 \
/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).