diff options
Diffstat (limited to 'drivers/mmc')
| -rw-r--r-- | drivers/mmc/card/block.c | 13 | ||||
| -rw-r--r-- | drivers/mmc/card/mmc_test.c | 4 | ||||
| -rw-r--r-- | drivers/mmc/host/at91_mci.c | 20 | ||||
| -rw-r--r-- | drivers/mmc/host/atmel-mci.c | 12 | ||||
| -rw-r--r-- | drivers/mmc/host/tmio_mmc.h | 4 |
5 files changed, 37 insertions, 16 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 86dbb366415a..ebc8b9d77613 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; |
| @@ -613,14 +615,19 @@ static struct mmc_driver mmc_driver = { | |||
| 613 | 615 | ||
| 614 | static int __init mmc_blk_init(void) | 616 | static int __init mmc_blk_init(void) |
| 615 | { | 617 | { |
| 616 | int res = -ENOMEM; | 618 | int res; |
| 617 | 619 | ||
| 618 | res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); | 620 | res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); |
| 619 | if (res) | 621 | if (res) |
| 620 | goto out; | 622 | goto out; |
| 621 | 623 | ||
| 622 | return mmc_register_driver(&mmc_driver); | 624 | res = mmc_register_driver(&mmc_driver); |
| 625 | if (res) | ||
| 626 | goto out2; | ||
| 623 | 627 | ||
| 628 | return 0; | ||
| 629 | out2: | ||
| 630 | unregister_blkdev(MMC_BLOCK_MAJOR, "mmc"); | ||
| 624 | out: | 631 | out: |
| 625 | return res; | 632 | return res; |
| 626 | } | 633 | } |
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index f26b01d811ae..b92b172074ee 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
| @@ -1040,7 +1040,7 @@ static const struct mmc_test_case mmc_test_cases[] = { | |||
| 1040 | 1040 | ||
| 1041 | }; | 1041 | }; |
| 1042 | 1042 | ||
| 1043 | static struct mutex mmc_test_lock; | 1043 | static DEFINE_MUTEX(mmc_test_lock); |
| 1044 | 1044 | ||
| 1045 | static void mmc_test_run(struct mmc_test_card *test, int testcase) | 1045 | static void mmc_test_run(struct mmc_test_card *test, int testcase) |
| 1046 | { | 1046 | { |
| @@ -1171,8 +1171,6 @@ static int mmc_test_probe(struct mmc_card *card) | |||
| 1171 | if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD)) | 1171 | if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD)) |
| 1172 | return -ENODEV; | 1172 | return -ENODEV; |
| 1173 | 1173 | ||
| 1174 | mutex_init(&mmc_test_lock); | ||
| 1175 | |||
| 1176 | ret = device_create_file(&card->dev, &dev_attr_test); | 1174 | ret = device_create_file(&card->dev, &dev_attr_test); |
| 1177 | if (ret) | 1175 | if (ret) |
| 1178 | return ret; | 1176 | 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 | ||
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 0bd06f5bd62f..917035e16da4 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
| @@ -195,7 +195,9 @@ static int atmci_regs_show(struct seq_file *s, void *v) | |||
| 195 | 195 | ||
| 196 | /* Grab a more or less consistent snapshot */ | 196 | /* Grab a more or less consistent snapshot */ |
| 197 | spin_lock_irq(&host->mmc->lock); | 197 | spin_lock_irq(&host->mmc->lock); |
| 198 | clk_enable(host->mck); | ||
| 198 | memcpy_fromio(buf, host->regs, MCI_REGS_SIZE); | 199 | memcpy_fromio(buf, host->regs, MCI_REGS_SIZE); |
| 200 | clk_disable(host->mck); | ||
| 199 | spin_unlock_irq(&host->mmc->lock); | 201 | spin_unlock_irq(&host->mmc->lock); |
| 200 | 202 | ||
| 201 | seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n", | 203 | seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n", |
| @@ -216,6 +218,8 @@ static int atmci_regs_show(struct seq_file *s, void *v) | |||
| 216 | atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]); | 218 | atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]); |
| 217 | atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]); | 219 | atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]); |
| 218 | 220 | ||
| 221 | kfree(buf); | ||
| 222 | |||
| 219 | return 0; | 223 | return 0; |
| 220 | } | 224 | } |
| 221 | 225 | ||
| @@ -237,7 +241,6 @@ static void atmci_init_debugfs(struct atmel_mci *host) | |||
| 237 | struct mmc_host *mmc; | 241 | struct mmc_host *mmc; |
| 238 | struct dentry *root; | 242 | struct dentry *root; |
| 239 | struct dentry *node; | 243 | struct dentry *node; |
| 240 | struct resource *res; | ||
| 241 | 244 | ||
| 242 | mmc = host->mmc; | 245 | mmc = host->mmc; |
| 243 | root = mmc->debugfs_root; | 246 | root = mmc->debugfs_root; |
| @@ -251,9 +254,6 @@ static void atmci_init_debugfs(struct atmel_mci *host) | |||
| 251 | if (!node) | 254 | if (!node) |
| 252 | goto err; | 255 | goto err; |
| 253 | 256 | ||
| 254 | res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0); | ||
| 255 | node->d_inode->i_size = res->end - res->start + 1; | ||
| 256 | |||
| 257 | node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops); | 257 | node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops); |
| 258 | if (!node) | 258 | if (!node) |
| 259 | goto err; | 259 | goto err; |
| @@ -1059,6 +1059,10 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
| 1059 | host->present = !gpio_get_value(host->detect_pin); | 1059 | host->present = !gpio_get_value(host->detect_pin); |
| 1060 | } | 1060 | } |
| 1061 | } | 1061 | } |
| 1062 | |||
| 1063 | if (!gpio_is_valid(host->detect_pin)) | ||
| 1064 | mmc->caps |= MMC_CAP_NEEDS_POLL; | ||
| 1065 | |||
| 1062 | if (gpio_is_valid(host->wp_pin)) { | 1066 | if (gpio_is_valid(host->wp_pin)) { |
| 1063 | if (gpio_request(host->wp_pin, "mmc_wp")) { | 1067 | if (gpio_request(host->wp_pin, "mmc_wp")) { |
| 1064 | dev_dbg(&mmc->class_dev, "no WP pin available\n"); | 1068 | dev_dbg(&mmc->class_dev, "no WP pin available\n"); |
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 9e647a06054f..ba2b4240a86a 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h | |||
| @@ -159,10 +159,10 @@ static inline void tmio_mmc_kunmap_atomic(struct tmio_mmc_host *host, | |||
| 159 | #define STATUS_TO_TEXT(a) \ | 159 | #define STATUS_TO_TEXT(a) \ |
| 160 | do { \ | 160 | do { \ |
| 161 | if (status & TMIO_STAT_##a) \ | 161 | if (status & TMIO_STAT_##a) \ |
| 162 | printf(#a); \ | 162 | printk(#a); \ |
| 163 | } while (0) | 163 | } while (0) |
| 164 | 164 | ||
| 165 | void debug_status(u32 status) | 165 | void pr_debug_status(u32 status) |
| 166 | { | 166 | { |
| 167 | printk(KERN_DEBUG "status: %08x = ", status); | 167 | printk(KERN_DEBUG "status: %08x = ", status); |
| 168 | STATUS_TO_TEXT(CARD_REMOVE); | 168 | STATUS_TO_TEXT(CARD_REMOVE); |
