From patchwork Mon Sep 15 10:26:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 4904161 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91934BEEA5 for ; Mon, 15 Sep 2014 10:26:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B9A12018B for ; Mon, 15 Sep 2014 10:26:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B42EB20166 for ; Mon, 15 Sep 2014 10:26:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753926AbaIOK0O (ORCPT ); Mon, 15 Sep 2014 06:26:14 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:55007 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753321AbaIOK0L (ORCPT ); Mon, 15 Sep 2014 06:26:11 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBX00LUSUBL06D0@mailout1.samsung.com> for linux-mmc@vger.kernel.org; Mon, 15 Sep 2014 19:26:09 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.113]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id F1.0E.04467.1CEB6145; Mon, 15 Sep 2014 19:26:09 +0900 (KST) X-AuditID: cbfee68f-f797f6d000001173-c9-5416bec18c8c Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B7.49.05196.1CEB6145; Mon, 15 Sep 2014 19:26:09 +0900 (KST) Received: from localhost.localdomain ([10.252.81.186]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NBX00GOSUBLG780@mmp1.samsung.com>; Mon, 15 Sep 2014 19:26:09 +0900 (KST) From: Jaehoon Chung To: linux-mmc Cc: Chris Ball , Ulf Hansson , tgih.jun@samsung.com, Jaehoon Chung Subject: [PATCH] mmc: dw_mmc-exynos: fixed wrong sample-clock selection Date: Mon, 15 Sep 2014 19:26:08 +0900 Message-id: <1410776768-1303-1-git-send-email-jh80.chung@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrILMWRmVeSWpSXmKPExsWyRsSkUPfgPrEQg9OPZSwmXN7OaHHjVxur xZH//YwWH+5fZLY4vjbcgdXjzrU9bB43Xi1k8ujbsorR4/MmuQCWKC6blNSczLLUIn27BK6M TZ9rCxbxVMy9cZyxgbGRq4uRk0NCwERizuefrBC2mMSFe+vZuhi5OIQEljJKrLq9kr2LkQOs 6NfiUIj4IkaJfVu62SGcNiaJK18+sYN0swnoSGz/dpwJxBYR0JTo3L4SbBKzQDujRFfPebAV wgLuEnfm32EBsVkEVCXmL//MArKBV8BV4tBUfohlChJzJtmAtEoIPGeT+LC/hQmiXEDi2+RD LBA1shKbDjBDHC0pcXDFDZYJjIILGBlWMYqmFiQXFCelFxnrFSfmFpfmpesl5+duYgSG5Ol/ z/p3MN49YH2IUYCDUYmH98QEsRAh1sSy4srcQ4ymQBsmMkuJJucDAz+vJN7Q2MzIwtTE1NjI 3NJMSZx3odTPYCGB9MSS1OzU1ILUovii0pzU4kOMTBycUg2Me7f/0fQ+fSWn83fpzJOLfDac isq/6sJz8qbjz+J1FjPWqtdu3DBR/7XMijWNt2tM35+QF+PhLvBd6LinRfOp5lvp3ZmadxgW LE3kqVvjo+7cNjt34mMP+0dNEpe2/kxhTb/4btnqE9oOfPwK125obbmrp/OHu5xLwd7N6saP D+letomPZntWKbEUZyQaajEXFScCAF27l9tEAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRmVeSWpSXmKPExsVy+t9jAd2D+8RCDH6dF7WYcHk7o8WNX22s Fkf+9zNafLh/kdni+NpwB1aPO9f2sHnceLWQyaNvyypGj8+b5AJYohoYbTJSE1NSixRS85Lz UzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTdMnOA9ioplCXmlAKFAhKLi5X07TBN CA1x07WAaYzQ9Q0JgusxMkADCWsYMzZ9ri1YxFMx98ZxxgbGRq4uRg4OCQETiV+LQ7sYOYFM MYkL99azdTFycQgJLGKU2Lelmx3CaWOSuPLlEztIFZuAjsT2b8eZQGwRAU2Jzu0rwTqYBdoZ Jbp6zrOCJIQF3CXuzL/DAmKzCKhKzF/+mQVkG6+Aq8ShqfwQixUk5kyymcDIvYCRYRWjaGpB ckFxUnqukV5xYm5xaV66XnJ+7iZGcMA/k97BuKrB4hCjAAejEg9vYZ9YiBBrYllxZe4hRgkO ZiUR3qlbgUK8KYmVValF+fFFpTmpxYcYTYF2T2SWEk3OB0ZjXkm8obGJmZGlkbmhhZGxuZI4 78FW60AhgfTEktTs1NSC1CKYPiYOTqkGRuP1m+7KfqoIyTwdLiTe9Trs0+/z325XTmn58+XS et8vgh2mf4V5TohaN7gV7X++T+jfs6meu+8wy1jUWzMccA1O8Z8n9u7cipsnnyxZnO5qF1wT 97LkYu02TqmUlVfZxFJaFwhNEk0Q1Xcw4QpgqlTdHFcxKZs786bAybnfbzMIWSfXLntbpMRS nJFoqMVcVJwIAGEbLQ+OAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Almost all case is selected to 0. (It's not correct sample-clock value.) Since it set to wrong value, HS200 mode don't work fine. If we want to select the correct value, it has to check from 1 to 7.(skip 0) Signed-off-by: Jaehoon Chung --- drivers/mmc/host/dw_mmc-exynos.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c index 0fbc53a..5294035 100644 --- a/drivers/mmc/host/dw_mmc-exynos.c +++ b/drivers/mmc/host/dw_mmc-exynos.c @@ -25,6 +25,7 @@ #define NUM_PINS(x) (x + 2) #define SDMMC_CLKSEL 0x09C +#define SDMMC_CLKSEL_CCLK_SAMPLE_MASK 0x7 #define SDMMC_CLKSEL_CCLK_SAMPLE(x) (((x) & 7) << 0) #define SDMMC_CLKSEL_CCLK_DRIVE(x) (((x) & 7) << 16) #define SDMMC_CLKSEL_CCLK_DIVIDER(x) (((x) & 7) << 24) @@ -330,6 +331,12 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode, if (!blk_test) return -ENOMEM; + /* + * In order to check all selclk_sample clock, + * it needs to reset to 0. + */ + dw_mci_exynos_set_clksmpl(host, 0); + start_smpl = dw_mci_exynos_get_clksmpl(host); do { @@ -372,7 +379,7 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode, "Tuning error: cmd.error:%d, data.error:%d\n", cmd.error, data.error); } - } while (start_smpl != smpl); + } while (start_smpl < SDMMC_CLKSEL_CCLK_SAMPLE_MASK); found = dw_mci_exynos_get_best_clksmpl(candiates); if (found >= 0)