mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
emmc: modify the RPMB mark
PD#151126: emmc: modify the RPMB mark 1. modify the RPMB mark in AMLSD.c file 2. add debug debugging methods Change-Id: Iae4f87612c8976520c8283188d331e9e94e72784 Signed-off-by: Long Yu <long.yu@amlogic.com>
This commit is contained in:
@@ -1725,6 +1725,49 @@ int meson_mmc_request_done(struct mmc_host *mmc, struct mmc_request *mrq)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __attribute__((unused))aml_sd_emmc_mrq_print_info(
|
||||
struct mmc_request *mrq, unsigned int desc_cnt)
|
||||
{
|
||||
pr_info("*mmc_request desc_cnt:%d cmd:%d, arg:0x%x, flags:0x%x",
|
||||
desc_cnt, mrq->cmd->opcode, mrq->cmd->arg, mrq->cmd->flags);
|
||||
|
||||
if (mrq->cmd->data)
|
||||
pr_info(", blksz:%d, blocks:0x%x",
|
||||
mrq->data->blksz, mrq->data->blocks);
|
||||
|
||||
pr_info("\n");
|
||||
|
||||
}
|
||||
|
||||
static void __attribute__((unused))
|
||||
aml_sd_emmc_desc_print_info(struct sd_emmc_desc_info *desc_info)
|
||||
{
|
||||
struct cmd_cfg *des_cmd_cur =
|
||||
(struct cmd_cfg *)&(desc_info->cmd_info);
|
||||
|
||||
pr_info("#####desc_info check, desc_info:0x%p\n",
|
||||
desc_info);
|
||||
|
||||
pr_info("\tlength:%d\n", des_cmd_cur->length);
|
||||
pr_info("\tblock_mode:%d\n", des_cmd_cur->block_mode);
|
||||
pr_info("\tr1b:%d\n", des_cmd_cur->r1b);
|
||||
pr_info("\tend_of_chain:%d\n", des_cmd_cur->end_of_chain);
|
||||
pr_info("\ttimeout:%d\n", des_cmd_cur->timeout);
|
||||
pr_info("\tno_resp:%d\n", des_cmd_cur->no_resp);
|
||||
pr_info("\tno_cmd:%d\n", des_cmd_cur->no_cmd);
|
||||
pr_info("\tdata_io:%d\n", des_cmd_cur->data_io);
|
||||
pr_info("\tdata_wr:%d\n", des_cmd_cur->data_wr);
|
||||
pr_info("\tresp_nocrc:%d\n", des_cmd_cur->resp_nocrc);
|
||||
pr_info("\tresp_128:%d\n", des_cmd_cur->resp_128);
|
||||
pr_info("\tresp_num:%d\n", des_cmd_cur->resp_num);
|
||||
pr_info("\tdata_num:%d\n", des_cmd_cur->data_num);
|
||||
pr_info("\tcmd_index:%d\n", des_cmd_cur->cmd_index);
|
||||
pr_info("\tcmd_arg:0x%x\n", desc_info->cmd_arg);
|
||||
pr_info("\tdata_addr:0x%x\n", desc_info->data_addr);
|
||||
pr_info("\tresp_addr:0x%x\n", desc_info->resp_addr);
|
||||
|
||||
}
|
||||
|
||||
static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_request *mrq)
|
||||
{
|
||||
struct amlsd_host *host = mmc_priv(mmc);
|
||||
@@ -1957,6 +2000,20 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_request *mrq)
|
||||
desc_start->busy = 1;
|
||||
desc_start->addr = host->desc_dma_addr >> 2;
|
||||
|
||||
#if 0 /* debug */
|
||||
desc_cur = (struct sd_emmc_desc_info *)host->desc_buf;
|
||||
des_cmd_cur = (struct cmd_cfg *)&(desc_cur->cmd_info);
|
||||
|
||||
aml_sd_emmc_mrq_print_info(mrq, desc_cnt);
|
||||
|
||||
while (desc_cnt) {
|
||||
aml_sd_emmc_desc_print_info(desc_cur);
|
||||
desc_cur++;
|
||||
des_cmd_cur = (struct cmd_cfg *)&(desc_cur->cmd_info);
|
||||
desc_cnt--;
|
||||
}
|
||||
|
||||
#endif
|
||||
dma_rmb();
|
||||
wmb(); /* ensure descriptor is written before kicked */
|
||||
#ifdef AML_CALIBRATION
|
||||
|
||||
@@ -104,6 +104,7 @@ static int aml_cmd_invalid(struct mmc_host *mmc, struct mmc_request *mrq)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int aml_rpmb_cmd_invalid(struct mmc_host *mmc, struct mmc_request *mrq)
|
||||
{
|
||||
#ifdef CONFIG_AMLOGIC_M8B_MMC
|
||||
@@ -123,6 +124,7 @@ static int aml_rpmb_cmd_invalid(struct mmc_host *mmc, struct mmc_request *mrq)
|
||||
mmc_request_done(mmc, mrq);
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
int aml_check_unsupport_cmd(struct mmc_host *mmc, struct mmc_request *mrq)
|
||||
{
|
||||
@@ -140,24 +142,6 @@ int aml_check_unsupport_cmd(struct mmc_host *mmc, struct mmc_request *mrq)
|
||||
if (opcode == 3)
|
||||
mmc->first_init_flag = false;
|
||||
|
||||
if (aml_card_type_mmc(pdata)) {
|
||||
if (opcode == 6) {
|
||||
if (arg == 0x3B30301)
|
||||
pdata->rmpb_cmd_flag = 1;
|
||||
else
|
||||
pdata->rmpb_cmd_flag = 0;
|
||||
}
|
||||
if (pdata->rmpb_cmd_flag && (!pdata->rpmb_valid_command)) {
|
||||
if ((opcode == 18)
|
||||
|| (opcode == 25))
|
||||
return aml_rpmb_cmd_invalid(mmc, mrq);
|
||||
}
|
||||
if (pdata->rmpb_cmd_flag && (opcode == 23))
|
||||
pdata->rpmb_valid_command = 1;
|
||||
else
|
||||
pdata->rpmb_valid_command = 0;
|
||||
}
|
||||
|
||||
if (mmc->caps & MMC_CAP_NONREMOVABLE) { /* nonremovable device */
|
||||
if (mmc->first_init_flag) { /* init for the first time */
|
||||
/* for 8189ETV needs ssdio reset when starts */
|
||||
|
||||
@@ -709,11 +709,13 @@ out:
|
||||
|
||||
#ifdef CONFIG_AMLOGIC_MMC
|
||||
static void aml_mmc_set_blockcount(struct mmc_request *p_mrq,
|
||||
struct mmc_command *p_sbc)
|
||||
struct mmc_command *p_sbc, bool is_rel_write)
|
||||
{
|
||||
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_sbc->arg = p_mrq->data->blocks;
|
||||
if (is_rel_write)
|
||||
p_sbc->arg |= (1 << 31);
|
||||
p_sbc->flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
|
||||
p_mrq->sbc = p_sbc;
|
||||
}
|
||||
#endif
|
||||
@@ -792,7 +794,8 @@ 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);
|
||||
aml_mmc_set_blockcount(&mrq, &sbc,
|
||||
idata->ic.write_flag & (1 << 31));
|
||||
#else
|
||||
err = mmc_set_blockcount(card, data.blocks,
|
||||
idata->ic.write_flag & (1 << 31));
|
||||
@@ -800,7 +803,6 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
|
||||
return err;
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) &&
|
||||
(cmd.opcode == MMC_SWITCH)) {
|
||||
err = ioctl_do_sanitize(card);
|
||||
|
||||
Reference in New Issue
Block a user