aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-06-27 17:55:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-06-27 17:55:43 -0400
commita64227b0855c42b5c037011afa80580ca3228527 (patch)
tree8633fc0989fd6e53c9f3f0bb5774c1a54bd5f18e /drivers
parentc6830c22603aaecf65405af23f6da2d55892f9cb (diff)
parentc31b55cd4eaf050bb5a15bd8251da1b3c7edeb1c (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: mmc: queue: bring discard_granularity/alignment into line with SCSI mmc: queue: append partition subname to queue thread name mmc: core: make erase timeout calculation allow for gated clock mmc: block: switch card to User Data Area when removing the block driver mmc: sdio: reset card during power_restore mmc: cb710: fix #ifdef HAVE_EFFICIENT_UNALIGNED_ACCESS mmc: sdhi: DMA slave ID 0 is invalid mmc: tmio: fix regression in TMIO_MMC_WRPROTECT_DISABLE handling mmc: omap_hsmmc: use original sg_len for dma_unmap_sg mmc: omap_hsmmc: fix ocr mask usage mmc: sdio: fix runtime PM path during driver removal mmc: Add PCI fixup quirks for Ricoh 1180:e823 reader mmc: sdhi: fix module unloading mmc: of_mmc_spi: add NO_IRQ define to of_mmc_spi.c mmc: vub300: fix null dereferences in error handling
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/cb710/sgbuf2.c2
-rw-r--r--drivers/mmc/card/block.c5
-rw-r--r--drivers/mmc/card/queue.c15
-rw-r--r--drivers/mmc/card/queue.h3
-rw-r--r--drivers/mmc/core/core.c2
-rw-r--r--drivers/mmc/core/sdio.c39
-rw-r--r--drivers/mmc/core/sdio_bus.c2
-rw-r--r--drivers/mmc/host/of_mmc_spi.c5
-rw-r--r--drivers/mmc/host/omap_hsmmc.c6
-rw-r--r--drivers/mmc/host/sh_mobile_sdhi.c5
-rw-r--r--drivers/mmc/host/tmio_mmc_pio.c4
-rw-r--r--drivers/mmc/host/vub300.c11
-rw-r--r--drivers/pci/quirks.c2
13 files changed, 73 insertions, 28 deletions
diff --git a/drivers/misc/cb710/sgbuf2.c b/drivers/misc/cb710/sgbuf2.c
index d019746551f3..2a40d0efdff5 100644
--- a/drivers/misc/cb710/sgbuf2.c
+++ b/drivers/misc/cb710/sgbuf2.c
@@ -47,7 +47,7 @@ static uint32_t sg_dwiter_read_buffer(struct sg_mapping_iter *miter)
47 47
48static inline bool needs_unaligned_copy(const void *ptr) 48static inline bool needs_unaligned_copy(const void *ptr)
49{ 49{
50#ifdef HAVE_EFFICIENT_UNALIGNED_ACCESS 50#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
51 return false; 51 return false;
52#else 52#else
53 return ((ptr - NULL) & 3) != 0; 53 return ((ptr - NULL) & 3) != 0;
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 71da5641e258..f85e42224559 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1024,7 +1024,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
1024 INIT_LIST_HEAD(&md->part); 1024 INIT_LIST_HEAD(&md->part);
1025 md->usage = 1; 1025 md->usage = 1;
1026 1026
1027 ret = mmc_init_queue(&md->queue, card, &md->lock); 1027 ret = mmc_init_queue(&md->queue, card, &md->lock, subname);
1028 if (ret) 1028 if (ret)
1029 goto err_putdisk; 1029 goto err_putdisk;
1030 1030
@@ -1297,6 +1297,9 @@ static void mmc_blk_remove(struct mmc_card *card)
1297 struct mmc_blk_data *md = mmc_get_drvdata(card); 1297 struct mmc_blk_data *md = mmc_get_drvdata(card);
1298 1298
1299 mmc_blk_remove_parts(card, md); 1299 mmc_blk_remove_parts(card, md);
1300 mmc_claim_host(card->host);
1301 mmc_blk_part_switch(card, md);
1302 mmc_release_host(card->host);
1300 mmc_blk_remove_req(md); 1303 mmc_blk_remove_req(md);
1301 mmc_set_drvdata(card, NULL); 1304 mmc_set_drvdata(card, NULL);
1302} 1305}
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index c07322c2658c..6413afa318d2 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -106,10 +106,12 @@ static void mmc_request(struct request_queue *q)
106 * @mq: mmc queue 106 * @mq: mmc queue
107 * @card: mmc card to attach this queue 107 * @card: mmc card to attach this queue
108 * @lock: queue lock 108 * @lock: queue lock
109 * @subname: partition subname
109 * 110 *
110 * Initialise a MMC card request queue. 111 * Initialise a MMC card request queue.
111 */ 112 */
112int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock) 113int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
114 spinlock_t *lock, const char *subname)
113{ 115{
114 struct mmc_host *host = card->host; 116 struct mmc_host *host = card->host;
115 u64 limit = BLK_BOUNCE_HIGH; 117 u64 limit = BLK_BOUNCE_HIGH;
@@ -133,12 +135,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
133 mq->queue->limits.max_discard_sectors = UINT_MAX; 135 mq->queue->limits.max_discard_sectors = UINT_MAX;
134 if (card->erased_byte == 0) 136 if (card->erased_byte == 0)
135 mq->queue->limits.discard_zeroes_data = 1; 137 mq->queue->limits.discard_zeroes_data = 1;
136 if (!mmc_can_trim(card) && is_power_of_2(card->erase_size)) { 138 mq->queue->limits.discard_granularity = card->pref_erase << 9;
137 mq->queue->limits.discard_granularity =
138 card->erase_size << 9;
139 mq->queue->limits.discard_alignment =
140 card->erase_size << 9;
141 }
142 if (mmc_can_secure_erase_trim(card)) 139 if (mmc_can_secure_erase_trim(card))
143 queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD, 140 queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD,
144 mq->queue); 141 mq->queue);
@@ -209,8 +206,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
209 206
210 sema_init(&mq->thread_sem, 1); 207 sema_init(&mq->thread_sem, 1);
211 208
212 mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d", 209 mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d%s",
213 host->index); 210 host->index, subname ? subname : "");
214 211
215 if (IS_ERR(mq->thread)) { 212 if (IS_ERR(mq->thread)) {
216 ret = PTR_ERR(mq->thread); 213 ret = PTR_ERR(mq->thread);
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h
index 64e66e0d4994..6223ef8dc9cd 100644
--- a/drivers/mmc/card/queue.h
+++ b/drivers/mmc/card/queue.h
@@ -19,7 +19,8 @@ struct mmc_queue {
19 unsigned int bounce_sg_len; 19 unsigned int bounce_sg_len;
20}; 20};
21 21
22extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *); 22extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
23 const char *);
23extern void mmc_cleanup_queue(struct mmc_queue *); 24extern void mmc_cleanup_queue(struct mmc_queue *);
24extern void mmc_queue_suspend(struct mmc_queue *); 25extern void mmc_queue_suspend(struct mmc_queue *);
25extern void mmc_queue_resume(struct mmc_queue *); 26extern void mmc_queue_resume(struct mmc_queue *);
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 68091dda3f31..7843efe22359 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1245,7 +1245,7 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
1245 */ 1245 */
1246 timeout_clks <<= 1; 1246 timeout_clks <<= 1;
1247 timeout_us += (timeout_clks * 1000) / 1247 timeout_us += (timeout_clks * 1000) /
1248 (card->host->ios.clock / 1000); 1248 (mmc_host_clk_rate(card->host) / 1000);
1249 1249
1250 erase_timeout = timeout_us / 1000; 1250 erase_timeout = timeout_us / 1000;
1251 1251
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 4d0c15bfa514..262fff019177 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -691,15 +691,54 @@ static int mmc_sdio_resume(struct mmc_host *host)
691static int mmc_sdio_power_restore(struct mmc_host *host) 691static int mmc_sdio_power_restore(struct mmc_host *host)
692{ 692{
693 int ret; 693 int ret;
694 u32 ocr;
694 695
695 BUG_ON(!host); 696 BUG_ON(!host);
696 BUG_ON(!host->card); 697 BUG_ON(!host->card);
697 698
698 mmc_claim_host(host); 699 mmc_claim_host(host);
700
701 /*
702 * Reset the card by performing the same steps that are taken by
703 * mmc_rescan_try_freq() and mmc_attach_sdio() during a "normal" probe.
704 *
705 * sdio_reset() is technically not needed. Having just powered up the
706 * hardware, it should already be in reset state. However, some
707 * platforms (such as SD8686 on OLPC) do not instantly cut power,
708 * meaning that a reset is required when restoring power soon after
709 * powering off. It is harmless in other cases.
710 *
711 * The CMD5 reset (mmc_send_io_op_cond()), according to the SDIO spec,
712 * is not necessary for non-removable cards. However, it is required
713 * for OLPC SD8686 (which expects a [CMD5,5,3,7] init sequence), and
714 * harmless in other situations.
715 *
716 * With these steps taken, mmc_select_voltage() is also required to
717 * restore the correct voltage setting of the card.
718 */
719 sdio_reset(host);
720 mmc_go_idle(host);
721 mmc_send_if_cond(host, host->ocr_avail);
722
723 ret = mmc_send_io_op_cond(host, 0, &ocr);
724 if (ret)
725 goto out;
726
727 if (host->ocr_avail_sdio)
728 host->ocr_avail = host->ocr_avail_sdio;
729
730 host->ocr = mmc_select_voltage(host, ocr & ~0x7F);
731 if (!host->ocr) {
732 ret = -EINVAL;
733 goto out;
734 }
735
699 ret = mmc_sdio_init_card(host, host->ocr, host->card, 736 ret = mmc_sdio_init_card(host, host->ocr, host->card,
700 mmc_card_keep_power(host)); 737 mmc_card_keep_power(host));
701 if (!ret && host->sdio_irqs) 738 if (!ret && host->sdio_irqs)
702 mmc_signal_sdio_irq(host); 739 mmc_signal_sdio_irq(host);
740
741out:
703 mmc_release_host(host); 742 mmc_release_host(host);
704 743
705 return ret; 744 return ret;
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index d29b9c36919a..d2565df8a7fb 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -189,7 +189,7 @@ static int sdio_bus_remove(struct device *dev)
189 189
190 /* Then undo the runtime PM settings in sdio_bus_probe() */ 190 /* Then undo the runtime PM settings in sdio_bus_probe() */
191 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) 191 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD)
192 pm_runtime_put_noidle(dev); 192 pm_runtime_put_sync(dev);
193 193
194out: 194out:
195 return ret; 195 return ret;
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index e2aecb7f1d5c..ab66f2454dc4 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -25,6 +25,11 @@
25#include <linux/mmc/core.h> 25#include <linux/mmc/core.h>
26#include <linux/mmc/host.h> 26#include <linux/mmc/host.h>
27 27
28/* For archs that don't support NO_IRQ (such as mips), provide a dummy value */
29#ifndef NO_IRQ
30#define NO_IRQ 0
31#endif
32
28MODULE_LICENSE("GPL"); 33MODULE_LICENSE("GPL");
29 34
30enum { 35enum {
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5b2e2155b413..dedf3dab8a3b 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -429,7 +429,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
429 return -EINVAL; 429 return -EINVAL;
430 } 430 }
431 } 431 }
432 mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg);
433 432
434 /* Allow an aux regulator */ 433 /* Allow an aux regulator */
435 reg = regulator_get(host->dev, "vmmc_aux"); 434 reg = regulator_get(host->dev, "vmmc_aux");
@@ -962,7 +961,8 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
962 spin_unlock(&host->irq_lock); 961 spin_unlock(&host->irq_lock);
963 962
964 if (host->use_dma && dma_ch != -1) { 963 if (host->use_dma && dma_ch != -1) {
965 dma_unmap_sg(mmc_dev(host->mmc), host->data->sg, host->dma_len, 964 dma_unmap_sg(mmc_dev(host->mmc), host->data->sg,
965 host->data->sg_len,
966 omap_hsmmc_get_dma_dir(host, host->data)); 966 omap_hsmmc_get_dma_dir(host, host->data));
967 omap_free_dma(dma_ch); 967 omap_free_dma(dma_ch);
968 } 968 }
@@ -1346,7 +1346,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data)
1346 return; 1346 return;
1347 } 1347 }
1348 1348
1349 dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->dma_len, 1349 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
1350 omap_hsmmc_get_dma_dir(host, data)); 1350 omap_hsmmc_get_dma_dir(host, data));
1351 1351
1352 req_in_progress = host->req_in_progress; 1352 req_in_progress = host->req_in_progress;
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index b3654293017b..ce500f03df85 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -92,7 +92,7 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
92 mmc_data->ocr_mask = p->tmio_ocr_mask; 92 mmc_data->ocr_mask = p->tmio_ocr_mask;
93 mmc_data->capabilities |= p->tmio_caps; 93 mmc_data->capabilities |= p->tmio_caps;
94 94
95 if (p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) { 95 if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) {
96 priv->param_tx.slave_id = p->dma_slave_tx; 96 priv->param_tx.slave_id = p->dma_slave_tx;
97 priv->param_rx.slave_id = p->dma_slave_rx; 97 priv->param_rx.slave_id = p->dma_slave_rx;
98 priv->dma_priv.chan_priv_tx = &priv->param_tx; 98 priv->dma_priv.chan_priv_tx = &priv->param_tx;
@@ -165,13 +165,14 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev)
165 165
166 p->pdata = NULL; 166 p->pdata = NULL;
167 167
168 tmio_mmc_host_remove(host);
169
168 for (i = 0; i < 3; i++) { 170 for (i = 0; i < 3; i++) {
169 irq = platform_get_irq(pdev, i); 171 irq = platform_get_irq(pdev, i);
170 if (irq >= 0) 172 if (irq >= 0)
171 free_irq(irq, host); 173 free_irq(irq, host);
172 } 174 }
173 175
174 tmio_mmc_host_remove(host);
175 clk_disable(priv->clk); 176 clk_disable(priv->clk);
176 clk_put(priv->clk); 177 clk_put(priv->clk);
177 kfree(priv); 178 kfree(priv);
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index ad6347bb02dd..0b09e8239aa0 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -824,8 +824,8 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc)
824 struct tmio_mmc_host *host = mmc_priv(mmc); 824 struct tmio_mmc_host *host = mmc_priv(mmc);
825 struct tmio_mmc_data *pdata = host->pdata; 825 struct tmio_mmc_data *pdata = host->pdata;
826 826
827 return ((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) || 827 return !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
828 !(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); 828 (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));
829} 829}
830 830
831static int tmio_mmc_get_cd(struct mmc_host *mmc) 831static int tmio_mmc_get_cd(struct mmc_host *mmc)
diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index cbb03305b77b..d4455ffbefd8 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -2096,7 +2096,7 @@ static struct mmc_host_ops vub300_mmc_ops = {
2096static int vub300_probe(struct usb_interface *interface, 2096static int vub300_probe(struct usb_interface *interface,
2097 const struct usb_device_id *id) 2097 const struct usb_device_id *id)
2098{ /* NOT irq */ 2098{ /* NOT irq */
2099 struct vub300_mmc_host *vub300 = NULL; 2099 struct vub300_mmc_host *vub300;
2100 struct usb_host_interface *iface_desc; 2100 struct usb_host_interface *iface_desc;
2101 struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface)); 2101 struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
2102 int i; 2102 int i;
@@ -2118,23 +2118,20 @@ static int vub300_probe(struct usb_interface *interface,
2118 command_out_urb = usb_alloc_urb(0, GFP_KERNEL); 2118 command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
2119 if (!command_out_urb) { 2119 if (!command_out_urb) {
2120 retval = -ENOMEM; 2120 retval = -ENOMEM;
2121 dev_err(&vub300->udev->dev, 2121 dev_err(&udev->dev, "not enough memory for command_out_urb\n");
2122 "not enough memory for the command_out_urb\n");
2123 goto error0; 2122 goto error0;
2124 } 2123 }
2125 command_res_urb = usb_alloc_urb(0, GFP_KERNEL); 2124 command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
2126 if (!command_res_urb) { 2125 if (!command_res_urb) {
2127 retval = -ENOMEM; 2126 retval = -ENOMEM;
2128 dev_err(&vub300->udev->dev, 2127 dev_err(&udev->dev, "not enough memory for command_res_urb\n");
2129 "not enough memory for the command_res_urb\n");
2130 goto error1; 2128 goto error1;
2131 } 2129 }
2132 /* this also allocates memory for our VUB300 mmc host device */ 2130 /* this also allocates memory for our VUB300 mmc host device */
2133 mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev); 2131 mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev);
2134 if (!mmc) { 2132 if (!mmc) {
2135 retval = -ENOMEM; 2133 retval = -ENOMEM;
2136 dev_err(&vub300->udev->dev, 2134 dev_err(&udev->dev, "not enough memory for the mmc_host\n");
2137 "not enough memory for the mmc_host\n");
2138 goto error4; 2135 goto error4;
2139 } 2136 }
2140 /* MMC core transfer sizes tunable parameters */ 2137 /* MMC core transfer sizes tunable parameters */
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index e8a140669f90..02145e9697a9 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2761,6 +2761,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2761} 2761}
2762DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2762DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2763DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2763DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2764DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2765DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2764#endif /*CONFIG_MMC_RICOH_MMC*/ 2766#endif /*CONFIG_MMC_RICOH_MMC*/
2765 2767
2766#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP) 2768#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)