Jaehoon, On 18/02/20 4:54 am, Jaehoon Chung wrote: > Hi Faiz, > > On 2/18/20 7:35 AM, Jaehoon Chung wrote: >> Hi Faiz, >> >> On 2/17/20 9:42 PM, Faiz Abbas wrote: >>> Jaehoon, >>> >>> On 17/02/20 5:47 pm, Jaehoon Chung wrote: >>>> Hi, >>>> >>>> On 2/5/20 4:33 PM, Faiz Abbas wrote: >>>>> Hi Peng, >>>>> >>>>> On 05/02/20 12:58 pm, Peng Fan wrote: >>>>>>> Subject: Re: [PATCH v2 04/10] mmc: sdhci: Expose sdhci_init() as >>>>>>> non-static >>>>>>> ... >> >> Well, if you want, i will make patch about callback function. > > How about below codes? Then you can just add am654_sdhci_deferred_probe { ... > return sdhci_probe() .. } > > > diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c > index 0b90a97650..c75892a72c 100644 > --- a/drivers/mmc/mmc-uclass.c > +++ b/drivers/mmc/mmc-uclass.c > @@ -138,6 +138,21 @@ int mmc_host_power_cycle(struct mmc *mmc) > return dm_mmc_host_power_cycle(mmc->dev); > } > > +int dm_mmc_deferred_probe(struct udevice *dev) > +{ > + struct dm_mmc_ops *ops = mmc_get_ops(dev); > + > + if (ops->deferred_probe) > + return ops->deferred_probe(dev); > + > + return 0; > +} > + > +int mmc_deferred_probe(struct mmc *mmc) > +{ > + return dm_mmc_deferred_probe(mmc->dev); > +} > + > int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg) > { > int val; > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c > index d43983d4a6..9eae538af4 100644 > --- a/drivers/mmc/mmc.c > +++ b/drivers/mmc/mmc.c > @@ -2790,6 +2790,7 @@ int mmc_get_op_cond(struct mmc *mmc) > > #if CONFIG_IS_ENABLED(DM_MMC) > /* The device has already been probed ready for use */ > + mmc_deferred_probe(mmc); > #else > /* made sure it's not NULL earlier */ > err = mmc->cfg->ops->init(mmc); > diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c > index 01fa5a9d4d..9ff37b888b 100644 > --- a/drivers/mmc/sdhci.c > +++ b/drivers/mmc/sdhci.c > @@ -661,6 +661,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); > @@ -695,6 +709,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 > diff --git a/include/mmc.h b/include/mmc.h > index b5cb514f57..b362b7f4c7 100644 > --- a/include/mmc.h > +++ b/include/mmc.h > @@ -477,6 +477,8 @@ struct dm_mmc_ops { > * @return 0 if not present, 1 if present, -ve on error > */ > int (*host_power_cycle)(struct udevice *dev); > + > + int (*deferred_probe)(struct udevice *dev); > }; > > #define mmc_get_ops(dev) ((struct dm_mmc_ops *)(dev)->driver->ops) > @@ -489,6 +491,7 @@ int dm_mmc_get_wp(struct udevice *dev); > int dm_mmc_execute_tuning(struct udevice *dev, uint opcode); > int dm_mmc_wait_dat0(struct udevice *dev, int state, int timeout_us); > int dm_mmc_host_power_cycle(struct udevice *dev); > +int dm_mmc_deferred_probe(struct udevice *dev); > > /* Transition functions for compatibility */ > int mmc_set_ios(struct mmc *mmc); > @@ -498,6 +501,7 @@ int mmc_execute_tuning(struct mmc *mmc, uint opcode); > int mmc_wait_dat0(struct mmc *mmc, int state, int timeout_us); > int mmc_set_enhanced_strobe(struct mmc *mmc); > int mmc_host_power_cycle(struct mmc *mmc); > +int mmc_deferred_probe(struct mmc *mmc); > > #else > struct mmc_ops { > diff --git a/include/sdhci.h b/include/sdhci.h > index 01addb7a60..1276f43935 100644 > --- a/include/sdhci.h > +++ b/include/sdhci.h > @@ -267,6 +267,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) > >>
This does look like the cleanest solution. Will add in a v3. Thanks, Faiz