Skip to content

Commit 8b22c3c

Browse files
Wolfram Sangstorulf
authored andcommitted
mmc: tmio: add CMD23 support
Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent f5fdcd1 commit 8b22c3c

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

drivers/mmc/host/tmio_mmc_core.c

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,11 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command
368368
c |= TRANSFER_MULTI;
369369

370370
/*
371-
* Disable auto CMD12 at IO_RW_EXTENDED when
372-
* multiple block transfer
371+
* Disable auto CMD12 at IO_RW_EXTENDED and SET_BLOCK_COUNT
372+
* when doing multiple block transfer
373373
*/
374374
if ((host->pdata->flags & TMIO_MMC_HAVE_CMD12_CTRL) &&
375-
(cmd->opcode == SD_IO_RW_EXTENDED))
375+
(cmd->opcode == SD_IO_RW_EXTENDED || host->mrq->sbc))
376376
c |= NO_CMD12_ISSUE;
377377
}
378378
if (data->flags & MMC_DATA_READ)
@@ -549,7 +549,7 @@ void tmio_mmc_do_data_irq(struct tmio_mmc_host *host)
549549
host->mrq);
550550
}
551551

552-
if (stop) {
552+
if (stop && !host->mrq->sbc) {
553553
if (stop->opcode != MMC_STOP_TRANSMISSION || stop->arg)
554554
dev_err(&host->pdev->dev, "unsupported stop: CMD%u,0x%x. We did CMD12,0\n",
555555
stop->opcode, stop->arg);
@@ -857,15 +857,21 @@ static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
857857

858858
static void tmio_process_mrq(struct tmio_mmc_host *host, struct mmc_request *mrq)
859859
{
860+
struct mmc_command *cmd;
860861
int ret;
861862

862-
if (mrq->data) {
863-
ret = tmio_mmc_start_data(host, mrq->data);
864-
if (ret)
865-
goto fail;
863+
if (mrq->sbc && host->cmd != mrq->sbc) {
864+
cmd = mrq->sbc;
865+
} else {
866+
cmd = mrq->cmd;
867+
if (mrq->data) {
868+
ret = tmio_mmc_start_data(host, mrq->data);
869+
if (ret)
870+
goto fail;
871+
}
866872
}
867873

868-
ret = tmio_mmc_start_command(host, mrq->cmd);
874+
ret = tmio_mmc_start_command(host, cmd);
869875
if (ret)
870876
goto fail;
871877

@@ -920,13 +926,16 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
920926
return;
921927
}
922928

923-
host->cmd = NULL;
924-
host->data = NULL;
925-
host->force_pio = false;
929+
/* If not SET_BLOCK_COUNT, clear old data */
930+
if (host->cmd != mrq->sbc) {
931+
host->cmd = NULL;
932+
host->data = NULL;
933+
host->force_pio = false;
934+
host->mrq = NULL;
935+
}
926936

927937
cancel_delayed_work(&host->delayed_reset_work);
928938

929-
host->mrq = NULL;
930939
spin_unlock_irqrestore(&host->lock, flags);
931940

932941
if (mrq->cmd->error || (mrq->data && mrq->data->error))
@@ -935,6 +944,12 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
935944
if (host->check_scc_error)
936945
host->check_scc_error(host);
937946

947+
/* If SET_BLOCK_COUNT, continue with main command */
948+
if (host->mrq) {
949+
tmio_process_mrq(host, mrq);
950+
return;
951+
}
952+
938953
mmc_request_done(host->mmc, mrq);
939954
}
940955

0 commit comments

Comments
 (0)