From patchwork Fri Jun 26 10:00:08 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: 50337 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 15AE322902 for ; Fri, 26 Jun 2015 10:00:40 +0000 (UTC) Received: by lbcui10 with SMTP id ui10sf25317480lbc.0 for ; Fri, 26 Jun 2015 03:00:39 -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=8Gp/ISQPDUsyBKeGUCGG8oCGIzPlTuCGfG3xBY8nNXU=; b=RPZUJIveug8AYG4YpIiI5LJdVO9q0xkJTP6lq3xx9CllTU+cbzUR3VpRrA7mzP3jbc zcvNNZN4WXS0fSbhflBD+FkRwthemWc8OTcFlA3zZYd3WTcAvQQngI9NXhUq/W97bVNI 1fm/lutxXZn9hwmDadm86GCJZ0wcItjoZ+JTjGhLzQs3t2c5a4i4BEdoPV3xEZvnc0N9 cCt/Zb5LQuF0PgAt8F5ORV7EKROjnTjpxS1VvDF9RrPHERJtdAORJoymLUUBcZtRZwMr GYL/orTBNsvHH68irPL2BpDKrZPS5MNOQtC64pDf28CqxXiAfEQOwzBFmRwyI0MD8Puv sVzg== X-Gm-Message-State: ALoCoQmycBNQEjyW5vD8S3pHnU3ColE1dmtIEu0WCEhg6osTOVWgSavk+zqHS4jmgHYMRAXfErj0 X-Received: by 10.194.179.42 with SMTP id dd10mr572433wjc.7.1435312839001; Fri, 26 Jun 2015 03:00:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.7 with SMTP id m7ls493723laj.70.gmail; Fri, 26 Jun 2015 03:00:38 -0700 (PDT) X-Received: by 10.112.143.130 with SMTP id se2mr792178lbb.65.1435312838668; Fri, 26 Jun 2015 03:00:38 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id l6si26987337lbd.114.2015.06.26.03.00.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 03:00:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbnk3 with SMTP id k3so61376291lbn.1 for ; Fri, 26 Jun 2015 03:00:38 -0700 (PDT) X-Received: by 10.112.55.207 with SMTP id u15mr824583lbp.88.1435312838230; Fri, 26 Jun 2015 03:00:38 -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 hn6csp1193816lbb; Fri, 26 Jun 2015 03:00:37 -0700 (PDT) X-Received: by 10.66.119.136 with SMTP id ku8mr1717163pab.19.1435312837223; Fri, 26 Jun 2015 03:00:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dl11si49700456pac.135.2015.06.26.03.00.36; Fri, 26 Jun 2015 03:00:37 -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 S1752822AbbFZKAe (ORCPT + 6 others); Fri, 26 Jun 2015 06:00:34 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:33427 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751954AbbFZKAR (ORCPT ); Fri, 26 Jun 2015 06:00:17 -0400 Received: by wgck11 with SMTP id k11so84259305wgc.0 for ; Fri, 26 Jun 2015 03:00:15 -0700 (PDT) X-Received: by 10.180.106.73 with SMTP id gs9mr3230103wib.1.1435312814977; Fri, 26 Jun 2015 03:00:14 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by mx.google.com with ESMTPSA id ha4sm1506507wib.0.2015.06.26.03.00.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jun 2015 03:00:14 -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 1/3] mmc: sdhci: let GPIO based card detection have higher precedence Date: Fri, 26 Jun 2015 13:00:08 +0300 Message-Id: <1435312810-23957-2-git-send-email-ivan.ivanov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435312810-23957-1-git-send-email-ivan.ivanov@linaro.org> References: <1435312810-23957-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.217.174 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 | 11 +++++++---- 1 file changed, 7 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..8bafb9f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1601,15 +1601,18 @@ static int sdhci_do_get_cd(struct sdhci_host *host) if (host->flags & SDHCI_DEVICE_DEAD) return 0; + /* + * 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/nonremovable, assume that the card is always present. */ if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || (host->mmc->caps & MMC_CAP_NONREMOVABLE)) return 1; - /* Try slot gpio detect */ - if (!IS_ERR_VALUE(gpio_cd)) - return !!gpio_cd; - /* Host native card detect */ return !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); }