diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-11-04 12:42:44 +0200 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2014-11-10 12:40:52 +0100 |
commit | 739d46dcc24d9fabeed1dea6705d2c7f444b092c (patch) | |
tree | cc6efab626bc17f1735635265d65f08144a56055 /drivers/mmc | |
parent | 4fb213f81fe51ace7dea7d2f7cc2417fa2a2dd9e (diff) | |
download | linux-739d46dcc24d9fabeed1dea6705d2c7f444b092c.tar.gz linux-739d46dcc24d9fabeed1dea6705d2c7f444b092c.tar.bz2 linux-739d46dcc24d9fabeed1dea6705d2c7f444b092c.zip |
mmc: sdhci: Define ADMA constants
Define all the ADMA constants instead of having numbers
scattered throughout the code.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 23 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 10 |
2 files changed, 23 insertions, 10 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 586c7391a066..11b62171f94e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -464,7 +464,7 @@ static void sdhci_adma_mark_end(void *desc) { u8 *dma_desc = desc; - dma_desc[0] |= 0x2; /* end */ + dma_desc[0] |= ADMA2_END; } static int sdhci_adma_table_pre(struct sdhci_host *host, @@ -532,7 +532,8 @@ static int sdhci_adma_table_pre(struct sdhci_host *host, } /* tran, valid */ - sdhci_adma_write_desc(desc, align_addr, offset, 0x21); + sdhci_adma_write_desc(desc, align_addr, offset, + ADMA2_TRAN_VALID); BUG_ON(offset > 65536); @@ -548,7 +549,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host, BUG_ON(len > 65536); /* tran, valid */ - sdhci_adma_write_desc(desc, addr, len, 0x21); + sdhci_adma_write_desc(desc, addr, len, ADMA2_TRAN_VALID); desc += host->desc_sz; /* @@ -572,7 +573,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host, */ /* nop, end, valid */ - sdhci_adma_write_desc(desc, 0, 0, 0x3); + sdhci_adma_write_desc(desc, 0, 0, ADMA2_NOP_END_VALID); } /* @@ -2312,7 +2313,7 @@ static void sdhci_adma_show_error(struct sdhci_host *host) desc += host->desc_sz; - if (attr & 2) + if (attr & ADMA2_END) break; } } @@ -2877,11 +2878,13 @@ int sdhci_add_host(struct sdhci_host *host) * descriptor for each segment, plus 1 for a nop end descriptor, * all multipled by the descriptor size. */ - host->adma_table_sz = (SDHCI_MAX_SEGS * 2 + 1) * 8; - host->align_buffer_sz = SDHCI_MAX_SEGS * 4; - host->desc_sz = 8; - host->align_sz = 4; - host->align_mask = 3; + host->adma_table_sz = (SDHCI_MAX_SEGS * 2 + 1) * + SDHCI_ADMA2_32_DESC_SZ; + host->align_buffer_sz = SDHCI_MAX_SEGS * + SDHCI_ADMA2_32_ALIGN; + host->desc_sz = SDHCI_ADMA2_32_DESC_SZ; + host->align_sz = SDHCI_ADMA2_32_ALIGN; + host->align_mask = SDHCI_ADMA2_32_ALIGN - 1; host->adma_table = dma_alloc_coherent(mmc_dev(mmc), host->adma_table_sz, &host->adma_addr, diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 6ae75cdd5f41..823cce177498 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -266,6 +266,16 @@ #define SDHCI_DEFAULT_BOUNDARY_SIZE (512 * 1024) #define SDHCI_DEFAULT_BOUNDARY_ARG (ilog2(SDHCI_DEFAULT_BOUNDARY_SIZE) - 12) +/* ADMA2 32-bit DMA descriptor size */ +#define SDHCI_ADMA2_32_DESC_SZ 8 + +/* ADMA2 32-bit DMA alignment */ +#define SDHCI_ADMA2_32_ALIGN 4 + +#define ADMA2_TRAN_VALID 0x21 +#define ADMA2_NOP_END_VALID 0x3 +#define ADMA2_END 0x2 + /* * Maximum segments assuming a 512KiB maximum requisition size and a minimum * 4KiB page size. |