[U-Boot] [PATCH 2/3] env_mmc: support env partition setup in runtime

Tom Rini trini at ti.com
Fri May 30 20:56:29 CEST 2014


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 <lifshitz at compulab.co.il>
> > Signed-off-by: Igor Grinberg <grinberg at compulab.co.il>
> > ---
> >  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: <http://lists.denx.de/pipermail/u-boot/attachments/20140530/0a40b835/attachment.pgp>


More information about the U-Boot mailing list