[PATCH v3 00/13] stm32mp1: Support falcon mode with OP-TEE payloads

The goal of this project is to to get to linux userspace within a second from power on, and be secure! This is my last full-time day on this project, so I don't expect to do a v4.
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
Patrick suggested more changes, but I decided against the following:
I) Use SPL_OPTEE_IMAGE in mach-stm32mp Kconfig selection
I explained in more detail in another email why this is a bad idea.
II) Don't use USER2 button for falcon mode.
This already exists as "fastboot-gpios", but I wasn't supposed to use it. So I aliased it as "falcon-gpios", but I'm again not supposed to use it because it aliases an existing GPIO. This makes absolutely no sense to me. I need a GPIO for this. This is America! I paid for the button, I intend to use the button! [*]
III) Use env_get_yesno("boot_os") to select falcon mode
I like this idea, but I feel it is part of the OS/SPL communication mechanism, which is beyond the scope of this series.
IV) Use if (serial_getc() == 'c') in spl_start_uboot()
I don't like the idea of doing serial input in SPL.
V) Move SYS_MMCSD_RAW_MODE_ARGS_* to Kconfig
The boot flow herein does not use the ARGS partition. It would destroy the security model to allow an external unsigned devicetree. I don't want to encourage others to use it, and I don't want to waste time with it. I hope the args partition just fizzles away into nothingness.
VI) What the heck is "spl export"
"spl export" is the u-boot (not SPL) command used to patch the devicetree and save it to the args partition mentioned above. This series avoids "spl export" because: it's a poor security choice (explained above).
VII) Wait what? How does the devicetree work? Huh?
A complete kernel devicetree is obtained using two methods: a) FDT patching done by SPL to the FIT devicetree b) devicetree overlays from the FIT Both (a) and (b) can be signed. In my specific use case, the bootargs are applied as a devicetree overlay. It's super effective.
[*] This is meant to be humorous
Changes since v2: - Drop armv7_boot_nonsec() hack - Introduce CONFIG_SPL_FALCON_BOOT_MMCSD - Remove superfluous spl_start_uboot() symbol
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 (13): spl: Untagle spl_start_uboot() from spl_mmc.c 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 ARM: dts: stm32mp: dts: Don't remove OPTEE nodes for DK2 boards
README | 4 - arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 6 +- 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 | 43 ++++ common/fdt_support.c | 30 +++ common/spl/Kconfig | 16 ++ common/spl/spl.c | 10 +- common/spl/spl_mmc.c | 6 +- configs/am335x_boneblack_vboot_defconfig | 2 + configs/am335x_evm_defconfig | 2 + configs/am335x_igep003x_defconfig | 2 + configs/am335x_shc_defconfig | 2 + configs/am335x_shc_ict_defconfig | 2 + configs/am335x_shc_netboot_defconfig | 2 + configs/am335x_shc_sdboot_defconfig | 2 + configs/am335x_sl50_defconfig | 2 + configs/am3517_evm_defconfig | 2 + configs/am43xx_evm_defconfig | 2 + configs/am43xx_evm_rtconly_defconfig | 2 + configs/am43xx_evm_usbhost_boot_defconfig | 2 + configs/am57xx_evm_defconfig | 2 + configs/devkit8000_defconfig | 2 + configs/display5_defconfig | 2 + configs/display5_factory_defconfig | 2 + configs/dra7xx_evm_defconfig | 2 + configs/gwventana_emmc_defconfig | 2 + configs/gwventana_gw5904_defconfig | 2 + configs/gwventana_nand_defconfig | 2 + configs/igep00x0_defconfig | 2 + configs/imx6dl_mamoj_defconfig | 2 + configs/imx6q_logic_defconfig | 2 + configs/omap35_logic_defconfig | 2 + configs/omap35_logic_somlv_defconfig | 2 + configs/omap3_logic_defconfig | 2 + configs/omap3_logic_somlv_defconfig | 2 + configs/omap4_panda_defconfig | 2 + configs/omap5_uevm_defconfig | 2 + configs/stm32mp15_falcon_defconfig | 183 ++++++++++++++++++ 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 - 67 files changed, 415 insertions(+), 57 deletions(-) create mode 100644 configs/stm32mp15_falcon_defconfig

