diff options
-rw-r--r-- | drivers/mmc/card/block.c | 4 | ||||
-rw-r--r-- | drivers/mmc/core/core.c | 4 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 36 | ||||
-rw-r--r-- | drivers/mmc/core/mmc_ops.c | 34 | ||||
-rw-r--r-- | drivers/mmc/core/sd.c | 56 | ||||
-rw-r--r-- | drivers/mmc/core/sd_ops.c | 46 | ||||
-rw-r--r-- | drivers/mmc/host/at91_mci.c | 12 | ||||
-rw-r--r-- | drivers/mmc/host/au1xmmc.c | 32 | ||||
-rw-r--r-- | drivers/mmc/host/imxmmc.c | 14 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.c | 12 | ||||
-rw-r--r-- | drivers/mmc/host/omap.c | 12 | ||||
-rw-r--r-- | drivers/mmc/host/pxamci.c | 12 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.c | 51 | ||||
-rw-r--r-- | drivers/mmc/host/tifm_sd.c | 20 | ||||
-rw-r--r-- | drivers/mmc/host/wbsd.c | 41 | ||||
-rw-r--r-- | include/linux/mmc/core.h | 19 |
16 files changed, 203 insertions, 202 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 93fe2e5dd616..0da341acf32b 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -154,7 +154,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
154 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | 154 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; |
155 | 155 | ||
156 | err = mmc_wait_for_cmd(card->host, &cmd, 0); | 156 | err = mmc_wait_for_cmd(card->host, &cmd, 0); |
157 | if ((err != MMC_ERR_NONE) || !(cmd.resp[0] & R1_APP_CMD)) | 157 | if (err || !(cmd.resp[0] & R1_APP_CMD)) |
158 | return (u32)-1; | 158 | return (u32)-1; |
159 | 159 | ||
160 | memset(&cmd, 0, sizeof(struct mmc_command)); | 160 | memset(&cmd, 0, sizeof(struct mmc_command)); |
@@ -192,7 +192,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
192 | 192 | ||
193 | mmc_wait_for_req(card->host, &mrq); | 193 | mmc_wait_for_req(card->host, &mrq); |
194 | 194 | ||
195 | if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE) | 195 | if (cmd.error || data.error) |
196 | return (u32)-1; | 196 | return (u32)-1; |
197 | 197 | ||
198 | blocks = ntohl(blocks); | 198 | blocks = ntohl(blocks); |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index bfd2ae5bd669..63b67296e92d 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -598,7 +598,7 @@ void mmc_rescan(struct work_struct *work) | |||
598 | mmc_send_if_cond(host, host->ocr_avail); | 598 | mmc_send_if_cond(host, host->ocr_avail); |
599 | 599 | ||
600 | err = mmc_send_app_op_cond(host, 0, &ocr); | 600 | err = mmc_send_app_op_cond(host, 0, &ocr); |
601 | if (err == MMC_ERR_NONE) { | 601 | if (!err) { |
602 | if (mmc_attach_sd(host, ocr)) | 602 | if (mmc_attach_sd(host, ocr)) |
603 | mmc_power_off(host); | 603 | mmc_power_off(host); |
604 | } else { | 604 | } else { |
@@ -607,7 +607,7 @@ void mmc_rescan(struct work_struct *work) | |||
607 | * searching for MMC cards. | 607 | * searching for MMC cards. |
608 | */ | 608 | */ |
609 | err = mmc_send_op_cond(host, 0, &ocr); | 609 | err = mmc_send_op_cond(host, 0, &ocr); |
610 | if (err == MMC_ERR_NONE) { | 610 | if (!err) { |
611 | if (mmc_attach_mmc(host, ocr)) | 611 | if (mmc_attach_mmc(host, ocr)) |
612 | mmc_power_off(host); | 612 | mmc_power_off(host); |
613 | } else { | 613 | } else { |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 21d7f48e1d4e..fe483d5af744 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -164,10 +164,10 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
164 | 164 | ||
165 | BUG_ON(!card); | 165 | BUG_ON(!card); |
166 | 166 | ||
167 | err = MMC_ERR_FAILED; | 167 | err = -EIO; |
168 | 168 | ||
169 | if (card->csd.mmca_vsn < CSD_SPEC_VER_4) | 169 | if (card->csd.mmca_vsn < CSD_SPEC_VER_4) |
170 | return MMC_ERR_NONE; | 170 | return 0; |
171 | 171 | ||
172 | /* | 172 | /* |
173 | * As the ext_csd is so large and mostly unused, we don't store the | 173 | * As the ext_csd is so large and mostly unused, we don't store the |
@@ -178,11 +178,11 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
178 | printk(KERN_ERR "%s: could not allocate a buffer to " | 178 | printk(KERN_ERR "%s: could not allocate a buffer to " |
179 | "receive the ext_csd. mmc v4 cards will be " | 179 | "receive the ext_csd. mmc v4 cards will be " |
180 | "treated as v3.\n", mmc_hostname(card->host)); | 180 | "treated as v3.\n", mmc_hostname(card->host)); |
181 | return MMC_ERR_FAILED; | 181 | return -ENOMEM; |
182 | } | 182 | } |
183 | 183 | ||
184 | err = mmc_send_ext_csd(card, ext_csd); | 184 | err = mmc_send_ext_csd(card, ext_csd); |
185 | if (err != MMC_ERR_NONE) { | 185 | if (err) { |
186 | /* | 186 | /* |
187 | * High capacity cards should have this "magic" size | 187 | * High capacity cards should have this "magic" size |
188 | * stored in their CSD. | 188 | * stored in their CSD. |
@@ -197,7 +197,7 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
197 | "EXT_CSD, performance might " | 197 | "EXT_CSD, performance might " |
198 | "suffer.\n", | 198 | "suffer.\n", |
199 | mmc_hostname(card->host)); | 199 | mmc_hostname(card->host)); |
200 | err = MMC_ERR_NONE; | 200 | err = 0; |
201 | } | 201 | } |
202 | goto out; | 202 | goto out; |
203 | } | 203 | } |
@@ -258,14 +258,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
258 | 258 | ||
259 | /* The extra bit indicates that we support high capacity */ | 259 | /* The extra bit indicates that we support high capacity */ |
260 | err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); | 260 | err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); |
261 | if (err != MMC_ERR_NONE) | 261 | if (err) |
262 | goto err; | 262 | goto err; |
263 | 263 | ||
264 | /* | 264 | /* |
265 | * Fetch CID from card. | 265 | * Fetch CID from card. |
266 | */ | 266 | */ |
267 | err = mmc_all_send_cid(host, cid); | 267 | err = mmc_all_send_cid(host, cid); |
268 | if (err != MMC_ERR_NONE) | 268 | if (err) |
269 | goto err; | 269 | goto err; |
270 | 270 | ||
271 | if (oldcard) { | 271 | if (oldcard) { |
@@ -290,7 +290,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
290 | * Set card RCA. | 290 | * Set card RCA. |
291 | */ | 291 | */ |
292 | err = mmc_set_relative_addr(card); | 292 | err = mmc_set_relative_addr(card); |
293 | if (err != MMC_ERR_NONE) | 293 | if (err) |
294 | goto free_card; | 294 | goto free_card; |
295 | 295 | ||
296 | mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); | 296 | mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); |
@@ -300,7 +300,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
300 | * Fetch CSD from card. | 300 | * Fetch CSD from card. |
301 | */ | 301 | */ |
302 | err = mmc_send_csd(card, card->raw_csd); | 302 | err = mmc_send_csd(card, card->raw_csd); |
303 | if (err != MMC_ERR_NONE) | 303 | if (err) |
304 | goto free_card; | 304 | goto free_card; |
305 | 305 | ||
306 | err = mmc_decode_csd(card); | 306 | err = mmc_decode_csd(card); |
@@ -315,7 +315,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
315 | * Select card, as all following commands rely on that. | 315 | * Select card, as all following commands rely on that. |
316 | */ | 316 | */ |
317 | err = mmc_select_card(card); | 317 | err = mmc_select_card(card); |
318 | if (err != MMC_ERR_NONE) | 318 | if (err) |
319 | goto free_card; | 319 | goto free_card; |
320 | 320 | ||
321 | if (!oldcard) { | 321 | if (!oldcard) { |
@@ -323,7 +323,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
323 | * Fetch and process extened CSD. | 323 | * Fetch and process extened CSD. |
324 | */ | 324 | */ |
325 | err = mmc_read_ext_csd(card); | 325 | err = mmc_read_ext_csd(card); |
326 | if (err != MMC_ERR_NONE) | 326 | if (err) |
327 | goto free_card; | 327 | goto free_card; |
328 | } | 328 | } |
329 | 329 | ||
@@ -334,7 +334,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
334 | (host->caps & MMC_CAP_MMC_HIGHSPEED)) { | 334 | (host->caps & MMC_CAP_MMC_HIGHSPEED)) { |
335 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 335 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
336 | EXT_CSD_HS_TIMING, 1); | 336 | EXT_CSD_HS_TIMING, 1); |
337 | if (err != MMC_ERR_NONE) | 337 | if (err) |
338 | goto free_card; | 338 | goto free_card; |
339 | 339 | ||
340 | mmc_card_set_highspeed(card); | 340 | mmc_card_set_highspeed(card); |
@@ -363,7 +363,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
363 | (host->caps & MMC_CAP_4_BIT_DATA)) { | 363 | (host->caps & MMC_CAP_4_BIT_DATA)) { |
364 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 364 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
365 | EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4); | 365 | EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4); |
366 | if (err != MMC_ERR_NONE) | 366 | if (err) |
367 | goto free_card; | 367 | goto free_card; |
368 | 368 | ||
369 | mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); | 369 | mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); |
@@ -372,14 +372,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
372 | if (!oldcard) | 372 | if (!oldcard) |
373 | host->card = card; | 373 | host->card = card; |
374 | 374 | ||
375 | return MMC_ERR_NONE; | 375 | return 0; |
376 | 376 | ||
377 | free_card: | 377 | free_card: |
378 | if (!oldcard) | 378 | if (!oldcard) |
379 | mmc_remove_card(card); | 379 | mmc_remove_card(card); |
380 | err: | 380 | err: |
381 | 381 | ||
382 | return MMC_ERR_FAILED; | 382 | return -EIO; |
383 | } | 383 | } |
384 | 384 | ||
385 | /* | 385 | /* |
@@ -413,7 +413,7 @@ static void mmc_detect(struct mmc_host *host) | |||
413 | 413 | ||
414 | mmc_release_host(host); | 414 | mmc_release_host(host); |
415 | 415 | ||
416 | if (err != MMC_ERR_NONE) { | 416 | if (err) { |
417 | mmc_remove(host); | 417 | mmc_remove(host); |
418 | 418 | ||
419 | mmc_claim_host(host); | 419 | mmc_claim_host(host); |
@@ -502,7 +502,7 @@ static void mmc_resume(struct mmc_host *host) | |||
502 | err = mmc_init_card(host, host->ocr, host->card); | 502 | err = mmc_init_card(host, host->ocr, host->card); |
503 | mmc_release_host(host); | 503 | mmc_release_host(host); |
504 | 504 | ||
505 | if (err != MMC_ERR_NONE) { | 505 | if (err) { |
506 | mmc_remove(host); | 506 | mmc_remove(host); |
507 | 507 | ||
508 | mmc_claim_host(host); | 508 | mmc_claim_host(host); |
@@ -565,7 +565,7 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr) | |||
565 | * Detect and init the card. | 565 | * Detect and init the card. |
566 | */ | 566 | */ |
567 | err = mmc_init_card(host, host->ocr, NULL); | 567 | err = mmc_init_card(host, host->ocr, NULL); |
568 | if (err != MMC_ERR_NONE) | 568 | if (err) |
569 | goto err; | 569 | goto err; |
570 | 570 | ||
571 | mmc_release_host(host); | 571 | mmc_release_host(host); |
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 913e75f00843..15cd575effaa 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c | |||
@@ -40,10 +40,10 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); | 42 | err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); |
43 | if (err != MMC_ERR_NONE) | 43 | if (err) |
44 | return err; | 44 | return err; |
45 | 45 | ||
46 | return MMC_ERR_NONE; | 46 | return 0; |
47 | } | 47 | } |
48 | 48 | ||
49 | int mmc_select_card(struct mmc_card *card) | 49 | int mmc_select_card(struct mmc_card *card) |
@@ -99,13 +99,13 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) | |||
99 | 99 | ||
100 | for (i = 100; i; i--) { | 100 | for (i = 100; i; i--) { |
101 | err = mmc_wait_for_cmd(host, &cmd, 0); | 101 | err = mmc_wait_for_cmd(host, &cmd, 0); |
102 | if (err != MMC_ERR_NONE) | 102 | if (err) |
103 | break; | 103 | break; |
104 | 104 | ||
105 | if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0) | 105 | if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0) |
106 | break; | 106 | break; |
107 | 107 | ||
108 | err = MMC_ERR_TIMEOUT; | 108 | err = -ETIMEDOUT; |
109 | 109 | ||
110 | mmc_delay(10); | 110 | mmc_delay(10); |
111 | } | 111 | } |
@@ -131,12 +131,12 @@ int mmc_all_send_cid(struct mmc_host *host, u32 *cid) | |||
131 | cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR; | 131 | cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR; |
132 | 132 | ||
133 | err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); | 133 | err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); |
134 | if (err != MMC_ERR_NONE) | 134 | if (err) |
135 | return err; | 135 | return err; |
136 | 136 | ||
137 | memcpy(cid, cmd.resp, sizeof(u32) * 4); | 137 | memcpy(cid, cmd.resp, sizeof(u32) * 4); |
138 | 138 | ||
139 | return MMC_ERR_NONE; | 139 | return 0; |
140 | } | 140 | } |
141 | 141 | ||
142 | int mmc_set_relative_addr(struct mmc_card *card) | 142 | int mmc_set_relative_addr(struct mmc_card *card) |
@@ -154,10 +154,10 @@ int mmc_set_relative_addr(struct mmc_card *card) | |||
154 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | 154 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; |
155 | 155 | ||
156 | err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); | 156 | err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); |
157 | if (err != MMC_ERR_NONE) | 157 | if (err) |
158 | return err; | 158 | return err; |
159 | 159 | ||
160 | return MMC_ERR_NONE; | 160 | return 0; |
161 | } | 161 | } |
162 | 162 | ||
163 | int mmc_send_csd(struct mmc_card *card, u32 *csd) | 163 | int mmc_send_csd(struct mmc_card *card, u32 *csd) |
@@ -176,12 +176,12 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd) | |||
176 | cmd.flags = MMC_RSP_R2 | MMC_CMD_AC; | 176 | cmd.flags = MMC_RSP_R2 | MMC_CMD_AC; |
177 | 177 | ||
178 | err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); | 178 | err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); |
179 | if (err != MMC_ERR_NONE) | 179 | if (err) |
180 | return err; | 180 | return err; |
181 | 181 | ||
182 | memcpy(csd, cmd.resp, sizeof(u32) * 4); | 182 | memcpy(csd, cmd.resp, sizeof(u32) * 4); |
183 | 183 | ||
184 | return MMC_ERR_NONE; | 184 | return 0; |
185 | } | 185 | } |
186 | 186 | ||
187 | int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) | 187 | int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) |
@@ -218,12 +218,12 @@ int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) | |||
218 | 218 | ||
219 | mmc_wait_for_req(card->host, &mrq); | 219 | mmc_wait_for_req(card->host, &mrq); |
220 | 220 | ||
221 | if (cmd.error != MMC_ERR_NONE) | 221 | if (cmd.error) |
222 | return cmd.error; | 222 | return cmd.error; |
223 | if (data.error != MMC_ERR_NONE) | 223 | if (data.error) |
224 | return data.error; | 224 | return data.error; |
225 | 225 | ||
226 | return MMC_ERR_NONE; | 226 | return 0; |
227 | } | 227 | } |
228 | 228 | ||
229 | int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value) | 229 | int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value) |
@@ -244,10 +244,10 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value) | |||
244 | cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; | 244 | cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; |
245 | 245 | ||
246 | err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); | 246 | err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); |
247 | if (err != MMC_ERR_NONE) | 247 | if (err) |
248 | return err; | 248 | return err; |
249 | 249 | ||
250 | return MMC_ERR_NONE; | 250 | return 0; |
251 | } | 251 | } |
252 | 252 | ||
253 | int mmc_send_status(struct mmc_card *card, u32 *status) | 253 | int mmc_send_status(struct mmc_card *card, u32 *status) |
@@ -265,12 +265,12 @@ int mmc_send_status(struct mmc_card *card, u32 *status) | |||
265 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | 265 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; |
266 | 266 | ||
267 | err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); | 267 | err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); |
268 | if (err != MMC_ERR_NONE) | 268 | if (err) |
269 | return err; | 269 | return err; |
270 | 270 | ||
271 | if (status) | 271 | if (status) |
272 | *status = cmd.resp[0]; | 272 | *status = cmd.resp[0]; |
273 | 273 | ||
274 | return MMC_ERR_NONE; | 274 | return 0; |
275 | } | 275 | } |
276 | 276 | ||
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 1edc62b1e5c6..00895c99d9bb 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -193,30 +193,30 @@ static int mmc_read_switch(struct mmc_card *card) | |||
193 | u8 *status; | 193 | u8 *status; |
194 | 194 | ||
195 | if (card->scr.sda_vsn < SCR_SPEC_VER_1) | 195 | if (card->scr.sda_vsn < SCR_SPEC_VER_1) |
196 | return MMC_ERR_NONE; | 196 | return 0; |
197 | 197 | ||
198 | if (!(card->csd.cmdclass & CCC_SWITCH)) { | 198 | if (!(card->csd.cmdclass & CCC_SWITCH)) { |
199 | printk(KERN_WARNING "%s: card lacks mandatory switch " | 199 | printk(KERN_WARNING "%s: card lacks mandatory switch " |
200 | "function, performance might suffer.\n", | 200 | "function, performance might suffer.\n", |
201 | mmc_hostname(card->host)); | 201 | mmc_hostname(card->host)); |
202 | return MMC_ERR_NONE; | 202 | return 0; |
203 | } | 203 | } |
204 | 204 | ||
205 | err = MMC_ERR_FAILED; | 205 | err = -EIO; |
206 | 206 | ||
207 | status = kmalloc(64, GFP_KERNEL); | 207 | status = kmalloc(64, GFP_KERNEL); |
208 | if (!status) { | 208 | if (!status) { |
209 | printk(KERN_ERR "%s: could not allocate a buffer for " | 209 | printk(KERN_ERR "%s: could not allocate a buffer for " |
210 | "switch capabilities.\n", mmc_hostname(card->host)); | 210 | "switch capabilities.\n", mmc_hostname(card->host)); |
211 | return err; | 211 | return -ENOMEM; |
212 | } | 212 | } |
213 | 213 | ||
214 | err = mmc_sd_switch(card, 0, 0, 1, status); | 214 | err = mmc_sd_switch(card, 0, 0, 1, status); |
215 | if (err != MMC_ERR_NONE) { | 215 | if (err) { |
216 | printk(KERN_WARNING "%s: problem reading switch " | 216 | printk(KERN_WARNING "%s: problem reading switch " |
217 | "capabilities, performance might suffer.\n", | 217 | "capabilities, performance might suffer.\n", |
218 | mmc_hostname(card->host)); | 218 | mmc_hostname(card->host)); |
219 | err = MMC_ERR_NONE; | 219 | err = 0; |
220 | goto out; | 220 | goto out; |
221 | } | 221 | } |
222 | 222 | ||
@@ -238,28 +238,28 @@ static int mmc_switch_hs(struct mmc_card *card) | |||
238 | u8 *status; | 238 | u8 *status; |
239 | 239 | ||
240 | if (card->scr.sda_vsn < SCR_SPEC_VER_1) | 240 | if (card->scr.sda_vsn < SCR_SPEC_VER_1) |
241 | return MMC_ERR_NONE; | 241 | return 0; |
242 | 242 | ||
243 | if (!(card->csd.cmdclass & CCC_SWITCH)) | 243 | if (!(card->csd.cmdclass & CCC_SWITCH)) |
244 | return MMC_ERR_NONE; | 244 | return 0; |
245 | 245 | ||
246 | if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) | 246 | if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) |
247 | return MMC_ERR_NONE; | 247 | return 0; |
248 | 248 | ||
249 | if (card->sw_caps.hs_max_dtr == 0) | 249 | if (card->sw_caps.hs_max_dtr == 0) |
250 | return MMC_ERR_NONE; | 250 | return 0; |
251 | 251 | ||
252 | err = MMC_ERR_FAILED; | 252 | err = -EIO; |
253 | 253 | ||
254 | status = kmalloc(64, GFP_KERNEL); | 254 | status = kmalloc(64, GFP_KERNEL); |
255 | if (!status) { | 255 | if (!status) { |
256 | printk(KERN_ERR "%s: could not allocate a buffer for " | 256 | printk(KERN_ERR "%s: could not allocate a buffer for " |
257 | "switch capabilities.\n", mmc_hostname(card->host)); | 257 | "switch capabilities.\n", mmc_hostname(card->host)); |
258 | return err; | 258 | return -ENOMEM; |
259 | } | 259 | } |
260 | 260 | ||
261 | err = mmc_sd_switch(card, 1, 0, 1, status); | 261 | err = mmc_sd_switch(card, 1, 0, 1, status); |
262 | if (err != MMC_ERR_NONE) | 262 | if (err) |
263 | goto out; | 263 | goto out; |
264 | 264 | ||
265 | if ((status[16] & 0xF) != 1) { | 265 | if ((status[16] & 0xF) != 1) { |
@@ -309,18 +309,18 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
309 | * block-addressed SDHC cards. | 309 | * block-addressed SDHC cards. |
310 | */ | 310 | */ |
311 | err = mmc_send_if_cond(host, ocr); | 311 | err = mmc_send_if_cond(host, ocr); |
312 | if (err == MMC_ERR_NONE) | 312 | if (!err) |
313 | ocr |= 1 << 30; | 313 | ocr |= 1 << 30; |
314 | 314 | ||
315 | err = mmc_send_app_op_cond(host, ocr, NULL); | 315 | err = mmc_send_app_op_cond(host, ocr, NULL); |
316 | if (err != MMC_ERR_NONE) | 316 | if (err) |
317 | goto err; | 317 | goto err; |
318 | 318 | ||
319 | /* | 319 | /* |
320 | * Fetch CID from card. | 320 | * Fetch CID from card. |
321 | */ | 321 | */ |
322 | err = mmc_all_send_cid(host, cid); | 322 | err = mmc_all_send_cid(host, cid); |
323 | if (err != MMC_ERR_NONE) | 323 | if (err) |
324 | goto err; | 324 | goto err; |
325 | 325 | ||
326 | if (oldcard) { | 326 | if (oldcard) { |
@@ -344,7 +344,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
344 | * Set card RCA. | 344 | * Set card RCA. |
345 | */ | 345 | */ |
346 | err = mmc_send_relative_addr(host, &card->rca); | 346 | err = mmc_send_relative_addr(host, &card->rca); |
347 | if (err != MMC_ERR_NONE) | 347 | if (err) |
348 | goto free_card; | 348 | goto free_card; |
349 | 349 | ||
350 | mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); | 350 | mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); |
@@ -354,7 +354,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
354 | * Fetch CSD from card. | 354 | * Fetch CSD from card. |
355 | */ | 355 | */ |
356 | err = mmc_send_csd(card, card->raw_csd); | 356 | err = mmc_send_csd(card, card->raw_csd); |
357 | if (err != MMC_ERR_NONE) | 357 | if (err) |
358 | goto free_card; | 358 | goto free_card; |
359 | 359 | ||
360 | err = mmc_decode_csd(card); | 360 | err = mmc_decode_csd(card); |
@@ -368,7 +368,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
368 | * Select card, as all following commands rely on that. | 368 | * Select card, as all following commands rely on that. |
369 | */ | 369 | */ |
370 | err = mmc_select_card(card); | 370 | err = mmc_select_card(card); |
371 | if (err != MMC_ERR_NONE) | 371 | if (err) |
372 | goto free_card; | 372 | goto free_card; |
373 | 373 | ||
374 | if (!oldcard) { | 374 | if (!oldcard) { |
@@ -376,7 +376,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
376 | * Fetch SCR from card. | 376 | * Fetch SCR from card. |
377 | */ | 377 | */ |
378 | err = mmc_app_send_scr(card, card->raw_scr); | 378 | err = mmc_app_send_scr(card, card->raw_scr); |
379 | if (err != MMC_ERR_NONE) | 379 | if (err) |
380 | goto free_card; | 380 | goto free_card; |
381 | 381 | ||
382 | err = mmc_decode_scr(card); | 382 | err = mmc_decode_scr(card); |
@@ -387,7 +387,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
387 | * Fetch switch information from card. | 387 | * Fetch switch information from card. |
388 | */ | 388 | */ |
389 | err = mmc_read_switch(card); | 389 | err = mmc_read_switch(card); |
390 | if (err != MMC_ERR_NONE) | 390 | if (err) |
391 | goto free_card; | 391 | goto free_card; |
392 | } | 392 | } |
393 | 393 | ||
@@ -395,7 +395,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
395 | * Attempt to change to high-speed (if supported) | 395 | * Attempt to change to high-speed (if supported) |
396 | */ | 396 | */ |
397 | err = mmc_switch_hs(card); | 397 | err = mmc_switch_hs(card); |
398 | if (err != MMC_ERR_NONE) | 398 | if (err) |
399 | goto free_card; | 399 | goto free_card; |
400 | 400 | ||
401 | /* | 401 | /* |
@@ -418,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
418 | if ((host->caps & MMC_CAP_4_BIT_DATA) && | 418 | if ((host->caps & MMC_CAP_4_BIT_DATA) && |
419 | (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) { | 419 | (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) { |
420 | err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); | 420 | err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); |
421 | if (err != MMC_ERR_NONE) | 421 | if (err) |
422 | goto free_card; | 422 | goto free_card; |
423 | 423 | ||
424 | mmc_set_bus_width(host, MMC_BUS_WIDTH_4); | 424 | mmc_set_bus_width(host, MMC_BUS_WIDTH_4); |
@@ -442,14 +442,14 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
442 | if (!oldcard) | 442 | if (!oldcard) |
443 | host->card = card; | 443 | host->card = card; |
444 | 444 | ||
445 | return MMC_ERR_NONE; | 445 | return 0; |
446 | 446 | ||
447 | free_card: | 447 | free_card: |
448 | if (!oldcard) | 448 | if (!oldcard) |
449 | mmc_remove_card(card); | 449 | mmc_remove_card(card); |
450 | err: | 450 | err: |
451 | 451 | ||
452 | return MMC_ERR_FAILED; | 452 | return -EIO; |
453 | } | 453 | } |
454 | 454 | ||
455 | /* | 455 | /* |
@@ -483,7 +483,7 @@ static void mmc_sd_detect(struct mmc_host *host) | |||
483 | 483 | ||
484 | mmc_release_host(host); | 484 | mmc_release_host(host); |
485 | 485 | ||
486 | if (err != MMC_ERR_NONE) { | 486 | if (err) { |
487 | mmc_sd_remove(host); | 487 | mmc_sd_remove(host); |
488 | 488 | ||
489 | mmc_claim_host(host); | 489 | mmc_claim_host(host); |
@@ -574,7 +574,7 @@ static void mmc_sd_resume(struct mmc_host *host) | |||
574 | err = mmc_sd_init_card(host, host->ocr, host->card); | 574 | err = mmc_sd_init_card(host, host->ocr, host->card); |
575 | mmc_release_host(host); | 575 | mmc_release_host(host); |
576 | 576 | ||
577 | if (err != MMC_ERR_NONE) { | 577 | if (err) { |
578 | mmc_sd_remove(host); | 578 | mmc_sd_remove(host); |
579 | 579 | ||
580 | mmc_claim_host(host); | 580 | mmc_claim_host(host); |
@@ -644,7 +644,7 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr) | |||
644 | * Detect and init the card. | 644 | * Detect and init the card. |
645 | */ | 645 | */ |
646 | err = mmc_sd_init_card(host, host->ocr, NULL); | 646 | err = mmc_sd_init_card(host, host->ocr, NULL); |
647 | if (err != MMC_ERR_NONE) | 647 | if (err) |
648 | goto err; | 648 | goto err; |
649 | 649 | ||
650 | mmc_release_host(host); | 650 | mmc_release_host(host); |
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index 342f340ebc25..b4d43bd0fedd 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c | |||
@@ -40,14 +40,14 @@ static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | err = mmc_wait_for_cmd(host, &cmd, 0); | 42 | err = mmc_wait_for_cmd(host, &cmd, 0); |
43 | if (err != MMC_ERR_NONE) | 43 | if (err) |
44 | return err; | 44 | return err; |
45 | 45 | ||
46 | /* Check that card supported application commands */ | 46 | /* Check that card supported application commands */ |
47 | if (!(cmd.resp[0] & R1_APP_CMD)) | 47 | if (!(cmd.resp[0] & R1_APP_CMD)) |
48 | return MMC_ERR_FAILED; | 48 | return -EOPNOTSUPP; |
49 | 49 | ||
50 | return MMC_ERR_NONE; | 50 | return 0; |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
@@ -73,7 +73,7 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, | |||
73 | BUG_ON(!cmd); | 73 | BUG_ON(!cmd); |
74 | BUG_ON(retries < 0); | 74 | BUG_ON(retries < 0); |
75 | 75 | ||
76 | err = MMC_ERR_INVALID; | 76 | err = -EIO; |
77 | 77 | ||
78 | /* | 78 | /* |
79 | * We have to resend MMC_APP_CMD for each attempt so | 79 | * We have to resend MMC_APP_CMD for each attempt so |
@@ -83,7 +83,7 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, | |||
83 | memset(&mrq, 0, sizeof(struct mmc_request)); | 83 | memset(&mrq, 0, sizeof(struct mmc_request)); |
84 | 84 | ||
85 | err = mmc_app_cmd(host, card); | 85 | err = mmc_app_cmd(host, card); |
86 | if (err != MMC_ERR_NONE) | 86 | if (err) |
87 | continue; | 87 | continue; |
88 | 88 | ||
89 | memset(&mrq, 0, sizeof(struct mmc_request)); | 89 | memset(&mrq, 0, sizeof(struct mmc_request)); |
@@ -97,7 +97,7 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, | |||
97 | mmc_wait_for_req(host, &mrq); | 97 | mmc_wait_for_req(host, &mrq); |
98 | 98 | ||
99 | err = cmd->error; | 99 | err = cmd->error; |
100 | if (cmd->error == MMC_ERR_NONE) | 100 | if (!cmd->error) |
101 | break; | 101 | break; |
102 | } | 102 | } |
103 | 103 | ||
@@ -127,14 +127,14 @@ int mmc_app_set_bus_width(struct mmc_card *card, int width) | |||
127 | cmd.arg = SD_BUS_WIDTH_4; | 127 | cmd.arg = SD_BUS_WIDTH_4; |
128 | break; | 128 | break; |
129 | default: | 129 | default: |
130 | return MMC_ERR_INVALID; | 130 | return -EINVAL; |
131 | } | 131 | } |
132 | 132 | ||
133 | err = mmc_wait_for_app_cmd(card->host, card, &cmd, MMC_CMD_RETRIES); | 133 | err = mmc_wait_for_app_cmd(card->host, card, &cmd, MMC_CMD_RETRIES); |
134 | if (err != MMC_ERR_NONE) | 134 | if (err) |
135 | return err; | 135 | return err; |
136 | 136 | ||
137 | return MMC_ERR_NONE; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) | 140 | int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) |
@@ -152,13 +152,13 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) | |||
152 | 152 | ||
153 | for (i = 100; i; i--) { | 153 | for (i = 100; i; i--) { |
154 | err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES); | 154 | err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES); |
155 | if (err != MMC_ERR_NONE) | 155 | if (err) |
156 | break; | 156 | break; |
157 | 157 | ||
158 | if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0) | 158 | if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0) |
159 | break; | 159 | break; |
160 | 160 | ||
161 | err = MMC_ERR_TIMEOUT; | 161 | err = -ETIMEDOUT; |
162 | 162 | ||
163 | mmc_delay(10); | 163 | mmc_delay(10); |
164 | } | 164 | } |
@@ -185,13 +185,13 @@ int mmc_send_if_cond(struct mmc_host *host, u32 ocr) | |||
185 | cmd.flags = MMC_RSP_R7 | MMC_CMD_BCR; | 185 | cmd.flags = MMC_RSP_R7 | MMC_CMD_BCR; |
186 | 186 | ||
187 | err = mmc_wait_for_cmd(host, &cmd, 0); | 187 | err = mmc_wait_for_cmd(host, &cmd, 0); |
188 | if (err != MMC_ERR_NONE) | 188 | if (err) |
189 | return err; | 189 | return err; |
190 | 190 | ||
191 | if ((cmd.resp[0] & 0xFF) != test_pattern) | 191 | if ((cmd.resp[0] & 0xFF) != test_pattern) |
192 | return MMC_ERR_FAILED; | 192 | return -EIO; |
193 | 193 | ||
194 | return MMC_ERR_NONE; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca) | 197 | int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca) |
@@ -209,12 +209,12 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca) | |||
209 | cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR; | 209 | cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR; |
210 | 210 | ||
211 | err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); | 211 | err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); |
212 | if (err != MMC_ERR_NONE) | 212 | if (err) |
213 | return err; | 213 | return err; |
214 | 214 | ||
215 | *rca = cmd.resp[0] >> 16; | 215 | *rca = cmd.resp[0] >> 16; |
216 | 216 | ||
217 | return MMC_ERR_NONE; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | int mmc_app_send_scr(struct mmc_card *card, u32 *scr) | 220 | int mmc_app_send_scr(struct mmc_card *card, u32 *scr) |
@@ -230,7 +230,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr) | |||
230 | BUG_ON(!scr); | 230 | BUG_ON(!scr); |
231 | 231 | ||
232 | err = mmc_app_cmd(card->host, card); | 232 | err = mmc_app_cmd(card->host, card); |
233 | if (err != MMC_ERR_NONE) | 233 | if (err) |
234 | return err; | 234 | return err; |
235 | 235 | ||
236 | memset(&mrq, 0, sizeof(struct mmc_request)); | 236 | memset(&mrq, 0, sizeof(struct mmc_request)); |
@@ -256,15 +256,15 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr) | |||
256 | 256 | ||
257 | mmc_wait_for_req(card->host, &mrq); | 257 | mmc_wait_for_req(card->host, &mrq); |
258 | 258 | ||
259 | if (cmd.error != MMC_ERR_NONE) | 259 | if (cmd.error) |
260 | return cmd.error; | 260 | return cmd.error; |
261 | if (data.error != MMC_ERR_NONE) | 261 | if (data.error) |
262 | return data.error; | 262 | return data.error; |
263 | 263 | ||
264 | scr[0] = ntohl(scr[0]); | 264 | scr[0] = ntohl(scr[0]); |
265 | scr[1] = ntohl(scr[1]); | 265 | scr[1] = ntohl(scr[1]); |
266 | 266 | ||
267 | return MMC_ERR_NONE; | 267 | return 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | int mmc_sd_switch(struct mmc_card *card, int mode, int group, | 270 | int mmc_sd_switch(struct mmc_card *card, int mode, int group, |
@@ -306,11 +306,11 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group, | |||
306 | 306 | ||
307 | mmc_wait_for_req(card->host, &mrq); | 307 | mmc_wait_for_req(card->host, &mrq); |
308 | 308 | ||
309 | if (cmd.error != MMC_ERR_NONE) | 309 | if (cmd.error) |
310 | return cmd.error; | 310 | return cmd.error; |
311 | if (data.error != MMC_ERR_NONE) | 311 | if (data.error) |
312 | return data.error; | 312 | return data.error; |
313 | 313 | ||
314 | return MMC_ERR_NONE; | 314 | return 0; |
315 | } | 315 | } |
316 | 316 | ||
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 955ea60583b5..810a433ce532 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -577,24 +577,22 @@ static void at91_mci_completed_command(struct at91mci_host *host) | |||
577 | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | | 577 | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | |
578 | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { | 578 | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { |
579 | if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) { | 579 | if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) { |
580 | cmd->error = MMC_ERR_NONE; | 580 | cmd->error = 0; |
581 | } | 581 | } |
582 | else { | 582 | else { |
583 | if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE)) | 583 | if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE)) |
584 | cmd->error = MMC_ERR_TIMEOUT; | 584 | cmd->error = -ETIMEDOUT; |
585 | else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE)) | 585 | else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE)) |
586 | cmd->error = MMC_ERR_BADCRC; | 586 | cmd->error = -EILSEQ; |
587 | else if (status & (AT91_MCI_OVRE | AT91_MCI_UNRE)) | ||
588 | cmd->error = MMC_ERR_FIFO; | ||
589 | else | 587 | else |
590 | cmd->error = MMC_ERR_FAILED; | 588 | cmd->error = -EIO; |
591 | 589 | ||
592 | pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n", | 590 | pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n", |
593 | cmd->error, cmd->opcode, cmd->retries); | 591 | cmd->error, cmd->opcode, cmd->retries); |
594 | } | 592 | } |
595 | } | 593 | } |
596 | else | 594 | else |
597 | cmd->error = MMC_ERR_NONE; | 595 | cmd->error = 0; |
598 | 596 | ||
599 | at91_mci_process_next(host); | 597 | at91_mci_process_next(host); |
600 | } | 598 | } |
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index 34c99d4ea041..49b0367e57c8 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c | |||
@@ -208,7 +208,7 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait, | |||
208 | default: | 208 | default: |
209 | printk(KERN_INFO "au1xmmc: unhandled response type %02x\n", | 209 | printk(KERN_INFO "au1xmmc: unhandled response type %02x\n", |
210 | mmc_resp_type(cmd)); | 210 | mmc_resp_type(cmd)); |
211 | return MMC_ERR_INVALID; | 211 | return -EINVAL; |
212 | } | 212 | } |
213 | 213 | ||
214 | if (flags & MMC_DATA_READ) { | 214 | if (flags & MMC_DATA_READ) { |
@@ -253,7 +253,7 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait, | |||
253 | IRQ_ON(host, SD_CONFIG_CR); | 253 | IRQ_ON(host, SD_CONFIG_CR); |
254 | } | 254 | } |
255 | 255 | ||
256 | return MMC_ERR_NONE; | 256 | return 0; |
257 | } | 257 | } |
258 | 258 | ||
259 | static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) | 259 | static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) |
@@ -278,7 +278,7 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) | |||
278 | while((host->flags & HOST_F_XMIT) && (status & SD_STATUS_DB)) | 278 | while((host->flags & HOST_F_XMIT) && (status & SD_STATUS_DB)) |
279 | status = au_readl(HOST_STATUS(host)); | 279 | status = au_readl(HOST_STATUS(host)); |
280 | 280 | ||
281 | data->error = MMC_ERR_NONE; | 281 | data->error = 0; |
282 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, host->dma.dir); | 282 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, host->dma.dir); |
283 | 283 | ||
284 | /* Process any errors */ | 284 | /* Process any errors */ |
@@ -288,14 +288,14 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) | |||
288 | crc |= ((status & 0x07) == 0x02) ? 0 : 1; | 288 | crc |= ((status & 0x07) == 0x02) ? 0 : 1; |
289 | 289 | ||
290 | if (crc) | 290 | if (crc) |
291 | data->error = MMC_ERR_BADCRC; | 291 | data->error = -EILSEQ; |
292 | 292 | ||
293 | /* Clear the CRC bits */ | 293 | /* Clear the CRC bits */ |
294 | au_writel(SD_STATUS_WC | SD_STATUS_RC, HOST_STATUS(host)); | 294 | au_writel(SD_STATUS_WC | SD_STATUS_RC, HOST_STATUS(host)); |
295 | 295 | ||
296 | data->bytes_xfered = 0; | 296 | data->bytes_xfered = 0; |
297 | 297 | ||
298 | if (data->error == MMC_ERR_NONE) { | 298 | if (!data->error) { |
299 | if (host->flags & HOST_F_DMA) { | 299 | if (host->flags & HOST_F_DMA) { |
300 | u32 chan = DMA_CHANNEL(host); | 300 | u32 chan = DMA_CHANNEL(host); |
301 | 301 | ||
@@ -475,7 +475,7 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status) | |||
475 | return; | 475 | return; |
476 | 476 | ||
477 | cmd = mrq->cmd; | 477 | cmd = mrq->cmd; |
478 | cmd->error = MMC_ERR_NONE; | 478 | cmd->error = 0; |
479 | 479 | ||
480 | if (cmd->flags & MMC_RSP_PRESENT) { | 480 | if (cmd->flags & MMC_RSP_PRESENT) { |
481 | if (cmd->flags & MMC_RSP_136) { | 481 | if (cmd->flags & MMC_RSP_136) { |
@@ -512,11 +512,11 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status) | |||
512 | /* Figure out errors */ | 512 | /* Figure out errors */ |
513 | 513 | ||
514 | if (status & (SD_STATUS_SC | SD_STATUS_WC | SD_STATUS_RC)) | 514 | if (status & (SD_STATUS_SC | SD_STATUS_WC | SD_STATUS_RC)) |
515 | cmd->error = MMC_ERR_BADCRC; | 515 | cmd->error = -EILSEQ; |
516 | 516 | ||
517 | trans = host->flags & (HOST_F_XMIT | HOST_F_RECV); | 517 | trans = host->flags & (HOST_F_XMIT | HOST_F_RECV); |
518 | 518 | ||
519 | if (!trans || cmd->error != MMC_ERR_NONE) { | 519 | if (!trans || cmd->error) { |
520 | 520 | ||
521 | IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA|SD_CONFIG_RF); | 521 | IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA|SD_CONFIG_RF); |
522 | tasklet_schedule(&host->finish_task); | 522 | tasklet_schedule(&host->finish_task); |
@@ -589,7 +589,7 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data) | |||
589 | data->sg_len, host->dma.dir); | 589 | data->sg_len, host->dma.dir); |
590 | 590 | ||
591 | if (host->dma.len == 0) | 591 | if (host->dma.len == 0) |
592 | return MMC_ERR_TIMEOUT; | 592 | return -ETIMEDOUT; |
593 | 593 | ||
594 | au_writel(data->blksz - 1, HOST_BLKSIZE(host)); | 594 | au_writel(data->blksz - 1, HOST_BLKSIZE(host)); |
595 | 595 | ||
@@ -640,11 +640,11 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data) | |||
640 | //IRQ_ON(host, SD_CONFIG_RA|SD_CONFIG_RF); | 640 | //IRQ_ON(host, SD_CONFIG_RA|SD_CONFIG_RF); |
641 | } | 641 | } |
642 | 642 | ||
643 | return MMC_ERR_NONE; | 643 | return 0; |
644 | 644 | ||
645 | dataerr: | 645 | dataerr: |
646 | dma_unmap_sg(mmc_dev(host->mmc),data->sg,data->sg_len,host->dma.dir); | 646 | dma_unmap_sg(mmc_dev(host->mmc),data->sg,data->sg_len,host->dma.dir); |
647 | return MMC_ERR_TIMEOUT; | 647 | return -ETIMEDOUT; |
648 | } | 648 | } |
649 | 649 | ||
650 | /* static void au1xmmc_request | 650 | /* static void au1xmmc_request |
@@ -656,7 +656,7 @@ static void au1xmmc_request(struct mmc_host* mmc, struct mmc_request* mrq) | |||
656 | 656 | ||
657 | struct au1xmmc_host *host = mmc_priv(mmc); | 657 | struct au1xmmc_host *host = mmc_priv(mmc); |
658 | unsigned int flags = 0; | 658 | unsigned int flags = 0; |
659 | int ret = MMC_ERR_NONE; | 659 | int ret = 0; |
660 | 660 | ||
661 | WARN_ON(irqs_disabled()); | 661 | WARN_ON(irqs_disabled()); |
662 | WARN_ON(host->status != HOST_S_IDLE); | 662 | WARN_ON(host->status != HOST_S_IDLE); |
@@ -672,10 +672,10 @@ static void au1xmmc_request(struct mmc_host* mmc, struct mmc_request* mrq) | |||
672 | ret = au1xmmc_prepare_data(host, mrq->data); | 672 | ret = au1xmmc_prepare_data(host, mrq->data); |
673 | } | 673 | } |
674 | 674 | ||
675 | if (ret == MMC_ERR_NONE) | 675 | if (!ret) |
676 | ret = au1xmmc_send_command(host, 0, mrq->cmd, flags); | 676 | ret = au1xmmc_send_command(host, 0, mrq->cmd, flags); |
677 | 677 | ||
678 | if (ret != MMC_ERR_NONE) { | 678 | if (ret) { |
679 | mrq->cmd->error = ret; | 679 | mrq->cmd->error = ret; |
680 | au1xmmc_finish_request(host); | 680 | au1xmmc_finish_request(host); |
681 | } | 681 | } |
@@ -764,10 +764,10 @@ static irqreturn_t au1xmmc_irq(int irq, void *dev_id) | |||
764 | 764 | ||
765 | if (host->mrq && (status & STATUS_TIMEOUT)) { | 765 | if (host->mrq && (status & STATUS_TIMEOUT)) { |
766 | if (status & SD_STATUS_RAT) | 766 | if (status & SD_STATUS_RAT) |
767 | host->mrq->cmd->error = MMC_ERR_TIMEOUT; | 767 | host->mrq->cmd->error = -ETIMEDOUT; |
768 | 768 | ||
769 | else if (status & SD_STATUS_DT) | 769 | else if (status & SD_STATUS_DT) |
770 | host->mrq->data->error = MMC_ERR_TIMEOUT; | 770 | host->mrq->data->error = -ETIMEDOUT; |
771 | 771 | ||
772 | /* In PIO mode, interrupts might still be enabled */ | 772 | /* In PIO mode, interrupts might still be enabled */ |
773 | IRQ_OFF(host, SD_CONFIG_NE | SD_CONFIG_TH); | 773 | IRQ_OFF(host, SD_CONFIG_NE | SD_CONFIG_TH); |
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c index 54bfc9f25596..04458c342812 100644 --- a/drivers/mmc/host/imxmmc.c +++ b/drivers/mmc/host/imxmmc.c | |||
@@ -428,11 +428,11 @@ static int imxmci_finish_data(struct imxmci_host *host, unsigned int stat) | |||
428 | if ( stat & STATUS_ERR_MASK ) { | 428 | if ( stat & STATUS_ERR_MASK ) { |
429 | dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n",stat); | 429 | dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n",stat); |
430 | if(stat & (STATUS_CRC_READ_ERR | STATUS_CRC_WRITE_ERR)) | 430 | if(stat & (STATUS_CRC_READ_ERR | STATUS_CRC_WRITE_ERR)) |
431 | data->error = MMC_ERR_BADCRC; | 431 | data->error = -EILSEQ; |
432 | else if(stat & STATUS_TIME_OUT_READ) | 432 | else if(stat & STATUS_TIME_OUT_READ) |
433 | data->error = MMC_ERR_TIMEOUT; | 433 | data->error = -ETIMEDOUT; |
434 | else | 434 | else |
435 | data->error = MMC_ERR_FAILED; | 435 | data->error = -EIO; |
436 | } else { | 436 | } else { |
437 | data->bytes_xfered = host->dma_size; | 437 | data->bytes_xfered = host->dma_size; |
438 | } | 438 | } |
@@ -458,10 +458,10 @@ static int imxmci_cmd_done(struct imxmci_host *host, unsigned int stat) | |||
458 | 458 | ||
459 | if (stat & STATUS_TIME_OUT_RESP) { | 459 | if (stat & STATUS_TIME_OUT_RESP) { |
460 | dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n"); | 460 | dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n"); |
461 | cmd->error = MMC_ERR_TIMEOUT; | 461 | cmd->error = -ETIMEDOUT; |
462 | } else if (stat & STATUS_RESP_CRC_ERR && cmd->flags & MMC_RSP_CRC) { | 462 | } else if (stat & STATUS_RESP_CRC_ERR && cmd->flags & MMC_RSP_CRC) { |
463 | dev_dbg(mmc_dev(host->mmc), "cmd crc error\n"); | 463 | dev_dbg(mmc_dev(host->mmc), "cmd crc error\n"); |
464 | cmd->error = MMC_ERR_BADCRC; | 464 | cmd->error = -EILSEQ; |
465 | } | 465 | } |
466 | 466 | ||
467 | if(cmd->flags & MMC_RSP_PRESENT) { | 467 | if(cmd->flags & MMC_RSP_PRESENT) { |
@@ -482,7 +482,7 @@ static int imxmci_cmd_done(struct imxmci_host *host, unsigned int stat) | |||
482 | dev_dbg(mmc_dev(host->mmc), "RESP 0x%08x, 0x%08x, 0x%08x, 0x%08x, error %d\n", | 482 | dev_dbg(mmc_dev(host->mmc), "RESP 0x%08x, 0x%08x, 0x%08x, 0x%08x, error %d\n", |
483 | cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3], cmd->error); | 483 | cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3], cmd->error); |
484 | 484 | ||
485 | if (data && (cmd->error == MMC_ERR_NONE) && !(stat & STATUS_ERR_MASK)) { | 485 | if (data && !cmd->error && !(stat & STATUS_ERR_MASK)) { |
486 | if (host->req->data->flags & MMC_DATA_WRITE) { | 486 | if (host->req->data->flags & MMC_DATA_WRITE) { |
487 | 487 | ||
488 | /* Wait for FIFO to be empty before starting DMA write */ | 488 | /* Wait for FIFO to be empty before starting DMA write */ |
@@ -491,7 +491,7 @@ static int imxmci_cmd_done(struct imxmci_host *host, unsigned int stat) | |||
491 | if(imxmci_busy_wait_for_status(host, &stat, | 491 | if(imxmci_busy_wait_for_status(host, &stat, |
492 | STATUS_APPL_BUFF_FE, | 492 | STATUS_APPL_BUFF_FE, |
493 | 40, "imxmci_cmd_done DMA WR") < 0) { | 493 | 40, "imxmci_cmd_done DMA WR") < 0) { |
494 | cmd->error = MMC_ERR_FIFO; | 494 | cmd->error = -EIO; |
495 | imxmci_finish_data(host, stat); | 495 | imxmci_finish_data(host, stat); |
496 | if(host->req) | 496 | if(host->req) |
497 | imxmci_finish_request(host, host->req); | 497 | imxmci_finish_request(host, host->req); |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index be730c0a0352..d53e9a8bdaa2 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -154,11 +154,11 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
154 | } | 154 | } |
155 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { | 155 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
156 | if (status & MCI_DATACRCFAIL) | 156 | if (status & MCI_DATACRCFAIL) |
157 | data->error = MMC_ERR_BADCRC; | 157 | data->error = -EILSEQ; |
158 | else if (status & MCI_DATATIMEOUT) | 158 | else if (status & MCI_DATATIMEOUT) |
159 | data->error = MMC_ERR_TIMEOUT; | 159 | data->error = -ETIMEDOUT; |
160 | else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) | 160 | else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) |
161 | data->error = MMC_ERR_FIFO; | 161 | data->error = -EIO; |
162 | status |= MCI_DATAEND; | 162 | status |= MCI_DATAEND; |
163 | 163 | ||
164 | /* | 164 | /* |
@@ -193,12 +193,12 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, | |||
193 | cmd->resp[3] = readl(base + MMCIRESPONSE3); | 193 | cmd->resp[3] = readl(base + MMCIRESPONSE3); |
194 | 194 | ||
195 | if (status & MCI_CMDTIMEOUT) { | 195 | if (status & MCI_CMDTIMEOUT) { |
196 | cmd->error = MMC_ERR_TIMEOUT; | 196 | cmd->error = -ETIMEDOUT; |
197 | } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { | 197 | } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { |
198 | cmd->error = MMC_ERR_BADCRC; | 198 | cmd->error = -EILSEQ; |
199 | } | 199 | } |
200 | 200 | ||
201 | if (!cmd->data || cmd->error != MMC_ERR_NONE) { | 201 | if (!cmd->data || cmd->error) { |
202 | if (host->data) | 202 | if (host->data) |
203 | mmci_stop_data(host); | 203 | mmci_stop_data(host); |
204 | mmci_request_end(host, cmd->mrq); | 204 | mmci_request_end(host, cmd->mrq); |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 0cf97edc5f58..60a67dfcda6a 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -263,7 +263,7 @@ mmc_omap_xfer_done(struct mmc_omap_host *host, struct mmc_data *data) | |||
263 | enum dma_data_direction dma_data_dir; | 263 | enum dma_data_direction dma_data_dir; |
264 | 264 | ||
265 | BUG_ON(host->dma_ch < 0); | 265 | BUG_ON(host->dma_ch < 0); |
266 | if (data->error != MMC_ERR_NONE) | 266 | if (data->error) |
267 | omap_stop_dma(host->dma_ch); | 267 | omap_stop_dma(host->dma_ch); |
268 | /* Release DMA channel lazily */ | 268 | /* Release DMA channel lazily */ |
269 | mod_timer(&host->dma_timer, jiffies + HZ); | 269 | mod_timer(&host->dma_timer, jiffies + HZ); |
@@ -368,7 +368,7 @@ mmc_omap_cmd_done(struct mmc_omap_host *host, struct mmc_command *cmd) | |||
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | if (host->data == NULL || cmd->error != MMC_ERR_NONE) { | 371 | if (host->data == NULL || cmd->error) { |
372 | host->mrq = NULL; | 372 | host->mrq = NULL; |
373 | clk_disable(host->fclk); | 373 | clk_disable(host->fclk); |
374 | mmc_request_done(host->mmc, cmd->mrq); | 374 | mmc_request_done(host->mmc, cmd->mrq); |
@@ -475,14 +475,14 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
475 | if (status & OMAP_MMC_STAT_DATA_TOUT) { | 475 | if (status & OMAP_MMC_STAT_DATA_TOUT) { |
476 | dev_dbg(mmc_dev(host->mmc), "data timeout\n"); | 476 | dev_dbg(mmc_dev(host->mmc), "data timeout\n"); |
477 | if (host->data) { | 477 | if (host->data) { |
478 | host->data->error |= MMC_ERR_TIMEOUT; | 478 | host->data->error = -ETIMEDOUT; |
479 | transfer_error = 1; | 479 | transfer_error = 1; |
480 | } | 480 | } |
481 | } | 481 | } |
482 | 482 | ||
483 | if (status & OMAP_MMC_STAT_DATA_CRC) { | 483 | if (status & OMAP_MMC_STAT_DATA_CRC) { |
484 | if (host->data) { | 484 | if (host->data) { |
485 | host->data->error |= MMC_ERR_BADCRC; | 485 | host->data->error = -EILSEQ; |
486 | dev_dbg(mmc_dev(host->mmc), | 486 | dev_dbg(mmc_dev(host->mmc), |
487 | "data CRC error, bytes left %d\n", | 487 | "data CRC error, bytes left %d\n", |
488 | host->total_bytes_left); | 488 | host->total_bytes_left); |
@@ -504,7 +504,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
504 | dev_err(mmc_dev(host->mmc), | 504 | dev_err(mmc_dev(host->mmc), |
505 | "command timeout, CMD %d\n", | 505 | "command timeout, CMD %d\n", |
506 | host->cmd->opcode); | 506 | host->cmd->opcode); |
507 | host->cmd->error = MMC_ERR_TIMEOUT; | 507 | host->cmd->error = -ETIMEDOUT; |
508 | end_command = 1; | 508 | end_command = 1; |
509 | } | 509 | } |
510 | } | 510 | } |
@@ -514,7 +514,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
514 | dev_err(mmc_dev(host->mmc), | 514 | dev_err(mmc_dev(host->mmc), |
515 | "command CRC error (CMD%d, arg 0x%08x)\n", | 515 | "command CRC error (CMD%d, arg 0x%08x)\n", |
516 | host->cmd->opcode, host->cmd->arg); | 516 | host->cmd->opcode, host->cmd->arg); |
517 | host->cmd->error = MMC_ERR_BADCRC; | 517 | host->cmd->error = -EILSEQ; |
518 | end_command = 1; | 518 | end_command = 1; |
519 | } else | 519 | } else |
520 | dev_err(mmc_dev(host->mmc), | 520 | dev_err(mmc_dev(host->mmc), |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index ff960334b337..b89e32d1e9b5 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -226,7 +226,7 @@ static int pxamci_cmd_done(struct pxamci_host *host, unsigned int stat) | |||
226 | } | 226 | } |
227 | 227 | ||
228 | if (stat & STAT_TIME_OUT_RESPONSE) { | 228 | if (stat & STAT_TIME_OUT_RESPONSE) { |
229 | cmd->error = MMC_ERR_TIMEOUT; | 229 | cmd->error = -ETIMEDOUT; |
230 | } else if (stat & STAT_RES_CRC_ERR && cmd->flags & MMC_RSP_CRC) { | 230 | } else if (stat & STAT_RES_CRC_ERR && cmd->flags & MMC_RSP_CRC) { |
231 | #ifdef CONFIG_PXA27x | 231 | #ifdef CONFIG_PXA27x |
232 | /* | 232 | /* |
@@ -239,11 +239,11 @@ static int pxamci_cmd_done(struct pxamci_host *host, unsigned int stat) | |||
239 | pr_debug("ignoring CRC from command %d - *risky*\n", cmd->opcode); | 239 | pr_debug("ignoring CRC from command %d - *risky*\n", cmd->opcode); |
240 | } else | 240 | } else |
241 | #endif | 241 | #endif |
242 | cmd->error = MMC_ERR_BADCRC; | 242 | cmd->error = -EILSEQ; |
243 | } | 243 | } |
244 | 244 | ||
245 | pxamci_disable_irq(host, END_CMD_RES); | 245 | pxamci_disable_irq(host, END_CMD_RES); |
246 | if (host->data && cmd->error == MMC_ERR_NONE) { | 246 | if (host->data && !cmd->error) { |
247 | pxamci_enable_irq(host, DATA_TRAN_DONE); | 247 | pxamci_enable_irq(host, DATA_TRAN_DONE); |
248 | } else { | 248 | } else { |
249 | pxamci_finish_request(host, host->mrq); | 249 | pxamci_finish_request(host, host->mrq); |
@@ -264,9 +264,9 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat) | |||
264 | host->dma_dir); | 264 | host->dma_dir); |
265 | 265 | ||
266 | if (stat & STAT_READ_TIME_OUT) | 266 | if (stat & STAT_READ_TIME_OUT) |
267 | data->error = MMC_ERR_TIMEOUT; | 267 | data->error = -ETIMEDOUT; |
268 | else if (stat & (STAT_CRC_READ_ERROR|STAT_CRC_WRITE_ERROR)) | 268 | else if (stat & (STAT_CRC_READ_ERROR|STAT_CRC_WRITE_ERROR)) |
269 | data->error = MMC_ERR_BADCRC; | 269 | data->error = -EILSEQ; |
270 | 270 | ||
271 | /* | 271 | /* |
272 | * There appears to be a hardware design bug here. There seems to | 272 | * There appears to be a hardware design bug here. There seems to |
@@ -274,7 +274,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat) | |||
274 | * This means that if there was an error on any block, we mark all | 274 | * This means that if there was an error on any block, we mark all |
275 | * data blocks as being in error. | 275 | * data blocks as being in error. |
276 | */ | 276 | */ |
277 | if (data->error == MMC_ERR_NONE) | 277 | if (!data->error) |
278 | data->bytes_xfered = data->blocks * data->blksz; | 278 | data->bytes_xfered = data->blocks * data->blksz; |
279 | else | 279 | else |
280 | data->bytes_xfered = 0; | 280 | data->bytes_xfered = 0; |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 20a7d89e01ba..479d6a265dd1 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -481,16 +481,16 @@ static void sdhci_finish_data(struct sdhci_host *host) | |||
481 | * Controller doesn't count down when in single block mode. | 481 | * Controller doesn't count down when in single block mode. |
482 | */ | 482 | */ |
483 | if (data->blocks == 1) | 483 | if (data->blocks == 1) |
484 | blocks = (data->error == MMC_ERR_NONE) ? 0 : 1; | 484 | blocks = (data->error == 0) ? 0 : 1; |
485 | else | 485 | else |
486 | blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); | 486 | blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); |
487 | data->bytes_xfered = data->blksz * (data->blocks - blocks); | 487 | data->bytes_xfered = data->blksz * (data->blocks - blocks); |
488 | 488 | ||
489 | if ((data->error == MMC_ERR_NONE) && blocks) { | 489 | if (!data->error && blocks) { |
490 | printk(KERN_ERR "%s: Controller signalled completion even " | 490 | printk(KERN_ERR "%s: Controller signalled completion even " |
491 | "though there were blocks left.\n", | 491 | "though there were blocks left.\n", |
492 | mmc_hostname(host->mmc)); | 492 | mmc_hostname(host->mmc)); |
493 | data->error = MMC_ERR_FAILED; | 493 | data->error = -EIO; |
494 | } | 494 | } |
495 | 495 | ||
496 | if (data->stop) { | 496 | if (data->stop) { |
@@ -498,7 +498,7 @@ static void sdhci_finish_data(struct sdhci_host *host) | |||
498 | * The controller needs a reset of internal state machines | 498 | * The controller needs a reset of internal state machines |
499 | * upon error conditions. | 499 | * upon error conditions. |
500 | */ | 500 | */ |
501 | if (data->error != MMC_ERR_NONE) { | 501 | if (data->error) { |
502 | sdhci_reset(host, SDHCI_RESET_CMD); | 502 | sdhci_reset(host, SDHCI_RESET_CMD); |
503 | sdhci_reset(host, SDHCI_RESET_DATA); | 503 | sdhci_reset(host, SDHCI_RESET_DATA); |
504 | } | 504 | } |
@@ -533,7 +533,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) | |||
533 | printk(KERN_ERR "%s: Controller never released " | 533 | printk(KERN_ERR "%s: Controller never released " |
534 | "inhibit bit(s).\n", mmc_hostname(host->mmc)); | 534 | "inhibit bit(s).\n", mmc_hostname(host->mmc)); |
535 | sdhci_dumpregs(host); | 535 | sdhci_dumpregs(host); |
536 | cmd->error = MMC_ERR_FAILED; | 536 | cmd->error = -EIO; |
537 | tasklet_schedule(&host->finish_tasklet); | 537 | tasklet_schedule(&host->finish_tasklet); |
538 | return; | 538 | return; |
539 | } | 539 | } |
@@ -554,7 +554,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) | |||
554 | if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { | 554 | if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { |
555 | printk(KERN_ERR "%s: Unsupported response type!\n", | 555 | printk(KERN_ERR "%s: Unsupported response type!\n", |
556 | mmc_hostname(host->mmc)); | 556 | mmc_hostname(host->mmc)); |
557 | cmd->error = MMC_ERR_INVALID; | 557 | cmd->error = -EINVAL; |
558 | tasklet_schedule(&host->finish_tasklet); | 558 | tasklet_schedule(&host->finish_tasklet); |
559 | return; | 559 | return; |
560 | } | 560 | } |
@@ -601,7 +601,7 @@ static void sdhci_finish_command(struct sdhci_host *host) | |||
601 | } | 601 | } |
602 | } | 602 | } |
603 | 603 | ||
604 | host->cmd->error = MMC_ERR_NONE; | 604 | host->cmd->error = 0; |
605 | 605 | ||
606 | if (host->data && host->data_early) | 606 | if (host->data && host->data_early) |
607 | sdhci_finish_data(host); | 607 | sdhci_finish_data(host); |
@@ -722,7 +722,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
722 | host->mrq = mrq; | 722 | host->mrq = mrq; |
723 | 723 | ||
724 | if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) { | 724 | if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) { |
725 | host->mrq->cmd->error = MMC_ERR_TIMEOUT; | 725 | host->mrq->cmd->error = -ENOMEDIUM; |
726 | tasklet_schedule(&host->finish_tasklet); | 726 | tasklet_schedule(&host->finish_tasklet); |
727 | } else | 727 | } else |
728 | sdhci_send_command(host, mrq->cmd); | 728 | sdhci_send_command(host, mrq->cmd); |
@@ -831,7 +831,7 @@ static void sdhci_tasklet_card(unsigned long param) | |||
831 | sdhci_reset(host, SDHCI_RESET_CMD); | 831 | sdhci_reset(host, SDHCI_RESET_CMD); |
832 | sdhci_reset(host, SDHCI_RESET_DATA); | 832 | sdhci_reset(host, SDHCI_RESET_DATA); |
833 | 833 | ||
834 | host->mrq->cmd->error = MMC_ERR_FAILED; | 834 | host->mrq->cmd->error = -ENOMEDIUM; |
835 | tasklet_schedule(&host->finish_tasklet); | 835 | tasklet_schedule(&host->finish_tasklet); |
836 | } | 836 | } |
837 | } | 837 | } |
@@ -859,9 +859,9 @@ static void sdhci_tasklet_finish(unsigned long param) | |||
859 | * The controller needs a reset of internal state machines | 859 | * The controller needs a reset of internal state machines |
860 | * upon error conditions. | 860 | * upon error conditions. |
861 | */ | 861 | */ |
862 | if ((mrq->cmd->error != MMC_ERR_NONE) || | 862 | if (mrq->cmd->error || |
863 | (mrq->data && ((mrq->data->error != MMC_ERR_NONE) || | 863 | (mrq->data && (mrq->data->error || |
864 | (mrq->data->stop && (mrq->data->stop->error != MMC_ERR_NONE))))) { | 864 | (mrq->data->stop && mrq->data->stop->error)))) { |
865 | 865 | ||
866 | /* Some controllers need this kick or reset won't work here */ | 866 | /* Some controllers need this kick or reset won't work here */ |
867 | if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) { | 867 | if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) { |
@@ -906,13 +906,13 @@ static void sdhci_timeout_timer(unsigned long data) | |||
906 | sdhci_dumpregs(host); | 906 | sdhci_dumpregs(host); |
907 | 907 | ||
908 | if (host->data) { | 908 | if (host->data) { |
909 | host->data->error = MMC_ERR_TIMEOUT; | 909 | host->data->error = -ETIMEDOUT; |
910 | sdhci_finish_data(host); | 910 | sdhci_finish_data(host); |
911 | } else { | 911 | } else { |
912 | if (host->cmd) | 912 | if (host->cmd) |
913 | host->cmd->error = MMC_ERR_TIMEOUT; | 913 | host->cmd->error = -ETIMEDOUT; |
914 | else | 914 | else |
915 | host->mrq->cmd->error = MMC_ERR_TIMEOUT; | 915 | host->mrq->cmd->error = -ETIMEDOUT; |
916 | 916 | ||
917 | tasklet_schedule(&host->finish_tasklet); | 917 | tasklet_schedule(&host->finish_tasklet); |
918 | } | 918 | } |
@@ -941,13 +941,12 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask) | |||
941 | } | 941 | } |
942 | 942 | ||
943 | if (intmask & SDHCI_INT_TIMEOUT) | 943 | if (intmask & SDHCI_INT_TIMEOUT) |
944 | host->cmd->error = MMC_ERR_TIMEOUT; | 944 | host->cmd->error = -ETIMEDOUT; |
945 | else if (intmask & SDHCI_INT_CRC) | 945 | else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT | |
946 | host->cmd->error = MMC_ERR_BADCRC; | 946 | SDHCI_INT_INDEX)) |
947 | else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX)) | 947 | host->cmd->error = -EILSEQ; |
948 | host->cmd->error = MMC_ERR_FAILED; | ||
949 | 948 | ||
950 | if (host->cmd->error != MMC_ERR_NONE) | 949 | if (host->cmd->error) |
951 | tasklet_schedule(&host->finish_tasklet); | 950 | tasklet_schedule(&host->finish_tasklet); |
952 | else if (intmask & SDHCI_INT_RESPONSE) | 951 | else if (intmask & SDHCI_INT_RESPONSE) |
953 | sdhci_finish_command(host); | 952 | sdhci_finish_command(host); |
@@ -974,13 +973,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) | |||
974 | } | 973 | } |
975 | 974 | ||
976 | if (intmask & SDHCI_INT_DATA_TIMEOUT) | 975 | if (intmask & SDHCI_INT_DATA_TIMEOUT) |
977 | host->data->error = MMC_ERR_TIMEOUT; | 976 | host->data->error = -ETIMEDOUT; |
978 | else if (intmask & SDHCI_INT_DATA_CRC) | 977 | else if (intmask & (SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_END_BIT)) |
979 | host->data->error = MMC_ERR_BADCRC; | 978 | host->data->error = -EILSEQ; |
980 | else if (intmask & SDHCI_INT_DATA_END_BIT) | ||
981 | host->data->error = MMC_ERR_FAILED; | ||
982 | 979 | ||
983 | if (host->data->error != MMC_ERR_NONE) | 980 | if (host->data->error) |
984 | sdhci_finish_data(host); | 981 | sdhci_finish_data(host); |
985 | else { | 982 | else { |
986 | if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) | 983 | if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) |
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 8b736e968447..b4a56e5e5132 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c | |||
@@ -404,14 +404,14 @@ static void tifm_sd_check_status(struct tifm_sd *host) | |||
404 | struct tifm_dev *sock = host->dev; | 404 | struct tifm_dev *sock = host->dev; |
405 | struct mmc_command *cmd = host->req->cmd; | 405 | struct mmc_command *cmd = host->req->cmd; |
406 | 406 | ||
407 | if (cmd->error != MMC_ERR_NONE) | 407 | if (cmd->error) |
408 | goto finish_request; | 408 | goto finish_request; |
409 | 409 | ||
410 | if (!(host->cmd_flags & CMD_READY)) | 410 | if (!(host->cmd_flags & CMD_READY)) |
411 | return; | 411 | return; |
412 | 412 | ||
413 | if (cmd->data) { | 413 | if (cmd->data) { |
414 | if (cmd->data->error != MMC_ERR_NONE) { | 414 | if (cmd->data->error) { |
415 | if ((host->cmd_flags & SCMD_ACTIVE) | 415 | if ((host->cmd_flags & SCMD_ACTIVE) |
416 | && !(host->cmd_flags & SCMD_READY)) | 416 | && !(host->cmd_flags & SCMD_READY)) |
417 | return; | 417 | return; |
@@ -504,7 +504,7 @@ static void tifm_sd_card_event(struct tifm_dev *sock) | |||
504 | { | 504 | { |
505 | struct tifm_sd *host; | 505 | struct tifm_sd *host; |
506 | unsigned int host_status = 0; | 506 | unsigned int host_status = 0; |
507 | int cmd_error = MMC_ERR_NONE; | 507 | int cmd_error = 0; |
508 | struct mmc_command *cmd = NULL; | 508 | struct mmc_command *cmd = NULL; |
509 | unsigned long flags; | 509 | unsigned long flags; |
510 | 510 | ||
@@ -521,15 +521,15 @@ static void tifm_sd_card_event(struct tifm_dev *sock) | |||
521 | writel(host_status & TIFM_MMCSD_ERRMASK, | 521 | writel(host_status & TIFM_MMCSD_ERRMASK, |
522 | sock->addr + SOCK_MMCSD_STATUS); | 522 | sock->addr + SOCK_MMCSD_STATUS); |
523 | if (host_status & TIFM_MMCSD_CTO) | 523 | if (host_status & TIFM_MMCSD_CTO) |
524 | cmd_error = MMC_ERR_TIMEOUT; | 524 | cmd_error = -ETIMEDOUT; |
525 | else if (host_status & TIFM_MMCSD_CCRC) | 525 | else if (host_status & TIFM_MMCSD_CCRC) |
526 | cmd_error = MMC_ERR_BADCRC; | 526 | cmd_error = -EILSEQ; |
527 | 527 | ||
528 | if (cmd->data) { | 528 | if (cmd->data) { |
529 | if (host_status & TIFM_MMCSD_DTO) | 529 | if (host_status & TIFM_MMCSD_DTO) |
530 | cmd->data->error = MMC_ERR_TIMEOUT; | 530 | cmd->data->error = -ETIMEDOUT; |
531 | else if (host_status & TIFM_MMCSD_DCRC) | 531 | else if (host_status & TIFM_MMCSD_DCRC) |
532 | cmd->data->error = MMC_ERR_BADCRC; | 532 | cmd->data->error = -EILSEQ; |
533 | } | 533 | } |
534 | 534 | ||
535 | writel(TIFM_FIFO_INT_SETALL, | 535 | writel(TIFM_FIFO_INT_SETALL, |
@@ -722,7 +722,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
722 | return; | 722 | return; |
723 | 723 | ||
724 | err_out: | 724 | err_out: |
725 | mrq->cmd->error = MMC_ERR_TIMEOUT; | 725 | mrq->cmd->error = -ETIMEDOUT; |
726 | mmc_request_done(mmc, mrq); | 726 | mmc_request_done(mmc, mrq); |
727 | } | 727 | } |
728 | 728 | ||
@@ -1012,9 +1012,9 @@ static void tifm_sd_remove(struct tifm_dev *sock) | |||
1012 | writel(TIFM_FIFO_INT_SETALL, | 1012 | writel(TIFM_FIFO_INT_SETALL, |
1013 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | 1013 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); |
1014 | writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); | 1014 | writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); |
1015 | host->req->cmd->error = MMC_ERR_TIMEOUT; | 1015 | host->req->cmd->error = -ENOMEDIUM; |
1016 | if (host->req->stop) | 1016 | if (host->req->stop) |
1017 | host->req->stop->error = MMC_ERR_TIMEOUT; | 1017 | host->req->stop->error = -ENOMEDIUM; |
1018 | tasklet_schedule(&host->finish_tasklet); | 1018 | tasklet_schedule(&host->finish_tasklet); |
1019 | } | 1019 | } |
1020 | spin_unlock_irqrestore(&sock->lock, flags); | 1020 | spin_unlock_irqrestore(&sock->lock, flags); |
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c index 9bf2a877113b..44968c2279e1 100644 --- a/drivers/mmc/host/wbsd.c +++ b/drivers/mmc/host/wbsd.c | |||
@@ -317,7 +317,7 @@ static inline void wbsd_get_short_reply(struct wbsd_host *host, | |||
317 | * Correct response type? | 317 | * Correct response type? |
318 | */ | 318 | */ |
319 | if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_SHORT) { | 319 | if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_SHORT) { |
320 | cmd->error = MMC_ERR_INVALID; | 320 | cmd->error = -EILSEQ; |
321 | return; | 321 | return; |
322 | } | 322 | } |
323 | 323 | ||
@@ -337,7 +337,7 @@ static inline void wbsd_get_long_reply(struct wbsd_host *host, | |||
337 | * Correct response type? | 337 | * Correct response type? |
338 | */ | 338 | */ |
339 | if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_LONG) { | 339 | if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_LONG) { |
340 | cmd->error = MMC_ERR_INVALID; | 340 | cmd->error = -EILSEQ; |
341 | return; | 341 | return; |
342 | } | 342 | } |
343 | 343 | ||
@@ -372,7 +372,7 @@ static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd) | |||
372 | for (i = 3; i >= 0; i--) | 372 | for (i = 3; i >= 0; i--) |
373 | outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR); | 373 | outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR); |
374 | 374 | ||
375 | cmd->error = MMC_ERR_NONE; | 375 | cmd->error = 0; |
376 | 376 | ||
377 | /* | 377 | /* |
378 | * Wait for the request to complete. | 378 | * Wait for the request to complete. |
@@ -392,13 +392,13 @@ static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd) | |||
392 | 392 | ||
393 | /* Card removed? */ | 393 | /* Card removed? */ |
394 | if (isr & WBSD_INT_CARD) | 394 | if (isr & WBSD_INT_CARD) |
395 | cmd->error = MMC_ERR_TIMEOUT; | 395 | cmd->error = -ENOMEDIUM; |
396 | /* Timeout? */ | 396 | /* Timeout? */ |
397 | else if (isr & WBSD_INT_TIMEOUT) | 397 | else if (isr & WBSD_INT_TIMEOUT) |
398 | cmd->error = MMC_ERR_TIMEOUT; | 398 | cmd->error = -ETIMEDOUT; |
399 | /* CRC? */ | 399 | /* CRC? */ |
400 | else if ((cmd->flags & MMC_RSP_CRC) && (isr & WBSD_INT_CRC)) | 400 | else if ((cmd->flags & MMC_RSP_CRC) && (isr & WBSD_INT_CRC)) |
401 | cmd->error = MMC_ERR_BADCRC; | 401 | cmd->error = -EILSEQ; |
402 | /* All ok */ | 402 | /* All ok */ |
403 | else { | 403 | else { |
404 | if (cmd->flags & MMC_RSP_136) | 404 | if (cmd->flags & MMC_RSP_136) |
@@ -585,7 +585,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) | |||
585 | ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); | 585 | ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); |
586 | wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); | 586 | wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); |
587 | } else { | 587 | } else { |
588 | data->error = MMC_ERR_INVALID; | 588 | data->error = -EINVAL; |
589 | return; | 589 | return; |
590 | } | 590 | } |
591 | 591 | ||
@@ -607,7 +607,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) | |||
607 | */ | 607 | */ |
608 | BUG_ON(size > 0x10000); | 608 | BUG_ON(size > 0x10000); |
609 | if (size > 0x10000) { | 609 | if (size > 0x10000) { |
610 | data->error = MMC_ERR_INVALID; | 610 | data->error = -EINVAL; |
611 | return; | 611 | return; |
612 | } | 612 | } |
613 | 613 | ||
@@ -669,7 +669,7 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) | |||
669 | } | 669 | } |
670 | } | 670 | } |
671 | 671 | ||
672 | data->error = MMC_ERR_NONE; | 672 | data->error = 0; |
673 | } | 673 | } |
674 | 674 | ||
675 | static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data) | 675 | static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data) |
@@ -724,8 +724,8 @@ static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data) | |||
724 | "%d bytes left.\n", | 724 | "%d bytes left.\n", |
725 | mmc_hostname(host->mmc), count); | 725 | mmc_hostname(host->mmc), count); |
726 | 726 | ||
727 | if (data->error == MMC_ERR_NONE) | 727 | if (!data->error) |
728 | data->error = MMC_ERR_FAILED; | 728 | data->error = -EIO; |
729 | } else { | 729 | } else { |
730 | /* | 730 | /* |
731 | * Transfer data from DMA buffer to | 731 | * Transfer data from DMA buffer to |
@@ -735,7 +735,7 @@ static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data) | |||
735 | wbsd_dma_to_sg(host, data); | 735 | wbsd_dma_to_sg(host, data); |
736 | } | 736 | } |
737 | 737 | ||
738 | if (data->error != MMC_ERR_NONE) { | 738 | if (data->error) { |
739 | if (data->bytes_xfered) | 739 | if (data->bytes_xfered) |
740 | data->bytes_xfered -= data->blksz; | 740 | data->bytes_xfered -= data->blksz; |
741 | } | 741 | } |
@@ -767,11 +767,10 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
767 | host->mrq = mrq; | 767 | host->mrq = mrq; |
768 | 768 | ||
769 | /* | 769 | /* |
770 | * If there is no card in the slot then | 770 | * Check that there is actually a card in the slot. |
771 | * timeout immediatly. | ||
772 | */ | 771 | */ |
773 | if (!(host->flags & WBSD_FCARD_PRESENT)) { | 772 | if (!(host->flags & WBSD_FCARD_PRESENT)) { |
774 | cmd->error = MMC_ERR_TIMEOUT; | 773 | cmd->error = -ENOMEDIUM; |
775 | goto done; | 774 | goto done; |
776 | } | 775 | } |
777 | 776 | ||
@@ -807,7 +806,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
807 | "supported by this controller.\n", | 806 | "supported by this controller.\n", |
808 | mmc_hostname(host->mmc), cmd->opcode); | 807 | mmc_hostname(host->mmc), cmd->opcode); |
809 | #endif | 808 | #endif |
810 | cmd->error = MMC_ERR_INVALID; | 809 | cmd->error = -EINVAL; |
811 | 810 | ||
812 | goto done; | 811 | goto done; |
813 | }; | 812 | }; |
@@ -819,7 +818,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
819 | if (cmd->data) { | 818 | if (cmd->data) { |
820 | wbsd_prepare_data(host, cmd->data); | 819 | wbsd_prepare_data(host, cmd->data); |
821 | 820 | ||
822 | if (cmd->data->error != MMC_ERR_NONE) | 821 | if (cmd->data->error) |
823 | goto done; | 822 | goto done; |
824 | } | 823 | } |
825 | 824 | ||
@@ -830,7 +829,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
830 | * will be finished after the data has | 829 | * will be finished after the data has |
831 | * transfered. | 830 | * transfered. |
832 | */ | 831 | */ |
833 | if (cmd->data && (cmd->error == MMC_ERR_NONE)) { | 832 | if (cmd->data && !cmd->error) { |
834 | /* | 833 | /* |
835 | * Dirty fix for hardware bug. | 834 | * Dirty fix for hardware bug. |
836 | */ | 835 | */ |
@@ -1033,7 +1032,7 @@ static void wbsd_tasklet_card(unsigned long param) | |||
1033 | mmc_hostname(host->mmc)); | 1032 | mmc_hostname(host->mmc)); |
1034 | wbsd_reset(host); | 1033 | wbsd_reset(host); |
1035 | 1034 | ||
1036 | host->mrq->cmd->error = MMC_ERR_FAILED; | 1035 | host->mrq->cmd->error = -ENOMEDIUM; |
1037 | tasklet_schedule(&host->finish_tasklet); | 1036 | tasklet_schedule(&host->finish_tasklet); |
1038 | } | 1037 | } |
1039 | 1038 | ||
@@ -1097,7 +1096,7 @@ static void wbsd_tasklet_crc(unsigned long param) | |||
1097 | 1096 | ||
1098 | DBGF("CRC error\n"); | 1097 | DBGF("CRC error\n"); |
1099 | 1098 | ||
1100 | data->error = MMC_ERR_BADCRC; | 1099 | data->error = -EILSEQ; |
1101 | 1100 | ||
1102 | tasklet_schedule(&host->finish_tasklet); | 1101 | tasklet_schedule(&host->finish_tasklet); |
1103 | 1102 | ||
@@ -1121,7 +1120,7 @@ static void wbsd_tasklet_timeout(unsigned long param) | |||
1121 | 1120 | ||
1122 | DBGF("Timeout\n"); | 1121 | DBGF("Timeout\n"); |
1123 | 1122 | ||
1124 | data->error = MMC_ERR_TIMEOUT; | 1123 | data->error = -ETIMEDOUT; |
1125 | 1124 | ||
1126 | tasklet_schedule(&host->finish_tasklet); | 1125 | tasklet_schedule(&host->finish_tasklet); |
1127 | 1126 | ||
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 63a80ea61124..a2b79518f051 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
@@ -54,12 +54,19 @@ struct mmc_command { | |||
54 | unsigned int retries; /* max number of retries */ | 54 | unsigned int retries; /* max number of retries */ |
55 | unsigned int error; /* command error */ | 55 | unsigned int error; /* command error */ |
56 | 56 | ||
57 | #define MMC_ERR_NONE 0 | 57 | /* |
58 | #define MMC_ERR_TIMEOUT 1 | 58 | * Standard errno values are used for errors, but some have specific |
59 | #define MMC_ERR_BADCRC 2 | 59 | * meaning in the MMC layer: |
60 | #define MMC_ERR_FIFO 3 | 60 | * |
61 | #define MMC_ERR_FAILED 4 | 61 | * ETIMEDOUT Card took too long to respond |
62 | #define MMC_ERR_INVALID 5 | 62 | * EILSEQ Basic format problem with the received or sent data |
63 | * (e.g. CRC check failed, incorrect opcode in response | ||
64 | * or bad end bit) | ||
65 | * EINVAL Request cannot be performed because of restrictions | ||
66 | * in hardware and/or the driver | ||
67 | * ENOMEDIUM Host can determine that the slot is empty and is | ||
68 | * actively failing requests | ||
69 | */ | ||
63 | 70 | ||
64 | struct mmc_data *data; /* data segment associated with cmd */ | 71 | struct mmc_data *data; /* data segment associated with cmd */ |
65 | struct mmc_request *mrq; /* associated request */ | 72 | struct mmc_request *mrq; /* associated request */ |