Commit a4c73aba authored by Adrian Hunter's avatar Adrian Hunter Committed by Ulf Hansson

mmc: sdhci: Reduce the use of host->mrq

In order to support commands during data transfer, there will have to be up
to two active requests (mrqs) at a time, instead of just one. That means
host->mrq will not be able to be used.

In several places, host->mrq is used when instead the mrq can be determined
from the cmd or data pointers. Reduce the use of host->mrq by doing that.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent ea968023
...@@ -906,12 +906,12 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host, ...@@ -906,12 +906,12 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
* If we are sending CMD23, CMD12 never gets sent * If we are sending CMD23, CMD12 never gets sent
* on successful completion (so no Auto-CMD12). * on successful completion (so no Auto-CMD12).
*/ */
if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12) && if (!cmd->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12) &&
(cmd->opcode != SD_IO_RW_EXTENDED)) (cmd->opcode != SD_IO_RW_EXTENDED))
mode |= SDHCI_TRNS_AUTO_CMD12; mode |= SDHCI_TRNS_AUTO_CMD12;
else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { else if (cmd->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) {
mode |= SDHCI_TRNS_AUTO_CMD23; mode |= SDHCI_TRNS_AUTO_CMD23;
sdhci_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2); sdhci_writel(host, cmd->mrq->sbc->arg, SDHCI_ARGUMENT2);
} }
} }
...@@ -954,7 +954,7 @@ static void sdhci_finish_data(struct sdhci_host *host) ...@@ -954,7 +954,7 @@ static void sdhci_finish_data(struct sdhci_host *host)
*/ */
if (data->stop && if (data->stop &&
(data->error || (data->error ||
!host->mrq->sbc)) { !data->mrq->sbc)) {
/* /*
* The controller needs a reset of internal state machines * The controller needs a reset of internal state machines
...@@ -990,7 +990,7 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) ...@@ -990,7 +990,7 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
/* We shouldn't wait for data inihibit for stop commands, even /* We shouldn't wait for data inihibit for stop commands, even
though they might use busy signaling */ though they might use busy signaling */
if (host->mrq->data && (cmd == host->mrq->data->stop)) if (cmd->mrq->data && (cmd == cmd->mrq->data->stop))
mask &= ~SDHCI_DATA_INHIBIT; mask &= ~SDHCI_DATA_INHIBIT;
while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) { while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
...@@ -1100,8 +1100,8 @@ static void sdhci_finish_command(struct sdhci_host *host) ...@@ -1100,8 +1100,8 @@ static void sdhci_finish_command(struct sdhci_host *host)
} }
/* Finished CMD23, now send actual command. */ /* Finished CMD23, now send actual command. */
if (cmd == host->mrq->sbc) { if (cmd == cmd->mrq->sbc) {
sdhci_send_command(host, host->mrq->cmd); sdhci_send_command(host, cmd->mrq->cmd);
} else { } else {
/* Processed actual command. */ /* Processed actual command. */
...@@ -1408,7 +1408,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -1408,7 +1408,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
host->mrq = mrq; host->mrq = mrq;
if (!present || host->flags & SDHCI_DEVICE_DEAD) { if (!present || host->flags & SDHCI_DEVICE_DEAD) {
host->mrq->cmd->error = -ENOMEDIUM; mrq->cmd->error = -ENOMEDIUM;
tasklet_schedule(&host->finish_tasklet); tasklet_schedule(&host->finish_tasklet);
} else { } else {
if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment