Skip to content

Commit

Permalink
mmc: sdio: Factor out retry init card helper function
Browse files Browse the repository at this point in the history
Add new helper function, mmc_sdio_resend_if_cond, to be
reused when trying to retry the init sequence.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
  • Loading branch information
Shawn Lin authored and Ulf Hansson committed Feb 13, 2017
1 parent 63928d4 commit 0eb51a5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions drivers/mmc/core/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,15 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
return err;
}

static void mmc_sdio_resend_if_cond(struct mmc_host *host,
struct mmc_card *card)
{
sdio_reset(host);
mmc_go_idle(host);
mmc_send_if_cond(host, host->ocr_avail);
mmc_remove_card(card);
}

/*
* Handle the detection and initialisation of a card.
*
Expand Down Expand Up @@ -630,10 +639,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180,
ocr_card);
if (err == -EAGAIN) {
sdio_reset(host);
mmc_go_idle(host);
mmc_send_if_cond(host, host->ocr_avail);
mmc_remove_card(card);
mmc_sdio_resend_if_cond(host, card);
retries--;
goto try_again;
} else if (err) {
Expand Down

0 comments on commit 0eb51a5

Please sign in to comment.