Commit Graph

13 Commits

Author SHA1 Message Date
6bf602057b stm32mp: stm32prog: add support of RAM target
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

Cover-letter:
stm32mp1: add command stm32prog

Add a specific command stm32prog for STM32MP soc family
witch allows to update the devices on the board with the
STMicroelectronics tool STM32CubeProgrammer
(http://www.st.com/STM32CubeProg).

This command use the same UART STM32 protocol than MCU STM32
with or USB with DFU protocol v1.1 (MCU ST extension are no supported).

The executed actions are based on a tab separated value file
with a stm32 header (see
https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout).

This FlashLayout file is loaded in DDR by TF-A during during a
serial boot or in a virtual device by stm32prog command
and is parsed by U-Boot (see "AN5275: USB DFU/USART protocols used
in STM32MP1 Series bootloaders" for details).

Regards
Patrick

END

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
42461cdd81 stm32mp: stm32prog: add serial link support
Add a support of UAR,  using the same UART STM32 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>
2020-04-09 15:40:59 +02:00
ab6c6bc0d7 stm32mp: stm32prog: add pmic NVM update support
Add a virtual partition to update the pmic not volatile memory.
(on ST board, STPMIC1).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
020567b5c2 stm32mp: stm32prog: add otp update support
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>
2020-04-09 15:40:59 +02:00
1ccb656964 stm32mp: stm32prog: add support for delete option in flashlayout
Add support for delete option 'D' in flashlayout for
full device or for partitions

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
699c121181 stm32mp: stm32prog: add support of ssbl copy
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>
2020-04-09 15:40:59 +02:00
4035dff056 stm32mp: stm32prog: adapt the MTD partitions
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>
Change-Id: I609771871d9986ed440c7620c048f24de42c83ba
2020-04-09 15:40:59 +02:00
9d1a2796a4 stm32mp: stm32prog: add MTD devices support
Add support of MTD device (DFU_MTD backend) for
NOR, NAND or SPI-NAND target.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
da198d31f5 stm32mp: stm32prog: add upport of partial update
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>
2020-04-09 15:40:59 +02:00
fab79bdcfa stm32mp: stm32prog: add support of boot partition for eMMC device
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>
2020-04-09 15:40:59 +02:00
d298a9564a stm32mp: stm32prog: add MMC device
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>
2020-04-09 15:40:59 +02:00
fe5de659be stm32mp: stm32prog: add flash layout parsing
Build the list of device and of partition with
a tab separated value file with a stm32 header: the FlashLayout.tsv
(https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
40de68cee6 stm32mp: add the command stm32prog
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 use 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:
- initialized 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 board 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>
Change-Id: I4a84b1a09311e05ad95aed6ee847685b03771b29
2020-04-09 15:40:59 +02:00