Commit 0293d501 authored by Adrian Hunter's avatar Adrian Hunter Committed by Ulf Hansson

mmc: sdhci: Factor out sdhci_auto_cmd12()

Factor out sdhci_auto_cmd12() so that there is a single place that controls
whether auto-CMD12 is used.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 4e9f8fe5
...@@ -881,6 +881,12 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) ...@@ -881,6 +881,12 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd)
sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT); sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT);
} }
static inline bool sdhci_auto_cmd12(struct sdhci_host *host,
struct mmc_request *mrq)
{
return !mrq->sbc && (host->flags & SDHCI_AUTO_CMD12);
}
static void sdhci_set_transfer_mode(struct sdhci_host *host, static void sdhci_set_transfer_mode(struct sdhci_host *host,
struct mmc_command *cmd) struct mmc_command *cmd)
{ {
...@@ -911,7 +917,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host, ...@@ -911,7 +917,7 @@ 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 (!cmd->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12) && if (sdhci_auto_cmd12(host, cmd->mrq) &&
(cmd->opcode != SD_IO_RW_EXTENDED)) (cmd->opcode != SD_IO_RW_EXTENDED))
mode |= SDHCI_TRNS_AUTO_CMD12; mode |= SDHCI_TRNS_AUTO_CMD12;
else if (cmd->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { else if (cmd->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) {
...@@ -1469,7 +1475,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -1469,7 +1475,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
* Ensure we don't send the STOP for non-SET_BLOCK_COUNTED * Ensure we don't send the STOP for non-SET_BLOCK_COUNTED
* requests if Auto-CMD12 is enabled. * requests if Auto-CMD12 is enabled.
*/ */
if (!mrq->sbc && (host->flags & SDHCI_AUTO_CMD12)) { if (sdhci_auto_cmd12(host, mrq)) {
if (mrq->stop) { if (mrq->stop) {
mrq->data->stop = NULL; mrq->data->stop = NULL;
mrq->stop = NULL; mrq->stop = NULL;
......
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