From: Adrian Hunter <adrian.hunter@intel.com>
To: Avri Altman <avri.altman@wdc.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-mmc@vger.kernel.org
Cc: Daniil Lunev <dlunev@google.com>,
Asutosh Das <quic_asutoshd@quicinc.com>
Subject: Re: [PATCH 1/3] mmc: host: Quirk - Disable auto-cmd12 during ffu
Date: Fri, 20 Oct 2023 08:36:24 +0300 [thread overview]
Message-ID: <cee3c9ac-4beb-4d78-87fc-fe1dab418cc2@intel.com> (raw)
In-Reply-To: <20231012184041.1837455-2-avri.altman@wdc.com>
On 12/10/23 21:40, Avri Altman wrote:
> Field Firmware Update (ffu) may use close-ended or open ended sequence.
> Each such sequence is comprised of a write commands enclosed between 2
> switch commands - to and from ffu mode.
>
> Some platforms generate auto command error interrupt when it shouldn't,
> e.g. auto-cmd12 while in close-ended ffu sequence.
>
> Therefore, add a quirk that disable auto-cmd12 while close-ended ffu is
> in progress.
If you hook the request function, maybe the existing SDHCI_AUTO_CMD12
flag could be used instead of introducing a new quirk:
void sdhci_msm_request(etc)
{
if data-mrq and using-auto-cmd-12
if ffu
host->flags &= ~SDHCI_AUTO_CMD12;
else
host->flags |= SDHCI_AUTO_CMD12;
sdhci_request(etc)
}
>
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
> ---
> drivers/mmc/host/sdhci.c | 8 +++++++-
> drivers/mmc/host/sdhci.h | 2 ++
> include/linux/mmc/core.h | 3 +++
> 3 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index ff41aa56564e..6d58f71f926e 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1389,11 +1389,17 @@ void sdhci_switch_external_dma(struct sdhci_host *host, bool en)
> }
> EXPORT_SYMBOL_GPL(sdhci_switch_external_dma);
>
> +static inline bool sdhci_dont_auto_cmd12_ffu(struct sdhci_host *host,
> + struct mmc_request *mrq) {
> + return (host->quirks2 & SDHCI_QUIRK2_FFU_ACMD12) && mrq->ffu;
> +}
> +
> static inline bool sdhci_auto_cmd12(struct sdhci_host *host,
> struct mmc_request *mrq)
> {
> return !mrq->sbc && (host->flags & SDHCI_AUTO_CMD12) &&
> - !mrq->cap_cmd_during_tfr;
> + !mrq->cap_cmd_during_tfr &&
> + !sdhci_dont_auto_cmd12_ffu(host, mrq);
> }
>
> static inline bool sdhci_auto_cmd23(struct sdhci_host *host,
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index f219bdea8f28..ccab3a76883c 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -485,6 +485,8 @@ struct sdhci_host {
> #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18)
> /* Issue CMD and DATA reset together */
> #define SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER (1<<19)
> +/* Controller generates auto-cmd error interrupt during close-ended ffu */
> +#define SDHCI_QUIRK2_FFU_ACMD12 (1<<20)
>
> int irq; /* Device IRQ */
> void __iomem *ioaddr; /* Mapped address */
> diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
> index 6efec0b9820c..aca4e84f648c 100644
> --- a/include/linux/mmc/core.h
> +++ b/include/linux/mmc/core.h
> @@ -161,6 +161,9 @@ struct mmc_request {
> /* Allow other commands during this ongoing data transfer or busy wait */
> bool cap_cmd_during_tfr;
>
> + /* Be aware that ffu is in progress and avoid auto-cmd12 */
> + bool ffu;
> +
> int tag;
>
> #ifdef CONFIG_MMC_CRYPTO
next prev parent reply other threads:[~2023-10-20 5:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 18:40 [PATCH 0/3] mmc: host: Disable auto-cmd12 during ffu Avri Altman
2023-10-12 18:40 ` [PATCH 1/3] mmc: host: Quirk - " Avri Altman
2023-10-20 5:36 ` Adrian Hunter [this message]
2023-10-20 11:14 ` Avri Altman
2023-10-12 18:40 ` [PATCH 2/3] mmc: core: Mark close-ended ffu in progress Avri Altman
2023-10-20 5:48 ` Adrian Hunter
2023-10-20 11:16 ` Avri Altman
2023-10-12 18:40 ` [PATCH 3/3] mmc: host: sdhci-msm: Apply SDHCI_QUIRK2_FFU_ACMD12 Avri Altman
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=cee3c9ac-4beb-4d78-87fc-fe1dab418cc2@intel.com \
--to=adrian.hunter@intel.com \
--cc=avri.altman@wdc.com \
--cc=dlunev@google.com \
--cc=linux-mmc@vger.kernel.org \
--cc=quic_asutoshd@quicinc.com \
--cc=ulf.hansson@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox