Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: renesas_sdhi: newer SoCs don't need manual tap correction

The newest Gen3 SoCs and Gen4 SoCs do not need manual tap correction
with HS400 anymore. So, instead of checking the SDHI version, add a
quirk flag and set manual tap correction only for affected SoCs.

Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
[wsa: rebased, renamed the quirk variable, removed stale comment]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20220720072901.1266-1-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Takeshi Saito and committed by
Ulf Hansson
00e8c11c 7ee48079

+9 -3
+1
drivers/mmc/host/renesas_sdhi.h
··· 43 43 bool hs400_4taps; 44 44 bool fixed_addr_mode; 45 45 bool dma_one_rx_only; 46 + bool manual_tap_correction; 46 47 u32 hs400_bad_taps; 47 48 const u8 (*hs400_calib_table)[SDHI_CALIB_TABLE_MAX]; 48 49 };
+2 -3
drivers/mmc/host/renesas_sdhi_core.c
··· 380 380 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DT2FF, 381 381 priv->scc_tappos_hs400); 382 382 383 - /* Gen3 can't do automatic tap correction with HS400, so disable it */ 384 - if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN3_SDMMC) 383 + if (priv->quirks && priv->quirks->manual_tap_correction) 385 384 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL, 386 385 ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN & 387 386 sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL)); ··· 717 718 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0); 718 719 719 720 /* Change TAP position according to correction status */ 720 - if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN3_SDMMC && 721 + if (priv->quirks && priv->quirks->manual_tap_correction && 721 722 host->mmc->ios.timing == MMC_TIMING_MMC_HS400) { 722 723 u32 bad_taps = priv->quirks ? priv->quirks->hs400_bad_taps : 0; 723 724 /*
+6
drivers/mmc/host/renesas_sdhi_internal_dmac.c
··· 170 170 static const struct renesas_sdhi_quirks sdhi_quirks_4tap = { 171 171 .hs400_4taps = true, 172 172 .hs400_bad_taps = BIT(2) | BIT(3) | BIT(6) | BIT(7), 173 + .manual_tap_correction = true, 173 174 }; 174 175 175 176 static const struct renesas_sdhi_quirks sdhi_quirks_nohs400 = { ··· 183 182 184 183 static const struct renesas_sdhi_quirks sdhi_quirks_bad_taps1357 = { 185 184 .hs400_bad_taps = BIT(1) | BIT(3) | BIT(5) | BIT(7), 185 + .manual_tap_correction = true, 186 186 }; 187 187 188 188 static const struct renesas_sdhi_quirks sdhi_quirks_bad_taps2367 = { 189 189 .hs400_bad_taps = BIT(2) | BIT(3) | BIT(6) | BIT(7), 190 + .manual_tap_correction = true, 190 191 }; 191 192 192 193 static const struct renesas_sdhi_quirks sdhi_quirks_r8a7796_es13 = { 193 194 .hs400_4taps = true, 194 195 .hs400_bad_taps = BIT(2) | BIT(3) | BIT(6) | BIT(7), 195 196 .hs400_calib_table = r8a7796_es13_calib_table, 197 + .manual_tap_correction = true, 196 198 }; 197 199 198 200 static const struct renesas_sdhi_quirks sdhi_quirks_r8a77965 = { 199 201 .hs400_bad_taps = BIT(2) | BIT(3) | BIT(6) | BIT(7), 200 202 .hs400_calib_table = r8a77965_calib_table, 203 + .manual_tap_correction = true, 201 204 }; 202 205 203 206 static const struct renesas_sdhi_quirks sdhi_quirks_r8a77990 = { 204 207 .hs400_calib_table = r8a77990_calib_table, 208 + .manual_tap_correction = true, 205 209 }; 206 210 207 211 /*