Message ID | 20250224045918.3321394-1-guan.wang.jy@renesas.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mmc: block: add reset workaround for partition switch failures | expand |
Hi, > Some eMMC devices (e.g., BGSD4R and AIM20F) may enter an unresponsive > state > after encountering CRC errors during RPMB writes (CMD25). This prevents the > device from switching back to the main partition via CMD6, blocking further > I/O operations. Different cards on the same platform? Can you share which platform, and few lines from the log supporting your analysis? > > The root cause is suspected to be a firmware/hardware issue in specific > eMMC models. A workaround is to perform a hardware reset via > mmc_hw_reset() > when the partition switch fails, followed by a retry. Same fw bug in 2 different products? Why do we need to fix it here? The ioctl will eventually return an error, and reset is needed anyway. If the eMMC is the primary storage, the platform is rebooting without being aware what went wrong. Thanks, Avri > > Add a workaround that: > 1. If initial partition switch fails after rpmb access > 2. Performs mmc card reset using mmc_hw_reset() > 3. Retries switching to main partition > This helps resolve cases where the device becomes unresponsive after > RPMB operations. > > Signed-off-by: Guan Wang <guan.wang.jy@renesas.com> > --- > drivers/mmc/core/block.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index 4830628510e6..29388786624c 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -1174,8 +1174,24 @@ static void mmc_blk_issue_drv_op(struct > mmc_queue *mq, struct request *req) > break; > } > /* Always switch back to main area after RPMB access */ > - if (rpmb_ioctl) > - mmc_blk_part_switch(card, 0); > + if (rpmb_ioctl) { > + if (mmc_blk_part_switch(card, 0)) { > + pr_warn("%s: failed to switch back to main > area, will reset and switch again\n", > + md->disk->disk_name); > + > + /* > + * Reset eMMC device if partition switch fails. > + * Some eMMC devices may get stuck by write > CRC error in RPMB, > + * preventing switch back to main partition. > This workaround > + * helps recover from this error state. > + */ > + mmc_hw_reset(card); > + > + if (mmc_blk_part_switch(card, 0)) > + pr_err("%s: failed to switch back to > main area even after reset\n", > + md->disk->disk_name); > + } > + } > else if (card->reenable_cmdq && !card->ext_csd.cmdq_en) > mmc_cmdq_enable(card); > break; > -- > 2.25.1
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 4830628510e6..29388786624c 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1174,8 +1174,24 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req) break; } /* Always switch back to main area after RPMB access */ - if (rpmb_ioctl) - mmc_blk_part_switch(card, 0); + if (rpmb_ioctl) { + if (mmc_blk_part_switch(card, 0)) { + pr_warn("%s: failed to switch back to main area, will reset and switch again\n", + md->disk->disk_name); + + /* + * Reset eMMC device if partition switch fails. + * Some eMMC devices may get stuck by write CRC error in RPMB, + * preventing switch back to main partition. This workaround + * helps recover from this error state. + */ + mmc_hw_reset(card); + + if (mmc_blk_part_switch(card, 0)) + pr_err("%s: failed to switch back to main area even after reset\n", + md->disk->disk_name); + } + } else if (card->reenable_cmdq && !card->ext_csd.cmdq_en) mmc_cmdq_enable(card); break;
Some eMMC devices (e.g., BGSD4R and AIM20F) may enter an unresponsive state after encountering CRC errors during RPMB writes (CMD25). This prevents the device from switching back to the main partition via CMD6, blocking further I/O operations. The root cause is suspected to be a firmware/hardware issue in specific eMMC models. A workaround is to perform a hardware reset via mmc_hw_reset() when the partition switch fails, followed by a retry. Add a workaround that: 1. If initial partition switch fails after rpmb access 2. Performs mmc card reset using mmc_hw_reset() 3. Retries switching to main partition This helps resolve cases where the device becomes unresponsive after RPMB operations. Signed-off-by: Guan Wang <guan.wang.jy@renesas.com> --- drivers/mmc/core/block.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)