From patchwork Wed May 4 07:14:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 9011071 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ECBEC9FC33 for ; Wed, 4 May 2016 07:14:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ED3D2038D for ; Wed, 4 May 2016 07:14:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A9952037F for ; Wed, 4 May 2016 07:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757181AbcEDHOl (ORCPT ); Wed, 4 May 2016 03:14:41 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:58309 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751378AbcEDHOi (ORCPT ); Wed, 4 May 2016 03:14:38 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O6N035ZD5GC6S20@mailout1.samsung.com> for linux-mmc@vger.kernel.org; Wed, 04 May 2016 16:14:36 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.116]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 58.38.04998.C51A9275; Wed, 4 May 2016 16:14:36 +0900 (KST) X-AuditID: cbfee68d-f79646d000001386-c7-5729a15cee64 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 77.57.06657.C51A9275; Wed, 4 May 2016 16:14:36 +0900 (KST) Received: from localhost.localdomain ([10.113.62.216]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O6N00EIN5GBAI30@mmp2.samsung.com>; Wed, 04 May 2016 16:14:35 +0900 (KST) From: Jaehoon Chung To: linux-mmc@vger.kernel.org Cc: ulf.hansson@linaro.org, shawn.lin@rock-chips.com, Jaehoon Chung Subject: [PATCH 2/2] mmc: dw_mmc: prevent to set the wrong value Date: Wed, 04 May 2016 16:14:34 +0900 Message-id: <1462346074-19113-2-git-send-email-jh80.chung@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1462346074-19113-1-git-send-email-jh80.chung@samsung.com> References: <1462346074-19113-1-git-send-email-jh80.chung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsWyRsSkRDdmoWa4wY+XwhY3frWxWhz5389o cefJelaL42vDHVg87lzbw+bxd9Z+Fo++LasYPT5vkgtgieKySUnNySxLLdK3S+DKODprHmvB XI6Kf6+b2RoYd7B1MXJySAiYSNx4sx/KFpO4cG89kM3FISSwglFi3cpJjDBFs5edYIJIzGKU WProCyOE84NRYvHlV2BVbAI6Etu/HWcCsUUEZCV+/rkANpZZIE5i0dGf7CC2sICDRNeiaUA2 BweLgKrEg70VIGFeATeJ/XcWs0Isk5M4eWwymM0p4C4x7+1RsDFCQDUPl/awguyVEPjNJjFj 6lewIhYBAYlvkw+xgMyUANq76QAzxBxJiYMrbrBMYBRewMiwilE0tSC5oDgpvchQrzgxt7g0 L10vOT93EyMweE//e9a7g/H2AetDjAIcjEo8vC+9NcOFWBPLiitzDzGaAm2YyCwlmpwPjJG8 knhDYzMjC1MTU2Mjc0szJXFeRamfwUIC6YklqdmpqQWpRfFFpTmpxYcYmTg4pRoYG7VkZu2Q 18he4y046abUIQV9lYrD3HO/tM7rlAg85iuVmi16823D67QD27L5Nwi2z/LYMWlB5aGDLAoh k2I3bPPz+FgVcfKItU7LFv6JQhX/NHqz55TtWcv/6L36ZuEzage3R5ZODw7kXCcpMO1oT5mF ZrKGzELOqVpBJV8mZIhIr2NfZHBOiaU4I9FQi7moOBEAq8OvZ1kCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMIsWRmVeSWpSXmKPExsVy+t9jQd2YhZrhBmd+81rc+NXGanHkfz+j xZ0n61ktjq8Nd2DxuHNtD5vH31n7WTz6tqxi9Pi8SS6AJaqB0SYjNTEltUghNS85PyUzL91W yTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMHaKWSQlliTilQKCCxuFhJ3w7ThNAQN10L mMYIXd+QILgeIwM0kLCGMePorHmsBXM5Kv69bmZrYNzB1sXIySEhYCIxe9kJJghbTOLCvfVA cS4OIYFZjBJLH31hhHB+MEosvvyKEaSKTUBHYvu342AdIgKyEj//XACbxCwQJ7Ho6E92EFtY wEGia9E0IJuDg0VAVeLB3gqQMK+Am8T+O4tZIZbJSZw8NhnM5hRwl5j39ijYGCGgmodLe1gn MPIuYGRYxSiRWpBcUJyUnmuYl1quV5yYW1yal66XnJ+7iREcIc+kdjAe3OV+iFGAg1GJh/eF t2a4EGtiWXFl7iFGCQ5mJRHe5fOAQrwpiZVVqUX58UWlOanFhxhNge6ayCwlmpwPjN68knhD YxMzI0sjc0MLI2NzJXHex//XhQkJpCeWpGanphakFsH0MXFwSjUwLnA657BFyE3mAW9icLXV fcu3tk/qv88LuCb1c8r/8twH18wd5v7IKDTaP48tL+NwSoKG59Wj3CrqfyfcNItX9D+RKLGW 53Bx9tND+6SuHJJq1G7fdWLdYad1aa3MIY96dSIeTnf8EnBY40T8pIuXlrc9k2rcZutrPuH/ 0cM1YV8fdhQ2qTnvVWIpzkg01GIuKk4EAOeVV4amAgAA 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=-9.0 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 If there is no vqmmc, real voltage should not change. Then it needs to maintain the previous status for UHS_REG register. It means that it doesn't need to set any bit. Signed-off-by: Jaehoon Chung --- drivers/mmc/host/dw_mmc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 28602cc..6bd8018 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1418,7 +1418,19 @@ static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) ret, uhs & v18 ? "1.8" : "3.3"); return -EAGAIN; } + } else { + /* + * If there isn't vqmmc, it should fail to switch voltage. + * Then it needs to maintain the previous status. + * If ios->signal_voltage is 3.3v, it means that previous + * voltages was 1.8v. + */ + if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) + uhs |= v18; + else + uhs &= ~v18; } + mci_writel(host, UHS_REG, uhs); return 0;