[PATCH v2 00/11] stm32mp1: Support falcon mode with OP-TEE payloads

My goal when I started on this project a year ago was to get to linux userspace within a second from power on. Oh, and it had to be secure! Contrast that to the two minutes it took the STLinux demo to come up.
It was obvious that the accepted way of running an FSBL, then SSBL was going to blow the time budget. There really wasn't a good solution, and traditional falcon mode with "spl export" command was not secure.
I chose to use SPL with a FIT payload. We have to add certain logic to SPL, as well as some FDT modifications that would be normally done in u-boot. The boot flow is
SPL -> OP-TEE -> Linux
One of the major complaints of v1 was that we shouldn't be patching the devicetree with optee nodes in SPL. Instead, we should let OP-TEE add the required nodes. I tried it, found a huge boot time penalty, and decided against it.
Another issue from v1 that I was unable to address is the MAC address. It was suggested to use the "nvmem-cells" FDT property to tell linux where in the OTP to read the MAC. Because of the way the linux BSEC driver is written, this would only work with TF-A, but fails with SPL.
There is also the issue of how to make the optee/ library available to SPL. Patrick has a couple of patches up regarding the issue, so I have not touched it in this series.
Changes since v1: - Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig instead of stm32mp1.h - Create a new defconfig for STM32MP in falcon mode - Rework board_fit_config_name_match() per Patrick's suggestions - Use "u-boot,falcon-gpios" instead of "st,fastboot-gpios" - Only update shadow registers in SPL for BSEC .probe()
Alexandru Gagniuc (11): spl: Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig stm32mp1: Add support for baudrates higher than 115200 stm32mp1: Add support for falcon mode boot from SD card board: stm32mp1: Implement board_fit_config_name_match() for SPL fdt_support: Implement fdt_ethernet_set_macaddr() arm: stm32mp: bsec: Update OTP shadow registers in SPL arm: stm32mp: Factor out reading MAC address from OTP stm32mp1: spl: Configure MAC address when booting OP-TEE lib: Makefile: Make optee library available in SPL ARM: dts: stm32mp: Add OP-TEE "/firmware" node to SPL dtb stm32mp1: spl: Copy optee nodes to target FDT for OP-TEE payloads
README | 4 - arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 3 + arch/arm/mach-stm32mp/bsec.c | 4 +- arch/arm/mach-stm32mp/cpu.c | 59 ++++-- .../arm/mach-stm32mp/include/mach/sys_proto.h | 3 + arch/arm/mach-stm32mp/spl.c | 3 + board/st/stm32mp1/spl.c | 53 +++++ common/fdt_support.c | 30 +++ common/spl/Kconfig | 11 ++ configs/am335x_boneblack_vboot_defconfig | 1 + configs/am335x_evm_defconfig | 1 + configs/am335x_igep003x_defconfig | 1 + configs/am335x_shc_defconfig | 1 + configs/am335x_shc_ict_defconfig | 1 + configs/am335x_shc_netboot_defconfig | 1 + configs/am335x_shc_sdboot_defconfig | 1 + configs/am335x_sl50_defconfig | 1 + configs/am3517_evm_defconfig | 1 + configs/am43xx_evm_defconfig | 1 + configs/am43xx_evm_rtconly_defconfig | 1 + configs/am43xx_evm_usbhost_boot_defconfig | 1 + configs/am57xx_evm_defconfig | 1 + configs/devkit8000_defconfig | 1 + configs/display5_defconfig | 1 + configs/display5_factory_defconfig | 1 + configs/dra7xx_evm_defconfig | 1 + configs/gwventana_emmc_defconfig | 1 + configs/gwventana_gw5904_defconfig | 1 + configs/gwventana_nand_defconfig | 1 + configs/igep00x0_defconfig | 1 + configs/imx6dl_mamoj_defconfig | 1 + configs/imx6q_logic_defconfig | 1 + configs/imx6qdl_icore_mipi_defconfig | 1 + configs/imx6qdl_icore_mmc_defconfig | 1 + configs/imx6qdl_icore_rqs_defconfig | 1 + configs/mccmon6_nor_defconfig | 1 + configs/omap35_logic_defconfig | 1 + configs/omap35_logic_somlv_defconfig | 1 + configs/omap3_logic_defconfig | 1 + configs/omap3_logic_somlv_defconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap5_uevm_defconfig | 1 + configs/stm32mp15_falcon_defconfig | 181 ++++++++++++++++++ include/configs/brppt1.h | 1 - include/configs/devkit8000.h | 2 - include/configs/display5.h | 1 - include/configs/embestmx6boards.h | 1 - include/configs/gw_ventana.h | 1 - include/configs/imx6-engicam.h | 1 - include/configs/imx6_logic.h | 1 - include/configs/imx6dl-mamoj.h | 1 - include/configs/ls1043ardb.h | 1 - include/configs/mccmon6.h | 1 - include/configs/mx6sabreauto.h | 1 - include/configs/mx6sabresd.h | 1 - include/configs/pico-imx6.h | 1 - include/configs/pico-imx6ul.h | 1 - include/configs/pico-imx7d.h | 1 - include/configs/sama5d3_xplained.h | 1 - include/configs/stm32mp1.h | 4 + include/configs/tam3517-common.h | 1 - include/configs/ti_armv7_common.h | 1 - include/configs/vyasa-rk3288.h | 1 - include/configs/xea.h | 1 - include/configs/xilinx_zynqmp.h | 1 - include/configs/zynq-common.h | 1 - include/fdt_support.h | 17 ++ lib/Makefile | 2 +- scripts/config_whitelist.txt | 1 - 69 files changed, 386 insertions(+), 45 deletions(-) create mode 100644 configs/stm32mp15_falcon_defconfig

