aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/atmel-mci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/atmel-mci.c')
-rw-r--r--drivers/mmc/host/atmel-mci.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 2cbb4516d353..42706ea0ba85 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1192,11 +1192,22 @@ static void atmci_start_request(struct atmel_mci *host,
1192 iflags |= ATMCI_CMDRDY; 1192 iflags |= ATMCI_CMDRDY;
1193 cmd = mrq->cmd; 1193 cmd = mrq->cmd;
1194 cmdflags = atmci_prepare_command(slot->mmc, cmd); 1194 cmdflags = atmci_prepare_command(slot->mmc, cmd);
1195 atmci_send_command(host, cmd, cmdflags); 1195
1196 /*
1197 * DMA transfer should be started before sending the command to avoid
1198 * unexpected errors especially for read operations in SDIO mode.
1199 * Unfortunately, in PDC mode, command has to be sent before starting
1200 * the transfer.
1201 */
1202 if (host->submit_data != &atmci_submit_data_dma)
1203 atmci_send_command(host, cmd, cmdflags);
1196 1204
1197 if (data) 1205 if (data)
1198 host->submit_data(host, data); 1206 host->submit_data(host, data);
1199 1207
1208 if (host->submit_data == &atmci_submit_data_dma)
1209 atmci_send_command(host, cmd, cmdflags);
1210
1200 if (mrq->stop) { 1211 if (mrq->stop) {
1201 host->stop_cmdr = atmci_prepare_command(slot->mmc, mrq->stop); 1212 host->stop_cmdr = atmci_prepare_command(slot->mmc, mrq->stop);
1202 host->stop_cmdr |= ATMCI_CMDR_STOP_XFER; 1213 host->stop_cmdr |= ATMCI_CMDR_STOP_XFER;
@@ -1391,8 +1402,14 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1391 clk_unprepare(host->mck); 1402 clk_unprepare(host->mck);
1392 1403
1393 switch (ios->power_mode) { 1404 switch (ios->power_mode) {
1405 case MMC_POWER_OFF:
1406 if (!IS_ERR(mmc->supply.vmmc))
1407 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
1408 break;
1394 case MMC_POWER_UP: 1409 case MMC_POWER_UP:
1395 set_bit(ATMCI_CARD_NEED_INIT, &slot->flags); 1410 set_bit(ATMCI_CARD_NEED_INIT, &slot->flags);
1411 if (!IS_ERR(mmc->supply.vmmc))
1412 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
1396 break; 1413 break;
1397 default: 1414 default:
1398 /* 1415 /*
@@ -2204,6 +2221,7 @@ static int __init atmci_init_slot(struct atmel_mci *host,
2204 } 2221 }
2205 2222
2206 host->slot[id] = slot; 2223 host->slot[id] = slot;
2224 mmc_regulator_get_supply(mmc);
2207 mmc_add_host(mmc); 2225 mmc_add_host(mmc);
2208 2226
2209 if (gpio_is_valid(slot->detect_pin)) { 2227 if (gpio_is_valid(slot->detect_pin)) {