From: Fabio Estevam <festevam@gmail.com>
To: ulf.hansson@linaro.org
Cc: aisheng.dong@freescale.com, kevin.lemoi@savant.com,
otavio@ossystems.com.br, kernel@pengutronix.de,
linux@arm.linux.org.uk, chuanxiao.dong@intel.com,
linux-mmc@vger.kernel.org,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH v2] mmc: core: Do not set mmc voltage to 1.8V when 'no-1-8-v' is present
Date: Sat, 13 Jun 2015 17:24:27 -0300 [thread overview]
Message-ID: <1434227067-9600-1-git-send-email-festevam@gmail.com> (raw)
From: Fabio Estevam <fabio.estevam@freescale.com>
Since commit 312449efd16bb06 ("mmc: core: Fix sequence for I/O voltage
in DDR mode for eMMC") the mmc voltage is set to 1.8V inside
mmc_select_hs_ddr(), even if 'no-1-8-v' property is present.
This causes the following error on a mx6sl board with the 'no-1-8-v'
property passed in the device tree:
mmc0: power class selection to bus width 8 ddr 4 failed
mmc0: error -110 whilst initialising MMC card
Fix this problem by only setting the mmc voltage to 1.8V if the
'no-1-8-v' property is absent.
Reported-by: Kevin Lemoi <kevin.lemoi@savant.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Fix it in the core code instead of doing it inside the sdhci imx code
drivers/mmc/core/host.c | 2 ++
drivers/mmc/core/mmc.c | 8 +++++++-
include/linux/mmc/host.h | 1 +
include/linux/mmc/mmc.h | 1 +
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 01fa1ed..736c985 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -527,6 +527,8 @@ int mmc_of_parse(struct mmc_host *host)
host->caps2 |= MMC_CAP2_HS400_1_8V | MMC_CAP2_HS200_1_8V_SDR;
if (of_find_property(np, "mmc-hs400-1_2v", &len))
host->caps2 |= MMC_CAP2_HS400_1_2V | MMC_CAP2_HS200_1_2V_SDR;
+ if (of_find_property(np, "no-1-8-v", &len))
+ host->caps2 |= MMC_CAP_3_3V_ONLY_DDR;
host->dsr_req = !of_property_read_u32(np, "dsr", &host->dsr);
if (host->dsr_req && (host->dsr & ~0xffff)) {
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index e726903..e76b9af 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -205,6 +205,10 @@ static void mmc_select_card_type(struct mmc_card *card)
avail_type |= EXT_CSD_CARD_TYPE_DDR_1_8V;
}
+ if (caps2 & MMC_CAP_3_3V_ONLY_DDR &&
+ card_type & EXT_CSD_CARD_TYPE_DDR_1_8V)
+ avail_type |= EXT_CSD_CARD_TYPE_DDR_3_3V_ONLY;
+
if (caps & MMC_CAP_1_2V_DDR &&
card_type & EXT_CSD_CARD_TYPE_DDR_1_2V) {
hs_max_dtr = MMC_HIGH_DDR_MAX_DTR;
@@ -1028,7 +1032,9 @@ static int mmc_select_hs_ddr(struct mmc_card *card)
err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
if (err && (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_8V))
- err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
+ if (!(card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_3_3V_ONLY))
+ err = __mmc_set_signal_voltage(host,
+ MMC_SIGNAL_VOLTAGE_180);
/* make sure vccq is 3.3v after switching disaster */
if (err)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1369e54..5aa999f 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -289,6 +289,7 @@ struct mmc_host {
#define MMC_CAP2_HSX00_1_2V (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V)
#define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
#define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */
+#define MMC_CAP_3_3V_ONLY_DDR (1 << 19) /* Only supports 3.3V DDR */
mmc_pm_flag_t pm_caps; /* supported pm features */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 15f2c4a..b3cbd3c 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -380,6 +380,7 @@ struct _mmc_csd {
#define EXT_CSD_CARD_TYPE_HS400_1_2V (1<<7) /* Card can run at 200MHz DDR, 1.2V */
#define EXT_CSD_CARD_TYPE_HS400 (EXT_CSD_CARD_TYPE_HS400_1_8V | \
EXT_CSD_CARD_TYPE_HS400_1_2V)
+#define EXT_CSD_CARD_TYPE_DDR_3_3V_ONLY (1<<8)
#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 */
--
1.9.1
next reply other threads:[~2015-06-13 20:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-13 20:24 Fabio Estevam [this message]
2015-06-15 11:44 ` [PATCH v2] mmc: core: Do not set mmc voltage to 1.8V when 'no-1-8-v' is present Otavio Salvador
2015-06-15 12:08 ` Ulf Hansson
2015-06-15 12:23 ` Fabio Estevam
2015-06-15 12:49 ` Fabio Estevam
2015-06-16 9:31 ` Ulf Hansson
2015-06-17 16:25 ` Fabio Estevam
2015-06-18 7:58 ` Ulf Hansson
2015-06-18 14:25 ` Dong Aisheng
2015-06-18 14:03 ` Dong Aisheng
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=1434227067-9600-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=aisheng.dong@freescale.com \
--cc=chuanxiao.dong@intel.com \
--cc=fabio.estevam@freescale.com \
--cc=kernel@pengutronix.de \
--cc=kevin.lemoi@savant.com \
--cc=linux-mmc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=otavio@ossystems.com.br \
--cc=ulf.hansson@linaro.org \
/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).