Although Falcon mode is very useful in improving boot speed, its implementation is quite antiquated. A question that Falcon mode asks is "Where do I look for the kernel". With MMC boot media, the correct answer is CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR.
There are a few things to be said about the wisdom of using a raw sector as opposed to more elegant schemes. However, changing how falcon mode works is beyond the scope of this change.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- README | 4 ---- common/spl/Kconfig | 11 +++++++++++ configs/am335x_boneblack_vboot_defconfig | 1 + configs/am335x_evm_defconfig | 1 + configs/am335x_igep003x_defconfig | 1 + configs/am335x_shc_defconfig | 1 + configs/am335x_shc_ict_defconfig | 1 + configs/am335x_shc_netboot_defconfig | 1 + configs/am335x_shc_sdboot_defconfig | 1 + configs/am335x_sl50_defconfig | 1 + configs/am3517_evm_defconfig | 1 + configs/am43xx_evm_defconfig | 1 + configs/am43xx_evm_rtconly_defconfig | 1 + configs/am43xx_evm_usbhost_boot_defconfig | 1 + configs/am57xx_evm_defconfig | 1 + configs/devkit8000_defconfig | 1 + configs/display5_defconfig | 1 + configs/display5_factory_defconfig | 1 + configs/dra7xx_evm_defconfig | 1 + configs/gwventana_emmc_defconfig | 1 + configs/gwventana_gw5904_defconfig | 1 + configs/gwventana_nand_defconfig | 1 + configs/igep00x0_defconfig | 1 + configs/imx6dl_mamoj_defconfig | 1 + configs/imx6q_logic_defconfig | 1 + configs/imx6qdl_icore_mipi_defconfig | 1 + configs/imx6qdl_icore_mmc_defconfig | 1 + configs/imx6qdl_icore_rqs_defconfig | 1 + configs/mccmon6_nor_defconfig | 1 + configs/omap35_logic_defconfig | 1 + configs/omap35_logic_somlv_defconfig | 1 + configs/omap3_logic_defconfig | 1 + configs/omap3_logic_somlv_defconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap5_uevm_defconfig | 1 + include/configs/brppt1.h | 1 - include/configs/devkit8000.h | 2 -- include/configs/display5.h | 1 - include/configs/embestmx6boards.h | 1 - include/configs/gw_ventana.h | 1 - include/configs/imx6-engicam.h | 1 - include/configs/imx6_logic.h | 1 - include/configs/imx6dl-mamoj.h | 1 - include/configs/ls1043ardb.h | 1 - include/configs/mccmon6.h | 1 - include/configs/mx6sabreauto.h | 1 - include/configs/mx6sabresd.h | 1 - include/configs/pico-imx6.h | 1 - include/configs/pico-imx6ul.h | 1 - include/configs/pico-imx7d.h | 1 - include/configs/sama5d3_xplained.h | 1 - include/configs/tam3517-common.h | 1 - include/configs/ti_armv7_common.h | 1 - include/configs/vyasa-rk3288.h | 1 - include/configs/xea.h | 1 - include/configs/xilinx_zynqmp.h | 1 - include/configs/zynq-common.h | 1 - scripts/config_whitelist.txt | 1 - 58 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/README b/README index 1c1db98098..7df53a9861 100644 --- a/README +++ b/README @@ -2182,10 +2182,6 @@ The following options need to be configured: Partition on the MMC to load U-Boot from when the MMC is being used in raw mode
- CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR - Sector to load kernel uImage from when MMC is being - used in raw mode (for Falcon mode) - CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS Sector and number of sectors to load kernel argument diff --git a/common/spl/Kconfig b/common/spl/Kconfig index c155a3b5fc..1c6b57af49 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -990,6 +990,17 @@ config SYS_OS_BASE
endif # SPL_OS_BOOT
+config SYS_MMCSD_RAW_MODE_KERNEL_SECTOR + hex "Falcon mode: Sector to load kernel uImage from MMC" + default 0x0 + depends on SPL_OS_BOOT + help + When Falcon mode is used with an MMC or SD media, SPL needs to know + where to look for the kernel uImage. The image is expected to begin + at the raw MMC specified in this config. + Note that the Falcon mode image can also be a FIT, if FIT support is + enabled. + config SPL_PAYLOAD string "SPL payload" default "tpl/u-boot-with-tpl.bin" if TPL diff --git a/configs/am335x_boneblack_vboot_defconfig b/configs/am335x_boneblack_vboot_defconfig index e720e1d553..5683010ef2 100644 --- a/configs/am335x_boneblack_vboot_defconfig +++ b/configs/am335x_boneblack_vboot_defconfig @@ -24,6 +24,7 @@ CONFIG_SPL_MUSB_NEW=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_NET_VCI_STRING="AM33xx U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_USB_GADGET=y CONFIG_SPL_USB_ETHER=y CONFIG_CMD_SPL=y diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig index ef8de5999e..951cc76189 100644 --- a/configs/am335x_evm_defconfig +++ b/configs/am335x_evm_defconfig @@ -24,6 +24,7 @@ CONFIG_SPL_NAND_BASE=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_NET_VCI_STRING="AM335x U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_USB_GADGET=y CONFIG_SPL_USB_ETHER=y CONFIG_CMD_SPL=y diff --git a/configs/am335x_igep003x_defconfig b/configs/am335x_igep003x_defconfig index 0ec6851f32..8b82fdcbc7 100644 --- a/configs/am335x_igep003x_defconfig +++ b/configs/am335x_igep003x_defconfig @@ -38,6 +38,7 @@ CONFIG_SPL_UBI_LOAD_MONITOR_ID=0 CONFIG_SPL_UBI_LOAD_KERNEL_ID=3 CONFIG_SPL_UBI_LOAD_ARGS_ID=4 CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_SPL_YMODEM_SUPPORT=y diff --git a/configs/am335x_shc_defconfig b/configs/am335x_shc_defconfig index 0c4186daa4..2e15bd656f 100644 --- a/configs/am335x_shc_defconfig +++ b/configs/am335x_shc_defconfig @@ -30,6 +30,7 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_SPL_YMODEM_SUPPORT=y diff --git a/configs/am335x_shc_ict_defconfig b/configs/am335x_shc_ict_defconfig index 354586b70b..08553bb399 100644 --- a/configs/am335x_shc_ict_defconfig +++ b/configs/am335x_shc_ict_defconfig @@ -31,6 +31,7 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_SPL_YMODEM_SUPPORT=y diff --git a/configs/am335x_shc_netboot_defconfig b/configs/am335x_shc_netboot_defconfig index 43fef20380..0516f8de4e 100644 --- a/configs/am335x_shc_netboot_defconfig +++ b/configs/am335x_shc_netboot_defconfig @@ -32,6 +32,7 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_SPL_YMODEM_SUPPORT=y diff --git a/configs/am335x_shc_sdboot_defconfig b/configs/am335x_shc_sdboot_defconfig index 4010d83fec..b7e49b4e43 100644 --- a/configs/am335x_shc_sdboot_defconfig +++ b/configs/am335x_shc_sdboot_defconfig @@ -31,6 +31,7 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_SPL_YMODEM_SUPPORT=y diff --git a/configs/am335x_sl50_defconfig b/configs/am335x_sl50_defconfig index 1f3b680bd6..a19571b292 100644 --- a/configs/am335x_sl50_defconfig +++ b/configs/am335x_sl50_defconfig @@ -32,6 +32,7 @@ CONFIG_SPL_NAND_BASE=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_NET_VCI_STRING="AM335x U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_SPL_YMODEM_SUPPORT=y diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig index 1234aa2251..1ccf25cb61 100644 --- a/configs/am3517_evm_defconfig +++ b/configs/am3517_evm_defconfig @@ -27,6 +27,7 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 # CONFIG_SPL_POWER is not set CONFIG_SYS_PROMPT="AM3517_EVM # " # CONFIG_CMD_IMI is not set diff --git a/configs/am43xx_evm_defconfig b/configs/am43xx_evm_defconfig index 5d35176890..55e5456c4e 100644 --- a/configs/am43xx_evm_defconfig +++ b/configs/am43xx_evm_defconfig @@ -23,6 +23,7 @@ CONFIG_SPL_NAND_BASE=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_NET_VCI_STRING="AM43xx U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_USB_HOST=y CONFIG_SPL_USB_GADGET=y CONFIG_SPL_USB_ETHER=y diff --git a/configs/am43xx_evm_rtconly_defconfig b/configs/am43xx_evm_rtconly_defconfig index 955ea087ac..03c6ec4ee4 100644 --- a/configs/am43xx_evm_rtconly_defconfig +++ b/configs/am43xx_evm_rtconly_defconfig @@ -20,6 +20,7 @@ CONFIG_SPL_NAND_DRIVERS=y CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_CMD_SPL=y CONFIG_CMD_SPL_NAND_OFS=0x00100000 CONFIG_CMD_SPL_WRITE_SIZE=0x40000 diff --git a/configs/am43xx_evm_usbhost_boot_defconfig b/configs/am43xx_evm_usbhost_boot_defconfig index 98b07b9a19..848dd91f1c 100644 --- a/configs/am43xx_evm_usbhost_boot_defconfig +++ b/configs/am43xx_evm_usbhost_boot_defconfig @@ -19,6 +19,7 @@ CONFIG_SPL_NAND_DRIVERS=y CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_USB_HOST=y CONFIG_SPL_USB_STORAGE=y CONFIG_SPL_USB_GADGET=y diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig index cc11323b9d..c8a131da6c 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -33,6 +33,7 @@ CONFIG_SPL_DMA=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000 CONFIG_SPL_YMODEM_SUPPORT=y diff --git a/configs/devkit8000_defconfig b/configs/devkit8000_defconfig index 2be548ea2c..02dba7896b 100644 --- a/configs/devkit8000_defconfig +++ b/configs/devkit8000_defconfig @@ -13,6 +13,7 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x500 # CONFIG_CMD_IMI is not set CONFIG_CMD_SPL=y CONFIG_CMD_SPL_NAND_OFS=0x680000 diff --git a/configs/display5_defconfig b/configs/display5_defconfig index d6541876f1..745ad6e1d6 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -41,6 +41,7 @@ CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_SAVEENV=y CONFIG_SPL_I2C=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x100 CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000 CONFIG_SPL_WATCHDOG=y diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig index 7dbed0473a..bcb62e6e88 100644 --- a/configs/display5_factory_defconfig +++ b/configs/display5_factory_defconfig @@ -38,6 +38,7 @@ CONFIG_MISC_INIT_R=y CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x100 CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000 CONFIG_SPL_USB_HOST=y diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig index 0c253da80c..a1f6d5668b 100644 --- a/configs/dra7xx_evm_defconfig +++ b/configs/dra7xx_evm_defconfig @@ -34,6 +34,7 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SPL_RAM_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000 diff --git a/configs/gwventana_emmc_defconfig b/configs/gwventana_emmc_defconfig index 9e764f40a2..2ecd48a49c 100644 --- a/configs/gwventana_emmc_defconfig +++ b/configs/gwventana_emmc_defconfig @@ -40,6 +40,7 @@ CONFIG_SPL_FIT_IMAGE_TINY=y CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_HUSH_PARSER=y diff --git a/configs/gwventana_gw5904_defconfig b/configs/gwventana_gw5904_defconfig index bab61e7daa..5602437d56 100644 --- a/configs/gwventana_gw5904_defconfig +++ b/configs/gwventana_gw5904_defconfig @@ -40,6 +40,7 @@ CONFIG_SPL_FIT_IMAGE_TINY=y CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_HUSH_PARSER=y diff --git a/configs/gwventana_nand_defconfig b/configs/gwventana_nand_defconfig index e59efebab7..cc31c394be 100644 --- a/configs/gwventana_nand_defconfig +++ b/configs/gwventana_nand_defconfig @@ -41,6 +41,7 @@ CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_NAND_SUPPORT=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_SPL_POWER=y CONFIG_SPL_WATCHDOG=y CONFIG_HUSH_PARSER=y diff --git a/configs/igep00x0_defconfig b/configs/igep00x0_defconfig index a3b97e512c..0194102daa 100644 --- a/configs/igep00x0_defconfig +++ b/configs/igep00x0_defconfig @@ -35,6 +35,7 @@ CONFIG_SPL_UBI_LOAD_KERNEL_ID=3 CONFIG_SPL_UBI_LOAD_ARGS_ID=4 CONFIG_SPL_ONENAND_SUPPORT=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_CMD_SPL=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_NAND=y diff --git a/configs/imx6dl_mamoj_defconfig b/configs/imx6dl_mamoj_defconfig index 48f0c0356d..9a33f99fba 100644 --- a/configs/imx6dl_mamoj_defconfig +++ b/configs/imx6dl_mamoj_defconfig @@ -16,6 +16,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_CMD_SPL=y CONFIG_CRC32_VERIFY=y CONFIG_CMD_MEMTEST=y diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig index ed8db745b6..bfb6dd3845 100644 --- a/configs/imx6q_logic_defconfig +++ b/configs/imx6q_logic_defconfig @@ -33,6 +33,7 @@ CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_NAND_SUPPORT=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_SPL_USB_HOST=y CONFIG_SPL_USB_GADGET=y CONFIG_SPL_USB_SDP_SUPPORT=y diff --git a/configs/imx6qdl_icore_mipi_defconfig b/configs/imx6qdl_icore_mipi_defconfig index d3191a250a..35add6b87f 100644 --- a/configs/imx6qdl_icore_mipi_defconfig +++ b/configs/imx6qdl_icore_mipi_defconfig @@ -30,6 +30,7 @@ CONFIG_SUPPORT_RAW_INITRD=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_SPL_WATCHDOG=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="icorem6qdl-mipi> " diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig index 76375ae911..bf74b0c4bf 100644 --- a/configs/imx6qdl_icore_mmc_defconfig +++ b/configs/imx6qdl_icore_mmc_defconfig @@ -33,6 +33,7 @@ CONFIG_SUPPORT_RAW_INITRD=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_SPL_WATCHDOG=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="icorem6qdl> " diff --git a/configs/imx6qdl_icore_rqs_defconfig b/configs/imx6qdl_icore_rqs_defconfig index 328e68d20a..b305014359 100644 --- a/configs/imx6qdl_icore_rqs_defconfig +++ b/configs/imx6qdl_icore_rqs_defconfig @@ -27,6 +27,7 @@ CONFIG_SUPPORT_RAW_INITRD=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_SPL_WATCHDOG=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="icorem6qdl-rqs> " diff --git a/configs/mccmon6_nor_defconfig b/configs/mccmon6_nor_defconfig index 2c82e3ca45..ac216ceb15 100644 --- a/configs/mccmon6_nor_defconfig +++ b/configs/mccmon6_nor_defconfig @@ -28,6 +28,7 @@ CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_NOR_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_SYS_OS_BASE=0x8180000 +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1000 CONFIG_CMD_SPL=y CONFIG_CMD_SPL_NOR_OFS=0x09600000 CONFIG_CMD_SPL_WRITE_SIZE=0x20000 diff --git a/configs/omap35_logic_defconfig b/configs/omap35_logic_defconfig index 8b0c943024..71e3dd024d 100644 --- a/configs/omap35_logic_defconfig +++ b/configs/omap35_logic_defconfig @@ -30,6 +30,7 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SYS_PROMPT="OMAP Logic # " # CONFIG_CMD_IMI is not set CONFIG_CMD_SPL=y diff --git a/configs/omap35_logic_somlv_defconfig b/configs/omap35_logic_somlv_defconfig index 2ab92551e4..ad1f60834f 100644 --- a/configs/omap35_logic_somlv_defconfig +++ b/configs/omap35_logic_somlv_defconfig @@ -30,6 +30,7 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 # CONFIG_SPL_POWER is not set CONFIG_SYS_PROMPT="OMAP Logic # " # CONFIG_CMD_IMI is not set diff --git a/configs/omap3_logic_defconfig b/configs/omap3_logic_defconfig index ec7a8a6e37..b02067529d 100644 --- a/configs/omap3_logic_defconfig +++ b/configs/omap3_logic_defconfig @@ -30,6 +30,7 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_SYS_PROMPT="OMAP Logic # " # CONFIG_CMD_IMI is not set CONFIG_CMD_SPL=y diff --git a/configs/omap3_logic_somlv_defconfig b/configs/omap3_logic_somlv_defconfig index f2e9d20e8f..544ba8a6a7 100644 --- a/configs/omap3_logic_somlv_defconfig +++ b/configs/omap3_logic_somlv_defconfig @@ -30,6 +30,7 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 # CONFIG_SPL_POWER is not set CONFIG_SYS_PROMPT="OMAP Logic # " # CONFIG_CMD_IMI is not set diff --git a/configs/omap4_panda_defconfig b/configs/omap4_panda_defconfig index 3585566cc0..f79c0f22e6 100644 --- a/configs/omap4_panda_defconfig +++ b/configs/omap4_panda_defconfig @@ -15,6 +15,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_SPL_I2C is not set # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_CMD_SPL=y CONFIG_CMD_ASKENV=y CONFIG_CMD_GPIO=y diff --git a/configs/omap5_uevm_defconfig b/configs/omap5_uevm_defconfig index 16264ae457..59719fa2dc 100644 --- a/configs/omap5_uevm_defconfig +++ b/configs/omap5_uevm_defconfig @@ -16,6 +16,7 @@ CONFIG_DEFAULT_FDT_FILE="omap5-uevm.dtb" CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1700 CONFIG_CMD_SPL=y CONFIG_CMD_ASKENV=y CONFIG_CMD_DFU=y diff --git a/include/configs/brppt1.h b/include/configs/brppt1.h index f9a0632e54..5de6cb296d 100644 --- a/include/configs/brppt1.h +++ b/include/configs/brppt1.h @@ -42,7 +42,6 @@ #define CONFIG_SYS_SPL_ARGS_ADDR 0x80F80000
/* RAW SD card / eMMC */ -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x900 /* address 0x120000 */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x80 /* address 0x10000 */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x80 /* 64KiB */
diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index 87da4410f5..811fa76935 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -159,10 +159,8 @@ /* SPL OS boot options */ #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000
-#undef CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR #undef CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR #undef CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x500 /* address 0xa0000 */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x8 /* address 0x1000 */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 8 /* 4KB */
diff --git a/include/configs/display5.h b/include/configs/display5.h index 40bb3b53a5..eb1be9e27b 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -16,7 +16,6 @@ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x3F00 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS \ (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x100 /* 128KiB */
/* * display5 SPI-NOR memory layout diff --git a/include/configs/embestmx6boards.h b/include/configs/embestmx6boards.h index 401b50d51b..3fc0b43760 100644 --- a/include/configs/embestmx6boards.h +++ b/include/configs/embestmx6boards.h @@ -77,7 +77,6 @@ #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage" #define CONFIG_SPL_FS_LOAD_ARGS_NAME "imx6dl-riotboard.dtb"
-#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0 /* offset 69KB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0 /* offset 69KB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0 /* offset 69KB */
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h index 4f27273634..7b8a0ff524 100644 --- a/include/configs/gw_ventana.h +++ b/include/configs/gw_ventana.h @@ -19,7 +19,6 @@ /* Falcon Mode - MMC support: args@1MB kernel@2MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */
#include "imx6_spl.h" /* common IMX6 SPL configuration */ #include "mx6_common.h" diff --git a/include/configs/imx6-engicam.h b/include/configs/imx6-engicam.h index bfe83b8cba..5af856948a 100644 --- a/include/configs/imx6-engicam.h +++ b/include/configs/imx6-engicam.h @@ -158,7 +158,6 @@ /* MMC support: args@1MB kernel@2MB */ # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -# define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ #endif
/* Framebuffer */ diff --git a/include/configs/imx6_logic.h b/include/configs/imx6_logic.h index 6b992f9ab8..a1e220b407 100644 --- a/include/configs/imx6_logic.h +++ b/include/configs/imx6_logic.h @@ -161,6 +161,5 @@ /* Falcon Mode - MMC support: args@1MB kernel@2MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */
#endif /* __IMX6LOGIC_CONFIG_H */ diff --git a/include/configs/imx6dl-mamoj.h b/include/configs/imx6dl-mamoj.h index 4027f329d3..8d5c844d11 100644 --- a/include/configs/imx6dl-mamoj.h +++ b/include/configs/imx6dl-mamoj.h @@ -61,7 +61,6 @@ /* MMC support: args@1MB kernel@2MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */
/* Miscellaneous configurable options */
diff --git a/include/configs/ls1043ardb.h b/include/configs/ls1043ardb.h index 84b83e6259..eb1b5390fb 100644 --- a/include/configs/ls1043ardb.h +++ b/include/configs/ls1043ardb.h @@ -36,7 +36,6 @@ #ifdef CONFIG_SD_BOOT #define CONFIG_SYS_FSL_PBL_RCW board/freescale/ls1043ardb/ls1043ardb_rcw_sd.cfg #define CONFIG_SYS_SPL_ARGS_ADDR 0x90000000 -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x10000 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x500 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 30 #endif diff --git a/include/configs/mccmon6.h b/include/configs/mccmon6.h index 0c383e94cc..398b472474 100644 --- a/include/configs/mccmon6.h +++ b/include/configs/mccmon6.h @@ -22,7 +22,6 @@ */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800) #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000) #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "fitImage"
/* Size of malloc() pool */ diff --git a/include/configs/mx6sabreauto.h b/include/configs/mx6sabreauto.h index 626dbd55d7..a9ea4e20e8 100644 --- a/include/configs/mx6sabreauto.h +++ b/include/configs/mx6sabreauto.h @@ -36,7 +36,6 @@ /* Falcon Mode - MMC support: args@1MB kernel@2MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ #endif
#ifdef CONFIG_MTD_NOR_FLASH diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h index 9546887182..022aeddc0f 100644 --- a/include/configs/mx6sabresd.h +++ b/include/configs/mx6sabresd.h @@ -26,7 +26,6 @@ /* Falcon Mode - MMC support: args@1MB kernel@2MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */
#define CONFIG_SYS_FSL_USDHC_NUM 3
diff --git a/include/configs/pico-imx6.h b/include/configs/pico-imx6.h index 6199f0d72e..4bf1d6d865 100644 --- a/include/configs/pico-imx6.h +++ b/include/configs/pico-imx6.h @@ -21,7 +21,6 @@ /* Falcon Mode - MMC support: args@1MB kernel@2MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ #endif
/* Size of malloc() pool */ diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 04a2531f74..9fb202c640 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -23,7 +23,6 @@ /* Falcon Mode - MMC support: args@1MB kernel@2MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ #endif
/* Network support */ diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index f5d2c23400..edc7f96583 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -21,7 +21,6 @@ /* Falcon Mode - MMC support: args@1MB kernel@2MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ #endif
/* Size of malloc() pool */ diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index 4c25964b43..9827ebda11 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -83,7 +83,6 @@ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x100 /* 128 KiB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) /* U-Boot proper stored by default at 0x200 (256 KiB) */ -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ #define CONFIG_SYS_SPL_ARGS_ADDR 0x22000000
/* Falcon boot support on FAT on MMC */ diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h index 41efb64752..5641d9ccd2 100644 --- a/include/configs/tam3517-common.h +++ b/include/configs/tam3517-common.h @@ -140,7 +140,6 @@ #define CONFIG_SPL_FS_LOAD_ARGS_NAME "args"
/* RAW SD card / eMMC */ -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x900 /* address 0x120000 */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x80 /* address 0x10000 */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x80 /* 64KiB */
diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index 4fcf741c0a..31bf53fc26 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -170,7 +170,6 @@ #define CONFIG_SPL_FS_LOAD_ARGS_NAME "args"
/* RAW SD card / eMMC */ -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1700 /* address 0x2E0000 */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x1500 /* address 0x2A0000 */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x200 /* 256KiB */ #endif diff --git a/include/configs/vyasa-rk3288.h b/include/configs/vyasa-rk3288.h index 3dc10b29c3..8176719561 100644 --- a/include/configs/vyasa-rk3288.h +++ b/include/configs/vyasa-rk3288.h @@ -32,7 +32,6 @@ /* Falcon Mode - MMC support: args@16MB kernel@17MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x8000 /* 16MB */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x8800 /* 17MB */ #endif
#endif diff --git a/include/configs/xea.h b/include/configs/xea.h index 1207f75017..2a735a424e 100644 --- a/include/configs/xea.h +++ b/include/configs/xea.h @@ -27,7 +27,6 @@
#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (SZ_512K / 0x200) #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (SZ_32K / 0x200) -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (SZ_1M / 0x200)
#ifndef CONFIG_SPL_BUILD #define CONFIG_SPI_FLASH_MTD diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 262154cdff..d9e90c0825 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -248,7 +248,6 @@ #ifdef CONFIG_MMC_SDHCI_ZYNQ # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0 /* unused */ # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0 /* unused */ -# define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0 /* unused */ # if defined(CONFIG_SPL_LOAD_FIT) # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.itb" # else diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 7859b77603..3b5d4655da 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -238,7 +238,6 @@ /* Not using MMC raw mode - just for compilation purpose */ #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0 -#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0
/* qspi mode is working fine */ #ifdef CONFIG_ZYNQ_QSPI diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index d86f35856f..48a74f0ec4 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -2567,7 +2567,6 @@ CONFIG_SYS_MII_MODE CONFIG_SYS_MIPS_TIMER_FREQ CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS -CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR CONFIG_SYS_MMC_CD_PIN CONFIG_SYS_MMC_CLK_OD CONFIG_SYS_MMC_MAX_BLK_COUNT

Hi,
On 9/8/21 1:59 AM, Alexandru Gagniuc wrote:
Although Falcon mode is very useful in improving boot speed, its implementation is quite antiquated. A question that Falcon mode asks is "Where do I look for the kernel". With MMC boot media, the correct answer is CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR.
There are a few things to be said about the wisdom of using a raw sector as opposed to more elegant schemes. However, changing how falcon mode works is beyond the scope of this change.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com
README | 4 ---- common/spl/Kconfig | 11 +++++++++++ configs/am335x_boneblack_vboot_defconfig | 1 + configs/am335x_evm_defconfig | 1 + configs/am335x_igep003x_defconfig | 1 + configs/am335x_shc_defconfig | 1 + configs/am335x_shc_ict_defconfig | 1 + configs/am335x_shc_netboot_defconfig | 1 + configs/am335x_shc_sdboot_defconfig | 1 + configs/am335x_sl50_defconfig | 1 + configs/am3517_evm_defconfig | 1 + configs/am43xx_evm_defconfig | 1 + configs/am43xx_evm_rtconly_defconfig | 1 + configs/am43xx_evm_usbhost_boot_defconfig | 1 + configs/am57xx_evm_defconfig | 1 + configs/devkit8000_defconfig | 1 + configs/display5_defconfig | 1 + configs/display5_factory_defconfig | 1 + configs/dra7xx_evm_defconfig | 1 + configs/gwventana_emmc_defconfig | 1 + configs/gwventana_gw5904_defconfig | 1 + configs/gwventana_nand_defconfig | 1 + configs/igep00x0_defconfig | 1 + configs/imx6dl_mamoj_defconfig | 1 + configs/imx6q_logic_defconfig | 1 + configs/imx6qdl_icore_mipi_defconfig | 1 + configs/imx6qdl_icore_mmc_defconfig | 1 + configs/imx6qdl_icore_rqs_defconfig | 1 + configs/mccmon6_nor_defconfig | 1 + configs/omap35_logic_defconfig | 1 + configs/omap35_logic_somlv_defconfig | 1 + configs/omap3_logic_defconfig | 1 + configs/omap3_logic_somlv_defconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap5_uevm_defconfig | 1 + include/configs/brppt1.h | 1 - include/configs/devkit8000.h | 2 -- include/configs/display5.h | 1 - include/configs/embestmx6boards.h | 1 - include/configs/gw_ventana.h | 1 - include/configs/imx6-engicam.h | 1 - include/configs/imx6_logic.h | 1 - include/configs/imx6dl-mamoj.h | 1 - include/configs/ls1043ardb.h | 1 - include/configs/mccmon6.h | 1 - include/configs/mx6sabreauto.h | 1 - include/configs/mx6sabresd.h | 1 - include/configs/pico-imx6.h | 1 - include/configs/pico-imx6ul.h | 1 - include/configs/pico-imx7d.h | 1 - include/configs/sama5d3_xplained.h | 1 - include/configs/tam3517-common.h | 1 - include/configs/ti_armv7_common.h | 1 - include/configs/vyasa-rk3288.h | 1 - include/configs/xea.h | 1 - include/configs/xilinx_zynqmp.h | 1 - include/configs/zynq-common.h | 1 - scripts/config_whitelist.txt | 1 - 58 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/README b/README index 1c1db98098..7df53a9861 100644 --- a/README +++ b/README @@ -2182,10 +2182,6 @@ The following options need to be configured: Partition on the MMC to load U-Boot from when the MMC is being used in raw mode - CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR - Sector to load kernel uImage from when MMC is being - used in raw mode (for Falcon mode)
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS Sector and number of sectors to load kernel argument diff --git a/common/spl/Kconfig b/common/spl/Kconfig index c155a3b5fc..1c6b57af49 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -990,6 +990,17 @@ config SYS_OS_BASE endif # SPL_OS_BOOT +config SYS_MMCSD_RAW_MODE_KERNEL_SECTOR + hex "Falcon mode: Sector to load kernel uImage from MMC" + default 0x0 + depends on SPL_OS_BOOT + help + When Falcon mode is used with an MMC or SD media, SPL needs to know + where to look for the kernel uImage. The image is expected to begin + at the raw MMC specified in this config. + Note that the Falcon mode image can also be a FIT, if FIT support is + enabled.
The define will be activated for all the board ... with default value 0x0 !?
So the code in mmc_load_image_raw_os() will be activated (the SPL behavior change):
#if defined(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR)
you need to add a boolean CONFIG_.* _USE_ .* to manage this case.
=> see SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR / SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
+ add depends on CONFIG_SPL_MMC as this define is only used in this spl_mmc.c
proposal :
+config SYS_MMCSD_RAW_MODE_KERNEL_USE_SECTOR + bool "Falcon mode: use sector to load kernel uImage from MMC" + depends on SPL_OS_BOOT && SPL_MMC + help + Use sector number for specifying Kernel location on MMC/SD in + raw mode. + +config SYS_MMCSD_RAW_MODE_KERNEL_SECTOR + hex "Falcon mode: MMC raw address to load kernel uImage" + default 0x0 + depends on SYS_MMCSD_RAW_MODE_KERNEL_USE_SECTOR + help + When Falcon mode is used with an MMC or SD media, SPL needs to know + where to look for the kernel uImage. The image is expected to begin + at the raw MMC specified in this config. + Note that the Falcon mode image can also be a FIT, if FIT support is + enabled. + Units: MMC sectors (1 sector = 512 bytes).
NB: can you also migrate the remaining CONFIG_SYS_MMCSD_RAW configs ?
- CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR
- CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS
Regards
Patrick

The UART can reliably go up to 2000000 baud when connected to the on-board st-link. Unfortunately u-boot will fall back to 115200 unless higher rates are declared via CONFIG_SYS_BAUDRATE_TABLE.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com Reviewed-by: Patrick Delaunay patrick.delaunay@foss.st.com --- include/configs/stm32mp1.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index b372838be8..9fcd60285a 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -16,6 +16,10 @@ #define CONFIG_ARMV7_SECURE_MAX_SIZE STM32_SYSRAM_SIZE #endif
+#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ + 230400, 460800, 921600, \ + 1000000, 2000000 } + /* * Configuration of the external SRAM memory used by U-Boot */

Falcon mode requires a board-specific mechanism to select between fast and normal boot. This is done via spl_start_uboot()
Use the USER2 button as the selection mechanism. This is connected to GPIO PA13. This GPIO is already accessible via the "st,fastboot-gpios" devicetree node, but is is also aliased as "u-boot,falcon-gpios". This is the only button on DK2 which accessible simultaneously to the RESET button. USER2 is too close, and I can't fit my fingers to press both.
The fact that USER2 is also used for android fastboot is of no consequence. One can let go of USER2 after SPL but before being sampled by u-boot. If that is missed, it's okay, u-boot tries to initialize the ethernet, which can be stopped with a Ctr-C. This conveniently opens up a u-boot shell.
Offsets for raw MMC loading are defined. These point to the partition after "ssbl". Offsets for SPI are not defined, and thus SPL_LOAD_SPI must be disabled to avoid a build failure. The only way to accommodate this is to add a new defconfig, adventurously named stm32mp1_falcon.
The baudrate is set to 2 Mbaud, as the point of this config is to boot fast. The default devicetree is set to -dk2. This is because EV1 does not have a crypto-enabled CPU, and thus enabling ECDSA support would have made far less sense. That and all the goodies with FIT in SPL are enabled to give this config some continuous integration TLC.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 2 + board/st/stm32mp1/spl.c | 39 +++++ configs/stm32mp15_falcon_defconfig | 181 +++++++++++++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 configs/stm32mp15_falcon_defconfig
diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index 0101962ea5..b314ce2dac 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -16,6 +16,8 @@ u-boot,boot-led = "heartbeat"; u-boot,error-led = "error"; u-boot,mmc-env-partition = "fip"; + /* This is the same as fastboot-gpios. This is on purpose */ + u-boot,falcon-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; st,adc_usb_pd = <&adc1 18>, <&adc1 19>; st,fastboot-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c index 8e4549a1b3..921d0190e0 100644 --- a/board/st/stm32mp1/spl.c +++ b/board/st/stm32mp1/spl.c @@ -8,6 +8,7 @@ #include <init.h> #include <asm/io.h> #include <asm/arch/sys_proto.h> +#include <asm/gpio.h> #include <linux/bitops.h> #include <linux/delay.h> #include "../common/stpmic1.h" @@ -29,6 +30,44 @@ int board_early_init_f(void) return 0; }
+#if IS_ENABLED(CONFIG_SPL_OS_BOOT) +int spl_start_uboot(void) +{ + ofnode node; + struct gpio_desc gpio; + int boot_uboot = 1; + + node = ofnode_path("/config"); + if (!ofnode_valid(node)) { + pr_warn("%s: no /config node?\n", __func__); + return 0; + } + + if (gpio_request_by_name_nodev(node, "u-boot,falcon-gpios", 0, &gpio, + GPIOD_IS_IN)) { + pr_warn("%s: could not find a /config/u-boot,falcon-gpios\n", + __func__); + return 1; + } + + boot_uboot = dm_gpio_get_value(&gpio); + dm_gpio_free(NULL, &gpio); + + return boot_uboot; +} + +#if IS_ENABLED(CONFIG_ARMV7_NONSEC) +/* + * A bit of a hack, but armv7_boot_nonsec() is provided by bootm.c. This is not + * available in SPL, so we have to provide an implementation. + */ +bool armv7_boot_nonsec(void) +{ + return 0; +} +#endif /* CONFIG_ARMV7_NONSEC */ +#endif /* CONFIG_SPL_OS_BOOT */ + #ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init(void) { diff --git a/configs/stm32mp15_falcon_defconfig b/configs/stm32mp15_falcon_defconfig new file mode 100644 index 0000000000..f86ef41589 --- /dev/null +++ b/configs/stm32mp15_falcon_defconfig @@ -0,0 +1,181 @@ +CONFIG_ARM=y +CONFIG_ARCH_STM32MP=y +CONFIG_SYS_MALLOC_F_LEN=0x3000 +CONFIG_SYS_MEMTEST_START=0xc0000000 +CONFIG_SYS_MEMTEST_END=0xc4000000 +CONFIG_ENV_OFFSET=0x280000 +CONFIG_ENV_SECT_SIZE=0x40000 +CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-dk2" +CONFIG_SPL_TEXT_BASE=0x2FFC2500 +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL=y +CONFIG_TARGET_ST_STM32MP15x=y +CONFIG_CMD_STM32KEY=y +CONFIG_CMD_STM32PROG=y +CONFIG_ENV_OFFSET_REDUND=0x2C0000 +CONFIG_TYPEC_STUSB160X=y +# CONFIG_ARMV7_VIRT is not set +CONFIG_DISTRO_DEFAULTS=y +CONFIG_FIT=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY=y +# CONFIG_USE_SPL_FIT_GENERATOR is not set +CONFIG_BOOTDELAY=1 +CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" +CONFIG_SPL_LOG=y +CONFIG_BOARD_EARLY_INIT_F=y +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=y +CONFIG_SPL_MTD_SUPPORT=y +CONFIG_SPL_OS_BOOT=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1422 +CONFIG_SPL_POWER=y +CONFIG_SPL_OPTEE=y +CONFIG_SYS_PROMPT="STM32MP> " +CONFIG_CMD_ADTIMG=y +CONFIG_CMD_ERASEENV=y +CONFIG_CMD_NVEDIT_EFI=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_UNZIP=y +CONFIG_CMD_ADC=y +CONFIG_CMD_CLK=y +CONFIG_CMD_DFU=y +CONFIG_CMD_FUSE=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y +CONFIG_CMD_MMC=y +CONFIG_CMD_REMOTEPROC=y +CONFIG_CMD_SPI=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_BMP=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_EFIDEBUG=y +CONFIG_CMD_TIME=y +CONFIG_CMD_RNG=y +CONFIG_CMD_TIMER=y +CONFIG_CMD_PMIC=y +CONFIG_CMD_REGULATOR=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_LOG=y +CONFIG_CMD_UBI=y +# CONFIG_SPL_DOS_PARTITION is not set +CONFIG_OF_LIVE=y +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_MMC=y +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_ENV_IS_IN_UBI=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y +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_SYS_MMC_ENV_DEV=-1 +# CONFIG_SPL_ENV_IS_NOWHERE is not set +# CONFIG_SPL_ENV_IS_IN_SPI_FLASH is not set +CONFIG_STM32_ADC=y +CONFIG_SET_DFU_ALT_INFO=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0xC0000000 +CONFIG_FASTBOOT_BUF_SIZE=0x02000000 +CONFIG_FASTBOOT_USB_DEV=1 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=1 +CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y +CONFIG_FASTBOOT_MMC_BOOT1_NAME="mmc1boot0" +CONFIG_FASTBOOT_MMC_BOOT2_NAME="mmc1boot1" +CONFIG_FASTBOOT_MMC_USER_SUPPORT=y +CONFIG_FASTBOOT_MMC_USER_NAME="mmc1" +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y +CONFIG_FASTBOOT_CMD_OEM_PARTCONF=y +CONFIG_FASTBOOT_CMD_OEM_BOOTBUS=y +CONFIG_GPIO_HOG=y +CONFIG_DM_HWSPINLOCK=y +CONFIG_HWSPINLOCK_STM32=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_STM32F7=y +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_DM_MAILBOX=y +CONFIG_STM32_IPCC=y +CONFIG_STM32_FMC2_EBI=y +CONFIG_SUPPORT_EMMC_BOOT=y +CONFIG_STM32_SDMMC2=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_SYS_MTDPARTS_RUNTIME=y +CONFIG_MTD_RAW_NAND=y +CONFIG_NAND_STM32_FMC2=y +CONFIG_MTD_SPI_NAND=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set +CONFIG_SPI_FLASH_MTD=y +CONFIG_PHY_REALTEK=y +CONFIG_DM_ETH=y +CONFIG_DWC_ETH_QOS=y +CONFIG_PHY=y +CONFIG_PHY_STM32_USBPHYC=y +CONFIG_PINCONF=y +# CONFIG_SPL_PINCTRL_FULL is not set +CONFIG_PINCTRL_STMFX=y +CONFIG_DM_PMIC=y +# CONFIG_SPL_PMIC_CHILDREN is not set +CONFIG_PMIC_STPMIC1=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DM_REGULATOR_STM32_VREFBUF=y +CONFIG_DM_REGULATOR_STPMIC1=y +CONFIG_REMOTEPROC_STM32_COPRO=y +CONFIG_DM_RNG=y +CONFIG_RNG_STM32MP1=y +CONFIG_DM_RTC=y +CONFIG_RTC_STM32=y +CONFIG_BAUDRATE=2000000 +CONFIG_SERIAL_RX_BUFFER=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_STM32_QSPI=y +CONFIG_STM32_SPI=y +CONFIG_SYSRESET_CMD_POWEROFF=y +CONFIG_TEE=y +CONFIG_OPTEE=y +CONFIG_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics" +CONFIG_USB_GADGET_VENDOR_NUM=0x0483 +CONFIG_USB_GADGET_PRODUCT_NUM=0x5720 +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_DM_VIDEO=y +CONFIG_BACKLIGHT_GPIO=y +CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y +CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y +CONFIG_VIDEO_STM32=y +CONFIG_VIDEO_STM32_DSI=y +CONFIG_VIDEO_STM32_MAX_XRES=1280 +CONFIG_VIDEO_STM32_MAX_YRES=800 +CONFIG_VIDEO_BMP_RLE8=y +CONFIG_BMP_16BPP=y +CONFIG_BMP_24BPP=y +CONFIG_BMP_32BPP=y +CONFIG_WDT=y +CONFIG_WDT_STM32MP=y +CONFIG_ECDSA=y +CONFIG_SPL_ECDSA_VERIFY=y +CONFIG_ERRNO_STR=y +CONFIG_FDT_FIXUP_PARTITIONS=y +# CONFIG_LMB_USE_MAX_REGIONS is not set +CONFIG_LMB_MEMORY_REGIONS=2 +CONFIG_LMB_RESERVED_REGIONS=16

Hi,
On 9/8/21 1:59 AM, Alexandru Gagniuc wrote:
Falcon mode requires a board-specific mechanism to select between fast and normal boot. This is done via spl_start_uboot()
Use the USER2 button as the selection mechanism. This is connected to GPIO PA13. This GPIO is already accessible via the "st,fastboot-gpios" devicetree node, but is is also aliased as "u-boot,falcon-gpios". This is the only button on DK2 which accessible simultaneously to the RESET button. USER2 is too close, and I can't fit my fingers to press both.
The fact that USER2 is also used for android fastboot is of no consequence. One can let go of USER2 after SPL but before being sampled by u-boot. If that is missed, it's okay, u-boot tries to initialize the ethernet, which can be stopped with a Ctr-C. This conveniently opens up a u-boot shell.
Offsets for raw MMC loading are defined. These point to the partition after "ssbl". Offsets for SPI are not defined, and thus SPL_LOAD_SPI must be disabled to avoid a build failure. The only way to accommodate this is to add a new defconfig, adventurously named stm32mp1_falcon.
The baudrate is set to 2 Mbaud, as the point of this config is to boot fast. The default devicetree is set to -dk2. This is because EV1 does not have a crypto-enabled CPU, and thus enabling ECDSA support would have made far less sense. That and all the goodies with FIT in SPL are enabled to give this config some continuous integration TLC.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 2 + board/st/stm32mp1/spl.c | 39 +++++ configs/stm32mp15_falcon_defconfig | 181 +++++++++++++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 configs/stm32mp15_falcon_defconfig
diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index 0101962ea5..b314ce2dac 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -16,6 +16,8 @@ u-boot,boot-led = "heartbeat"; u-boot,error-led = "error"; u-boot,mmc-env-partition = "fip";
/* This is the same as fastboot-gpios. This is on purpose */
st,adc_usb_pd = <&adc1 18>, <&adc1 19>; st,fastboot-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;u-boot,falcon-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c index 8e4549a1b3..921d0190e0 100644 --- a/board/st/stm32mp1/spl.c +++ b/board/st/stm32mp1/spl.c @@ -8,6 +8,7 @@ #include <init.h> #include <asm/io.h> #include <asm/arch/sys_proto.h> +#include <asm/gpio.h> #include <linux/bitops.h> #include <linux/delay.h> #include "../common/stpmic1.h" @@ -29,6 +30,44 @@ int board_early_init_f(void) return 0; }
+#if IS_ENABLED(CONFIG_SPL_OS_BOOT) +int spl_start_uboot(void) +{
- ofnode node;
- struct gpio_desc gpio;
- int boot_uboot = 1;
- node = ofnode_path("/config");
- if (!ofnode_valid(node)) {
pr_warn("%s: no /config node?\n", __func__);
return 0;
- }
- if (gpio_request_by_name_nodev(node, "u-boot,falcon-gpios", 0, &gpio,
GPIOD_IS_IN)) {
pr_warn("%s: could not find a /config/u-boot,falcon-gpios\n",
__func__);
return 1;
- }
- boot_uboot = dm_gpio_get_value(&gpio);
- dm_gpio_free(NULL, &gpio);
- return boot_uboot;
+}
I don't like the duplicated function for one key...
To avoid conflict with GPIO key already used for other purpose fastboot,
the Falcon mode activation can also use U-Boot environment
=> benefit:
1/ U-Boot can be requested by Linux before reset.... (set env boot_os=0)
2/ for first boot, the U-Boot is started to execute "spl export" before to set "boot_os=1"
And / or with console to force U-Boot as it is done by many other board (check 'c' character)
/* * Return * 0 if booting into OS is selected * 1 if booting into U-Boot is selected */ intspl_start_uboot(void) {/* Break into full U-Boot on 'c' */ if (serial_tstc() && serial_getc() == 'c') return 1; /* check environment for falcon mode activation */ env_init(); if(env_get_yesno("boot_os") != 0) return0; return1; }
+#if IS_ENABLED(CONFIG_ARMV7_NONSEC) +/*
- A bit of a hack, but armv7_boot_nonsec() is provided by bootm.c. This is not
- available in SPL, so we have to provide an implementation.
- */
+bool armv7_boot_nonsec(void) +{
- return 0;
+}
This hack can be avoid => CONFIG_ARMV7_NONSEC not activated
U-Boot is running in normal world after OP-TEE / loaded by SPL :
it is the same for PSCI / SCMI support !
config STM32MP15x bool "Support STMicroelectronics STM32MP15x Soc" select ARCH_SUPPORT_PSCI if !TFABOOT && !SPL_OPTEE_IMAGE select ARM_SMCCC if TFABOOT || SPL_OPTEE_IMAGE select CPU_V7A select CPU_V7_HAS_NONSEC if !TFABOOT && !SPL_OPTEE_IMAGE select CPU_V7_HAS_VIRT select OF_BOARD_SETUP select PINCTRL_STM32 select STM32_RCC select STM32_RESET select STM32_SERIAL select SYS_ARCH_TIMER imply CMD_NVEDIT_INFO imply SYSRESET_PSCI if TFABOOT || SPL_OPTEE_IMAGE imply SYSRESET_SYSCON if !TFABOOT && !SPL_OPTEE_IMAGE
+#endif /* CONFIG_ARMV7_NONSEC */ +#endif /* CONFIG_SPL_OS_BOOT */
- #ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init(void) {
diff --git a/configs/stm32mp15_falcon_defconfig b/configs/stm32mp15_falcon_defconfig
stm32mp15_falcon_defconfig or stm32mp15_spl_optee_defconfig
=> if OPTEE is loaded after SPL the U-Boot configuration change (running in secure world or not)
I am starting to work on these issues in the branch
https://github.com/u-boot/u-boot/compare/master...patrickdelaunay:spl_optee_...
https://github.com/u-boot/u-boot/commit/04ad553e9c6bee62781460d2952df4962e58...
https://github.com/u-boot/u-boot/commit/aebb687a1557590bf070cf5d3478544ffff2...
But it is still not working, OP-TEE is not correctly started
regards
Patrick

