Skip to content

Commit 8edf637

Browse files
andreiwcjb
authored andcommitted
mmc: sdhci: Auto-CMD23 support.
Enables Auto-CMD23 support where available (SDHCI 3.0 controllers) Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Tested-by: Arindam Nath <arindam.nath@amd.com> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent f0d8997 commit 8edf637

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎drivers/mmc/host/sdhci.c‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,12 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
857857
*/
858858
if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12))
859859
mode |= SDHCI_TRNS_AUTO_CMD12;
860+
else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) {
861+
mode |= SDHCI_TRNS_AUTO_CMD23;
862+
sdhci_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2);
863+
}
860864
}
865+
861866
if (data->flags & MMC_DATA_READ)
862867
mode |= SDHCI_TRNS_READ;
863868
if (host->flags & SDHCI_REQ_USE_DMA)
@@ -1252,7 +1257,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
12521257
host->mrq = mrq;
12531258
}
12541259

1255-
if (mrq->sbc)
1260+
if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))
12561261
sdhci_send_command(host, mrq->sbc);
12571262
else
12581263
sdhci_send_command(host, mrq->cmd);
@@ -2488,6 +2493,16 @@ int sdhci_add_host(struct sdhci_host *host)
24882493
if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12)
24892494
host->flags |= SDHCI_AUTO_CMD12;
24902495

2496+
/* Auto-CMD23 stuff only works in ADMA or PIO. */
2497+
if ((host->version == SDHCI_SPEC_300) &&
2498+
((host->flags & SDHCI_USE_ADMA) ||
2499+
!(host->flags & SDHCI_REQ_USE_DMA))) {
2500+
host->flags |= SDHCI_AUTO_CMD23;
2501+
DBG("%s: Auto-CMD23 available\n", mmc_hostname(mmc));
2502+
} else {
2503+
DBG("%s: Auto-CMD23 unavailable\n", mmc_hostname(mmc));
2504+
}
2505+
24912506
/*
24922507
* A controller may support 8-bit width, but the board itself
24932508
* might not have the pins brought out. Boards that support

‎drivers/mmc/host/sdhci.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#define SDHCI_DMA_ADDRESS 0x00
28+
#define SDHCI_ARGUMENT2 SDHCI_DMA_ADDRESS
2829

2930
#define SDHCI_BLOCK_SIZE 0x04
3031
#define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF))
@@ -37,6 +38,7 @@
3738
#define SDHCI_TRNS_DMA 0x01
3839
#define SDHCI_TRNS_BLK_CNT_EN 0x02
3940
#define SDHCI_TRNS_AUTO_CMD12 0x04
41+
#define SDHCI_TRNS_AUTO_CMD23 0x08
4042
#define SDHCI_TRNS_READ 0x10
4143
#define SDHCI_TRNS_MULTI 0x20
4244

‎include/linux/mmc/sdhci.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ struct sdhci_host {
114114
#define SDHCI_SDR50_NEEDS_TUNING (1<<4) /* SDR50 needs tuning */
115115
#define SDHCI_NEEDS_RETUNING (1<<5) /* Host needs retuning */
116116
#define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */
117+
#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
117118

118119
unsigned int version; /* SDHCI spec. version */
119120

0 commit comments

Comments
 (0)