The symbol spl_start_uboot() is provided in spl_mmc.c, but it may also be provided by platform code.
Fireworks can be created with the following combination:
CONFIG_SPL_OS_BOOT is not set CONFIG_SPL_MMC=y ARCH provides spl_start_uboot()
A weak implementation of spl_start_uboot() exists in spl/spl.c, so leverage that one and stop defining the symbol in spl_mmc.c. We need the symbol because spl_start_uboot() is called in spl_mmc.c irrespective of the Falcon mode being activated.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- common/spl/spl.c | 10 ++++++---- common/spl/spl_mmc.c | 4 ---- 2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c index a9304d4148..6232a23c9e 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -87,15 +87,17 @@ __weak int dram_init_banksize(void) * 0 to not start u-boot * positive if u-boot should start */ -#ifdef CONFIG_SPL_OS_BOOT __weak int spl_start_uboot(void) { - puts(SPL_TPL_PROMPT - "Please implement spl_start_uboot() for your board\n"); - puts(SPL_TPL_PROMPT "Direct Linux boot not active!\n"); + if (IS_ENABLED(CONFIG_SPL_OS_BOOT)){ + puts(SPL_TPL_PROMPT + "Please implement spl_start_uboot() for your board\n"); + puts(SPL_TPL_PROMPT "Direct Linux boot not active!\n"); + } return 1; }
+#ifdef CONFIG_SPL_OS_BOOT /* * Weak default function for arch specific zImage check. Return zero * and fill start and end address if image is recognized. diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index d52f8a3eef..a9a588b04f 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -252,10 +252,6 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, return 0; } #else -int spl_start_uboot(void) -{ - return 1; -} static int mmc_load_image_raw_os(struct spl_image_info *spl_image, struct mmc *mmc) {

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.
The predicate to enable mmc_load_image_raw_os() is changed from SPL_OS_BOOT to SPL_FALCON_BOOT_MMCSD. It is possible for a system to support Falcon mode from NOR but not MMC. In that case, it doesn't make sense to have mmc_load_image_raw_os().
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- README | 4 ---- common/spl/Kconfig | 16 ++++++++++++++++ common/spl/spl_mmc.c | 2 +- configs/am335x_boneblack_vboot_defconfig | 2 ++ configs/am335x_evm_defconfig | 2 ++ configs/am335x_igep003x_defconfig | 2 ++ configs/am335x_shc_defconfig | 2 ++ configs/am335x_shc_ict_defconfig | 2 ++ configs/am335x_shc_netboot_defconfig | 2 ++ configs/am335x_shc_sdboot_defconfig | 2 ++ configs/am335x_sl50_defconfig | 2 ++ configs/am3517_evm_defconfig | 2 ++ configs/am43xx_evm_defconfig | 2 ++ configs/am43xx_evm_rtconly_defconfig | 2 ++ configs/am43xx_evm_usbhost_boot_defconfig | 2 ++ configs/am57xx_evm_defconfig | 2 ++ configs/devkit8000_defconfig | 2 ++ configs/display5_defconfig | 2 ++ configs/display5_factory_defconfig | 2 ++ configs/dra7xx_evm_defconfig | 2 ++ configs/gwventana_emmc_defconfig | 2 ++ configs/gwventana_gw5904_defconfig | 2 ++ configs/gwventana_nand_defconfig | 2 ++ configs/igep00x0_defconfig | 2 ++ configs/imx6dl_mamoj_defconfig | 2 ++ configs/imx6q_logic_defconfig | 2 ++ configs/omap35_logic_defconfig | 2 ++ configs/omap35_logic_somlv_defconfig | 2 ++ configs/omap3_logic_defconfig | 2 ++ configs/omap3_logic_somlv_defconfig | 2 ++ configs/omap4_panda_defconfig | 2 ++ configs/omap5_uevm_defconfig | 2 ++ 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 - 55 files changed, 75 insertions(+), 29 deletions(-)
diff --git a/README b/README index 840b192aae..7e33ad79ff 100644 --- a/README +++ b/README @@ -2020,10 +2020,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 8a8a971a91..39745a216f 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -918,6 +918,22 @@ config SYS_OS_BASE
endif # SPL_OS_BOOT
+config SPL_FALCON_BOOT_MMCSD + bool "Enable Falcon boot from MMC or SD media" + depends on SPL_OS_BOOT && SPL_MMC + help + Select this if the Falcon mode OS image mode is on MMC or SD media. + +config SYS_MMCSD_RAW_MODE_KERNEL_SECTOR + hex "Falcon mode: Sector to load kernel uImage from MMC" + depends on SPL_FALCON_BOOT_MMCSD + 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/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index a9a588b04f..000e4ecf0b 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -218,7 +218,7 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, } #endif
-#ifdef CONFIG_SPL_OS_BOOT +#ifdef CONFIG_SPL_FALCON_BOOT_MMCSD static int mmc_load_image_raw_os(struct spl_image_info *spl_image, struct mmc *mmc) { diff --git a/configs/am335x_boneblack_vboot_defconfig b/configs/am335x_boneblack_vboot_defconfig index f0b197a050..5a6dd046bd 100644 --- a/configs/am335x_boneblack_vboot_defconfig +++ b/configs/am335x_boneblack_vboot_defconfig @@ -24,6 +24,8 @@ CONFIG_SPL_MUSB_NEW=y CONFIG_SPL_NET=y CONFIG_SPL_NET_VCI_STRING="AM33xx U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 0f938e7de3..39cc7b3f33 100644 --- a/configs/am335x_evm_defconfig +++ b/configs/am335x_evm_defconfig @@ -24,6 +24,8 @@ CONFIG_SPL_NAND_BASE=y CONFIG_SPL_NET=y CONFIG_SPL_NET_VCI_STRING="AM335x U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 9a6f71dc6c..ad16fab378 100644 --- a/configs/am335x_igep003x_defconfig +++ b/configs/am335x_igep003x_defconfig @@ -37,6 +37,8 @@ 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_SPL_FALCON_BOOT_MMCSD=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 4169d13d2a..03c47f5bcb 100644 --- a/configs/am335x_shc_defconfig +++ b/configs/am335x_shc_defconfig @@ -30,6 +30,8 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 1d25adf7cd..9e4463b10d 100644 --- a/configs/am335x_shc_ict_defconfig +++ b/configs/am335x_shc_ict_defconfig @@ -31,6 +31,8 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 0ab3acb77e..9cd5993326 100644 --- a/configs/am335x_shc_netboot_defconfig +++ b/configs/am335x_shc_netboot_defconfig @@ -32,6 +32,8 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 914f21cb7c..7e0b6dfb46 100644 --- a/configs/am335x_shc_sdboot_defconfig +++ b/configs/am335x_shc_sdboot_defconfig @@ -31,6 +31,8 @@ CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 aa1e196d40..6cfcbc6e6d 100644 --- a/configs/am335x_sl50_defconfig +++ b/configs/am335x_sl50_defconfig @@ -32,6 +32,8 @@ CONFIG_SPL_NAND_BASE=y CONFIG_SPL_NET=y CONFIG_SPL_NET_VCI_STRING="AM335x U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 1bdebf5b7f..e4e39a3f4b 100644 --- a/configs/am3517_evm_defconfig +++ b/configs/am3517_evm_defconfig @@ -27,6 +27,8 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 108db834c4..fe68dc295b 100644 --- a/configs/am43xx_evm_defconfig +++ b/configs/am43xx_evm_defconfig @@ -24,6 +24,8 @@ CONFIG_SPL_NAND_BASE=y CONFIG_SPL_NET=y CONFIG_SPL_NET_VCI_STRING="AM43xx U-Boot SPL" CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 f558fd503a..b97fd1f1fc 100644 --- a/configs/am43xx_evm_rtconly_defconfig +++ b/configs/am43xx_evm_rtconly_defconfig @@ -21,6 +21,8 @@ CONFIG_SPL_NAND_DRIVERS=y CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 0b91f3a5f0..fd0bd25b67 100644 --- a/configs/am43xx_evm_usbhost_boot_defconfig +++ b/configs/am43xx_evm_usbhost_boot_defconfig @@ -20,6 +20,8 @@ CONFIG_SPL_NAND_DRIVERS=y CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 9a038a6bc6..69f950c89a 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -33,6 +33,8 @@ CONFIG_SPL_DMA=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 ccdd4f606f..1ed936862f 100644 --- a/configs/devkit8000_defconfig +++ b/configs/devkit8000_defconfig @@ -14,6 +14,8 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 a49bf33179..4d69407936 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -41,6 +41,8 @@ CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_SAVEENV=y CONFIG_SPL_I2C=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 5a2e478c48..9cb3130c80 100644 --- a/configs/display5_factory_defconfig +++ b/configs/display5_factory_defconfig @@ -38,6 +38,8 @@ CONFIG_MISC_INIT_R=y CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 19f5563e15..9e4c6337c8 100644 --- a/configs/dra7xx_evm_defconfig +++ b/configs/dra7xx_evm_defconfig @@ -34,6 +34,8 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 000bdb5949..c2de658bc6 100644 --- a/configs/gwventana_emmc_defconfig +++ b/configs/gwventana_emmc_defconfig @@ -43,6 +43,8 @@ CONFIG_SPL_FIT_IMAGE_TINY=y CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 87851f3524..e2da3677e2 100644 --- a/configs/gwventana_gw5904_defconfig +++ b/configs/gwventana_gw5904_defconfig @@ -43,6 +43,8 @@ CONFIG_SPL_FIT_IMAGE_TINY=y CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 8ff8ab472e..45539ad56d 100644 --- a/configs/gwventana_nand_defconfig +++ b/configs/gwventana_nand_defconfig @@ -44,6 +44,8 @@ CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_NAND_SUPPORT=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 8f6e13e2a8..3a73e5df47 100644 --- a/configs/igep00x0_defconfig +++ b/configs/igep00x0_defconfig @@ -35,6 +35,8 @@ 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_SPL_FALCON_BOOT_MMCSD=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 70268d0ab5..74dc262d22 100644 --- a/configs/imx6dl_mamoj_defconfig +++ b/configs/imx6dl_mamoj_defconfig @@ -16,6 +16,8 @@ CONFIG_IMX_HAB=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 f9d472eacd..bfc95a2cdf 100644 --- a/configs/imx6q_logic_defconfig +++ b/configs/imx6q_logic_defconfig @@ -33,6 +33,8 @@ CONFIG_SPL_DMA=y CONFIG_SPL_I2C=y CONFIG_SPL_NAND_SUPPORT=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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/omap35_logic_defconfig b/configs/omap35_logic_defconfig index 9d8ac94d2a..5e6b0fe120 100644 --- a/configs/omap35_logic_defconfig +++ b/configs/omap35_logic_defconfig @@ -30,6 +30,8 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 ee0c58ad2b..1803d6dd8b 100644 --- a/configs/omap35_logic_somlv_defconfig +++ b/configs/omap35_logic_somlv_defconfig @@ -30,6 +30,8 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 becf862dcb..8437451390 100644 --- a/configs/omap3_logic_defconfig +++ b/configs/omap3_logic_defconfig @@ -30,6 +30,8 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 ece92fef61..61e40366d4 100644 --- a/configs/omap3_logic_somlv_defconfig +++ b/configs/omap3_logic_somlv_defconfig @@ -30,6 +30,8 @@ CONFIG_SPL_NAND_ECC=y CONFIG_SPL_NAND_SIMPLE=y CONFIG_SPL_NAND_BASE=y CONFIG_SPL_OS_BOOT=y +CONFIG_SPL_FALCON_BOOT_MMCSD=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 8c6baaf4fd..13df606cc4 100644 --- a/configs/omap4_panda_defconfig +++ b/configs/omap4_panda_defconfig @@ -15,6 +15,8 @@ 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_SPL_FALCON_BOOT_MMCSD=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 0280b4ac8d..f5937783ef 100644 --- a/configs/omap5_uevm_defconfig +++ b/configs/omap5_uevm_defconfig @@ -16,6 +16,8 @@ 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_SPL_FALCON_BOOT_MMCSD=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 4c56a8a59b..d5458edbdb 100644 --- a/include/configs/brppt1.h +++ b/include/configs/brppt1.h @@ -34,7 +34,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 591a33fca6..06e7fe9132 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -144,10 +144,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 27854dfdf1..35eb013f7d 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 9769155bca..a1d3c2ce8f 100644 --- a/include/configs/embestmx6boards.h +++ b/include/configs/embestmx6boards.h @@ -66,7 +66,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 3f6afc1646..9cbe5b2df9 100644 --- a/include/configs/gw_ventana.h +++ b/include/configs/gw_ventana.h @@ -18,7 +18,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 9af0a04040..1b31cef982 100644 --- a/include/configs/imx6-engicam.h +++ b/include/configs/imx6-engicam.h @@ -151,7 +151,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 f1b78c6751..a190fc4f24 100644 --- a/include/configs/imx6_logic.h +++ b/include/configs/imx6_logic.h @@ -155,6 +155,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 367f78d125..a0b5dff4c1 100644 --- a/include/configs/imx6dl-mamoj.h +++ b/include/configs/imx6dl-mamoj.h @@ -58,7 +58,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 0d071c4ab7..6cc2ecac93 100644 --- a/include/configs/ls1043ardb.h +++ b/include/configs/ls1043ardb.h @@ -25,7 +25,6 @@
#ifdef CONFIG_SD_BOOT #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 a0803227c8..345658d9df 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"
#define CONFIG_MXC_UART_BASE UART1_BASE diff --git a/include/configs/mx6sabreauto.h b/include/configs/mx6sabreauto.h index 5e8446088b..11de96fec2 100644 --- a/include/configs/mx6sabreauto.h +++ b/include/configs/mx6sabreauto.h @@ -35,7 +35,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 9a9f5884aa..5a854b9d19 100644 --- a/include/configs/mx6sabresd.h +++ b/include/configs/mx6sabresd.h @@ -25,7 +25,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 4e72caa45d..90cc9bda01 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
#define CONFIG_MXC_UART_BASE UART1_BASE diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 7e36ceed3f..edd371e080 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 36c57923de..f98a85fe8e 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
#define CONFIG_MXC_UART_BASE UART5_IPS_BASE_ADDR diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index 119b4a652c..68bbe8f29c 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -73,7 +73,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 a47e2c5b28..23ab1667a9 100644 --- a/include/configs/tam3517-common.h +++ b/include/configs/tam3517-common.h @@ -121,7 +121,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 fa48cd2818..d457df0c33 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -153,7 +153,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 5081cc8691..48bb198e3e 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 f8607b7617..95acf78a18 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -242,7 +242,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 0c87f19ac3..0b7782ca4d 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -236,7 +236,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 02d86d79cf..08df4b9baf 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -2255,7 +2255,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

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 06cd153d13..b12896bc07 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 | 29 ++++ configs/stm32mp15_falcon_defconfig | 183 +++++++++++++++++++++++ 3 files changed, 214 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 15a04ae927..629451e731 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..ea2f809245 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,34 @@ 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; +} + +#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..c5683616cc --- /dev/null +++ b/configs/stm32mp15_falcon_defconfig @@ -0,0 +1,183 @@ +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=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_SYS_LOAD_ADDR=0xc2000000 +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_SPL_FALCON_BOOT_MMCSD=y +CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR=0x1422 +CONFIG_SPL_POWER=y +CONFIG_SPL_OPTEE_IMAGE=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

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 ea2f809245..01aa5e51c5 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> @@ -82,3 +83,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 72a5b90c97..8453fc8d76 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 962470f496..c7dc217e2b 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_LIB) += optee/ obj-$(CONFIG_ASN1_DECODER) += asn1_decoder.o obj-y += crypto/
@@ -50,6 +49,7 @@ obj-$(CONFIG_BITREVERSE) += bitrev.o obj-y += list_sort.o endif
+obj-$(CONFIG_OPTEE_LIB) += optee/ obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm-common.o ifeq ($(CONFIG_$(SPL_TPL_)TPM),y) obj-y += crc8.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 629451e731..fb60549f4d 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -35,6 +35,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(); }

To prepare for an OP-TEE payload, the spl_board_prepare_for_optee() handler of STM32MP calls. stm32_init_tzc_for_optee(), which will panic(). The reason for the panic is a failure to locate a valid "/reserved-memory/optee" node in the devicetree.
This all occurs in SPL, so to re-add the OP-TEE memory nodes to the SPL devicetree.
Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 3 --- 1 file changed, 3 deletions(-)
diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index fb60549f4d..fe347377ba 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -27,10 +27,7 @@ config { u-boot,mmc-env-partition = "ssbl"; }; -#endif
-#ifdef CONFIG_STM32MP15x_STM32IMAGE - /* only needed for boot with TF-A, witout FIP support */ firmware { optee { compatible = "linaro,optee-tz";
participants (1)
-
Alexandru Gagniuc