]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mmc: Work in UHS modes even if card already switched to UHS
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Tue, 25 Jul 2017 06:21:35 +0000 (11:51 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 25 Jul 2017 06:34:12 +0000 (08:34 +0200)
This patch adds support for swicthing to UHS mode even if
the card already switched to UHS modes.
This patch fixes an issue where it is not able to power
cycle the SD card. Due to this once the card is initialized
in UHS-I mode it cannot be reinitialized in UHS-I mode again.
So to solve this issue there are some checks that are made in
place to ensure that the card operates in UHS-I mode even on
reinitialization. This will enable the SD host controller to
run SD at 200MHz in uboot even if the bootloader was running
at 200MHz.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/mmc/mmc.c

index e28b4048ffdef973f80b3091589b905ee952a01b..88cf23a443db3e50ec974a1988151da94f99e0f0 100644 (file)
@@ -1187,9 +1187,23 @@ retry_scr:
 
        mode = MMC_TIMING_HS;
 
-       if (mmc->is_uhs && mmc->version >= SD_VERSION_3) {
-               if (!(mmc_host_uhs(mmc)))
-                       return 0;
+       if ((mmc->version >= SD_VERSION_3) &&
+           mmc_host_uhs(mmc)) {
+               /*
+                * If the card is already in 1.8V and the system doesn't have
+                * mechanism to power cycle the SD card, it will respond with
+                * no 1.8V supported in OCR response. Below check will confirm
+                * if the above condition has occured. If the host is supporting
+                * UHS modes and the card is supporting SD specification 3.0 and
+                * above, it can operate at UHS modes and hence switch to 1.8
+                * voltage.
+                */
+               if (__be32_to_cpu(switch_status[3]) &
+                   (SD_UHS_SPEED_SDR104 | SD_UHS_SPEED_DDR50 |
+                    SD_UHS_SPEED_SDR50)) {
+                       mmc->is_uhs = 1;
+                       mmc_set_voltage(mmc);
+               }
 
                if (__be32_to_cpu(switch_status[3]) &
                    SD_UHS_SPEED_SDR104) {