summaryrefslogtreecommitdiff
path: root/drivers/mmc/core/sd.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2015-02-06 15:12:55 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2015-06-01 10:07:12 +0300
commite23350b35deb77ef8e33c35dbb0ed1dab9e8ab86 (patch)
tree29cc97e17338d483ecb47bb8ed075107d154164a /drivers/mmc/core/sd.c
parentf168359efbb99d6f8591bb666d6510bb78df2d07 (diff)
downloadlinux-e23350b35deb77ef8e33c35dbb0ed1dab9e8ab86.tar.xz
mmc: core: Factor out common code in drive strength selection
Make a new function out of common code used for drive strength selection. 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.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 63f9163b8dda..9771b84db4b3 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -386,35 +386,14 @@ out:
static int sd_select_driver_type(struct mmc_card *card, u8 *status)
{
- int host_drv_type = SD_DRIVER_TYPE_B;
int card_drv_type, drive_strength, drv_type;
int err;
- if (!card->host->ops->select_drive_strength)
- return 0;
-
- if (card->host->caps & MMC_CAP_DRIVER_TYPE_A)
- host_drv_type |= SD_DRIVER_TYPE_A;
-
- if (card->host->caps & MMC_CAP_DRIVER_TYPE_C)
- host_drv_type |= SD_DRIVER_TYPE_C;
-
- if (card->host->caps & MMC_CAP_DRIVER_TYPE_D)
- host_drv_type |= SD_DRIVER_TYPE_D;
-
card_drv_type = card->sw_caps.sd3_drv_type | SD_DRIVER_TYPE_B;
- /*
- * The drive strength that the hardware can support
- * depends on the board design. Pass the appropriate
- * information and let the hardware specific code
- * return what is possible given the options
- */
- mmc_host_clk_hold(card->host);
- drive_strength = card->host->ops->select_drive_strength(card,
- card->sw_caps.uhs_max_dtr,
- host_drv_type, card_drv_type, &drv_type);
- mmc_host_clk_release(card->host);
+ drive_strength = mmc_select_drive_strength(card,
+ card->sw_caps.uhs_max_dtr,
+ card_drv_type, &drv_type);
if (drive_strength) {
err = mmc_sd_switch(card, 1, 2, drive_strength, status);