]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mmc/mmci.c
[ARM] 3472/1: Use the D variants of FLDMIA/FSTMIA on ARMv6
[linux-2.6-omap-h63xx.git] / drivers / mmc / mmci.c
index 6d161c70014ae6bfffa67cdfd02b08010ae79150..df7e861e2fc75f2c5cfa5e5196b70b597378ecd9 100644 (file)
 #include <linux/highmem.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/protocol.h>
+#include <linux/amba/bus.h>
+#include <linux/clk.h>
 
 #include <asm/cacheflush.h>
 #include <asm/div64.h>
 #include <asm/io.h>
 #include <asm/scatterlist.h>
 #include <asm/sizes.h>
-#include <asm/hardware/amba.h>
-#include <asm/hardware/clock.h>
 #include <asm/mach/mmc.h>
 
 #include "mmci.h"
 
 #define DRIVER_NAME "mmci-pl18x"
 
-#ifdef CONFIG_MMC_DEBUG
 #define DBG(host,fmt,args...)  \
        pr_debug("%s: %s: " fmt, mmc_hostname(host->mmc), __func__ , args)
-#else
-#define DBG(host,fmt,args...)  do { } while (0)
-#endif
 
 static unsigned int fmax = 515633;
 
@@ -97,6 +93,13 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
        if (data->flags & MMC_DATA_READ) {
                datactrl |= MCI_DPSM_DIRECTION;
                irqmask = MCI_RXFIFOHALFFULLMASK;
+
+               /*
+                * If we have less than a FIFOSIZE of bytes to transfer,
+                * trigger a PIO interrupt as soon as any data is available.
+                */
+               if (host->size < MCI_FIFOSIZE)
+                       irqmask |= MCI_RXDATAAVLBLMASK;
        } else {
                /*
                 * We don't actually need to include "FIFO empty" here
@@ -124,15 +127,10 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c)
        }
 
        c |= cmd->opcode | MCI_CPSM_ENABLE;
-       switch (cmd->flags & MMC_RSP_MASK) {
-       case MMC_RSP_NONE:
-       default:
-               break;
-       case MMC_RSP_LONG:
-               c |= MCI_CPSM_LONGRSP;
-       case MMC_RSP_SHORT:
+       if (cmd->flags & MMC_RSP_PRESENT) {
+               if (cmd->flags & MMC_RSP_136)
+                       c |= MCI_CPSM_LONGRSP;
                c |= MCI_CPSM_RESPONSE;
-               break;
        }
        if (/*interrupt*/0)
                c |= MCI_CPSM_INTERRUPT;
@@ -300,7 +298,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id, struct pt_regs *regs)
                /*
                 * Unmap the buffer.
                 */
-               mmci_kunmap_atomic(host, &flags);
+               mmci_kunmap_atomic(host, buffer, &flags);
 
                host->sg_off += len;
                host->size -= len;
@@ -494,13 +492,9 @@ static int mmci_probe(struct amba_device *dev, void *id)
                goto host_free;
        }
 
-       ret = clk_use(host->clk);
-       if (ret)
-               goto clk_free;
-
        ret = clk_enable(host->clk);
        if (ret)
-               goto clk_unuse;
+               goto clk_free;
 
        host->plat = plat;
        host->mclk = clk_get_rate(host->clk);
@@ -573,8 +567,6 @@ static int mmci_probe(struct amba_device *dev, void *id)
        iounmap(host->base);
  clk_disable:
        clk_disable(host->clk);
- clk_unuse:
-       clk_unuse(host->clk);
  clk_free:
        clk_put(host->clk);
  host_free:
@@ -609,7 +601,6 @@ static int mmci_remove(struct amba_device *dev)
 
                iounmap(host->base);
                clk_disable(host->clk);
-               clk_unuse(host->clk);
                clk_put(host->clk);
 
                mmc_free_host(mmc);