Commit 41875e38 authored by Sujit Reddy Thumma's avatar Sujit Reddy Thumma Committed by Chris Ball

mmc: sdio: Fix SDIO 3.0 UHS-I initialization sequence

According to UHS-I initialization sequence for SDIO 3.0 cards,
the host must set bit[24] (S18R) of OCR register during OCR
handshake to know whether the SDIO card is capable of doing
1.8V I/O.
Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Reviewed-by: default avatarJohan Rudholm <johan.rudholm@stericsson.com>
Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 51aa66a5
...@@ -157,10 +157,7 @@ static int sdio_read_cccr(struct mmc_card *card, u32 ocr) ...@@ -157,10 +157,7 @@ static int sdio_read_cccr(struct mmc_card *card, u32 ocr)
if (ret) if (ret)
goto out; goto out;
if (card->host->caps & if (mmc_host_uhs(card->host)) {
(MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 |
MMC_CAP_UHS_DDR50)) {
if (data & SDIO_UHS_DDR50) if (data & SDIO_UHS_DDR50)
card->sw_caps.sd3_bus_mode card->sw_caps.sd3_bus_mode
|= SD_MODE_UHS_DDR50; |= SD_MODE_UHS_DDR50;
...@@ -478,8 +475,7 @@ static int sdio_set_bus_speed_mode(struct mmc_card *card) ...@@ -478,8 +475,7 @@ static int sdio_set_bus_speed_mode(struct mmc_card *card)
* If the host doesn't support any of the UHS-I modes, fallback on * If the host doesn't support any of the UHS-I modes, fallback on
* default speed. * default speed.
*/ */
if (!(card->host->caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | if (!mmc_host_uhs(card->host))
MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_DDR50)))
return 0; return 0;
bus_speed = SDIO_SPEED_SDR12; bus_speed = SDIO_SPEED_SDR12;
...@@ -645,11 +641,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, ...@@ -645,11 +641,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
* systems that claim 1.8v signalling in fact do not support * systems that claim 1.8v signalling in fact do not support
* it. * it.
*/ */
if ((ocr & R4_18V_PRESENT) && if ((ocr & R4_18V_PRESENT) && mmc_host_uhs(host)) {
(host->caps &
(MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 |
MMC_CAP_UHS_DDR50))) {
err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180,
true); true);
if (err) { if (err) {
...@@ -1022,6 +1014,10 @@ static int mmc_sdio_power_restore(struct mmc_host *host) ...@@ -1022,6 +1014,10 @@ static int mmc_sdio_power_restore(struct mmc_host *host)
goto out; goto out;
} }
if (mmc_host_uhs(host))
/* to query card if 1.8V signalling is supported */
host->ocr |= R4_18V_PRESENT;
ret = mmc_sdio_init_card(host, host->ocr, host->card, ret = mmc_sdio_init_card(host, host->ocr, host->card,
mmc_card_keep_power(host)); mmc_card_keep_power(host));
if (!ret && host->sdio_irqs) if (!ret && host->sdio_irqs)
...@@ -1087,6 +1083,10 @@ int mmc_attach_sdio(struct mmc_host *host) ...@@ -1087,6 +1083,10 @@ int mmc_attach_sdio(struct mmc_host *host)
/* /*
* Detect and init the card. * Detect and init the card.
*/ */
if (mmc_host_uhs(host))
/* to query card if 1.8V signalling is supported */
host->ocr |= R4_18V_PRESENT;
err = mmc_sdio_init_card(host, host->ocr, NULL, 0); err = mmc_sdio_init_card(host, host->ocr, NULL, 0);
if (err) { if (err) {
if (err == -EAGAIN) { if (err == -EAGAIN) {
......
...@@ -434,6 +434,14 @@ static inline int mmc_boot_partition_access(struct mmc_host *host) ...@@ -434,6 +434,14 @@ static inline int mmc_boot_partition_access(struct mmc_host *host)
return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
} }
static inline int mmc_host_uhs(struct mmc_host *host)
{
return host->caps &
(MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 |
MMC_CAP_UHS_DDR50);
}
#ifdef CONFIG_MMC_CLKGATE #ifdef CONFIG_MMC_CLKGATE
void mmc_host_clk_hold(struct mmc_host *host); void mmc_host_clk_hold(struct mmc_host *host);
void mmc_host_clk_release(struct mmc_host *host); void mmc_host_clk_release(struct mmc_host *host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment