sdhci: Add sdhci_deferred_probe() API
authorFaiz Abbas <faiz_abbas@ti.com>
Wed, 26 Feb 2020 08:14:31 +0000 (13:44 +0530)
committerPeng Fan <peng.fan@nxp.com>
Mon, 9 Mar 2020 00:33:16 +0000 (08:33 +0800)
Add the sdhci_deferred_probe() function to register as the
deferred_probe() callback to the mmc core. It will in turn call the
deferred_probe() callback of the platform drivers as declared in the
sdhci_ops.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
drivers/mmc/sdhci.c
include/sdhci.h

index 9b7c5f8f684ff63949694beac06bbd310fd0a6e7..520c9f9feba7036fe03bddb7caaa6b50f3fcdbc6 100644 (file)
@@ -658,6 +658,20 @@ int sdhci_probe(struct udevice *dev)
        return sdhci_init(mmc);
 }
 
+static int sdhci_deferred_probe(struct udevice *dev)
+{
+       int err;
+       struct mmc *mmc = mmc_get_mmc_dev(dev);
+       struct sdhci_host *host = mmc->priv;
+
+       if (host->ops && host->ops->deferred_probe) {
+               err = host->ops->deferred_probe(host);
+               if (err)
+                       return err;
+       }
+       return 0;
+}
+
 static int sdhci_get_cd(struct udevice *dev)
 {
        struct mmc *mmc = mmc_get_mmc_dev(dev);
@@ -692,6 +706,7 @@ const struct dm_mmc_ops sdhci_ops = {
        .send_cmd       = sdhci_send_command,
        .set_ios        = sdhci_set_ios,
        .get_cd         = sdhci_get_cd,
+       .deferred_probe = sdhci_deferred_probe,
 #ifdef MMC_SUPPORTS_TUNING
        .execute_tuning = sdhci_execute_tuning,
 #endif
index 7f8feefa450bfa82d98c560576fe711eb98fdad9..aa4378fd5797cf6db4ca129ab3a14283082008fb 100644 (file)
@@ -268,6 +268,7 @@ struct sdhci_ops {
        void    (*set_clock)(struct sdhci_host *host, u32 div);
        int (*platform_execute_tuning)(struct mmc *host, u8 opcode);
        void (*set_delay)(struct sdhci_host *host);
+       int     (*deferred_probe)(struct sdhci_host *host);
 };
 
 #if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)