Commit 8aad16916d04e3db0d1652cb96e840e209e19252

Authored by Tom Rini

Merge tag 'u-boot-stm32-20200203' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- convert stm32mp1 board documentation to rst format

Showing 6 changed files Side-by-side Diff

... ... @@ -345,6 +345,7 @@
345 345 T: git https://gitlab.denx.de/u-boot/custodians/u-boot-stm.git
346 346 S: Maintained
347 347 F: arch/arm/mach-stm32mp/
  348 +F: doc/board/st/
348 349 F: drivers/adc/stm32-adc*
349 350 F: drivers/clk/clk_stm32mp1.c
350 351 F: drivers/gpio/stm32_gpio.c
board/st/stm32mp1/README
1   -SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2   -#
3   -# Copyright (C) 2018 STMicroelectronics - All Rights Reserved
4   -#
5   -
6   -U-Boot on STMicroelectronics STM32MP15x
7   -=======================================
8   -
9   -1. Summary
10   -==========
11   -This is a quick instruction for setup stm32mp1 boards.
12   -
13   -2. Supported devices
14   -====================
15   -U-Boot supports STMP32MP15x SoCs: STM32MP157, STM32MP153 and STM32MP151
16   -
17   -The STM32MP15x is a Cortex-A MPU aimed at various applications.
18   -It features:
19   -- Dual core Cortex-A7 application core (Single on STM32MP151)
20   -- 2D/3D image composition with GPU (only on STM32MP157)
21   -- Standard memories interface support
22   -- Standard connectivity, widely inherited from the STM32 MCU family
23   -- Comprehensive security support
24   -
25   -Everything is supported in Linux but U-Boot is limited to:
26   -1. UART
27   -2. SDCard/MMC controller (SDMMC)
28   -3. NAND controller (FMC)
29   -4. NOR controller (QSPI)
30   -5. USB controller (OTG DWC2)
31   -6. Ethernet controller
32   -
33   -And the necessary drivers
34   -1. I2C
35   -2. STPMIC1 (PMIC and regulator)
36   -3. Clock, Reset, Sysreset
37   -4. Fuse
38   -
39   -Currently the following boards are supported:
40   -+ stm32mp157a-avenger96.dts
41   -+ stm32mp157a-dk1.dts
42   -+ stm32mp157c-dk2.dts
43   -+ stm32mp157c-ed1.dts
44   -+ stm32mp157c-ev1.dts
45   -
46   -3. Boot Sequences
47   -=================
48   -
49   -BootRom => FSBL in SYSRAM => SSBL in DDR => OS (Linux Kernel)
50   -
51   -with FSBL = First Stage Bootloader
52   - SSBL = Second Stage Bootloader
53   -
54   -3 boot configurations are supported:
55   -
56   -1) The "Trusted" boot chain (defconfig_file : stm32mp15_trusted_defconfig)
57   - BootRom => FSBL = Trusted Firmware-A (TF-A) => SSBL = U-Boot
58   - TF-A performs a full initialization of Secure peripherals and installs a
59   - secure monitor.
60   - U-Boot is running in normal world and uses TF-A monitor
61   - to access to secure resources.
62   -
63   -2) The "Trusted" boot chain with OP-TEE
64   - (defconfig_file : stm32mp15_optee_defconfig)
65   - BootRom => FSBL = Trusted Firmware-A (TF-A) => SSBL = U-Boot
66   - TF-A performs a full initialization of Secure peripherals and installs OP-TEE
67   - from specific partitions (teeh, teed, teex).
68   - U-Boot is running in normal world and uses OP-TEE monitor to access
69   - to secure resources.
70   -
71   -3) The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
72   - BootRom => FSBL = U-Boot SPL => SSBL = U-Boot
73   - SPL has limited security initialisation
74   - U-Boot is running in secure mode and provide a secure monitor to the kernel
75   - with only PSCI support (Power State Coordination Interface defined by ARM).
76   -
77   -All the STM32MP15x boards supported by U-Boot use the same generic board
78   -stm32mp1 which support all the bootable devices.
79   -
80   -Each board is configurated only with the associated device tree.
81   -
82   -4. Device Tree Selection
83   -========================
84   -
85   -You need to select the appropriate device tree for your board,
86   -the supported device trees for stm32mp157 are:
87   -
88   -+ ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1)
89   - dts: stm32mp157c-ev1
90   -
91   -+ ed1: daughter board with pmic stpmic1
92   - dts: stm32mp157c-ed1
93   -
94   -+ dk1: Discovery board
95   - dts: stm32mp157a-dk1
96   -
97   -+ dk2: Discovery board = dk1 with a BT/WiFI combo and a DSI panel
98   - dts: stm32mp157c-dk2
99   -
100   -+ avenger96: Avenger96 board from Arrow Electronics
101   - dts: stm32mp157a-avenger96
102   -
103   -5. Build Procedure
104   -==================
105   -
106   -1. Install required tools for U-Boot
107   -
108   - + install package needed in U-Boot makefile
109   - (libssl-dev, swig, libpython-dev...)
110   - + install ARMv7 toolchain for 32bit Cortex-A (from Linaro,
111   - from SDK for STM32MP15x, or any crosstoolchains from your distribution)
112   -
113   -2. Set the cross compiler:
114   -
115   - # export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi-
116   - (you can use any gcc cross compiler compatible with U-Boot)
117   -
118   -3. Select the output directory (optional)
119   -
120   - # export KBUILD_OUTPUT=/path/to/output
121   -
122   - for example: use one output directory for each configuration
123   - # export KBUILD_OUTPUT=stm32mp15_trusted
124   - # export KBUILD_OUTPUT=stm32mp15_optee
125   - # export KBUILD_OUTPUT=stm32mp15_basic
126   -
127   - you can build outside of code directory:
128   - # export KBUILD_OUTPUT=../build/stm32mp15_trusted
129   -
130   -4. Configure U-Boot:
131   -
132   - # make <defconfig_file>
133   -
134   - - For trusted boot mode : "stm32mp15_trusted_defconfig"
135   - - For trusted with OP-TEE boot mode : "stm32mp15_optee_defconfig"
136   - - For basic boot mode: "stm32mp15_basic_defconfig"
137   -
138   -5. Configure the device-tree and build the U-Boot image:
139   -
140   - # make DEVICE_TREE=<name> all
141   -
142   - example:
143   - a) trusted boot on ev1
144   - # export KBUILD_OUTPUT=stm32mp15_trusted
145   - # make stm32mp15_trusted_defconfig
146   - # make DEVICE_TREE=stm32mp157c-ev1 all
147   -
148   - b) trusted with OP-TEE boot on dk2
149   - # export KBUILD_OUTPUT=stm32mp15_optee
150   - # make stm32mp15_optee_defconfig
151   - # make DEVICE_TREE=stm32mp157c-dk2 all
152   -
153   - c) basic boot on ev1
154   - # export KBUILD_OUTPUT=stm32mp15_basic
155   - # make stm32mp15_basic_defconfig
156   - # make DEVICE_TREE=stm32mp157c-ev1 all
157   -
158   - d) basic boot on ed1
159   - # export KBUILD_OUTPUT=stm32mp15_basic
160   - # make stm32mp15_basic_defconfig
161   - # make DEVICE_TREE=stm32mp157c-ed1 all
162   -
163   - e) basic boot on dk1
164   - # export KBUILD_OUTPUT=stm32mp15_basic
165   - # make stm32mp15_basic_defconfig
166   - # make DEVICE_TREE=stm32mp157a-dk1 all
167   -
168   - f) basic boot on avenger96
169   - # export KBUILD_OUTPUT=stm32mp15_basic
170   - # make stm32mp15_basic_defconfig
171   - # make DEVICE_TREE=stm32mp157a-avenger96 all
172   -
173   -6. Output files
174   -
175   - BootRom and TF-A expect binaries with STM32 image header
176   - SPL expects file with U-Boot uImage header
177   -
178   - So in the output directory (selected by KBUILD_OUTPUT),
179   - you can found the needed files:
180   -
181   - a) For Trusted boot (with or without OP-TEE)
182   - + FSBL = tf-a.stm32 (provided by TF-A compilation)
183   - + SSBL = u-boot.stm32
184   -
185   - b) For Basic boot
186   - + FSBL = spl/u-boot-spl.stm32
187   - + SSBL = u-boot.img
188   -
189   -6. Switch Setting for Boot Mode
190   -===============================
191   -
192   -You can select the boot mode, on the board with one switch :
193   -
194   -- on the daugther board ed1 with the switch SW1 : BOOT0, BOOT1, BOOT2
195   -
196   - -----------------------------------
197   - Boot Mode BOOT2 BOOT1 BOOT0
198   - -----------------------------------
199   - Reserved 0 0 0
200   - NOR 0 0 1
201   - SD-Card 1 0 1
202   - eMMC 0 1 0
203   - NAND 0 1 1
204   - Recovery 1 1 0
205   - Recovery 0 0 0
206   -
207   -- on board DK1/DK2 with the switch SW1 : BOOT0, BOOT2
208   - (BOOT1 forced to 0, NOR not supported)
209   -
210   - --------------------------
211   - Boot Mode BOOT2 BOOT0
212   - --------------------------
213   - Reserved 1 0
214   - SD-Card 1 1
215   - Recovery 0 0
216   -
217   -- Boot mode of Avenger96 can be selected using switch S3
218   -
219   - -----------------------------------
220   - Boot Mode BOOT2 BOOT1 BOOT0
221   - -----------------------------------
222   - Recovery 0 0 0
223   - NOR 0 0 1
224   - SD-Card 1 0 1
225   - eMMC 0 1 0
226   - NAND 0 1 1
227   - Reserved 1 0 0
228   - Recovery 1 1 0
229   - SD-Card 1 1 1
230   -
231   -Recovery is a boot from serial link (UART/USB) and it is used with
232   -STM32CubeProgrammer tool to load executable in RAM and to update the flash
233   -devices available on the board (NOR/NAND/eMMC/SDCARD).
234   -The communication between HOST and board is based on
235   -- for UARTs : the uart protocol used with all MCU STM32
236   -- for USB : based on USB DFU 1.1 (without the ST extensions used on MCU STM32)
237   -
238   -7. Prepare an SDCard
239   -===================
240   -
241   -The minimal requirements for STMP32MP1 boot up to U-Boot are:
242   -- GPT partitioning (with gdisk or with sgdisk)
243   -- 2 fsbl partitions, named fsbl1 and fsbl2, size at least 256KiB
244   -- one ssbl partition for U-Boot
245   -
246   -Then the minimal GPT partition is:
247   - ----- ------- --------- --------------
248   - | Num | Name | Size | Content |
249   - ----- ------- -------- ---------------
250   - | 1 | fsbl1 | 256 KiB | TF-A or SPL |
251   - | 2 | fsbl2 | 256 KiB | TF-A or SPL |
252   - | 3 | ssbl | enought | U-Boot |
253   - | * | - | - | Boot/Rootfs |
254   - ----- ------- --------- --------------
255   -
256   -(*) add bootable partition for extlinux.conf
257   - following Generic Distribution
258   - (doc/README.distro for use)
259   -
260   - according the used card reader select the block device
261   - (/dev/sdx or /dev/mmcblk0)
262   - in the next example I use /dev/mmcblk0
263   -
264   -for example: with gpt table with 128 entries
265   -
266   - a) remove previous formatting
267   - # sgdisk -o /dev/<SDCard dev>
268   -
269   - b) create minimal image
270   - # sgdisk --resize-table=128 -a 1 \
271   - -n 1:34:545 -c 1:fsbl1 \
272   - -n 2:546:1057 -c 2:fsbl2 \
273   - -n 3:1058:5153 -c 3:ssbl \
274   - -p /dev/<SDCard dev>
275   -
276   - you can add other partitions for kernel
277   - one partition rootfs for example:
278   - -n 4:5154: -c 4:rootfs \
279   -
280   - c) copy the FSBL (2 times) and SSBL file on the correct partition.
281   - in this example in partition 1 to 3
282   -
283   - for basic boot mode : <SDCard dev> = /dev/mmcblk0
284   - # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1
285   - # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2
286   - # dd if=u-boot.img of=/dev/mmcblk0p3
287   -
288   - for trusted boot mode :
289   - # dd if=tf-a.stm32 of=/dev/mmcblk0p1
290   - # dd if=tf-a.stm32 of=/dev/mmcblk0p2
291   - # dd if=u-boot.stm32 of=/dev/mmcblk0p3
292   -
293   -To boot from SDCard, select BootPinMode = 1 0 1 and reset.
294   -
295   -8. Prepare eMMC
296   -===============
297   -You can use U-Boot to copy binary in eMMC.
298   -
299   -In the next example, you need to boot from SDCARD and the images (u-boot-spl.stm32, u-boot.img)
300   -are presents on SDCARD (mmc 0) in ext4 partition 4 (bootfs).
301   -
302   -To boot from SDCard, select BootPinMode = 1 0 1 and reset.
303   -
304   -Then you update the eMMC with the next U-Boot command :
305   -
306   -a) prepare GPT on eMMC,
307   - example with 2 partitions, bootfs and roots:
308   -
309   - # setenv emmc_part "name=ssbl,size=2MiB;name=bootfs,type=linux,bootable,size=64MiB;name=rootfs,type=linux,size=512"
310   - # gpt write mmc 1 ${emmc_part}
311   -
312   -b) copy SPL on eMMC on firts boot partition
313   - (SPL max size is 256kB, with LBA 512, 0x200)
314   -
315   - # ext4load mmc 0:4 0xC0000000 u-boot-spl.stm32
316   - # mmc dev 1
317   - # mmc partconf 1 1 1 1
318   - # mmc write ${fileaddr} 0 200
319   - # mmc partconf 1 1 1 0
320   -
321   -c) copy U-Boot in first GPT partition of eMMC
322   -
323   - # ext4load mmc 0:4 0xC0000000 u-boot.img
324   - # mmc dev 1
325   - # part start mmc 1 1 partstart
326   - # mmc write ${fileaddr} ${partstart} ${filesize}
327   -
328   -To boot from eMMC, select BootPinMode = 0 1 0 and reset.
329   -
330   -9. MAC Address
331   -==============
332   -
333   -Please read doc/README.enetaddr for the implementation guidelines for mac id
334   -usage. Basically, environment has precedence over board specific storage.
335   -
336   -For STMicroelectonics board, it is retrieved in STM32MP15x otp :
337   -- OTP_57[31:0] = MAC_ADDR[31:0]
338   -- OTP_58[15:0] = MAC_ADDR[47:32]
339   -
340   -To program a MAC address on virgin OTP words above, you can use the fuse command
341   -on bank 0 to access to internal OTP:
342   -
343   - Prerequisite: check if a MAC address isn't yet programmed in OTP
344   -
345   - 1- check OTP: their value must be equal to 0
346   -
347   - STM32MP> fuse sense 0 57 2
348   - Sensing bank 0:
349   - Word 0x00000039: 00000000 00000000
350   -
351   - 2- check environment variable
352   -
353   - STM32MP> env print ethaddr
354   - ## Error: "ethaddr" not defined
355   -
356   - Example to set mac address "12:34:56:78:9a:bc"
357   -
358   - 1- Write OTP
359   - STM32MP> fuse prog -y 0 57 0x78563412 0x0000bc9a
360   -
361   - 2- Read OTP
362   - STM32MP> fuse sense 0 57 2
363   - Sensing bank 0:
364   - Word 0x00000039: 78563412 0000bc9a
365   -
366   - 3- next REBOOT :
367   - ### Setting environment from OTP MAC address = "12:34:56:78:9a:bc"
368   -
369   - 4 check env update
370   - STM32MP> env print ethaddr
371   - ethaddr=12:34:56:78:9a:bc
372   -
373   -warning:: This MAC address provisioning can't be executed twice on the same
374   - board as the OTP are protected. It is already done for the board
375   - provided by STMicroelectronics.
376   -
377   -10. Coprocessor firmware
378   -========================
379   -
380   -U-Boot can boot the coprocessor before the kernel (coprocessor early boot).
381   -
382   -A/ Manuallly by using rproc commands (update the bootcmd)
383   - Configurations
384   - # env set name_copro "rproc-m4-fw.elf"
385   - # env set dev_copro 0
386   - # env set loadaddr_copro 0xC1000000
387   -
388   - Load binary from bootfs partition (number 4) on SDCard (mmc 0)
389   - # ext4load mmc 0:4 ${loadaddr_copro} ${name_copro}
390   - => ${filesize} updated with the size of the loaded file
391   -
392   - Start M4 firmware with remote proc command
393   - # rproc init
394   - # rproc load ${dev_copro} ${loadaddr_copro} ${filesize}
395   - # rproc start ${dev_copro}
396   -
397   -B/ Automatically by using FIT feature and generic DISTRO bootcmd
398   -
399   - see examples in this directory :
400   -
401   - Generate FIT including kernel + device tree + M4 firmware
402   - with cfg with M4 boot
403   - $> mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb
404   -
405   - Then using DISTRO configuration file: see extlinux.conf to select
406   - the correct configuration
407   - => stm32mp157c-ev1-m4
408   - => stm32mp157c-dk2-m4
409   -
410   -11. DFU support
411   -===============
412   -
413   -The DFU is supported on ST board.
414   -The env variable dfu_alt_info is automatically build, and all
415   -the memory present on the ST boards are exported.
416   -
417   -The mode is started by
418   -
419   -STM32MP> dfu 0
420   -
421   -On EV1 board:
422   -
423   -STM32MP> dfu 0 list
424   -
425   -DFU alt settings list:
426   -dev: RAM alt: 0 name: uImage layout: RAM_ADDR
427   -dev: RAM alt: 1 name: devicetree.dtb layout: RAM_ADDR
428   -dev: RAM alt: 2 name: uramdisk.image.gz layout: RAM_ADDR
429   -dev: eMMC alt: 3 name: sdcard_fsbl1 layout: RAW_ADDR
430   -dev: eMMC alt: 4 name: sdcard_fsbl2 layout: RAW_ADDR
431   -dev: eMMC alt: 5 name: sdcard_ssbl layout: RAW_ADDR
432   -dev: eMMC alt: 6 name: sdcard_bootfs layout: RAW_ADDR
433   -dev: eMMC alt: 7 name: sdcard_vendorfs layout: RAW_ADDR
434   -dev: eMMC alt: 8 name: sdcard_rootfs layout: RAW_ADDR
435   -dev: eMMC alt: 9 name: sdcard_userfs layout: RAW_ADDR
436   -dev: eMMC alt: 10 name: emmc_fsbl1 layout: RAW_ADDR
437   -dev: eMMC alt: 11 name: emmc_fsbl2 layout: RAW_ADDR
438   -dev: eMMC alt: 12 name: emmc_ssbl layout: RAW_ADDR
439   -dev: eMMC alt: 13 name: emmc_bootfs layout: RAW_ADDR
440   -dev: eMMC alt: 14 name: emmc_vendorfs layout: RAW_ADDR
441   -dev: eMMC alt: 15 name: emmc_rootfs layout: RAW_ADDR
442   -dev: eMMC alt: 16 name: emmc_userfs layout: RAW_ADDR
443   -dev: MTD alt: 17 name: nor_fsbl1 layout: RAW_ADDR
444   -dev: MTD alt: 18 name: nor_fsbl2 layout: RAW_ADDR
445   -dev: MTD alt: 19 name: nor_ssbl layout: RAW_ADDR
446   -dev: MTD alt: 20 name: nor_env layout: RAW_ADDR
447   -dev: MTD alt: 21 name: nand_fsbl layout: RAW_ADDR
448   -dev: MTD alt: 22 name: nand_ssbl1 layout: RAW_ADDR
449   -dev: MTD alt: 23 name: nand_ssbl2 layout: RAW_ADDR
450   -dev: MTD alt: 24 name: nand_UBI layout: RAW_ADDR
451   -dev: VIRT alt: 25 name: OTP layout: RAW_ADDR
452   -dev: VIRT alt: 26 name: PMIC layout: RAW_ADDR
453   -
454   -All the supported device are exported for dfu-util tool:
455   -
456   -$> dfu-util -l
457   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=26, name="PMIC", serial="002700333338511934383330"
458   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=25, name="OTP", serial="002700333338511934383330"
459   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=24, name="nand_UBI", serial="002700333338511934383330"
460   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=23, name="nand_ssbl2", serial="002700333338511934383330"
461   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=22, name="nand_ssbl1", serial="002700333338511934383330"
462   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=21, name="nand_fsbl", serial="002700333338511934383330"
463   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=20, name="nor_env", serial="002700333338511934383330"
464   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=19, name="nor_ssbl", serial="002700333338511934383330"
465   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=18, name="nor_fsbl2", serial="002700333338511934383330"
466   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=17, name="nor_fsbl1", serial="002700333338511934383330"
467   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=16, name="emmc_userfs", serial="002700333338511934383330"
468   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=15, name="emmc_rootfs", serial="002700333338511934383330"
469   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=14, name="emmc_vendorfs", serial="002700333338511934383330"
470   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=13, name="emmc_bootfs", serial="002700333338511934383330"
471   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=12, name="emmc_ssbl", serial="002700333338511934383330"
472   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=11, name="emmc_fsbl2", serial="002700333338511934383330"
473   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=10, name="emmc_fsbl1", serial="002700333338511934383330"
474   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=9, name="sdcard_userfs", serial="002700333338511934383330"
475   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=8, name="sdcard_rootfs", serial="002700333338511934383330"
476   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=7, name="sdcard_vendorfs", serial="002700333338511934383330"
477   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=6, name="sdcard_bootfs", serial="002700333338511934383330"
478   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=5, name="sdcard_ssbl", serial="002700333338511934383330"
479   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=4, name="sdcard_fsbl2", serial="002700333338511934383330"
480   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=3, name="sdcard_fsbl1", serial="002700333338511934383330"
481   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=2, name="uramdisk.image.gz", serial="002700333338511934383330"
482   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=1, name="devicetree.dtb", serial="002700333338511934383330"
483   -Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=0, name="uImage", serial="002700333338511934383330"
484   -
485   -You can update the boot device:
486   -
487   -#SDCARD
488   -$> dfu-util -d 0483:5720 -a 3 -D tf-a-stm32mp157c-ev1-trusted.stm32
489   -$> dfu-util -d 0483:5720 -a 4 -D tf-a-stm32mp157c-ev1-trusted.stm32
490   -$> dfu-util -d 0483:5720 -a 5 -D u-boot-stm32mp157c-ev1-trusted.img
491   -$> dfu-util -d 0483:5720 -a 6 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4
492   -$> dfu-util -d 0483:5720 -a 7 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
493   -$> dfu-util -d 0483:5720 -a 8 -D st-image-weston-openstlinux-weston-stm32mp1.ext4
494   -$> dfu-util -d 0483:5720 -a 9 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4
495   -
496   -#EMMC
497   -$> dfu-util -d 0483:5720 -a 10 -D tf-a-stm32mp157c-ev1-trusted.stm32
498   -$> dfu-util -d 0483:5720 -a 11 -D tf-a-stm32mp157c-ev1-trusted.stm32
499   -$> dfu-util -d 0483:5720 -a 12 -D u-boot-stm32mp157c-ev1-trusted.img
500   -$> dfu-util -d 0483:5720 -a 13 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4
501   -$> dfu-util -d 0483:5720 -a 14 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
502   -$> dfu-util -d 0483:5720 -a 15 -D st-image-weston-openstlinux-weston-stm32mp1.ext4
503   -$> dfu-util -d 0483:5720 -a 16 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4
504   -
505   -#NOR
506   -$> dfu-util -d 0483:5720 -a 17 -D tf-a-stm32mp157c-ev1-trusted.stm32
507   -$> dfu-util -d 0483:5720 -a 18 -D tf-a-stm32mp157c-ev1-trusted.stm32
508   -$> dfu-util -d 0483:5720 -a 19 -D u-boot-stm32mp157c-ev1-trusted.img
509   -
510   -#NAND (UBI partition used for NAND only boot or NOR + NAND boot)
511   -$> dfu-util -d 0483:5720 -a 21 -D tf-a-stm32mp157c-ev1-trusted.stm32
512   -$> dfu-util -d 0483:5720 -a 22 -D u-boot-stm32mp157c-ev1-trusted.img
513   -$> dfu-util -d 0483:5720 -a 23 -D u-boot-stm32mp157c-ev1-trusted.img
514   -$> dfu-util -d 0483:5720 -a 24 -D st-image-weston-openstlinux-weston-stm32mp1_nand_4_256_multivolume.ubi
515   -
516   -And you can also dump the OTP and the PMIC NVM with:
517   -
518   -$> dfu-util -d 0483:5720 -a 25 -U otp.bin
519   -$> dfu-util -d 0483:5720 -a 26 -U pmic.bin
  1 +see doc/board/st/stm32mp1.rst
... ... @@ -16,5 +16,6 @@
16 16 renesas/index
17 17 rockchip/index
18 18 sifive/index
  19 + st/index
19 20 xilinx/index
doc/board/st/index.rst
  1 +.. SPDX-License-Identifier: GPL-2.0+
  2 +
  3 +STMicroelectronics
  4 +==================
  5 +
  6 +.. toctree::
  7 + :maxdepth: 2
  8 +
  9 + stm32mp1
doc/board/st/stm32mp1.rst
  1 +.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
  2 +.. sectionauthor:: Patrick Delaunay <patrick.delaunay@st.com>
  3 +
  4 +STM32MP15x boards
  5 +=================
  6 +
  7 +This is a quick instruction for setup STM32MP15x boards.
  8 +
  9 +Supported devices
  10 +-----------------
  11 +
  12 +U-Boot supports STMP32MP15x SoCs:
  13 +
  14 + - STM32MP157
  15 + - STM32MP153
  16 + - STM32MP151
  17 +
  18 +The STM32MP15x is a Cortex-A MPU aimed at various applications.
  19 +
  20 +It features:
  21 +
  22 + - Dual core Cortex-A7 application core (Single on STM32MP151)
  23 + - 2D/3D image composition with GPU (only on STM32MP157)
  24 + - Standard memories interface support
  25 + - Standard connectivity, widely inherited from the STM32 MCU family
  26 + - Comprehensive security support
  27 +
  28 +Everything is supported in Linux but U-Boot is limited to:
  29 +
  30 + 1. UART
  31 + 2. SD card/MMC controller (SDMMC)
  32 + 3. NAND controller (FMC)
  33 + 4. NOR controller (QSPI)
  34 + 5. USB controller (OTG DWC2)
  35 + 6. Ethernet controller
  36 +
  37 +And the necessary drivers
  38 +
  39 + 1. I2C
  40 + 2. STPMIC1 (PMIC and regulator)
  41 + 3. Clock, Reset, Sysreset
  42 + 4. Fuse
  43 +
  44 +Currently the following boards are supported:
  45 +
  46 + + stm32mp157a-avenger96.dts
  47 + + stm32mp157a-dk1.dts
  48 + + stm32mp157c-dk2.dts
  49 + + stm32mp157c-ed1.dts
  50 + + stm32mp157c-ev1.dts
  51 +
  52 +Boot Sequences
  53 +--------------
  54 +
  55 +3 boot configurations are supported with:
  56 +
  57 ++----------+------------------------+-------------------------+--------------+
  58 +| **ROM** | **FSBL** | **SSBL** | **OS** |
  59 ++ **code** +------------------------+-------------------------+--------------+
  60 +| | First Stage Bootloader | Second Stage Bootloader | Linux Kernel |
  61 ++ +------------------------+-------------------------+--------------+
  62 +| | embedded RAM | DDR |
  63 ++----------+------------------------+-------------------------+--------------+
  64 +
  65 +The **Trusted** boot chain
  66 +``````````````````````````
  67 +
  68 +defconfig_file : stm32mp15_trusted_defconfig
  69 +
  70 + +-------------+-------------------------+------------+-------+
  71 + | ROM code | FSBL | SSBL | OS |
  72 + + +-------------------------+------------+-------+
  73 + | |Trusted Firmware-A (TF-A)| U-Boot | Linux |
  74 + +-------------+-------------------------+------------+-------+
  75 + | TrustZone |TF-A secure monitor |
  76 + +-------------+-------------------------+------------+-------+
  77 +
  78 +TF-A performs a full initialization of Secure peripherals and installs a
  79 +secure monitor (BL32=SPMin).
  80 +
  81 +U-Boot is running in normal world and uses TF-A monitor to access
  82 +to secure resources.
  83 +
  84 +The **Trusted** boot chain with **OP-TEE**
  85 +``````````````````````````````````````````
  86 +
  87 +defconfig_file : stm32mp15_optee_defconfig
  88 +
  89 + +-------------+-------------------------+------------+-------+
  90 + | ROM code | FSBL | SSBL | OS |
  91 + + +-------------------------+------------+-------+
  92 + | |Trusted Firmware-A (TF-A)| U-Boot | Linux |
  93 + +-------------+-------------------------+------------+-------+
  94 + | TrustZone |OP-TEE |
  95 + +-------------+-------------------------+------------+-------+
  96 +
  97 +TF-A performs a full initialization of Secure peripherals and installs OP-TEE
  98 +from specific partitions (teeh, teed, teex).
  99 +
  100 +U-Boot is running in normal world and uses OP-TEE monitor to access
  101 +to secure resources.
  102 +
  103 +The **Basic** boot chain
  104 +````````````````````````
  105 +
  106 +defconfig_file : stm32mp15_basic_defconfig
  107 +
  108 + +-------------+------------+------------+-------+
  109 + | ROM code | FSBL | SSBL | OS |
  110 + + +------------+------------+-------+
  111 + | |U-Boot SPL | U-Boot | Linux |
  112 + +-------------+------------+------------+-------+
  113 + | TrustZone | | PSCI from U-Boot |
  114 + +-------------+------------+------------+-------+
  115 +
  116 +SPL has limited security initialization
  117 +
  118 +U-Boot is running in secure mode and provide a secure monitor to the kernel
  119 +with only PSCI support (Power State Coordination Interface defined by ARM).
  120 +
  121 +All the STM32MP15x boards supported by U-Boot use the same generic board
  122 +stm32mp1 which support all the bootable devices.
  123 +
  124 +Each board is configured only with the associated device tree.
  125 +
  126 +Device Tree Selection
  127 +---------------------
  128 +
  129 +You need to select the appropriate device tree for your board,
  130 +the supported device trees for STM32MP15x are:
  131 +
  132 ++ ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1)
  133 +
  134 + + stm32mp157c-ev1
  135 +
  136 ++ ed1: daughter board with pmic stpmic1
  137 +
  138 + + stm32mp157c-ed1
  139 +
  140 ++ dk1: Discovery board
  141 +
  142 + + stm32mp157a-dk1
  143 +
  144 ++ dk2: Discovery board = dk1 with a BT/WiFI combo and a DSI panel
  145 +
  146 + + stm32mp157c-dk2
  147 +
  148 ++ avenger96: Avenger96 board from Arrow Electronics
  149 +
  150 + + stm32mp157a-avenger96
  151 +
  152 +Build Procedure
  153 +---------------
  154 +
  155 +1. Install the required tools for U-Boot
  156 +
  157 + * install package needed in U-Boot makefile
  158 + (libssl-dev, swig, libpython-dev...)
  159 +
  160 + * install ARMv7 toolchain for 32bit Cortex-A (from Linaro,
  161 + from SDK for STM32MP15x, or any crosstoolchains from your distribution)
  162 + (you can use any gcc cross compiler compatible with U-Boot)
  163 +
  164 +2. Set the cross compiler::
  165 +
  166 + # export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi-
  167 +
  168 +3. Select the output directory (optional)::
  169 +
  170 + # export KBUILD_OUTPUT=/path/to/output
  171 +
  172 + for example: use one output directory for each configuration::
  173 +
  174 + # export KBUILD_OUTPUT=stm32mp15_trusted
  175 + # export KBUILD_OUTPUT=stm32mp15_optee
  176 + # export KBUILD_OUTPUT=stm32mp15_basic
  177 +
  178 + you can build outside of code directory::
  179 +
  180 + # export KBUILD_OUTPUT=../build/stm32mp15_trusted
  181 +
  182 +4. Configure U-Boot::
  183 +
  184 + # make <defconfig_file>
  185 +
  186 + with <defconfig_file>:
  187 +
  188 + - For **trusted** boot mode : **stm32mp15_trusted_defconfig**
  189 + - For **trusted** with OP-TEE boot mode : **stm32mp15_optee_defconfig**
  190 + - For basic boot mode: stm32mp15_basic_defconfig
  191 +
  192 +5. Configure the device-tree and build the U-Boot image::
  193 +
  194 + # make DEVICE_TREE=<name> all
  195 +
  196 + Examples:
  197 +
  198 + a) trusted boot on ev1::
  199 +
  200 + # export KBUILD_OUTPUT=stm32mp15_trusted
  201 + # make stm32mp15_trusted_defconfig
  202 + # make DEVICE_TREE=stm32mp157c-ev1 all
  203 +
  204 + b) trusted with OP-TEE boot on dk2::
  205 +
  206 + # export KBUILD_OUTPUT=stm32mp15_optee
  207 + # make stm32mp15_optee_defconfig
  208 + # make DEVICE_TREE=stm32mp157c-dk2 all
  209 +
  210 + c) basic boot on ev1::
  211 +
  212 + # export KBUILD_OUTPUT=stm32mp15_basic
  213 + # make stm32mp15_basic_defconfig
  214 + # make DEVICE_TREE=stm32mp157c-ev1 all
  215 +
  216 + d) basic boot on ed1::
  217 +
  218 + # export KBUILD_OUTPUT=stm32mp15_basic
  219 + # make stm32mp15_basic_defconfig
  220 + # make DEVICE_TREE=stm32mp157c-ed1 all
  221 +
  222 + e) basic boot on dk1::
  223 +
  224 + # export KBUILD_OUTPUT=stm32mp15_basic
  225 + # make stm32mp15_basic_defconfig
  226 + # make DEVICE_TREE=stm32mp157a-dk1 all
  227 +
  228 + f) basic boot on avenger96::
  229 +
  230 + # export KBUILD_OUTPUT=stm32mp15_basic
  231 + # make stm32mp15_basic_defconfig
  232 + # make DEVICE_TREE=stm32mp157a-avenger96 all
  233 +
  234 +6. Output files
  235 +
  236 + BootRom and TF-A expect binaries with STM32 image header
  237 + SPL expects file with U-Boot uImage header
  238 +
  239 + So in the output directory (selected by KBUILD_OUTPUT),
  240 + you can found the needed files:
  241 +
  242 + - For **Trusted** boot (with or without OP-TEE)
  243 +
  244 + - FSBL = **tf-a.stm32** (provided by TF-A compilation)
  245 + - SSBL = **u-boot.stm32**
  246 +
  247 + - For Basic boot
  248 +
  249 + - FSBL = spl/u-boot-spl.stm32
  250 + - SSBL = u-boot.img
  251 +
  252 +Switch Setting for Boot Mode
  253 +----------------------------
  254 +
  255 +You can select the boot mode, on the board with one switch, to select
  256 +the boot pin values = BOOT0, BOOT1, BOOT2
  257 +
  258 + +-------------+---------+---------+---------+
  259 + |*Boot Mode* | *BOOT2* | *BOOT1* | *BOOT0* |
  260 + +=============+=========+=========+=========+
  261 + | Recovery | 0 | 0 | 0 |
  262 + +-------------+---------+---------+---------+
  263 + | NOR | 0 | 0 | 1 |
  264 + +-------------+---------+---------+---------+
  265 + | eMMC | 0 | 1 | 0 |
  266 + +-------------+---------+---------+---------+
  267 + | NAND | 0 | 1 | 1 |
  268 + +-------------+---------+---------+---------+
  269 + | Reserved | 1 | 0 | 0 |
  270 + +-------------+---------+---------+---------+
  271 + | SD-Card | 1 | 0 | 1 |
  272 + +-------------+---------+---------+---------+
  273 + | Recovery | 1 | 1 | 0 |
  274 + +-------------+---------+---------+---------+
  275 + | SPI-NAND | 1 | 1 | 1 |
  276 + +-------------+---------+---------+---------+
  277 +
  278 +- on the **daugther board ed1 = MB1263** with the switch SW1
  279 +- on **Avenger96** with switch S3 (NOR and SPI-NAND are not applicable)
  280 +- on board **DK1/DK2** with the switch SW1 = BOOT0, BOOT2
  281 + with only 2 pins available (BOOT1 is forced to 0 and NOR not supported),
  282 + the possible value becomes:
  283 +
  284 + +-------------+---------+---------+
  285 + |*Boot Mode* | *BOOT2* | *BOOT0* |
  286 + +=============+=========+=========+
  287 + | Recovery | 0 | 0 |
  288 + +-------------+---------+---------+
  289 + | NOR (NA)| 0 | 1 |
  290 + +-------------+---------+---------+
  291 + | Reserved | 1 | 0 |
  292 + +-------------+---------+---------+
  293 + | SD-Card | 1 | 1 |
  294 + +-------------+---------+---------+
  295 +
  296 +Recovery is a boot from serial link (UART/USB) and it is used with
  297 +STM32CubeProgrammer tool to load executable in RAM and to update the flash
  298 +devices available on the board (NOR/NAND/eMMC/SD card).
  299 +
  300 +The communication between HOST and board is based on
  301 +
  302 + - for UARTs : the uart protocol used with all MCU STM32
  303 + - for USB : based on USB DFU 1.1 (without the ST extensions used on MCU STM32)
  304 +
  305 +Prepare an SD card
  306 +------------------
  307 +
  308 +The minimal requirements for STMP32MP15x boot up to U-Boot are:
  309 +
  310 +- GPT partitioning (with gdisk or with sgdisk)
  311 +- 2 fsbl partitions, named fsbl1 and fsbl2, size at least 256KiB
  312 +- one ssbl partition for U-Boot
  313 +
  314 +Then the minimal GPT partition is:
  315 +
  316 + +-------+--------+---------+-------------+
  317 + | *Num* | *Name* | *Size* | *Content* |
  318 + +=======+========+=========+=============+
  319 + | 1 | fsbl1 | 256 KiB | TF-A or SPL |
  320 + +-------+--------+---------+-------------+
  321 + | 2 | fsbl2 | 256 KiB | TF-A or SPL |
  322 + +-------+--------+---------+-------------+
  323 + | 3 | ssbl | enought | U-Boot |
  324 + +-------+--------+---------+-------------+
  325 + | 4 | <any> | <any> | Rootfs |
  326 + +-------+--------+---------+-------------+
  327 +
  328 +Add a 4th partition (Rootfs) marked bootable with a file extlinux.conf
  329 +following the Generic Distribution feature (doc/README.distro for use).
  330 +
  331 +According the used card reader select the correct block device
  332 +(for example /dev/sdx or /dev/mmcblk0).
  333 +
  334 +In the next example, it is /dev/mmcblk0
  335 +
  336 +For example: with gpt table with 128 entries
  337 +
  338 +a) remove previous formatting::
  339 +
  340 + # sgdisk -o /dev/<SD card dev>
  341 +
  342 +b) create minimal image::
  343 +
  344 + # sgdisk --resize-table=128 -a 1 \
  345 + -n 1:34:545 -c 1:fsbl1 \
  346 + -n 2:546:1057 -c 2:fsbl2 \
  347 + -n 3:1058:5153 -c 3:ssbl \
  348 + -n 4:5154: -c 4:rootfs \
  349 + -p /dev/<SD card dev>
  350 +
  351 + With other partition for kernel one partition rootfs for kernel.
  352 +
  353 +c) copy the FSBL (2 times) and SSBL file on the correct partition.
  354 + in this example in partition 1 to 3
  355 +
  356 + for basic boot mode : <SD card dev> = /dev/mmcblk0::
  357 +
  358 + # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1
  359 + # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2
  360 + # dd if=u-boot.img of=/dev/mmcblk0p3
  361 +
  362 + for trusted boot mode: ::
  363 +
  364 + # dd if=tf-a.stm32 of=/dev/mmcblk0p1
  365 + # dd if=tf-a.stm32 of=/dev/mmcblk0p2
  366 + # dd if=u-boot.stm32 of=/dev/mmcblk0p3
  367 +
  368 +To boot from SD card, select BootPinMode = 1 0 1 and reset.
  369 +
  370 +Prepare eMMC
  371 +------------
  372 +
  373 +You can use U-Boot to copy binary in eMMC.
  374 +
  375 +In the next example, you need to boot from SD card and the images
  376 +(u-boot-spl.stm32, u-boot.img) are presents on SD card (mmc 0)
  377 +in ext4 partition 4 (bootfs).
  378 +
  379 +To boot from SD card, select BootPinMode = 1 0 1 and reset.
  380 +
  381 +Then you update the eMMC with the next U-Boot command :
  382 +
  383 +a) prepare GPT on eMMC,
  384 + example with 2 partitions, bootfs and roots::
  385 +
  386 + # setenv emmc_part "name=ssbl,size=2MiB;name=bootfs,type=linux,bootable,size=64MiB;name=rootfs,type=linux,size=512"
  387 + # gpt write mmc 1 ${emmc_part}
  388 +
  389 +b) copy SPL on eMMC on firts boot partition
  390 + (SPL max size is 256kB, with LBA 512, 0x200)::
  391 +
  392 + # ext4load mmc 0:4 0xC0000000 u-boot-spl.stm32
  393 + # mmc dev 1
  394 + # mmc partconf 1 1 1 1
  395 + # mmc write ${fileaddr} 0 200
  396 + # mmc partconf 1 1 1 0
  397 +
  398 +c) copy U-Boot in first GPT partition of eMMC::
  399 +
  400 + # ext4load mmc 0:4 0xC0000000 u-boo t.img
  401 + # mmc dev 1
  402 + # part start mmc 1 1 partstart
  403 + # mmc write ${fileaddr} ${partstart} ${filesize}
  404 +
  405 +To boot from eMMC, select BootPinMode = 0 1 0 and reset.
  406 +
  407 +MAC Address
  408 +-----------
  409 +
  410 +Please read doc/README.enetaddr for the implementation guidelines for mac id
  411 +usage. Basically, environment has precedence over board specific storage.
  412 +
  413 +For STMicroelectonics board, it is retrieved in STM32MP15x OTP :
  414 +
  415 + - OTP_57[31:0] = MAC_ADDR[31:0]
  416 + - OTP_58[15:0] = MAC_ADDR[47:32]
  417 +
  418 +To program a MAC address on virgin OTP words above, you can use the fuse command
  419 +on bank 0 to access to internal OTP:
  420 +
  421 +Prerequisite: check if a MAC address isn't yet programmed in OTP
  422 +
  423 +1) check OTP: their value must be equal to 0
  424 +
  425 + STM32MP> fuse sense 0 57 2
  426 + Sensing bank 0:
  427 + Word 0x00000039: 00000000 00000000
  428 +
  429 +2) check environment variable
  430 +
  431 + STM32MP> env print ethaddr
  432 + ## Error: "ethaddr" not defined
  433 +
  434 +Example to set mac address "12:34:56:78:9a:bc"
  435 +
  436 +1) Write OTP::
  437 +
  438 + STM32MP> fuse prog -y 0 57 0x78563412 0x0000bc9a
  439 +
  440 +2) Read OTP::
  441 +
  442 + STM32MP> fuse sense 0 57 2
  443 + Sensing bank 0:
  444 + Word 0x00000039: 78563412 0000bc9a
  445 +
  446 +3) next REBOOT, in the trace::
  447 +
  448 + ### Setting environment from OTP MAC address = "12:34:56:78:9a:bc"
  449 +
  450 +4) check env update::
  451 +
  452 + STM32MP> env print ethaddr
  453 + ethaddr=12:34:56:78:9a:bc
  454 +
  455 +.. warning:: This command can't be executed twice on the same board as
  456 + OTP are protected. It is already done for the board
  457 + provided by STMicroelectronics.
  458 +
  459 +Coprocessor firmware
  460 +--------------------
  461 +
  462 +U-Boot can boot the coprocessor before the kernel (coprocessor early boot).
  463 +
  464 +a) Manuallly by using rproc commands (update the bootcmd)
  465 +
  466 + Configurations::
  467 +
  468 + # env set name_copro "rproc-m4-fw.elf"
  469 + # env set dev_copro 0
  470 + # env set loadaddr_copro 0xC1000000
  471 +
  472 + Load binary from bootfs partition (number 4) on SD card (mmc 0)::
  473 +
  474 + # ext4load mmc 0:4 ${loadaddr_copro} ${name_copro}
  475 +
  476 + => ${filesize} variable is updated with the size of the loaded file.
  477 +
  478 + Start M4 firmware with remote proc command::
  479 +
  480 + # rproc init
  481 + # rproc load ${dev_copro} ${loadaddr_copro} ${filesize}
  482 + # rproc start ${dev_copro}"00270033
  483 +
  484 +b) Automatically by using FIT feature and generic DISTRO bootcmd
  485 +
  486 + see examples in the board stm32mp1 directory: fit_copro_kernel_dtb.its
  487 +
  488 + Generate FIT including kernel + device tree + M4 firmware with cfg with M4 boot::
  489 +
  490 + $> mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb
  491 +
  492 + Then using DISTRO configuration file: see extlinux.conf to select the correct
  493 + configuration:
  494 +
  495 + - stm32mp157c-ev1-m4
  496 + - stm32mp157c-dk2-m4
  497 +
  498 +DFU support
  499 +-----------
  500 +
  501 +The DFU is supported on ST board.
  502 +
  503 +The env variable dfu_alt_info is automatically build, and all
  504 +the memory present on the ST boards are exported.
  505 +
  506 +The dfu mode is started by the command::
  507 +
  508 + STM32MP> dfu 0
  509 +
  510 +On EV1 board, booting from SD card, without OP-TEE::
  511 +
  512 + STM32MP> dfu 0 list
  513 + DFU alt settings list:
  514 + dev: RAM alt: 0 name: uImage layout: RAM_ADDR
  515 + dev: RAM alt: 1 name: devicetree.dtb layout: RAM_ADDR
  516 + dev: RAM alt: 2 name: uramdisk.image.gz layout: RAM_ADDR
  517 + dev: eMMC alt: 3 name: sdcard_fsbl1 layout: RAW_ADDR
  518 + dev: eMMC alt: 4 name: sdcard_fsbl2 layout: RAW_ADDR
  519 + dev: eMMC alt: 5 name: sdcard_ssbl layout: RAW_ADDR
  520 + dev: eMMC alt: 6 name: sdcard_bootfs layout: RAW_ADDR
  521 + dev: eMMC alt: 7 name: sdcard_vendorfs layout: RAW_ADDR
  522 + dev: eMMC alt: 8 name: sdcard_rootfs layout: RAW_ADDR
  523 + dev: eMMC alt: 9 name: sdcard_userfs layout: RAW_ADDR
  524 + dev: eMMC alt: 10 name: emmc_fsbl1 layout: RAW_ADDR
  525 + dev: eMMC alt: 11 name: emmc_fsbl2 layout: RAW_ADDR
  526 + dev: eMMC alt: 12 name: emmc_ssbl layout: RAW_ADDR
  527 + dev: eMMC alt: 13 name: emmc_bootfs layout: RAW_ADDR
  528 + dev: eMMC alt: 14 name: emmc_vendorfs layout: RAW_ADDR
  529 + dev: eMMC alt: 15 name: emmc_rootfs layout: RAW_ADDR
  530 + dev: eMMC alt: 16 name: emmc_userfs layout: RAW_ADDR
  531 + dev: MTD alt: 17 name: nor_fsbl1 layout: RAW_ADDR
  532 + dev: MTD alt: 18 name: nor_fsbl2 layout: RAW_ADDR
  533 + dev: MTD alt: 19 name: nor_ssbl layout: RAW_ADDR
  534 + dev: MTD alt: 20 name: nor_env layout: RAW_ADDR
  535 + dev: MTD alt: 21 name: nand_fsbl layout: RAW_ADDR
  536 + dev: MTD alt: 22 name: nand_ssbl1 layout: RAW_ADDR
  537 + dev: MTD alt: 23 name: nand_ssbl2 layout: RAW_ADDR
  538 + dev: MTD alt: 24 name: nand_UBI layout: RAW_ADDR
  539 + dev: VIRT alt: 25 name: OTP layout: RAW_ADDR
  540 + dev: VIRT alt: 26 name: PMIC layout: RAW_ADDR
  541 +
  542 +All the supported device are exported for dfu-util tool::
  543 +
  544 + $> dfu-util -l
  545 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=26, name="PMIC", serial="002700333338511934383330"
  546 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=25, name="OTP", serial="002700333338511934383330"
  547 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=24, name="nand_UBI", serial="002700333338511934383330"
  548 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=23, name="nand_ssbl2", serial="002700333338511934383330"
  549 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=22, name="nand_ssbl1", serial="002700333338511934383330"
  550 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=21, name="nand_fsbl", serial="002700333338511934383330"
  551 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=20, name="nor_env", serial="002700333338511934383330"
  552 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=19, name="nor_ssbl", serial="002700333338511934383330"
  553 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=18, name="nor_fsbl2", serial="002700333338511934383330"
  554 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=17, name="nor_fsbl1", serial="002700333338511934383330"
  555 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=16, name="emmc_userfs", serial="002700333338511934383330"
  556 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=15, name="emmc_rootfs", serial="002700333338511934383330"
  557 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=14, name="emmc_vendorfs", serial="002700333338511934383330"
  558 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=13, name="emmc_bootfs", serial="002700333338511934383330"
  559 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=12, name="emmc_ssbl", serial="002700333338511934383330"
  560 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=11, name="emmc_fsbl2", serial="002700333338511934383330"
  561 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=10, name="emmc_fsbl1", serial="002700333338511934383330"
  562 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=9, name="sdcard_userfs", serial="002700333338511934383330"
  563 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=8, name="sdcard_rootfs", serial="002700333338511934383330"
  564 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=7, name="sdcard_vendorfs", serial="002700333338511934383330"
  565 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=6, name="sdcard_bootfs", serial="002700333338511934383330"
  566 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=5, name="sdcard_ssbl", serial="002700333338511934383330"
  567 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=4, name="sdcard_fsbl2", serial="002700333338511934383330"
  568 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=3, name="sdcard_fsbl1", serial="002700333338511934383330"
  569 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=2, name="uramdisk.image.gz", serial="002700333338511934383330"
  570 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=1, name="devicetree.dtb", serial="002700333338511934383330"
  571 + Found DFU: [0483:5720] ver=9999, devnum=99, cfg=1, intf=0, alt=0, name="uImage", serial="002700333338511934383330"
  572 +
  573 +You can update the boot device:
  574 +
  575 +- SD card (mmc0) ::
  576 +
  577 + $> dfu-util -d 0483:5720 -a 3 -D tf-a-stm32mp157c-ev1-trusted.stm32
  578 + $> dfu-util -d 0483:5720 -a 4 -D tf-a-stm32mp157c-ev1-trusted.stm32
  579 + $> dfu-util -d 0483:5720 -a 5 -D u-boot-stm32mp157c-ev1-trusted.img
  580 + $> dfu-util -d 0483:5720 -a 6 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4
  581 + $> dfu-util -d 0483:5720 -a 7 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
  582 + $> dfu-util -d 0483:5720 -a 8 -D st-image-weston-openstlinux-weston-stm32mp1.ext4
  583 + $> dfu-util -d 0483:5720 -a 9 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4
  584 +
  585 +- EMMC (mmc1)::
  586 +
  587 + $> dfu-util -d 0483:5720 -a 10 -D tf-a-stm32mp157c-ev1-trusted.stm32
  588 + $> dfu-util -d 0483:5720 -a 11 -D tf-a-stm32mp157c-ev1-trusted.stm32
  589 + $> dfu-util -d 0483:5720 -a 12 -D u-boot-stm32mp157c-ev1-trusted.img
  590 + $> dfu-util -d 0483:5720 -a 13 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4
  591 + $> dfu-util -d 0483:5720 -a 14 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
  592 + $> dfu-util -d 0483:5720 -a 15 -D st-image-weston-openstlinux-weston-stm32mp1.ext4
  593 + $> dfu-util -d 0483:5720 -a 16 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4
  594 +
  595 +- NOR::
  596 +
  597 + $> dfu-util -d 0483:5720 -a 17 -D tf-a-stm32mp157c-ev1-trusted.stm32
  598 + $> dfu-util -d 0483:5720 -a 18 -D tf-a-stm32mp157c-ev1-trusted.stm32
  599 + $> dfu-util -d 0483:5720 -a 19 -D u-boot-stm32mp157c-ev1-trusted.img
  600 +
  601 +- NAND (UBI partition used for NAND only boot or NOR + NAND boot)::
  602 +
  603 + $> dfu-util -d 0483:5720 -a 21 -D tf-a-stm32mp157c-ev1-trusted.stm32
  604 + $> dfu-util -d 0483:5720 -a 22 -D u-boot-stm32mp157c-ev1-trusted.img
  605 + $> dfu-util -d 0483:5720 -a 23 -D u-boot-stm32mp157c-ev1-trusted.img
  606 + $> dfu-util -d 0483:5720 -a 24 -D st-image-weston-openstlinux-weston-stm32mp1_nand_4_256_multivolume.ubi
  607 +
  608 +- you can also dump the OTP and the PMIC NVM with::
  609 +
  610 + $> dfu-util -d 0483:5720 -a 25 -U otp.bin
  611 + $> dfu-util -d 0483:5720 -a 26 -U pmic.bin
drivers/rng/stm32mp1_rng.c
... ... @@ -33,7 +33,7 @@
33 33  
34 34 static int stm32_rng_read(struct udevice *dev, void *data, size_t len)
35 35 {
36   - int retval = 0, i;
  36 + int retval, i;
37 37 u32 sr, count, reg;
38 38 size_t increment;
39 39 struct stm32_rng_platdata *pdata = dev_get_platdata(dev);