On 10/4/21 9:57 AM, Patrick DELAUNAY wrote:
Hi,
=> if OPTEE is loaded after SPL the U-Boot configuration change (running in secure world or not)
I am starting to work on these issues in the branch
https://github.com/u-boot/u-boot/compare/master...patrickdelaunay:spl_optee_... https://github.com/u-boot/u-boot/commit/04ad553e9c6bee62781460d2952df4962e58... https://github.com/u-boot/u-boot/commit/aebb687a1557590bf070cf5d3478544ffff2...
But it is still not working, OP-TEE is not correctly started
What do you mean by "OP-TEE is not correctly started". Here's the .its that I use for my FIT image. I hope this will be helpful.
/dts-v1/ ;/ { description = "U-Boot fitImage for stm32mp1"; #address-cells = <1>; images { optee-1 { description = "OP-TEE secure world firmware"; data = /incbin/("firmware/tee.bin"); type = "tee"; arch = "arm"; os = "tee"; compression = "none"; load = <0xddffffe4>; entry = <0xde000000>; hash-1 { algo = "sha256"; }; }; kernel-1 { description = "Linux kernel"; data = /incbin/("kernel/zImage"); type = "kernel"; arch = "arm"; os = "linux"; compression = "none"; load = <0xc2000040>; entry = <0xc2000040>; hash-1 { algo = "sha256"; }; }; fdt-stm32mp157c-ev1.dtb { description = "Flattened Device Tree blob"; data = /incbin/("kernel/stm32mp157c-ev1.dtb"); type = "flat_dt"; arch = "arm"; compression = "none"; hash-1 { algo = "sha256"; }; }; fdt-stm32mp157c-dk2.dtb { description = "Flattened Device Tree blob"; data = /incbin/("kernel/stm32mp157c-dk2.dtb"); type = "flat_dt"; arch = "arm"; compression = "none"; hash-1 { algo = "sha256"; }; }; fdt-dk2-optee.dto { description = "Flattened Device Tree blob"; data = /incbin/("firmware/dk2-optee.dto"); type = "flat_dt"; arch = "arm"; compression = "none"; hash-1 { algo = "sha256"; }; }; fdt-dk2-can1-enable.dto { description = "Flattened Device Tree blob"; data = /incbin/("firmware/dk2-can1-enable.dto"); type = "flat_dt"; arch = "arm"; compression = "none"; hash-1 { algo = "sha256"; }; }; fdt-bootargs.dto { description = "Flattened Device Tree blob"; data = /incbin/("firmware/bootargs.dto"); type = "flat_dt"; arch = "arm"; compression = "none"; hash-1 { algo = "sha256"; }; }; }; configurations { default = "secure-stm32mp157c-ev1.dtb"; secure-stm32mp157c-ev1.dtb { description = "Linux with OP-TEE for stm32mp157c-ev1.dtb"; kernel = "optee-1"; fdt = "fdt-stm32mp157c-ev1.dtb", "fdt-bootargs.dto"; loadables = "kernel-1"; hash-1 { algo = "sha256"; }; }; secure-stm32mp157c-dk2.dtb { description = "Linux with OP-TEE for stm32mp157c-dk2.dtb"; kernel = "optee-1"; fdt = "fdt-stm32mp157c-dk2.dtb", "fdt-bootargs.dto", "fdt-dk2-can1-enable.dto", "fdt-dk2-optee.dto"; loadables = "kernel-1"; hash-1 { algo = "sha256"; }; }; }; };

This function is needed when loading a FIT image from SPL. It selects the correct configuration node for the current board. Implement it.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- board/st/stm32mp1/spl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c index 921d0190e0..7542ee52c9 100644 --- a/board/st/stm32mp1/spl.c +++ b/board/st/stm32mp1/spl.c @@ -5,6 +5,7 @@
#include <config.h> #include <common.h> +#include <dm/device.h> #include <init.h> #include <asm/io.h> #include <asm/arch/sys_proto.h> @@ -92,3 +93,16 @@ void board_debug_uart_init(void) #endif } #endif + +int board_fit_config_name_match(const char *name) +{ + const void *compatible; + + compatible = fdt_getprop(gd->fdt_blob, 0, "compatible", NULL); + + /* only STM boards are supported (currently) */ + if (strncmp(compatible, "st,", 3) != 0) + return 1; + + return !strstr(name, compatible + 3); +}

Oftentimes we have MAC address information stored in a ROM or OTP. The way to add that to the FDT would be through the u-boot environment, and then fdt_fixup_ethernet(). This is not very useful in SPL.
It would be more helpful to be able to "set interface x to MAC y". This is where fdt_ethernet_set_macaddr() comes in. It is similar in function to fdt_fixup_ethernet(), but only updates one interface, without using the u-boot env, and without string processing.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- common/fdt_support.c | 30 ++++++++++++++++++++++++++++++ include/fdt_support.h | 17 +++++++++++++++++ 2 files changed, 47 insertions(+)
diff --git a/common/fdt_support.c b/common/fdt_support.c index 8992ac5d3f..1c43640cf7 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -610,6 +610,36 @@ void fdt_fixup_ethernet(void *fdt) } }
+int fdt_ethernet_set_macaddr(void *fdt, int ethnum, const uint8_t *mac_addr) +{ + const char *path, *name; + int prop, aliases_node; + char eth_name[16] = "ethernet"; + + aliases_node = fdt_path_offset(fdt, "/aliases"); + if (aliases_node < 0) + return aliases_node; + + if (ethnum >= 0) + sprintf(eth_name, "ethernet%d", ethnum); + + fdt_for_each_property_offset(prop, fdt, aliases_node) { + path = fdt_getprop_by_offset(fdt, prop, &name, NULL); + if (!strcmp(name, eth_name)) + break; + + path = NULL; + } + + if (!path) + return -FDT_ERR_NOTFOUND; + + do_fixup_by_path(fdt, path, "mac-address", mac_addr, 6, 0); + do_fixup_by_path(fdt, path, "local-mac-address", mac_addr, 6, 1); + + return 0; +} + int fdt_record_loadable(void *blob, u32 index, const char *name, uintptr_t load_addr, u32 size, uintptr_t entry_point, const char *type, const char *os, const char *arch) diff --git a/include/fdt_support.h b/include/fdt_support.h index f6f46bb8e9..3f0bcb5a00 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -119,6 +119,23 @@ static inline int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], #endif
void fdt_fixup_ethernet(void *fdt); + +/** + * Set the "mac-address" and "local-mac-address" of ethernet node + * The ethernet node is located from the "/aliases" section of the fdt. When + * 'ethnum' is positive, then the name is matched exactly, e.g "ethernet0". + * When ethnum is negative, the first ethernet alias is updated. + * Unlike fdt_fixup_ethernet(), this function only updates one ethernet node, + * and soes not use the "ethaddr" from the u-boot environment. This is useful, + * for example, in SPL, when the environment is not initialized or available. + * + * @param fdt FDT blob to update + * @param ethnum Ethernet device index, or negative for any ethernet + * @param mac_addr Pointer to 6-byte array containing the MAC address + * + * @return 0 if ok, or -FDT_ERR_... on error + */ +int fdt_ethernet_set_macaddr(void *fdt, int ethnum, const uint8_t *mac_addr); int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, const void *val, int len, int create); void fdt_fixup_qe_firmware(void *fdt);

