Commit 0e587014 authored by Wolfram Sang's avatar Wolfram Sang Committed by Ulf Hansson
Browse files

mmc: renesas_sdhi: break SCC reset into own function



renesas_sdhi_reset used to mainly reset the SCC but is now doing more
and even more will be added. So, factor out SCC reset to have a clear
distinction when we want to reset either SCC or SDHI+SCC.

Reviewed-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20210317091622.31890-3-wsa+renesas@sang-engineering.com


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent ab0cdefe
Loading
Loading
Loading
Loading
+14 −10
Original line number Original line Diff line number Diff line
@@ -557,13 +557,8 @@ static int renesas_sdhi_prepare_hs400_tuning(struct mmc_host *mmc, struct mmc_io
	return 0;
	return 0;
}
}


/* only populated for TMIO_MMC_MIN_RCAR2 */
static void renesas_sdhi_scc_reset(struct tmio_mmc_host *host, struct renesas_sdhi *priv)
static void renesas_sdhi_reset(struct tmio_mmc_host *host)
{
{
	struct renesas_sdhi *priv = host_to_priv(host);
	u16 val;

	if (priv->scc_ctl) {
	renesas_sdhi_disable_scc(host->mmc);
	renesas_sdhi_disable_scc(host->mmc);
	renesas_sdhi_reset_hs400_mode(host, priv);
	renesas_sdhi_reset_hs400_mode(host, priv);
	priv->needs_adjust_hs400 = false;
	priv->needs_adjust_hs400 = false;
@@ -573,6 +568,15 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host)
		       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
		       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
}
}


/* only populated for TMIO_MMC_MIN_RCAR2 */
static void renesas_sdhi_reset(struct tmio_mmc_host *host)
{
	struct renesas_sdhi *priv = host_to_priv(host);
	u16 val;

	if (priv->scc_ctl)
		renesas_sdhi_scc_reset(host, priv);

	sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, TMIO_MASK_ALL_RCAR2);
	sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, TMIO_MASK_ALL_RCAR2);


	if (sd_ctrl_read16(host, CTL_VERSION) >= SDHI_VER_GEN3_SD) {
	if (sd_ctrl_read16(host, CTL_VERSION) >= SDHI_VER_GEN3_SD) {
@@ -691,7 +695,7 @@ static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode)


	ret = renesas_sdhi_select_tuning(host);
	ret = renesas_sdhi_select_tuning(host);
	if (ret < 0)
	if (ret < 0)
		renesas_sdhi_reset(host);
		renesas_sdhi_scc_reset(host, priv);
	return ret;
	return ret;
}
}