* [PATCH] ARM: imx9: support env in fat and ext4
@ 2023-04-11 17:27 Oleksandr Suvorov
2023-04-12 8:38 ` Peng Fan
2023-07-11 19:42 ` sbabic
0 siblings, 2 replies; 3+ messages in thread
From: Oleksandr Suvorov @ 2023-04-11 17:27 UTC (permalink / raw)
To: u-boot
Cc: Oleksandr Suvorov, Fabio Estevam, Jian Li, NXP i.MX U-Boot Team,
Peng Fan, Simon Glass, Stefano Babic, Ye Li
Change boot device logic to also allow environment stored in fat and
in ext4 when booting from SD or eMMC.
As the boot device check for SD and for eMMC was depending on
ENV_IS_IN_MMC being defined, change the ifdef blocks at
env_get_location to use IS_ENABLED instead for all modes, returning
NOWHERE when no valid mode is found.
This solution is based on (with added SPL support):
Link: https://lore.kernel.org/all/20211020191626.3648540-1-ricardo@foundries.io/
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
---
arch/arm/mach-imx/imx9/soc.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c
index a16e22ea6bb..2dfce1492bb 100644
--- a/arch/arm/mach-imx/imx9/soc.c
+++ b/arch/arm/mach-imx/imx9/soc.c
@@ -286,35 +286,31 @@ int timer_init(void)
enum env_location env_get_location(enum env_operation op, int prio)
{
enum boot_device dev = get_boot_device();
- enum env_location env_loc = ENVL_UNKNOWN;
if (prio)
- return env_loc;
+ return ENVL_UNKNOWN;
switch (dev) {
-#if defined(CONFIG_ENV_IS_IN_SPI_FLASH)
case QSPI_BOOT:
- env_loc = ENVL_SPI_FLASH;
- break;
-#endif
-#if defined(CONFIG_ENV_IS_IN_MMC)
+ if (CONFIG_IS_ENABLED(ENV_IS_IN_SPI_FLASH))
+ return ENVL_SPI_FLASH;
+ return ENVL_NOWHERE;
case SD1_BOOT:
case SD2_BOOT:
case SD3_BOOT:
case MMC1_BOOT:
case MMC2_BOOT:
case MMC3_BOOT:
- env_loc = ENVL_MMC;
- break;
-#endif
+ if (CONFIG_IS_ENABLED(ENV_IS_IN_MMC))
+ return ENVL_MMC;
+ else if (CONFIG_IS_ENABLED(ENV_IS_IN_EXT4))
+ return ENVL_EXT4;
+ else if (CONFIG_IS_ENABLED(ENV_IS_IN_FAT))
+ return ENVL_FAT;
+ return ENVL_NOWHERE;
default:
-#if defined(CONFIG_ENV_IS_NOWHERE)
- env_loc = ENVL_NOWHERE;
-#endif
- break;
+ return ENVL_NOWHERE;
}
-
- return env_loc;
}
static int mix_power_init(enum mix_power_domain pd)
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: imx9: support env in fat and ext4
2023-04-11 17:27 [PATCH] ARM: imx9: support env in fat and ext4 Oleksandr Suvorov
@ 2023-04-12 8:38 ` Peng Fan
2023-07-11 19:42 ` sbabic
1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan @ 2023-04-12 8:38 UTC (permalink / raw)
To: Oleksandr Suvorov, u-boot
Cc: Fabio Estevam, Jian Li, NXP i.MX U-Boot Team, Peng Fan,
Simon Glass, Stefano Babic, Ye Li
On 4/12/2023 1:27 AM, Oleksandr Suvorov wrote:
> Change boot device logic to also allow environment stored in fat and
> in ext4 when booting from SD or eMMC.
>
> As the boot device check for SD and for eMMC was depending on
> ENV_IS_IN_MMC being defined, change the ifdef blocks at
> env_get_location to use IS_ENABLED instead for all modes, returning
> NOWHERE when no valid mode is found.
>
> This solution is based on (with added SPL support):
> Link: https://lore.kernel.org/all/20211020191626.3648540-1-ricardo@foundries.io/
> Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
>
> arch/arm/mach-imx/imx9/soc.c | 28 ++++++++++++----------------
> 1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c
> index a16e22ea6bb..2dfce1492bb 100644
> --- a/arch/arm/mach-imx/imx9/soc.c
> +++ b/arch/arm/mach-imx/imx9/soc.c
> @@ -286,35 +286,31 @@ int timer_init(void)
> enum env_location env_get_location(enum env_operation op, int prio)
> {
> enum boot_device dev = get_boot_device();
> - enum env_location env_loc = ENVL_UNKNOWN;
>
> if (prio)
> - return env_loc;
> + return ENVL_UNKNOWN;
>
> switch (dev) {
> -#if defined(CONFIG_ENV_IS_IN_SPI_FLASH)
> case QSPI_BOOT:
> - env_loc = ENVL_SPI_FLASH;
> - break;
> -#endif
> -#if defined(CONFIG_ENV_IS_IN_MMC)
> + if (CONFIG_IS_ENABLED(ENV_IS_IN_SPI_FLASH))
> + return ENVL_SPI_FLASH;
> + return ENVL_NOWHERE;
> case SD1_BOOT:
> case SD2_BOOT:
> case SD3_BOOT:
> case MMC1_BOOT:
> case MMC2_BOOT:
> case MMC3_BOOT:
> - env_loc = ENVL_MMC;
> - break;
> -#endif
> + if (CONFIG_IS_ENABLED(ENV_IS_IN_MMC))
> + return ENVL_MMC;
> + else if (CONFIG_IS_ENABLED(ENV_IS_IN_EXT4))
> + return ENVL_EXT4;
> + else if (CONFIG_IS_ENABLED(ENV_IS_IN_FAT))
> + return ENVL_FAT;
> + return ENVL_NOWHERE;
> default:
> -#if defined(CONFIG_ENV_IS_NOWHERE)
> - env_loc = ENVL_NOWHERE;
> -#endif
> - break;
> + return ENVL_NOWHERE;
> }
> -
> - return env_loc;
> }
>
> static int mix_power_init(enum mix_power_domain pd)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ARM: imx9: support env in fat and ext4
2023-04-11 17:27 [PATCH] ARM: imx9: support env in fat and ext4 Oleksandr Suvorov
2023-04-12 8:38 ` Peng Fan
@ 2023-07-11 19:42 ` sbabic
1 sibling, 0 replies; 3+ messages in thread
From: sbabic @ 2023-07-11 19:42 UTC (permalink / raw)
To: Oleksandr Suvorov, u-boot
> Change boot device logic to also allow environment stored in fat and
> in ext4 when booting from SD or eMMC.
> As the boot device check for SD and for eMMC was depending on
> ENV_IS_IN_MMC being defined, change the ifdef blocks at
> env_get_location to use IS_ENABLED instead for all modes, returning
> NOWHERE when no valid mode is found.
> This solution is based on (with added SPL support):
> Link: https://lore.kernel.org/all/20211020191626.3648540-1-ricardo@foundries.io/
> Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-11 19:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-11 17:27 [PATCH] ARM: imx9: support env in fat and ext4 Oleksandr Suvorov
2023-04-12 8:38 ` Peng Fan
2023-07-11 19:42 ` sbabic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox