diff options
author | Faiz Abbas <faiz_abbas@ti.com> | 2019-04-16 23:06:58 +0530 |
---|---|---|
committer | Peng Fan <peng.fan@nxp.com> | 2019-05-03 20:44:11 +0800 |
commit | 37cb626da25d0d895079c85866d0c2030cd98438 (patch) | |
tree | 3d2f2c7caa0903efb0aa5bc449f68accd3282122 /include/sdhci.h | |
parent | 6d6af20571d1f64b823ca0116654f326c3ac495f (diff) | |
download | u-boot-37cb626da25d0d895079c85866d0c2030cd98438.tar.gz u-boot-37cb626da25d0d895079c85866d0c2030cd98438.tar.bz2 u-boot-37cb626da25d0d895079c85866d0c2030cd98438.zip |
mmc: sdhci: Add Support for ADMA2
The Standard Host Controller Interface (SDHCI) specification version
3.00 adds support for Advanced DMA (ADMA) for both 64 and 32 bit widths
of DMA. ADMA2 uses a table of descriptors for aggregating DMA requests.
This significantly improves read and write throughput.
Add Support for the same.
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Diffstat (limited to 'include/sdhci.h')
-rw-r--r-- | include/sdhci.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/include/sdhci.h b/include/sdhci.h index c66ec6ca25..eee493ab5f 100644 --- a/include/sdhci.h +++ b/include/sdhci.h @@ -186,6 +186,7 @@ /* 55-57 reserved */ #define SDHCI_ADMA_ADDRESS 0x58 +#define SDHCI_ADMA_ADDRESS_HI 0x5c /* 60-FB reserved */ @@ -252,6 +253,38 @@ struct sdhci_ops { void (*set_delay)(struct sdhci_host *host); }; +#if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA) +#define ADMA_MAX_LEN 65532 +#ifdef CONFIG_DMA_ADDR_T_64BIT +#define ADMA_DESC_LEN 16 +#else +#define ADMA_DESC_LEN 8 +#endif +#define ADMA_TABLE_NO_ENTRIES (CONFIG_SYS_MMC_MAX_BLK_COUNT * \ + MMC_MAX_BLOCK_LEN) / ADMA_MAX_LEN + +#define ADMA_TABLE_SZ (ADMA_TABLE_NO_ENTRIES * ADMA_DESC_LEN) + +/* Decriptor table defines */ +#define ADMA_DESC_ATTR_VALID BIT(0) +#define ADMA_DESC_ATTR_END BIT(1) +#define ADMA_DESC_ATTR_INT BIT(2) +#define ADMA_DESC_ATTR_ACT1 BIT(4) +#define ADMA_DESC_ATTR_ACT2 BIT(5) + +#define ADMA_DESC_TRANSFER_DATA ADMA_DESC_ATTR_ACT2 +#define ADMA_DESC_LINK_DESC (ADMA_DESC_ATTR_ACT1 | ADMA_DESC_ATTR_ACT2) + +struct sdhci_adma_desc { + u8 attr; + u8 reserved; + u16 len; + u32 addr_lo; +#ifdef CONFIG_DMA_ADDR_T_64BIT + u32 addr_hi; +#endif +} __packed; +#endif struct sdhci_host { const char *name; void *ioaddr; @@ -275,6 +308,14 @@ struct sdhci_host { dma_addr_t start_addr; int flags; #define USE_SDMA (0x1 << 0) +#define USE_ADMA (0x1 << 1) +#define USE_ADMA64 (0x1 << 2) +#define USE_DMA (USE_SDMA | USE_ADMA | USE_ADMA64) + dma_addr_t adma_addr; +#if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA) + struct sdhci_adma_desc *adma_desc_table; + uint desc_slot; +#endif }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS |