diff mbox

mmc: core: use 1.8v signling in ddr mode for some special host

Message ID 20140801060816.GA3172@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chuanxiao.Dong Aug. 1, 2014, 6:08 a.m. UTC
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(+)

Comments

Ulf Hansson Aug. 12, 2014, 1:21 p.m. UTC | #1
On 1 August 2014 08:08, Chuanxiao Dong <chuanxiao.dong@intel.com> wrote:
> 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;
> +       }

I am wondering if we could try an another approach while changing
signal voltage for (e)MMC. Simply start by trying with 1.2V, then 1.8V
and then 3.3V. Obviously we shouldn't try with something that isn't
supported, which card->mmc_avail_type tells us about.

I realize that it will mean a change in behaviour and depending on how
hosts are handling signal voltage, this is a bit uncertain if it would
work. Still I feel it would be the right approach. Can we give at
shot?

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
Chuanxiao.Dong Aug. 13, 2014, 2:15 a.m. UTC | #2
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogbGludXgtbW1jLW93bmVy
QHZnZXIua2VybmVsLm9yZw0KPiBbbWFpbHRvOmxpbnV4LW1tYy1vd25lckB2Z2VyLmtlcm5lbC5v
cmddIE9uIEJlaGFsZiBPZiBVbGYgSGFuc3Nvbg0KPiBTZW50OiBUdWVzZGF5LCBBdWd1c3QgMTIs
IDIwMTQgOToyMSBQTQ0KPiBUbzogRG9uZywgQ2h1YW54aWFvDQo+IENjOiBsaW51eC1tbWM7IGNo
cmlzQHByaW50Zi5vcmc7IEdhbywgWXVucGVuZw0KPiBTdWJqZWN0OiBSZTogW1BBVENIXSBtbWM6
IGNvcmU6IHVzZSAxLjh2IHNpZ25saW5nIGluIGRkciBtb2RlIGZvciBzb21lIHNwZWNpYWwNCj4g
aG9zdA0KPiANCj4gT24gMSBBdWd1c3QgMjAxNCAwODowOCwgQ2h1YW54aWFvIERvbmcgPGNodWFu
eGlhby5kb25nQGludG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3ZSBjYW5ub3QgdGVzdCB0aGlzIGFwcHJvYWNoIG9uIGFsbCBob3N0IGNvbnRy
b2xsZXJzLCB0aHVzIGZpbmFsbHkgY2hhbmdlIHRvIGFkZCBhIG5ldyBDQVAgaXMgdG8gYXZvaWQg
aW1wYWN0aW5nIG90aGVyIGhvc3QgY29udHJvbGxlcnMuDQoNCkkgY2FuIHBvc3QgYSB2MiBwYXRj
aCB0byBpbXBsZW1lbnQgdGhpcyBJTyBzaWduYWwgdm9sdGFnZSBjaGFuZ2luZyBzZXF1ZW5jZSBm
b3IgcmV2aWV3Lg0KDQpUaGFua3MNCkNodWFueGlhbw0KDQo+IA0KPiBLaW5kIHJlZ2FyZHMNCj4g
VWZmZQ0KPiAtLQ0KPiBUbyB1bnN1YnNjcmliZSBmcm9tIHRoaXMgbGlzdDogc2VuZCB0aGUgbGlu
ZSAidW5zdWJzY3JpYmUgbGludXgtbW1jIiBpbiB0aGUgYm9keQ0KPiBvZiBhIG1lc3NhZ2UgdG8g
bWFqb3Jkb21vQHZnZXIua2VybmVsLm9yZyBNb3JlIG1ham9yZG9tbyBpbmZvIGF0DQo+IGh0dHA6
Ly92Z2VyLmtlcm5lbC5vcmcvbWFqb3Jkb21vLWluZm8uaHRtbA0K
--
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/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 */