summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/fsl_esdhc_imx.c
diff options
context:
space:
mode:
authorFabio Estevam <festevam@gmail.com>2020-01-06 20:11:27 -0300
committerStefano Babic <sbabic@denx.de>2020-01-14 22:47:15 +0100
commit29230f389db7b714393a722bfaab1d44d41b8fca (patch)
treeec7ff8338ab8cea932fe1832a7929d2edc61b472 /drivers/mmc/fsl_esdhc_imx.c
parentbc9b06533a99b61c10544dc343b313fe8e8f63ac (diff)
downloadu-boot-29230f389db7b714393a722bfaab1d44d41b8fca.tar.gz
u-boot-29230f389db7b714393a722bfaab1d44d41b8fca.tar.xz
u-boot-29230f389db7b714393a722bfaab1d44d41b8fca.zip
mmc: fsl_esdhc_imx: Handle the "broken-cd" property
When no GPIO is used to read the card detect status the following error is seen: MMC: FSL_SDHC: 0, FSL_SDHC: 1 Loading Environment from MMC... MMC: no card present *** Warning - No block device, using default environment Fix it by handling the "broken-cd" property in the same way that drivers/mmc/sdhci.c does, which considers that the SD card is present when the "broken-cd" property is passed. Tested on a imx6ul-evk board. Signed-off-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/mmc/fsl_esdhc_imx.c')
-rw-r--r--drivers/mmc/fsl_esdhc_imx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index f7b754bd9d..a698184352 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -115,6 +115,7 @@ struct esdhc_soc_data {
* Following is used when Driver Model is enabled for MMC
* @dev: pointer for the device
* @non_removable: 0: removable; 1: non-removable
+ * @broken_cd: 0: use GPIO for card detect; 1: Do not use GPIO for card detect
* @wp_enable: 1: enable checking wp; 0: no check
* @vs18_enable: 1: use 1.8V voltage; 0: use 3.3V
* @flags: ESDHC_FLAG_xx in include/fsl_esdhc_imx.h
@@ -138,6 +139,7 @@ struct fsl_esdhc_priv {
#endif
struct udevice *dev;
int non_removable;
+ int broken_cd;
int wp_enable;
int vs18_enable;
u32 flags;
@@ -1093,6 +1095,9 @@ static int esdhc_getcd_common(struct fsl_esdhc_priv *priv)
#if CONFIG_IS_ENABLED(DM_MMC)
if (priv->non_removable)
return 1;
+
+ if (priv->broken_cd)
+ return 1;
#if CONFIG_IS_ENABLED(DM_GPIO)
if (dm_gpio_is_valid(&priv->cd_gpio))
return dm_gpio_get_value(&priv->cd_gpio);
@@ -1451,6 +1456,9 @@ static int fsl_esdhc_probe(struct udevice *dev)
ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT);
priv->strobe_dll_delay_target = val;
+ if (dev_read_bool(dev, "broken-cd"))
+ priv->broken_cd = 1;
+
if (dev_read_bool(dev, "non-removable")) {
priv->non_removable = 1;
} else {