Commit 8edf6371 authored by Andrei Warkentin's avatar Andrei Warkentin Committed by Chris Ball

mmc: sdhci: Auto-CMD23 support.

Enables Auto-CMD23 support where available (SDHCI 3.0 controllers)
Signed-off-by: default avatarAndrei Warkentin <andreiw@motorola.com>
Tested-by: default avatarArindam Nath <arindam.nath@amd.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent f0d89972
...@@ -857,7 +857,12 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host, ...@@ -857,7 +857,12 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
*/ */
if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12)) if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12))
mode |= SDHCI_TRNS_AUTO_CMD12; mode |= SDHCI_TRNS_AUTO_CMD12;
else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) {
mode |= SDHCI_TRNS_AUTO_CMD23;
sdhci_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2);
}
} }
if (data->flags & MMC_DATA_READ) if (data->flags & MMC_DATA_READ)
mode |= SDHCI_TRNS_READ; mode |= SDHCI_TRNS_READ;
if (host->flags & SDHCI_REQ_USE_DMA) if (host->flags & SDHCI_REQ_USE_DMA)
...@@ -1252,7 +1257,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -1252,7 +1257,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
host->mrq = mrq; host->mrq = mrq;
} }
if (mrq->sbc) if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))
sdhci_send_command(host, mrq->sbc); sdhci_send_command(host, mrq->sbc);
else else
sdhci_send_command(host, mrq->cmd); sdhci_send_command(host, mrq->cmd);
...@@ -2488,6 +2493,16 @@ int sdhci_add_host(struct sdhci_host *host) ...@@ -2488,6 +2493,16 @@ int sdhci_add_host(struct sdhci_host *host)
if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12)
host->flags |= SDHCI_AUTO_CMD12; host->flags |= SDHCI_AUTO_CMD12;
/* Auto-CMD23 stuff only works in ADMA or PIO. */
if ((host->version == SDHCI_SPEC_300) &&
((host->flags & SDHCI_USE_ADMA) ||
!(host->flags & SDHCI_REQ_USE_DMA))) {
host->flags |= SDHCI_AUTO_CMD23;
DBG("%s: Auto-CMD23 available\n", mmc_hostname(mmc));
} else {
DBG("%s: Auto-CMD23 unavailable\n", mmc_hostname(mmc));
}
/* /*
* A controller may support 8-bit width, but the board itself * A controller may support 8-bit width, but the board itself
* might not have the pins brought out. Boards that support * might not have the pins brought out. Boards that support
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
*/ */
#define SDHCI_DMA_ADDRESS 0x00 #define SDHCI_DMA_ADDRESS 0x00
#define SDHCI_ARGUMENT2 SDHCI_DMA_ADDRESS
#define SDHCI_BLOCK_SIZE 0x04 #define SDHCI_BLOCK_SIZE 0x04
#define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF)) #define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF))
...@@ -37,6 +38,7 @@ ...@@ -37,6 +38,7 @@
#define SDHCI_TRNS_DMA 0x01 #define SDHCI_TRNS_DMA 0x01
#define SDHCI_TRNS_BLK_CNT_EN 0x02 #define SDHCI_TRNS_BLK_CNT_EN 0x02
#define SDHCI_TRNS_AUTO_CMD12 0x04 #define SDHCI_TRNS_AUTO_CMD12 0x04
#define SDHCI_TRNS_AUTO_CMD23 0x08
#define SDHCI_TRNS_READ 0x10 #define SDHCI_TRNS_READ 0x10
#define SDHCI_TRNS_MULTI 0x20 #define SDHCI_TRNS_MULTI 0x20
......
...@@ -114,6 +114,7 @@ struct sdhci_host { ...@@ -114,6 +114,7 @@ struct sdhci_host {
#define SDHCI_SDR50_NEEDS_TUNING (1<<4) /* SDR50 needs tuning */ #define SDHCI_SDR50_NEEDS_TUNING (1<<4) /* SDR50 needs tuning */
#define SDHCI_NEEDS_RETUNING (1<<5) /* Host needs retuning */ #define SDHCI_NEEDS_RETUNING (1<<5) /* Host needs retuning */
#define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ #define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */
#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
unsigned int version; /* SDHCI spec. version */ unsigned int version; /* SDHCI spec. version */
......
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