From: Peter Chen <peter.chen@kernel.org>
To: Frank Li <lznuaa@gmail.com>
Cc: pawell@cadence.com, a-govindraju@ti.com, linux-imx@nxp.com,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v1 2/2] usb: cdns3: imx: add power lost support for system resume
Date: Sat, 6 Mar 2021 11:13:43 +0800 [thread overview]
Message-ID: <20210306031343.GA28902@b29397-desktop> (raw)
In-Reply-To: <20210218225109.265730-2-Frank.Li@nxp.com>
On 21-02-18 16:51:09, Frank Li wrote:
> From: Frank Li <Frank.li@nxp.com>
>
> imx need special handle when controller lost power
>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Applied both, thanks.
Peter
> ---
> split imx part
>
> drivers/usb/cdns3/cdns3-imx.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/drivers/usb/cdns3/cdns3-imx.c b/drivers/usb/cdns3/cdns3-imx.c
> index 8f88eec0b0ea..708b51cc5844 100644
> --- a/drivers/usb/cdns3/cdns3-imx.c
> +++ b/drivers/usb/cdns3/cdns3-imx.c
> @@ -361,6 +361,39 @@ static int cdns_imx_suspend(struct device *dev)
>
> return 0;
> }
> +
> +
> +/* Indicate if the controller was power lost before */
> +static inline bool cdns_imx_is_power_lost(struct cdns_imx *data)
> +{
> + u32 value;
> +
> + value = cdns_imx_readl(data, USB3_CORE_CTRL1);
> + if ((value & SW_RESET_MASK) == ALL_SW_RESET)
> + return true;
> + else
> + return false;
> +}
> +
> +static int cdns_imx_system_resume(struct device *dev)
> +{
> + struct cdns_imx *data = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = cdns_imx_resume(dev);
> + if (ret)
> + return ret;
> +
> + if (cdns_imx_is_power_lost(data)) {
> + dev_dbg(dev, "resume from power lost\n");
> + ret = cdns_imx_noncore_init(data);
> + if (ret)
> + cdns_imx_suspend(dev);
> + }
> +
> + return ret;
> +}
> +
> #else
> static int cdns_imx_platform_suspend(struct device *dev,
> bool suspend, bool wakeup)
> @@ -372,6 +405,7 @@ static int cdns_imx_platform_suspend(struct device *dev,
>
> static const struct dev_pm_ops cdns_imx_pm_ops = {
> SET_RUNTIME_PM_OPS(cdns_imx_suspend, cdns_imx_resume, NULL)
> + SET_SYSTEM_SLEEP_PM_OPS(cdns_imx_suspend, cdns_imx_system_resume)
> };
>
> static const struct of_device_id cdns_imx_of_match[] = {
> --
> 2.25.1
>
--
Thanks,
Peter Chen
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2021-03-06 3:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 22:51 [PATCH v4 1/2] usb: cdns3: add power lost support for system resume Frank Li
2021-02-18 22:51 ` [PATCH v1 2/2] usb: cdns3: imx: " Frank Li
2021-03-06 3:13 ` Peter Chen [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=20210306031343.GA28902@b29397-desktop \
--to=peter.chen@kernel.org \
--cc=a-govindraju@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=lznuaa@gmail.com \
--cc=pawell@cadence.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).