mmc: core: Extend mmc_switch_status() to rid of __mmc_switch_status()
To simplify code, let's extend mmc_switch_status() to cope with needs addressed in __mmc_switch_status(). Then move all users to the updated mmc_switch_status() API and drop __mmc_switch_status() altogether. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Baolin Wang <baolin.wang7@gmail.com> Tested-by: Ludovic Barre <ludovic.barre@st.com> Reviewed-by: Ludovic Barre <ludovic.barre@st.com> Link: https://lore.kernel.org/r/20200204085449.32585-4-ulf.hansson@linaro.org
This commit is contained in:
parent
ebd4f4bd01
commit
60db8a4749
|
@ -1173,7 +1173,7 @@ static int mmc_select_hs400(struct mmc_card *card)
|
||||||
max_dtr = card->ext_csd.hs_max_dtr;
|
max_dtr = card->ext_csd.hs_max_dtr;
|
||||||
mmc_set_clock(host, max_dtr);
|
mmc_set_clock(host, max_dtr);
|
||||||
|
|
||||||
err = mmc_switch_status(card);
|
err = mmc_switch_status(card, true);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
@ -1211,7 +1211,7 @@ static int mmc_select_hs400(struct mmc_card *card)
|
||||||
if (host->ops->hs400_complete)
|
if (host->ops->hs400_complete)
|
||||||
host->ops->hs400_complete(host);
|
host->ops->hs400_complete(host);
|
||||||
|
|
||||||
err = mmc_switch_status(card);
|
err = mmc_switch_status(card, true);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
@ -1249,7 +1249,7 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
|
||||||
|
|
||||||
mmc_set_timing(host, MMC_TIMING_MMC_DDR52);
|
mmc_set_timing(host, MMC_TIMING_MMC_DDR52);
|
||||||
|
|
||||||
err = mmc_switch_status(card);
|
err = mmc_switch_status(card, true);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
@ -1265,7 +1265,7 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
|
||||||
if (host->ops->hs400_downgrade)
|
if (host->ops->hs400_downgrade)
|
||||||
host->ops->hs400_downgrade(host);
|
host->ops->hs400_downgrade(host);
|
||||||
|
|
||||||
err = mmc_switch_status(card);
|
err = mmc_switch_status(card, true);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
@ -1285,7 +1285,7 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
|
||||||
* failed. If there really is a problem, we would expect tuning will
|
* failed. If there really is a problem, we would expect tuning will
|
||||||
* fail and the result ends up the same.
|
* fail and the result ends up the same.
|
||||||
*/
|
*/
|
||||||
err = __mmc_switch_status(card, false);
|
err = mmc_switch_status(card, false);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
@ -1366,7 +1366,7 @@ static int mmc_select_hs400es(struct mmc_card *card)
|
||||||
}
|
}
|
||||||
|
|
||||||
mmc_set_timing(host, MMC_TIMING_MMC_HS);
|
mmc_set_timing(host, MMC_TIMING_MMC_HS);
|
||||||
err = mmc_switch_status(card);
|
err = mmc_switch_status(card, true);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
@ -1407,7 +1407,7 @@ static int mmc_select_hs400es(struct mmc_card *card)
|
||||||
if (host->ops->hs400_enhanced_strobe)
|
if (host->ops->hs400_enhanced_strobe)
|
||||||
host->ops->hs400_enhanced_strobe(host, &host->ios);
|
host->ops->hs400_enhanced_strobe(host, &host->ios);
|
||||||
|
|
||||||
err = mmc_switch_status(card);
|
err = mmc_switch_status(card, true);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
@ -1468,7 +1468,7 @@ static int mmc_select_hs200(struct mmc_card *card)
|
||||||
* switch failed. If there really is a problem, we would expect
|
* switch failed. If there really is a problem, we would expect
|
||||||
* tuning will fail and the result ends up the same.
|
* tuning will fail and the result ends up the same.
|
||||||
*/
|
*/
|
||||||
err = __mmc_switch_status(card, false);
|
err = mmc_switch_status(card, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mmc_select_timing() assumes timing has not changed if
|
* mmc_select_timing() assumes timing has not changed if
|
||||||
|
|
|
@ -430,7 +430,7 @@ static int mmc_switch_status_error(struct mmc_host *host, u32 status)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Caller must hold re-tuning */
|
/* Caller must hold re-tuning */
|
||||||
int __mmc_switch_status(struct mmc_card *card, bool crc_err_fatal)
|
int mmc_switch_status(struct mmc_card *card, bool crc_err_fatal)
|
||||||
{
|
{
|
||||||
u32 status;
|
u32 status;
|
||||||
int err;
|
int err;
|
||||||
|
@ -444,11 +444,6 @@ int __mmc_switch_status(struct mmc_card *card, bool crc_err_fatal)
|
||||||
return mmc_switch_status_error(card->host, status);
|
return mmc_switch_status_error(card->host, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mmc_switch_status(struct mmc_card *card)
|
|
||||||
{
|
|
||||||
return __mmc_switch_status(card, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
|
static int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
|
||||||
bool send_status, bool retry_crc_err)
|
bool send_status, bool retry_crc_err)
|
||||||
{
|
{
|
||||||
|
@ -596,7 +591,7 @@ out_tim:
|
||||||
mmc_set_timing(host, timing);
|
mmc_set_timing(host, timing);
|
||||||
|
|
||||||
if (send_status) {
|
if (send_status) {
|
||||||
err = mmc_switch_status(card);
|
err = mmc_switch_status(card, true);
|
||||||
if (err && timing)
|
if (err && timing)
|
||||||
mmc_set_timing(host, old_timing);
|
mmc_set_timing(host, old_timing);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,7 @@ int mmc_bus_test(struct mmc_card *card, u8 bus_width);
|
||||||
int mmc_interrupt_hpi(struct mmc_card *card);
|
int mmc_interrupt_hpi(struct mmc_card *card);
|
||||||
int mmc_can_ext_csd(struct mmc_card *card);
|
int mmc_can_ext_csd(struct mmc_card *card);
|
||||||
int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
|
int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
|
||||||
int mmc_switch_status(struct mmc_card *card);
|
int mmc_switch_status(struct mmc_card *card, bool crc_err_fatal);
|
||||||
int __mmc_switch_status(struct mmc_card *card, bool crc_err_fatal);
|
|
||||||
int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
|
int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
|
||||||
unsigned int timeout_ms, unsigned char timing,
|
unsigned int timeout_ms, unsigned char timing,
|
||||||
bool use_busy_signal, bool send_status, bool retry_crc_err);
|
bool use_busy_signal, bool send_status, bool retry_crc_err);
|
||||||
|
|
Loading…
Reference in New Issue