emmc: refixed RPMB operation process
authorLong Yu <long.yu@amlogic.com>
Fri, 8 Sep 2017 02:26:34 +0000 (10:26 +0800)
committerVictor Wan <victor.wan@amlogic.com>
Fri, 8 Sep 2017 03:33:16 +0000 (20:33 -0700)
PD149212: emmc: refixed RPMB operation process

Change-Id: Ifc845dc1009d2c28ee57a51fd45e43f12c28b7f6
Signed-off-by: Long Yu <long.yu@amlogic.com>
drivers/amlogic/mmc/aml_sd_emmc.c
drivers/mmc/card/block.c

index 2845bda..7e25ffd 100644 (file)
@@ -1802,7 +1802,7 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_request *mrq)
                des_cmd_cur->owner = 1;
                des_cmd_cur->end_of_chain = 0;
 
-               desc_cur->cmd_arg = mrq->cmd->data->blocks;
+               desc_cur->cmd_arg = mrq->sbc->arg;
                /* response save into resp_addr itself */
                des_cmd_cur->resp_num = 1;
                desc_cur->resp_addr = 0;
@@ -1907,8 +1907,7 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_request *mrq)
 #ifdef SD_EMMC_MANUAL_CMD23
                if (((mrq->cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK)
                        || (mrq->cmd->opcode == MMC_READ_MULTIPLE_BLOCK))
-                       && (!host->cmd_is_stop) && (!mrq->sbc)
-                       && !(mrq->cmd->flags & (1 << 30))) {
+                       && (!host->cmd_is_stop) && (!mrq->sbc)) {
 
                        /* pr_info("Send stop command here\n"); */
 
index 6e95e65..613d6bf 100644 (file)
@@ -707,11 +707,25 @@ out:
        return err;
 }
 
+#ifdef CONFIG_AMLOGIC_MMC
+static void aml_mmc_set_blockcount(struct mmc_request *p_mrq,
+               struct mmc_command *p_sbc)
+{
+       p_sbc->opcode = MMC_SET_BLOCK_COUNT;
+       p_sbc->arg = p_mrq->data->blocks | (1 << 31);
+       p_sbc->flags = MMC_RSP_R1 | MMC_CMD_AC;
+       p_mrq->sbc = p_sbc;
+}
+#endif
+
 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_data data = {0};
+#ifdef CONFIG_AMLOGIC_MMC
+       struct mmc_command sbc = {0};
+#endif
        struct mmc_request mrq = {NULL};
        struct scatterlist sg;
        int err;
@@ -777,10 +791,14 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
        }
 
        if (is_rpmb) {
+#ifdef CONFIG_AMLOGIC_MMC
+               aml_mmc_set_blockcount(&mrq, &sbc);
+#else
                err = mmc_set_blockcount(card, data.blocks,
                        idata->ic.write_flag & (1 << 31));
                if (err)
                        return err;
+#endif
        }
 
        if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) &&