Skip to content

Commit a663f64

Browse files
Veerabhadrarao Badigantistorulf
authored andcommitted
mmc: sdhci: Let a vendor driver supply and update ADMA descriptor size
Let a vendor driver supply the maximum descriptor size that it can operate on. ADMA descriptor table would be allocated using this supplied size. If any SD Host controller is of version prior to v4.10 spec but supports 16byte descriptor, this change allows them to supply correct descriptor size for ADMA table allocation. Also let a vendor driver update the descriptor size by overriding sdhc_host->desc_size if it has to operates on a different descriptor sizes in different conditions. Suggested-by: Adrian Hunter <[email protected]> Signed-off-by: Veerabhadrarao Badiganti <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 80c7482 commit a663f64

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4043,15 +4043,13 @@ int sdhci_setup_host(struct sdhci_host *host)
40434043
dma_addr_t dma;
40444044
void *buf;
40454045

4046-
if (host->flags & SDHCI_USE_64_BIT_DMA) {
4047-
host->adma_table_sz = host->adma_table_cnt *
4048-
SDHCI_ADMA2_64_DESC_SZ(host);
4049-
host->desc_sz = SDHCI_ADMA2_64_DESC_SZ(host);
4050-
} else {
4051-
host->adma_table_sz = host->adma_table_cnt *
4052-
SDHCI_ADMA2_32_DESC_SZ;
4053-
host->desc_sz = SDHCI_ADMA2_32_DESC_SZ;
4054-
}
4046+
if (!(host->flags & SDHCI_USE_64_BIT_DMA))
4047+
host->alloc_desc_sz = SDHCI_ADMA2_32_DESC_SZ;
4048+
else if (!host->alloc_desc_sz)
4049+
host->alloc_desc_sz = SDHCI_ADMA2_64_DESC_SZ(host);
4050+
4051+
host->desc_sz = host->alloc_desc_sz;
4052+
host->adma_table_sz = host->adma_table_cnt * host->desc_sz;
40554053

40564054
host->align_buffer_sz = SDHCI_MAX_SEGS * SDHCI_ADMA2_ALIGN;
40574055
/*

drivers/mmc/host/sdhci.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ struct sdhci_host {
558558
dma_addr_t adma_addr; /* Mapped ADMA descr. table */
559559
dma_addr_t align_addr; /* Mapped bounce buffer */
560560

561-
unsigned int desc_sz; /* ADMA descriptor size */
561+
unsigned int desc_sz; /* ADMA current descriptor size */
562+
unsigned int alloc_desc_sz; /* ADMA descr. max size host supports */
562563

563564
struct workqueue_struct *complete_wq; /* Request completion wq */
564565
struct work_struct complete_work; /* Request completion work */

0 commit comments

Comments
 (0)