From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Kocialkowski Date: Sun, 02 Nov 2014 19:51:06 +0100 Subject: [U-Boot] [PATCH v3 1/2] mmc: Board-specific MMC power initializations In-Reply-To: <5456306D.4080201@compulab.co.il> References: <1414839138-6587-1-git-send-email-contact@paulk.fr> <1414839138-6587-2-git-send-email-contact@paulk.fr> <5456306D.4080201@compulab.co.il> Message-ID: <1414954266.17533.2.camel@collins> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Igor, > On 11/01/14 12:52, Paul Kocialkowski wrote: > > Some devices may use non-standard combinations of regulators to power MMC: > > this allows these devices to provide a board-specific MMC power init function > > to set everything up in their own way. > > > > Signed-off-by: Paul Kocialkowski > > --- > > drivers/mmc/mmc.c | 8 ++++++++ > > include/mmc.h | 1 + > > 2 files changed, 9 insertions(+) > > > > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c > > index 44a4feb..125f347 100644 > > --- a/drivers/mmc/mmc.c > > +++ b/drivers/mmc/mmc.c > > @@ -1277,6 +1277,12 @@ block_dev_desc_t *mmc_get_dev(int dev) > > } > > #endif > > > > +/* board-specific MMC power initializations. */ > > +__weak int board_mmc_power_init(void) > > +{ > > + return -1; > > +} > > + > > int mmc_start_init(struct mmc *mmc) > > { > > int err; > > @@ -1293,6 +1299,8 @@ int mmc_start_init(struct mmc *mmc) > > if (mmc->has_init) > > return 0; > > > > + board_mmc_power_init(); > > + > > Shouldn't we have some error handling here? I noticed how weak implementations tend to return -1 and not have their return code checked so much (see the other two such functions in mmc.c). I would be fine with checking the return code and returning 0 in the weak implementation. If you think that's better, I'll make a new version with that. > > /* made sure it's not NULL earlier */ > > err = mmc->cfg->ops->init(mmc); > > > > diff --git a/include/mmc.h b/include/mmc.h > > index d74a190..aaea644 100644 > > --- a/include/mmc.h > > +++ b/include/mmc.h > > @@ -385,6 +385,7 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode); > > int mmc_legacy_init(int verbose); > > #endif > > > > +int board_mmc_power_init(void); > > int board_mmc_init(bd_t *bis); > > int cpu_mmc_init(bd_t *bis); > > int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr); > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: