From: Jaehoon Chung <jh80.chung@samsung.com>
To: Shawn Lin <shawn.lin@rock-chips.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, Doug Anderson <dianders@chromium.org>,
linux-rockchip@lists.infradead.org
Subject: Re: [RFC PATCH v2 1/4] mmc: dw_mmc: add runtime PM callback
Date: Fri, 07 Oct 2016 13:12:54 +0900 [thread overview]
Message-ID: <2dd84d82-a14b-7d5e-80f0-89e6c0b1aaae@samsung.com> (raw)
In-Reply-To: <1475225317-2815-2-git-send-email-shawn.lin@rock-chips.com>
Hi Shawn,
On 09/30/2016 05:48 PM, Shawn Lin wrote:
> This patch add dw_mci_runtime_suspend/resume interfaces
> and expose it to dw_mci variant driver to support runtime
> PM.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> ---
>
> drivers/mmc/host/dw_mmc.c | 60 +++++++++++++++++++++++++++++++++++++++++++++--
> drivers/mmc/host/dw_mmc.h | 4 +++-
> 2 files changed, 61 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 4fcbc40..54b860e 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3266,7 +3266,7 @@ EXPORT_SYMBOL(dw_mci_remove);
>
>
>
> -#ifdef CONFIG_PM_SLEEP
> +#ifdef CONFIG_PM
> /*
> * TODO: we should probably disable the clock to the card in the suspend path.
> */
> @@ -3324,7 +3324,63 @@ int dw_mci_resume(struct dw_mci *host)
> return 0;
> }
> EXPORT_SYMBOL(dw_mci_resume);
> -#endif /* CONFIG_PM_SLEEP */
> +
> +int dw_mci_runtime_suspend(struct dw_mci *host)
> +{
> + printk("dw_mci_runtime_suspend\n");
Maybe I think you will remove this..if you send the patch, not RFC.
> +
> + if (host->use_dma && host->dma_ops->exit)
> + host->dma_ops->exit(host);
Can just call dw_mci_suspend()
> +
> + clk_disable_unprepare(host->ciu_clk);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(dw_mci_runtime_suspend);
> +
> +int dw_mci_runtime_resume(struct dw_mci *host)
> +{
> + int ret = 0;
> + int i;
Can make one line.
> +
> + printk("dw_mci_runtime_resume\n");
> +
> + ret = clk_prepare_enable(host->ciu_clk);
> + if (ret)
> + return ret;
> +
> + if (host->use_dma && host->dma_ops->init)
> + host->dma_ops->init(host);
> +
> + mci_writel(host, FIFOTH, host->fifoth_val);
> + host->prev_blksz = 0;
> +
> + mci_writel(host, TMOUT, 0xFFFFFFFF);
> + mci_writel(host, RINTSTS, 0xFFFFFFFF);
> + mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE |
> + SDMMC_INT_DATA_OVER |
> + SDMMC_INT_TXDR | SDMMC_INT_RXDR |
> + DW_MCI_ERROR_FLAGS);
> + mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE);
> +
> + for (i = 0; i < host->num_slots; i++) {
> + struct dw_mci_slot *slot = host->slot[i];
> +
> + if (!slot)
> + continue;
> +
> + if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) {
> + dw_mci_set_ios(slot->mmc, &slot->mmc->ios);
> + dw_mci_setup_bus(slot, true);
> + }
> + }
> +
> + dw_mci_enable_cd(host);
Some part of this function can be reused with codes in dw_mci_resume().
Best Regards,
Jaehoon Chung
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(dw_mci_runtime_resume);
> +#endif /* CONFIG_PM */
>
> static int __init dw_mci_init(void)
> {
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index e8cd2de..baa7261 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -234,9 +234,11 @@
>
> extern int dw_mci_probe(struct dw_mci *host);
> extern void dw_mci_remove(struct dw_mci *host);
> -#ifdef CONFIG_PM_SLEEP
> +#ifdef CONFIG_PM
> extern int dw_mci_suspend(struct dw_mci *host);
> extern int dw_mci_resume(struct dw_mci *host);
> +extern int dw_mci_runtime_suspend(struct dw_mci *host);
> +extern int dw_mci_runtime_resume(struct dw_mci *host);
> #endif
>
> /**
>
next prev parent reply other threads:[~2016-10-07 4:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-30 8:48 [RFC PATCH v2 0/4] Init runtime PM support for dw_mmc Shawn Lin
2016-09-30 8:48 ` [RFC PATCH v2 1/4] mmc: dw_mmc: add runtime PM callback Shawn Lin
2016-10-07 4:12 ` Jaehoon Chung [this message]
[not found] ` <2dd84d82-a14b-7d5e-80f0-89e6c0b1aaae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-10-07 9:19 ` Shawn Lin
2016-09-30 8:48 ` [RFC PATCH v2 2/4] mmc: dw_mmc-rockchip: add runtime PM support Shawn Lin
2016-09-30 8:48 ` [RFC PATCH v2 3/4] mmc: core: expose the capability of gpio card detect Shawn Lin
2016-09-30 8:48 ` [RFC PATCH v2 4/4] mmc: dw_mmc-rockchip: disable biu clk and genpd if possible Shawn Lin
[not found] ` <1475225317-2815-5-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-10-07 4:15 ` Jaehoon Chung
[not found] ` <b9180674-648a-d2d1-0221-cec90b73adab-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-10-07 9:01 ` Shawn Lin
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=2dd84d82-a14b-7d5e-80f0-89e6c0b1aaae@samsung.com \
--to=jh80.chung@samsung.com \
--cc=dianders@chromium.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=shawn.lin@rock-chips.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