Return-Path: Received: from mail-yk0-f172.google.com ([209.85.160.172]:34164 "EHLO mail-yk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751485AbbIOEFJ (ORCPT ); Tue, 15 Sep 2015 00:05:09 -0400 Received: by ykdg206 with SMTP id g206so173382311ykd.1 for ; Mon, 14 Sep 2015 21:05:09 -0700 (PDT) From: Fabio Estevam To: stable@vger.kernel.org Cc: ulf.hansson@linaro.org, aisheng.dong@freescale.com, shawnguo@kernel.org, kernel@pengutronix.de, Fabio Estevam Subject: [PATCH 3/7] mmc: sdhci-esdhc-imx: fix cd regression for dt platform Date: Tue, 15 Sep 2015 01:04:48 -0300 Message-Id: <1442289892-32244-3-git-send-email-festevam@gmail.com> In-Reply-To: <1442289892-32244-1-git-send-email-festevam@gmail.com> References: <1442289892-32244-1-git-send-email-festevam@gmail.com> Sender: stable-owner@vger.kernel.org List-ID: From: Dong Aisheng commit 4800e87a2ee886c1972deb73f057d1a6541edb36 upstream. Current card detect probe process is that when driver finds a valid ESDHC_CD_GPIO, it will clear the quirk SDHCI_QUIRK_BROKEN_CARD_DETECTION which is set by default for all esdhc/usdhc controllers. Then host driver will know there's a valid card detect function. Commit 8d86e4fcccf6 ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()") breaks GPIO CD function for dt platform that it will return directly when find ESDHC_CD_GPIO for dt platform which result in the later wrongly to keep SDHCI_QUIRK_BROKEN_CARD_DETECTION for all dt platforms. Then MMC_CAP_NEEDS_POLL will be used instead even there's a valid GPIO card detect. This patch adds back this function and follows the original approach to clear the quirk if find an valid CD GPIO for dt platforms. Cc: # 4.1 Fixes: 8d86e4fcccf6 ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()") Signed-off-by: Dong Aisheng Reviewed-by: Johan Derycke Signed-off-by: Ulf Hansson Signed-off-by: Fabio Estevam --- drivers/mmc/host/sdhci-esdhc-imx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 165a2e7..c87590d 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1083,6 +1083,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; } + if (!IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc))) + host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; + err = sdhci_add_host(host); if (err) goto disable_clk; -- 1.9.1