stm32mp1: board: add support of CONFIG_ENV_IS_IN_MMC
Subsystems (2)
PATCH 1/3 stm32mp1: board: add support of CONFIG_ENV_IS_IN_MMC
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.
---
board/st/stm32mp1/stm32mp1.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
board/st/stm32mp1/stm32mp1.c +14 -0
@@ -785,6 +785,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 :
@@ -826,6 +831,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 +#ifdef CONFIG_SYS_MTDPARTS_RUNTIME #define MTDPARTS_LEN 256
Signature · 1 line
2.17.1
PATCH 2/3 stm32mp1: use a specific SD/eMMC partition for U-Boot enviromnent
Save the environment at the end of the U-Boot partition, the GPT partition named "ssbl" in SD card or eMMC and avoid requirements on the "bootfs" file system generated via specific raw tools (like wic and genimage).
With the previous configuration of the U-Boot environment saved in ext4 file, U-Boot need to create/modify the file uenv.txt in the ext4 file system; so this EXT4 file system need to be generated without some functionality, like metadata_csum and dir_index, because they are not supported by U-Boot.
---
arch/arm/dts/stm32mp157a-avenger96-u-boot.dtsi | 1 + arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 1 + configs/stm32mp15_basic_defconfig | 5 +---- configs/stm32mp15_optee_defconfig | 5 +---- configs/stm32mp15_trusted_defconfig | 5 +---- 6 files changed, 6 insertions(+), 12 deletions(-)
arch/arm/dts/stm32mp157a-avenger96-u-boot.dtsi +1 -0
@@ -20,6 +20,7 @@ config { u-boot,boot-led = "led1"; u-boot,error-led = "led4"; + u-boot,mmc-env-partition = "ssbl"; }; };
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +1 -0
@@ -16,6 +16,7 @@ config { u-boot,boot-led = "heartbeat"; u-boot,error-led = "error"; + u-boot,mmc-env-partition = "ssbl"; st,adc_usb_pd = <&adc1 18>, <&adc1 19>; st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +1 -0
@@ -17,6 +17,7 @@ config { u-boot,boot-led = "heartbeat"; u-boot,error-led = "error"; + u-boot,mmc-env-partition = "ssbl"; st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>; };
configs/stm32mp15_basic_defconfig +1 -4
@@ -55,13 +55,10 @@ CONFIG_CMD_UBI=y CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1" CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks" CONFIG_ENV_IS_NOWHERE=y -CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_UBI=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y -CONFIG_ENV_EXT4_INTERFACE="mmc" -CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto" -CONFIG_ENV_EXT4_FILE="/uboot.env" CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"
configs/stm32mp15_optee_defconfig +1 -4
@@ -42,13 +42,10 @@ CONFIG_CMD_MTDPARTS=y CONFIG_CMD_UBI=y CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1" CONFIG_ENV_IS_NOWHERE=y -CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_UBI=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y -CONFIG_ENV_EXT4_INTERFACE="mmc" -CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto" -CONFIG_ENV_EXT4_FILE="/uboot.env" CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"
configs/stm32mp15_trusted_defconfig +1 -4
@@ -41,13 +41,10 @@ CONFIG_CMD_MTDPARTS=y CONFIG_CMD_UBI=y CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1" CONFIG_ENV_IS_NOWHERE=y -CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_UBI=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y -CONFIG_ENV_EXT4_INTERFACE="mmc" -CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto" -CONFIG_ENV_EXT4_FILE="/uboot.env" CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"
Signature · 1 line
2.17.1
PATCH 2/3 stm32mp1: use a specific SD/eMMC partition for U-Boot enviromnent
Hi
Quoted 105 lines · Patrick Delaunay
Save the environment at the end of the U-Boot partition, the GPT partition named "ssbl" in SD card or eMMC and avoid requirements on the "bootfs" file system generated via specific raw tools (like wic and genimage).
With the previous configuration of the U-Boot environment saved in ext4 file, U-Boot need to create/modify the file uenv.txt in the ext4 file system; so this EXT4 file system need to be generated without some functionality, like
metadata_csumanddir_index, because they are not supported by U-Boot.Signed-off-by Patrick Delaunay <[email protected]>---
arch/arm/dts/stm32mp157a-avenger96-u-boot.dtsi | 1 + arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 1 + configs/stm32mp15_basic_defconfig | 5 +---- configs/stm32mp15_optee_defconfig | 5 +---- configs/stm32mp15_trusted_defconfig | 5 +---- 6 files changed, 6 insertions(+), 12 deletions(-)arch/arm/dts/stm32mp157a-avenger96-u-boot.dtsi +1
-0@@ -20,6 +20,7 @@ config { u-boot,boot-led = "led1"; u-boot,error-led = "led4"; + u-boot,mmc-env-partition = "ssbl"; }; };arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +1
-0@@ -16,6 +16,7 @@ config { u-boot,boot-led = "heartbeat"; u-boot,error-led = "error"; + u-boot,mmc-env-partition = "ssbl"; st,adc_usb_pd = <&adc1 18>, <&adc1 19>; st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +1
-0@@ -17,6 +17,7 @@ config { u-boot,boot-led = "heartbeat"; u-boot,error-led = "error"; + u-boot,mmc-env-partition = "ssbl"; st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>; };configs/stm32mp15_basic_defconfig +1
-4@@ -55,13 +55,10 @@ CONFIG_CMD_UBI=y CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1" CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks" CONFIG_ENV_IS_NOWHERE=y -CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_UBI=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y -CONFIG_ENV_EXT4_INTERFACE="mmc" -CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto" -CONFIG_ENV_EXT4_FILE="/uboot.env" CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"configs/stm32mp15_optee_defconfig +1
-4@@ -42,13 +42,10 @@ CONFIG_CMD_MTDPARTS=y CONFIG_CMD_UBI=y CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1" CONFIG_ENV_IS_NOWHERE=y -CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_UBI=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y -CONFIG_ENV_EXT4_INTERFACE="mmc" -CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto" -CONFIG_ENV_EXT4_FILE="/uboot.env" CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"configs/stm32mp15_trusted_defconfig +0
-1@@ -41,13 +41,10 @@ CONFIG_CMD_MTDPARTS=y CONFIG_CMD_UBI=y CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1" CONFIG_ENV_IS_NOWHERE=y -CONFIG_ENV_IS_IN_EXT4=y
configs/stm32mp15_trusted_defconfig CONFIG_CMD_MTDPARTS=y · line 50
Quoted 10 lines
configs/stm32mp15_trusted_defconfig +1
-3+CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_IS_IN_UBI=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y -CONFIG_ENV_EXT4_INTERFACE="mmc" -CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto" -CONFIG_ENV_EXT4_FILE="/uboot.env" CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"
Thanks
Patrice
PATCH 3/3 configs:stm32mp1: activate env config in SPL
In reply to Patrick DelaunayActivate env config in SPL with CONFIG_SPL_ENV_SUPPORT and use CONFIG_IS_ENABLED macro to test the activated CONFIG_$(SPL_)ENV_IS_IN_... in env_get_location.
---
board/st/stm32mp1/stm32mp1.c | 8 ++++---- configs/stm32mp15_basic_defconfig | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-)
board/st/stm32mp1/stm32mp1.c +4 -4
@@ -785,21 +785,21 @@ 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 +#if CONFIG_IS_ENABLED (ENV_IS_IN_MMC )case BOOT_FLASH_SD :case BOOT_FLASH_EMMC :return ENVL_MMC ;#endif -#ifdef CONFIG_ENV_IS_IN_EXT4 +#if CONFIG_IS_ENABLED (ENV_IS_IN_EXT4 )case BOOT_FLASH_SD :case BOOT_FLASH_EMMC :return ENVL_EXT4 ;#endif -#ifdef CONFIG_ENV_IS_IN_UBI +#if CONFIG_IS_ENABLED (ENV_IS_IN_UBI )case BOOT_FLASH_NAND :return ENVL_UBI ;#endif -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH +#if CONFIG_IS_ENABLED (ENV_IS_IN_SPI_FLASH )case BOOT_FLASH_NOR :return ENVL_SPI_FLASH ;#endif
configs/stm32mp15_basic_defconfig +3 -0
@@ -16,6 +16,7 @@ CONFIG_FIT=y CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3 +CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_MTD_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y
@@ -63,6 +64,8 @@ CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +# CONFIG_SPL_ENV_IS_NOWHERE is not set +# CONFIG_SPL_ENV_IS_IN_SPI_FLASH is not set CONFIG_STM32_ADC=y CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y
Signature · 1 line
2.17.1
PATCH 3/3 configs:stm32mp1: activate env config in SPL
Hi
Quoted 54 lines · Patrick Delaunay
Activate env config in SPL with
CONFIG_SPL_ENV_SUPPORTand useCONFIG_IS_ENABLEDmacro to test the activated CONFIG_$(SPL_)ENV_IS_IN_... inenv_get_location.Signed-off-by Patrick Delaunay <[email protected]>---
board/st/stm32mp1/stm32mp1.c | 8 ++++---- configs/stm32mp15_basic_defconfig | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-)board/st/stm32mp1/stm32mp1.c +4
-4@@ -785,21 +785,21 @@ 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 +#if CONFIG_IS_ENABLED (ENV_IS_IN_MMC )case BOOT_FLASH_SD :case BOOT_FLASH_EMMC :return ENVL_MMC ;#endif -#ifdef CONFIG_ENV_IS_IN_EXT4 +#if CONFIG_IS_ENABLED (ENV_IS_IN_EXT4 )case BOOT_FLASH_SD :case BOOT_FLASH_EMMC :return ENVL_EXT4 ;#endif -#ifdef CONFIG_ENV_IS_IN_UBI +#if CONFIG_IS_ENABLED (ENV_IS_IN_UBI )case BOOT_FLASH_NAND :return ENVL_UBI ;#endif -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH +#if CONFIG_IS_ENABLED (ENV_IS_IN_SPI_FLASH )case BOOT_FLASH_NOR :return ENVL_SPI_FLASH ;#endif configs/stm32mp15_basic_defconfig +1
-0@@ -16,6 +16,7 @@ CONFIG_FIT=y CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3 +CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_MTD_SUPPORT=y CONFIG_SPL_POWER_SUPPORT=y
configs/stm32mp15_basic_defconfig CONFIG_ENV_UBI_PART="UBI" · line 71
Quoted 8 lines
configs/stm32mp15_basic_defconfig +2
-0@@ -63,6 +64,8 @@ CONFIG_ENV_UBI_PART="UBI" CONFIG_ENV_UBI_VOLUME="uboot_config" CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +# CONFIG_SPL_ENV_IS_NOWHERE is not set +# CONFIG_SPL_ENV_IS_IN_SPI_FLASH is not set CONFIG_STM32_ADC=y CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y
Thanks
Patrice
PATCH 1/3 stm32mp1: board: add support of CONFIG_ENV_IS_IN_MMC
In reply to Patrick DelaunayHi
Quoted 35 lines · Patrick Delaunay
Add support of
CONFIG_ENV_IS_IN_MMCinenv_get_location, used for all mmc device (SD card and eMMC).
The 2 configsCONFIG_ENV_IS_IN_MMCandCONFIG_ENV_IS_IN_EXT4are incompatible.Add the weak function
mmc_get_env_devto select the mmc boot instance.Signed-off-by Patrick Delaunay <[email protected]>---
board/st/stm32mp1/stm32mp1.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)board/st/stm32mp1/stm32mp1.c +7
-0@@ -785,6 +785,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 :@@ -826,6 +831,15 @@ const char *env_ext4_get_dev_part(void) }#endif +#if defined(CONFIG_ENV_IS_IN_MMC ) +int mmc_get_env_dev (void )
board/st/stm32mp1/stm32mp1.c const char *env_ext4_get_dev_part(void) · line 845
Quoted 10 lines
board/st/stm32mp1/stm32mp1.c +7
-0+{ +u32 bootmode =get_bootmode (); + +return (bootmode &TAMP_BOOT_INSTANCE_MASK ) -1 ; +} +#endif +#ifdef CONFIG_SYS_MTDPARTS_RUNTIME #define MTDPARTS_LEN 256
Thanks
Patrice