From patchwork Fri May 8 05:56: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: 6362541 Return-Path: X-Original-To: patchwork-linux-mmc@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 BAF7B9F373 for ; Fri, 8 May 2015 05:59:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5405203A9 for ; Fri, 8 May 2015 05:59:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE8812039E for ; Fri, 8 May 2015 05:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751923AbbEHF70 (ORCPT ); Fri, 8 May 2015 01:59:26 -0400 Received: from mail-yh0-f42.google.com ([209.85.213.42]:34979 "EHLO mail-yh0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751732AbbEHF7Z (ORCPT ); Fri, 8 May 2015 01:59:25 -0400 Received: by yhda23 with SMTP id a23so17003233yhd.2 for ; Thu, 07 May 2015 22:59:25 -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=H42ks5WmC+5a5uHLK+98PWZVcGIKxq4/mb6IEbkPsf8=; b=mvydPXyIgFAXI0Hasw7SyYd9LQk3oTSo3iyGbwHgCyYwwOXYIn+eFVg9rDTG/McVzn TfCf3jWXt5UNL7ECb4Ujw7QmnZBcVDWtm0kV6qGEHP3Q7G7gjx0vPtl6tIjRZb/AlwxP v/tad0Pyxd7KAQyWTWt6grmV35m3vkyr4mbDi/0+0ogjV92HalpCYrER9/ekiJm7wuoi KowERG2uBvSsGIZtql49NwSoXBrn2ys/P5gd7h9HuhyKfrFs2xl8xmXiCJqJytEkLlUD GRRe9/BhVvzNwJwWfsoWntXfO/eSUlg2a4KE/L0Ehj1QEMixzmyhmEJi19QOStpjj8S+ p86w== X-Received: by 10.170.119.14 with SMTP id l14mr2272016ykb.110.1431064765144; Thu, 07 May 2015 22:59:25 -0700 (PDT) Received: from localhost.localdomain ([187.64.235.17]) by mx.google.com with ESMTPSA id s27sm3743401yho.9.2015.05.07.22.59.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 May 2015 22:59:24 -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 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards Date: Fri, 8 May 2015 02:56:09 -0300 Message-Id: <1431064569-5947-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431064569-5947-1-git-send-email-festevam@gmail.com> References: <1431064569-5947-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. Signed-off-by: Fabio Estevam --- 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: