From: Igor Grinberg <grinberg@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] env_mmc: support env partition setup in runtime
Date: Sun, 25 May 2014 10:23:46 +0300 [thread overview]
Message-ID: <53819A82.5090108@compulab.co.il> (raw)
In-Reply-To: <1398593928-13860-3-git-send-email-lifshitz@compulab.co.il>
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@compulab.co.il>
> Signed-off-by: Igor Grinberg <grinberg@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;
> }
>
--
Regards,
Igor.
next prev parent reply other threads:[~2014-05-25 7:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-27 10:18 [U-Boot] [PATCH 0/3] cm_t54: add MAC address and env partiton handling Dmitry Lifshitz
2014-04-27 10:18 ` [U-Boot] [PATCH 1/3] cm-t54: add EEPROM support and MAC address handling Dmitry Lifshitz
2014-05-23 23:48 ` [U-Boot] [U-Boot, " Tom Rini
2014-04-27 10:18 ` [U-Boot] [PATCH 2/3] env_mmc: support env partition setup in runtime Dmitry Lifshitz
2014-05-25 7:23 ` Igor Grinberg [this message]
2014-05-30 18:56 ` Tom Rini
2014-06-11 6:51 ` Igor Grinberg
2014-06-12 15:10 ` Pantelis Antoniou
2014-06-25 8:27 ` Dmitry Lifshitz
2014-04-27 10:18 ` [U-Boot] [PATCH 3/3] cm-t54: add environment partition runtime detection Dmitry Lifshitz
2014-05-23 23:49 ` [U-Boot] [U-Boot, " Tom Rini
2014-05-25 7:23 ` Igor Grinberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53819A82.5090108@compulab.co.il \
--to=grinberg@compulab.co.il \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox