diff mbox

[v2,1/2] mmc: core: enable CMD19 tuning for DDR50 mode

Message ID 1443410618-14763-1-git-send-email-21cnbao@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Barry Song Sept. 28, 2015, 3:23 a.m. UTC
From: Weijun Yang <york.yang@csr.com>

As SD Specifications Part1 Physical Layer Specification Version
3.01 says, CMD19 tuning is available for unlocked cards in transfer
state of 1.8V signaling mode. The small difference between v3.00
and 3.01 spec means that CMD19 tuning is also available for DDR50
mode.

Signed-off-by: Weijun Yang <york.yang@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 drivers/mmc/core/sd.c    | 19 +++++++++++++++++--
 drivers/mmc/host/sdhci.c |  1 +
 2 files changed, 18 insertions(+), 2 deletions(-)

Comments

Ulf Hansson Sept. 29, 2015, 10:22 a.m. UTC | #1
On 28 September 2015 at 05:23, Barry Song <21cnbao@gmail.com> wrote:
> From: Weijun Yang <york.yang@csr.com>
>
> As SD Specifications Part1 Physical Layer Specification Version
> 3.01 says, CMD19 tuning is available for unlocked cards in transfer
> state of 1.8V signaling mode. The small difference between v3.00
> and 3.01 spec means that CMD19 tuning is also available for DDR50
> mode.
>
> Signed-off-by: Weijun Yang <york.yang@csr.com>
> Signed-off-by: Barry Song <Baohua.Song@csr.com>
> ---
>  drivers/mmc/core/sd.c    | 19 +++++++++++++++++--
>  drivers/mmc/host/sdhci.c |  1 +

Sorry for not pointing out this is the first round, but I would rather
split @subject patch into two parts.
One for core and one for sdhci, as it then becomes obvious that sdhci
will start using the option to do tuning for DDR50 mode.

>  2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 4e7366a..eaf8cb3 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -628,9 +628,24 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
>          * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
>          */
>         if (!mmc_host_is_spi(card->host) &&
> -           (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
> -            card->sd_bus_speed == UHS_SDR104_BUS_SPEED))
> +               (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
> +                card->sd_bus_speed == UHS_DDR50_BUS_SPEED ||
> +                card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) {
>                 err = mmc_execute_tuning(card);
> +
> +               /*
> +                * As SD Specifications Part1 Physical Layer Specification Version
> +                * 3.01 says, CMD19 tuning is available for unlocked cards in transfer
> +                * state of 1.8V signaling mode. The small difference between v3.00
> +                * and 3.01 spec means that CMD19 tuning is also available for DDR50
> +                * mode.
> +                */
> +               if (err && (card->sd_bus_speed == UHS_DDR50_BUS_SPEED)) {
> +                       pr_warn("%s: ddr50 tuning failed\n", mmc_hostname(card->host));
> +                       err = 0;
> +               }
> +       }
> +
>  out:
>         kfree(status);
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 64b7fdb..382810d 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1915,6 +1915,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
>                 break;
>
>         case MMC_TIMING_UHS_SDR104:
> +       case MMC_TIMING_UHS_DDR50:
>                 break;
>
>         case MMC_TIMING_UHS_SDR50:
> --
> 1.9.1
>

Kind regards
Uffe
--
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
diff mbox

Patch

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 4e7366a..eaf8cb3 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -628,9 +628,24 @@  static int mmc_sd_init_uhs_card(struct mmc_card *card)
 	 * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
 	 */
 	if (!mmc_host_is_spi(card->host) &&
-	    (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
-	     card->sd_bus_speed == UHS_SDR104_BUS_SPEED))
+		(card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
+		 card->sd_bus_speed == UHS_DDR50_BUS_SPEED ||
+		 card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) {
 		err = mmc_execute_tuning(card);
+
+		/*
+		 * As SD Specifications Part1 Physical Layer Specification Version
+		 * 3.01 says, CMD19 tuning is available for unlocked cards in transfer
+		 * state of 1.8V signaling mode. The small difference between v3.00
+		 * and 3.01 spec means that CMD19 tuning is also available for DDR50
+		 * mode.
+		 */
+		if (err && (card->sd_bus_speed == UHS_DDR50_BUS_SPEED)) {
+			pr_warn("%s: ddr50 tuning failed\n", mmc_hostname(card->host));
+			err = 0;
+		}
+	}
+
 out:
 	kfree(status);
 
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 64b7fdb..382810d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1915,6 +1915,7 @@  static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
 		break;
 
 	case MMC_TIMING_UHS_SDR104:
+	case MMC_TIMING_UHS_DDR50:
 		break;
 
 	case MMC_TIMING_UHS_SDR50: