42bb94148d9d4e0dc66970b92b77d29b5e065742
[platform/kernel/u-boot.git] / doc / board / st / stm32mp1.rst
1 .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2 .. sectionauthor:: Patrick Delaunay <patrick.delaunay@foss.st.com>
3
4 STM32MP15x boards
5 =================
6
7 This is a quick instruction for setup STM32MP15x boards.
8
9 Futher information can be found in STMicrolectronics STM32 WIKI_.
10
11 Supported devices
12 -----------------
13
14 U-Boot supports STMP32MP15x SoCs:
15
16  - STM32MP157
17  - STM32MP153
18  - STM32MP151
19
20 The STM32MP15x is a Cortex-A MPU aimed at various applications.
21
22 It features:
23
24  - Dual core Cortex-A7 application core (Single on STM32MP151)
25  - 2D/3D image composition with GPU (only on STM32MP157)
26  - Standard memories interface support
27  - Standard connectivity, widely inherited from the STM32 MCU family
28  - Comprehensive security support
29
30 Each line comes with a security option (cryptography & secure boot) and
31 a Cortex-A frequency option:
32
33  - A : Cortex-A7 @ 650 MHz
34  - C : Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
35  - D : Cortex-A7 @ 800 MHz
36  - F : Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz
37
38 Everything is supported in Linux but U-Boot is limited to:
39
40  1. UART
41  2. SD card/MMC controller (SDMMC)
42  3. NAND controller (FMC)
43  4. NOR controller (QSPI)
44  5. USB controller (OTG DWC2)
45  6. Ethernet controller
46
47 And the necessary drivers
48
49  1. I2C
50  2. STPMIC1 (PMIC and regulator)
51  3. Clock, Reset, Sysreset
52  4. Fuse
53
54 Currently the following boards are supported:
55
56  + stm32mp157a-dk1.dts
57  + stm32mp157c-dk2.dts
58  + stm32mp157c-ed1.dts
59  + stm32mp157c-ev1.dts
60  + stm32mp15xx-dhcor-avenger96.dts
61
62 Boot Sequences
63 --------------
64
65 2 boot configurations are supported with:
66
67 +----------+------------------------+-------------------------+--------------+
68 | **ROM**  | **FSBL**               | **SSBL**                | **OS**       |
69 + **code** +------------------------+-------------------------+--------------+
70 |          | First Stage Bootloader | Second Stage Bootloader | Linux Kernel |
71 +          +------------------------+-------------------------+--------------+
72 |          | embedded RAM           | DDR                                    |
73 +----------+------------------------+-------------------------+--------------+
74
75 The **Trusted** boot chain with TF-A_
76 `````````````````````````````````````
77
78 defconfig_file :
79    + **stm32mp15_defconfig** (for TF-A_ with FIP support)
80    + **stm32mp15_trusted_defconfig** (for TF-A_ without FIP support)
81
82     +-------------+--------------------------+------------+-------+
83     |  ROM code   | FSBL                     | SSBL       | OS    |
84     +             +--------------------------+------------+-------+
85     |             |Trusted Firmware-A (TF-A_)| U-Boot     | Linux |
86     +-------------+--------------------------+------------+-------+
87     | TrustZone   |secure monitor = SPMin or OP-TEE_              |
88     +-------------+--------------------------+------------+-------+
89
90 TF-A_ and OP-TEE_ are 2 separate projects, with their git repository;
91 they are compiled separately.
92
93 TF-A_ (BL2) initialize the DDR and loads the next stage binaries from a FIP file:
94    + BL32: a secure monitor BL32 = SPMin provided by TF-A_ or OP-TEE_ :
95      performs a full initialization of Secure peripherals and provides service
96      to normal world
97    + BL33: a non-trusted firmware = U-Boot, running in normal world and uses
98      the secure monitor to access to secure resources.
99    + HW_CONFIG: The hardware configuration file = the U-Boot device tree
100
101 The **Basic** boot chain with SPL
102 `````````````````````````````````
103
104 defconfig_file :
105    + **stm32mp15_basic_defconfig**
106
107     +-------------+------------+------------+-------+
108     |  ROM code   | FSBL       | SSBL       | OS    |
109     +             +------------+------------+-------+
110     |             |U-Boot SPL  | U-Boot     | Linux |
111     +-------------+------------+------------+-------+
112     | TrustZone   |            | PSCI from U-Boot   |
113     +-------------+------------+------------+-------+
114
115 SPL has limited security initialization.
116
117 U-Boot is running in secure mode and provide a secure monitor to the kernel
118 with only PSCI support (Power State Coordination Interface defined by ARM).
119
120 All the STM32MP15x boards supported by U-Boot use the same generic board
121 stm32mp1 which support all the bootable devices.
122
123 Each board is configured only with the associated device tree.
124
125 Device Tree Selection
126 ---------------------
127
128 You need to select the appropriate device tree for your board,
129 the supported device trees for STM32MP15x are:
130
131 + ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1)
132
133    + stm32mp157c-ev1
134
135 + ed1: daughter board with pmic stpmic1
136
137    + stm32mp157c-ed1
138
139 + dk1: Discovery board
140
141    + stm32mp157a-dk1
142
143 + dk2: Discovery board = dk1 with a BT/WiFI combo and a DSI panel
144
145    + stm32mp157c-dk2
146
147 + avenger96: Avenger96 board from Arrow Electronics based on DH Elec. DHCOR SoM
148
149    + stm32mp15xx-dhcor-avenger96
150
151 Build Procedure
152 ---------------
153
154 1. Install the required tools for U-Boot
155
156    * install package needed in U-Boot makefile
157      (libssl-dev, swig, libpython-dev...)
158
159    * install ARMv7 toolchain for 32bit Cortex-A (from Linaro,
160      from SDK for STM32MP15x, or any crosstoolchains from your distribution)
161      (you can use any gcc cross compiler compatible with U-Boot)
162
163 2. Set the cross compiler::
164
165     # export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi-
166
167 3. Select the output directory (optional)::
168
169    # export KBUILD_OUTPUT=/path/to/output
170
171    for example: use one output directory for each configuration::
172
173    # export KBUILD_OUTPUT=stm32mp15
174    # export KBUILD_OUTPUT=stm32mp15_trusted
175    # export KBUILD_OUTPUT=stm32mp15_basic
176
177    you can build outside of code directory::
178
179    # export KBUILD_OUTPUT=../build/stm32mp15
180
181 4. Configure U-Boot::
182
183    # make <defconfig_file>
184
185    with <defconfig_file>:
186
187    - For **trusted** boot mode : **stm32mp15_defconfig** or
188      stm32mp15_trusted_defconfig
189    - For basic boot mode: stm32mp15_basic_defconfig
190
191 5. Configure the device-tree and build the U-Boot image::
192
193    # make DEVICE_TREE=<name> all
194
195    Examples:
196
197   a) trusted boot with FIP on ev1::
198
199      # export KBUILD_OUTPUT=stm32mp15
200      # make stm32mp15_defconfig
201      # make DEVICE_TREE=stm32mp157c-ev1 all
202
203   b) trusted boot without FIP on dk2::
204
205       # export KBUILD_OUTPUT=stm32mp15_trusted
206       # make stm32mp15_trusted_defconfig
207       # make DEVICE_TREE=stm32mp157c-dk2 all
208
209   c) basic boot on ev1::
210
211       # export KBUILD_OUTPUT=stm32mp15_basic
212       # make stm32mp15_basic_defconfig
213       # make DEVICE_TREE=stm32mp157c-ev1 all
214
215   d) basic boot on ed1::
216
217       # export KBUILD_OUTPUT=stm32mp15_basic
218       # make stm32mp15_basic_defconfig
219       # make DEVICE_TREE=stm32mp157c-ed1 all
220
221   e) basic boot on dk1::
222
223      # export KBUILD_OUTPUT=stm32mp15_basic
224      # make stm32mp15_basic_defconfig
225      # make DEVICE_TREE=stm32mp157a-dk1 all
226
227   f) basic boot on avenger96::
228
229      # export KBUILD_OUTPUT=stm32mp15_basic
230      # make stm32mp15_basic_defconfig
231      # make DEVICE_TREE=stm32mp15xx-dhcor-avenger96 all
232
233 6. U-Boot Output files
234
235    So in the output directory (selected by KBUILD_OUTPUT),
236    you can found the needed U-Boot files:
237
238      - stm32mp15_defconfig = **u-boot-nodtb.bin** and **u-boot.dtb**
239
240      - stm32mp15_trusted_defconfig = u-boot.stm32
241
242      - stm32mp15_basic_defconfig
243
244        - FSBL = spl/u-boot-spl.stm32
245
246        - SSBL = u-boot.img (without CONFIG_SPL_LOAD_FIT) or
247                 u-boot.itb (with CONFIG_SPL_LOAD_FIT=y)
248
249 7. TF-A_ compilation
250
251    This step is required only for **Trusted** boot (stm32mp15_defconfig and
252    stm32mp15_trusted_defconfig); see OP-TEE_ and TF-A_ documentation for build
253    commands.
254
255    - For TF-A_ with FIP support: **stm32mp15_defconfig**
256
257      - with OP-TEE_ support, compile the OP-TEE to generate the binary included
258        in FIP
259
260      - after TF-A compilation, the used  files are:
261
262        - TF-A_ BL2 => FSBL = **tf-a.stm32**
263
264        - FIP => **fip.bin**
265
266          FIP file includes the 2 files given in arguments of TF-A_ compilation:
267
268         - BL33=u-boot-nodtb.bin
269         - BL33_CFG=u-boot.dtb
270
271      You can also update a existing FIP after U-boot compilation with fiptool,
272      a tool provided by TF-A_::
273
274      # fiptool update --nt-fw u-boot-nodtb.bin --hw-config u-boot.dtb fip-stm32mp157c-ev1.bin
275
276    - For TF-A_ without FIP support : **stm32mp15_trusted_defconfig**
277      SPMin is used and the used files are:
278
279        - FSBL = **tf-a.stm32** (provided by TF-A_ compilation, contening BL2 and
280          BL32 = SPMin)
281
282        - SSBL = **u-boot.stm32** used instead of fip.bin in next chapters
283
284 8. The bootloaders files
285
286 + The **ROM code** expects FSBL binaries with STM32 image header =
287   tf-a.stm32 or u-boot-spl.stm32
288
289 According the FSBL / the boot mode:
290
291 + **TF-A** expect a FIP binary = fip.bin, including the OS monitor (SPMin or
292   OP-TEE_) and the U-Boot binary + device tree
293
294   or, without FIP support, binaries with STM32 image header: U-Boot
295   = u-boot.stm32 and eventually  OP-TEE files (tee-header.stm32, tee-pageable.stm32,
296   tee-pager.stm32)
297
298 + **SPL** expects SSBL = U-Boot with uImage header = u-boot.img
299   or FIT = u-boot.itb.
300
301
302 Switch Setting for Boot Mode
303 ----------------------------
304
305 You can select the boot mode, on the board with one switch, to select
306 the boot pin values = BOOT0, BOOT1, BOOT2
307
308   +-------------+---------+---------+---------+
309   |*Boot Mode*  | *BOOT2* | *BOOT1* | *BOOT0* |
310   +=============+=========+=========+=========+
311   | Recovery    |  0      |  0      |  0      |
312   +-------------+---------+---------+---------+
313   | NOR         |  0      |  0      |  1      |
314   +-------------+---------+---------+---------+
315   | eMMC        |  0      |  1      |  0      |
316   +-------------+---------+---------+---------+
317   | NAND        |  0      |  1      |  1      |
318   +-------------+---------+---------+---------+
319   | Reserved    |  1      |  0      |  0      |
320   +-------------+---------+---------+---------+
321   | SD-Card     |  1      |  0      |  1      |
322   +-------------+---------+---------+---------+
323   | Recovery    |  1      |  1      |  0      |
324   +-------------+---------+---------+---------+
325   | SPI-NAND    |  1      |  1      |  1      |
326   +-------------+---------+---------+---------+
327
328 - on the **daugther board ed1 = MB1263** with the switch SW1
329 - on **Avenger96** with switch S3 (NOR and SPI-NAND are not applicable)
330 - on board **DK1/DK2** with the switch SW1 = BOOT0, BOOT2
331   with only 2 pins available (BOOT1 is forced to 0 and NOR not supported),
332   the possible value becomes:
333
334     +-------------+---------+---------+
335     |*Boot Mode*  | *BOOT2* | *BOOT0* |
336     +=============+=========+=========+
337     | Recovery    |  0      |  0      |
338     +-------------+---------+---------+
339     | NOR     (NA)|  0      |  1      |
340     +-------------+---------+---------+
341     | Reserved    |  1      |  0      |
342     +-------------+---------+---------+
343     | SD-Card     |  1      |  1      |
344     +-------------+---------+---------+
345
346 Recovery is a boot from serial link (UART/USB) and it is used with
347 STM32CubeProgrammer tool to load executable in RAM and to update the flash
348 devices available on the board (NOR/NAND/eMMC/SD card).
349
350 The communication between HOST and board is based on
351
352   - for UARTs : the uart protocol used with all MCU STM32
353   - for USB : based on USB DFU 1.1 (without the ST extensions used on MCU STM32)
354
355 Prepare an SD card
356 ------------------
357
358 The minimal requirements for STMP32MP15x boot up to U-Boot are:
359
360 - GPT partitioning (with gdisk or with sgdisk)
361 - 2 fsbl partitions, named "fsbl1" and "fsbl2", size at least 256KiB
362 - one partition named "fip" for FIP or U-Boot (TF-A_ search the "fip"
363   partition and SPL search the 3th partition, because
364   CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3)
365
366 The 2 fsbl partitions have the same content and are present to guarantee a
367 fail-safe update of FSBL; fsbl2 can be omitted if this ROM code feature is
368 not required.
369
370 Without FIP support in TF-A_, the 3rd partition "fip" for u-boot.stm32 must
371 be named "ssbl".
372
373 Then the minimal GPT partition is:
374
375 For TF-A_ with FIP support:
376
377   +-------+--------+---------+------------------------+
378   | *Num* | *Name* | *Size*  | *Content*              |
379   +=======+========+=========+========================+
380   | 1     | fsbl1  | 256 KiB | TF-A_ BL2 (tf-a.stm32) |
381   +-------+--------+---------+------------------------+
382   | 2     | fsbl2  | 256 KiB | TF-A_ BL2 (tf-a.stm32) |
383   +-------+--------+---------+------------------------+
384   | 3     | fip    | 4MB     | fip.bin                |
385   +-------+--------+---------+------------------------+
386   | 4     | <any>  | <any>   | Rootfs                 |
387   +-------+--------+---------+------------------------+
388
389 or:
390
391   +-------+--------+---------+------------------------+------------------------+
392   | *Num* | *Name* | *Size*  | *Trusted boot content* | *Basic boot content*   |
393   +=======+========+=========+========================+========================+
394   | 1     | fsbl1  | 256 KiB | TF-A_ BL2 (tf-a.stm32) | SPL (u-boot-spl.stm32) |
395   +-------+--------+---------+------------------------+------------------------+
396   | 2     | fsbl2  | 256 KiB | TF-A_ BL2 (tf-a.stm32) | SPL (u-boot-spl.stm32) |
397   +-------+--------+---------+------------------------+------------------------+
398   | 3     | ssbl   | 2MB     | U-Boot (u-boot.stm32)  | U-Boot (u-boot.img)    |
399   +-------+--------+---------+------------------------+------------------------+
400   | 4     | <any>  | <any>   | Rootfs                                          |
401   +-------+--------+---------+------------------------+------------------------+
402
403 And the 4th partition (Rootfs) is marked bootable with a file extlinux.conf
404 following the Generic Distribution feature (doc/README.distro for use).
405
406 The size of fip or ssbl partition must be enough for the associated binary file,
407 4MB and 2MB are default values.
408
409 According the used card reader select the correct block device
410 (for example /dev/sdx or /dev/mmcblk0), in the next example, it is /dev/mmcblk0
411
412 For example:
413
414 a) remove previous formatting::
415
416      # sgdisk -o /dev/<SD card dev>
417
418 b) create minimal image for FIP
419
420    For FIP support in TF-A_::
421
422     # sgdisk --resize-table=128 -a 1 \
423     -n 1:34:545         -c 1:fsbl1 \
424     -n 2:546:1057               -c 2:fsbl2 \
425     -n 3:1058:9249              -c 3:fip \
426     -n 4:9250:                  -c 4:rootfs -A 4:set:2 \
427     -p /dev/<SD card dev>
428
429    With gpt table with 128 entries an the partition 4 marked bootable (bit 2).
430
431    For basic boot mode or without FIP support in TF-A_::
432
433     # sgdisk --resize-table=128 -a 1 \
434     -n 1:34:545         -c 1:fsbl1 \
435     -n 2:546:1057               -c 2:fsbl2 \
436     -n 3:1058:5153              -c 3:ssbl \
437     -n 4:5154:              -c 4:rootfs -A 4:set:2 \
438     -p /dev/<SD card dev>
439
440 c) copy the FSBL (2 times) and SSBL file on the correct partition.
441    in this example in partition 1 to 3
442
443    for trusted boot: ::
444
445     # dd if=tf-a.stm32 of=/dev/mmcblk0p1
446     # dd if=tf-a.stm32 of=/dev/mmcblk0p2
447     # dd if=fip.bin of=/dev/mmcblk0p3
448       OR
449       dd if=u-boot.stm32 of=/dev/mmcblk0p3 # Without FIT support
450
451    for basic boot mode : <SD card dev> = /dev/mmcblk0::
452
453     # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1
454     # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2
455     # dd if=u-boot.img of=/dev/mmcblk0p3 # Without CONFIG_SPL_LOAD_FIT
456       OR
457       dd if=u-boot.itb of=/dev/mmcblk0p3 # With CONFIG_SPL_LOAD_FIT=y
458
459 To boot from SD card, select BootPinMode = 1 0 1 and reset.
460
461 Prepare eMMC
462 ------------
463
464 You can use U-Boot to copy binary in eMMC.
465
466 In the next example, you need to boot from SD card and the images
467 (tf-a.stm32, fip.bin / u-boot-spl.stm32, u-boot.img for systems without
468 CONFIG_SPL_LOAD_FIT or u-boot.itb for systems with CONFIG_SPL_LOAD_FIT=y) are
469 presents on SD card (mmc 0) in ext4 partition 4 (bootfs)
470
471 To boot from SD card, select BootPinMode = 1 0 1 and reset.
472
473 Then you update the eMMC with the next U-Boot command :
474
475 a) prepare GPT on eMMC,
476    example with 3 partitions, fip, bootfs and roots::
477
478     # setenv emmc_part "name=fip,size=4MiB;name=bootfs,type=linux,bootable,size=64MiB;name=rootfs,type=linux,size=512"
479     # gpt write mmc 1 ${emmc_part}
480
481 b) copy FSBL, TF-A_ or SPL, on first eMMC boot partition
482    (SPL max size is 256kB, with LBA 512, 0x200)::
483
484     # ext4load mmc 0:4 0xC0000000 tf-a.stm32
485     or
486     # ext4load mmc 0:4 0xC0000000 u-boot-spl.stm32
487
488     # mmc dev 1
489     # mmc partconf 1 1 1 1
490     # mmc write ${fileaddr} 0 200
491     # mmc partconf 1 1 1 0
492
493 c) copy SSBL, FIP or U-Boot binary, in first GPT partition of eMMC::
494
495     # ext4load mmc 0:4 0xC0000000 fip.bin
496     or
497     # ext4load mmc 0:4 0xC0000000 u-boot.img # Without CONFIG_SPL_LOAD_FIT
498     or
499     # ext4load mmc 0:4 0xC0000000 u-boot.itb # With CONFIG_SPL_LOAD_FIT=y
500
501
502     # mmc dev 1
503     # part start mmc 1 1 partstart
504     # mmc write ${fileaddr} ${partstart} ${filesize}
505
506 To boot from eMMC, select BootPinMode = 0 1 0 and reset.
507
508 MAC Address
509 -----------
510
511 Please read doc/README.enetaddr for the implementation guidelines for mac id
512 usage. Basically, environment has precedence over board specific storage.
513
514 For STMicroelectonics board, it is retrieved in STM32MP15x OTP :
515
516  - OTP_57[31:0] = MAC_ADDR[31:0]
517  - OTP_58[15:0] = MAC_ADDR[47:32]
518
519 To program a MAC address on virgin OTP words above, you can use the fuse command
520 on bank 0 to access to internal OTP and lock them:
521
522 Prerequisite: check if a MAC address isn't yet programmed in OTP
523
524 1) check OTP: their value must be equal to 0::
525
526     STM32MP> fuse sense 0 57 2
527     Sensing bank 0:
528     Word 0x00000039: 00000000 00000000
529
530 2) check environment variable::
531
532     STM32MP> env print ethaddr
533     ## Error: "ethaddr" not defined
534
535 3) check lock status of fuse 57 & 58 (at 0x39, 0=unlocked, 1=locked)::
536
537     STM32MP> fuse sense 0 0x10000039 2
538     Sensing bank 0:
539        Word 0x10000039: 00000000 00000000
540
541 Example to set mac address "12:34:56:78:9a:bc"
542
543 1) Write OTP::
544
545     STM32MP> fuse prog -y 0 57 0x78563412 0x0000bc9a
546
547 2) Read OTP::
548
549     STM32MP> fuse sense 0 57 2
550     Sensing bank 0:
551     Word 0x00000039: 78563412 0000bc9a
552
553 3) Lock OTP::
554
555     STM32MP> fuse prog 0 0x10000039 1 1
556
557     STM32MP> fuse sense 0 0x10000039 2
558     Sensing bank 0:
559        Word 0x10000039: 00000001 00000001
560
561 4) next REBOOT, in the trace::
562
563     ### Setting environment from OTP MAC address = "12:34:56:78:9a:bc"
564
565 5) check env update::
566
567     STM32MP> env print ethaddr
568     ethaddr=12:34:56:78:9a:bc
569
570 .. warning:: This command can't be executed twice on the same board as
571              OTP are protected. It is already done for the board
572              provided by STMicroelectronics.
573
574 Coprocessor firmware
575 --------------------
576
577 U-Boot can boot the coprocessor before the kernel (coprocessor early boot).
578
579 a) Manuallly by using rproc commands (update the bootcmd)
580
581    Configurations::
582
583         # env set name_copro "rproc-m4-fw.elf"
584         # env set dev_copro 0
585         # env set loadaddr_copro 0xC1000000
586
587    Load binary from bootfs partition (number 4) on SD card (mmc 0)::
588
589         # ext4load mmc 0:4 ${loadaddr_copro} ${name_copro}
590
591    => ${filesize} variable is updated with the size of the loaded file.
592
593    Start M4 firmware with remote proc command::
594
595         # rproc init
596         # rproc load ${dev_copro} ${loadaddr_copro} ${filesize}
597         # rproc start ${dev_copro}"00270033
598
599 b) Automatically by using FIT feature and generic DISTRO bootcmd
600
601    see examples in the board stm32mp1 directory: fit_copro_kernel_dtb.its
602
603    Generate FIT including kernel + device tree + M4 firmware with cfg with M4
604    boot::
605
606    $> mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb
607
608    Then using DISTRO configuration file: see extlinux.conf to select the correct
609    configuration:
610
611    - stm32mp157c-ev1-m4
612    - stm32mp157c-dk2-m4
613
614 DFU support
615 -----------
616
617 The DFU is supported on ST board.
618
619 The env variable dfu_alt_info is automatically build, and all
620 the memory present on the ST boards are exported.
621
622 The dfu mode is started by the command::
623
624   STM32MP> dfu 0
625
626 On EV1 board, booting from SD card, without OP-TEE_::
627
628   STM32MP> dfu 0 list
629   DFU alt settings list:
630   dev: RAM alt: 0 name: uImage layout: RAM_ADDR
631   dev: RAM alt: 1 name: devicetree.dtb layout: RAM_ADDR
632   dev: RAM alt: 2 name: uramdisk.image.gz layout: RAM_ADDR
633   dev: eMMC alt: 3 name: mmc0_fsbl1 layout: RAW_ADDR
634   dev: eMMC alt: 4 name: mmc0_fsbl2 layout: RAW_ADDR
635   dev: eMMC alt: 5 name: mmc0_fip layout: RAW_ADDR
636   dev: eMMC alt: 6 name: mmc0_bootfs layout: RAW_ADDR
637   dev: eMMC alt: 7 name: mmc0_vendorfs layout: RAW_ADDR
638   dev: eMMC alt: 8 name: mmc0_rootfs layout: RAW_ADDR
639   dev: eMMC alt: 9 name: mmc0_userfs layout: RAW_ADDR
640   dev: eMMC alt: 10 name: mmc1_boot1 layout: RAW_ADDR
641   dev: eMMC alt: 11 name: mmc1_boot2 layout: RAW_ADDR
642   dev: eMMC alt: 12 name: mmc1_fip layout: RAW_ADDR
643   dev: eMMC alt: 13 name: mmc1_bootfs layout: RAW_ADDR
644   dev: eMMC alt: 14 name: mmc1_vendorfs layout: RAW_ADDR
645   dev: eMMC alt: 15 name: mmc1_rootfs layout: RAW_ADDR
646   dev: eMMC alt: 16 name: mmc1_userfs layout: RAW_ADDR
647   dev: MTD alt: 17 name: nor0 layout: RAW_ADDR
648   dev: MTD alt: 18 name: nand0 layout: RAW_ADDR
649   dev: VIRT alt: 19 name: OTP layout: RAW_ADDR
650   dev: VIRT alt: 20 name: PMIC layout: RAW_ADDR
651
652 All the supported device are exported for dfu-util tool::
653
654   $> dfu-util -l
655   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=20, name="PMIC", serial="002700333338511934383330"
656   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=19, name="OTP", serial="002700333338511934383330"
657   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=18, name="nand0", serial="002700333338511934383330"
658   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=17, name="nor0", serial="002700333338511934383330"
659   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=16, name="mmc1_userfs", serial="002700333338511934383330"
660   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=15, name="mmc1_rootfs", serial="002700333338511934383330"
661   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=14, name="mmc1_vendorfs", serial="002700333338511934383330"
662   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=13, name="mmc1_bootfs", serial="002700333338511934383330"
663   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=12, name="mmc1_fip", serial="002700333338511934383330"
664   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=11, name="mmc1_boot2", serial="002700333338511934383330"
665   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=10, name="mmc1_boot1", serial="002700333338511934383330"
666   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=9, name="mmc0_userfs", serial="002700333338511934383330"
667   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=8, name="mmc0_rootfs", serial="002700333338511934383330"
668   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=7, name="mmc0_vendorfs", serial="002700333338511934383330"
669   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=6, name="mmc0_bootfs", serial="002700333338511934383330"
670   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=5, name="mmc0_fip", serial="002700333338511934383330"
671   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=4, name="mmc0_fsbl2", serial="002700333338511934383330"
672   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=3, name="mmc0_fsbl1", serial="002700333338511934383330"
673   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=2, name="uramdisk.image.gz", serial="002700333338511934383330"
674   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=1, name="devicetree.dtb", serial="002700333338511934383330"
675   Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=0, name="uImage", serial="002700333338511934383330"
676
677 You can update the boot device:
678
679 - SD card (mmc0) ::
680
681   $> dfu-util -d 0483:5720 -a 3 -D tf-a-stm32mp157c-ev1.stm32
682   $> dfu-util -d 0483:5720 -a 4 -D tf-a-stm32mp157c-ev1.stm32
683   $> dfu-util -d 0483:5720 -a 5 -D fip-stm32mp157c-ev1.bin
684   $> dfu-util -d 0483:5720 -a 6 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4
685   $> dfu-util -d 0483:5720 -a 7 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
686   $> dfu-util -d 0483:5720 -a 8 -D st-image-weston-openstlinux-weston-stm32mp1.ext4
687   $> dfu-util -d 0483:5720 -a 9 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4
688
689 - EMMC (mmc1)::
690
691   $> dfu-util -d 0483:5720 -a 10 -D tf-a-stm32mp157c-ev1.stm32
692   $> dfu-util -d 0483:5720 -a 11 -D tf-a-stm32mp157c-ev1.stm32
693   $> dfu-util -d 0483:5720 -a 12 -D fip-stm32mp157c-ev1.bin
694   $> dfu-util -d 0483:5720 -a 13 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4
695   $> dfu-util -d 0483:5720 -a 14 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
696   $> dfu-util -d 0483:5720 -a 15 -D st-image-weston-openstlinux-weston-stm32mp1.ext4
697   $> dfu-util -d 0483:5720 -a 16 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4
698
699 - you can also dump the OTP and the PMIC NVM with::
700
701   $> dfu-util -d 0483:5720 -a 19 -U otp.bin
702   $> dfu-util -d 0483:5720 -a 20 -U pmic.bin
703
704
705 When the board is booting for nor0 or nand0,
706 only the MTD partition on the boot devices are available, for example:
707
708 - NOR (nor0 = alt 20) & NAND (nand0 = alt 26) ::
709
710   $> dfu-util -d 0483:5720 -a 21 -D tf-a-stm32mp157c-ev1.stm32
711   $> dfu-util -d 0483:5720 -a 22 -D tf-a-stm32mp157c-ev1.stm32
712   $> dfu-util -d 0483:5720 -a 23 -D fip-stm32mp157c-ev1.bin
713   $> dfu-util -d 0483:5720 -a 27 -D st-image-weston-openstlinux-weston-stm32mp1_nand_4_256_multivolume.ubi
714
715 - NAND (nand0 = alt 21)::
716
717   $> dfu-util -d 0483:5720 -a 22 -D tf-a-stm32mp157c-ev1.stm32
718   $> dfu-util -d 0483:5720 -a 23 -D fip-stm32mp157c-ev1.bin
719   $> dfu-util -d 0483:5720 -a 24 -D fip-stm32mp157c-ev1.bin
720   $> dfu-util -d 0483:5720 -a 25 -D st-image-weston-openstlinux-weston-stm32mp1_nand_4_256_multivolume.ubi
721
722 References
723 ----------
724
725 .. _WIKI:
726
727 STM32 Arm® Cortex®-based MPUs user guide
728
729   + https://wiki.st.com/
730   + https://wiki.st.com/stm32mpu/wiki/Main_Page
731
732 .. _TF-A:
733
734 TF-A = The Trusted Firmware-A project provides a reference implementation of
735 secure world software for Armv7-A and Armv8-A class processors
736
737   + https://www.trustedfirmware.org/projects/tf-a/
738   + https://trustedfirmware-a.readthedocs.io/en/latest/
739   + https://trustedfirmware-a.readthedocs.io/en/latest/plat/stm32mp1.html
740   + https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/
741
742 .. _OP-TEE:
743
744 OP-TEE = an open source Trusted Execution Environment (TEE) implementing the
745 Arm TrustZone technology
746
747   + https://www.op-tee.org/
748   + https://optee.readthedocs.io/en/latest/
749   + https://optee.readthedocs.io/en/latest/building/devices/stm32mp1.html
750   + https://github.com/OP-TEE/optee_os