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

mmc: sdhci: Correct the tuning command handle for PIO mode

If sdhci use PIO mode, and use mmc_send_tuning() to send the tuning
command, system will stuck because of the storm irq of sdhci. For PIO mode,
use mmc_send_tuning(), it will trigger buffer_read_ready interrupt and data
transfer complete interrupt. In current code logic, it will directly
return in sdhci_data_irq, can not call the sdhci_transfer_pio(). So the
buffer_read_ready interrupt storm happen. So for standard tuning method,
need to exclude this case.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/1628858041-1911-1-git-send-email-haibo.chen@nxp.com
[Ulf: Dropped redundant parenthesis in an expression]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Haibo Chen and committed by
Ulf Hansson
f4ff24f8 71b7597c

+8 -2
+8 -2
drivers/mmc/host/sdhci.c
··· 3279 3279 { 3280 3280 u32 command; 3281 3281 3282 - /* CMD19 generates _only_ Buffer Read Ready interrupt */ 3283 - if (intmask & SDHCI_INT_DATA_AVAIL) { 3282 + /* 3283 + * CMD19 generates _only_ Buffer Read Ready interrupt if 3284 + * use sdhci_send_tuning. 3285 + * Need to exclude this case: PIO mode and use mmc_send_tuning, 3286 + * If not, sdhci_transfer_pio will never be called, make the 3287 + * SDHCI_INT_DATA_AVAIL always there, stuck in irq storm. 3288 + */ 3289 + if (intmask & SDHCI_INT_DATA_AVAIL && !host->data) { 3284 3290 command = SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND)); 3285 3291 if (command == MMC_SEND_TUNING_BLOCK || 3286 3292 command == MMC_SEND_TUNING_BLOCK_HS200) {