diff mbox series

[RFC,1/4] mmc: renesas_sdhi: only reset SCC when its pointer is populated

Message ID 20201110142058.36393-2-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show
Series mmc: renesas_sdhi: reset SCC only when available | expand

Commit Message

Wolfram Sang Nov. 10, 2020, 2:20 p.m. UTC
Only re-initialize SCC and tuning when an SCC was found during probe().
This is currently a noop because all R-Car Gen2+ are considered to have
an SCC. But this will change in a later patch, so we need this
preparation.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Niklas Söderlund Nov. 11, 2020, 9:18 p.m. UTC | #1
Hi Wolfram,

Thanks for your work.

On 2020-11-10 15:20:55 +0100, Wolfram Sang wrote:
> Only re-initialize SCC and tuning when an SCC was found during probe().
> This is currently a noop because all R-Car Gen2+ are considered to have
> an SCC. But this will change in a later patch, so we need this
> preparation.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/mmc/host/renesas_sdhi_core.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index acb9c81a4e45..a395f835e836 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -556,16 +556,18 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host)
>  {
>  	struct renesas_sdhi *priv = host_to_priv(host);
>  
> -	renesas_sdhi_reset_scc(host, priv);
> -	renesas_sdhi_reset_hs400_mode(host, priv);
> -	priv->needs_adjust_hs400 = false;
> +	if (priv->scc_ctl) {
> +		renesas_sdhi_reset_scc(host, priv);
> +		renesas_sdhi_reset_hs400_mode(host, priv);
> +		priv->needs_adjust_hs400 = false;
>  
> -	sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN |
> -			sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
> +		sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN |
> +				sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
>  
> -	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL,
> -		       ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &
> -		       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
> +		sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL,
> +			       ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &
> +			       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
> +	}
>  
>  	if (host->pdata->flags & TMIO_MMC_MIN_RCAR2)
>  		sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK,
> -- 
> 2.28.0
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index acb9c81a4e45..a395f835e836 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -556,16 +556,18 @@  static void renesas_sdhi_reset(struct tmio_mmc_host *host)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
 
-	renesas_sdhi_reset_scc(host, priv);
-	renesas_sdhi_reset_hs400_mode(host, priv);
-	priv->needs_adjust_hs400 = false;
+	if (priv->scc_ctl) {
+		renesas_sdhi_reset_scc(host, priv);
+		renesas_sdhi_reset_hs400_mode(host, priv);
+		priv->needs_adjust_hs400 = false;
 
-	sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN |
-			sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
+		sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN |
+				sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
 
-	sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL,
-		       ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &
-		       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
+		sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL,
+			       ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &
+			       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
+	}
 
 	if (host->pdata->flags & TMIO_MMC_MIN_RCAR2)
 		sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK,