aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h
Commit message (Collapse)AuthorAgeFilesLines
* arm: Rename STM32MP15xPatrick Delaunay2024-01-191-2/+2
| | | | | | | | | CONFIG options must not use lower-case letter. Convert this and related ones to upper case. Signed-off-by: Simon Glass <sjg@chromium.org Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* arm: Rename STM32MP13xPatrick Delaunay2024-01-191-1/+1
| | | | | | | | | CONFIG options must not use lower-case letter. Convert this and related ones to upper case. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
* stm32mp: stm32prog: add support of stm32mp25Patrick Delaunay2024-01-191-1/+9
| | | | | | | Change OTP number to 364 for STM32MP25 as it is done in bsec driver. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* common: Drop linux/printk.h from common headerSimon Glass2023-09-241-0/+2
| | | | | | | | | This old patch was marked as deferred. Bring it back to life, to continue towards the removal of common.h Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass <sjg@chromium.org>
* stm32mp: stm32prog: Add support of FWU_MDATA partition typePatrick Delaunay2023-06-161-0/+1
| | | | | | | | | | | | | | | | | | | Add support of "FWU_MDATA" partition type in flashlayout to select the TF-A firmware update metadata partition type guid, associated to U-Boot "system" partition type guid, FWU_MDATA_GUID introduced by commit 2eaedc95164f ("FWU: Add FWU metadata structure and driver for accessing metadata") and used in gpt_get_mdata_partitions() for commit 554b38f7a532 ("FWU: Add FWU metadata access driver for GPT partitioned block devices") See also recommendation in FWU-PSA-A_DEN0118_1.0ALP3.pdf 4.1.2 Metadata integration with GPT When embedded in a GPT, each metadata replica occupies a single partition with PartitionTypeGUID = metadata_uuid. UUID = 8a7a84a0-8387-40f6-ab41-a8b9a5a60d23 Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: Add support of ESP partition typePatrick Delaunay2023-06-161-1/+7
| | | | | | | | | | | | Add support of "ESP" partition type in flashlayout to select the "EFI System Partition", associated to U-Boot "system" partition type guid, PARTITION_SYSTEM_GUID = C12A7328-F81F-11d2-BA4B-00A0C93EC93B. This partition is the bootable partition for efi boot. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: Add support of ENV partition typePatrick Delaunay2023-06-161-0/+1
| | | | | | | | | | | | Add support of "ENV" partition type in flashlayout to select the "u-boot-env" GUID, with PARTITION_U_BOOT_ENVIRONMENT = 3de21764-95bd-54bd-a5c3-4abe786f38a8, that mean a partition holding a U-Boot environment introduced by commit c0364ce1c695 ("doc/README.gpt: define partition type GUID for U-Boot environment")' Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: Remove tee_detected from stm32prog_data structPatrice Chotard2023-06-161-3/+0
| | | | | | | | | As stm32prog_get_tee_partitions() is no more used, remove tee_detected boolean from stm32prog_data struct and all code using it. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: correctly handle OTP when SMC is not supportedPatrick Delaunay2022-09-231-0/+5
| | | | | | | | | As the SMC is only supported in SP-MIN for STM32MP15x, the associated partition should be absent when the TA NVMEM is not available in OPT-TEE in STM32MP13x. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: solve warning for 64bits compilationPatrick Delaunay2022-09-231-7/+7
| | | | | | | Solve many compilation warning when stm32prog is activated on the aarch64. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: handle U-Boot script in flashlayout alternatePatrick Delaunay2022-05-101-0/+2
| | | | | | | | | | | | | | | | Update the stm32prog command to allow the reception of U-Boot script in the FlashLayout alternate during the first USB enumeration. This patch is aligned with the last TF-A behavior: the Flashlayout is now loaded by U-Boot; it is no more present at STM32_DDR_BASE when the stm32prog is launched after a serial boot, on UART or on USB. The received script must be a U-Boot legacy image, no more need to add a stm32image header. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: add support of UUID for FIP partitionPatrick Delaunay2022-05-101-1/+2
| | | | | | | | | | | | | | | | | | Add support of UUID for FIP parttion, required by Firmware update support in TF-A: - UUID TYPE for FIP partition: 19d5df83-11b0-457b-be2c-7559c13142a5 - "fip-a" partition UUID: 4fd84c93-54ef-463f-a7ef-ae25ff887087 - "fip-b" partition UUID: 09c54952-d5bf-45af-acee-335303766fb3 This check is done with a new partition type "FIP" associated at the FIP UUID. The A/B partition UUID is detected by the partition name: "fip-a", "fip-b". Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: add support of STM32IMAGE version 2Patrick Delaunay2022-05-101-8/+27
| | | | | | | | | Add support of new header for the STM32IMAGE version V2 in command stm32prog command for STM32MP13x family. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: add TEE support in stm32prog commandPatrick Delaunay2022-05-101-1/+6
| | | | | | | | | | | | When OP-TEE is used, the SMC for BSEC management are not available and the PTA provisioning for OTP must be used. U-Boot opens the session to this PTA and use it for OTP access. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp1: stm32prog: remove stm32prog_get_tee_partitions with FIPPatrick Delaunay2021-08-161-0/+2
| | | | | | | | | | | | | The MTD tee partitions used to save the OP-TEE binary are needed when TF-A doesn't use the FIP container to load binaries. This patch puts under CONFIG_STM32MP15x_STM32IMAGE flag the associated code in U-Boot binary and prepare the code cleanup when CONFIG_STM32MP15x_STM32IMAGE support will be removed after TF-A migration to FIP support. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: use defines for virtual partition sizePatrick Delaunay2021-07-161-0/+1
| | | | | | | | | | | Use the existing defines PMIC_SIZE and OTP_SIZE and a new define CMD_SIZE for virtual partition size. This patch corrects the size for OTP partition in alternate name (1024 instead of 512) and avoids other alignment issues. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: add support of initrd in flashlayoutPatrick Delaunay2021-06-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the support in command stm32prog of kernel load and start with initrd file, identify by the partition Type "Binary" in the flashlayout.tsv, for example: - 0x01 fsbl Binary none 0x0 tfa.stm32 - 0x03 fip Binary none 0x0 fip.bin P 0x10 kernel System ram0 0xC2000000 uImage.bin P 0x11 dtb FileSystem ram0 0xC4000000 board.dtb P 0x12 initrd Binary ram0 0xC4400000 <initrd> The <initrd> file can be a legacy image "uInitrd", generated with mkimage, or a RAW initrd image "initrd.gz". After a DFU detach the bootm command with be executed with the associated address, for example: $> bootm 0xC2000000 0xC4400000:<size> 0xC4000000 When the "Binary" partition type is absent, the 'bootm' command starts the kernel without ramdisk, for example: $> bootm 0xC2000000 - 0xC4000000 With this paths, it is no more mandatory to generate FIT including the kernel, DT and initrd: - 0x01 fsbl Binary none 0x0 tfa.stm32 - 0x03 fip Binary none 0x0 fip.bin P 0x10 fit System ram0 0xC2000000 fit.bin Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: remove all the header check for UART downloadPatrick Delaunay2021-06-181-5/+0
| | | | | | | | | | | | | This patch removes the header check for UART download; the check of checksum is not mandatory with even parity and chuck checksum for each 256 received bytes and it is only done for STM32 image (FSBL = TF-A BL2), not for FIT image. This patch solve issue of duplicated 0x100 byte written with FIP header. Fixes: 4fb7b3e10891 ("stm32mp: stm32prog: add FIP header support") Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: add FIP header supportPatrick Delaunay2021-04-091-3/+9
| | | | | | | | | | | | | | Add support of TF-A FIP header in command stm32prog for all the boot partition and not only the STM32IMAGE. This patch is a preliminary patch to support FIP as second boot stage after TF-A BL2 when CONFIG_TFABOOT is activated for trusted boot chain. The FIP is archive binary loaded by TF-A BL2, which contains the secure OS = OP-TEE and the non secure firmware and device tree = U-Boot. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* stm32mp: stm32prog: Add CONFIG_CMD_STM32PROG_SERIAL and _USBPatrick Delaunay2021-03-111-1/+22
| | | | | | | | | | | | | Add CONFIG_CMD_STM32PROG_SERIAL and CONFIG_CMD_STM32PROG_USB to independently select the support of UART or USB communication for STM32CubeProgrammer. For serial boot over UART, user can deactivate CONFIG_CMD_STM32PROG_SERIAL to use U-Boot console of binary loaded by UART (for board bring-up for example). Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
* arm: stm32mp: migrate cmd_stm32prog to log macroPatrick Delaunay2021-01-131-1/+1
| | | | | | | Change debug and pr_ macro to log macro. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add support of RAM targetPatrick Delaunay2020-05-141-1/+6
| | | | | | | | | | | | | | | | Add support of RAM target in flashlayout to load kernel image ("system") and device tree ("filesystem") in DDR with DFU and start these images. The flashlayout.tsv is: - 0x01 fsbl Binary none 0x00000000 tf-a.stm32 - 0x03 ssbl Binary none 0x00000000 u-boot.stm32 P 0x10 kernel System ram0 0xC2000000 uImage.bin P 0x11 dtb FileSystem ram0 0xC4000000 dtb.bin Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add serial link supportPatrick Delaunay2020-05-141-0/+11
| | | | | | | | | | Add a support of UART, using the same protocol than MCU STM32. See "AN5275: USB DFU/USART protocols used in STM32MP1 Series bootloaders" for details. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add pmic NVM update supportPatrick Delaunay2020-05-141-0/+10
| | | | | | | | Add a virtual partition to update the pmic non volatile memory. (on ST board, STPMIC1). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add otp update supportPatrick Delaunay2020-05-141-0/+11
| | | | | | | | Add a virtual partition to update the STM32MP15x OTP based on SMC service provided by TF-A. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add support of ssbl copyPatrick Delaunay2020-05-141-0/+1
| | | | | | | | | | For reliability of boot from NAND/SPI-NAND (with read-disturb issue) the SSBL can be present several time, when it is indicated in the flashlayout with "Binary(X)". The received binary is copied X times by U-Boot on the target. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: adapt the MTD partitionsPatrick Delaunay2020-05-141-0/+2
| | | | | | | | | | Dynamically adapt the MTD partitions in NOR/NAND/SPI-NAND when stm32prog command detects in the parsed flash layout files: - a fsbl partition in NOR. - a tee partition in NOR/NAND/SPI-NAND Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add MTD devices supportPatrick Delaunay2020-05-141-0/+4
| | | | | | | | Add support of MTD device (DFU_MTD backend) for NOR, NAND or SPI-NAND target. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add upport of partial updatePatrick Delaunay2020-05-141-0/+1
| | | | | | | | | Add support of partial update, update only some partitions, and check the coherence of the layout with the existing GPT partitions (offset and size). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add support of boot partition for eMMC devicePatrick Delaunay2020-05-141-1/+1
| | | | | | | | | | | | | Add support of eMMC device boot partition with part_id = -1 for offset="boot1" or = -2 for offset="boot2" The stm32prog command configures the MMC DFU backend with "mmcpart" and configure the eMMC (command "mmc bootbus" and "mmc partconf") when the update is done. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: stm32prog: add MMC devicePatrick Delaunay2020-05-141-0/+3
| | | | | | | | | | | Add support of MMC device (based on DFU_MMC backend) for SD card and eMMC update. Create a GPT partitioning on the device. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* stm32mp: add the command stm32progPatrick Delaunay2020-05-141-0/+137
Add a specific command stm32prog for STM32MP soc family witch allows to program the boot devices with the tool STM32CubeProgrammer (http://www.st.com/STM32CubeProg). This command uses the same UART STM32 protocol than MCU STM32 with or USB with DFU protocol v1.1 (ithe MCU ST extension are no supported). The executed actions are based on a tab separated value file with a stm32 header, the FlashLayout file (https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout). This file is parsed by the U-Boot command to: - initialize the devices - create the partition table on each device - initialize the DFU backend to access to not volatile memory (NOR/NAND/SD/eMMC) or to virtual device (OTP/PMIC) Up to STM32PROG_MAX_DEV (5) devices can be updated with a FlashLayout. The communication between U-Boot and STM32CubeProgrammer is done with the specific alternate configuration (see "AN5275: USB DFU/USART protocols used in STM32MP1 Series bootloaders" for details). The command stm32prog is executed when a boot from USB is detected (selected with bootpins) and we can program the boot devices with a simple command (on Windows or Linux): PC $> STM32_Programmer_CLI -c port=usb1 -w flaslayout.tsv 1/ the ROM code loads TF-A in embedded RAM (DFU or uart) 2/ TF-A loads flashlayout file and U-Boot in DDR (DFU or uart) 3/ U-Boot executes the stm32prog command (DFU or uart) Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>