mmc: omap_hsmmc: Enable Auto CMD12
authorBalaji T K <balajitk@ti.com>
Mon, 9 Apr 2012 06:38:32 +0000 (12:08 +0530)
committerChris Ball <cjb@laptop.org>
Sun, 22 Apr 2012 15:16:43 +0000 (11:16 -0400)
Enable Auto-CMD12 for multi block read/write on HSMMC.
Tested on OMAP4430, OMAP3430 and OMAP2430 SDP

Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Venkatraman S <svenkatr@ti.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/omap_hsmmc.c

index 56d4499d43889e42a971fcfffb9bd0c334645294..dfa6f87b6cc2e94fc0e0865642d63f38b35ff92c 100644 (file)
@@ -85,6 +85,7 @@
 #define BRR_ENABLE             (1 << 5)
 #define DTO_ENABLE             (1 << 20)
 #define INIT_STREAM            (1 << 1)
+#define ACEN_ACMD12            (1 << 2)
 #define DP_SELECT              (1 << 21)
 #define DDIR                   (1 << 4)
 #define DMA_EN                 0x1
 #define OMAP_MMC_MAX_CLOCK     52000000
 #define DRIVER_NAME            "omap_hsmmc"
 
+#define AUTO_CMD12             (1 << 0)        /* Auto CMD12 support */
 /*
  * One controller can have multiple slots, like on some omap boards using
  * omap.c controller driver. Luckily this is not currently done on any known
@@ -175,6 +177,7 @@ struct omap_hsmmc_host {
        int                     reqs_blocked;
        int                     use_reg;
        int                     req_in_progress;
+       unsigned int            flags;
        struct omap_hsmmc_next  next_data;
 
        struct  omap_mmc_platform_data  *pdata;
@@ -766,6 +769,8 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd,
                cmdtype = 0x3;
 
        cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22);
+       if ((host->flags & AUTO_CMD12) && mmc_op_multi(cmd->opcode))
+               cmdreg |= ACEN_ACMD12;
 
        if (data) {
                cmdreg |= DP_SELECT | MSBS | BCE;
@@ -837,11 +842,14 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct mmc_data *data)
        else
                data->bytes_xfered = 0;
 
-       if (!data->stop) {
+       if (data->stop && ((!(host->flags & AUTO_CMD12)) || data->error)) {
+               omap_hsmmc_start_command(host, data->stop, NULL);
+       } else {
+               if (data->stop)
+                       data->stop->resp[0] = OMAP_HSMMC_READ(host->base,
+                                                       RSP76);
                omap_hsmmc_request_done(host, data->mrq);
-               return;
        }
-       omap_hsmmc_start_command(host, data->stop, NULL);
 }
 
 /*
@@ -1844,6 +1852,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
        host->mapbase   = res->start + pdata->reg_offset;
        host->base      = ioremap(host->mapbase, SZ_4K);
        host->power_mode = MMC_POWER_OFF;
+       host->flags     = AUTO_CMD12;
        host->next_data.cookie = 1;
 
        platform_set_drvdata(pdev, host);