Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255185
b: refs/heads/master
c: 4c2b8f2
h: refs/heads/master
i:
  255183: c38cef0
v: v3
  • Loading branch information
Russell King - ARM Linux authored and Chris Ball committed Jul 20, 2011
1 parent 03ed2ec commit 4f3f946
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a01f3ccf845067de32189f8a8e85d22c381f93b9
refs/heads/master: 4c2b8f26eb8b54203e0e7834e0f7a11a7ae15ef1
26 changes: 25 additions & 1 deletion trunk/drivers/mmc/card/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,14 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq,
}
}

#define CMD_ERRORS \
(R1_OUT_OF_RANGE | /* Command argument out of range */ \
R1_ADDRESS_ERROR | /* Misaligned address */ \
R1_BLOCK_LEN_ERROR | /* Transferred block length incorrect */\
R1_WP_VIOLATION | /* Tried to write to protected block */ \
R1_CC_ERROR | /* Card controller error */ \
R1_ERROR) /* General/unknown error */

static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
{
struct mmc_blk_data *md = mq->data;
Expand Down Expand Up @@ -967,6 +975,22 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
}
}

/*
* Check for errors relating to the execution of the
* initial command - such as address errors. No data
* has been transferred.
*/
if (brq.cmd.resp[0] & CMD_ERRORS) {
pr_err("%s: r/w command failed, status = %#x\n",
req->rq_disk->disk_name, brq.cmd.resp[0]);
goto cmd_abort;
}

/*
* Everything else is either success, or a data error of some
* kind. If it was a write, we may have transitioned to
* program mode, which we have to wait for it to complete.
*/
if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
u32 status;
do {
Expand All @@ -986,7 +1010,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
}

if (brq.data.error) {
pr_err("%s: error %d transferring data, sector %u nr %u, cmd response %#x card status %#x\n",
pr_err("%s: error %d transferring data, sector %u, nr %u, cmd response %#x, card status %#x\n",
req->rq_disk->disk_name, brq.data.error,
(unsigned)blk_rq_pos(req),
(unsigned)blk_rq_sectors(req),
Expand Down

0 comments on commit 4f3f946

Please sign in to comment.