Skip to content

Commit 30652aa

Browse files
olofjcjb
authored andcommitted
mmc: sdhci: add quirk for max len ADMA descriptors
Some controllers misparse segment length 0 as being 0, not 65536. Add a quirk to deal with it. Signed-off-by: Olof Johansson <olof@lixom.net> Reviewed-by: Chris Ball <cjb@laptop.org> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent c288b85 commit 30652aa

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎drivers/mmc/host/sdhci.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,10 +1949,14 @@ int sdhci_add_host(struct sdhci_host *host)
19491949
* of bytes. When doing hardware scatter/gather, each entry cannot
19501950
* be larger than 64 KiB though.
19511951
*/
1952-
if (host->flags & SDHCI_USE_ADMA)
1953-
mmc->max_seg_size = 65536;
1954-
else
1952+
if (host->flags & SDHCI_USE_ADMA) {
1953+
if (host->quirks & SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC)
1954+
mmc->max_seg_size = 65535;
1955+
else
1956+
mmc->max_seg_size = 65536;
1957+
} else {
19551958
mmc->max_seg_size = mmc->max_req_size;
1959+
}
19561960

19571961
/*
19581962
* Maximum block size. This varies from controller to controller and

‎include/linux/mmc/sdhci.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ struct sdhci_host {
8383
#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28)
8484
/* Controller doesn't have HISPD bit field in HI-SPEED SD card */
8585
#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29)
86+
/* Controller treats ADMA descriptors with length 0000h incorrectly */
87+
#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30)
8688

8789
int irq; /* Device IRQ */
8890
void __iomem *ioaddr; /* Mapped address */

0 commit comments

Comments
 (0)