mmc: sdhci: use phys2bus macro when dma address is accessed 24/222824/2
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 20 Jan 2020 09:33:26 +0000 (18:33 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 20 Jan 2020 21:45:50 +0000 (06:45 +0900)
Use phys2bus macro when dma address is accessed.
Some targets need to use phys2bus macro.(e.g, RPI4)
After applied it, SDMA mode can be used.

When thor download is used,
- Before : 1.8MB/s
- After : 7.23MB/s

Change-Id: Id63dbdc4bd48198ca33c2b55d9bdf3d9f1a4b570
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/mmc/sdhci.c

index fbc576f..81f2f35 100644 (file)
@@ -14,6 +14,7 @@
 #include <mmc.h>
 #include <sdhci.h>
 #include <dm.h>
+#include <phys2bus.h>
 
 #if defined(CONFIG_FIXED_SDHCI_ALIGNED_BUFFER)
 void *aligned_buffer = (void *)CONFIG_FIXED_SDHCI_ALIGNED_BUFFER;
@@ -163,7 +164,8 @@ static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
                if (data->flags != MMC_DATA_READ)
                        memcpy(aligned_buffer, data->src, trans_bytes);
 #endif
-               sdhci_writel(host, host->start_addr, SDHCI_DMA_ADDRESS);
+               sdhci_writel(host, phys_to_bus((ulong)host->start_addr),
+                               SDHCI_DMA_ADDRESS);
 
        } else if (host->flags & (USE_ADMA | USE_ADMA64)) {
                sdhci_prepare_adma_table(host, data);
@@ -219,7 +221,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
                                start_addr &=
                                ~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1);
                                start_addr += SDHCI_DEFAULT_BOUNDARY_SIZE;
-                               sdhci_writel(host, start_addr,
+                               sdhci_writel(host, phys_to_bus((ulong)start_addr),
                                             SDHCI_DMA_ADDRESS);
                        }
                }