From: Richard Zhu Date: Mon, 18 Apr 2011 06:52:50 +0000 (+0800) Subject: ENGR00142266-2 eSDHC:Add the GPIO CD/WP on MX5x boards X-Git-Tag: v3.0.35-fsl_4.1.0~2553 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=de06f0f7eaf15ee39073b8e3ce266b477da56857;p=karo-tx-linux.git ENGR00142266-2 eSDHC:Add the GPIO CD/WP on MX5x boards sdhc: add the CD/WP on the MX5x boards Signed-off-by: Richard Zhu --- diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 6fe8cede4179..0cc60ef540e3 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -247,17 +247,24 @@ static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pd host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; - if (cpu_is_mx25() || cpu_is_mx35()) { + if (cpu_is_mx25() || cpu_is_mx35()) /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK; - /* write_protect can't be routed to controller, use gpio */ - sdhci_esdhc_ops.get_ro = esdhc_pltfm_get_ro; - } + + /* write_protect can't be routed to controller, use gpio */ + sdhci_esdhc_ops.get_ro = esdhc_pltfm_get_ro; if (!(cpu_is_mx25() || cpu_is_mx35() || cpu_is_mx51())) imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; if (boarddata) { + /* Device is always present, e.x, populated emmc device */ + if (boarddata->always_present) { + imx_data->flags |= ESDHC_FLAG_GPIO_FOR_CD_WP; + host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; + return 0; + } + err = gpio_request_one(boarddata->wp_gpio, GPIOF_IN, "ESDHC_WP"); if (err) { dev_warn(mmc_dev(host->mmc), @@ -272,10 +279,6 @@ static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pd goto no_card_detect_pin; } - /* i.MX5x has issues to be researched */ - if (!cpu_is_mx25() && !cpu_is_mx35()) - goto not_supported; - err = request_irq(gpio_to_irq(boarddata->cd_gpio), cd_irq, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, mmc_hostname(host->mmc), host); @@ -295,7 +298,6 @@ static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pd gpio_free(boarddata->cd_gpio); no_card_detect_pin: boarddata->cd_gpio = err; - not_supported: kfree(imx_data); return 0; }