RPMB operation with auto-cmd12 host controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm using the sdhci-iproc host controller on my board (running linux-4.9).
When I try to access to the RPMB partition I get the following message.

mmc0: Timeout waiting for hardware interrupt.
sdhci: =========== REGISTER DUMP (mmc0)===========
sdhci: Sys addr: 0x7e820000 | Version:  0x0000ac02
sdhci: Blk size: 0x00007200 | Blk cnt:  0x00000000
sdhci: Argument: 0x00000000 | Trn mode: 0x00000027
sdhci: Present:  0x01f70002 | Host ctl: 0x00000017
sdhci: Power:    0x0000000f | Blk gap:  0x00000000
sdhci: Wake-up:  0x00000000 | Clock:    0x00000207
sdhci: Timeout:  0x0000000e | Int stat: 0x00000000
sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
sdhci: AC12 err: 0x00000002 | Slot int: 0x00000000
sdhci: Caps:     0x05e80000 | Caps_1:   0x03002075
sdhci: Cmd:      0x0000193a | Max curr: 0x00000001
sdhci: Host ctl2: 0x0000800c
sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7f30c210
sdhci: ===========================================
sdhci-iproc 18041000.sdhci: __mmc_blk_ioctl_cmd: data error -110
RPMB ioctl failed: Connection timed out

The controller has the auto-cmd12 feature wich make the RPMB cmd incorrect.
Because the cmd23 is sent separately and an incorrect CMD12 is added
during the operation (from what I understand).

A dirty patch to make it works could be (on top of 4.9) :

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index c411f7a68641..d0d1fd9cfad5 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -464,6 +464,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card
*card, struct mmc_blk_data *md,
                               struct mmc_blk_ioc_data *idata)
 {
        struct mmc_command cmd = {0};
+       struct mmc_command sbc = {0};
        struct mmc_data data = {0};
        struct mmc_request mrq = {NULL};
        struct scatterlist sg;
@@ -530,10 +531,12 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card
*card, struct mmc_blk_data *md,
        }

        if (is_rpmb) {
-               err = mmc_set_blockcount(card, data.blocks,
-                       idata->ic.write_flag & (1 << 31));
-               if (err)
-                       return err;
+               sbc.opcode = MMC_SET_BLOCK_COUNT;
+               sbc.arg = data.blocks & 0x0000FFFF;
+               if (idata->ic.write_flag & (1 << 31))
+                       sbc.arg |= 1 << 31;
+               sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
+               mrq.sbc = &sbc;
        }

        if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) &&

But this patch will break other controller. Do you know a proper way
to fix this issue ?

Thanks,
Clement



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux