From: Adrian Hunter <adrian.hunter@intel.com>
To: Quentin Schulz <quentin.schulz@free-electrons.com>,
ludovic.desroches@microchip.com, ulf.hansson@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@free-electrons.com,
alexandre.belloni@free-electrons.com,
nicolas.ferre@microchip.com
Subject: Re: [PATCH 2/2] mmc: sdhci-of-at91: set clocks and presets after resume from deepest PM
Date: Tue, 20 Jun 2017 10:39:36 +0300 [thread overview]
Message-ID: <6acdfd61-afb8-e0cf-b8d3-b2e81bd71569@intel.com> (raw)
In-Reply-To: <20170616072929.3266-2-quentin.schulz@free-electrons.com>
On 16/06/17 10:29, Quentin Schulz wrote:
> This adds deepest (Backup+Self-Refresh) PM support to the ATMEL SAMA5D2
> SoC's SDHCI controller.
>
> When resuming from deepest state, it is required to restore preset
> registers as the registers are lost since VDD core has been shut down
> when entering deepest state on the SAMA5D2. The clocks need to be
> reconfigured as well.
>
> The other registers and init process are taken care of by the SDHCI
> core.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> ---
> drivers/mmc/host/sdhci-of-at91.c | 34 ++++++++++++++++++++++++++++++++--
> 1 file changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index fb8c6011f13d..300513fc1068 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -207,6 +207,37 @@ static int sdhci_at91_set_clks_presets(struct device *dev)
> }
>
> #ifdef CONFIG_PM
Should be CONFIG_PM_SLEEP for suspend / resume callbacks.
> +static int sdhci_at91_suspend(struct device *dev)
> +{
> + struct sdhci_host *host = dev_get_drvdata(dev);
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
> + int ret;
> +
> + ret = sdhci_suspend_host(host);
> +
> + if (host->runtime_suspended)
> + return ret;
Suspending while runtime suspended seems like a bad idea. Have you
considered just adding sdhci_at91_set_clks_presets() to
sdhci_at91_runtime_resume()?
> +
> + clk_disable_unprepare(priv->gck);
> + clk_disable_unprepare(priv->hclock);
> + clk_disable_unprepare(priv->mainck);
> +
> + return ret;
> +}
> +
> +static int sdhci_at91_resume(struct device *dev)
> +{
> + struct sdhci_host *host = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = sdhci_at91_set_clks_presets(dev);
> + if (ret)
> + return ret;
> +
> + return sdhci_resume_host(host);
> +}
> +
> static int sdhci_at91_runtime_suspend(struct device *dev)
> {
> struct sdhci_host *host = dev_get_drvdata(dev);
> @@ -256,8 +287,7 @@ static int sdhci_at91_runtime_resume(struct device *dev)
> #endif /* CONFIG_PM */
>
> static const struct dev_pm_ops sdhci_at91_dev_pm_ops = {
> - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> - pm_runtime_force_resume)
> + SET_SYSTEM_SLEEP_PM_OPS(sdhci_at91_suspend, sdhci_at91_resume)
> SET_RUNTIME_PM_OPS(sdhci_at91_runtime_suspend,
> sdhci_at91_runtime_resume,
> NULL)
>
next prev parent reply other threads:[~2017-06-20 7:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-16 7:29 [PATCH 1/2] mmc: sdhci-of-at91: factor out clks and presets setting Quentin Schulz
2017-06-16 7:29 ` [PATCH 2/2] mmc: sdhci-of-at91: set clocks and presets after resume from deepest PM Quentin Schulz
2017-06-20 6:33 ` Ludovic Desroches
2017-06-20 7:39 ` Adrian Hunter [this message]
2017-06-20 8:07 ` Quentin Schulz
2017-06-20 9:49 ` Ludovic Desroches
2017-07-05 6:23 ` Quentin Schulz
2017-07-05 6:45 ` Quentin Schulz
2017-07-06 7:59 ` Adrian Hunter
2017-07-11 12:42 ` Ulf Hansson
2017-07-11 13:33 ` Ludovic Desroches
2017-07-11 13:54 ` Ulf Hansson
2017-07-11 14:36 ` Ludovic Desroches
2017-06-20 6:31 ` [PATCH 1/2] mmc: sdhci-of-at91: factor out clks and presets setting Ludovic Desroches
2017-06-20 6:36 ` Adrian Hunter
2017-06-20 8:11 ` Quentin Schulz
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=6acdfd61-afb8-e0cf-b8d3-b2e81bd71569@intel.com \
--to=adrian.hunter@intel.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.com \
--cc=quentin.schulz@free-electrons.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=ulf.hansson@linaro.org \
/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