For TFABOOT and SPL_BUILD, stm32mp_bsec_probe() skipped updating the OTP shadow registers. The idea is that we can't access BSEC from the normal world. This is true with TFABOOT. However, in SPL, we are in the secure world, so skipping probe is incorrect. In fact, SPL is not even built when TFABOOT is selected.
Thus, do not skip this step for SPL_BUILD. Note that because SPL is now doing this step, we no longer need to do it in u-boot. The new logic is "let the FSBL do it", which is simpler.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- arch/arm/mach-stm32mp/bsec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index fe39bd80cf..41ed5f3cf5 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -503,10 +503,10 @@ static int stm32mp_bsec_probe(struct udevice *dev)
/* * update unlocked shadow for OTP cleared by the rom code - * only executed in U-Boot proper when TF-A is not used + * Executed only by FSBL (SPL or TF-A) */
- if (!IS_ENABLED(CONFIG_TFABOOT) && !IS_ENABLED(CONFIG_SPL_BUILD)) { + if (IS_ENABLED(CONFIG_SPL_BUILD)) { plat = dev_get_plat(dev);
for (otp = 57; otp <= BSEC_OTP_MAX_VALUE; otp++)

Move the reading the OTP into a separate function. This is required for a subsequent change which sets the MAC in SPL.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- arch/arm/mach-stm32mp/cpu.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index eb79f3ffd2..8727de513c 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -593,6 +593,28 @@ static void setup_boot_mode(void) clrsetbits_le32(TAMP_BOOT_CONTEXT, TAMP_BOOT_FORCED_MASK, BOOT_NORMAL); }
+static int stm32_read_otp_mac(uint8_t enetaddr[ARP_HLEN]) +{ + struct udevice *dev; + int ret, i; + u32 otp[2]; + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(stm32mp_bsec), + &dev); + if (ret) + return ret; + + ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), otp, sizeof(otp)); + if (ret < 0) + return ret; + + for (i = 0; i < ARP_HLEN; i++) + enetaddr[i] = ((uint8_t *)&otp)[i]; + + return 0; +} + /* * If there is no MAC address in the environment, then it will be initialized * (silently) from the value in the OTP. @@ -601,29 +623,16 @@ __weak int setup_mac_address(void) { #if defined(CONFIG_NET) int ret; - int i; - u32 otp[2]; uchar enetaddr[6]; - struct udevice *dev;
/* MAC already in environment */ if (eth_env_get_enetaddr("ethaddr", enetaddr)) return 0;
- ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_DRIVER_GET(stm32mp_bsec), - &dev); - if (ret) - return ret; - - ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), - otp, sizeof(otp)); + ret = stm32_read_otp_mac(enetaddr); if (ret < 0) return ret;
- for (i = 0; i < 6; i++) - enetaddr[i] = ((uint8_t *)&otp)[i]; - if (!is_valid_ethaddr(enetaddr)) { log_err("invalid MAC address in OTP %pM\n", enetaddr); return -EINVAL;

When OP-TEE is booted as the SPL payload, the stage after OP-TEE is not guaranteed to be u-boot. Thus the FDT patching in u-boot is not guaranteed to occur. Add this step to SPL.
The patching by stm32_fdt_setup_mac_addr() is done in SPL, and patches the target FDT directly. This differs is different from setup_mac_address(), which sets the "ethaddr" env variable, and does not work in SPL.
An alternative way of setting the MAC is to patch the kernel's devicetree to use the "nvmem-cells" property. This would backend on the linux BSEC driver, which relies on an SMCC call. That call is implemented only by TF-A, not by SPL. Thus linux will not be able to read the MAC from OTP, and this alternative method will fail.
Changing the linux driver is not feasible is our goal is to support the current linux LTS release (v5.14). Implementing the SMCC call would require SPL finagling, and possibly carry security side-effects.
Thus, adding "mac-address" nodes to the kernel devicetree is the most economical method in terms of lines of code and complexity.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- arch/arm/mach-stm32mp/cpu.c | 22 +++++++++++++++++++ .../arm/mach-stm32mp/include/mach/sys_proto.h | 3 +++ arch/arm/mach-stm32mp/spl.c | 1 + 3 files changed, 26 insertions(+)
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c index 8727de513c..2b8b67bb40 100644 --- a/arch/arm/mach-stm32mp/cpu.c +++ b/arch/arm/mach-stm32mp/cpu.c @@ -10,6 +10,7 @@ #include <cpu_func.h> #include <debug_uart.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <log.h> #include <lmb.h> @@ -646,6 +647,27 @@ __weak int setup_mac_address(void) return 0; }
+int stm32_fdt_setup_mac_addr(void *fdt) +{ + int ret; + uchar enetaddr[ARP_HLEN]; + + ret = stm32_read_otp_mac(enetaddr); + if (ret < 0) + return ret; + + if (!is_valid_ethaddr(enetaddr)) { + printf("invalid MAC address in OTP\n"); + return -EINVAL; + } + + ret = fdt_ethernet_set_macaddr(fdt, 0, enetaddr); + if (ret) + debug("Failed to set mac address from OTP: %d\n", ret); + + return ret; +} + static int setup_serial_number(void) { char serial_string[25]; diff --git a/arch/arm/mach-stm32mp/include/mach/sys_proto.h b/arch/arm/mach-stm32mp/include/mach/sys_proto.h index 4149d3a133..2d24cfee3f 100644 --- a/arch/arm/mach-stm32mp/include/mach/sys_proto.h +++ b/arch/arm/mach-stm32mp/include/mach/sys_proto.h @@ -47,7 +47,10 @@ void get_soc_name(char name[SOC_NAME_SIZE]); /* return boot mode */ u32 get_bootmode(void);
+/* Set 'ethaddr' env variable with MAC from OTP (useful for u-boot proper) */ int setup_mac_address(void); +/* Patch the first 'ethernet' node of FDT with MAC from OTP (useful for SPL) */ +int stm32_fdt_setup_mac_addr(void *fdt);
/* board power management : configure vddcore according OPP */ void board_vddcore_init(u32 voltage_mv); diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index 405eff68a3..d9fdc5926c 100644 --- a/arch/arm/mach-stm32mp/spl.c +++ b/arch/arm/mach-stm32mp/spl.c @@ -181,6 +181,7 @@ void stm32_init_tzc_for_optee(void)
void spl_board_prepare_for_optee(void *fdt) { + stm32_fdt_setup_mac_addr(fdt); stm32_init_tzc_for_optee(); }

We want the optee_copy_fdt_nodes symbols in SPL. This is for cases when booting an OPTEE payload directly.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Makefile b/lib/Makefile index 8ba745faa0..73dacbb01b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -16,7 +16,6 @@ obj-$(CONFIG_FIT) += libfdt/ obj-$(CONFIG_OF_LIVE) += of_live.o obj-$(CONFIG_CMD_DHRYSTONE) += dhry/ obj-$(CONFIG_ARCH_AT91) += at91/ -obj-$(CONFIG_OPTEE) += optee/ obj-$(CONFIG_ASN1_DECODER) += asn1_decoder.o obj-y += crypto/
@@ -74,6 +73,7 @@ obj-$(CONFIG_$(SPL_)GZIP) += gunzip.o obj-$(CONFIG_$(SPL_)LZO) += lzo/ obj-$(CONFIG_$(SPL_)LZMA) += lzma/ obj-$(CONFIG_$(SPL_)LZ4) += lz4_wrapper.o +obj-$(CONFIG_OPTEE) += optee/
obj-$(CONFIG_$(SPL_)LIB_RATIONAL) += rational.o

The optee "/firmware" node is normally used to load the OP-TEE driver. SPL does not use it this way, but instead uses it to patch the kernel devicetree when booting OP-TEE. This seems weird, as OP-TEE -- which would run after SPL -- is capable of patching the devicetree and adding the required "/firmware" and "/reserved-memory" nodes.
However, OP-TEE's devicetree patching (CFG_DT=y) comes with a significant boot time penalty. Measurements put it between 700 to 1800 milliseconds. SPL can also do this patching, without incurring a measurable increase in boot time. This is the use case for falcon mode, which is the main reason to launch OP-TEE from SPL.
Although some OP-TEE configurations do not require any pre-patching of the devicetree, there are good use cases for doing so. As far as concerns with adding the nodes twice, OP-TEE will not add the node if it already-exists.
Add the "/firmware/optee" node the SPL devicetree.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index b314ce2dac..7deb0f5d70 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -33,6 +33,7 @@ optee { compatible = "linaro,optee-tz"; method = "smc"; + u-boot,dm-spl; }; };

OP-TEE does not take a devicetree for its own use. However, it does pass the devicetree to the normal world OS. In most cases that will be some other devicetree-bearing platform, such as linux.
OP-TEE is capable of patching the devicetree and adding the required "/firmware" and "/reserved-memory" nodes. Not all OP-TEE configurations do so, and it would need to be explicitly enabled (CFG_DT=y). There is a measurable boot time penalty to enabling this feature, and sometimes it is preferrable to do it in SPL for this exact reason.
As such, there are cases where it is required to copy the optee nodes to he target's FDT. Do this as part of spl_board_prepare_for_optee().
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- arch/arm/mach-stm32mp/spl.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index d9fdc5926c..94fbb45cf9 100644 --- a/arch/arm/mach-stm32mp/spl.c +++ b/arch/arm/mach-stm32mp/spl.c @@ -19,6 +19,7 @@ #include <asm/arch/sys_proto.h> #include <mach/tzc.h> #include <linux/libfdt.h> +#include <tee/optee.h>
u32 spl_boot_device(void) { @@ -182,6 +183,7 @@ void stm32_init_tzc_for_optee(void) void spl_board_prepare_for_optee(void *fdt) { stm32_fdt_setup_mac_addr(fdt); + optee_copy_fdt_nodes(fdt); stm32_init_tzc_for_optee(); }

Hi Alexandru
On 9/8/21 1:59 AM, Alexandru Gagniuc wrote:
My goal when I started on this project a year ago was to get to linux userspace within a second from power on. Oh, and it had to be secure! Contrast that to the two minutes it took the STLinux demo to come up.
It was obvious that the accepted way of running an FSBL, then SSBL was going to blow the time budget. There really wasn't a good solution, and traditional falcon mode with "spl export" command was not secure.
I chose to use SPL with a FIT payload. We have to add certain logic to SPL, as well as some FDT modifications that would be normally done in u-boot. The boot flow is
SPL -> OP-TEE -> Linux
One of the major complaints of v1 was that we shouldn't be patching the devicetree with optee nodes in SPL. Instead, we should let OP-TEE add the required nodes. I tried it, found a huge boot time penalty, and decided against it.
Another issue from v1 that I was unable to address is the MAC address. It was suggested to use the "nvmem-cells" FDT property to tell linux where in the OTP to read the MAC. Because of the way the linux BSEC driver is written, this would only work with TF-A, but fails with SPL.
There is also the issue of how to make the optee/ library available to SPL. Patrick has a couple of patches up regarding the issue, so I have not touched it in this series.
Changes since v1: - Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig instead of stm32mp1.h - Create a new defconfig for STM32MP in falcon mode - Rework board_fit_config_name_match() per Patrick's suggestions - Use "u-boot,falcon-gpios" instead of "st,fastboot-gpios" - Only update shadow registers in SPL for BSEC .probe()
Alexandru Gagniuc (11): spl: Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig
=> OK
stm32mp1: Add support for baudrates higher than 115200
=> OK
stm32mp1: Add support for falcon mode boot from SD card
=> some remarks
board: stm32mp1: Implement board_fit_config_name_match() for SPL
=> OK
For the next commit of the serie....
I am not a specialist of falcon mode but I think all the next commit should be removed if the falcon mode is correctly managed
see the command "spl export" in doc/README.falcon
arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon:19:
=> the fixup is done one time and saved in U-Boot proper (first boot ?) before to activate the Falcon mode
see also CONFIG_SYS_SPL_ARGS_ADDR usage in ls1043a
and in :
void board_init_r(gd_t *dummy1, ulong dummy2) {
....
case IH_OS_LINUX: debug("Jumping to Linux\n"); #ifdefined(CONFIG_SYS_SPL_ARGS_ADDR) spl_fixup_fdt((void*)CONFIG_SYS_SPL_ARGS_ADDR); #endif
=>jump_to_image_linux use the address spl_image->arg = CONFIG_SYS_SPL_ARGS_ADDR
For me U-boot must saved the device tree get from FIT with the needed fixup in CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR .. CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS
=> loaded by SPL in CONFIG_SYS_SPL_ARGS_ADDR in mmc_load_image_raw_os()
and this FDT is used to start Linux in falscon mode with spl_image.arg (at least when OP-TEE is not present)
I am working of suport on all my working branch (WIP)
https://github.com/u-boot/u-boot/compare/master...patrickdelaunay:spl_optee_...
fdt_support: Implement fdt_ethernet_set_macaddr() arm: stm32mp: bsec: Update OTP shadow registers in SPL arm: stm32mp: Factor out reading MAC address from OTP stm32mp1: spl: Configure MAC address when booting OP-TEE lib: Makefile: Make optee library available in SPL ARM: dts: stm32mp: Add OP-TEE "/firmware" node to SPL dtb stm32mp1: spl: Copy optee nodes to target FDT for OP-TEE payloads
README | 4 - arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 3 + arch/arm/mach-stm32mp/bsec.c | 4 +- arch/arm/mach-stm32mp/cpu.c | 59 ++++-- .../arm/mach-stm32mp/include/mach/sys_proto.h | 3 + arch/arm/mach-stm32mp/spl.c | 3 + board/st/stm32mp1/spl.c | 53 +++++ common/fdt_support.c | 30 +++ common/spl/Kconfig | 11 ++ configs/am335x_boneblack_vboot_defconfig | 1 + configs/am335x_evm_defconfig | 1 + configs/am335x_igep003x_defconfig | 1 + configs/am335x_shc_defconfig | 1 + configs/am335x_shc_ict_defconfig | 1 + configs/am335x_shc_netboot_defconfig | 1 + configs/am335x_shc_sdboot_defconfig | 1 + configs/am335x_sl50_defconfig | 1 + configs/am3517_evm_defconfig | 1 + configs/am43xx_evm_defconfig | 1 + configs/am43xx_evm_rtconly_defconfig | 1 + configs/am43xx_evm_usbhost_boot_defconfig | 1 + configs/am57xx_evm_defconfig | 1 + configs/devkit8000_defconfig | 1 + configs/display5_defconfig | 1 + configs/display5_factory_defconfig | 1 + configs/dra7xx_evm_defconfig | 1 + configs/gwventana_emmc_defconfig | 1 + configs/gwventana_gw5904_defconfig | 1 + configs/gwventana_nand_defconfig | 1 + configs/igep00x0_defconfig | 1 + configs/imx6dl_mamoj_defconfig | 1 + configs/imx6q_logic_defconfig | 1 + configs/imx6qdl_icore_mipi_defconfig | 1 + configs/imx6qdl_icore_mmc_defconfig | 1 + configs/imx6qdl_icore_rqs_defconfig | 1 + configs/mccmon6_nor_defconfig | 1 + configs/omap35_logic_defconfig | 1 + configs/omap35_logic_somlv_defconfig | 1 + configs/omap3_logic_defconfig | 1 + configs/omap3_logic_somlv_defconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap5_uevm_defconfig | 1 + configs/stm32mp15_falcon_defconfig | 181 ++++++++++++++++++ include/configs/brppt1.h | 1 - include/configs/devkit8000.h | 2 - include/configs/display5.h | 1 - include/configs/embestmx6boards.h | 1 - include/configs/gw_ventana.h | 1 - include/configs/imx6-engicam.h | 1 - include/configs/imx6_logic.h | 1 - include/configs/imx6dl-mamoj.h | 1 - include/configs/ls1043ardb.h | 1 - include/configs/mccmon6.h | 1 - include/configs/mx6sabreauto.h | 1 - include/configs/mx6sabresd.h | 1 - include/configs/pico-imx6.h | 1 - include/configs/pico-imx6ul.h | 1 - include/configs/pico-imx7d.h | 1 - include/configs/sama5d3_xplained.h | 1 - include/configs/stm32mp1.h | 4 + include/configs/tam3517-common.h | 1 - include/configs/ti_armv7_common.h | 1 - include/configs/vyasa-rk3288.h | 1 - include/configs/xea.h | 1 - include/configs/xilinx_zynqmp.h | 1 - include/configs/zynq-common.h | 1 - include/fdt_support.h | 17 ++ lib/Makefile | 2 +- scripts/config_whitelist.txt | 1 - 69 files changed, 386 insertions(+), 45 deletions(-) create mode 100644 configs/stm32mp15_falcon_defconfig
regards
Patrick
participants (3)
-
Alex G.
-
Alexandru Gagniuc
-
Patrick DELAUNAY