aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2015-02-23 21:42:23 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2015-03-23 09:13:49 -0400
commit303dbedc3152b0a3828ea881b446c2e2a247662f (patch)
tree69f33168b407c3b595a79d2616af7feba3774592 /drivers/mmc
parenta1cb1d1114d3258487321f822457f74ed897068c (diff)
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>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/sdio.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index ce6cc47206b0..5bc6c7dbbd60 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -293,19 +293,22 @@ static int sdio_enable_4bit_bus(struct mmc_card *card)
293 int err; 293 int err;
294 294
295 if (card->type == MMC_TYPE_SDIO) 295 if (card->type == MMC_TYPE_SDIO)
296 return sdio_enable_wide(card); 296 err = sdio_enable_wide(card);
297 297 else if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
298 if ((card->host->caps & MMC_CAP_4_BIT_DATA) && 298 (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
299 (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
300 err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); 299 err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
301 if (err) 300 if (err)
302 return err; 301 return err;
302 err = sdio_enable_wide(card);
303 if (err <= 0)
304 mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1);
303 } else 305 } else
304 return 0; 306 return 0;
305 307
306 err = sdio_enable_wide(card); 308 if (err > 0) {
307 if (err <= 0) 309 mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
308 mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1); 310 err = 0;
311 }
309 312
310 return err; 313 return err;
311} 314}
@@ -547,13 +550,8 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
547 /* 550 /*
548 * Switch to wider bus (if supported). 551 * Switch to wider bus (if supported).
549 */ 552 */
550 if (card->host->caps & MMC_CAP_4_BIT_DATA) { 553 if (card->host->caps & MMC_CAP_4_BIT_DATA)
551 err = sdio_enable_4bit_bus(card); 554 err = sdio_enable_4bit_bus(card);
552 if (err > 0) {
553 mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
554 err = 0;
555 }
556 }
557 555
558 /* Set the driver strength for the card */ 556 /* Set the driver strength for the card */
559 sdio_select_driver_type(card); 557 sdio_select_driver_type(card);
@@ -803,9 +801,7 @@ try_again:
803 * Switch to wider bus (if supported). 801 * Switch to wider bus (if supported).
804 */ 802 */
805 err = sdio_enable_4bit_bus(card); 803 err = sdio_enable_4bit_bus(card);
806 if (err > 0) 804 if (err)
807 mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
808 else if (err)
809 goto remove; 805 goto remove;
810 } 806 }
811finish: 807finish:
@@ -983,10 +979,6 @@ static int mmc_sdio_resume(struct mmc_host *host)
983 } else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) { 979 } else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
984 /* We may have switched to 1-bit mode during suspend */ 980 /* We may have switched to 1-bit mode during suspend */
985 err = sdio_enable_4bit_bus(host->card); 981 err = sdio_enable_4bit_bus(host->card);
986 if (err > 0) {
987 mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
988 err = 0;
989 }
990 } 982 }
991 983
992 if (!err && host->sdio_irqs) { 984 if (!err && host->sdio_irqs) {