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: 3489981 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 332959F169 for ; Wed, 15 Jan 2014 05:16:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 504372020F for ; Wed, 15 Jan 2014 05:16:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E1AE520203 for ; Wed, 15 Jan 2014 05:16:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbaAOFQW (ORCPT ); Wed, 15 Jan 2014 00:16:22 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]:59883 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbaAOFQV (ORCPT ); Wed, 15 Jan 2014 00:16:21 -0500 Received: by mail-pb0-f45.google.com with SMTP id rp16so637143pbb.18 for ; Tue, 14 Jan 2014 21:16:21 -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=RFUeKJn/B6kXfBzmNBgnIe17DesVlNstFDDar/BCmCLHBDJiJXSpWLu1hVKy5XH9+h q4VDkUJXtfgtWzCMU+VN/I3MgB5ewit6P3GLWeeqAUMCEJnKyQZNxQma79NwxHD7DKTn MxNWFS2FSbarC1Z21KiDQAQHldNM4MSMkyW+6MDzORn6zdYapQsy19WcaoLMaMdyZlbo oO93jyGmyvsREN7YCSsK5JuGIPih7ujppJ/+RBtgBEBwAVXiMb5KFRqvQa7gCRFmlkqw Bb7K0fDguUjJ27Wgsd9gnTerGA6fD9yQmiqHvxJWyRviD+WUEAGbH0qH3qeabl3tTv3w eWbA== X-Gm-Message-State: ALoCoQlBrw84VIUUS7bj4Sk+mOLMEofmmyEMJquMv2a/W0l6AaD0m/k9ClrwVsMKIuoysIlDgGLg 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 CC: Chris Ball , Arnd Bergmann , Mike Turquette , Rob Herring , Jaehoon Chung , Seungwon Jeon , Kumar Gala , Haojian Zhuang , "linux-mmc@vger.kernel.org" , linux-arm-kernel , Patch Tracking , "devicetree@vger.kernel.org" , Tomasz Figa 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> 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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; --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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))