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
This commit is contained in:
commit
a64227b085
14 changed files with 74 additions and 28 deletions
|
@ -47,7 +47,7 @@ static uint32_t sg_dwiter_read_buffer(struct sg_mapping_iter *miter)
|
|||
|
||||
static inline bool needs_unaligned_copy(const void *ptr)
|
||||
{
|
||||
#ifdef HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
return false;
|
||||
#else
|
||||
return ((ptr - NULL) & 3) != 0;
|
||||
|
|
|
@ -1024,7 +1024,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
|
|||
INIT_LIST_HEAD(&md->part);
|
||||
md->usage = 1;
|
||||
|
||||
ret = mmc_init_queue(&md->queue, card, &md->lock);
|
||||
ret = mmc_init_queue(&md->queue, card, &md->lock, subname);
|
||||
if (ret)
|
||||
goto err_putdisk;
|
||||
|
||||
|
@ -1297,6 +1297,9 @@ static void mmc_blk_remove(struct mmc_card *card)
|
|||
struct mmc_blk_data *md = mmc_get_drvdata(card);
|
||||
|
||||
mmc_blk_remove_parts(card, md);
|
||||
mmc_claim_host(card->host);
|
||||
mmc_blk_part_switch(card, md);
|
||||
mmc_release_host(card->host);
|
||||
mmc_blk_remove_req(md);
|
||||
mmc_set_drvdata(card, NULL);
|
||||
}
|
||||
|
|
|
@ -106,10 +106,12 @@ static void mmc_request(struct request_queue *q)
|
|||
* @mq: mmc queue
|
||||
* @card: mmc card to attach this queue
|
||||
* @lock: queue lock
|
||||
* @subname: partition subname
|
||||
*
|
||||
* Initialise a MMC card request queue.
|
||||
*/
|
||||
int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock)
|
||||
int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
|
||||
spinlock_t *lock, const char *subname)
|
||||
{
|
||||
struct mmc_host *host = card->host;
|
||||
u64 limit = BLK_BOUNCE_HIGH;
|
||||
|
@ -133,12 +135,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
|
|||
mq->queue->limits.max_discard_sectors = UINT_MAX;
|
||||
if (card->erased_byte == 0)
|
||||
mq->queue->limits.discard_zeroes_data = 1;
|
||||
if (!mmc_can_trim(card) && is_power_of_2(card->erase_size)) {
|
||||
mq->queue->limits.discard_granularity =
|
||||
card->erase_size << 9;
|
||||
mq->queue->limits.discard_alignment =
|
||||
card->erase_size << 9;
|
||||
}
|
||||
mq->queue->limits.discard_granularity = card->pref_erase << 9;
|
||||
if (mmc_can_secure_erase_trim(card))
|
||||
queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD,
|
||||
mq->queue);
|
||||
|
@ -209,8 +206,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
|
|||
|
||||
sema_init(&mq->thread_sem, 1);
|
||||
|
||||
mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d",
|
||||
host->index);
|
||||
mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d%s",
|
||||
host->index, subname ? subname : "");
|
||||
|
||||
if (IS_ERR(mq->thread)) {
|
||||
ret = PTR_ERR(mq->thread);
|
||||
|
|
|
@ -19,7 +19,8 @@ struct mmc_queue {
|
|||
unsigned int bounce_sg_len;
|
||||
};
|
||||
|
||||
extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *);
|
||||
extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
|
||||
const char *);
|
||||
extern void mmc_cleanup_queue(struct mmc_queue *);
|
||||
extern void mmc_queue_suspend(struct mmc_queue *);
|
||||
extern void mmc_queue_resume(struct mmc_queue *);
|
||||
|
|
|
@ -1245,7 +1245,7 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
|
|||
*/
|
||||
timeout_clks <<= 1;
|
||||
timeout_us += (timeout_clks * 1000) /
|
||||
(card->host->ios.clock / 1000);
|
||||
(mmc_host_clk_rate(card->host) / 1000);
|
||||
|
||||
erase_timeout = timeout_us / 1000;
|
||||
|
||||
|
|
|
@ -691,15 +691,54 @@ static int mmc_sdio_resume(struct mmc_host *host)
|
|||
static int mmc_sdio_power_restore(struct mmc_host *host)
|
||||
{
|
||||
int ret;
|
||||
u32 ocr;
|
||||
|
||||
BUG_ON(!host);
|
||||
BUG_ON(!host->card);
|
||||
|
||||
mmc_claim_host(host);
|
||||
|
||||
/*
|
||||
* Reset the card by performing the same steps that are taken by
|
||||
* mmc_rescan_try_freq() and mmc_attach_sdio() during a "normal" probe.
|
||||
*
|
||||
* sdio_reset() is technically not needed. Having just powered up the
|
||||
* hardware, it should already be in reset state. However, some
|
||||
* platforms (such as SD8686 on OLPC) do not instantly cut power,
|
||||
* meaning that a reset is required when restoring power soon after
|
||||
* powering off. It is harmless in other cases.
|
||||
*
|
||||
* The CMD5 reset (mmc_send_io_op_cond()), according to the SDIO spec,
|
||||
* is not necessary for non-removable cards. However, it is required
|
||||
* for OLPC SD8686 (which expects a [CMD5,5,3,7] init sequence), and
|
||||
* harmless in other situations.
|
||||
*
|
||||
* With these steps taken, mmc_select_voltage() is also required to
|
||||
* restore the correct voltage setting of the card.
|
||||
*/
|
||||
sdio_reset(host);
|
||||
mmc_go_idle(host);
|
||||
mmc_send_if_cond(host, host->ocr_avail);
|
||||
|
||||
ret = mmc_send_io_op_cond(host, 0, &ocr);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (host->ocr_avail_sdio)
|
||||
host->ocr_avail = host->ocr_avail_sdio;
|
||||
|
||||
host->ocr = mmc_select_voltage(host, ocr & ~0x7F);
|
||||
if (!host->ocr) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = mmc_sdio_init_card(host, host->ocr, host->card,
|
||||
mmc_card_keep_power(host));
|
||||
if (!ret && host->sdio_irqs)
|
||||
mmc_signal_sdio_irq(host);
|
||||
|
||||
out:
|
||||
mmc_release_host(host);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -189,7 +189,7 @@ static int sdio_bus_remove(struct device *dev)
|
|||
|
||||
/* Then undo the runtime PM settings in sdio_bus_probe() */
|
||||
if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD)
|
||||
pm_runtime_put_noidle(dev);
|
||||
pm_runtime_put_sync(dev);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
#include <linux/mmc/core.h>
|
||||
#include <linux/mmc/host.h>
|
||||
|
||||
/* For archs that don't support NO_IRQ (such as mips), provide a dummy value */
|
||||
#ifndef NO_IRQ
|
||||
#define NO_IRQ 0
|
||||
#endif
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
enum {
|
||||
|
|
|
@ -429,7 +429,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
|
|||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg);
|
||||
|
||||
/* Allow an aux regulator */
|
||||
reg = regulator_get(host->dev, "vmmc_aux");
|
||||
|
@ -962,7 +961,8 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
|
|||
spin_unlock(&host->irq_lock);
|
||||
|
||||
if (host->use_dma && dma_ch != -1) {
|
||||
dma_unmap_sg(mmc_dev(host->mmc), host->data->sg, host->dma_len,
|
||||
dma_unmap_sg(mmc_dev(host->mmc), host->data->sg,
|
||||
host->data->sg_len,
|
||||
omap_hsmmc_get_dma_dir(host, host->data));
|
||||
omap_free_dma(dma_ch);
|
||||
}
|
||||
|
@ -1346,7 +1346,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data)
|
|||
return;
|
||||
}
|
||||
|
||||
dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->dma_len,
|
||||
dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
|
||||
omap_hsmmc_get_dma_dir(host, data));
|
||||
|
||||
req_in_progress = host->req_in_progress;
|
||||
|
|
|
@ -92,7 +92,7 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
|
|||
mmc_data->ocr_mask = p->tmio_ocr_mask;
|
||||
mmc_data->capabilities |= p->tmio_caps;
|
||||
|
||||
if (p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
|
||||
if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) {
|
||||
priv->param_tx.slave_id = p->dma_slave_tx;
|
||||
priv->param_rx.slave_id = p->dma_slave_rx;
|
||||
priv->dma_priv.chan_priv_tx = &priv->param_tx;
|
||||
|
@ -165,13 +165,14 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev)
|
|||
|
||||
p->pdata = NULL;
|
||||
|
||||
tmio_mmc_host_remove(host);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
irq = platform_get_irq(pdev, i);
|
||||
if (irq >= 0)
|
||||
free_irq(irq, host);
|
||||
}
|
||||
|
||||
tmio_mmc_host_remove(host);
|
||||
clk_disable(priv->clk);
|
||||
clk_put(priv->clk);
|
||||
kfree(priv);
|
||||
|
|
|
@ -824,8 +824,8 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc)
|
|||
struct tmio_mmc_host *host = mmc_priv(mmc);
|
||||
struct tmio_mmc_data *pdata = host->pdata;
|
||||
|
||||
return ((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
|
||||
!(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));
|
||||
return !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
|
||||
(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));
|
||||
}
|
||||
|
||||
static int tmio_mmc_get_cd(struct mmc_host *mmc)
|
||||
|
|
|
@ -2096,7 +2096,7 @@ static struct mmc_host_ops vub300_mmc_ops = {
|
|||
static int vub300_probe(struct usb_interface *interface,
|
||||
const struct usb_device_id *id)
|
||||
{ /* NOT irq */
|
||||
struct vub300_mmc_host *vub300 = NULL;
|
||||
struct vub300_mmc_host *vub300;
|
||||
struct usb_host_interface *iface_desc;
|
||||
struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
int i;
|
||||
|
@ -2118,23 +2118,20 @@ static int vub300_probe(struct usb_interface *interface,
|
|||
command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!command_out_urb) {
|
||||
retval = -ENOMEM;
|
||||
dev_err(&vub300->udev->dev,
|
||||
"not enough memory for the command_out_urb\n");
|
||||
dev_err(&udev->dev, "not enough memory for command_out_urb\n");
|
||||
goto error0;
|
||||
}
|
||||
command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!command_res_urb) {
|
||||
retval = -ENOMEM;
|
||||
dev_err(&vub300->udev->dev,
|
||||
"not enough memory for the command_res_urb\n");
|
||||
dev_err(&udev->dev, "not enough memory for command_res_urb\n");
|
||||
goto error1;
|
||||
}
|
||||
/* this also allocates memory for our VUB300 mmc host device */
|
||||
mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev);
|
||||
if (!mmc) {
|
||||
retval = -ENOMEM;
|
||||
dev_err(&vub300->udev->dev,
|
||||
"not enough memory for the mmc_host\n");
|
||||
dev_err(&udev->dev, "not enough memory for the mmc_host\n");
|
||||
goto error4;
|
||||
}
|
||||
/* MMC core transfer sizes tunable parameters */
|
||||
|
|
|
@ -2761,6 +2761,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
|
|||
}
|
||||
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
|
||||
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
|
||||
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
|
||||
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
|
||||
#endif /*CONFIG_MMC_RICOH_MMC*/
|
||||
|
||||
#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
|
||||
|
|
|
@ -1537,6 +1537,7 @@
|
|||
#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
|
||||
#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
|
||||
#define PCI_DEVICE_ID_RICOH_R5C822 0x0822
|
||||
#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823
|
||||
#define PCI_DEVICE_ID_RICOH_R5C832 0x0832
|
||||
#define PCI_DEVICE_ID_RICOH_R5C843 0x0843
|
||||
|
||||
|
|
Loading…
Reference in a new issue