From patchwork Wed Jan 15 05:16:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 3489991 Return-Path: X-Original-To: patchwork-linux-arm@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 D49F3C02DC for ; Wed, 15 Jan 2014 05:17:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBBDB201B4 for ; Wed, 15 Jan 2014 05:17:10 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A66ED2017A for ; Wed, 15 Jan 2014 05:17:09 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3IqT-0005zG-BH; Wed, 15 Jan 2014 05:16:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3IqQ-0002ex-Sz; Wed, 15 Jan 2014 05:16:50 +0000 Received: from mail-pd0-f169.google.com ([209.85.192.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3IqN-0002eV-OS for linux-arm-kernel@lists.infradead.org; Wed, 15 Jan 2014 05:16:48 +0000 Received: by mail-pd0-f169.google.com with SMTP id v10so624275pde.28 for ; Tue, 14 Jan 2014 21:16:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=TsYW1nqI7/DEA7O7IvGpTd3w+g3QbP64+cjpZFKsKNU=; b=YVlPzM1QFPnpmmFPMDOAlHSex/H3HI+GsissegTCzJEv93rdT1UQ0m9odvyfjeNTV2 qTthXgCynHL2hCzHcw/R9Nq2dxOLjg+yLQeu/7ENWdqYSZ86oAFb7WQMcZyhFrv36SEl YUQbfhxwliId88IDJ8rNbI2c4t81npulZZi4hzgnIkBpY6hI7u2VBbTMsyXN3tJb6Q5Z E1LEVqsjLV6h2JXVy6d5F2oJ/bTxMZZ9B4zp44tFZN8Qo+/J7aZOPRiwjew6zZQoDlfk PoYT7EOqIyxab9/TwVO79+GHN7o8PB8NTMRWHVkIO4cAkOBprchpetIb+j5NV7q+4Brz HFkw== X-Gm-Message-State: ALoCoQkd0SW1EsKJj/HpqEgzpuHxBmb2565jhTmFDswVe5f1wranvYZ+s96IuxhRCrFimaPPyOnp X-Received: by 10.68.198.68 with SMTP id ja4mr299141pbc.24.1389762981348; Tue, 14 Jan 2014 21:16:21 -0800 (PST) Received: from [192.168.3.108] ([124.73.82.100]) by mx.google.com with ESMTPSA id by1sm5139428pbd.25.2014.01.14.21.16.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:16:20 -0800 (PST) Message-ID: <52D61995.5090003@linaro.org> Date: Wed, 15 Jan 2014 13:16:05 +0800 From: zhangfei User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Olof Johansson , Kevin Hilman Subject: Re: [PATCH 1/3] mmc: dw_mmc: use slot-gpio to handle cd pin References: <1389278112-7099-1-git-send-email-zhangfei.gao@linaro.org> <1389278112-7099-2-git-send-email-zhangfei.gao@linaro.org> <52D5DFB5.7@linaro.org> In-Reply-To: <52D5DFB5.7@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140115_001647_879552_F3D36CD5 X-CRM114-Status: GOOD ( 19.23 ) X-Spam-Score: -1.9 (-) Cc: "devicetree@vger.kernel.org" , Mike Turquette , Arnd Bergmann , Patch Tracking , Seungwon Jeon , "linux-mmc@vger.kernel.org" , Tomasz Figa , Jaehoon Chung , Haojian Zhuang , Kumar Gala , Chris Ball , linux-arm-kernel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Dear Kevin On 01/15/2014 09:09 AM, zhangfei wrote: > > > On 01/15/2014 01:23 AM, Olof Johansson wrote: >> On Tue, Jan 14, 2014 at 7:58 AM, Kevin Hilman wrote: >>> On Thu, Jan 9, 2014 at 6:35 AM, Zhangfei Gao >>> wrote: >>>> Suggested by Jaehoon: Use slot-gpio to handle cd-gpio >>>> Add function dw_mci_of_get_cd_gpio to check "cd-gpios" from dts. >>>> mmc_gpio_request_cd and mmc_gpio_get_cd are used to handle cd pin >>>> >>>> Signed-off-by: Zhangfei Gao >>>> Acked-by: Jaehoon Chung >>> >>> The Samsung Arndale board started failing boot from MMC root tests >>> starting with next-20140113 and I bisected it down to this patch. >>> Reverting this patch on top of next-20140114 gets Arndale booting >>> again from MMC. Is there some supporting DT data that's missing for >>> Arndale? >> >> Rather, it looks like this patch changes behaviour and no longer uses >> dw_mci_get_cd() to find out if there's a card attached -- it switches >> to rely only on GPIO (see the last chunk in the patch). That seems >> broken? >> > Oops, > Change using dw_mci_get_cd set flag DW_MMC_CARD_PRESENT. > And dw_mci_get_cd is called from mmc_rescan, a litter later than > dw_mci_probe. > Is that too late? Should have found the issue, CDETECT is ignored since IS_ERR_VALUE does not workable to !mmc_gpio_get_cd(mmc), which used for adding debounce. Sorry for that. However, with this change the debounce seems not stable as before. In the test of plug-in-out, sometimes sd detect will return timeout although present indicates as 1, while next time it can be detected again. Still want to check more. == 0 ? 1 : 0; diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index a776f24f4311..f1683ba194ee 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1033,7 +1033,7 @@ static int dw_mci_get_cd(struct mmc_host *mmc) int present; struct dw_mci_slot *slot = mmc_priv(mmc); struct dw_mci_board *brd = slot->host->pdata; - int gpio_cd = !mmc_gpio_get_cd(mmc); + int gpio_cd = mmc_gpio_get_cd(mmc); /* Use platform get_cd function, else try onboard card detect */ if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) @@ -1041,7 +1041,7 @@ static int dw_mci_get_cd(struct mmc_host *mmc) else if (brd->get_cd) present = !brd->get_cd(slot->id); else if (!IS_ERR_VALUE(gpio_cd)) - present = !!gpio_cd; + present = !gpio_cd; else present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))