From patchwork Tue Jan 18 17:26:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kishore kadiyala X-Patchwork-Id: 486511 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0IHKBeW009720 for ; Tue, 18 Jan 2011 17:20:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752754Ab1ARRUH (ORCPT ); Tue, 18 Jan 2011 12:20:07 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:38460 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752647Ab1ARRUG (ORCPT ); Tue, 18 Jan 2011 12:20:06 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p0IHJx2K016041 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Jan 2011 11:20:01 -0600 Received: from ucmsshproxy.india.ext.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with SMTP id p0IHJt8x006654; Tue, 18 Jan 2011 22:49:56 +0530 (IST) Received: from localhost (unknown [10.24.244.160]) by ucmsshproxy.india.ext.ti.com (Postfix) with ESMTP id C4ED1158003; Tue, 18 Jan 2011 22:49:55 +0530 (IST) From: Kishore Kadiyala To: linux-mmc@vger.kernel.org, linux-omap@vger.kernel.org Cc: tony@atomide.com, cjb@laptop.org, madhu.cr@ti.com, Kishore Kadiyala Subject: [PATCH 1/4] omap: hsmmc: Rename use_dma to xfer_type and define possible transfers Date: Tue, 18 Jan 2011 22:56:28 +0530 Message-Id: <1295371591-13610-2-git-send-email-kishore.kadiyala@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1295371591-13610-1-git-send-email-kishore.kadiyala@ti.com> References: <1295371591-13610-1-git-send-email-kishore.kadiyala@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 18 Jan 2011 17:20:12 +0000 (UTC) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 5d46021..8fb8586 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -125,6 +125,11 @@ #define OMAP_MMC_SLEEP_TIMEOUT 1000 #define OMAP_MMC_OFF_TIMEOUT 8000 +/* Transfer Modes used by MMC controller */ +#define OMAP_HSMMC_USE_PIO_XFER 0 +#define OMAP_HSMMC_USE_SDMA_XFER 1 +#define OMAP_HSMMC_USE_ADMA_XFER 2 + /* * 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 @@ -172,7 +177,8 @@ struct omap_hsmmc_host { u32 bytesleft; int suspended; int irq; - int use_dma, dma_ch; + int dma_ch; + int xfer_type; /* Transfer can be PIO/SDMA/ADMA */ int dma_line_tx, dma_line_rx; int slot_id; int got_dbclk; @@ -545,7 +551,7 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host, { unsigned int irq_mask; - if (host->use_dma) + if (host->xfer_type != OMAP_HSMMC_USE_PIO_XFER) irq_mask = INT_EN_MASK & ~(BRR_ENABLE | BWR_ENABLE); else irq_mask = INT_EN_MASK; @@ -835,7 +841,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd, cmdreg &= ~(DDIR); } - if (host->use_dma) + if (host->xfer_type != OMAP_HSMMC_USE_PIO_XFER) cmdreg |= DMA_EN; host->req_in_progress = 1; @@ -864,7 +870,7 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_req omap_hsmmc_disable_irq(host); /* Do not complete the request if DMA is still in progress */ - if (mrq->data && host->use_dma && dma_ch != -1) + if (mrq->data && host->xfer_type && dma_ch != -1) return; host->mrq = NULL; mmc_request_done(host->mmc, mrq); @@ -942,7 +948,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) host->dma_ch = -1; spin_unlock(&host->irq_lock); - if (host->use_dma && dma_ch != -1) { + if (host->xfer_type && dma_ch != -1) { dma_unmap_sg(mmc_dev(host->mmc), host->data->sg, host->dma_len, omap_hsmmc_get_dma_dir(host, host->data)); omap_free_dma(dma_ch); @@ -1451,7 +1457,7 @@ omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, struct mmc_request *req) | (req->data->blocks << 16)); set_data_timeout(host, req->data->timeout_ns, req->data->timeout_clks); - if (host->use_dma) { + if (host->xfer_type) { ret = omap_hsmmc_start_dma_transfer(host, req); if (ret != 0) { dev_dbg(mmc_dev(host->mmc), "MMC start dma failure\n"); @@ -2050,7 +2056,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) host->mmc = mmc; host->pdata = pdata; host->dev = &pdev->dev; - host->use_dma = 1; + host->xfer_type = OMAP_HSMMC_USE_SDMA_XFER; host->dev->dma_mask = &pdata->dma_mask; host->dma_ch = -1; host->irq = irq;