straight copy from Linux didn't worked because the macro SDHCI_DMA_BOUNDARY_512K
(default value of sdhci::sdma_boundary) is not a size but the enum value to be
written in the transfer control register.

Signed-off-by: Jules Maselbas <[email protected]>
---
 drivers/mci/sdhci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
index 4c8e73d94d..b0b83bfaa9 100644
--- a/drivers/mci/sdhci.c
+++ b/drivers/mci/sdhci.c
@@ -289,8 +289,10 @@ int sdhci_transfer_data_dma(struct sdhci *sdhci, struct 
mci_data *data,
                 * some controllers are faulty, don't trust them.
                 */
                if (irqstat & SDHCI_INT_DMA) {
+                       int boundary_cfg = (sdhci->sdma_boundary >> 12) & 0x7;
+                       dma_addr_t boundary_size = 4096 << boundary_cfg;
                        /* Force update to the next DMA block boundary. */
-                       dma += sdhci->sdma_boundary;
+                       dma = (dma & ~(boundary_size - 1)) + boundary_size;
 
                        /*
                         * DMA engine has stopped on buffer boundary. 
Acknowledge
-- 
2.17.1






Reply via email to