All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [MMC] RPMB: Transfer data timeout error
@ 2019-05-27 13:48 Bharat Gooty
  0 siblings, 0 replies; only message in thread
From: Bharat Gooty @ 2019-05-27 13:48 UTC (permalink / raw)
  To: u-boot

Hello,



I am using Broadcom northstar2 platform, which uses Arasan eMMC 5.0
controller and micron 4.5.1 eMMC card.



Switched to “rpmb” partition using “mmc dev 0 3” command.



I am trying to use “mmc rpmb counter” command and results is “Transfer data
timeout”.



Further investigation, found, mmc_rpmb_get_counter () -à
mmc_rpmb_request(), which expects response type of MMC_RSP_R1b.

As part of the rpmb protocol, MMC_CMD_SET_BLOCK_COUNT (23) is set to #1 and
MMC_CMD_WRITE_MULTIPLE_BLOCK (25) is send. For multi block write command,
data is rpmb data.



As the expected response is set to MMC_RSP_R1b, in sdhci_send_command(),
data mask is or’ed with SDHCI_INT_DATA_END (mask |= SDHCI_INT_DATA_END).

After the sdhci_cmd_done() happens, data mask is written to
SDHCI_INT_STATUS. I guess this is sending STOP, because of
SDHCI_INT_DATA_END. As the actual rpmb data is transferred in
sdhci_transfer_data (), which will check for rdy (SDHCI_INT_SPACE_AVAIL|
SDHCI_INT_DATA_AVAIL). The SDHCI_INT_STATUS register read value will be
always 0x0 and causing for “Transfer data timeout”



Would like to know whether response type for mmc_rpmb_request() can be
changed to MMC_RSP_R1 (instead of MMC_RSP_R1b)



Or using SDHCI_QUIRK_BROKEN_R1B quirk in mmc_rpmb_request() like the
following or any other alternative ways, please suggest:

--- a/drivers/mmc/rpmb.c

+++ b/drivers/mmc/rpmb.c

@@ -91,6 +91,7 @@ static int mmc_rpmb_request(struct mmc *mmc, const struct
s_rpmb *s,

{

        struct mmc_cmd cmd = {0};

        struct mmc_data data;

+       struct sdhci_host *host = mmc->priv;

        int ret;



        ret = mmc_set_blockcount(mmc, count, is_rel_write);

@@ -105,6 +106,9 @@ static int mmc_rpmb_request(struct mmc *mmc, const
struct s_rpmb *s,

        cmd.cmdarg = 0;

        cmd.resp_type = MMC_RSP_R1b;



+       if (host->quirks & SDHCI_QUIRK_BROKEN_R1B)

+               cmd.resp_type = MMC_RSP_R1;

+

        data.src = (const char *)s;

        data.blocks = 1;

        data.blocksize = MMC_MAX_BLOCK_LEN;



Thanks,

-Bharat

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-27 13:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 13:48 [U-Boot] [MMC] RPMB: Transfer data timeout error Bharat Gooty

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.