mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-15 17:14:00 +08:00
mmc: sdhci-of-dwcmshc: fix rpmb access
Commita44f7cb937
("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:a44f7cb937
("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> Link: https://lore.kernel.org/r/20201229161625.38255233@xhacker.debian Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
7c53f6b671
commit
ca1219c0a7
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user