From: Adrian Hunter <adrian.hunter@intel.com>
To: Jisheng Zhang <Jisheng.Zhang@synaptics.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: sdhci-of-dwcmshc: fix rpmb access
Date: Tue, 5 Jan 2021 18:00:01 +0200 [thread overview]
Message-ID: <33a544d0-d911-17dd-6ea6-a847fce42b3c@intel.com> (raw)
In-Reply-To: <20201229161625.38255233@xhacker.debian>
On 29/12/20 10:16 am, Jisheng Zhang wrote:
> Commit a44f7cb93732 ("mmc: core: use mrq->sbc when sending CMD23 for
> RPMB") began to use ACMD23 for RPMB if the host supports ACMD23. In
> RPMB ACM23 case, we need to set bit 31 to CMD23 argument, otherwise
> RPMB write operation will return general fail.
>
> However, no matter V4 is enabled or not, the dwcmshc's ARGUMENT2
> register is 32-bit block count register which doesn't support stuff
> bits of CMD23 argument. So let's handle this specific ACMD23 case.
>
>>From another side, this patch also prepare for future v4 enabling
> for dwcmshc, because from the 4.10 spec, the ARGUMENT2 register is
> redefined as 32bit block count which doesn't support stuff bits of
> CMD23 argument.
>
> Fixes: a44f7cb93732 ("mmc: core: use mrq->sbc when sending CMD23 for RPMB")
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-of-dwcmshc.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 4b673792b5a4..d90020ed3622 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -16,6 +16,8 @@
>
> #include "sdhci-pltfm.h"
>
> +#define SDHCI_DWCMSHC_ARG2_STUFF GENMASK(31, 16)
> +
> /* DWCMSHC specific Mode Select value */
> #define DWCMSHC_CTRL_HS400 0x7
>
> @@ -49,6 +51,29 @@ static void dwcmshc_adma_write_desc(struct sdhci_host *host, void **desc,
> sdhci_adma_write_desc(host, desc, addr, len, cmd);
> }
>
> +static void dwcmshc_check_auto_cmd23(struct mmc_host *mmc,
> + struct mmc_request *mrq)
> +{
> + struct sdhci_host *host = mmc_priv(mmc);
> +
> + /*
> + * No matter V4 is enabled or not, ARGUMENT2 register is 32-bit
> + * block count register which doesn't support stuff bits of
> + * CMD23 argument on dwcmsch host controller.
> + */
> + if (mrq->sbc && (mrq->sbc->arg & SDHCI_DWCMSHC_ARG2_STUFF))
> + host->flags &= ~SDHCI_AUTO_CMD23;
> + else
> + host->flags |= SDHCI_AUTO_CMD23;
> +}
> +
> +static void dwcmshc_request(struct mmc_host *mmc, struct mmc_request *mrq)
> +{
> + dwcmshc_check_auto_cmd23(mmc, mrq);
> +
> + sdhci_request(mmc, mrq);
> +}
> +
> static void dwcmshc_set_uhs_signaling(struct sdhci_host *host,
> unsigned int timing)
> {
> @@ -133,6 +158,8 @@ static int dwcmshc_probe(struct platform_device *pdev)
>
> sdhci_get_of_property(pdev);
>
> + host->mmc_host_ops.request = dwcmshc_request;
> +
> err = sdhci_add_host(host);
> if (err)
> goto err_clk;
>
next prev parent reply other threads:[~2021-01-05 16:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 8:16 [PATCH] mmc: sdhci-of-dwcmshc: fix rpmb access Jisheng Zhang
2021-01-05 16:00 ` Adrian Hunter [this message]
2021-01-11 18:06 ` 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=33a544d0-d911-17dd-6ea6-a847fce42b3c@intel.com \
--to=adrian.hunter@intel.com \
--cc=Jisheng.Zhang@synaptics.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--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