diff options
Diffstat (limited to 'drivers/mmc/host/at91_mci.c')
-rw-r--r-- | drivers/mmc/host/at91_mci.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 6915f40ac8ab..1f8b5b36222c 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -621,12 +621,21 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command | |||
621 | if (cpu_is_at91sam9260 () || cpu_is_at91sam9263()) | 621 | if (cpu_is_at91sam9260 () || cpu_is_at91sam9263()) |
622 | if (host->total_length < 12) | 622 | if (host->total_length < 12) |
623 | host->total_length = 12; | 623 | host->total_length = 12; |
624 | host->buffer = dma_alloc_coherent(NULL, | 624 | |
625 | host->total_length, | 625 | host->buffer = kmalloc(host->total_length, GFP_KERNEL); |
626 | &host->physical_address, GFP_KERNEL); | 626 | if (!host->buffer) { |
627 | pr_debug("Can't alloc tx buffer\n"); | ||
628 | cmd->error = -ENOMEM; | ||
629 | mmc_request_done(host->mmc, host->request); | ||
630 | return; | ||
631 | } | ||
627 | 632 | ||
628 | at91_mci_sg_to_dma(host, data); | 633 | at91_mci_sg_to_dma(host, data); |
629 | 634 | ||
635 | host->physical_address = dma_map_single(NULL, | ||
636 | host->buffer, host->total_length, | ||
637 | DMA_TO_DEVICE); | ||
638 | |||
630 | pr_debug("Transmitting %d bytes\n", host->total_length); | 639 | pr_debug("Transmitting %d bytes\n", host->total_length); |
631 | 640 | ||
632 | at91_mci_write(host, ATMEL_PDC_TPR, host->physical_address); | 641 | at91_mci_write(host, ATMEL_PDC_TPR, host->physical_address); |
@@ -694,7 +703,10 @@ static void at91_mci_completed_command(struct at91mci_host *host, unsigned int s | |||
694 | cmd->resp[3] = at91_mci_read(host, AT91_MCI_RSPR(3)); | 703 | cmd->resp[3] = at91_mci_read(host, AT91_MCI_RSPR(3)); |
695 | 704 | ||
696 | if (host->buffer) { | 705 | if (host->buffer) { |
697 | dma_free_coherent(NULL, host->total_length, host->buffer, host->physical_address); | 706 | dma_unmap_single(NULL, |
707 | host->physical_address, host->total_length, | ||
708 | DMA_TO_DEVICE); | ||
709 | kfree(host->buffer); | ||
698 | host->buffer = NULL; | 710 | host->buffer = NULL; |
699 | } | 711 | } |
700 | 712 | ||