From: Simon Horman <horms@verge.net.au>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>, Chris Ball <cjb@laptop.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH 5/5 v4] mmc: sh_mmcif: add regulator support
Date: Wed, 20 Jun 2012 14:12:32 +0900 [thread overview]
Message-ID: <20120620051232.GE20030@verge.net.au> (raw)
In-Reply-To: <Pine.LNX.4.64.1206131535090.17854@axis700.grange>
Hi Guennadi,
On Wed, Jun 13, 2012 at 03:37:31PM +0200, Guennadi Liakhovetski wrote:
> Add regulator support to the sh_mmcif driver, but also preserve the current
> power-callback.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> v4: update to the new mmc_regulator_get_supply() function
>
> drivers/mmc/host/sh_mmcif.c | 38 +++++++++++++++++++++++++++++++-------
> 1 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 4680276..204bced 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -923,10 +923,22 @@ static int sh_mmcif_clk_update(struct sh_mmcif_host *host)
> return ret;
> }
>
> +static void sh_mmcif_set_power(struct sh_mmcif_host *host, struct mmc_ios *ios)
> +{
> + struct sh_mmcif_plat_data *pd = host->pd->dev.platform_data;
> + struct mmc_host *mmc = host->mmc;
> +
> + if (pd->set_pwr)
> + pd->set_pwr(host->pd, ios->power_mode != MMC_POWER_OFF);
> + if (!IS_ERR(mmc->supply.vmmc))
> + /* Errors ignored... */
> + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
> + ios->power_mode ? ios->vdd : 0);
> +}
> +
> static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> {
> struct sh_mmcif_host *host = mmc_priv(mmc);
> - struct sh_mmcif_plat_data *p = host->pd->dev.platform_data;
> unsigned long flags;
>
> spin_lock_irqsave(&host->lock, flags);
> @@ -944,6 +956,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> sh_mmcif_request_dma(host, host->pd->dev.platform_data);
> host->card_present = true;
> }
> + sh_mmcif_set_power(host, ios);
> } else if (ios->power_mode == MMC_POWER_OFF || !ios->clock) {
> /* clock stop */
> sh_mmcif_clock_control(host, 0);
> @@ -957,8 +970,8 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> pm_runtime_put(&host->pd->dev);
> clk_disable(host->hclk);
> host->power = false;
> - if (p->set_pwr && ios->power_mode == MMC_POWER_OFF)
> - p->set_pwr(host->pd, 0);
> + if (ios->power_mode == MMC_POWER_OFF)
> + sh_mmcif_set_power(host, ios);
> }
> host->state = STATE_IDLE;
> return;
> @@ -966,8 +979,6 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>
> if (ios->clock) {
> if (!host->power) {
> - if (p->set_pwr)
> - p->set_pwr(host->pd, ios->power_mode);
> sh_mmcif_clk_update(host);
> pm_runtime_get_sync(&host->pd->dev);
> host->power = true;
It is unclear to me how this hunk relates to the description of the
change in the changelog.
> @@ -1251,6 +1262,19 @@ static void mmcif_timeout_work(struct work_struct *work)
> mmc_request_done(host->mmc, mrq);
> }
>
> +static void sh_mmcif_init_ocr(struct sh_mmcif_host *host)
> +{
> + struct sh_mmcif_plat_data *pd = host->pd->dev.platform_data;
> + struct mmc_host *mmc = host->mmc;
> +
> + mmc_regulator_get_supply(mmc);
> +
> + if (!mmc->ocr_avail)
> + mmc->ocr_avail = pd->ocr;
> + else if (pd->ocr)
> + dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n");
> +}
> +
> static int __devinit sh_mmcif_probe(struct platform_device *pdev)
> {
> int ret = 0, irq[2];
> @@ -1298,8 +1322,8 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
> spin_lock_init(&host->lock);
>
> mmc->ops = &sh_mmcif_ops;
> - if (pd->ocr)
> - mmc->ocr_avail = pd->ocr;
> + sh_mmcif_init_ocr(host);
> +
> mmc->caps = MMC_CAP_MMC_HIGHSPEED;
> if (pd->caps)
> mmc->caps |= pd->caps;
> --
> 1.7.2.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@verge.net.au>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>, Chris Ball <cjb@laptop.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH 5/5 v4] mmc: sh_mmcif: add regulator support
Date: Wed, 20 Jun 2012 05:12:32 +0000 [thread overview]
Message-ID: <20120620051232.GE20030@verge.net.au> (raw)
In-Reply-To: <Pine.LNX.4.64.1206131535090.17854@axis700.grange>
Hi Guennadi,
On Wed, Jun 13, 2012 at 03:37:31PM +0200, Guennadi Liakhovetski wrote:
> Add regulator support to the sh_mmcif driver, but also preserve the current
> power-callback.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> v4: update to the new mmc_regulator_get_supply() function
>
> drivers/mmc/host/sh_mmcif.c | 38 +++++++++++++++++++++++++++++++-------
> 1 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 4680276..204bced 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -923,10 +923,22 @@ static int sh_mmcif_clk_update(struct sh_mmcif_host *host)
> return ret;
> }
>
> +static void sh_mmcif_set_power(struct sh_mmcif_host *host, struct mmc_ios *ios)
> +{
> + struct sh_mmcif_plat_data *pd = host->pd->dev.platform_data;
> + struct mmc_host *mmc = host->mmc;
> +
> + if (pd->set_pwr)
> + pd->set_pwr(host->pd, ios->power_mode != MMC_POWER_OFF);
> + if (!IS_ERR(mmc->supply.vmmc))
> + /* Errors ignored... */
> + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
> + ios->power_mode ? ios->vdd : 0);
> +}
> +
> static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> {
> struct sh_mmcif_host *host = mmc_priv(mmc);
> - struct sh_mmcif_plat_data *p = host->pd->dev.platform_data;
> unsigned long flags;
>
> spin_lock_irqsave(&host->lock, flags);
> @@ -944,6 +956,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> sh_mmcif_request_dma(host, host->pd->dev.platform_data);
> host->card_present = true;
> }
> + sh_mmcif_set_power(host, ios);
> } else if (ios->power_mode = MMC_POWER_OFF || !ios->clock) {
> /* clock stop */
> sh_mmcif_clock_control(host, 0);
> @@ -957,8 +970,8 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> pm_runtime_put(&host->pd->dev);
> clk_disable(host->hclk);
> host->power = false;
> - if (p->set_pwr && ios->power_mode = MMC_POWER_OFF)
> - p->set_pwr(host->pd, 0);
> + if (ios->power_mode = MMC_POWER_OFF)
> + sh_mmcif_set_power(host, ios);
> }
> host->state = STATE_IDLE;
> return;
> @@ -966,8 +979,6 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>
> if (ios->clock) {
> if (!host->power) {
> - if (p->set_pwr)
> - p->set_pwr(host->pd, ios->power_mode);
> sh_mmcif_clk_update(host);
> pm_runtime_get_sync(&host->pd->dev);
> host->power = true;
It is unclear to me how this hunk relates to the description of the
change in the changelog.
> @@ -1251,6 +1262,19 @@ static void mmcif_timeout_work(struct work_struct *work)
> mmc_request_done(host->mmc, mrq);
> }
>
> +static void sh_mmcif_init_ocr(struct sh_mmcif_host *host)
> +{
> + struct sh_mmcif_plat_data *pd = host->pd->dev.platform_data;
> + struct mmc_host *mmc = host->mmc;
> +
> + mmc_regulator_get_supply(mmc);
> +
> + if (!mmc->ocr_avail)
> + mmc->ocr_avail = pd->ocr;
> + else if (pd->ocr)
> + dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n");
> +}
> +
> static int __devinit sh_mmcif_probe(struct platform_device *pdev)
> {
> int ret = 0, irq[2];
> @@ -1298,8 +1322,8 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
> spin_lock_init(&host->lock);
>
> mmc->ops = &sh_mmcif_ops;
> - if (pd->ocr)
> - mmc->ocr_avail = pd->ocr;
> + sh_mmcif_init_ocr(host);
> +
> mmc->caps = MMC_CAP_MMC_HIGHSPEED;
> if (pd->caps)
> mmc->caps |= pd->caps;
> --
> 1.7.2.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2012-06-20 5:12 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 13:37 [PATCH 0/5 v4] mmc: sh_mmcif: clock and power updates Guennadi Liakhovetski
2012-06-13 13:37 ` Guennadi Liakhovetski
2012-06-13 13:37 ` [PATCH 1/5 v4] mmc: sh_mmcif: simplify and use meaningful label names in error-handling Guennadi Liakhovetski
2012-06-13 13:37 ` Guennadi Liakhovetski
2012-06-20 5:02 ` Simon Horman
2012-06-20 5:02 ` Simon Horman
2012-06-13 13:37 ` [PATCH 2/5 v4] mmc: sh_mmcif: fix clock management Guennadi Liakhovetski
2012-06-13 13:37 ` Guennadi Liakhovetski
2012-06-20 5:18 ` Simon Horman
2012-06-20 5:18 ` Simon Horman
2012-06-20 6:41 ` Guennadi Liakhovetski
2012-06-20 6:41 ` Guennadi Liakhovetski
2012-06-20 6:58 ` Simon Horman
2012-06-20 6:58 ` Simon Horman
2012-06-13 13:37 ` [PATCH 3/5 v4] mmc: sh_mmcif: re-read the clock frequency every time the clock is turned on Guennadi Liakhovetski
2012-06-13 13:37 ` Guennadi Liakhovetski
2012-06-20 5:23 ` Simon Horman
2012-06-20 5:23 ` Simon Horman
2012-06-13 13:37 ` [PATCH 4/5 v4] mmc: sh_mmcif: remove redundant .down_pwr() callback Guennadi Liakhovetski
2012-06-13 13:37 ` Guennadi Liakhovetski
2012-06-20 4:58 ` Simon Horman
2012-06-20 4:58 ` Simon Horman
2012-06-20 6:19 ` Guennadi Liakhovetski
2012-06-20 6:19 ` Guennadi Liakhovetski
2012-06-20 6:57 ` Simon Horman
2012-06-20 6:57 ` Simon Horman
2012-06-13 13:37 ` [PATCH 5/5 v4] mmc: sh_mmcif: add regulator support Guennadi Liakhovetski
2012-06-13 13:37 ` Guennadi Liakhovetski
2012-06-17 17:23 ` Mark Brown
2012-06-17 17:23 ` Mark Brown
2012-06-20 5:12 ` Simon Horman [this message]
2012-06-20 5:12 ` Simon Horman
2012-06-20 6:38 ` Guennadi Liakhovetski
2012-06-20 6:38 ` Guennadi Liakhovetski
2012-06-20 6:58 ` Simon Horman
2012-06-20 6:58 ` Simon Horman
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=20120620051232.GE20030@verge.net.au \
--to=horms@verge.net.au \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=cjb@laptop.org \
--cc=g.liakhovetski@gmx.de \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.