]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: atmel_sdhci: re-enable sdhci after SD Card re-insertion
authorSergiu Moga <sergiu.moga@microchip.com>
Wed, 22 Jun 2022 13:30:47 +0000 (16:30 +0300)
committerEugen Hristev <eugen.hristev@microchip.com>
Mon, 19 Sep 2022 06:50:17 +0000 (09:50 +0300)
Whenever the SD Card would be removed and then re-inserted while in the
U-Boot command line, the `SDBPWR` bit of the `SDMMC_PCR` register would
remain unset afterwards. In order for the bit to be set again after
re-insertion, register an additional `deferred_probe` method that the
DM would then transparently call. This method will call the generic
`sdhci_probe` which will, during its execution flow, set this bit to 1.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reported-by: Mihai Sain <mihai.sain@microchip.com>
Reviewed-by: Eugen Hristev <eugen.hristev@microchip.com>
drivers/mmc/atmel_sdhci.c

index 2b5ceeab94b5415ed7fc4595a58e3b1615eade97..37b0beeed47e3808bb58344ef6b9a16afdc62666 100644 (file)
@@ -52,6 +52,17 @@ struct atmel_sdhci_plat {
        struct mmc mmc;
 };
 
+static int atmel_sdhci_deferred_probe(struct sdhci_host *host)
+{
+       struct udevice *dev = host->mmc->dev;
+
+       return sdhci_probe(dev);
+}
+
+static const struct sdhci_ops atmel_sdhci_ops = {
+       .deferred_probe = atmel_sdhci_deferred_probe,
+};
+
 static int atmel_sdhci_probe(struct udevice *dev)
 {
        struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
@@ -104,6 +115,7 @@ static int atmel_sdhci_probe(struct udevice *dev)
                return ret;
 
        host->mmc->priv = host;
+       host->ops = &atmel_sdhci_ops;
        upriv->mmc = host->mmc;
 
        clk_free(&clk);