From patchwork Sat May 9 12:57:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 6369421 Return-Path: X-Original-To: patchwork-linux-mmc@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 48DD5BEEE1 for ; Sat, 9 May 2015 13:05:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33359202EC for ; Sat, 9 May 2015 13:05:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39F3920265 for ; Sat, 9 May 2015 13:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750867AbbEINFe (ORCPT ); Sat, 9 May 2015 09:05:34 -0400 Received: from mail-yh0-f50.google.com ([209.85.213.50]:36038 "EHLO mail-yh0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750842AbbEINFd (ORCPT ); Sat, 9 May 2015 09:05:33 -0400 Received: by yhrr66 with SMTP id r66so26015274yhr.3 for ; Sat, 09 May 2015 06:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Zpe7XSUACJ6jdsDKBQrr/lCkh6JbUpJv2bmhfaWKkcg=; b=wumrm9lkRkpbOPcpokVxjBOpYku5tFPCU6/PSJAu9MHT4UGTbHPDQmQSSaXLQHPgKr 36N6jVwo8a8sLsCLCHHlm6nuTJs/5b4JKzV/+zgpzEXbCrad+7zleP2t2LoJkJ3xMcHd hPspGTxjDFM/cETrf5eWWgoG9lLWkAQEhHdM65wf92KfZs6FTvs6RrtnIiU8f4P54Q8/ 1NNkAZxsW8vDCb8eca/FTB59GOTNHDale/a6d5tVZhMHFOZfPviAKKsHy7f7rg8q3rIm GXb0K4lD0/WbLDl/sv6G5RyU9bZPC6JaDUVvs/7aqfd6dXZxdi7C4YIcuSmX2BARSwUy NokA== X-Received: by 10.170.170.6 with SMTP id m6mr2717798ykd.102.1431176255756; Sat, 09 May 2015 05:57:35 -0700 (PDT) Received: from localhost.localdomain ([187.64.235.17]) by mx.google.com with ESMTPSA id o67sm7044929yha.41.2015.05.09.05.57.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 09 May 2015 05:57:34 -0700 (PDT) From: Fabio Estevam To: ulf.hansson@linaro.org Cc: shawn.guo@linaro.org, kernel@pengutronix.de, linux-mmc@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards Date: Sat, 9 May 2015 09:57:09 -0300 Message-Id: <1431176229-32708-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431176229-32708-1-git-send-email-festevam@gmail.com> References: <1431176229-32708-1-git-send-email-festevam@gmail.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 From: Fabio Estevam The only user of this driver that has not been converted to fully device tree is the i.MX35 SoC. There is a i.MX35-based board (mach-pcm043.c) that uses platform data to pass wp_gpio and cd_gpio information. Commit 8d86e4fcccf61ba ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()") broke the platform data case by removing mmc_gpio_request_ro() and mmc_gpio_request_cd(), so restore the functionality for the non-dt case. Also, restore the check for ESDHC_CD_CONTROLLER so that we can still support the "fsl,cd-controller" property. Signed-off-by: Fabio Estevam --- Changes since v1: - Add info in the commitlog about the need of keeping the check for the ESDHC_CD_CONTROLLER case as suggested by Ulf. drivers/mmc/host/sdhci-esdhc-imx.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index a9980d7..812c670 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -918,6 +918,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) struct esdhc_platform_data *boarddata; int err; struct pltfm_imx_data *imx_data; + bool dt = true; host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0); if (IS_ERR(host)) @@ -1005,11 +1006,44 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) } imx_data->boarddata = *((struct esdhc_platform_data *) host->mmc->parent->platform_data); + dt = false; + } + /* write_protect */ + if (boarddata->wp_type == ESDHC_WP_GPIO && !dt) { + err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio); + if (err) { + dev_err(mmc_dev(host->mmc), + "failed to request write-protect gpio!\n"); + goto disable_clk; + } + host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; } /* card_detect */ - if (boarddata->cd_type == ESDHC_CD_CONTROLLER) + switch (boarddata->cd_type) { + case ESDHC_CD_GPIO: + if (dt) + break; + err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0); + if (err) { + dev_err(mmc_dev(host->mmc), + "failed to request card-detect gpio!\n"); + goto disable_clk; + } + /* fall through */ + + case ESDHC_CD_CONTROLLER: + /* we have a working card_detect back */ host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; + break; + + case ESDHC_CD_PERMANENT: + host->mmc->caps |= MMC_CAP_NONREMOVABLE; + break; + + case ESDHC_CD_NONE: + break; + } switch (boarddata->max_bus_width) { case 8: