mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 14:10:43 +00:00
mmc: 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. However the codes remain to use internal WP checking. This patch changes to examine the "fsl,wp-controller" for enabling internal WP checking, and "wp-gpios" for muxing to gpio. Signed-off-by: Ye Li <ye.li@nxp.com>
This commit is contained in:
parent
72a89e0da5
commit
da8e1f3cd4
1 changed files with 14 additions and 6 deletions
|
@ -297,6 +297,13 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,
|
|||
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(®s->wml, WML_WR_WML_MASK,
|
||||
|
@ -1502,14 +1509,15 @@ static int fsl_esdhc_probe(struct udevice *dev)
|
|||
#endif
|
||||
}
|
||||
|
||||
priv->wp_enable = 1;
|
||||
|
||||
#ifdef CONFIG_DM_GPIO
|
||||
ret = gpio_request_by_name(dev, "wp-gpios", 0, &priv->wp_gpio,
|
||||
GPIOD_IS_IN);
|
||||
if (ret)
|
||||
if (dev_read_prop(dev, "fsl,wp-controller", NULL)) {
|
||||
priv->wp_enable = 1;
|
||||
} else {
|
||||
priv->wp_enable = 0;
|
||||
#ifdef CONFIG_DM_GPIO
|
||||
gpio_request_by_name(dev, "wp-gpios", 0, &priv->wp_gpio,
|
||||
GPIOD_IS_IN);
|
||||
#endif
|
||||
}
|
||||
|
||||
priv->vs18_enable = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue