Skip to content

Commit

Permalink
mmc: core: add driver strength selection when selecting hs400es
Browse files Browse the repository at this point in the history
The driver strength selection is missed and required when selecting
hs400es. So, It is added here.

Fixes: 81ac2af ("mmc: core: implement enhanced strobe support")
Cc: stable@vger.kernel.org
Signed-off-by: Hankyung Yu <hankyung.yu@lge.com>
Signed-off-by: Chanho Min <chanho.min@lge.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
  • Loading branch information
Chanho Min authored and Ulf Hansson committed Oct 2, 2017
1 parent 9e66317 commit fb45886
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions drivers/mmc/core/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,23 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
return err;
}

static void mmc_select_driver_type(struct mmc_card *card)
{
int card_drv_type, drive_strength, drv_type;

card_drv_type = card->ext_csd.raw_driver_strength |
mmc_driver_type_mask(0);

drive_strength = mmc_select_drive_strength(card,
card->ext_csd.hs200_max_dtr,
card_drv_type, &drv_type);

card->drive_strength = drive_strength;

if (drv_type)
mmc_set_driver_type(card->host, drv_type);
}

static int mmc_select_hs400es(struct mmc_card *card)
{
struct mmc_host *host = card->host;
Expand Down Expand Up @@ -1341,6 +1358,8 @@ static int mmc_select_hs400es(struct mmc_card *card)
goto out_err;
}

mmc_select_driver_type(card);

/* Switch card to HS400 */
val = EXT_CSD_TIMING_HS400 |
card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
Expand Down Expand Up @@ -1374,23 +1393,6 @@ static int mmc_select_hs400es(struct mmc_card *card)
return err;
}

static void mmc_select_driver_type(struct mmc_card *card)
{
int card_drv_type, drive_strength, drv_type;

card_drv_type = card->ext_csd.raw_driver_strength |
mmc_driver_type_mask(0);

drive_strength = mmc_select_drive_strength(card,
card->ext_csd.hs200_max_dtr,
card_drv_type, &drv_type);

card->drive_strength = drive_strength;

if (drv_type)
mmc_set_driver_type(card->host, drv_type);
}

/*
* For device supporting HS200 mode, the following sequence
* should be done before executing the tuning process.
Expand Down

0 comments on commit fb45886

Please sign in to comment.