From: Tom Rini Date: Fri, 30 May 2014 14:56:29 -0400 Subject: [U-Boot] [PATCH 2/3] env_mmc: support env partition setup in runtime In-Reply-To: <53819A82.5090108@compulab.co.il> References: <1398593928-13860-1-git-send-email-lifshitz@compulab.co.il> <1398593928-13860-3-git-send-email-lifshitz@compulab.co.il> <53819A82.5090108@compulab.co.il> Message-ID: <20140530185629.GT5836@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, May 25, 2014 at 10:23:46AM +0300, Igor Grinberg wrote: > ping.. > > On 04/27/14 13:18, Dmitry Lifshitz wrote: > > Add callback with __weak annotation to allow setup of environment > > partition number in runtime from a board file. > > > > Signed-off-by: Dmitry Lifshitz > > Signed-off-by: Igor Grinberg > > --- > > common/env_mmc.c | 35 ++++++++++++++++++++++++++--------- > > 1 files changed, 26 insertions(+), 9 deletions(-) > > > > diff --git a/common/env_mmc.c b/common/env_mmc.c > > index 045428c..5d4b5f4 100644 > > --- a/common/env_mmc.c > > +++ b/common/env_mmc.c > > @@ -62,6 +62,30 @@ int env_init(void) > > return 0; > > } > > > > + > > +#ifdef CONFIG_SYS_MMC_ENV_PART > > +__weak uint mmc_get_env_part(struct mmc *mmc) > > +{ > > + return CONFIG_SYS_MMC_ENV_PART; > > +} > > + > > +static int mmc_set_env_part(struct mmc *mmc) > > +{ > > + uint part = mmc_get_env_part(mmc); > > + > > + if (part != mmc->part_num) { > > + if (mmc_switch_part(CONFIG_SYS_MMC_ENV_DEV, part)) { > > + puts("MMC partition switch failed\n"); > > + return -1; > > + } > > + } > > + > > + return 0; > > +} > > +#else > > +static inline int mmc_set_env_part(struct mmc *mmc) {return 0; }; > > +#endif > > + > > static int init_mmc_for_env(struct mmc *mmc) > > { > > if (!mmc) { > > @@ -74,15 +98,8 @@ static int init_mmc_for_env(struct mmc *mmc) > > return -1; > > } > > > > -#ifdef CONFIG_SYS_MMC_ENV_PART > > - if (CONFIG_SYS_MMC_ENV_PART != mmc->part_num) { > > - if (mmc_switch_part(CONFIG_SYS_MMC_ENV_DEV, > > - CONFIG_SYS_MMC_ENV_PART)) { > > - puts("MMC partition switch failed\n"); > > - return -1; > > - } > > - } > > -#endif > > + if (mmc_set_env_part(mmc)) > > + return -1; > > > > return 0; > > } > > Pantelis, weren't you going to pick this up? Thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: