Message ID | 20140815032806.GA19745@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 15 August 2014 05:28, Chuanxiao Dong <chuanxiao.dong@intel.com> wrote: > Even (e)MMC 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. > > So the sequence will be: > if (host and device can both support 1.2v IO) > use 1.2v IO; > else if (host and device can both support 1.8v IO) > use 1.8v IO; > so if host and device can only support 3.3v IO, this is the last choice. > > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> > Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com> This looks good to me! But before I queue it for 3.18 I would appreciate if we could get some help in testing this for some various platforms, that support MMC DDR. Kind regards Uffe > --- > Changelog V2: > - For (e)MMC device switching to DDR mode, try 1.2v singaling first. Then > try 1.8v. If 1.2v and 1.8v are both not supported, use the default > > Changelog V3: > - continue to try 1.8v/3.3v vccq if there is IO voltage switching failure > > drivers/mmc/core/mmc.c | 34 +++++++++++++++++++++++++--------- > 1 file changed, 25 insertions(+), 9 deletions(-) > > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c > index 793c6f7..8d69671 100644 > --- a/drivers/mmc/core/mmc.c > +++ b/drivers/mmc/core/mmc.c > @@ -988,19 +988,35 @@ static int mmc_select_hs_ddr(struct mmc_card *card) > * 1.8V vccq at 3.3V core voltage (vcc) is not required > * in the JEDEC spec for DDR. > * > - * Do not force change in vccq since we are obviously > - * working and no change to vccq is needed. > + * Even (e)MMC 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. > + * > + * So the sequence will be: > + * if (host and device can both support 1.2v IO) > + * use 1.2v IO; > + * else if (host and device can both support 1.8v IO) > + * use 1.8v IO; > + * so if host and device can only support 3.3v IO, this is the > + * last choice. > * > * WARNING: eMMC rules are NOT the same as SD DDR > */ > - if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_2V) { > - err = __mmc_set_signal_voltage(host, > - MMC_SIGNAL_VOLTAGE_120); > - if (err) > - return err; > - } > + err = -EINVAL; > + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_2V) > + err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); > > - mmc_set_timing(host, MMC_TIMING_MMC_DDR52); > + if (err && (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_8V)) > + err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); > + > + /* make sure vccq is 3.3v after switching disaster */ > + if (err) > + err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330); > + > + if (!err) > + mmc_set_timing(host, MMC_TIMING_MMC_DDR52); > > return err; > } > -- > 1.7.10.4 > -- 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
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogVWxmIEhhbnNzb24gW21h aWx0bzp1bGYuaGFuc3NvbkBsaW5hcm8ub3JnXQ0KPiBTZW50OiBGcmlkYXksIEF1Z3VzdCAxNSwg MjAxNCA0OjM0IFBNDQo+IFRvOiBEb25nLCBDaHVhbnhpYW8NCj4gQ2M6IGxpbnV4LW1tYzsgY2hy aXNAcHJpbnRmLm9yZw0KPiBTdWJqZWN0OiBSZTogW1BBVENIIHYzXSBtbWM6IGNvcmU6IHRyeSAx Ljh2IHNpZ25saW5nIGluIGRkciBtb2RlIGlmIGhvc3QgYW5kDQo+IGRldmljZQ0KPiANCj4gT24g MTUgQXVndXN0IDIwMTQgMDU6MjgsIENodWFueGlhbyBEb25nIDxjaHVhbnhpYW8uZG9uZ0BpbnRl bC5jb20+DQo+IHdyb3RlOg0KPiA+IEV2ZW4gKGUpTU1DI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w0KPiA+ICsgICAgICAgaWYgKGVyciAmJiAoY2FyZC0+bW1jX2F2YWlsX3R5cGUg Jg0KPiBFWFRfQ1NEX0NBUkRfVFlQRV9ERFJfMV84VikpDQo+ID4gKyAgICAgICAgICAgICAgIGVy ciA9IF9fbW1jX3NldF9zaWduYWxfdm9sdGFnZShob3N0LA0KPiA+ICsgTU1DX1NJR05BTF9WT0xU QUdFXzE4MCk7DQo+ID4gKw0KPiA+ICsgICAgICAgLyogbWFrZSBzdXJlIHZjY3EgaXMgMy4zdiBh ZnRlciBzd2l0Y2hpbmcgZGlzYXN0ZXIgKi8NCj4gPiArICAgICAgIGlmIChlcnIpDQo+ID4gKyAg ICAgICAgICAgICAgIGVyciA9IF9fbW1jX3NldF9zaWduYWxfdm9sdGFnZShob3N0LA0KPiA+ICsg TU1DX1NJR05BTF9WT0xUQUdFXzMzMCk7DQo+ID4gKw0KPiA+ICsgICAgICAgaWYgKCFlcnIpDQo+ ID4gKyAgICAgICAgICAgICAgIG1tY19zZXRfdGltaW5nKGhvc3QsIE1NQ19USU1JTkdfTU1DX0RE UjUyKTsNCj4gPg0KPiA+ICAgICAgICAgcmV0dXJuIGVycjsNCj4gPiAgfQ0KPiA+IC0tDQo+ID4g MS43LjEwLjQNCj4gPg0K -- 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
2014-08-15 10:36 GMT+02:00 Dong, Chuanxiao <chuanxiao.dong@intel.com>: > > >> -----Original Message----- >> From: Ulf Hansson [mailto:ulf.hansson@linaro.org] >> Sent: Friday, August 15, 2014 4:34 PM >> To: Dong, Chuanxiao >> Cc: linux-mmc; chris@printf.org >> Subject: Re: [PATCH v3] mmc: core: try 1.8v signling in ddr mode if host and >> device >> >> On 15 August 2014 05:28, Chuanxiao Dong <chuanxiao.dong@intel.com> >> wrote: >> > Even (e)MMC 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. >> > >> > So the sequence will be: >> > if (host and device can both support 1.2v IO) >> > use 1.2v IO; >> > else if (host and device can both support 1.8v IO) >> > use 1.8v IO; >> > so if host and device can only support 3.3v IO, this is the last choice. >> > >> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> >> > Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com> >> >> This looks good to me! But before I queue it for 3.18 I would appreciate if we >> could get some help in testing this for some various platforms, that support >> MMC DDR. > > Thanks a lot. BTW, this patch is already tested on Intel's platform which can support MMC DDR. This patch associated with vqmmc-supply and vmmc-supply in the DT is working for me too on i.MX6. JM -- 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
On 2 September 2014 17:31, Jean-Michel Hautbois <jhautbois@gmail.com> wrote: > 2014-08-15 10:36 GMT+02:00 Dong, Chuanxiao <chuanxiao.dong@intel.com>: >> >> >>> -----Original Message----- >>> From: Ulf Hansson [mailto:ulf.hansson@linaro.org] >>> Sent: Friday, August 15, 2014 4:34 PM >>> To: Dong, Chuanxiao >>> Cc: linux-mmc; chris@printf.org >>> Subject: Re: [PATCH v3] mmc: core: try 1.8v signling in ddr mode if host and >>> device >>> >>> On 15 August 2014 05:28, Chuanxiao Dong <chuanxiao.dong@intel.com> >>> wrote: >>> > Even (e)MMC 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. >>> > >>> > So the sequence will be: >>> > if (host and device can both support 1.2v IO) >>> > use 1.2v IO; >>> > else if (host and device can both support 1.8v IO) >>> > use 1.8v IO; >>> > so if host and device can only support 3.3v IO, this is the last choice. >>> > >>> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> >>> > Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com> >>> >>> This looks good to me! But before I queue it for 3.18 I would appreciate if we >>> could get some help in testing this for some various platforms, that support >>> MMC DDR. >> >> Thanks a lot. BTW, this patch is already tested on Intel's platform which can support MMC DDR. > > This patch associated with vqmmc-supply and vmmc-supply in the DT is > working for me too on i.MX6. > JM Thanks! Applied for next. I took the liberty of updating the commit msg header to "mmc: core: Fix sequence for I/O voltage in DDR mode for eMMC", to get a better description of the patch. I also added a tested by tag from "JM". Please tell me if you have any concern with my changes. 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
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogbGludXgtbW1jLW93bmVy QHZnZXIua2VybmVsLm9yZw0KPiBbbWFpbHRvOmxpbnV4LW1tYy1vd25lckB2Z2VyLmtlcm5lbC5v cmddIE9uIEJlaGFsZiBPZiBVbGYgSGFuc3Nvbg0KPiBTZW50OiBXZWRuZXNkYXksIFNlcHRlbWJl ciAwMywgMjAxNCAzOjIxIFBNDQo+IFRvOiBKZWFuLU1pY2hlbCBIYXV0Ym9pczsgRG9uZywgQ2h1 YW54aWFvDQo+IENjOiBsaW51eC1tbWM7IGNocmlzQHByaW50Zi5vcmcNCj4gU3ViamVjdDogUmU6 IFtQQVRDSCB2M10gbW1jOiBjb3JlOiB0cnkgMS44diBzaWdubGluZyBpbiBkZHIgbW9kZSBpZiBo b3N0IGFuZA0KPiBkZXZpY2UNCj4gDQo+IE9uIDIgU2VwdGVtYmVyIDIwMTQgMTc6MzEsIEplYW4t TWljaGVsIEhhdXRib2lzIDxqaGF1dGJvaXNAZ21haWwuY29tPg0KPiB3cm90ZToNCj4gPiAyMDE0 LTA4LTE1IDEwOjM2IEdNVCswMjowMCBEb25nLCBDaHVhbnhpYW8NCj4gPGNodWFueGlhby5kb25n QGludGVsLmNvbT46DQo+ID4+DQo+ID4+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IA0KPiBJIHRvb2sgdGhlIGxpYmVydHkgb2YgdXBkYXRpbmcgdGhlIGNvbW1pdCBtc2cgaGVhZGVy IHRvICJtbWM6IGNvcmU6DQo+IEZpeCBzZXF1ZW5jZSBmb3IgSS9PIHZvbHRhZ2UgaW4gRERSIG1v ZGUgZm9yIGVNTUMiLCB0byBnZXQgYSBiZXR0ZXINCj4gZGVzY3JpcHRpb24gb2YgdGhlIHBhdGNo Lg0KPiANCj4gSSBhbHNvIGFkZGVkIGEgdGVzdGVkIGJ5IHRhZyBmcm9tICJKTSIuDQo+IA0KPiBQ bGVhc2UgdGVsbCBtZSBpZiB5b3UgaGF2ZSBhbnkgY29uY2VybiB3aXRoIG15IGNoYW5nZXMuDQpO byBjb25jZXJuIGZyb20gbXkgc2lkZS4NCg0KVGhhbmtzIEpNIGZvciB0ZXN0aW5nIHRoaXMgcGF0 Y2gsIGFuZCBhbHNvIHRoYW5rcyBVbGYgZm9yIG1ha2luZyB0aGlzIHBhdGNoIGJldHRlciA6KQ0K DQpUaGFua3MNCkNodWFueGlhbw0KDQo+IA0KPiBLaW5kIHJlZ2FyZHMNCj4gVWZmZQ0KPiAtLQ0K PiBUbyB1bnN1YnNjcmliZSBmcm9tIHRoaXMgbGlzdDogc2VuZCB0aGUgbGluZSAidW5zdWJzY3Jp YmUgbGludXgtbW1jIiBpbiB0aGUgYm9keQ0KPiBvZiBhIG1lc3NhZ2UgdG8gbWFqb3Jkb21vQHZn ZXIua2VybmVsLm9yZyBNb3JlIG1ham9yZG9tbyBpbmZvIGF0DQo+IGh0dHA6Ly92Z2VyLmtlcm5l bC5vcmcvbWFqb3Jkb21vLWluZm8uaHRtbA0K -- 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 --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 793c6f7..8d69671 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -988,19 +988,35 @@ static int mmc_select_hs_ddr(struct mmc_card *card) * 1.8V vccq at 3.3V core voltage (vcc) is not required * in the JEDEC spec for DDR. * - * Do not force change in vccq since we are obviously - * working and no change to vccq is needed. + * Even (e)MMC 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. + * + * So the sequence will be: + * if (host and device can both support 1.2v IO) + * use 1.2v IO; + * else if (host and device can both support 1.8v IO) + * use 1.8v IO; + * so if host and device can only support 3.3v IO, this is the + * last choice. * * WARNING: eMMC rules are NOT the same as SD DDR */ - if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_2V) { - err = __mmc_set_signal_voltage(host, - MMC_SIGNAL_VOLTAGE_120); - if (err) - return err; - } + err = -EINVAL; + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_2V) + err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); - mmc_set_timing(host, MMC_TIMING_MMC_DDR52); + if (err && (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_8V)) + err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); + + /* make sure vccq is 3.3v after switching disaster */ + if (err) + err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330); + + if (!err) + mmc_set_timing(host, MMC_TIMING_MMC_DDR52); return err; }