From patchwork Mon Jun 23 10:45:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuvaraj CD X-Patchwork-Id: 4401261 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 A8696BEECB for ; Mon, 23 Jun 2014 10:45:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8F522021A for ; Mon, 23 Jun 2014 10:45:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D6BF20211 for ; Mon, 23 Jun 2014 10:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753218AbaFWKpt (ORCPT ); Mon, 23 Jun 2014 06:45:49 -0400 Received: from mail-pb0-f50.google.com ([209.85.160.50]:45736 "EHLO mail-pb0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753100AbaFWKps (ORCPT ); Mon, 23 Jun 2014 06:45:48 -0400 Received: by mail-pb0-f50.google.com with SMTP id rp16so5734223pbb.37 for ; Mon, 23 Jun 2014 03:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jKqeW65Xx/0F5Kri3dNJ/WjPlN88IXp43cEGoogZf6U=; b=L2nq81M33LdDgk5KBY180Ag3iy/hdLPstoUJshlDwuvW//tQOqO0zB5iBbAhjpYtXf Hv+da34Hnm7zao/UJLVjrbhsLVQlsN+3/y5DtUdC5dqE7Fhdb7t1jB7i56oAlT6oE3pa FiepddiFr/odR+gnx8rWQWXaMFTjiY2b2Xuqcav8f1cIRBSqKlgB8P9c9up5F8yY7g5X AI3rb11ATTY2SaP6wSGugLV9nJyllDJ0OazvxCfQdK3+YS6pvf9okqTvmXcAbi76HyC3 C6Vndb+4hb0OU0fyYabtKqKekMT/yQ/lKkeUTQwz9q3GsqdEZEMgh1P/YE73PET83cNj NF3Q== X-Received: by 10.66.153.80 with SMTP id ve16mr28095712pab.143.1403520348507; Mon, 23 Jun 2014 03:45:48 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id qj3sm26243034pbc.91.2014.06.23.03.45.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 03:45:47 -0700 (PDT) From: Yuvaraj Kumar C D X-Google-Original-From: Yuvaraj Kumar C D To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jh80.chung@samsung.com, cjb@laptop.org, tgih.jun@samsung.com, linux-mmc@vger.kernel.org, ulf.hansson@linaro.org Cc: sonnyrao@chromium.org, t.figa@samsung.com, kgene.kim@samsung.com, joshi@samsung.com, ks.giri@samsung.com, prashanth.g@samsung.com, alim.akhtar@samsung.com, Yuvaraj Kumar C D Subject: [PATCH 2/3] mmc: dw_mmc: Dont cut off vqmmc and vmmc Date: Mon, 23 Jun 2014 16:15:20 +0530 Message-Id: <1403520321-2431-3-git-send-email-yuvaraj.cd@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403520321-2431-1-git-send-email-yuvaraj.cd@samsung.com> References: <1403520321-2431-1-git-send-email-yuvaraj.cd@samsung.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 On exynos 5250 and 5420 based boards which uses built-in CD# line for card detection.But unfortunately CD# line is on the same voltage rails as of I/O voltage rails.When we cut off vqmmc,the consequent card detection will break in these boards. Also if we let alone the vqmmc turned on when vmmc turned off, the card could have half way powered and this can damage the card.So this patch adds a check so that, if the board used the built-in card detection mechanism i.e through CDETECT, it will not turned down vqmmc and vmmc both. Signed-off-by: Yuvaraj Kumar C D --- drivers/mmc/host/dw_mmc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index f5cabce..e034bce 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -932,6 +932,25 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_bh(&host->lock); } +/* + * some of the boards use controller CD line for card detection.Unfortunately + * CD line is bind to the same volatge domain as of the IO lines.If we turn off + * IO voltage domain, CD line wont work. + * Return true when controller CD line is used for card detection or return + * false. + */ +static bool dw_mci_builtin_cd(struct dw_mci_slot *slot) +{ + struct dw_mci_board *brd = slot->host->pdata; + struct mmc_host *mmc = slot->mmc; + + if ((brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) && + !IS_ERR_VALUE(mmc_gpio_get_cd(mmc))) + return true; + else + return false; +} + static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -988,6 +1007,10 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) mci_writel(slot->host, PWREN, regs); break; case MMC_POWER_OFF: + if (dw_mci_builtin_cd(slot) && + !test_bit(DW_MMC_CARD_PRESENT, &slot->flags)) + return; + if (!IS_ERR(mmc->supply.vqmmc) && test_bit(DW_MMC_IO_POWERED, &slot->flags)) { ret = regulator_disable(mmc->supply.vqmmc);