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: 6679811 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 56C709F1C1 for ; Fri, 26 Jun 2015 10:00:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B40C206B6 for ; Fri, 26 Jun 2015 10:00:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 819662069D for ; Fri, 26 Jun 2015 10:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752822AbbFZKAe (ORCPT ); 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8WSNXjBwsRhpcLOdVEPDft1phcf1wqufeYhryLKW5ck=; b=We0y/Emd59etSFuoVfp8mNok2TgqQHS4remLp4zAmHUm95gRhWGAl8pcgFr60WZd2j 3isRahr+cIdsgHqJVmprdeZjJMuZ8BgKBwzuKDkZij4/f/4RAycMp4bKtVIpGdn0oBZ/ MFRLq6mqcxnbuH5qZ/nea/BoO0dE+eo5yQI8FD/jSG2B2CYvTJzCXdeyKZclV1xIoYpV ZM3souKA0HMgFCUfgHxNyjhcNOThoZdE0hCXp3Rd9njf3kzNWRnpYRODjimkmK39sc/R k4GIz5gZkvu9CCXILqctmLlgTi4dNhteD4GSnsqSWMoBE3Grc91K6bqUWW+/wzwWo1Jg FmFw== X-Gm-Message-State: ALoCoQkvIl9cq8+4rwj81jjxrJ5ijXMFKT3bnWQmJsc0Yjr01ihW/h+jznoR80UC+CGwdXzQ4Yyn 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: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-8.3 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 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); }