* [PATCH] mmc: sdhci: correct the tuning command handle for PIO mode
@ 2021-08-13 12:34 haibo.chen
2021-08-20 11:04 ` Adrian Hunter
2021-08-24 14:56 ` Ulf Hansson
0 siblings, 2 replies; 4+ messages in thread
From: haibo.chen @ 2021-08-13 12:34 UTC (permalink / raw)
To: adrian.hunter, ulf.hansson, linux-mmc; +Cc: linux-imx, haibo.chen
From: Haibo Chen <haibo.chen@nxp.com>
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.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/mmc/host/sdhci.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index aba6e10b8605..acee54b368b0 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: sdhci: correct the tuning command handle for PIO mode
2021-08-13 12:34 [PATCH] mmc: sdhci: correct the tuning command handle for PIO mode haibo.chen
@ 2021-08-20 11:04 ` Adrian Hunter
2021-08-20 11:06 ` Adrian Hunter
2021-08-24 14:56 ` Ulf Hansson
1 sibling, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2021-08-20 11:04 UTC (permalink / raw)
To: haibo.chen, ulf.hansson, linux-mmc; +Cc: linux-imx
On 13/08/21 3:34 pm, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> 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.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index aba6e10b8605..acee54b368b0 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -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) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: sdhci: correct the tuning command handle for PIO mode
2021-08-20 11:04 ` Adrian Hunter
@ 2021-08-20 11:06 ` Adrian Hunter
0 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2021-08-20 11:06 UTC (permalink / raw)
To: haibo.chen, ulf.hansson, linux-mmc; +Cc: linux-imx
On 20/08/21 2:04 pm, Adrian Hunter wrote:
> On 13/08/21 3:34 pm, haibo.chen@nxp.com wrote:
>> From: Haibo Chen <haibo.chen@nxp.com>
>>
>> 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.
>>
>> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Although there are unnecessary parenthesis around !host->data
>
>> ---
>> drivers/mmc/host/sdhci.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index aba6e10b8605..acee54b368b0 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -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) {
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: sdhci: correct the tuning command handle for PIO mode
2021-08-13 12:34 [PATCH] mmc: sdhci: correct the tuning command handle for PIO mode haibo.chen
2021-08-20 11:04 ` Adrian Hunter
@ 2021-08-24 14:56 ` Ulf Hansson
1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2021-08-24 14:56 UTC (permalink / raw)
To: Haibo Chen; +Cc: Adrian Hunter, linux-mmc, dl-linux-imx
On Fri, 13 Aug 2021 at 14:55, <haibo.chen@nxp.com> wrote:
>
> From: Haibo Chen <haibo.chen@nxp.com>
>
> 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.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Applied for next (and by dropping parenthesis according to the comment
from Adrian), thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index aba6e10b8605..acee54b368b0 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-24 14:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 12:34 [PATCH] mmc: sdhci: correct the tuning command handle for PIO mode haibo.chen
2021-08-20 11:04 ` Adrian Hunter
2021-08-20 11:06 ` Adrian Hunter
2021-08-24 14:56 ` Ulf Hansson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.