diff mbox series

[v1,02/11] mmc: sdhci: allow disabling sdma in spl

Message ID 20220222013131.3114990-3-pgwipeout@gmail.com
State Changes Requested
Delegated to: Kever Yang
Headers show
Series rockchip fixes and extend rk3568 support | expand

Commit Message

Peter Geis Feb. 22, 2022, 1:31 a.m. UTC
Rockchip emmc devices have a similar issue to Rockchip dwmmc devices,
where performing dma to sram causes errors with suspend/resume.
Allow us to toggle sdma in spl for sdhci similar to adma support, so we
can ensure dma is not used when loading the sram code.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/mmc/Kconfig | 7 +++++++
 drivers/mmc/sdhci.c | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

Comments

Jaehoon Chung Feb. 25, 2022, 1:46 a.m. UTC | #1
On 2/22/22 10:31, Peter Geis wrote:
> Rockchip emmc devices have a similar issue to Rockchip dwmmc devices,
> where performing dma to sram causes errors with suspend/resume.
> Allow us to toggle sdma in spl for sdhci similar to adma support, so we
> can ensure dma is not used when loading the sram code.
> 
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/Kconfig | 7 +++++++
>  drivers/mmc/sdhci.c | 6 +++---
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index f04cc44e1973..1e4342285ce7 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -468,6 +468,13 @@ config MMC_SDHCI_SDMA
>  	  This enables support for the SDMA (Single Operation DMA) defined
>  	  in the SD Host Controller Standard Specification Version 1.00 .
>  
> +config SPL_MMC_SDHCI_SDMA
> +	bool "Support SDHCI SDMA in SPL"
> +	depends on MMC_SDHCI
> +	help
> +	  This enables support for the SDMA (Single Operation DMA) defined
> +	  in the SD Host Controller Standard Specification Version 1.00 in SPL.
> +
>  config MMC_SDHCI_ADMA
>  	bool "Support SDHCI ADMA2"
>  	depends on MMC_SDHCI
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 766e4a6b0c5e..6285e53d12a2 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -70,7 +70,7 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)
>  	}
>  }
>  
> -#if (defined(CONFIG_MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
> +#if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
>  static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
>  			      int *is_aligned, int trans_bytes)
>  {
> @@ -177,7 +177,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
>  		}
>  	} while (!(stat & SDHCI_INT_DATA_END));
>  
> -#if (defined(CONFIG_MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
> +#if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
>  	dma_unmap_single(host->start_addr, data->blocks * data->blocksize,
>  			 mmc_get_dma_dir(data));
>  #endif
> @@ -836,7 +836,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
>  #endif
>  	debug("%s, caps: 0x%x\n", __func__, caps);
>  
> -#ifdef CONFIG_MMC_SDHCI_SDMA
> +#if CONFIG_IS_ENABLED(MMC_SDHCI_SDMA)
>  	if ((caps & SDHCI_CAN_DO_SDMA)) {
>  		host->flags |= USE_SDMA;
>  	} else {
Kever Yang March 14, 2022, 8:41 a.m. UTC | #2
Hi Peter,


On 2022/2/22 09:31, Peter Geis wrote:
> Rockchip emmc devices have a similar issue to Rockchip dwmmc devices,
> where performing dma to sram causes errors with suspend/resume.
> Allow us to toggle sdma in spl for sdhci similar to adma support, so we
> can ensure dma is not used when loading the sram code.
>
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>


Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever

> ---
>   drivers/mmc/Kconfig | 7 +++++++
>   drivers/mmc/sdhci.c | 6 +++---
>   2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index f04cc44e1973..1e4342285ce7 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -468,6 +468,13 @@ config MMC_SDHCI_SDMA
>   	  This enables support for the SDMA (Single Operation DMA) defined
>   	  in the SD Host Controller Standard Specification Version 1.00 .
>   
> +config SPL_MMC_SDHCI_SDMA
> +	bool "Support SDHCI SDMA in SPL"
> +	depends on MMC_SDHCI
> +	help
> +	  This enables support for the SDMA (Single Operation DMA) defined
> +	  in the SD Host Controller Standard Specification Version 1.00 in SPL.
> +
>   config MMC_SDHCI_ADMA
>   	bool "Support SDHCI ADMA2"
>   	depends on MMC_SDHCI
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 766e4a6b0c5e..6285e53d12a2 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -70,7 +70,7 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)
>   	}
>   }
>   
> -#if (defined(CONFIG_MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
> +#if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
>   static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
>   			      int *is_aligned, int trans_bytes)
>   {
> @@ -177,7 +177,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
>   		}
>   	} while (!(stat & SDHCI_INT_DATA_END));
>   
> -#if (defined(CONFIG_MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
> +#if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
>   	dma_unmap_single(host->start_addr, data->blocks * data->blocksize,
>   			 mmc_get_dma_dir(data));
>   #endif
> @@ -836,7 +836,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
>   #endif
>   	debug("%s, caps: 0x%x\n", __func__, caps);
>   
> -#ifdef CONFIG_MMC_SDHCI_SDMA
> +#if CONFIG_IS_ENABLED(MMC_SDHCI_SDMA)
>   	if ((caps & SDHCI_CAN_DO_SDMA)) {
>   		host->flags |= USE_SDMA;
>   	} else {
diff mbox series

Patch

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f04cc44e1973..1e4342285ce7 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -468,6 +468,13 @@  config MMC_SDHCI_SDMA
 	  This enables support for the SDMA (Single Operation DMA) defined
 	  in the SD Host Controller Standard Specification Version 1.00 .
 
+config SPL_MMC_SDHCI_SDMA
+	bool "Support SDHCI SDMA in SPL"
+	depends on MMC_SDHCI
+	help
+	  This enables support for the SDMA (Single Operation DMA) defined
+	  in the SD Host Controller Standard Specification Version 1.00 in SPL.
+
 config MMC_SDHCI_ADMA
 	bool "Support SDHCI ADMA2"
 	depends on MMC_SDHCI
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 766e4a6b0c5e..6285e53d12a2 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -70,7 +70,7 @@  static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)
 	}
 }
 
-#if (defined(CONFIG_MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
+#if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
 static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
 			      int *is_aligned, int trans_bytes)
 {
@@ -177,7 +177,7 @@  static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
 		}
 	} while (!(stat & SDHCI_INT_DATA_END));
 
-#if (defined(CONFIG_MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
+#if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
 	dma_unmap_single(host->start_addr, data->blocks * data->blocksize,
 			 mmc_get_dma_dir(data));
 #endif
@@ -836,7 +836,7 @@  int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 #endif
 	debug("%s, caps: 0x%x\n", __func__, caps);
 
-#ifdef CONFIG_MMC_SDHCI_SDMA
+#if CONFIG_IS_ENABLED(MMC_SDHCI_SDMA)
 	if ((caps & SDHCI_CAN_DO_SDMA)) {
 		host->flags |= USE_SDMA;
 	} else {