summaryrefslogtreecommitdiff
path: root/drivers/mmc/core/sd.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2015-02-06 14:12:52 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2015-06-01 09:07:11 +0200
commitb4f30a174e1fda8118eda038b5d8d5260db36ad5 (patch)
treedc77366f106bc5b15aa836518dc5cbfca855b558 /drivers/mmc/core/sd.c
parent75e8a2288c4fabd6c2f752e8fd3bf7f60be7d3a4 (diff)
mmc: core: Allow card drive strength to be different to host
Initialization of UHS-I modes for SD and SDIO cards employs a callback to allow the host driver to choose a drive strength value. Currently that assumes the card drive strength and host driver type must be the same value. Change to let the callback make that decision and return both the card drive strength and host driver type. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/sd.c')
-rw-r--r--drivers/mmc/core/sd.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 8f6864a2a055..5edd7d8b033e 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -388,18 +388,9 @@ static int sd_select_driver_type(struct mmc_card *card, u8 *status)
{
int host_drv_type = SD_DRIVER_TYPE_B;
int card_drv_type = SD_DRIVER_TYPE_B;
- int drive_strength;
+ int drive_strength, drv_type;
int err;
- /*
- * If the host doesn't support any of the Driver Types A,C or D,
- * or there is no board specific handler then default Driver
- * Type B is used.
- */
- if (!(card->host->caps & (MMC_CAP_DRIVER_TYPE_A | MMC_CAP_DRIVER_TYPE_C
- | MMC_CAP_DRIVER_TYPE_D)))
- return 0;
-
if (!card->host->ops->select_drive_strength)
return 0;
@@ -430,20 +421,22 @@ static int sd_select_driver_type(struct mmc_card *card, u8 *status)
mmc_host_clk_hold(card->host);
drive_strength = card->host->ops->select_drive_strength(
card->sw_caps.uhs_max_dtr,
- host_drv_type, card_drv_type);
+ host_drv_type, card_drv_type, &drv_type);
mmc_host_clk_release(card->host);
- err = mmc_sd_switch(card, 1, 2, drive_strength, status);
- if (err)
- return err;
-
- if ((status[15] & 0xF) != drive_strength) {
- pr_warn("%s: Problem setting drive strength!\n",
- mmc_hostname(card->host));
- return 0;
+ if (drive_strength) {
+ err = mmc_sd_switch(card, 1, 2, drive_strength, status);
+ if (err)
+ return err;
+ if ((status[15] & 0xF) != drive_strength) {
+ pr_warn("%s: Problem setting drive strength!\n",
+ mmc_hostname(card->host));
+ return 0;
+ }
}
- mmc_set_driver_type(card->host, drive_strength);
+ if (drv_type)
+ mmc_set_driver_type(card->host, drv_type);
return 0;
}