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

mmc: tmio: always restore irq register

Currently, only SDHI on R-Car Gen2+ reinitializes the irq register
during reset but it should be done on all instances. We can move it from
the SDHI driver to the TMIO core, because we now have the
'sd_irq_mask_all' variable which carries the proper value to use. That
also means we can remove the initialization from tmio_mmc_probe()
because it calls tmio_mmc_reset(), too. We only move that
tmio_mmc_reset() call there a little to ensure 'sd_irq_mask_all' is
properly set.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20210413083137.11171-1-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Wolfram Sang and committed by
Ulf Hansson
0751d56e 9751bacc

+6 -7
-2
drivers/mmc/host/renesas_sdhi_core.c
··· 588 588 renesas_sdhi_scc_reset(host, priv); 589 589 } 590 590 591 - sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, TMIO_MASK_ALL_RCAR2); 592 - 593 591 if (sd_ctrl_read16(host, CTL_VERSION) >= SDHI_VER_GEN3_SD) { 594 592 val = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT); 595 593 val |= CARD_OPT_EXTOP;
+6 -5
drivers/mmc/host/tmio_mmc_core.c
··· 192 192 if (host->reset) 193 193 host->reset(host); 194 194 195 + sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host->sdcard_irq_mask_all); 196 + host->sdcard_irq_mask = host->sdcard_irq_mask_all; 197 + 195 198 tmio_mmc_set_bus_width(host, host->mmc->ios.bus_width); 196 199 197 200 if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) { ··· 1179 1176 if (pdata->flags & TMIO_MMC_SDIO_IRQ) 1180 1177 _host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; 1181 1178 1182 - _host->set_clock(_host, 0); 1183 - tmio_mmc_reset(_host); 1184 - 1185 - _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK); 1186 1179 if (!_host->sdcard_irq_mask_all) 1187 1180 _host->sdcard_irq_mask_all = TMIO_MASK_ALL; 1188 - tmio_mmc_disable_mmc_irqs(_host, _host->sdcard_irq_mask_all); 1181 + 1182 + _host->set_clock(_host, 0); 1183 + tmio_mmc_reset(_host); 1189 1184 1190 1185 if (_host->native_hotplug) 1191 1186 tmio_mmc_enable_mmc_irqs(_host,