diff options
Diffstat (limited to 'drivers/mmc/host/at91_mci.c')
-rw-r--r-- | drivers/mmc/host/at91_mci.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 955ea60583b5..6ba98a49612d 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -328,7 +328,7 @@ static void at91_mci_handle_transmitted(struct at91mci_host *host) | |||
328 | data = cmd->data; | 328 | data = cmd->data; |
329 | if (!data) return; | 329 | if (!data) return; |
330 | 330 | ||
331 | if (cmd->data->flags & MMC_DATA_MULTI) { | 331 | if (cmd->data->blocks > 1) { |
332 | pr_debug("multiple write : wait for BLKE...\n"); | 332 | pr_debug("multiple write : wait for BLKE...\n"); |
333 | at91_mci_write(host, AT91_MCI_IER, AT91_MCI_BLKE); | 333 | at91_mci_write(host, AT91_MCI_IER, AT91_MCI_BLKE); |
334 | } else | 334 | } else |
@@ -428,6 +428,14 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command | |||
428 | } | 428 | } |
429 | 429 | ||
430 | if (data) { | 430 | if (data) { |
431 | |||
432 | if ( data->blksz & 0x3 ) { | ||
433 | pr_debug("Unsupported block size\n"); | ||
434 | cmd->error = -EINVAL; | ||
435 | mmc_request_done(host->mmc, host->request); | ||
436 | return; | ||
437 | } | ||
438 | |||
431 | block_length = data->blksz; | 439 | block_length = data->blksz; |
432 | blocks = data->blocks; | 440 | blocks = data->blocks; |
433 | 441 | ||
@@ -439,7 +447,7 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command | |||
439 | 447 | ||
440 | if (data->flags & MMC_DATA_STREAM) | 448 | if (data->flags & MMC_DATA_STREAM) |
441 | cmdr |= AT91_MCI_TRTYP_STREAM; | 449 | cmdr |= AT91_MCI_TRTYP_STREAM; |
442 | if (data->flags & MMC_DATA_MULTI) | 450 | if (data->blocks > 1) |
443 | cmdr |= AT91_MCI_TRTYP_MULTIPLE; | 451 | cmdr |= AT91_MCI_TRTYP_MULTIPLE; |
444 | } | 452 | } |
445 | else { | 453 | else { |
@@ -577,24 +585,22 @@ static void at91_mci_completed_command(struct at91mci_host *host) | |||
577 | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | | 585 | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | |
578 | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { | 586 | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { |
579 | if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) { | 587 | if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) { |
580 | cmd->error = MMC_ERR_NONE; | 588 | cmd->error = 0; |
581 | } | 589 | } |
582 | else { | 590 | else { |
583 | if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE)) | 591 | if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE)) |
584 | cmd->error = MMC_ERR_TIMEOUT; | 592 | cmd->error = -ETIMEDOUT; |
585 | else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE)) | 593 | else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE)) |
586 | cmd->error = MMC_ERR_BADCRC; | 594 | cmd->error = -EILSEQ; |
587 | else if (status & (AT91_MCI_OVRE | AT91_MCI_UNRE)) | ||
588 | cmd->error = MMC_ERR_FIFO; | ||
589 | else | 595 | else |
590 | cmd->error = MMC_ERR_FAILED; | 596 | cmd->error = -EIO; |
591 | 597 | ||
592 | pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n", | 598 | pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n", |
593 | cmd->error, cmd->opcode, cmd->retries); | 599 | cmd->error, cmd->opcode, cmd->retries); |
594 | } | 600 | } |
595 | } | 601 | } |
596 | else | 602 | else |
597 | cmd->error = MMC_ERR_NONE; | 603 | cmd->error = 0; |
598 | 604 | ||
599 | at91_mci_process_next(host); | 605 | at91_mci_process_next(host); |
600 | } | 606 | } |
@@ -836,7 +842,6 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
836 | mmc->f_min = 375000; | 842 | mmc->f_min = 375000; |
837 | mmc->f_max = 25000000; | 843 | mmc->f_max = 25000000; |
838 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 844 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
839 | mmc->caps = MMC_CAP_BYTEBLOCK; | ||
840 | 845 | ||
841 | mmc->max_blk_size = 4095; | 846 | mmc->max_blk_size = 4095; |
842 | mmc->max_blk_count = mmc->max_req_size; | 847 | mmc->max_blk_count = mmc->max_req_size; |