mmc: core: fold mmc_set_bus_width calls into sdio_enable_4bit_bus.
Every call to sdio_enable_4bit_bus is followed (on success) by a call to mmc_set_bus_width(). To simplify the code, include those calls directly in sdio_enable_4bit_bus(). Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
a1cb1d1114
commit
303dbedc31
|
@ -293,19 +293,22 @@ static int sdio_enable_4bit_bus(struct mmc_card *card)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (card->type == MMC_TYPE_SDIO)
|
if (card->type == MMC_TYPE_SDIO)
|
||||||
return sdio_enable_wide(card);
|
err = sdio_enable_wide(card);
|
||||||
|
else if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
|
||||||
if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
|
(card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
|
||||||
(card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
|
|
||||||
err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
|
err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
err = sdio_enable_wide(card);
|
||||||
|
if (err <= 0)
|
||||||
|
mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1);
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err = sdio_enable_wide(card);
|
if (err > 0) {
|
||||||
if (err <= 0)
|
mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
|
||||||
mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1);
|
err = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -547,13 +550,8 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
|
||||||
/*
|
/*
|
||||||
* Switch to wider bus (if supported).
|
* Switch to wider bus (if supported).
|
||||||
*/
|
*/
|
||||||
if (card->host->caps & MMC_CAP_4_BIT_DATA) {
|
if (card->host->caps & MMC_CAP_4_BIT_DATA)
|
||||||
err = sdio_enable_4bit_bus(card);
|
err = sdio_enable_4bit_bus(card);
|
||||||
if (err > 0) {
|
|
||||||
mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
|
|
||||||
err = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the driver strength for the card */
|
/* Set the driver strength for the card */
|
||||||
sdio_select_driver_type(card);
|
sdio_select_driver_type(card);
|
||||||
|
@ -803,9 +801,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
|
||||||
* Switch to wider bus (if supported).
|
* Switch to wider bus (if supported).
|
||||||
*/
|
*/
|
||||||
err = sdio_enable_4bit_bus(card);
|
err = sdio_enable_4bit_bus(card);
|
||||||
if (err > 0)
|
if (err)
|
||||||
mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
|
|
||||||
else if (err)
|
|
||||||
goto remove;
|
goto remove;
|
||||||
}
|
}
|
||||||
finish:
|
finish:
|
||||||
|
@ -983,10 +979,6 @@ static int mmc_sdio_resume(struct mmc_host *host)
|
||||||
} else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
|
} else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
|
||||||
/* We may have switched to 1-bit mode during suspend */
|
/* We may have switched to 1-bit mode during suspend */
|
||||||
err = sdio_enable_4bit_bus(host->card);
|
err = sdio_enable_4bit_bus(host->card);
|
||||||
if (err > 0) {
|
|
||||||
mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
|
|
||||||
err = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err && host->sdio_irqs) {
|
if (!err && host->sdio_irqs) {
|
||||||
|
|
Loading…
Reference in New Issue