From patchwork Mon Jul 6 12:16:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T. Ivanov" X-Patchwork-Id: 50743 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 77331229FC for ; Mon, 6 Jul 2015 12:17:44 +0000 (UTC) Received: by wipp2 with SMTP id p2sf31249083wip.2 for ; Mon, 06 Jul 2015 05:17:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=rSFysXyNfcibqAUzPc62tqD8PnXZzSztjwLiK+vchz4=; b=GcpQS2aJx60vQrehp7Ib/cH+vrZGifYg5mcXXmd064reK6Pq5tYY3UlBOQRu22kj3E y8XcoTLfM37M/XfsIphilHf2dgg4u1iCV/XeD+CqoLhshtPG5OecVI1swhiNqUXoBF7W hg1FyXS3W+iUq3/glkD/BR7NhiiHCCexYvfXbnMYoUqceENaD8BFLraISWLCoEHEITA1 RbfEyjp8r8X7GHhizT/DtPkKBpIhhOf7k7R15tYqPNys9WF3Yvk9/6hxtpSunLm1Av7U Di6vnDlYWsR1r/06sWd7t5S6NxDSVQ7oqPobkCzAmAKyy/ifi+V5f2fI32l9wOBv6N8l KKMg== X-Gm-Message-State: ALoCoQlNoDAAxN2NwjAF621hYo8JS2orhJDoSronxLj8+v1uxrpj/gGvW8TPAwH5LQASFuOTuVg/ X-Received: by 10.112.139.137 with SMTP id qy9mr90561lbb.17.1436185063713; Mon, 06 Jul 2015 05:17:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.138 with SMTP id am10ls580479lac.67.gmail; Mon, 06 Jul 2015 05:17:43 -0700 (PDT) X-Received: by 10.152.204.43 with SMTP id kv11mr1953588lac.15.1436185063522; Mon, 06 Jul 2015 05:17:43 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id db5si15124001lac.73.2015.07.06.05.17.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 05:17:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lagx9 with SMTP id x9so152227046lag.1 for ; Mon, 06 Jul 2015 05:17:43 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr47672480lac.41.1436185063401; Mon, 06 Jul 2015 05:17:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1687559lbb; Mon, 6 Jul 2015 05:17:42 -0700 (PDT) X-Received: by 10.68.226.166 with SMTP id rt6mr71369294pbc.2.1436185061635; Mon, 06 Jul 2015 05:17:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5si28851293pap.50.2015.07.06.05.17.40; Mon, 06 Jul 2015 05:17:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755289AbbGFMRh (ORCPT + 6 others); Mon, 6 Jul 2015 08:17:37 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:36364 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754545AbbGFMQd (ORCPT ); Mon, 6 Jul 2015 08:16:33 -0400 Received: by widjy10 with SMTP id jy10so159116038wid.1 for ; Mon, 06 Jul 2015 05:16:32 -0700 (PDT) X-Received: by 10.180.106.195 with SMTP id gw3mr53831256wib.25.1436184992458; Mon, 06 Jul 2015 05:16:32 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by mx.google.com with ESMTPSA id ha4sm46918316wib.0.2015.07.06.05.16.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jul 2015 05:16:31 -0700 (PDT) From: "Ivan T. Ivanov" To: Ulf Hansson Cc: Adrian Hunter , Tim Kryger , Aisheng Dong , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 1/3] mmc: sdhci: let GPIO based card detection have higher precedence Date: Mon, 6 Jul 2015 15:16:19 +0300 Message-Id: <1436184981-16719-2-git-send-email-ivan.ivanov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436184981-16719-1-git-send-email-ivan.ivanov@linaro.org> References: <1436184981-16719-1-git-send-email-ivan.ivanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.ivanov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Controller could have BROKEN_CARD_DETECTION quirk set, but drivers could use GPIO to detect card present state. Let, when defined, GPIO take precedence, so drivers could properly detect card state and not use polling. Signed-off-by: Ivan T. Ivanov --- drivers/mmc/host/sdhci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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/sdhci.c b/drivers/mmc/host/sdhci.c index bc14452..dd91b24 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1601,15 +1601,21 @@ static int sdhci_do_get_cd(struct sdhci_host *host) if (host->flags & SDHCI_DEVICE_DEAD) return 0; - /* If polling/nonremovable, assume that the card is always present. */ - if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || - (host->mmc->caps & MMC_CAP_NONREMOVABLE)) + /* If nonremovable, assume that the card is always present. */ + if (host->mmc->caps & MMC_CAP_NONREMOVABLE) return 1; - /* Try slot gpio detect */ + /* + * Try slot gpio detect, if defined it take precedence + * over build in controller functionality + */ if (!IS_ERR_VALUE(gpio_cd)) return !!gpio_cd; + /* If polling, assume that the card is always present. */ + if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) + return 1; + /* Host native card detect */ return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); }