From patchwork Tue Jun 12 04:21:06 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: 9212 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 B4EFD23F19 for ; Tue, 12 Jun 2012 04:21:23 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 7E2F4A18237 for ; Tue, 12 Jun 2012 04:21:23 +0000 (UTC) Received: by yhpp61 with SMTP id p61so3434066yhp.11 for ; Mon, 11 Jun 2012 21:21:23 -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=bWZRnh/hTTqxB0/4L1qy7h6SRjvfdOyDOYI62+mMVYs=; b=TYMTZGNz4w1zHzoXr/u+sPVACURLKaEhVYD//GMvezMMpJXfSngSBg6YYTJmKicnSL tmAa8a87UF4pJpoeOnZ8acJxy6vw7HSMpft2UhgW7+Q7rB1En09+IAZ4ZqHFdXQg1qSS SuymNg0eWbF5VTlsfZadN7CiYLj4qAK37tD3IIgf6D7sLMKxoKltOYrch1LdC+zzzo1b kFXkkn22ULNWDpKy2XnJia+MK0VTLidKpas6qQM5tc6sOBqbvgbAQ9IakgvofoNdXv8T YDZ4a4k3sWJGmOlZFZBIv3qF5olTH6lRbLZu+yLHEZFGiijSBLVbhI0UaoIduf7ZP4pP VZuA== Received: by 10.50.57.167 with SMTP id j7mr7454370igq.53.1339474882811; Mon, 11 Jun 2012 21:21:22 -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 v20csp145446ibb; Mon, 11 Jun 2012 21:21:21 -0700 (PDT) Received: by 10.68.192.97 with SMTP id hf1mr1926901pbc.132.1339474881597; Mon, 11 Jun 2012 21:21:21 -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 jy8si559960pbc.305.2012.06.11.21.21.21 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jun 2012 21:21:21 -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 h15so7500801dan.37 for ; Mon, 11 Jun 2012 21:21:21 -0700 (PDT) Received: by 10.68.218.103 with SMTP id pf7mr32287817pbc.67.1339474881165; Mon, 11 Jun 2012 21:21:21 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id pj5sm575039pbb.51.2012.06.11.21.21.18 (version=SSLv3 cipher=OTHER); Mon, 11 Jun 2012 21:21:20 -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: [PATCH] mmc: dw_mmc: Add check for IDMAC configuration Date: Tue, 12 Jun 2012 09:51:06 +0530 Message-Id: <1339474866-17805-1-git-send-email-girish.shivananjappa@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQnV52psBcz0cvsPCGcLPdQ2/F+scu+eEJy8b8HRzlKXXOsrGccZGVoISJL6SEdhDz7zRkkg 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 --- drivers/mmc/host/dw_mmc.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index cbd8f3d..9821293 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -405,7 +405,16 @@ 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; + + /* 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 DMA Tx.\n"); + return -ENODEV; + } /* Number of descriptors in the ring buffer */ host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);