linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuanxiao Dong <chuanxiao.dong@intel.com>
To: linux-mmc@vger.kernel.org, chris@printf.org, ulf.hansson@linaro.org
Cc: yunpeng.gao@intel.com
Subject: [PATCH] mmc: core: use 1.8v signling in ddr mode for some special host
Date: Fri, 1 Aug 2014 14:08:16 +0800	[thread overview]
Message-ID: <20140801060816.GA3172@intel.com> (raw)

Even eMMC card can support 3.3v to 1.2v vccq in DDR, but not all
host controller can support this, like some of the SDHCI host
which connect to an eMMC device. Some of these host controller
still needs to use 1.8v vccq for supporting DDR mode.

If a host controller cannot support 3.3v for DDR, try 1.8v.

Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
---
 drivers/mmc/core/mmc.c   |   19 +++++++++++++++++++
 include/linux/mmc/host.h |    1 +
 2 files changed, 20 insertions(+)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 793c6f7..13a5b24 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1000,6 +1000,25 @@ static int mmc_select_hs_ddr(struct mmc_card *card)
 			return err;
 	}
 
+	/*
+	 * Even eMMC card can support 3.3v to 1.2v vccq, but not all
+	 * host controller can support this, like some of the SDHCI
+	 * controller which connect to an eMMC device. Some of these
+	 * host controller still needs to use 1.8v vccq for supporting
+	 * DDR mode.
+	 *
+	 * If a host controller cannot support 3.3v for DDR, try 1.8v
+	 */
+	if (unlikely(host->caps2 & MMC_CAP2_NO_3_3V_DDR)) {
+		if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_8V) {
+			err = __mmc_set_signal_voltage(host,
+					MMC_SIGNAL_VOLTAGE_180);
+			if (err)
+				return err;
+		} else
+			return -EOPNOTSUPP;
+	}
+
 	mmc_set_timing(host, MMC_TIMING_MMC_DDR52);
 
 	return err;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7960424..e5d3ada 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -283,6 +283,7 @@ struct mmc_host {
 #define MMC_CAP2_HS400		(MMC_CAP2_HS400_1_8V | \
 				 MMC_CAP2_HS400_1_2V)
 #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
+#define MMC_CAP2_NO_3_3V_DDR	(1 << 18) /* doesn't support 3.3v vccq in ddr */
 
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 
-- 
1.7.10.4


             reply	other threads:[~2014-08-01  6:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  6:08 Chuanxiao Dong [this message]
2014-08-12 13:21 ` [PATCH] mmc: core: use 1.8v signling in ddr mode for some special host Ulf Hansson
2014-08-13  2:15   ` Dong, Chuanxiao

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=20140801060816.GA3172@intel.com \
    --to=chuanxiao.dong@intel.com \
    --cc=chris@printf.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=yunpeng.gao@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).