]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blobdiff - drivers/mmc/host/atmel-mci.c
Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
[mirror_ubuntu-kernels.git] / drivers / mmc / host / atmel-mci.c
index 492854b09d89152aeb9c759e0a54b9f3be534590..9819dc09ce08d24f7bd2924fd35d786cc013b0ac 100644 (file)
@@ -972,11 +972,14 @@ static void atmci_start_request(struct atmel_mci *host,
        host->data_status = 0;
 
        if (host->need_reset) {
+               iflags = atmci_readl(host, ATMCI_IMR);
+               iflags &= (ATMCI_SDIOIRQA | ATMCI_SDIOIRQB);
                atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
                atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
                atmci_writel(host, ATMCI_MR, host->mode_reg);
                if (host->caps.has_cfg_reg)
                        atmci_writel(host, ATMCI_CFG, host->cfg_reg);
+               atmci_writel(host, ATMCI_IER, iflags);
                host->need_reset = false;
        }
        atmci_writel(host, ATMCI_SDCR, slot->sdc_reg);
@@ -1948,12 +1951,12 @@ static bool atmci_filter(struct dma_chan *chan, void *slave)
        }
 }
 
-static void atmci_configure_dma(struct atmel_mci *host)
+static bool atmci_configure_dma(struct atmel_mci *host)
 {
        struct mci_platform_data        *pdata;
 
        if (host == NULL)
-               return;
+               return false;
 
        pdata = host->pdev->dev.platform_data;
 
@@ -1967,10 +1970,11 @@ static void atmci_configure_dma(struct atmel_mci *host)
                        dma_request_channel(mask, atmci_filter, pdata->dma_slave);
        }
        if (!host->dma.chan) {
-               dev_notice(&host->pdev->dev, "DMA not available, using PIO\n");
+               dev_warn(&host->pdev->dev, "no DMA channel available\n");
+               return false;
        } else {
                dev_info(&host->pdev->dev,
-                                       "Using %s for DMA transfers\n",
+                                       "using %s for DMA transfers\n",
                                        dma_chan_name(host->dma.chan));
 
                host->dma_conf.src_addr = host->mapbase + ATMCI_RDR;
@@ -1980,6 +1984,7 @@ static void atmci_configure_dma(struct atmel_mci *host)
                host->dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
                host->dma_conf.dst_maxburst = 1;
                host->dma_conf.device_fc = false;
+               return true;
        }
 }
 
@@ -2090,8 +2095,7 @@ static int __init atmci_probe(struct platform_device *pdev)
 
        /* Get MCI capabilities and set operations according to it */
        atmci_get_cap(host);
-       if (host->caps.has_dma) {
-               dev_info(&pdev->dev, "using DMA\n");
+       if (host->caps.has_dma && atmci_configure_dma(host)) {
                host->prepare_data = &atmci_prepare_data_dma;
                host->submit_data = &atmci_submit_data_dma;
                host->stop_transfer = &atmci_stop_transfer_dma;
@@ -2101,15 +2105,12 @@ static int __init atmci_probe(struct platform_device *pdev)
                host->submit_data = &atmci_submit_data_pdc;
                host->stop_transfer = &atmci_stop_transfer_pdc;
        } else {
-               dev_info(&pdev->dev, "no DMA, no PDC\n");
+               dev_info(&pdev->dev, "using PIO\n");
                host->prepare_data = &atmci_prepare_data;
                host->submit_data = &atmci_submit_data;
                host->stop_transfer = &atmci_stop_transfer;
        }
 
-       if (host->caps.has_dma)
-               atmci_configure_dma(host);
-
        platform_set_drvdata(pdev, host);
 
        /* We need at least one slot to succeed */