mmc: sdhci: Read cd-gpio from devicetree
[oweals/u-boot.git] / drivers / mmc / sdhci.c
index e2bb90abbdf3c5b05af34a23526f75da985df62d..4ffe74e35e08872f40ae2bbdcb2224ca47546abe 100644 (file)
@@ -590,6 +590,12 @@ static int sdhci_set_ios(struct mmc *mmc)
 static int sdhci_init(struct mmc *mmc)
 {
        struct sdhci_host *host = mmc->priv;
+#if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_GPIO)
+       struct udevice *dev = mmc->dev;
+
+       gpio_request_by_name(dev, "cd-gpio", 0,
+                            &host->cd_gpio, GPIOD_IS_IN);
+#endif
 
        sdhci_reset(host, SDHCI_RESET_ALL);