Commit a04e6bae authored by Wolfram Sang's avatar Wolfram Sang Committed by Ulf Hansson

mmc: core: check also R1 response for stop commands

To detect errors like ECC errors, we must parse the R1 response bits. Introduce
a helper function to also set the error value of a command when R1 error bits
are set. Add ECC error to list of flags checked. Use the new helper for the
stop command to call mmc_blk_recovery when detecting ECC errors which are only
flagged on the next command after multiblock.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 0796e439
...@@ -1359,9 +1359,18 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq, ...@@ -1359,9 +1359,18 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq,
R1_ADDRESS_ERROR | /* Misaligned address */ \ R1_ADDRESS_ERROR | /* Misaligned address */ \
R1_BLOCK_LEN_ERROR | /* Transferred block length incorrect */\ R1_BLOCK_LEN_ERROR | /* Transferred block length incorrect */\
R1_WP_VIOLATION | /* Tried to write to protected block */ \ R1_WP_VIOLATION | /* Tried to write to protected block */ \
R1_CARD_ECC_FAILED | /* Card ECC failed */ \
R1_CC_ERROR | /* Card controller error */ \ R1_CC_ERROR | /* Card controller error */ \
R1_ERROR) /* General/unknown error */ R1_ERROR) /* General/unknown error */
static bool mmc_blk_has_cmd_err(struct mmc_command *cmd)
{
if (!cmd->error && cmd->resp[0] & CMD_ERRORS)
cmd->error = -EIO;
return cmd->error;
}
static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card, static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card,
struct mmc_async_req *areq) struct mmc_async_req *areq)
{ {
...@@ -1383,7 +1392,7 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card, ...@@ -1383,7 +1392,7 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card,
* stop.error indicates a problem with the stop command. Data * stop.error indicates a problem with the stop command. Data
* may have been transferred, or may still be transferring. * may have been transferred, or may still be transferring.
*/ */
if (brq->sbc.error || brq->cmd.error || brq->stop.error || if (brq->sbc.error || brq->cmd.error || mmc_blk_has_cmd_err(&brq->stop) ||
brq->data.error) { brq->data.error) {
switch (mmc_blk_cmd_recovery(card, req, brq, &ecc_err, &gen_err)) { switch (mmc_blk_cmd_recovery(card, req, brq, &ecc_err, &gen_err)) {
case ERR_RETRY: case ERR_RETRY:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment