This patch didn't change functionality just move mmc_select_hs400() and mmc_hs200_to_hs400() between mmc_select_hs400es() and mmc_select_hs200 and fix checkpatch --script warings. Signed-off-by: Chris Ruehl <chris.ruehl@xxxxxxxxxxxx> --- drivers/mmc/core/mmc.c | 184 ++++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index ff3063ce2acd..5477786aded8 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1142,98 +1142,6 @@ static int mmc_select_hs_ddr(struct mmc_card *card) return err; } -static int mmc_select_hs400(struct mmc_card *card) -{ - struct mmc_host *host = card->host; - unsigned int max_dtr; - int err = 0; - u8 val; - - /* - * HS400 mode requires 8-bit bus width - */ - if (!(card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400 && - host->ios.bus_width == MMC_BUS_WIDTH_8)) - return 0; - - /* Switch card to HS mode */ - val = EXT_CSD_TIMING_HS; - err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_HS_TIMING, val, - card->ext_csd.generic_cmd6_time, 0, - false, true); - if (err) { - pr_err("%s: switch to high-speed from hs200 failed, err:%d\n", - mmc_hostname(host), err); - return err; - } - - /* Prepare host to downgrade to HS timing */ - if (host->ops->hs400_downgrade) - host->ops->hs400_downgrade(host); - - /* Set host controller to HS timing */ - mmc_set_timing(host, MMC_TIMING_MMC_HS); - - /* Reduce frequency to HS frequency */ - max_dtr = card->ext_csd.hs_max_dtr; - mmc_set_clock(host, max_dtr); - - err = mmc_switch_status(card, true); - if (err) - goto out_err; - - if (host->ops->hs400_prepare_ddr) - host->ops->hs400_prepare_ddr(host); - - /* Switch card to DDR */ - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_BUS_WIDTH, - EXT_CSD_DDR_BUS_WIDTH_8, - card->ext_csd.generic_cmd6_time); - if (err) { - pr_err("%s: switch to bus width for hs400 failed, err:%d\n", - mmc_hostname(host), err); - return err; - } - - /* Switch card to HS400 */ - val = EXT_CSD_TIMING_HS400 | - card->drive_strength << EXT_CSD_DRV_STR_SHIFT; - err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_HS_TIMING, val, - card->ext_csd.generic_cmd6_time, 0, - false, true); - if (err) { - pr_err("%s: switch to hs400 failed, err:%d\n", - mmc_hostname(host), err); - return err; - } - - /* Set host controller to HS400 timing and frequency */ - mmc_set_timing(host, MMC_TIMING_MMC_HS400); - mmc_set_bus_speed(card); - - if (host->ops->hs400_complete) - host->ops->hs400_complete(host); - - err = mmc_switch_status(card, true); - if (err) - goto out_err; - - return 0; - -out_err: - pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host), - __func__, err); - return err; -} - -int mmc_hs200_to_hs400(struct mmc_card *card) -{ - return mmc_select_hs400(card); -} - int mmc_hs400_to_hs200(struct mmc_card *card) { struct mmc_host *host = card->host; @@ -1425,6 +1333,98 @@ static int mmc_select_hs400es(struct mmc_card *card) return err; } +static int mmc_select_hs400(struct mmc_card *card) +{ + struct mmc_host *host = card->host; + unsigned int max_dtr; + int err = 0; + u8 val; + + /* + * HS400 mode requires 8-bit bus width + */ + if (!(card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400 && + host->ios.bus_width == MMC_BUS_WIDTH_8)) + return 0; + + /* Switch card to HS mode */ + val = EXT_CSD_TIMING_HS; + err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_HS_TIMING, val, + card->ext_csd.generic_cmd6_time, 0, + false, true); + if (err) { + pr_err("%s: switch to high-speed from hs200 failed, err:%d\n", + mmc_hostname(host), err); + return err; + } + + /* Prepare host to downgrade to HS timing */ + if (host->ops->hs400_downgrade) + host->ops->hs400_downgrade(host); + + /* Set host controller to HS timing */ + mmc_set_timing(host, MMC_TIMING_MMC_HS); + + /* Reduce frequency to HS frequency */ + max_dtr = card->ext_csd.hs_max_dtr; + mmc_set_clock(host, max_dtr); + + err = mmc_switch_status(card, true); + if (err) + goto out_err; + + if (host->ops->hs400_prepare_ddr) + host->ops->hs400_prepare_ddr(host); + + /* Switch card to DDR */ + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_BUS_WIDTH, + EXT_CSD_DDR_BUS_WIDTH_8, + card->ext_csd.generic_cmd6_time); + if (err) { + pr_err("%s: switch to bus width for hs400 failed, err:%d\n", + mmc_hostname(host), err); + return err; + } + + /* Switch card to HS400 */ + val = EXT_CSD_TIMING_HS400 | + card->drive_strength << EXT_CSD_DRV_STR_SHIFT; + err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_HS_TIMING, val, + card->ext_csd.generic_cmd6_time, 0, + false, true); + if (err) { + pr_err("%s: switch to hs400 failed, err:%d\n", + mmc_hostname(host), err); + return err; + } + + /* Set host controller to HS400 timing and frequency */ + mmc_set_timing(host, MMC_TIMING_MMC_HS400); + mmc_set_bus_speed(card); + + if (host->ops->hs400_complete) + host->ops->hs400_complete(host); + + err = mmc_switch_status(card, true); + if (err) + goto out_err; + + return 0; + +out_err: + pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host), + __func__, err); + return err; +} + +int mmc_hs200_to_hs400(struct mmc_card *card) +{ + return mmc_select_hs400(card); +} + /* * For device supporting HS200 mode, the following sequence * should be done before executing the tuning process. -- 2.20.1