From patchwork Mon Dec 31 10:58:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amar X-Patchwork-Id: 13751 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 171BB23E03 for ; Mon, 31 Dec 2012 10:36:18 +0000 (UTC) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by fiordland.canonical.com (Postfix) with ESMTP id B3A12A18257 for ; Mon, 31 Dec 2012 10:36:17 +0000 (UTC) Received: by mail-vc0-f170.google.com with SMTP id fl11so12762764vcb.1 for ; Mon, 31 Dec 2012 02:36:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:dlp-filter:x-mtr:x-brightmail-tracker :x-brightmail-tracker:x-cfilter-loop:x-gm-message-state; bh=86dHptzrJtwlvhCSLZByJaIX11hP8eM10k13pLyAuV0=; b=NQzcQbAtF/QTpSNjBHX6fXBjC3X5MViA+PCxP1q0G0f0XW4BYll8EzLk7I5NLjH8ex 4Xv1EAQHPGlHm4p6N/i8EeedCm6Fk9JF6Qcls/EHXY0d2qz+hYfTwpSOWbDIDPdjq++S 4TWogMkR8UgMOW4Q2DKQt4khYvztdJJzmkVkpjWr/Rq6fSg3KFEg+e8XRaRUXfKYu+bu YLsKdm+6CqnXSchR3LaIUASN/dzsMUE71iGkMKkIzhCzya6fCskYFpoUOn0JJm3dKLEv N97okF9CyxP+jONndnkoLTT9utHC7rBhYS0l12WFChI4RQXcpKDG8nDnWA1a2IuXyh5i /4dg== X-Received: by 10.52.176.6 with SMTP id ce6mr55028751vdc.57.1356950177232; Mon, 31 Dec 2012 02:36:17 -0800 (PST) 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.58.214.195 with SMTP id oc3csp153808vec; Mon, 31 Dec 2012 02:36:16 -0800 (PST) X-Received: by 10.66.81.68 with SMTP id y4mr119703303pax.66.1356950175410; Mon, 31 Dec 2012 02:36:15 -0800 (PST) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id go4si37230401pbc.324.2012.12.31.02.36.14; Mon, 31 Dec 2012 02:36:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of amarendra.xt@samsung.com designates 203.254.224.25 as permitted sender) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of amarendra.xt@samsung.com designates 203.254.224.25 as permitted sender) smtp.mail=amarendra.xt@samsung.com Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MFW00AHA5G5QUD0@mailout2.samsung.com>; Mon, 31 Dec 2012 19:36:14 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 5D.CE.12699.E9A61E05; Mon, 31 Dec 2012 19:36:14 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-f6-50e16a9e63c8 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id DB.CE.12699.D9A61E05; Mon, 31 Dec 2012 19:36:14 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MFW00JL05G0TP80@mmp1.samsung.com>; Mon, 31 Dec 2012 19:36:13 +0900 (KST) From: Amar To: u-boot@lists.denx.de, jh80.chung@samsung.com Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, afleming@gmail.com Subject: [PATCH V3 3/9] DWMMC: Initialise dwmci and resolve EMMC read write issues Date: Mon, 31 Dec 2012 05:58:14 -0500 Message-id: <1356951500-22490-4-git-send-email-amarendra.xt@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1356951500-22490-1-git-send-email-amarendra.xt@samsung.com> References: <1356951500-22490-1-git-send-email-amarendra.xt@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHLMWRmVeSWpSXmKPExsWyRsSkVnde1sMAg18NAhYP199ksZhy+AuL A5PHnWt72AIYo7hsUlJzMstSi/TtErgyDj05ylSwVaBi0eKsBsZ1vF2MnBwSAiYSl78/ZISw xSQu3FvP1sXIxSEksJRRonvnfHaYogWznjGB2EICixglmvb5QhT1MknMenUaqJuDg01AVeLX YnuQGhEBA4npT7azgoSZBQoknu0WAwkLC4RIrHx2nhnEZgGq3rJqOthIXgEPiZnNT5kgVslJ fNjzCGwtp4CnxOktO5gh1npI3OxeyA7RKyDxbfIhFpDxEgKyEpsOMINcIyFwnU2iteMp1MmS EgdX3GCZwCi8gJFhFaNoakFyQXFSeq6RXnFibnFpXrpecn7uJkZgIJ7+90x6B+OqBotDjAIc jEo8vJxMDwOEWBPLiitzDzFKcDArifC+1QIK8aYkVlalFuXHF5XmpBYfYvQBumQis5Rocj4w SvJK4g2NTcxNjU0tjYzMTE1xCCuJ8zZ7pAQICaQnlqRmp6YWpBbBjGPi4JRqYFxY/iA3/X58 /e+K34rSzhyBs39Nn2bFH9ax8nncVtY3c3sFnn18+Tr33IbZoUWcmnV6p+Y/Vwq+mPOzxnFX dXnVtulvAvfMnWooO+/gz4MzojKVZCacyJ3xbeWJPZHfJQNu+i55oH1UTnbXNP7UI92uOj8M FS5Xz/qcGKO16QPHifJzv1eEv8xWYinOSDTUYi4qTgQAzs3CcnECAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeLIzCtJLcpLzFFi42I5/e+xgO68rIcBBhNWsFg8XH+TxWLK4S8s Dkwed67tYQtgjGpgtMlITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLx CdB1y8wBmq2kUJaYUwoUCkgsLlbSt8M0ITTETdcCpjFC1zckCK7HyAANJKxhzDj05ChTwVaB ikWLsxoY1/F2MXJySAiYSCyY9YwJwhaTuHBvPRuILSSwiFGiaZ9vFyMXkN3LJDHr1WnGLkYO DjYBVYlfi+1BakQEDCSmP9nOChJmFiiQeLZbDCQsLBAisfLZeWYQmwWoesuq6WDjeQU8JGY2 P4VaJSfxYc8jdhCbU8BT4vSWHcwQaz0kbnYvZJ/AyLuAkWEVo2hqQXJBcVJ6rpFecWJucWle ul5yfu4mRnCYP5PewbiqweIQowAHoxIPLyfTwwAh1sSy4srcQ4wSHMxKIrxvtYBCvCmJlVWp RfnxRaU5qcWHGH2ArprILCWanA+MwbySeENjE3NTY1NLEwsTM0scwkrivM0eKQFCAumJJanZ qakFqUUw45g4OKUaGCsz87eJBVd0ec1qWvPJKIV7/vmf7l1Hb84vztmXErNBdZM6/6oJssbl b5TVD6x8um7v5H0M8rWa0YwfmKva4oL/lCtuvrpvb3XjPyeP2u2n+CMLbWoeXHotON3qB0PT mYg1TpO0sqLW6xh7VYd3N1zuCpj5huOa0wKvm9zLuvyMr3A+Lfr7SYmlOCPRUIu5qDgRAMcx 4+SgAgAA X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQlhiVq7/p5OAQ22S1uezO4eZztqt4qu/BOhUS8U9dZOgJvyCzZ8umAtEfUBaBr4noY8pD5C This patch enumerates dwmci and set auto stop command during dwmci initialisation. EMMC read/write is not happening in current implementation due to improper fifo size computation. Hence Modified the fifo size computation to resolve EMMC read write issues. Changes from V1: 1)Created the macros RX_WMARK_SHIFT and RX_WMARK_MASK in header file. Changes from V2: 1)Updation of commit message and resubmition of proper patch set. Signed-off-by: Amar --- drivers/mmc/dw_mmc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 4070d4e..d8fa1a2 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -136,6 +136,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, return TIMEOUT; } timeout--; + mdelay(1); } dwmci_writel(host, DWMCI_RINTSTS, DWMCI_INTMSK_ALL); @@ -314,7 +315,7 @@ static void dwmci_set_ios(struct mmc *mmc) static int dwmci_init(struct mmc *mmc) { struct dwmci_host *host = (struct dwmci_host *)mmc->priv; - u32 fifo_size, fifoth_val; + u32 fifo_size, fifoth_val, ier; dwmci_writel(host, DWMCI_PWREN, 1); @@ -323,6 +324,14 @@ static int dwmci_init(struct mmc *mmc) return -1; } + /* Enumerate at 400KHz */ + dwmci_setup_bus(host, mmc->f_min); + + /* Set auto stop command */ + ier = dwmci_readl(host, DWMCI_CTRL); + ier |= (1<<10); + dwmci_writel(host, DWMCI_CTRL, ier); + dwmci_writel(host, DWMCI_RINTSTS, 0xFFFFFFFF); dwmci_writel(host, DWMCI_INTMASK, 0); @@ -332,10 +341,11 @@ static int dwmci_init(struct mmc *mmc) dwmci_writel(host, DWMCI_BMOD, 1); fifo_size = dwmci_readl(host, DWMCI_FIFOTH); + fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1; if (host->fifoth_val) fifoth_val = host->fifoth_val; else - fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) | + fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 - 1) | TX_WMARK(fifo_size/2); dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);