[meta-freescale] Commit 1b673ef breaks riotboard boot

Fabio Estevam festevam at gmail.com
Tue Apr 28 03:42:38 PDT 2015


Hi Gary / Nikolay,

On Tue, Apr 28, 2015 at 1:25 AM, Fabio Estevam <festevam at gmail.com> wrote:

> I was able to reproduce the same behaviour on a mx6qsabresd, so I hope
> I can debug this tomorrow.

Please try the attached patch and let us know if it works on riotboard.

I will also test it on warp board later today.

Regards,

Fabio Estevam
-------------- next part --------------
From 3bda6d618a6bab3c0d7836a8f8d4f7573eec3e36 Mon Sep 17 00:00:00 2001
From: Fabio Estevam <fabio.estevam at freescale.com>
Date: Tue, 28 Apr 2015 02:07:30 -0300
Subject: [PATCH] mmc: sdhci-esdhc-imx: Avoid calling mmc_of_parse()

This is a partial revert from 1b673ef39236("mmc: sdhci-esdhc-imx: Call 
mmc_of_parse()"), which calls mmc_pwrseq_alloc() instead of the recommeded
mmc_of_parse() to allow powering up Wifi/BT gpios connected via esdhc.

Such commit is causing SD cards to not getting detected.

This is a quick workaround for kernel 4.0, as 4.1-rc1 does not show this
problem.

Tested on a imx6q-sabresd.

Reported-by: Nikolay Dimitrov <picmaster at mail.bg>
Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 39 +++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 1690d0b..59882b2 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -31,6 +31,8 @@
 #include "sdhci-pltfm.h"
 #include "sdhci-esdhc.h"
 
+#include "../core/pwrseq.h"
+
 #define	ESDHC_CTRL_D3CD			0x08
 /* VENDOR SPEC register */
 #define ESDHC_VENDOR_SPEC		0xc0
@@ -1009,9 +1011,40 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 					host->mmc->parent->platform_data);
 	}
 
+	/* write_protect */
+	if (boarddata->wp_type == ESDHC_WP_GPIO) {
+		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:
+		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:
@@ -1044,8 +1077,8 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
 	}
 
-	/* call to generic mmc_of_parse to support additional capabilities */
-	err = mmc_of_parse(host->mmc);
+
+	err = mmc_pwrseq_alloc(host->mmc);
 	if (err)
 		goto disable_clk;
 
-- 
1.9.1


More information about the meta-freescale mailing list