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: 23209 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 59E51202FA for ; Wed, 15 Jan 2014 05:16:24 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id kq14sf1348210pab.1 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:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=TsYW1nqI7/DEA7O7IvGpTd3w+g3QbP64+cjpZFKsKNU=; b=iWFIDR6otjURZbsJxslFQuFLHQWygejX3wGM5LWVEsABZIwwyqL55k3KpkgvRJCahr fqbdJXIsmW9mhg8UX0kFYoc0PeRmh6iTXPnQ9r869yJLjQYBhse/NGrnIYD7jR1kMat8 pCFODCC5z2hSAPyoYKyx9Dm9nEF2GbyiAvnvXIBP0GuFVxNfhxUCu8VLVbL1pq5KDoX5 bBkfv0UvWihCApFXJ+Bb+KfIHpYbuW/T/8FLM4n/T6XvG7d3xdnHaLykE11IaoXCrreB PX4Re/M6Qo9NRURgA15ybGTTT5DH9RlscRwu1bLDbSi/4u3RqchWb9oZBUV16IW92lZf hi3w== X-Gm-Message-State: ALoCoQkIuAKANBgHJFfpprxGaqCBsJPxv89Y3P968MIZykZ4YBuKCusuxaUlkB3Bin0C4uEwE9/V X-Received: by 10.66.189.163 with SMTP id gj3mr65983pac.32.1389762983408; Tue, 14 Jan 2014 21:16:23 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.36.161 with SMTP id r1ls485857qej.71.gmail; Tue, 14 Jan 2014 21:16:23 -0800 (PST) X-Received: by 10.52.167.163 with SMTP id zp3mr70439vdb.82.1389762983294; Tue, 14 Jan 2014 21:16:23 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id tc7si1120564vdc.74.2014.01.14.21.16.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:16:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id im17so221345vcb.5 for ; Tue, 14 Jan 2014 21:16:23 -0800 (PST) X-Received: by 10.221.20.199 with SMTP id qp7mr108495vcb.24.1389762983024; Tue, 14 Jan 2014 21:16:23 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp249300ved; Tue, 14 Jan 2014 21:16:22 -0800 (PST) X-Received: by 10.66.246.130 with SMTP id xw2mr253621pac.84.1389762981779; Tue, 14 Jan 2014 21:16:21 -0800 (PST) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by mx.google.com with ESMTPS id nu8si2556969pbb.192.2014.01.14.21.16.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:16:21 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.181 is neither permitted nor denied by best guess record for domain of zhangfei.gao@linaro.org) client-ip=209.85.192.181; Received: by mail-pd0-f181.google.com with SMTP id p10so627742pdj.12 for ; Tue, 14 Jan 2014 21:16:21 -0800 (PST) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhangfei.gao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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))