mmc: sdhci: 64-bit DMA actually has 4-byte alignment
authorAdrian Hunter <adrian.hunter@intel.com>
Thu, 26 Nov 2015 12:00:49 +0000 (14:00 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 22 Dec 2015 10:32:16 +0000 (11:32 +0100)
commit04a5ae6fdd018af29675eb8b6c2550c87f471570
treedd1c9160a5196b467217fc4beac52c7d6bd46a3f
parent347ea32dc118326c4f2636928239a29d192cc9b8
mmc: sdhci: 64-bit DMA actually has 4-byte alignment

The version 3.00 SDHCI spec. was a bit unclear about the
required data alignment for 64-bit DMA, whereas the version
4.10 spec. uses different language and indicates that only
4-byte alignment is required rather than the 8-byte alignment
currently implemented.  That make no difference to SD and EMMC
which invariably transfer data in sector-aligned blocks.
However with SDIO, it results in using more DMA descriptors
than necessary.  Theoretically that slows DMA slightly although
DMA is not the limiting factor for throughput, so there is no
discernable impact on performance.  Nevertheless, the driver
should follw the spec unless there is good reason not to, so
this patch corrects the alignment criterion.

There is a more complicated criterion for the DMA descriptor
table itself.  However the table is allocated by dma_alloc_coherent()
which allocates pages (i.e. aligned to a page boundary).
For simplicity just check it is 8-byte aligned, but add a comment
that some Intel controllers actually require 8-byte alignment
even when using 32-bit DMA.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h