All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Wenbin Mei <wenbin.mei@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: mtk-sd: Clear interrupts when cqe off/disable
Date: Mon, 15 Aug 2022 20:28:04 +0200	[thread overview]
Message-ID: <CAPDyKFqg7gDXMKyDXa_oczfkjqEAcsyL-9YJWHE9wA2sY0BGfg@mail.gmail.com> (raw)
In-Reply-To: <20220728080048.21336-1-wenbin.mei@mediatek.com>

On Thu, 28 Jul 2022 at 10:01, Wenbin Mei <wenbin.mei@mediatek.com> wrote:
>
> Currently we don't clear MSDC interrupts when cqe off/disable, which led
> to the data complete interrupt will be reserved for the next command.
> If the next command with data transfer after cqe off/disable, we process
> the CMD ready interrupt and trigger DMA start for data, but the data
> complete interrupt is already exists, then SW assume that the data transfer
> is complete, SW will trigger DMA stop, but the data may not be transmitted
> yet or is transmitting, so we may encounter the following error:
> mtk-msdc 11230000.mmc: CMD bus busy detected.
>
> Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>

Applied for fixes and by adding the below tags, thanks!

Fixes: 88bd652b3c74 ("mmc: mediatek: command queue support")
Cc: stable@vger.kernel.org

Kind regards
Uffe


> ---
>  drivers/mmc/host/mtk-sd.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 4ff73d1883de..69d78604d1fc 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -2446,6 +2446,9 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery)
>         /* disable busy check */
>         sdr_clr_bits(host->base + MSDC_PATCH_BIT1, MSDC_PB1_BUSY_CHECK_SEL);
>
> +       val = readl(host->base + MSDC_INT);
> +       writel(val, host->base + MSDC_INT);
> +
>         if (recovery) {
>                 sdr_set_field(host->base + MSDC_DMA_CTRL,
>                               MSDC_DMA_CTRL_STOP, 1);
> @@ -2932,11 +2935,14 @@ static int __maybe_unused msdc_suspend(struct device *dev)
>         struct mmc_host *mmc = dev_get_drvdata(dev);
>         struct msdc_host *host = mmc_priv(mmc);
>         int ret;
> +       u32 val;
>
>         if (mmc->caps2 & MMC_CAP2_CQE) {
>                 ret = cqhci_suspend(mmc);
>                 if (ret)
>                         return ret;
> +               val = readl(host->base + MSDC_INT);
> +               writel(val, host->base + MSDC_INT);
>         }
>
>         /*
> --
> 2.25.1
>

WARNING: multiple messages have this Message-ID (diff)
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Wenbin Mei <wenbin.mei@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	 linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	 linux-mediatek@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: mtk-sd: Clear interrupts when cqe off/disable
Date: Mon, 15 Aug 2022 20:28:04 +0200	[thread overview]
Message-ID: <CAPDyKFqg7gDXMKyDXa_oczfkjqEAcsyL-9YJWHE9wA2sY0BGfg@mail.gmail.com> (raw)
In-Reply-To: <20220728080048.21336-1-wenbin.mei@mediatek.com>

On Thu, 28 Jul 2022 at 10:01, Wenbin Mei <wenbin.mei@mediatek.com> wrote:
>
> Currently we don't clear MSDC interrupts when cqe off/disable, which led
> to the data complete interrupt will be reserved for the next command.
> If the next command with data transfer after cqe off/disable, we process
> the CMD ready interrupt and trigger DMA start for data, but the data
> complete interrupt is already exists, then SW assume that the data transfer
> is complete, SW will trigger DMA stop, but the data may not be transmitted
> yet or is transmitting, so we may encounter the following error:
> mtk-msdc 11230000.mmc: CMD bus busy detected.
>
> Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com>

Applied for fixes and by adding the below tags, thanks!

Fixes: 88bd652b3c74 ("mmc: mediatek: command queue support")
Cc: stable@vger.kernel.org

Kind regards
Uffe


> ---
>  drivers/mmc/host/mtk-sd.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 4ff73d1883de..69d78604d1fc 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -2446,6 +2446,9 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery)
>         /* disable busy check */
>         sdr_clr_bits(host->base + MSDC_PATCH_BIT1, MSDC_PB1_BUSY_CHECK_SEL);
>
> +       val = readl(host->base + MSDC_INT);
> +       writel(val, host->base + MSDC_INT);
> +
>         if (recovery) {
>                 sdr_set_field(host->base + MSDC_DMA_CTRL,
>                               MSDC_DMA_CTRL_STOP, 1);
> @@ -2932,11 +2935,14 @@ static int __maybe_unused msdc_suspend(struct device *dev)
>         struct mmc_host *mmc = dev_get_drvdata(dev);
>         struct msdc_host *host = mmc_priv(mmc);
>         int ret;
> +       u32 val;
>
>         if (mmc->caps2 & MMC_CAP2_CQE) {
>                 ret = cqhci_suspend(mmc);
>                 if (ret)
>                         return ret;
> +               val = readl(host->base + MSDC_INT);
> +               writel(val, host->base + MSDC_INT);
>         }
>
>         /*
> --
> 2.25.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-08-15 18:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28  8:00 [PATCH] mmc: mtk-sd: Clear interrupts when cqe off/disable Wenbin Mei
2022-07-28  8:00 ` Wenbin Mei
2022-08-15 18:28 ` Ulf Hansson [this message]
2022-08-15 18:28   ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPDyKFqg7gDXMKyDXa_oczfkjqEAcsyL-9YJWHE9wA2sY0BGfg@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=chaotian.jing@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=wenbin.mei@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.