[v2,1/3] mmc: sdhci: use phys2bus macro when dma address is accessed
diff mbox series

Message ID 20200218012546.15858-2-jh80.chung@samsung.com
State Accepted
Delegated to: Peng Fan
Headers show
Series
  • Support SDMA mode on RPI4 target - 32bit
Related show

Commit Message

Jaehoon Chung Feb. 18, 2020, 1:25 a.m. UTC
Use phys2bus macro when dma address is accessed.
Some targets need to use pyhs2bus macro. (e.g, RPI4)
After applied it, SDMA mode can be used.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
Changelog on V2
- None

 drivers/mmc/sdhci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Minkyu Kang Feb. 21, 2020, 5:50 a.m. UTC | #1
On 18/02/2020 10:25, Jaehoon Chung wrote:
> Use phys2bus macro when dma address is accessed.
> Some targets need to use pyhs2bus macro. (e.g, RPI4)
> After applied it, SDMA mode can be used.
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
> Changelog on V2
> - None
> 
>  drivers/mmc/sdhci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 01fa5a9d4d..93c9049c5d 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -15,6 +15,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;
> @@ -164,7 +165,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);
> @@ -220,7 +222,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);
>  			}
>  		}
> 

Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

Thanks,
Minkyu Kang.

Patch
diff mbox series

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 01fa5a9d4d..93c9049c5d 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -15,6 +15,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;
@@ -164,7 +165,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);
@@ -220,7 +222,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);
 			}
 		}