Browse Source

MLK-14608 fsl_esdhc: Fix wp_enable issue

The wp-gpios property is used for gpio, if this is set, the WP pin is muxed
to gpio function, can't be used as internal WP checking.

This patch changes to examine the "fsl,wp-controller" for using internal WP checking. And
wp-gpios for using gpio pin.

Signed-off-by: Ye Li <ye.li@nxp.com>
imx_v2017.03_4.9.11_1.0.0_ga
Ye Li 4 years ago
parent
commit
733a7fde6f
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      drivers/mmc/fsl_esdhc.c

+ 13
- 5
drivers/mmc/fsl_esdhc.c View File

@ -262,6 +262,13 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
printf("\nThe SD card is locked. Can not write to a locked card.\n\n");
return -ETIMEDOUT;
}
} else {
#ifdef CONFIG_DM_GPIO
if (dm_gpio_is_valid(&priv->wp_gpio) && dm_gpio_get_value(&priv->wp_gpio)) {
printf("\nThe SD card is locked. Can not write to a locked card.\n\n");
return -ETIMEDOUT;
}
#endif
}
esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK,
@ -1011,14 +1018,15 @@ static int fsl_esdhc_probe(struct udevice *dev)
#endif
}
priv->wp_enable = 1;
if (fdt_get_property(fdt, node, "fsl,wp-controller", NULL)) {
priv->wp_enable = 1;
} else {
priv->wp_enable = 0;
#ifdef CONFIG_DM_GPIO
ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
&priv->wp_gpio, GPIOD_IS_IN);
if (ret)
priv->wp_enable = 0;
#endif
}
#ifdef CONFIG_DM_REGULATOR
ret = device_get_supply_regulator(dev, "vqmmc-supply", &vqmmc_dev);


Loading…
Cancel
Save