aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-10-07 14:08:56 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-07 14:08:56 -0400
commit5a89770daad83df74d77a8d34a1ffaedae565ce9 (patch)
tree0d8ef70293a6ef969ba8b7718e59608337643d40 /drivers/mmc
parentc46c948260f41af18b277c1eb1895d788d3605dc (diff)
parentaf7c951d76708c61b862463d579d76be757130bf (diff)
Merge branches 'pxa-core' and 'pxa-machines' into pxa-all
Conflicts: arch/arm/mach-pxa/Kconfig arch/arm/mach-pxa/pxa25x.c arch/arm/mach-pxa/pxa27x.c
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/card/block.c4
-rw-r--r--drivers/mmc/host/at91_mci.c20
2 files changed, 19 insertions, 5 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 86dbb366415a..6986f3926244 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -103,8 +103,10 @@ static int mmc_blk_open(struct inode *inode, struct file *filp)
103 check_disk_change(inode->i_bdev); 103 check_disk_change(inode->i_bdev);
104 ret = 0; 104 ret = 0;
105 105
106 if ((filp->f_mode & FMODE_WRITE) && md->read_only) 106 if ((filp->f_mode & FMODE_WRITE) && md->read_only) {
107 mmc_blk_put(md);
107 ret = -EROFS; 108 ret = -EROFS;
109 }
108 } 110 }
109 111
110 return ret; 112 return ret;
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