From patchwork Wed Jul 22 12:53:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dong Aisheng X-Patchwork-Id: 6844381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2395BC05AC for ; Wed, 22 Jul 2015 14:07:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D7C42058E for ; Wed, 22 Jul 2015 14:07:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E3822058C for ; Wed, 22 Jul 2015 14:07:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHueB-0008RM-W4; Wed, 22 Jul 2015 14:05:24 +0000 Received: from mail-bl2on0102.outbound.protection.outlook.com ([65.55.169.102] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHucs-00068o-VF for linux-arm-kernel@lists.infradead.org; Wed, 22 Jul 2015 14:04:05 +0000 Received: from BN3PR0301CA0035.namprd03.prod.outlook.com (10.160.180.173) by CY1PR03MB1424.namprd03.prod.outlook.com (10.163.17.146) with Microsoft SMTP Server (TLS) id 15.1.213.14; Wed, 22 Jul 2015 14:03:34 +0000 Received: from BL2FFO11OLC012.protection.gbl (2a01:111:f400:7c09::176) by BN3PR0301CA0035.outlook.office365.com (2a01:111:e400:4000::45) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Wed, 22 Jul 2015 14:03:34 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; gmail.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11OLC012.mail.protection.outlook.com (10.173.160.159) with Microsoft SMTP Server (TLS) id 15.1.225.13 via Frontend Transport; Wed, 22 Jul 2015 14:03:27 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t6ME2iY4019637; Wed, 22 Jul 2015 07:03:21 -0700 From: Dong Aisheng To: Subject: [PATCH V2 06/11] mmc: sdhci-esdhc-imx: fix cd regression for dt platform Date: Wed, 22 Jul 2015 20:53:05 +0800 Message-ID: <1437569590-5228-7-git-send-email-aisheng.dong@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437569590-5228-1-git-send-email-aisheng.dong@freescale.com> References: <1437569590-5228-1-git-send-email-aisheng.dong@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC012; 1:KaARt9dwv4K7ZD9Y81pBB09DeovjLREWOikjumfkRgdsikTToOI/9UTg8B1T3hdjaB1fgZF10eZp+zf37J/2TDbH37Gb9aKpNwiwXdDaRPTFJG0OkJNq/YuothsGoNl9JjWyebuNyHQ/j0jzW6+m0DB3AignvbK5TFNTl+MGvz6ZWlcOuuu1VgO70717EyVr7MDGwv9IZ9sLkbzLcrqjpEMDFGgywxFhza5jXPt77Mf3kY9oQbZubYz1ZNBKEwvtaCLBcuRlsz8p+AxYLRt7sA8Y95JOeyy0Bzn2Opq4yvHQL5fQ5QxhRZtRhIzvOChYVJAJyuso2ehwnERUu1agRg== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(5003940100001)(50226001)(85426001)(5001960100002)(110136002)(92566002)(19580395003)(77096005)(87936001)(19580405001)(62966003)(77156002)(2950100001)(47776003)(6806004)(229853001)(50466002)(46102003)(104016003)(86362001)(230783001)(575784001)(2351001)(48376002)(189998001)(106466001)(36756003)(33646002)(76176999)(105606002)(50986999); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR03MB1424; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1424; 2:vNRw1KFqtE7uDGN+d4p/clm6f3Re9CH8qO7dX27UsnSrzVgq6DS2ei55RocNUvlT; 3:5zrYxIrumyqCfC16XOSh1eFD6uyxxdGJdbah+V8FUFQWAUi+XyiDIZqEgQUovtNlLy5xThUr41+ZR3/y0Rwf2+f50HxSzNCV0jb2gIZe8XnDfmesntKojG1dpWkmqhL5I4Kr+x5YGgAWo5E7B/pU6SJD3n0Nvyq9gqXJme5CNPNiIqwo7Rhpdw2QTytkewX8vcWM1Ud0F+x3XHBfJeDhZeHqC6djpxx/lrMtJvGhR9M=; 25:lGat8vRFZNV4cQopMzYaA2ToT/S5sujh1jzZDydW0mIdeoyPTXi3ITUN/JFNNxJuWxviOALzR3aVoXLGqvbFuJg7w3bXsBLoy26moi2V4We2yuqer9a5UIkOAu9q1uqAYQxvwjy/DAJ61Q06DEpy5vvEO5ft8jHclwLO58HRTiYcS7TJOLJOCBuAlnl3iXsod158NKmrPllJexMNC7PrJfcJAJGj/TH7PoP0ww+XJL//kPJg2oclzoSRNTzE+yNLREjYpAJbNlxB6fLx0m6mMQ==; 20:SIZ82WK1K2yvLh1H1y+Qm7I0dB9TdyiPcO3PINLfOJnfTIb1bm9/WIktg7fFbAedzJOKcNOAzw5X4mmEw92+1UcGy3cEQoxkSHPlR1UWqzRrdfPZBRTkFeCu03nXI55t0BMvJETlde8JlU6MI05OkO92lko1pfahv0uN5w3D+1lN/7YuzU/9GdwZsmuxIVl31n2+RFbSIvyBy0fTQ6mw29bns9s9chRf5Hcfj7KCSl7BC4TWflzOFcy7mCwPmhXA2C1kCFoNlm0nBbslgNBcIZbH2cT4KZJnw+U1GyTK9jLTR1BQQLl/GvMBdF4Hm7jjOZm4prv+184MBD1aPso4Xkukv/0qZcenOqKfvo1jyBU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1424; CY1PR03MB1424: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:CY1PR03MB1424; BCL:0; PCL:0; RULEID:; SRVR:CY1PR03MB1424; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1424; 4:vd/qLwjp/WDJ9nQBJDFlSVih7upnx/fgxHdpAI8gYpztRttZVJjqOYfKviNUo5fJV0rYZ0iWJCwnnUOn1Fr/C6aRqs5nwF6EsxGQ8O7idcpTIiTcitQQ/CO4HIK01aVbWvaNo3kaiLpjGTygc2eKsYIyTze/V6U4TDeo0KcSP/96TjxmVLiZ4OApzWXPJ8EaFRvvZLuv76q89AUEAeYidXUoujqSRLHTFqIvaZd5550mLbQ6D+MoXvTtfw328/X9ouki+eXpsO3HJOWvklxNp+Nc3N8LGGRlxbaKOy80ugg= X-Forefront-PRVS: 0645BEB7AA X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1424; 23:y2s9zAKvpyOBdfncB8V4ChYnHP06hA9x/JFqy+NNvwolzgrKsmqGd5x87dtOc/lXwwxrLFJsKo+8mDBZL9nPi7bNODJRsKRywHS6/qoj3s1J3yludzVEb9NWsKvFv1UfdwK8GH0An+kTD70ZTJQC6lnCLyty6vpu1R/HNzsaVyMqKyq9xAh/qzWGf9zEa3WUVXZ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bml+ig2fPUk45GDCpkI4A/DSUKbqJ4W8gE/gbB5Aek2VmYH1KbhatDqiwzOFk3kKQ2kMG+rbk7kgsw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2015 14:03:27.1282 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1424 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150722_070403_235392_2F8D0215 X-CRM114-Status: GOOD ( 14.44 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fabio.estevam@freescale.com, marex@denx.de, ulf.hansson@linaro.org, hs@denx.de, p.zabel@pengutronix.de, tharvey@gateworks.com, shawn.guo@linaro.org, s.hauer@pengutronix.de, ipaton0@gmail.com, chris@printf.net, rabeeh@solid-run.com, troy.kisky@boundarydevices.com, smoch@web.de, gwenhael.goavec-merou@armadeus.com, rmk+kernel@arm.linux.org.uk, lisovy@gmail.com, s.trumtrar@pengutronix.de, robertcnelson@gmail.com, b29396@freescale.com, linux-arm-kernel@lists.infradead.org, LW@KARO-electronics.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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. Fixes: 8d86e4fcccf6 ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()") Signed-off-by: Dong Aisheng --- drivers/mmc/host/sdhci-esdhc-imx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index faf0cb9..4815391 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -881,6 +881,7 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, struct esdhc_platform_data *boarddata) { struct device_node *np = pdev->dev.of_node; + int ret; if (!np) return -ENODEV; @@ -917,7 +918,14 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, mmc_of_parse_voltage(np, &host->ocr_mask); /* call to generic mmc_of_parse to support additional capabilities */ - return mmc_of_parse(host->mmc); + ret = mmc_of_parse(host->mmc); + if (ret) + return ret; + + if (!IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc))) + host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; + + return 0; } #else static inline int