All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chris Ball <chris@printf.net>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Aaron Lu <aaron.lu@intel.com>, Philip Rakity <prakity@nvidia.com>,
	Girish K S <girish.shivananjappa@linaro.org>,
	Al Cooper <alcooperx@gmail.com>,
	Arend van Spriel <arend@broadcom.com>
Subject: Re: [PATCH 01/13] mmc: core: Simplify by adding mmc_execute_tuning()
Date: Tue, 13 Jan 2015 12:19:55 +0100	[thread overview]
Message-ID: <CAPDyKFpA30z-D2qqYsvNCcepaDtr=MgNcTQ8t04wS7Qg_AA3jA@mail.gmail.com> (raw)
In-Reply-To: <1417801271-15575-2-git-send-email-adrian.hunter@intel.com>

On 5 December 2014 at 18:40, Adrian Hunter <adrian.hunter@intel.com> wrote:
> For each MMC, SD and SDIO there is code that
> holds the clock, calls ops->execute_tuning, and
> releases the clock. Simplify the code a bit by
> providing a separate function to do that.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/core/core.c | 24 ++++++++++++++++++++++++
>  drivers/mmc/core/core.h |  3 +++
>  drivers/mmc/core/mmc.c  | 14 +-------------
>  drivers/mmc/core/sd.c   | 13 ++++---------
>  drivers/mmc/core/sdio.c | 14 ++++----------
>  5 files changed, 36 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 9584bff..b329725 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1077,6 +1077,30 @@ void mmc_set_ungated(struct mmc_host *host)
>  }
>  #endif
>
> +int mmc_execute_tuning(struct mmc_card *card)
> +{
> +       struct mmc_host *host = card->host;
> +       u32 opcode;
> +       int err;
> +
> +       if (!host->ops->execute_tuning)
> +               return 0;
> +
> +       if (mmc_card_mmc(card))
> +               opcode = MMC_SEND_TUNING_BLOCK_HS200;
> +       else
> +               opcode = MMC_SEND_TUNING_BLOCK;
> +
> +       mmc_host_clk_hold(host);
> +       err = host->ops->execute_tuning(host, opcode);
> +       mmc_host_clk_release(host);
> +
> +       if (err)
> +               pr_err("%s: tuning execution failed\n", mmc_hostname(host));
> +
> +       return err;
> +}
> +
>  /*
>   * Change the bus mode (open drain/push-pull) of a host.
>   */
> diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
> index d76597c..1b022c9 100644
> --- a/drivers/mmc/core/core.h
> +++ b/drivers/mmc/core/core.h
> @@ -82,5 +82,8 @@ void mmc_add_card_debugfs(struct mmc_card *card);
>  void mmc_remove_card_debugfs(struct mmc_card *card);
>
>  void mmc_init_context_info(struct mmc_host *host);
> +
> +int mmc_execute_tuning(struct mmc_card *card);
> +
>  #endif
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 02ad792..c712ba7 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1194,7 +1194,6 @@ EXPORT_SYMBOL(tuning_blk_pattern_8bit);
>  static int mmc_hs200_tuning(struct mmc_card *card)
>  {
>         struct mmc_host *host = card->host;
> -       int err = 0;
>
>         /*
>          * Timing should be adjusted to the HS400 target
> @@ -1205,18 +1204,7 @@ static int mmc_hs200_tuning(struct mmc_card *card)
>                 if (host->ops->prepare_hs400_tuning)
>                         host->ops->prepare_hs400_tuning(host, &host->ios);
>
> -       if (host->ops->execute_tuning) {
> -               mmc_host_clk_hold(host);
> -               err = host->ops->execute_tuning(host,
> -                               MMC_SEND_TUNING_BLOCK_HS200);
> -               mmc_host_clk_release(host);
> -
> -               if (err)
> -                       pr_err("%s: tuning execution failed\n",
> -                               mmc_hostname(host));
> -       }
> -
> -       return err;
> +       return mmc_execute_tuning(card);
>  }
>
>  /*
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index d90a6de..7907544 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -660,15 +660,10 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
>          * SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
>          * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
>          */
> -       if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning &&
> -                       (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
> -                        card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) {
> -               mmc_host_clk_hold(card->host);
> -               err = card->host->ops->execute_tuning(card->host,
> -                                                     MMC_SEND_TUNING_BLOCK);
> -               mmc_host_clk_release(card->host);
> -       }
> -
> +       if (!mmc_host_is_spi(card->host) &&
> +           (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
> +            card->sd_bus_speed == UHS_SDR104_BUS_SPEED))
> +               err = mmc_execute_tuning(card);
>  out:
>         kfree(status);
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index fd0750b..ce6cc47 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -567,17 +567,11 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
>          * SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
>          * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
>          */
> -       if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning &&
> -                       ((card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR50) ||
> -                        (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104))) {
> -               mmc_host_clk_hold(card->host);
> -               err = card->host->ops->execute_tuning(card->host,
> -                                                     MMC_SEND_TUNING_BLOCK);
> -               mmc_host_clk_release(card->host);
> -       }
> -
> +       if (!mmc_host_is_spi(card->host) &&
> +           ((card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR50) ||
> +            (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104)))
> +               err = mmc_execute_tuning(card);
>  out:
> -
>         return err;
>  }
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-01-13 11:19 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05 17:40 [RFC PATCH 00/13] mmc: host: Add facility to support re-tuning Adrian Hunter
2014-12-05 17:40 ` [PATCH 01/13] mmc: core: Simplify by adding mmc_execute_tuning() Adrian Hunter
2015-01-13 11:19   ` Ulf Hansson [this message]
2014-12-05 17:41 ` [PATCH 02/13] mmc: host: Add facility to support re-tuning Adrian Hunter
2015-01-13 11:25   ` Ulf Hansson
2015-01-13 13:23     ` Adrian Hunter
2015-01-13 14:22       ` Ulf Hansson
2015-01-13 14:36         ` Adrian Hunter
2015-01-13 14:56           ` Ulf Hansson
2015-01-13 15:11             ` Arend van Spriel
2015-01-13 15:41               ` Ulf Hansson
2015-01-13 16:02                 ` Arend van Spriel
2015-01-14  9:47                   ` Ulf Hansson
2015-01-14  9:57                     ` Adrian Hunter
2015-01-14 10:13                       ` Ulf Hansson
2015-01-14 12:24                         ` Adrian Hunter
2015-01-14 12:59                           ` Ulf Hansson
2015-01-15 10:17                             ` Adrian Hunter
2015-01-15 13:39                               ` Ulf Hansson
2015-01-15 14:07                                 ` Arend van Spriel
2015-01-15 14:17                                   ` Arend van Spriel
2015-01-15 14:46                                     ` Ulf Hansson
2015-01-15 14:59                                       ` Arend van Spriel
2015-01-19  9:27                                         ` Ulf Hansson
2015-01-19  9:56                                           ` Adrian Hunter
2015-01-14 12:38                         ` Arend van Spriel
2015-01-14 12:52                           ` Ulf Hansson
2015-01-13 15:04         ` Arend van Spriel
2014-12-05 17:41 ` [PATCH 03/13] mmc: core: Disable re-tuning when card is no longer initialized Adrian Hunter
2014-12-05 17:41 ` [PATCH 04/13] mmc: core: Move mmc_card_removed() into mmc_start_request() Adrian Hunter
2015-01-13 11:20   ` Ulf Hansson
2014-12-05 17:41 ` [PATCH 05/13] mmc: core: Add support for re-tuning before each request Adrian Hunter
2014-12-05 17:41 ` [PATCH 06/13] mmc: core: Check re-tuning before retrying Adrian Hunter
2014-12-05 17:41 ` [PATCH 07/13] mmc: core: Hold re-tuning during switch commands Adrian Hunter
2014-12-05 17:41 ` [PATCH 08/13] mmc: core: Hold re-tuning during erase commands Adrian Hunter
2014-12-05 17:41 ` [PATCH 09/13] mmc: core: Hold re-tuning while bkops ongoing Adrian Hunter
2014-12-05 17:41 ` [PATCH 10/13] mmc: mmc: Comment that callers need to hold re-tuning if the card is put to sleep Adrian Hunter
2014-12-05 17:41 ` [PATCH 11/13] mmc: core: Add support for HS400 re-tuning Adrian Hunter
2014-12-05 17:41 ` [PATCH 12/13] mmc: sdhci: Always init buf_ready_int Adrian Hunter
2015-01-13 11:21   ` Ulf Hansson
2014-12-05 17:41 ` [PATCH 13/13] mmc: sdhci: Change to new way of doing re-tuning Adrian Hunter
2014-12-19 14:07 ` [RFC PATCH 00/13] mmc: host: Add facility to support re-tuning Adrian Hunter
2014-12-19 14:37   ` Ulf Hansson
2015-01-12 13:05   ` Adrian Hunter
2015-01-13 11:27 ` Ulf Hansson

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='CAPDyKFpA30z-D2qqYsvNCcepaDtr=MgNcTQ8t04wS7Qg_AA3jA@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=aaron.lu@intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=alcooperx@gmail.com \
    --cc=arend@broadcom.com \
    --cc=chris@printf.net \
    --cc=girish.shivananjappa@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=prakity@nvidia.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.