From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] env: mmc/fat/ext4: make sure that the MMC sub-system is initialized before using it
Date: Sun, 4 Feb 2018 20:58:45 +0100 [thread overview]
Message-ID: <20180204205845.3e9d357b@jawa> (raw)
In-Reply-To: <1517564875-10237-1-git-send-email-faiz_abbas@ti.com>
On Fri, 2 Feb 2018 15:17:55 +0530
Faiz Abbas <faiz_abbas@ti.com> wrote:
> When booting from a non-MMC device, the MMC sub-system may not be
> initialized when the environment is first accessed.
> We need to make sure that the MMC sub-system is ready in even a
> non-MMC boot case.
>
> Therefore, initialize mmc during .init() of environment.
>
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> ---
> env/ext4.c | 9 +++++++++
> env/fat.c | 9 +++++++++
> env/mmc.c | 8 ++++++++
> 3 files changed, 26 insertions(+)
>
> diff --git a/env/ext4.c b/env/ext4.c
> index 9cdf28e..ba93e5b 100644
> --- a/env/ext4.c
> +++ b/env/ext4.c
> @@ -123,9 +123,18 @@ err_env_relocate:
> return -EIO;
> }
>
> +static int env_ext4_init(void)
> +{
> + if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc"))
> + mmc_initialize(NULL);
> +
> + return 0;
> +}
> +
> U_BOOT_ENV_LOCATION(ext4) = {
> .location = ENVL_EXT4,
> ENV_NAME("EXT4")
> .load = env_ext4_load,
> .save = env_save_ptr(env_ext4_save),
> + .init = env_ext4_init,
> };
> diff --git a/env/fat.c b/env/fat.c
> index ec49c39..9f147ee 100644
> --- a/env/fat.c
> +++ b/env/fat.c
> @@ -112,6 +112,14 @@ err_env_relocate:
> }
> #endif /* LOADENV */
>
> +static int env_fat_init(void)
> +{
> + if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc"))
> + mmc_initialize(NULL);
> +
> + return 0;
> +}
> +
> U_BOOT_ENV_LOCATION(fat) = {
> .location = ENVL_FAT,
> ENV_NAME("FAT")
> @@ -121,4 +129,5 @@ U_BOOT_ENV_LOCATION(fat) = {
> #ifdef CMD_SAVEENV
> .save = env_save_ptr(env_fat_save),
> #endif
> + .init = env_fat_init,
> };
> diff --git a/env/mmc.c b/env/mmc.c
> index ed7bcf1..714a073 100644
> --- a/env/mmc.c
> +++ b/env/mmc.c
> @@ -365,6 +365,13 @@ err:
> }
> #endif /* CONFIG_ENV_OFFSET_REDUND */
>
> +static int env_mmc_init(void)
> +{
> + mmc_initialize(NULL);
> +
> + return 0;
> +}
> +
> U_BOOT_ENV_LOCATION(mmc) = {
> .location = ENVL_MMC,
> ENV_NAME("MMC")
> @@ -372,4 +379,5 @@ U_BOOT_ENV_LOCATION(mmc) = {
> #ifndef CONFIG_SPL_BUILD
> .save = env_save_ptr(env_mmc_save),
> #endif
> + .init = env_mmc_init,
> };
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180204/028ed066/attachment.sig>
next prev parent reply other threads:[~2018-02-04 19:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 9:47 [U-Boot] [PATCH] env: mmc/fat/ext4: make sure that the MMC sub-system is initialized before using it Faiz Abbas
2018-02-04 19:58 ` Lukasz Majewski [this message]
2018-02-04 21:29 ` Alex Kiernan
2018-02-05 13:37 ` Faiz Abbas
2018-02-07 8:52 ` Wolfgang Denk
2018-02-08 14:18 ` Faiz Abbas
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=20180204205845.3e9d357b@jawa \
--to=lukma@denx.de \
--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