[PATCH 1/5] mmc: sdhci-esdhc-imx: add support for write protect on custom GPIO
Marc Reilly
marc at cpdesign.com.au
Thu Feb 10 17:24:38 EST 2011
Hi Wolfram,
First three patches work well on my vpr200 board (mx35).
One comment inline...
I ran some tests of insert/remove card with the card locked and unlocked, and
trying to append a file. It behaved as expected, thus:
Tested-by: Marc Reilly <marc at cpdesign.com.au>
> +static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
> +{
> + struct esdhc_platform_data *boarddata = host->mmc->parent->platform_data;
> +
> + if (boarddata && gpio_is_valid(boarddata->wp_gpio))
> + return gpio_get_value(boarddata->wp_gpio);
> + else
> + return -ENOSYS;
> +}
> +
..snip..
> @@ -116,9 +139,20 @@ static int esdhc_pltfm_init(struct sdhci_host *host,
> struct sdhci_pltfm_data *pd if (cpu_is_mx35() || cpu_is_mx51())
> host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
>
> - /* Fix errata ENGcm07207 which is present on i.MX25 and i.MX35 */
> - 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;
> + }
> +
> + if (boarddata) {
Perhaps (boarddata && gpio_is_valid(boarddata->wp_gpio) as above?
For example what if someone sets up the boarddata for a card detect, but not
write protect.
> + err = gpio_request_one(boarddata->wp_gpio, GPIOF_IN, "ESDHC_WP");
> + if (err) {
> + dev_warn(mmc_dev(host->mmc), "can't get wp_pin!\n");
> + boarddata->wp_gpio = err;
> + }
> + }
>
> return 0;
> }
Cheers,
Marc
More information about the linux-arm-kernel
mailing list