diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index c09739c946f..08adfee19e7 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -1047,7 +1047,7 @@ static int mmcsd_switch(FAR struct mmcsd_state_s *priv, uint32_t arg) * CMD6(SWITCH) to set the PARTITION_ACCESS bits in the EXT_CSD * register, byte[179].After that, master can use the Multiple Block * read and write commands (CMD23, CMD18 and CMD25) to access the - * RPMB partition. + * specified partition. * PARTITION_CONFIG[179](see 7.4.69) * Bit[2:0] : PARTITION_ACCESS (before BOOT_PARTITION_ACCESS) * User selects partitions to access: @@ -1073,7 +1073,17 @@ static int mmcsd_switch(FAR struct mmcsd_state_s *priv, uint32_t arg) * [2:0] Cmd Set */ + int ret; + + ret = mmcsd_transferready(priv); + if (ret != OK) + { + ferr("ERROR: Card not ready: %d\n", ret); + return ret; + } + mmcsd_sendcmdpoll(priv, MMCSD_CMD6, arg); + priv->wrbusy = true; return mmcsd_recv_r1(priv, MMCSD_CMD6); }