stm32mp1: Support falcon mode with OP-TEE payloads
Subsystems (6)
v2 cover 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
Signature · 1 line
2.31.1
PATCH v2 1/11 spl: Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig
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.
--- 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(-)
README +0 -4
@@ -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
common/spl/Kconfig +11 -0
@@ -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
configs/am335x_boneblack_vboot_defconfig +1 -0
@@ -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
configs/am335x_evm_defconfig +1 -0
@@ -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
configs/am335x_igep003x_defconfig +1 -0
@@ -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
configs/am335x_shc_defconfig +1 -0
@@ -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
configs/am335x_shc_ict_defconfig +1 -0
@@ -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
configs/am335x_shc_netboot_defconfig +1 -0
@@ -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
configs/am335x_shc_sdboot_defconfig +1 -0
@@ -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
configs/am335x_sl50_defconfig +1 -0
@@ -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
configs/am3517_evm_defconfig +1 -0
@@ -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
configs/am43xx_evm_defconfig +1 -0
@@ -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
configs/am43xx_evm_rtconly_defconfig +1 -0
@@ -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
configs/am43xx_evm_usbhost_boot_defconfig +1 -0
@@ -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
configs/am57xx_evm_defconfig +1 -0
@@ -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
configs/devkit8000_defconfig +1 -0
@@ -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
configs/display5_defconfig +1 -0
@@ -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
configs/display5_factory_defconfig +1 -0
@@ -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
configs/dra7xx_evm_defconfig +1 -0
@@ -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
configs/gwventana_emmc_defconfig +1 -0
@@ -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
configs/gwventana_gw5904_defconfig +1 -0
@@ -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
configs/gwventana_nand_defconfig +1 -0
@@ -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
configs/igep00x0_defconfig +1 -0
@@ -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
configs/imx6dl_mamoj_defconfig +1 -0
@@ -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
configs/imx6q_logic_defconfig +1 -0
@@ -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
configs/imx6qdl_icore_mipi_defconfig +1 -0
@@ -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> "
configs/imx6qdl_icore_mmc_defconfig +1 -0
@@ -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> "
configs/imx6qdl_icore_rqs_defconfig +1 -0
@@ -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> "
configs/mccmon6_nor_defconfig +1 -0
@@ -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
configs/omap35_logic_defconfig +1 -0
@@ -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
configs/omap35_logic_somlv_defconfig +1 -0
@@ -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
configs/omap3_logic_defconfig +1 -0
@@ -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
configs/omap3_logic_somlv_defconfig +1 -0
@@ -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
configs/omap4_panda_defconfig +1 -0
@@ -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
configs/omap5_uevm_defconfig +1 -0
@@ -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
include/configs/brppt1.h +0 -1
@@ -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 */
include/configs/devkit8000.h +0 -2
@@ -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 */
include/configs/display5.h +0 -1
@@ -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
include/configs/embestmx6boards.h +0 -1
@@ -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 */
include/configs/gw_ventana.h +0 -1
@@ -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"
include/configs/imx6-engicam.h +0 -1
@@ -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 */
include/configs/imx6_logic.h +0 -1
@@ -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 */
include/configs/imx6dl-mamoj.h +0 -1
@@ -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 */
include/configs/ls1043ardb.h +0 -1
@@ -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
include/configs/mccmon6.h +0 -1
@@ -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 */
include/configs/mx6sabreauto.h +0 -1
@@ -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
include/configs/mx6sabresd.h +0 -1
@@ -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
include/configs/pico-imx6.h +0 -1
@@ -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 */
include/configs/pico-imx6ul.h +0 -1
@@ -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 */
include/configs/pico-imx7d.h +0 -1
@@ -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 */
include/configs/sama5d3_xplained.h +0 -1
@@ -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 */
include/configs/tam3517-common.h +0 -1
@@ -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 */
include/configs/ti_armv7_common.h +0 -1
@@ -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
include/configs/vyasa-rk3288.h +0 -1
@@ -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
include/configs/xea.h +0 -1
@@ -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
include/configs/xilinx_zynqmp.h +0 -1
@@ -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
include/configs/zynq-common.h +0 -1
@@ -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
scripts/config_whitelist.txt +0 -1
@@ -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
Signature · 1 line
2.31.1
Re: [Uboot-stm32] [PATCH v2 01/11] spl: Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig
Hi,
Quoted 97 lines · Alexandru Gagniuc
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 <[email protected]>---
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(-)README +0
-0@@ -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 argumentcommon/spl/Kconfig +0
-0@@ -990,6 +990,17 @@ config SYS_OS_BASEendif #
SPL_OS_BOOT
+configSYS_MMCSD_RAW_MODE_KERNEL_SECTOR
+ hex "Falcon mode: Sector to load kernel uImage from MMC" + default0x0
+ depends onSPL_OS_BOOT
+ help
+ When Falcon mode is used with an MMC or SD media, SPL needs to
Quoted 8 lines
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
PATCH v2 2/11 stm32mp1: Add support for baudrates higher than 115200
In reply to Alexandru GagniucThe 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.
--- include/configs/stm32mp1.h | 4 ++++ 1 file changed, 4 insertions(+)
include/configs/stm32mp1.h +4 -0
@@ -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 */
Signature · 1 line
2.31.1
PATCH v2 3/11 stm32mp1: Add support for falcon mode boot from SD card
In reply to Alexandru GagniucFalcon 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.
--- 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
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +2 -0
@@ -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)>;
board/st/stm32mp1/spl.c +39 -0
@@ -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 ) {
configs/stm32mp15_falcon_defconfig new file +181 -0
181 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [Uboot-stm32] [PATCH v2 03/11] stm32mp1: Add support for falcon mode boot from SD card
Hi,
Quoted 79 lines · Alexandru Gagniuc
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_SPImust be disabled to avoid a build failure. The only way to accommodate this is to add a new defconfig, adventurously namedstm32mp1_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 <[email protected]>--- 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
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +2
-0@@ -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)>;board/st/stm32mp1/spl.c +17
-0@@ -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",
board/st/stm32mp1/spl.c int board_early_init_f(void) · line 58
Quoted 10 lines
board/st/stm32mp1/spl.c +10
-0+ __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;
}
board/st/stm32mp1/spl.c int board_early_init_f(void) · line 67
Quoted 9 lines
board/st/stm32mp1/spl.c +9
-0+#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
configs/stm32mp15_falcon_defconfig
Quoted 7 lines
board/st/stm32mp1/spl.c +3
-0+#endif /* CONFIG_ARMV7_NONSEC */ +#endif /* CONFIG_SPL_OS_BOOT */ +#ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init (void ) {configs/stm32mp15_falcon_defconfig +0
-0
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_W2140
https://github.com/u-boot/u-boot/commit/04ad553e9c6bee62781460d2952df4962e58ae14
https://github.com/u-boot/u-boot/commit/aebb687a1557590bf070cf5d3478544ffff20ca1
But it is still not working, OP-TEE is not correctly started
regards
Patrick
Re: [Uboot-stm32] [PATCH v2 03/11] stm32mp1: Add support for falcon mode boot from SD card
Quoted 9 lines · Patrick DELAUNAY
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_W2140 https://github.com/u-boot/u-boot/commit/04ad553e9c6bee62781460d2952df4962e58ae14 https://github.com/u-boot/u-boot/commit/aebb687a1557590bf070cf5d3478544ffff20ca1
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";
};
};
};
};PATCH v2 4/11 board: stm32mp1: Implement board_fit_config_name_match() for SPL
In reply to Alexandru GagniucThis function is needed when loading a FIT image from SPL. It selects the correct configuration node for the current board. Implement it.
--- board/st/stm32mp1/spl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
board/st/stm32mp1/spl.c +14 -0
@@ -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 ); +}
Signature · 1 line
2.31.1
PATCH v2 5/11 fdt_support: Implement fdt_ethernet_set_macaddr()
In reply to Alexandru GagniucOftentimes 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.
--- common/fdt_support.c | 30 ++++++++++++++++++++++++++++++ include/fdt_support.h | 17 +++++++++++++++++ 2 files changed, 47 insertions(+)
common/fdt_support.c +30 -0
@@ -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)
include/fdt_support.h +17 -0
@@ -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);
Signature · 1 line
2.31.1
PATCH v2 6/11 arm: stm32mp: bsec: Update OTP shadow registers in SPL
In reply to Alexandru GagniucFor 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.
--- arch/arm/mach-stm32mp/bsec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-stm32mp/bsec.c +2 -2
@@ -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++)
Signature · 1 line
2.31.1
PATCH v2 7/11 arm: stm32mp: Factor out reading MAC address from OTP
In reply to Alexandru GagniucMove the reading the OTP into a separate function. This is required for a subsequent change which sets the MAC in SPL.
--- arch/arm/mach-stm32mp/cpu.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-)
arch/arm/mach-stm32mp/cpu.c +23 -14
@@ -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 ;
Signature · 1 line
2.31.1
PATCH v2 8/11 stm32mp1: spl: Configure MAC address when booting OP-TEE
In reply to Alexandru GagniucWhen 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.
--- 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(+)
arch/arm/mach-stm32mp/cpu.c +22 -0
@@ -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 ];
arch/arm/mach-stm32mp/include/mach/sys_proto.h +3 -0
@@ -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);
arch/arm/mach-stm32mp/spl.c +1 -0
@@ -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 (); }
Signature · 1 line
2.31.1
PATCH v2 9/11 lib: Makefile: Make optee library available in SPL
In reply to Alexandru GagniucWe want the optee_copy_fdt_nodes symbols in SPL. This is for cases when booting an OPTEE payload directly.
--- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/Makefile +1 -1
@@ -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
Signature · 1 line
2.31.1
PATCH v2 10/11 ARM: dts: stm32mp: Add OP-TEE "/firmware" node to SPL dtb
In reply to Alexandru GagniucThe 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.
--- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +1 -0
@@ -33,6 +33,7 @@ optee { compatible = "linaro,optee-tz"; method = "smc"; + u-boot,dm-spl; }; };
Signature · 1 line
2.31.1
PATCH v2 11/11 stm32mp1: spl: Copy optee nodes to target FDT for OP-TEE payloads
In reply to Alexandru GagniucOP-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().
--- arch/arm/mach-stm32mp/spl.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-stm32mp/spl.c +2 -0
@@ -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 (); }
Signature · 1 line
2.31.1
Hi Alexandru
Quoted 37 lines · Alexandru Gagniuc
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 -> LinuxOne 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:
- MoveSYS_MMCSD_RAW_MODE_KERNEL_SECTORtoKconfiginstead ofstm32mp1.h
- Create a new defconfig for STM32MP in falcon mode
- Reworkboard_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()
Quoted 2 lines
Alexandru Gagniuc (11):
spl: MoveSYS_MMCSD_RAW_MODE_KERNEL_SECTORtoKconfig
=> OK
Quoted 1 line
stm32mp1: Add support for baudrates higher than 115200
=> OK
Quoted 1 line
stm32mp1: Add support for falcon mode boot from SD card
=> some remarks
Quoted 1 line
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_W2140
Quoted 78 lines
fdt_support: Implementfdt_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 payloadsREADME | 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(-)
Quoted 2 lines
create mode 100644 configs/stm32mp15_falcon_defconfig
regards
Patrick