1
0
Fork 0
forked from nuttx/nuttx-update

emmc: add get emmc cid register interface.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26 2023-09-22 22:43:27 +08:00 committed by Xiang Xiao
parent b172de378d
commit 50cad1536d

View file

@ -3161,46 +3161,52 @@ static int mmcsd_general_cmd_read(FAR struct mmcsd_state_s *priv,
static int mmcsd_iocmd(FAR struct mmcsd_state_s *priv,
FAR struct mmc_ioc_cmd *ic_ptr)
{
uint32_t opcode;
int ret;
DEBUGASSERT(priv != NULL && ic_ptr != NULL);
if (!ic_ptr->is_acmd)
opcode = ic_ptr->opcode & MMCSD_CMDIDX_MASK;
switch (opcode)
{
uint32_t opcode = ic_ptr->opcode & MMCSD_CMDIDX_MASK;
switch (opcode)
{
case MMCSD_CMDIDX56: /* support general commands */
case MMCSD_CMDIDX2:
{
memcpy((FAR void *)(uintptr_t)ic_ptr->data_ptr,
priv->cid, sizeof(priv->cid));
}
break;
case MMCSD_CMDIDX56: /* support general commands */
{
if (ic_ptr->write_flag)
{
if (ic_ptr->write_flag)
ret = mmcsd_general_cmd_write(priv,
(FAR uint8_t *)(uintptr_t)(ic_ptr->data_ptr),
ic_ptr->arg);
if (ret != OK)
{
ret = mmcsd_general_cmd_write(priv,
(FAR uint8_t *)(uintptr_t)(ic_ptr->data_ptr),
ic_ptr->arg);
if (ret != OK)
{
ferr("mmcsd_iocmd MMCSD_CMDIDX56 write failed.\n");
return ret;
}
}
else
{
ret = mmcsd_general_cmd_read(priv,
(FAR uint8_t *)(uintptr_t)(ic_ptr->data_ptr),
ic_ptr->arg);
if (ret != OK)
{
ferr("mmcsd_iocmd MMCSD_CMDIDX56 read failed.\n");
return ret;
}
ferr("mmcsd_iocmd MMCSD_CMDIDX56 write failed.\n");
return ret;
}
}
break;
default:
ferr("mmcsd_iocmd opcode unsupported.\n");
return -EINVAL;
}
else
{
ret = mmcsd_general_cmd_read(priv,
(FAR uint8_t *)(uintptr_t)(ic_ptr->data_ptr),
ic_ptr->arg);
if (ret != OK)
{
ferr("mmcsd_iocmd MMCSD_CMDIDX56 read failed.\n");
return ret;
}
}
}
break;
default:
{
ferr("mmcsd_iocmd opcode unsupported.\n");
return -EINVAL;
}
break;
}
return OK;