Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 109409
b: refs/heads/master
c: e385ea6
h: refs/heads/master
i:
  109407: edd50a9
v: v3
  • Loading branch information
David Brownell authored and Linus Torvalds committed Sep 3, 2008
1 parent a686f63 commit 4cd2ee5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 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: 363f66fe06c75270b669c88e321e6b354ba0201e
refs/heads/master: e385ea63f44b475e034a78b6d8bc6bb50caf72ca
20 changes: 16 additions & 4 deletions trunk/drivers/mmc/host/at91_mci.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,12 +621,21 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command
if (cpu_is_at91sam9260 () || cpu_is_at91sam9263())
if (host->total_length < 12)
host->total_length = 12;
host->buffer = dma_alloc_coherent(NULL,
host->total_length,
&host->physical_address, GFP_KERNEL);

host->buffer = kmalloc(host->total_length, GFP_KERNEL);
if (!host->buffer) {
pr_debug("Can't alloc tx buffer\n");
cmd->error = -ENOMEM;
mmc_request_done(host->mmc, host->request);
return;
}

at91_mci_sg_to_dma(host, data);

host->physical_address = dma_map_single(NULL,
host->buffer, host->total_length,
DMA_TO_DEVICE);

pr_debug("Transmitting %d bytes\n", host->total_length);

at91_mci_write(host, ATMEL_PDC_TPR, host->physical_address);
Expand Down Expand Up @@ -694,7 +703,10 @@ static void at91_mci_completed_command(struct at91mci_host *host, unsigned int s
cmd->resp[3] = at91_mci_read(host, AT91_MCI_RSPR(3));

if (host->buffer) {
dma_free_coherent(NULL, host->total_length, host->buffer, host->physical_address);
dma_unmap_single(NULL,
host->physical_address, host->total_length,
DMA_TO_DEVICE);
kfree(host->buffer);
host->buffer = NULL;
}

Expand Down

0 comments on commit 4cd2ee5

Please sign in to comment.