All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [UBOOT v2 12/15] mmc: sdhci: Add support for eMMC HS200 mode
Date: Mon, 30 Jan 2017 16:08:29 +0530	[thread overview]
Message-ID: <1485772712-4653-13-git-send-email-sivadur@xilinx.com> (raw)
In-Reply-To: <1485772712-4653-1-git-send-email-sivadur@xilinx.com>

Add support for eMMC HS200 mode by reading
card type from ext_csd and then by switching to
HS200 timing mode.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
---
Changes from v1:
- Split the patch with only mmc changes
---
 drivers/mmc/mmc.c | 24 ++++++++++++++++++------
 include/mmc.h     |  7 +++++++
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 0f0bfc8..02c0408 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -619,9 +619,16 @@ static int mmc_change_freq(struct mmc *mmc)
 	if (err)
 		return err;
 
-	cardtype = ext_csd[EXT_CSD_CARD_TYPE] & 0xf;
+	cardtype = ext_csd[EXT_CSD_CARD_TYPE] & 0x3f;
 
-	err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
+	if (cardtype & EXT_CSD_CARD_TYPE_HS200)
+		err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
+				 EXT_CSD_HS_TIMING,
+				 EXT_CSD_HS_TIMING_HS200);
+	else
+		err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
+				 EXT_CSD_HS_TIMING,
+				 EXT_CSD_HS_TIMING_HIGH_SPEED);
 
 	if (err)
 		return err;
@@ -636,8 +643,10 @@ static int mmc_change_freq(struct mmc *mmc)
 	if (!ext_csd[EXT_CSD_HS_TIMING])
 		return 0;
 
-	/* High Speed is set, there are two types: 52MHz and 26MHz */
-	if (cardtype & EXT_CSD_CARD_TYPE_52) {
+	/* High Speed is set, there are three types: 200MHZ, 52MHz and 26MHz */
+	if (cardtype & EXT_CSD_CARD_TYPE_HS200) {
+		mmc->card_caps |= MMC_MODE_HS200;
+	} else if (cardtype & EXT_CSD_CARD_TYPE_52) {
 		if (cardtype & EXT_CSD_CARD_TYPE_DDR_1_8V)
 			mmc->card_caps |= MMC_MODE_DDR_52MHz;
 		mmc->card_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
@@ -1659,7 +1668,9 @@ static int mmc_startup(struct mmc *mmc)
 		if (err)
 			return err;
 
-		if (mmc->card_caps & MMC_MODE_HS) {
+		if (mmc->card_caps & MMC_MODE_HS200) {
+			mmc->tran_speed = 200000000;
+		} else if (mmc->card_caps & MMC_MODE_HS) {
 			if (mmc->card_caps & MMC_MODE_HS_52MHz)
 				mmc->tran_speed = 52000000;
 			else
@@ -1670,7 +1681,8 @@ static int mmc_startup(struct mmc *mmc)
 	mmc_set_clock(mmc, mmc->tran_speed);
 
 	if ((mmc->card_caps & (MMC_MODE_UHS_SDR50 |
-			       MMC_MODE_UHS_SDR104)) &&
+			       MMC_MODE_UHS_SDR104 |
+			       MMC_MODE_HS200)) &&
 	    (mmc->cfg->host_caps & MMC_MODE_NEEDS_TUNING)) {
 		err = mmc_execute_tuning(mmc);
 		if (err)
diff --git a/include/mmc.h b/include/mmc.h
index 56395ee..90e1dcc 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -223,6 +223,13 @@
 #define EXT_CSD_CARD_TYPE_DDR_1_2V	(1 << 3)
 #define EXT_CSD_CARD_TYPE_DDR_52	(EXT_CSD_CARD_TYPE_DDR_1_8V \
 					| EXT_CSD_CARD_TYPE_DDR_1_2V)
+#define EXT_CSD_CARD_TYPE_HS200_1_8V	(1 << 4)
+#define EXT_CSD_CARD_TYPE_HS200_1_2V	(1 << 5)
+#define EXT_CSD_CARD_TYPE_HS200		(EXT_CSD_CARD_TYPE_HS200_1_8V \
+					| EXT_CSD_CARD_TYPE_HS200_1_2V)
+
+#define EXT_CSD_HS_TIMING_HIGH_SPEED	1
+#define EXT_CSD_HS_TIMING_HS200		2
 
 #define EXT_CSD_BUS_WIDTH_1	0	/* Card is in 1 bit mode */
 #define EXT_CSD_BUS_WIDTH_4	1	/* Card is in 4 bit mode */
-- 
2.7.4

  parent reply	other threads:[~2017-01-30 10:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170130103830epcas1p195ed3f0d004b3724edeebd6f000212ce@epcas1p1.samsung.com>
2017-01-30 10:38 ` [U-Boot] [UBOOT v2 00/15] Add support for SD3.0 and eMMC HS200 Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 01/15] mmc: sdhci: Update host capabilities about host controller Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 02/15] mmc: Add support for SD3.0 Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 03/15] mmc: sdhci: Add SD3.0 support Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 04/15] mmc: sdhci: Add support for platform/board specific tuning Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 05/15] mmc: sdhci: Add support for platform specific delay Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 06/15] mmc: sdhci: Make sdhci_ops of host as modifiable Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 07/15] zynqmp: Define routines for mmio write and read Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 08/15] mmc: sdhci: zynq: Define private structure arasan_sdhci_priv Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 09/15] mmc: sdhci: zynqmp: Add support of SD3.0 Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 10/15] mmc: sdhci: Add quirk for 1.8v switching not supported Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 11/15] mmc: zynq_sdhci: Update quirk if " Siva Durga Prasad Paladugu
2017-01-30 10:38   ` Siva Durga Prasad Paladugu [this message]
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 13/15] mmc: sdhci: Update execute tuning and set clock for HS200 Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 14/15] mmc: sdhci: zynqmp: Set tapdelays for eMMC HS200 mode Siva Durga Prasad Paladugu
2017-01-30 10:38   ` [U-Boot] [UBOOT v2 15/15] mmc: Change frequency while accessing to boot partition Siva Durga Prasad Paladugu
2017-02-02 10:52   ` [U-Boot] [UBOOT v2 00/15] Add support for SD3.0 and eMMC HS200 Jaehoon Chung

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=1485772712-4653-13-git-send-email-sivadur@xilinx.com \
    --to=siva.durga.paladugu@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /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.