From patchwork Fri Jan 4 09:34:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amar X-Patchwork-Id: 13792 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 48B0A23EDC for ; Fri, 4 Jan 2013 09:12:14 +0000 (UTC) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by fiordland.canonical.com (Postfix) with ESMTP id E00BDA18F7C for ; Fri, 4 Jan 2013 09:12:13 +0000 (UTC) Received: by mail-vc0-f173.google.com with SMTP id f13so16316025vcb.18 for ; Fri, 04 Jan 2013 01:12:13 -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=ITgYdNP/MNdVw3DQWZgbpb/TE6JXPe6dTvenW21vwV8=; b=eNaYQi0mPvo7Xv5Jz49SjxhMTFvjyVJdwFbbw8gkCOqvptuJ5Toj5mYQCYBxzL76/o V26ktwq6DfSt93VdRlnseHtBnQzb+hzOQDGF/kJVpbKXY0rdLRSq51JumRoBp/7JPuAX MVcYTgn53Nca4uABHFKs9Ip2FDb1iBjFCoo2vh79isM3GOlTQ5mtCxwVdp5isFt6KBQq U0qu20Sp6MqHNdI1q0NKCEsqPhtsfVofxg7qXJ0ktBBsFGqhUnW9kFFGZpFT66fi20l/ Na9Qi1zd7G7IF8NB/UgjRXFmoMVjxGqmtuX+OqSqGdnG6T5cZ9Ut+ZXGQCzW0yffAHJw vNyg== X-Received: by 10.52.18.207 with SMTP id y15mr65953145vdd.8.1357290733427; Fri, 04 Jan 2013 01:12:13 -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.145.101 with SMTP id st5csp128038veb; Fri, 4 Jan 2013 01:12:12 -0800 (PST) X-Received: by 10.68.219.36 with SMTP id pl4mr54762264pbc.124.1357290730809; Fri, 04 Jan 2013 01:12:10 -0800 (PST) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id s7si50402851pax.7.2013.01.04.01.12.10; Fri, 04 Jan 2013 01:12:10 -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 epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MG3001JJG89DNG0@mailout2.samsung.com>; Fri, 04 Jan 2013 18:12:09 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.123]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E9.50.01231.9EC96E05; Fri, 04 Jan 2013 18:12:09 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-cc-50e69ce97f3f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id A8.50.01231.8EC96E05; Fri, 04 Jan 2013 18:12:09 +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 <0MG30081AG7XXLA0@mmp1.samsung.com>; Fri, 04 Jan 2013 18:12:08 +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 V4 3/9] DWMMC: Initialise dwmci and resolve EMMC read write issues Date: Fri, 04 Jan 2013 04:34:04 -0500 Message-id: <1357292050-12137-4-git-send-email-amarendra.xt@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1357292050-12137-1-git-send-email-amarendra.xt@samsung.com> References: <1357292050-12137-1-git-send-email-amarendra.xt@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsWyRsSkWvflnGcBBl2/BS0err/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlTJv+lK3gpGBF3+yN7A2Ms/m6GDk5JARMJE6cvsEO YYtJXLi3nq2LkYtDSGApo8SH3lWsMEW/f15hhkgsYpSY83kqlNPLJHH2xhkgh4ODTUBV4tdi e5AGEQEDielPtrOChJkFCiSe7RYDMYUFQiS2XE0HqWABKr7WdIQNxOYV8JCY+uwc1A1yEh/2 PGIHKecU8JTYdEUExBQCKrl6qASiU0Di2+RDLCBhCQFZiU0HwE6RELjNJtHWc5wFYoqkxMEV N1gmMAovYGRYxSiaWpBcUJyUnmuoV5yYW1yal66XnJ+7iREYhqf/PZPawbiyweIQowAHoxIP r+WdpwFCrIllxZW5hxglOJiVRHg/az8LEOJNSaysSi3Kjy8qzUktPsToA3TJRGYp0eR8YIzk lcQbGpuYmxqbWhoZmZma4hBWEudlPPUkQEggPbEkNTs1tSC1CGYcEwenVAPjkg72ud+WT9OK 2vn4I1v7mez+GINXcenllXI/Lsqc0Pi/vTB8+rEij9w+7zRH5qtZFlryvPvWGvovXxGxwypE bseF3ZHl81W3n3vqp3qSKdM7p/pu+B6GH8u5VML/Tr/OkvmKpZSvyJljpff0F55vBTJTzBYK v1jwIOT8dCHPz5vcRF22Ox1RYinOSDTUYi4qTgQA2Xdy0nACAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42I5/e+xgO7LOc8CDDb1MFk8XH+TxWLK4S8s Dkwed67tYQtgjGpgtMlITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLx CdB1y8wBmq2kUJaYUwoUCkgsLlbSt8M0ITTETdcCpjFC1zckCK7HyAANJKxhzJg2/SlbwUnB ir7ZG9kbGGfzdTFyckgImEj8/nmFGcIWk7hwbz1bFyMXh5DAIkaJOZ+nMkM4vUwSZ2+cAXI4 ONgEVCV+LbYHaRARMJCY/mQ7K0iYWaBA4tluMRBTWCBEYsvVdJAKFqDia01H2EBsXgEPianP zrFDrJKT+LDnETtIOaeAp8SmKyIgphBQydVDJRMYeRcwMqxiFE0tSC4oTkrPNdQrTswtLs1L 10vOz93ECA7yZ1I7GFc2WBxiFOBgVOLhtbzzNECINbGsuDL3EKMEB7OSCO9n7WcBQrwpiZVV qUX58UWlOanFhxh9gG6ayCwlmpwPjMC8knhDYxNzU2NTSxMLEzNLHMJK4ryMp54ECAmkJ5ak ZqemFqQWwYxj4uCUamA8lt9Uu2eGo5OMx+3ciSK9v5Qv3X7YYmpQKa5XGDn9rVuARduDnwpL X07RWJl0zyAl66WzquiVzbeUTp1LiGR4vXb6sYcM6YdCup4cfiQ2M7ytU81csiT9coqs/0VT sx5es0e5fH7+2R7VAUnbN6rKm+7a1bftK8v3A/YzAydvtVp3WetMYL8SS3FGoqEWc1FxIgDF UADAnwIAAA== X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQk9PokBoV7Vnk2ltmufbgyLgf155+tpEG1cJkJbzN6/+6T/J3JDXmOUAtOCIydE6pLi8o5O 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. Changes from V3: 1)Updated to use the macro DWMCI_CTRL_SEND_AS_CCSD instead of the hard coded value (1 << 10). 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..776fdb6 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 |= DWMCI_CTRL_SEND_AS_CCSD; + 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);