From db3aa310b0027604eeeddeff5aa489c554e1827b Mon Sep 17 00:00:00 2001 From: Chuanxiao Dong Date: Fri, 4 May 2012 17:54:55 +0800 Subject: [PATCH] mmc: sd: Handle SD3.0 cards not supporting UHS-I bus speed mode BZ: 34834 This patch is a variant of an upstream patch. It fixed SD cannot change high spee mode issue. Below is the original commit info: Here is Essential conditions to indicate Version 3.00 Card (SD_SPEC=2 and SD_SPEC3=1) : (1) The card shall support CMD6 (2) The card shall support CMD8 (3) The card shall support CMD42 (4) User area capacity shall be up to 2GB (SDSC) or 32GB (SDHC) User area capacity shall be more than or equal to 32GB and up to 2TB (SDXC) (5) Speed Class shall be supported (SDHC or SDXC) So even if SD card doesn't support any of the newly defined UHS-I bus speed mode, it can advertise itself as SD3.0 cards as long as it supports all the essential conditions of SD3.0 cards. Given this, these type of cards should atleast run in High Speed mode @50MHZ if it supports HS. But current initialization sequence for SD3.0 cards is such that these non-UHS-I SD3.0 cards runs in Default Speed mode @25MHz. This patch makes sure that these non-UHS-I SD3.0 cards run in High Speed Mode @50MHz. Change-Id: I780ac5d2d076fe56b8079bfd98fc234d301eef4b Signed-off-by: Chuanxiao Dong Reviewed-on: http://android.intel.com:8080/47435 Reviewed-by: Tang, Richard Tested-by: Sun, Jianhua Reviewed-by: buildbot Tested-by: buildbot --- drivers/mmc/core/sd.c | 6 +++--- include/linux/mmc/card.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 010002c..eade770 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -326,6 +326,9 @@ static int mmc_read_switch(struct mmc_card *card) goto out; } + if (status[13] & SD_MODE_HIGH_SPEED) + card->sw_caps.hs_max_dtr = 50000000; + if (card->scr.sda_spec3) { card->sw_caps.sd3_bus_mode = status[13]; @@ -368,9 +371,6 @@ static int mmc_read_switch(struct mmc_card *card) } card->sw_caps.sd3_curr_limit = status[7]; - } else { - if (status[13] & 0x02) - card->sw_caps.hs_max_dtr = 50000000; } out: diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 6834147..867afac 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -118,11 +118,13 @@ struct sd_switch_caps { #define UHS_SDR12_MAX_DTR 25000000 unsigned int sd3_bus_mode; #define UHS_SDR12_BUS_SPEED 0 +#define HIGH_SPEED_BUS_MODE 1 #define UHS_SDR25_BUS_SPEED 1 #define UHS_SDR50_BUS_SPEED 2 #define UHS_SDR104_BUS_SPEED 3 #define UHS_DDR50_BUS_SPEED 4 +#define SD_MODE_HIGH_SPEED (1 << HIGH_SPEED_BUS_MODE) #define SD_MODE_UHS_SDR12 (1 << UHS_SDR12_BUS_SPEED) #define SD_MODE_UHS_SDR25 (1 << UHS_SDR25_BUS_SPEED) #define SD_MODE_UHS_SDR50 (1 << UHS_SDR50_BUS_SPEED) -- 2.7.4