diff mbox

mmc: core: Only execute tuning for SDR50 and SDR104

Message ID 1366199453-6135-1-git-send-email-fredrik.soderstedt@stericsson.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fredrik Soderstedt April 17, 2013, 11:50 a.m. UTC
Only execute tuning for sd and sdio devices that are using
SDR50 or SDR104.

Make sure clock is hold during tuning for sdio devices.

Signed-off-by: Fredrik Soderstedt <fredrik.soderstedt@stericsson.com>
---
 drivers/mmc/core/sd.c   |  9 +++++++--
 drivers/mmc/core/sdio.c | 12 ++++++++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

Comments

Johan Rudholm April 17, 2013, 1:10 p.m. UTC | #1
Hi,

2013/4/17 Fredrik Soderstedt <fredrik.soderstedt@stericsson.com>:
> Only execute tuning for sd and sdio devices that are using
> SDR50 or SDR104.
>
> Make sure clock is hold during tuning for sdio devices.
>
> Signed-off-by: Fredrik Soderstedt <fredrik.soderstedt@stericsson.com>

Acked-by: Johan Rudholm <jrudholm@gmail.com>

//Johan
--
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
Ulf Hansson April 19, 2013, 10:16 a.m. UTC | #2
On 17 April 2013 13:50, Fredrik Soderstedt
<fredrik.soderstedt@stericsson.com> wrote:
> Only execute tuning for sd and sdio devices that are using
> SDR50 or SDR104.
>
> Make sure clock is hold during tuning for sdio devices.
>
> Signed-off-by: Fredrik Soderstedt <fredrik.soderstedt@stericsson.com>
> ---
>  drivers/mmc/core/sd.c   |  9 +++++++--
>  drivers/mmc/core/sdio.c | 12 ++++++++++--
>  2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 9e645e1..8373d22 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -646,8 +646,13 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
>         if (err)
>                 goto out;
>
> -       /* SPI mode doesn't define CMD19 */
> -       if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning) {
> +       /*
> +        * 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);
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 6889a82..444668c 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -563,10 +563,18 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
>         if (err)
>                 goto out;
>
> -       /* Initialize and start re-tuning timer */
> -       if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning)
> +       /*
> +        * 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);
> +       }
>
>  out:
>
> --
> 1.8.2.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

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
--
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
Chris Ball May 26, 2013, 5:17 p.m. UTC | #3
Hi,

On Wed, Apr 17 2013, Fredrik Soderstedt wrote:
> Only execute tuning for sd and sdio devices that are using
> SDR50 or SDR104.
>
> Make sure clock is hold during tuning for sdio devices.
>
> Signed-off-by: Fredrik Soderstedt <fredrik.soderstedt@stericsson.com>

Thanks, pushed to mmc-next for 3.11.

- Chris.
diff mbox

Patch

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 9e645e1..8373d22 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -646,8 +646,13 @@  static int mmc_sd_init_uhs_card(struct mmc_card *card)
 	if (err)
 		goto out;
 
-	/* SPI mode doesn't define CMD19 */
-	if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning) {
+	/*
+	 * 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);
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 6889a82..444668c 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -563,10 +563,18 @@  static int mmc_sdio_init_uhs_card(struct mmc_card *card)
 	if (err)
 		goto out;
 
-	/* Initialize and start re-tuning timer */
-	if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning)
+	/*
+	 * 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);
+	}
 
 out: