mmc: remove the "state" argument to mmc_suspend_host()
[firefly-linux-kernel-4.4.55.git] / drivers / mmc / host / mxcmmc.c
index 51e880c8f193edb0185c641b50276f1f80a79693..d9d4a72e0ec792d42386d21afcf327fa5b59f69c 100644 (file)
@@ -489,6 +489,9 @@ static void mxcmci_datawork(struct work_struct *work)
        struct mxcmci_host *host = container_of(work, struct mxcmci_host,
                                                  datawork);
        int datastat = mxcmci_transfer_data(host);
+
+       writel(STATUS_READ_OP_DONE | STATUS_WRITE_OP_DONE,
+               host->base + MMC_REG_STATUS);
        mxcmci_finish_data(host, datastat);
 
        if (host->req->stop) {
@@ -553,7 +556,8 @@ static irqreturn_t mxcmci_irq(int irq, void *devid)
        u32 stat;
 
        stat = readl(host->base + MMC_REG_STATUS);
-       writel(stat & ~STATUS_SDIO_INT_ACTIVE, host->base + MMC_REG_STATUS);
+       writel(stat & ~(STATUS_SDIO_INT_ACTIVE | STATUS_DATA_TRANS_DONE |
+                       STATUS_WRITE_OP_DONE), host->base + MMC_REG_STATUS);
 
        dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat);
 
@@ -561,6 +565,13 @@ static irqreturn_t mxcmci_irq(int irq, void *devid)
        sdio_irq = (stat & STATUS_SDIO_INT_ACTIVE) && host->use_sdio;
        spin_unlock_irqrestore(&host->lock, flags);
 
+#ifdef HAS_DMA
+       if (mxcmci_use_dma(host) &&
+           (stat & (STATUS_READ_OP_DONE | STATUS_WRITE_OP_DONE)))
+               writel(STATUS_READ_OP_DONE | STATUS_WRITE_OP_DONE,
+                       host->base + MMC_REG_STATUS);
+#endif
+
        if (sdio_irq) {
                writel(STATUS_SDIO_INT_ACTIVE, host->base + MMC_REG_STATUS);
                mmc_signal_sdio_irq(host->mmc);
@@ -724,11 +735,27 @@ static void mxcmci_enable_sdio_irq(struct mmc_host *mmc, int enable)
        spin_unlock_irqrestore(&host->lock, flags);
 }
 
+static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card)
+{
+       /*
+        * MX3 SoCs have a silicon bug which corrupts CRC calculation of
+        * multi-block transfers when connected SDIO peripheral doesn't
+        * drive the BUSY line as required by the specs.
+        * One way to prevent this is to only allow 1-bit transfers.
+        */
+
+       if (cpu_is_mx3() && card->type == MMC_TYPE_SDIO)
+               host->caps &= ~MMC_CAP_4_BIT_DATA;
+       else
+               host->caps |= MMC_CAP_4_BIT_DATA;
+}
+
 static const struct mmc_host_ops mxcmci_ops = {
        .request                = mxcmci_request,
        .set_ios                = mxcmci_set_ios,
        .get_ro                 = mxcmci_get_ro,
        .enable_sdio_irq        = mxcmci_enable_sdio_irq,
+       .init_card              = mxcmci_init_card,
 };
 
 static int mxcmci_probe(struct platform_device *pdev)
@@ -905,7 +932,7 @@ static int mxcmci_suspend(struct platform_device *dev, pm_message_t state)
        int ret = 0;
 
        if (mmc)
-               ret = mmc_suspend_host(mmc, state);
+               ret = mmc_suspend_host(mmc);
 
        return ret;
 }