diff mbox series

[v2,1/3] stm32mp1: board: add support of CONFIG_ENV_IS_IN_MMC

Message ID 20200615091824.3022-2-patrick.delaunay@st.com
State Accepted
Commit a9addcafd180abf4c51d02a5954c8d03ba747f26
Headers show
Series stm32mp1: board: add support of CONFIG_ENV_IS_IN_MMC | expand

Commit Message

Patrick Delaunay June 15, 2020, 9:18 a.m. UTC
Add support of CONFIG_ENV_IS_IN_MMC in env_get_location, used for
all mmc device (SD card and eMMC).
The 2 configs CONFIG_ENV_IS_IN_MMC and CONFIG_ENV_IS_IN_EXT4 are
incompatible.

Add the weak function mmc_get_env_dev to select the mmc boot instance.

Reviewed-by: Patrice Chotard <patrice.chotard at st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---

(no changes since v1)

 board/st/stm32mp1/stm32mp1.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Patrice CHOTARD July 28, 2020, 3:28 p.m. UTC | #1
On 6/15/20 11:18 AM, Patrick Delaunay wrote:
> Add support of CONFIG_ENV_IS_IN_MMC in env_get_location, used for

> all mmc device (SD card and eMMC).

> The 2 configs CONFIG_ENV_IS_IN_MMC and CONFIG_ENV_IS_IN_EXT4 are

> incompatible.

>

> Add the weak function mmc_get_env_dev to select the mmc boot instance.

>

> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

> ---

>

> (no changes since v1)

>

>  board/st/stm32mp1/stm32mp1.c | 14 ++++++++++++++

>  1 file changed, 14 insertions(+)

>

> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c

> index 4553329b25..b695e8bc6b 100644

> --- a/board/st/stm32mp1/stm32mp1.c

> +++ b/board/st/stm32mp1/stm32mp1.c

> @@ -833,6 +833,11 @@ enum env_location env_get_location(enum env_operation op, int prio)

>  		return ENVL_UNKNOWN;

>  

>  	switch (bootmode & TAMP_BOOT_DEVICE_MASK) {

> +#ifdef CONFIG_ENV_IS_IN_MMC

> +	case BOOT_FLASH_SD:

> +	case BOOT_FLASH_EMMC:

> +		return ENVL_MMC;

> +#endif

>  #ifdef CONFIG_ENV_IS_IN_EXT4

>  	case BOOT_FLASH_SD:

>  	case BOOT_FLASH_EMMC:

> @@ -875,6 +880,15 @@ const char *env_ext4_get_dev_part(void)

>  }

>  #endif

>  

> +#if defined(CONFIG_ENV_IS_IN_MMC)

> +int mmc_get_env_dev(void)

> +{

> +	u32 bootmode = get_bootmode();

> +

> +	return (bootmode & TAMP_BOOT_INSTANCE_MASK) - 1;

> +}

> +#endif

> +

>  #if defined(CONFIG_OF_BOARD_SETUP)

>  int ft_board_setup(void *blob, bd_t *bd)

>  {

Applied to u-boot-stm/master

Thanks

Patrice
diff mbox series

Patch

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 4553329b25..b695e8bc6b 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -833,6 +833,11 @@  enum env_location env_get_location(enum env_operation op, int prio)
 		return ENVL_UNKNOWN;
 
 	switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
+#ifdef CONFIG_ENV_IS_IN_MMC
+	case BOOT_FLASH_SD:
+	case BOOT_FLASH_EMMC:
+		return ENVL_MMC;
+#endif
 #ifdef CONFIG_ENV_IS_IN_EXT4
 	case BOOT_FLASH_SD:
 	case BOOT_FLASH_EMMC:
@@ -875,6 +880,15 @@  const char *env_ext4_get_dev_part(void)
 }
 #endif
 
+#if defined(CONFIG_ENV_IS_IN_MMC)
+int mmc_get_env_dev(void)
+{
+	u32 bootmode = get_bootmode();
+
+	return (bootmode & TAMP_BOOT_INSTANCE_MASK) - 1;
+}
+#endif
+
 #if defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, bd_t *bd)
 {