mmc: sd: Fix signal voltage when there is no power cycle
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 25 Sep 2017 08:29:04 +0000 (11:29 +0300)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 30 Oct 2017 10:45:57 +0000 (11:45 +0100)
commit6a11fc47f175c8d87018e89cb58e2d36c66534cb
tree99e66a5bc89c10e724bb463ac37873f0455ff13e
parent3f496afb6fb361b282f37968ff7d3d80b0f1b5cb
mmc: sd: Fix signal voltage when there is no power cycle

Some boards have SD card connectors where the power rail cannot be switched
off by the driver. However there are various circumstances when a card
might be re-initialized, such as after system resume, warm re-boot, or
error handling. However, a UHS card will continue to use 1.8V signaling
unless it is power cycled.

If the card has not been power cycled, it may still be using 1.8V
signaling. According to the SD spec., the Bus Speed Mode (function group 1)
bits 2 to 4 are zero if the card is initialized at 3.3V signal level. Thus
they can be used to determine if the card has already switched to 1.8V
signaling. Detect that situation and try to initialize a UHS-I (1.8V)
transfer mode.

Tested with the following cards:
  Transcend 4GB High Speed
  Kingston 64GB SDR104
  Lexar by Micron HIGH-PERFORMANCE 300x 16GB DDR50
  SanDisk Ultra 8GB DDR50
  Transcend Ultimate 600x 16GB SDR104
  Transcend Premium 300x 64GB SDR104
  Lexar by Micron Professional 1000x 32GB UHS-II SDR104
  SanDisk Extreme Pro 16GB SDR104

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Zhoujie Wu <zjwu@marvell.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/sd.c