mmc: pxamci: set proper buswidth capabilities according to PXA flavor
authorBridge Wu <mingqiao.wu@gmail.com>
Tue, 25 Sep 2007 17:09:19 +0000 (19:09 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 25 Sep 2007 17:11:39 +0000 (19:11 +0200)
From PXA27x, it is possible to do 4-bit data transfers.

Signed-off-by: Bridge Wu <mingqiao.wu@gmail.com>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/host/pxamci.c
drivers/mmc/host/pxamci.h

index 67acc6a0089524af3e6a4fa8f02026015e891513..6549f546df556a8d919586f0ad5faab5e01cc393 100644 (file)
@@ -284,7 +284,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat)
        host->data = NULL;
        if (host->mrq->stop) {
                pxamci_stop_clock(host);
-               pxamci_start_cmd(host, host->mrq->stop, 0);
+               pxamci_start_cmd(host, host->mrq->stop, host->cmdat);
        } else {
                pxamci_finish_request(host, host->mrq);
        }
@@ -382,6 +382,11 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                        host->cmdat |= CMDAT_INIT;
        }
 
+       if (ios->bus_width == MMC_BUS_WIDTH_4)
+               host->cmdat |= CMDAT_SD_4DAT;
+       else
+               host->cmdat &= ~CMDAT_SD_4DAT;
+
        pr_debug("PXAMCI: clkrt = %x cmdat = %x\n",
                 host->clkrt, host->cmdat);
 }
@@ -460,6 +465,9 @@ static int pxamci_probe(struct platform_device *pdev)
        mmc->ocr_avail = host->pdata ?
                         host->pdata->ocr_mask :
                         MMC_VDD_32_33|MMC_VDD_33_34;
+       mmc->caps = 0;
+       if (!cpu_is_pxa21x() && !cpu_is_pxa25x())
+               mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL);
        if (!host->sg_cpu) {
index df17c281278a68d272a21756b1be5eb1f1d9c82f..5655be823a00caf2879c069efe26e869848f6682 100644 (file)
@@ -25,6 +25,7 @@
 #define SPI_EN                 (1 << 0)
 
 #define MMC_CMDAT      0x0010
+#define CMDAT_SD_4DAT          (1 << 8)
 #define CMDAT_DMAEN            (1 << 7)
 #define CMDAT_INIT             (1 << 6)
 #define CMDAT_BUSY             (1 << 5)