diff options
author | Vincent Yang <vincent.yang.fujitsu@gmail.com> | 2014-11-20 19:51:40 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2014-11-26 08:31:05 -0500 |
commit | c6eb588028f8f23dae8e26312cf192f365c85b95 (patch) | |
tree | 97bc0ab1c2d1f0fb861ec6f736fc8c08ab1a9b72 /drivers/mmc | |
parent | e34d467c515f5f64e12c28fb2b15035c9b38f332 (diff) |
mmc: core: hold SD Clock before CMD11 during Signal
Voltage Switch Procedure
This patch is to fix an issue found on mb86s7x platforms.
[symptom]
There are some UHS-1 SD memory cards sometimes cannot be detected correctly,
e.g., Transcend 600x SDXC 64GB UHS-1 memory card.
During Signal Voltage Switch Procedure, failure to switch is indicated
by the card holding DAT[3:0] low.
[analysis]
According to SD Host Controller Simplified Specification Version 3.00
chapter 3.6.1, the Signal Voltage Switch Procedure should be:
(1) Check S18A; (2) Issue CMD11; (3) Check CMD 11 response;
(4) Stop providing SD clock; (5) Check DAT[3:0] should be 0000b;
(6) Set 1.8V Signal Enable; (7) Wait 5ms; (8) Check 1.8V Signal Enable;
(9) Provide SD Clock; (10) Wait 1ms; (11) Check DAT[3:0] should be 1111b;
(12) error handling
With CONFIG_MMC_CLKGATE=y, sometimes there is one more gating/un-gating
SD clock between (2) and (3). In this case, some UHS-1 SD cards will hold
DAT[3:0] 0000b at (11) and thus fails Signal Voltage Switch Procedure.
[solution]
By mmc_host_clk_hold() before CMD11, the additional gating/un-gating
SD clock between (2) and (3) can be prevented and thus no failure at (11).
It has been verified with many UHS-1 SD cards on mb86s7x platforms and
works correctly.
Signed-off-by: Vincent Yang <Vincent.Yang@tw.fujitsu.com>
Reviewed-by: Johan Rudholm <jrudholm@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/core.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 5bda29bff8eb..9584bffa8b22 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1447,18 +1447,20 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr) | |||
1447 | pr_warn("%s: cannot verify signal voltage switch\n", | 1447 | pr_warn("%s: cannot verify signal voltage switch\n", |
1448 | mmc_hostname(host)); | 1448 | mmc_hostname(host)); |
1449 | 1449 | ||
1450 | mmc_host_clk_hold(host); | ||
1451 | |||
1450 | cmd.opcode = SD_SWITCH_VOLTAGE; | 1452 | cmd.opcode = SD_SWITCH_VOLTAGE; |
1451 | cmd.arg = 0; | 1453 | cmd.arg = 0; |
1452 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | 1454 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; |
1453 | 1455 | ||
1454 | err = mmc_wait_for_cmd(host, &cmd, 0); | 1456 | err = mmc_wait_for_cmd(host, &cmd, 0); |
1455 | if (err) | 1457 | if (err) |
1456 | return err; | 1458 | goto err_command; |
1457 | |||
1458 | if (!mmc_host_is_spi(host) && (cmd.resp[0] & R1_ERROR)) | ||
1459 | return -EIO; | ||
1460 | 1459 | ||
1461 | mmc_host_clk_hold(host); | 1460 | if (!mmc_host_is_spi(host) && (cmd.resp[0] & R1_ERROR)) { |
1461 | err = -EIO; | ||
1462 | goto err_command; | ||
1463 | } | ||
1462 | /* | 1464 | /* |
1463 | * The card should drive cmd and dat[0:3] low immediately | 1465 | * The card should drive cmd and dat[0:3] low immediately |
1464 | * after the response of cmd11, but wait 1 ms to be sure | 1466 | * after the response of cmd11, but wait 1 ms to be sure |
@@ -1507,6 +1509,7 @@ power_cycle: | |||
1507 | mmc_power_cycle(host, ocr); | 1509 | mmc_power_cycle(host, ocr); |
1508 | } | 1510 | } |
1509 | 1511 | ||
1512 | err_command: | ||
1510 | mmc_host_clk_release(host); | 1513 | mmc_host_clk_release(host); |
1511 | 1514 | ||
1512 | return err; | 1515 | return err; |