mmc: sdhci: correct the tuning command handle for PIO mode
PATCH 1/1 mmc: sdhci: correct the tuning command handle for PIO mode
From: Haibo Chen <[email protected]>
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 excluse this case.
--- drivers/mmc/host/sdhci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +8 -2
@@ -3278,8 +3278,14 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) {u32 command; -/* CMD19 generates _only_ Buffer Read Ready interrupt */ -if (intmask &SDHCI_INT_DATA_AVAIL ) { +/* +* CMD19 generates _only_ Buffer Read Ready interrupt if +* use sdhci_send_tuning. +* Need to exclude this case: PIO mode and use mmc_send_tuning, +* If not, sdhci_transfer_pio will never be called, make the +* SDHCI_INT_DATA_AVAIL always there, stuck in irq storm. +*/ +if ((intmask &SDHCI_INT_DATA_AVAIL ) && (!host->data)) { command =SDHCI_GET_CMD (sdhci_readw (host,SDHCI_COMMAND ));if (command ==MMC_SEND_TUNING_BLOCK || command ==MMC_SEND_TUNING_BLOCK_HS200 ) {
Signature · 1 line
2.17.1
Quoted 11 lines · On 13/08/21 3:34 pm, [email protected] wrote:
From: Haibo Chen <[email protected]>
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, usemmc_send_tuning(), it will triggerbuffer_read_readyinterrupt and data transfer complete interrupt. In current code logic, it will directly return insdhci_data_irq, can not call thesdhci_transfer_pio(). So thebuffer_read_readyinterrupt storm happen. So for standard tuning method, need to excluse this case.
Quoted 1 line
Signed-off-by Haibo Chen <[email protected]>
Quoted 26 lines
--- drivers/mmc/host/sdhci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/mmc/host/sdhci.c +8
-2@@ -3278,8 +3278,14 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) {u32 command; -/* CMD19 generates _only_ Buffer Read Ready interrupt */ -if (intmask &SDHCI_INT_DATA_AVAIL ) { +/* +* CMD19 generates _only_ Buffer Read Ready interrupt if +* use sdhci_send_tuning. +* Need to exclude this case: PIO mode and use mmc_send_tuning, +* If not, sdhci_transfer_pio will never be called, make the +* SDHCI_INT_DATA_AVAIL always there, stuck in irq storm. +*/ +if ((intmask &SDHCI_INT_DATA_AVAIL ) && (!host->data)) { command =SDHCI_GET_CMD (sdhci_readw (host,SDHCI_COMMAND ));if (command ==MMC_SEND_TUNING_BLOCK || command ==MMC_SEND_TUNING_BLOCK_HS200 ) {
Adrian Hunter
maintainerQuoted 12 lines · Adrian Hunter
Quoted 11 lines · On 13/08/21 3:34 pm, [email protected] wrote:
From: Haibo Chen <[email protected]>
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, usemmc_send_tuning(), it will triggerbuffer_read_readyinterrupt and data transfer complete interrupt. In current code logic, it will directly return insdhci_data_irq, can not call thesdhci_transfer_pio(). So thebuffer_read_readyinterrupt storm happen. So for standard tuning method, need to excluse this case.
Quoted 3 lines
Quoted 1 line
Signed-off-by Haibo Chen <[email protected]>Acked-by Adrian Hunter <[email protected]>
Although there are unnecessary parenthesis around !host->data
Quoted 28 lines
Quoted 27 lines
--- drivers/mmc/host/sdhci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/mmc/host/sdhci.c +8
-2@@ -3278,8 +3278,14 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) {u32 command; -/* CMD19 generates _only_ Buffer Read Ready interrupt */ -if (intmask &SDHCI_INT_DATA_AVAIL ) { +/* +* CMD19 generates _only_ Buffer Read Ready interrupt if +* use sdhci_send_tuning. +* Need to exclude this case: PIO mode and use mmc_send_tuning, +* If not, sdhci_transfer_pio will never be called, make the +* SDHCI_INT_DATA_AVAIL always there, stuck in irq storm. +*/ +if ((intmask &SDHCI_INT_DATA_AVAIL ) && (!host->data)) { command =SDHCI_GET_CMD (sdhci_readw (host,SDHCI_COMMAND ));if (command ==MMC_SEND_TUNING_BLOCK || command ==MMC_SEND_TUNING_BLOCK_HS200 ) {
Quoted 12 lines · On Fri, 13 Aug 2021 at 14:55, <[email protected]> wrote:
From: Haibo Chen <[email protected]>
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, usemmc_send_tuning(), it will triggerbuffer_read_readyinterrupt and data transfer complete interrupt. In current code logic, it will directly return insdhci_data_irq, can not call thesdhci_transfer_pio(). So thebuffer_read_readyinterrupt storm happen. So for standard tuning method, need to excluse this case.
Quoted 1 line
Signed-off-by Haibo Chen <[email protected]>
Applied for next (and by dropping parenthesis according to the comment from Adrian), thanks!
Kind regards
Uffe
Quoted 28 lines
--- drivers/mmc/host/sdhci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/mmc/host/sdhci.c +8
-3@@ -3278,8 +3278,14 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) {u32 command; -/* CMD19 generates _only_ Buffer Read Ready interrupt */ -if (intmask &SDHCI_INT_DATA_AVAIL ) { +/* +* CMD19 generates _only_ Buffer Read Ready interrupt if +* use sdhci_send_tuning. +* Need to exclude this case: PIO mode and use mmc_send_tuning, +* If not, sdhci_transfer_pio will never be called, make the +* SDHCI_INT_DATA_AVAIL always there, stuck in irq storm. +*/ +if ((intmask &SDHCI_INT_DATA_AVAIL ) && (!host->data)) { command =SDHCI_GET_CMD (sdhci_readw (host,SDHCI_COMMAND ));if (command ==MMC_SEND_TUNING_BLOCK || command ==MMC_SEND_TUNING_BLOCK_HS200 ) { --2.17.1