From patchwork Tue Jun 12 09:58:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Girish K S X-Patchwork-Id: 9218 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0659D23E49 for ; Tue, 12 Jun 2012 09:58:39 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id BCB11A18100 for ; Tue, 12 Jun 2012 09:58:38 +0000 (UTC) Received: by yenq6 with SMTP id q6so3528579yen.11 for ; Tue, 12 Jun 2012 02:58:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=Oz+pqmcb+rkIzUyxGlfYxrHLFP9RbvRXflBrKQ7caWs=; b=Q3boA3hkwZDJWOVf1n69CKLGcAsJT0xpwpPkVCMQnHybGdJ8K2Vy0qZ/ohk8nFx92S OIl3v/IQ7UBhnxKRKfKk2DuJNE/Xm2g6kYBC6E/TU1LD2/zQWRaVJno6E/bTVFvwJvao 2qyiW/cSiXiQjez+CBHe/4eNHa3pWrX1zWUCOsRElm4BEUIAo1n5G6McU7i7sX3FnkL4 oDw4jTwhsKPVT1SbOLuJTW+hTgS7J3yUH27rM19odSjr6gYFFPvN3GsP96GGP0WZW1ZJ MCMaD5gmNsjMSHxuIwiKhNfbKByLbXccNiSZHnz9+X2xAq4PDxEVz1i2bJA8iB+oqG1I sFEQ== Received: by 10.50.40.193 with SMTP id z1mr7918618igk.0.1339495117959; Tue, 12 Jun 2012 02:58:37 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp156222ibb; Tue, 12 Jun 2012 02:58:37 -0700 (PDT) Received: by 10.68.237.202 with SMTP id ve10mr36677310pbc.54.1339495116948; Tue, 12 Jun 2012 02:58:36 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id ts4si1602502pbc.92.2012.06.12.02.58.36 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jun 2012 02:58:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of girish.shivananjappa@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of girish.shivananjappa@linaro.org) smtp.mail=girish.shivananjappa@linaro.org Received: by danh15 with SMTP id h15so7917050dan.37 for ; Tue, 12 Jun 2012 02:58:36 -0700 (PDT) Received: by 10.68.194.6 with SMTP id hs6mr37257063pbc.133.1339495116632; Tue, 12 Jun 2012 02:58:36 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id rs4sm1527621pbc.0.2012.06.12.02.58.33 (version=SSLv3 cipher=OTHER); Tue, 12 Jun 2012 02:58:35 -0700 (PDT) From: Girish K S To: linux-mmc@vger.kernel.org Cc: cjb@laptop.org, patches@linaro.org, will.newton@imgtec.com, Girish K S Subject: [RESEND PATCH] mmc: dw_mmc: Add check for IDMAC configuration Date: Tue, 12 Jun 2012 15:28:22 +0530 Message-Id: <1339495102-4889-1-git-send-email-girish.shivananjappa@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQnY9ZK35jFC1JS3/twzgjwym95yp0DuB0G5gr/zWTopBEdrvkuFvKx+hIz0beg0liZlg4GB In the Current dwmmc driver there is support for selecting IDMAC from the menu config option. If the support for IDMAC is enabled in the menu config and Hardware configuration register's DMA_INTERFACE field is 0. Still the driver will try to do the DMA initialization. The dw_mci_idmac_init function currently implemented returns only success indicating that the DMA initialization is always successful. The current patch will add a ciheck for existance of the DMA IP and allow the DMA initialization. Signed-off-by: Girish K S Acked-by: Will Newton Signed-off-by: Girish K S --- drivers/mmc/host/dw_mmc.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index cbd8f3d..c485d1b 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -405,11 +405,23 @@ static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len) static int dw_mci_idmac_init(struct dw_mci *host) { struct idmac_desc *p; - int i; + int i, dma_support; /* Number of descriptors in the ring buffer */ host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc); + /* Check if Hardware Configuration Register has support for DMA */ + dma_support = (mci_readl(host, HCON) >> 16) & 0x3; + + if (!dma_support || dma_support > 2) { + dev_err(&host->dev, + "Host Controller does not support IDMA Tx.\n"); + host->dma_ops = NULL; + return -ENODEV; + } + + dev_info(&host->dev, "Using internal DMA controller.\n"); + /* Forward link the descriptor list */ for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++) p->des3 = host->sg_dma + (sizeof(struct idmac_desc) * (i + 1)); @@ -1871,7 +1883,6 @@ static void dw_mci_init_dma(struct dw_mci *host) /* Determine which DMA interface to use */ #ifdef CONFIG_MMC_DW_IDMAC host->dma_ops = &dw_mci_idmac_ops; - dev_info(&host->dev, "Using internal DMA controller.\n"); #endif if (!host->dma_ops)