From 27c7a62986b3dd6d44351271d2c0cf59664ce759 Mon Sep 17 00:00:00 2001 From: Chanho Park Date: Fri, 18 Aug 2023 14:11:02 +0900 Subject: [PATCH 01/54] dm: event: add EVT_DM_POST_INIT_R event type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch introduces EVT_DM_POST_INIT_R event type for handling hooks after relocation. Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation") Suggested-by: Simon Glass Cc: Bin Meng Signed-off-by: Chanho Park Tested-by: Milan P. Stanić Reviewed-by: Simon Glass Tested-by: Roland Ruckerbauer Tested-by: Roland Ruckerbauer Fixed missing event name in event.c: Signed-off-by: Simon Glass --- common/event.c | 1 + drivers/core/root.c | 6 ++++-- include/event.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/event.c b/common/event.c index 3224e281222..6653300e6cf 100644 --- a/common/event.c +++ b/common/event.c @@ -28,6 +28,7 @@ const char *const type_name[] = { /* Events related to driver model */ "dm_post_init_f", + "dm_post_init_r", "dm_pre_probe", "dm_post_probe", "dm_pre_remove", diff --git a/drivers/core/root.c b/drivers/core/root.c index 6775fb0b657..79d871ab291 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only) return ret; } } - if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) { - ret = event_notify_null(EVT_DM_POST_INIT_F); + if (CONFIG_IS_ENABLED(DM_EVENT)) { + ret = event_notify_null(gd->flags & GD_FLG_RELOC ? + EVT_DM_POST_INIT_R : + EVT_DM_POST_INIT_F); if (ret) return log_msg_ret("ev", ret); } diff --git a/include/event.h b/include/event.h index daf44bf8a83..bb38ba98e73 100644 --- a/include/event.h +++ b/include/event.h @@ -24,6 +24,7 @@ enum event_t { /* Events related to driver model */ EVT_DM_POST_INIT_F, + EVT_DM_POST_INIT_R, EVT_DM_PRE_PROBE, EVT_DM_POST_PROBE, EVT_DM_PRE_REMOVE, From 1c55d62fb9ccc107cb4fefa9bb04cb16395ca84c Mon Sep 17 00:00:00 2001 From: Chanho Park Date: Fri, 18 Aug 2023 14:11:03 +0900 Subject: [PATCH 02/54] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the Patch 55171aedda88, VisionFive2 booting has been broken [1]. VisionFive2 board requires to enable CONFIG_TIMER_EARLY but booting went to panic from initr_dm_devices due to lack of a timer device. - Error logs initcall sequence 00000000fffd8d38 failed at call 00000000402185e4 (err=-19) Thus, we need to move riscv_cpu_probe function in order to register the timer earlier than initr_dm_devices. Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") Cc: Simon Glass Cc: Bin Meng Signed-off-by: Chanho Park Tested-by: Milan P. Stanić Tested-by: Roland Ruckerbauer Tested-by: Roland Ruckerbauer --- arch/riscv/cpu/cpu.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index ecfb1fb08c4..0b4208e7219 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -66,7 +66,7 @@ static inline bool supports_extension(char ext) #endif /* CONFIG_CPU */ } -static int riscv_cpu_probe(void) +static int riscv_cpu_probe(void *ctx, struct event *event) { #ifdef CONFIG_CPU int ret; @@ -79,6 +79,7 @@ static int riscv_cpu_probe(void) return 0; } +EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe); /* * This is called on secondary harts just after the IPI is init'd. Currently @@ -95,7 +96,7 @@ int riscv_cpu_setup(void *ctx, struct event *event) { int ret; - ret = riscv_cpu_probe(); + ret = riscv_cpu_probe(ctx, event); if (ret) return ret; @@ -149,12 +150,6 @@ EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup); int arch_early_init_r(void) { - int ret; - - ret = riscv_cpu_probe(); - if (ret) - return ret; - if (IS_ENABLED(CONFIG_SYSRESET_SBI)) device_bind_driver(gd->dm_root, "sbi-sysreset", "sbi-sysreset", NULL); From 175e4b01beed25dedbd17a082786ec2e6739f1b3 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 22 Aug 2023 12:21:13 +0200 Subject: [PATCH 03/54] cmd: setexpr: fix printf_str() If vsnprintf() returns a negative number, (i >= remaining) will possibly be true: 'i' is of type signed int and 'remaining' is of the unsigned type size_t. The C language will convert i to an unsigned type before the comparison. This can result in the wrong error type being indicated. Checking for negative i should be done first. Fixes: f4f8d8bb1abc ("cmd: setexpr: add format string handling") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- cmd/printf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/printf.c b/cmd/printf.c index e0246767431..0c6887e0d6e 100644 --- a/cmd/printf.c +++ b/cmd/printf.c @@ -144,10 +144,10 @@ static void printf_str(struct print_inf *inf, char *format, ...) i = vsnprintf(inf->str + inf->offset, remaining, format, args); va_end(args); - if (i >= remaining) - inf->error |= PRINT_TRUNCATED_ERROR; - else if (i < 0) + if (i < 0) inf->error |= PRINT_CONVERSION_ERROR; + else if ((unsigned int)i >= remaining) + inf->error |= PRINT_TRUNCATED_ERROR; else inf->offset += i; } From 7f62928a8919eb19543ec72ca7c824ae71347666 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 22 Aug 2023 11:40:55 -0500 Subject: [PATCH 04/54] doc: board: ti: k3: image alt texts Provide alternative texts for images. Fixes: 6e8fa0611f19 ("board: ti: k3: Convert boot flow ascii flow to svg") Signed-off-by: Heinrich Schuchardt Signed-off-by: Nishanth Menon --- doc/board/ti/k3.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index f4576c54cb3..5be8fa23007 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -47,6 +47,7 @@ including a 32bit U-Boot SPL, (called the wakup SPL) that ROM will jump to after it has finished loading everything into internal SRAM. .. image:: img/boot_flow_01.svg + :alt: Boot flow up to wakeup domain SPL The wakeup SPL, running on a wakeup domain core, will initialize DDR and any peripherals needed load the larger binaries inside the `tispl.bin` @@ -56,6 +57,7 @@ starting with Trusted Firmware-A (TF-A), before moving on to start OP-TEE and the main domain's U-Boot SPL. .. image:: img/boot_flow_02.svg + :alt: Boot flow up to main domain SPL The main domain's SPL, running on a 64bit application core, has virtually unlimited space (billions of bytes now that DDR is working) to @@ -64,6 +66,7 @@ which loads more firmware into the micro-controller & wakeup domains and finally prepare the main domain to run Linux. .. image:: img/boot_flow_03.svg + :alt: Complete boot flow up to Linux This is the typical boot flow for all K3 based SoCs, however this flow offers quite a lot in the terms of flexibility, especially on High From c6df52892ebf5bcb67424c8457676ab796ab53bf Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 22 Aug 2023 11:40:56 -0500 Subject: [PATCH 05/54] doc: board: ti: k3: Fixup alt text for openocd sequence Fix up OpenOCD setup sequence Fixes: effe50854a69 ("doc: board: ti: k3: Add a guide to debugging with OpenOCD") Reported-by: Heinrich Schuchardt Signed-off-by: Nishanth Menon --- doc/board/ti/k3.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index 5be8fa23007..445c0f5e159 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -488,6 +488,7 @@ generation device. The overall structure of this setup is in the following figure. .. image:: img/openocd-overview.svg + :alt: Overview of OpenOCD setup. .. note:: From f5a578e77e3598a830483f539e5ddd03b2e08eea Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 22 Aug 2023 11:40:57 -0500 Subject: [PATCH 06/54] doc: board: ti: am62x: provide image alt texts Provide alternative texts for images. Fixes: 34f76921d801 ("doc: board: ti: am62x: Convert the image format to svg") Signed-off-by: Heinrich Schuchardt Signed-off-by: Nishanth Menon --- doc/board/ti/am62x_sk.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index 5ed17c0a3a5..42b37f9c76f 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -47,6 +47,7 @@ Boot Flow: Below is the pictorial representation of boot flow: .. image:: img/boot_diagram_k3_current.svg + :alt: Boot flow diagram - Here TIFS acts as master and provides all the critical services. R5/A53 requests TIFS to get these services done as shown in the above diagram. @@ -141,10 +142,12 @@ Image formats: - tiboot3.bin .. image:: img/multi_cert_tiboot3.bin.svg + :alt: tiboot3.bin image format - tispl.bin .. image:: img/dm_tispl.bin.svg + :alt: tispl.bin image format A53 SPL DDR Memory Layout ------------------------- From dfd299a6964145877e5dbaed9486c5dab31d1510 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 22 Aug 2023 11:40:59 -0500 Subject: [PATCH 07/54] doc: board: ti: am65x: provide image alt text Provide alternative text for image. Fixes: fd358121bdb8 ("doc: board: ti: am65x: Update with boot flow diagram") Signed-off-by: Heinrich Schuchardt Signed-off-by: Nishanth Menon --- doc/board/ti/am65x_evm.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 5f3c46cf9f9..10e30f45cfd 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -46,6 +46,7 @@ applications. This should happen before running Linux. instead use Falcon boot flow to reduce boot time. .. image:: img/boot_diagram_am65.svg + :alt: Boot flow diagram - Here DMSC acts as master and provides all the critical services. R5/A53 requests DMSC to get these services done as shown in the above diagram. @@ -136,14 +137,17 @@ Image formats: - tiboot3.bin .. image:: img/no_multi_cert_tiboot3.bin.svg + :alt: tiboot3.bin image format - tispl.bin .. image:: img/nodm_tispl.bin.svg + :alt: tispl.bin image format - sysfw.itb .. image:: img/sysfw.itb.svg + :alt: sysfw.itb image format eMMC: ----- @@ -185,6 +189,7 @@ used: eMMC layout: .. image:: img/emmc_am65x_evm_boot0.svg + :alt: emmc boot partition layout Kernel image and DT are expected to be present in the /boot folder of rootfs. To boot kernel from eMMC, use the following commands: @@ -220,6 +225,7 @@ addresses. Flash layout for OSPI: .. image:: img/ospi_sysfw.svg + :alt: OSPI flash partition layout Kernel Image and DT are expected to be present in the /boot folder of UBIFS ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named From 49509dfec83d24a45af11a5e451fd2cbb03659ad Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 22 Aug 2023 11:41:00 -0500 Subject: [PATCH 08/54] doc: board: ti: j7200: provide image alt text Provide alternative text for image. Fixes: f4ade09a1e76 ("doc: board: ti: j7200: Convert the image format to svg") Reported-by: Heinrich Schuchardt Signed-off-by: Nishanth Menon --- doc/board/ti/j7200_evm.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/board/ti/j7200_evm.rst b/doc/board/ti/j7200_evm.rst index 2e60e22ba15..2bf680cda2c 100644 --- a/doc/board/ti/j7200_evm.rst +++ b/doc/board/ti/j7200_evm.rst @@ -35,6 +35,7 @@ Boot Flow: Below is the pictorial representation of boot flow: .. image:: img/boot_diagram_k3_current.svg + :alt: Boot flow diagram - Here DMSC acts as master and provides all the critical services. R5/A72 requests DMSC to get these services done as shown in the above diagram. @@ -130,12 +131,12 @@ Image formats: - tiboot3.bin .. image:: img/j7200_tiboot3.bin.svg + :alt: tiboot3.bin image format - tispl.bin .. image:: img/dm_tispl.bin.svg - - + :alt: tispl.bin image format Switch Setting for Boot Mode ---------------------------- @@ -191,6 +192,7 @@ Size of u-boot.img is taken 4MB for refernece, But this is subject to change depending upon atf, optee size .. image:: img/emmc_j7200_evm_boot01.svg + :alt: Traditional eMMC boot partition layout In case of UDA FS mode booting, following is layout. @@ -198,6 +200,7 @@ All boot images tiboot3.bin, tispl and u-boot should be written to fat formatted UDA FS as file. .. image:: img/emmc_j7200_evm_udafs.svg + :alt: eMMC UDA boot partition layout In case of booting from eMMC, write above images into raw or UDA FS. and set mmc partconf accordingly. From e21a2ed33fb84ab9d202d430b41f2e4fe348db4c Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 22 Aug 2023 11:41:01 -0500 Subject: [PATCH 09/54] doc: board: ti: j721e: provide image alt text Provide alternative text for image. Fixes: 3b83dff183b5 ("doc: board: ti: j721e: Convert the image format to svg") Reported-by: Heinrich Schuchardt Signed-off-by: Nishanth Menon --- doc/board/ti/j721e_evm.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst index d2a214fb33f..a4c464707c6 100644 --- a/doc/board/ti/j721e_evm.rst +++ b/doc/board/ti/j721e_evm.rst @@ -40,6 +40,7 @@ Boot flow is similar to that of AM65x SoC and extending it with remoteproc support. Below is the pictorial representation of boot flow: .. image:: img/boot_diagram_j721e.svg + :alt: Boot flow diagram - Here DMSC acts as master and provides all the critical services. R5/A72 requests DMSC to get these services done as shown in the above diagram. @@ -136,14 +137,17 @@ Image formats: - tiboot3.bin .. image:: img/no_multi_cert_tiboot3.bin.svg + :alt: tiboot3.bin image format - tispl.bin .. image:: img/dm_tispl.bin.svg + :alt: tispl.bin image format - sysfw.itb .. image:: img/sysfw.itb.svg + :alt: sysfw.itb image format R5 Memory Map: -------------- @@ -213,6 +217,7 @@ addresses. Flash layout for OSPI: .. image:: img/ospi_sysfw.svg + :alt: OSPI flash partition layout Firmwares: ---------- From bfffc81b4c2b49666ece620ee3bc65fada9ed6eb Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 22 Aug 2023 11:41:02 -0500 Subject: [PATCH 10/54] doc: board: ti: am62x: Fix build step numbering Fix up build step numbering. Fixes: c727b81d6530 ("doc: board: ti: k3: Reuse build instructions") Signed-off-by: Nishanth Menon Revieed-by: Heinrich Schuchardt --- doc/board/ti/am62x_sk.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index 42b37f9c76f..d7437c6d22f 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -103,13 +103,13 @@ Set the variables corresponding to this platform: 3. U-Boot: -* 4.1 R5: +* 3.1 R5: .. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_build_steps_spl_r5 :end-before: .. k3_rst_include_end_build_steps_spl_r5 -* 4.2 A53: +* 3.2 A53: .. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_build_steps_uboot From c8612e2f495b2b7679f7974289a686a1c059d893 Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 22 Aug 2023 11:41:04 -0500 Subject: [PATCH 11/54] doc: board: ti: am65x: Fix build step numbering Fix up build step numbering. Fixes: c727b81d6530 ("doc: board: ti: k3: Reuse build instructions") Signed-off-by: Nishanth Menon Reviewed-by: Heinrich Schuchardt --- doc/board/ti/am65x_evm.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/board/ti/am65x_evm.rst b/doc/board/ti/am65x_evm.rst index 10e30f45cfd..7cebb1ca62d 100644 --- a/doc/board/ti/am65x_evm.rst +++ b/doc/board/ti/am65x_evm.rst @@ -103,13 +103,13 @@ Set the variables corresponding to this platform: 3. U-Boot: -* 4.1 R5: +* 3.1 R5: .. include:: k3.rst :start-after: .. k3_rst_include_start_build_steps_spl_r5 :end-before: .. k3_rst_include_end_build_steps_spl_r5 -* 4.2 A53: +* 3.2 A53: .. include:: k3.rst :start-after: .. k3_rst_include_start_build_steps_uboot @@ -123,13 +123,13 @@ Each SoC variant (GP and HS) requires a different source for these files. - GP - * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 4.1 - * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2 + * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 3.1 + * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2 - HS - * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 4.1 - * tispl.bin, u-boot.img from step 4.2 + * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 3.1 + * tispl.bin, u-boot.img from step 3.2 Image formats: -------------- From 7af00a79574f999e94cad77a3278d537a4a06592 Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 22 Aug 2023 11:41:05 -0500 Subject: [PATCH 12/54] doc: board: ti: j7200: Fix build step numbering Fix up build step numbering. Fixes: c727b81d6530 ("doc: board: ti: k3: Reuse build instructions") Signed-off-by: Nishanth Menon Reviewed-by: Heinrich Schuchardt --- doc/board/ti/j7200_evm.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/board/ti/j7200_evm.rst b/doc/board/ti/j7200_evm.rst index 2bf680cda2c..bcf8dc1c5f0 100644 --- a/doc/board/ti/j7200_evm.rst +++ b/doc/board/ti/j7200_evm.rst @@ -92,13 +92,13 @@ Set the variables corresponding to this platform: 3. U-Boot: -* 4.1 R5: +* 3.1 R5: .. include:: k3.rst :start-after: .. k3_rst_include_start_build_steps_spl_r5 :end-before: .. k3_rst_include_end_build_steps_spl_r5 -* 4.2 A72: +* 3.2 A72: .. include:: k3.rst :start-after: .. k3_rst_include_start_build_steps_uboot @@ -112,18 +112,18 @@ variant (GP, HS-FS, HS-SE) requires a different source for these files. - GP - * tiboot3-j7200-gp-evm.bin from step 4.1 - * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2 + * tiboot3-j7200-gp-evm.bin from step 3.1 + * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2 - HS-FS - * tiboot3-j7200_sr2-hs-fs-evm.bin from step 4.1 - * tispl.bin, u-boot.img from step 4.2 + * tiboot3-j7200_sr2-hs-fs-evm.bin from step 3.1 + * tispl.bin, u-boot.img from step 3.2 - HS-SE - * tiboot3-j7200_sr2-hs-evm.bin from step 4.1 - * tispl.bin, u-boot.img from step 4.2 + * tiboot3-j7200_sr2-hs-evm.bin from step 3.1 + * tispl.bin, u-boot.img from step 3.2 Image formats: -------------- From f340a162fbf2b4f71c01ab430c2c1ef875d4741e Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 22 Aug 2023 11:41:06 -0500 Subject: [PATCH 13/54] doc: board: ti: j721e: Fix build step numbering Fix up build step numbering. Fixes: c727b81d6530 ("doc: board: ti: k3: Reuse build instructions") Signed-off-by: Nishanth Menon Reviewed-by: Heinrich Schuchardt --- doc/board/ti/j721e_evm.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst index a4c464707c6..cadaac01781 100644 --- a/doc/board/ti/j721e_evm.rst +++ b/doc/board/ti/j721e_evm.rst @@ -97,13 +97,13 @@ Set the variables corresponding to this platform: 3. U-Boot: -* 4.1 R5: +* 3.1 R5: .. include:: k3.rst :start-after: .. k3_rst_include_start_build_steps_spl_r5 :end-before: .. k3_rst_include_end_build_steps_spl_r5 -* 4.2 A72: +* 3.2 A72: .. include:: k3.rst :start-after: .. k3_rst_include_start_build_steps_uboot @@ -118,18 +118,18 @@ files. - GP - * tiboot3-j721e-gp-evm.bin, sysfw-j721e-gp-evm.itb from step 4.1 - * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2 + * tiboot3-j721e-gp-evm.bin, sysfw-j721e-gp-evm.itb from step 3.1 + * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2 - HS-FS - * tiboot3-j721e_sr2-hs-fs-evm.bin, sysfw-j721e_sr2-hs-fs-evm.itb from step 4.1 - * tispl.bin, u-boot.img from step 4.2 + * tiboot3-j721e_sr2-hs-fs-evm.bin, sysfw-j721e_sr2-hs-fs-evm.itb from step 3.1 + * tispl.bin, u-boot.img from step 3.2 - HS-SE - * tiboot3-j721e_sr2-hs-evm.bin, sysfw-j721e_sr2-hs-evm.itb from step 4.1 - * tispl.bin, u-boot.img from step 4.2 + * tiboot3-j721e_sr2-hs-evm.bin, sysfw-j721e_sr2-hs-evm.itb from step 3.1 + * tispl.bin, u-boot.img from step 3.2 Image formats: -------------- From 4e4f344e7d68b350dbb2ff27d992c66d54deeffb Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 22 Aug 2023 11:41:07 -0500 Subject: [PATCH 14/54] doc: board: ti: k3: Elaborate on various firmware Add elaboration text for the various firmware involved for system management. Signed-off-by: Nishanth Menon --- doc/board/ti/k3.rst | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index 445c0f5e159..2b7a22a4cab 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -123,11 +123,30 @@ online | **source:** https://github.com/OP-TEE/optee_os.git | **branch:** master -* **TI Firmware (TIFS, DM, DSMC)** +* **TI Firmware (TIFS, DM, SYSFW)** | **source:** https://git.ti.com/git/processor-firmware/ti-linux-firmware.git | **branch:** ti-linux-firmware +.. note:: + + The TI Firmware required for functionality of the system can be + one of the following combination (see platform specific boot diagram for + further information as to which component runs on which processor): + + * **TIFS** - TI Foundational Security Firmware - Consists of purely firmware + meant to run on the security enclave. + * **DM** - Device Management firmware also called TI System Control Interface + server (TISCI Server) - This component purely plays the role of managing + device resources such as power, clock, interrupts, dma etc. This firmware + runs on a dedicated or multi-use microcontroller outside the security + enclave. + + OR + + * **SYSFW** - System firmware - consists of both TIFS and DM both running on + the security enclave. + .. k3_rst_include_end_boot_sources Build Procedure From 975103f1ac92b0702e42e314c9dd556f71008035 Mon Sep 17 00:00:00 2001 From: Jonathan Humphreys Date: Tue, 22 Aug 2023 13:49:03 -0500 Subject: [PATCH 15/54] doc: board: ti: k3: Fix up OpenOCD references and debug info Fix minor path and config macro name updates to sync with latest OpenOCD and U-Boot configurations. Fixes: effe50854a69 ("doc: board: ti: k3: Add a guide to debugging with OpenOCD") Signed-off-by: Jonathan Humphreys Signed-off-by: Nishanth Menon Reviewed-by: Heinrich Schuchardt --- doc/board/ti/k3.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index 2b7a22a4cab..1175b776ad4 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -600,7 +600,7 @@ correctly to ensure a sane system. $ cd openocd # Copy the udev rules to the correct system location $ sudo cp ./contrib/60-openocd.rules \ - ./src/JTAG/drivers/libjaylink/contrib/99-libjaylink.rules \ + ./src/jtag/drivers/libjaylink/contrib/99-libjaylink.rules \ /etc/udev/rules.d/ # Get Udev to load the new rules up $ sudo udevadm control --reload-rules @@ -791,7 +791,7 @@ Code modification In this example, we will debug ``board_init_f`` inside ``arch/arm/mach-k3/{soc}_init.c``. Since some sections of U-Boot will be executed multiple times during the bootup process of K3 - devices, we will need to include either ``CONFIG_CPU_ARM64`` or + devices, we will need to include either ``CONFIG_ARM64`` or ``CONFIG_CPU_V7R`` to catch the CPU at the desired place during the bootup process (Main or Wakeup domains). For example, modify the file as follows (depending on need): @@ -809,7 +809,7 @@ Code modification } ... /* Code to run on the ARMV8 (Main Domain) */ - if (IS_ENABLED(CONFIG_CPU_ARM64)) { + if (IS_ENABLED(CONFIG_ARM64)) { volatile int x = 1; while(x) {}; } From d737e9efcfc6c4afe207d82ae81bde57ba9f41a4 Mon Sep 17 00:00:00 2001 From: Thomas Mittelstaedt Date: Tue, 22 Aug 2023 13:49:02 +0000 Subject: [PATCH 16/54] Documentation extended with specific information for VirtualBox The configuration for EFI is enhanced to start U-Boot at VirtualBox (x86_64) with all features like booting with help of boot scripts and extended linux. This documentation describes how to use U-Boot at VirtualBox to boot Linux systems with a some simple example. Signed-off-by: Thomas Mittelstaedt --- doc/develop/uefi/u-boot_on_efi.rst | 84 ++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/doc/develop/uefi/u-boot_on_efi.rst b/doc/develop/uefi/u-boot_on_efi.rst index acad6397e81..0d4927807ca 100644 --- a/doc/develop/uefi/u-boot_on_efi.rst +++ b/doc/develop/uefi/u-boot_on_efi.rst @@ -254,6 +254,90 @@ This shows running with serial enabled (see `include/configs/efi-x86_app.h`):: => QEMU: Terminated +Run on VirtualBox (x86_64) +-------------------------- + +Enable EFI +~~~~~~~~~~ +At settings for virtual machine the flag at **System->Motherboard->Enable EFI +(special OSes only)** has to be enabled. + +Installation +~~~~~~~~~~~~ +Provide the preinstalled Linux system as a Virtual Disk Image (VDI) and assign +it to a SATA controller (type AHCI) using the settings for the virtual machine +at menu item **System->Storage->Controller:SATA**. + +For the following description three GPT partitions are assumed: + +- Partition 1: formatted as FAT file-system and marked as EFI system partition + (partition type 0xEF00) used for the U-Boot EFI binary. (If VirtualBox is UEFI + compliant, it should recognize the ESP as the boot partition.) + +- Partition 2: formatted as **ext4**, used for root file system + +Create an extlinux.conf or a boot script +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Following files are assumed to be located at system for boot configuration:: + + Partition File Comment + 1 EFI/BOOT/BOOTX64.efi # renamed U-Boot EFI image + 1 Image # Linux image + 1 Initrd # Initramfs of Linux + +**EFI/BOOT/BOOTX64.efi** is a renamed build result **u-boot-payload.efi**, built with +**efi-x86_payload64_defconfig** configuration. + +Boot script +~~~~~~~~~~~ + +The boot script **boot.scr** is assumed to be located at:: + + Partition File Comment + 1 boot.scr # Boot script, generated with mkimage from template + +Content of **boot.scr**: + +.. code-block:: bash + + ext4load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}Image + setenv kernel_size ${filesize} + ext4load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}Initrd + setenv initrd_size ${filesize} + zboot ${kernel_addr_r} ${kernel_size} ${ramdisk_addr_r} ${initrd_size} + +Extlinux configuration +~~~~~~~~~~~~~~~~~~~~~~ + +Alternatively a configuration **extlinux.conf** can be used. **extlinux.conf** +is assumed to be located at:: + + Partition File Comment + 1 extlinux/extlinux.conf # Extlinux boot configuration + +Content of **extlinux.conf**: + +.. code-block:: bash + + default l0 + menu title U-Boot menu + prompt 0 + timeout 50 + + label l0 + menu label Linux + linux /Image + initrd /Initrd + + +Additionally something like (sda is assumed as disk device): + +.. code-block:: bash + + append root=/dev/sda2 console=tty0 console=ttyS0,115200n8 rootwait rw + + Future work ----------- From 2a3c0680e60eea6591b6c43671d0eef4eac35681 Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Tue, 22 Aug 2023 19:53:58 +0100 Subject: [PATCH 17/54] doc: Explicitly list build dependencies for docs Highlight the packages which need to be installed in order to build the docs. Signed-off-by: Paul Barker --- doc/build/documentation.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/build/documentation.rst b/doc/build/documentation.rst index 011cd34a57c..20b0fefa2d8 100644 --- a/doc/build/documentation.rst +++ b/doc/build/documentation.rst @@ -5,6 +5,17 @@ Building documentation The U-Boot documentation is based on the Sphinx documentation generator. +In addition to the Python packages listed in ``doc/sphinx/requirements.txt``, +the following dependencies are needed to build the documentation: + +* fontconfig + +* graphviz + +* imagemagick + +* texinfo (if building the `Infodoc documentation`_) + HTML documentation ------------------ From 4e73b0153cce064e10dee4722cb2b6833361c227 Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Tue, 22 Aug 2023 19:53:59 +0100 Subject: [PATCH 18/54] doc: Highlight the most relevant u-boot talks The list of u-boot talks on elinux.org is quite long, so let's highlight the talks which are likely most relevant for newcomers. Signed-off-by: Paul Barker Reviewed-by: Simon Glass --- doc/learn/talks.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/learn/talks.rst b/doc/learn/talks.rst index 33bac483e17..0bb44aeabe5 100644 --- a/doc/learn/talks.rst +++ b/doc/learn/talks.rst @@ -3,9 +3,18 @@ U-Boot Talks ============ -U-Boot is a topic at various conferences each year. These talkes might help you -learn a bit about U-Boot. +U-Boot is a topic at various conferences each year. These talks might help you +learn a bit about U-Boot: -See elinux_talks_ for a list. +* `Tutorial: Introduction to the Embedded Boot Loader U-boot - Behan Webster, + Converse in Code `__ + from Embedded Linux Conference 2020 + (`slides `__). + +* `Recent Advances in U-Boot - Simon Glass, Google Inc. + `__ + from Embedded Linux Conference 2023. + +See elinux_talks_ for a more comprehensive list. .. _elinux_talks: https://elinux.org/Boot_Loaders#U-Boot From 9871b0e5d0f9a5479dddfc5d3a9f47924a996421 Mon Sep 17 00:00:00 2001 From: Venkatesh Yadav Abbarapu Date: Wed, 9 Aug 2023 09:03:50 +0530 Subject: [PATCH 19/54] usb: dwc3: Fix remove function if there is no ulpi_reset gpio As ulpi_reset gpio is now optional, we need to check it when doing the 'dwc3_generic_remove' function. Check if it is declared before accessing the ulpi_reset. Fixes: 237d1f60b1d ("usb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio") Reported-by: Thomas Nizan Signed-off-by: Venkatesh Yadav Abbarapu --- drivers/usb/dwc3/dwc3-generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index b3ed728fd84..7f0af05855a 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -145,7 +145,8 @@ static int dwc3_generic_remove(struct udevice *dev, struct dwc3 *dwc3 = &priv->dwc3; if (CONFIG_IS_ENABLED(DM_GPIO) && - device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3")) { + device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3") && + priv->ulpi_reset) { struct gpio_desc *ulpi_reset = priv->ulpi_reset; dm_gpio_free(ulpi_reset->dev, ulpi_reset); From c90729c46348cbc90d510708c407c8b783c970a9 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 13 Jul 2023 11:56:07 -0700 Subject: [PATCH 20/54] phy: phy-imx8mq-usb: add vbus regulator support Add support for enabling and disabling vbus-supply regulator found on several imx8mp boards in the usb3_phy0 and usb3_phy1 nodes. Signed-off-by: Tim Harvey Reviewed-by: Adam Ford Reviewed-by: Marek Vasut Tested-by: Marcel Ziswiler --- drivers/phy/phy-imx8mq-usb.c | 39 +++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/drivers/phy/phy-imx8mq-usb.c b/drivers/phy/phy-imx8mq-usb.c index 69f01de5553..9fa78ef4da3 100644 --- a/drivers/phy/phy-imx8mq-usb.c +++ b/drivers/phy/phy-imx8mq-usb.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #define PHY_CTRL0 0x0 #define PHY_CTRL0_REF_SSP_EN BIT(2) @@ -81,6 +83,7 @@ struct imx8mq_usb_phy { #endif void __iomem *base; enum imx8mpq_phy_type type; + struct udevice *vbus_supply; }; static const struct udevice_id imx8mq_usb_phy_of_match[] = { @@ -173,9 +176,9 @@ static int imx8mq_usb_phy_power_on(struct phy *usb_phy) struct udevice *dev = usb_phy->dev; struct imx8mq_usb_phy *imx_phy = dev_get_priv(dev); u32 value; + int ret; #if CONFIG_IS_ENABLED(CLK) - int ret; ret = clk_enable(&imx_phy->phy_clk); if (ret) { printf("Failed to enable usb phy clock\n"); @@ -183,12 +186,26 @@ static int imx8mq_usb_phy_power_on(struct phy *usb_phy) } #endif + if (CONFIG_IS_ENABLED(DM_REGULATOR) && imx_phy->vbus_supply) { + ret = regulator_set_enable_if_allowed(imx_phy->vbus_supply, true); + if (ret && ret != -ENOSYS) { + dev_err(dev, "Failed to enable VBUS regulator: %d\n", ret); + goto err; + } + } + /* Disable rx term override */ value = readl(imx_phy->base + PHY_CTRL6); value &= ~PHY_CTRL6_RXTERM_OVERRIDE_SEL; writel(value, imx_phy->base + PHY_CTRL6); return 0; + +err: +#if CONFIG_IS_ENABLED(CLK) + clk_disable(&imx_phy->phy_clk); +#endif + return ret; } static int imx8mq_usb_phy_power_off(struct phy *usb_phy) @@ -196,6 +213,7 @@ static int imx8mq_usb_phy_power_off(struct phy *usb_phy) struct udevice *dev = usb_phy->dev; struct imx8mq_usb_phy *imx_phy = dev_get_priv(dev); u32 value; + int ret; /* Override rx term to be 0 */ value = readl(imx_phy->base + PHY_CTRL6); @@ -206,6 +224,14 @@ static int imx8mq_usb_phy_power_off(struct phy *usb_phy) clk_disable(&imx_phy->phy_clk); #endif + if (CONFIG_IS_ENABLED(DM_REGULATOR) && imx_phy->vbus_supply) { + ret = regulator_set_enable_if_allowed(imx_phy->vbus_supply, false); + if (ret && ret != -ENOSYS) { + dev_err(dev, "Failed to disable VBUS regulator: %d\n", ret); + return ret; + } + } + return 0; } @@ -224,6 +250,7 @@ struct phy_ops imx8mq_usb_phy_ops = { int imx8mq_usb_phy_probe(struct udevice *dev) { struct imx8mq_usb_phy *priv = dev_get_priv(dev); + int ret; priv->type = dev_get_driver_data(dev); priv->base = dev_read_addr_ptr(dev); @@ -232,8 +259,6 @@ int imx8mq_usb_phy_probe(struct udevice *dev) return -EINVAL; #if CONFIG_IS_ENABLED(CLK) - int ret; - /* Assigned clock already set clock */ ret = clk_get_by_name(dev, "phy", &priv->phy_clk); if (ret) { @@ -241,6 +266,14 @@ int imx8mq_usb_phy_probe(struct udevice *dev) return ret; } #endif + if (CONFIG_IS_ENABLED(DM_REGULATOR)) { + ret = device_get_supply_regulator(dev, "vbus-supply", + &priv->vbus_supply); + if (ret && ret != -ENOENT) { + dev_err(dev, "Failed to get VBUS regulator: %d\n", ret); + return ret; + } + } return 0; } From e3380e1c1a88af454c1a41b6b63a8822e57f9a45 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Thu, 13 Jul 2023 11:56:08 -0700 Subject: [PATCH 21/54] phy: phy-imx8mq-usb: clean up clock code use CONFIG_IS_ENABLED for clock enable/disable and change printf's to dev_err. Additionlly remove the comment that does not make sense. Signed-off-by: Tim Harvey Reviewed-by: Marek Vasut --- drivers/phy/phy-imx8mq-usb.c | 38 ++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/drivers/phy/phy-imx8mq-usb.c b/drivers/phy/phy-imx8mq-usb.c index 9fa78ef4da3..b660eadecf1 100644 --- a/drivers/phy/phy-imx8mq-usb.c +++ b/drivers/phy/phy-imx8mq-usb.c @@ -78,9 +78,7 @@ enum imx8mpq_phy_type { }; struct imx8mq_usb_phy { -#if CONFIG_IS_ENABLED(CLK) struct clk phy_clk; -#endif void __iomem *base; enum imx8mpq_phy_type type; struct udevice *vbus_supply; @@ -178,13 +176,13 @@ static int imx8mq_usb_phy_power_on(struct phy *usb_phy) u32 value; int ret; -#if CONFIG_IS_ENABLED(CLK) - ret = clk_enable(&imx_phy->phy_clk); - if (ret) { - printf("Failed to enable usb phy clock\n"); - return ret; + if (CONFIG_IS_ENABLED(CLK)) { + ret = clk_enable(&imx_phy->phy_clk); + if (ret) { + dev_err(dev, "Failed to enable usb phy clock: %d\n", ret); + return ret; + } } -#endif if (CONFIG_IS_ENABLED(DM_REGULATOR) && imx_phy->vbus_supply) { ret = regulator_set_enable_if_allowed(imx_phy->vbus_supply, true); @@ -202,9 +200,8 @@ static int imx8mq_usb_phy_power_on(struct phy *usb_phy) return 0; err: -#if CONFIG_IS_ENABLED(CLK) - clk_disable(&imx_phy->phy_clk); -#endif + if (CONFIG_IS_ENABLED(CLK)) + clk_disable(&imx_phy->phy_clk); return ret; } @@ -220,9 +217,8 @@ static int imx8mq_usb_phy_power_off(struct phy *usb_phy) value |= PHY_CTRL6_RXTERM_OVERRIDE_SEL; writel(value, imx_phy->base + PHY_CTRL6); -#if CONFIG_IS_ENABLED(CLK) - clk_disable(&imx_phy->phy_clk); -#endif + if (CONFIG_IS_ENABLED(CLK)) + clk_disable(&imx_phy->phy_clk); if (CONFIG_IS_ENABLED(DM_REGULATOR) && imx_phy->vbus_supply) { ret = regulator_set_enable_if_allowed(imx_phy->vbus_supply, false); @@ -258,14 +254,14 @@ int imx8mq_usb_phy_probe(struct udevice *dev) if (!priv->base) return -EINVAL; -#if CONFIG_IS_ENABLED(CLK) - /* Assigned clock already set clock */ - ret = clk_get_by_name(dev, "phy", &priv->phy_clk); - if (ret) { - printf("Failed to get usb phy clock\n"); - return ret; + if (CONFIG_IS_ENABLED(CLK)) { + ret = clk_get_by_name(dev, "phy", &priv->phy_clk); + if (ret) { + dev_err(dev, "Failed to get usb phy clock %d\n", ret); + return ret; + } } -#endif + if (CONFIG_IS_ENABLED(DM_REGULATOR)) { ret = device_get_supply_regulator(dev, "vbus-supply", &priv->vbus_supply); From b2fb22396f97492fb5a2749dbd1bd9b6fdc30c71 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 10 Jul 2023 10:44:09 +0200 Subject: [PATCH 22/54] ARM: dts: stm32mp15: remove shmem for scmi-optee Since OP-TEE commit 89ba3422ee80 ("plat-stm32mp1: scmi_server: default use OP-TEE shared memory"), integrated in OP-TEE 3.22.0-rc1 the default configuration for STM32MP15x SoCs changes, CFG_STM32MP1_SCMI_SHM_SYSRAM is disabled by default and the OP-TEE SMCI server uses ithe OP-TEE native shared memory registered by clients. To be compatible by default with this configuration and the next OP-TEE version, this patch removes the SHMEM in the SCMI configuration and the associated reserved memory in the last 4KByte page of SRAM, in the STM32MP15 device tree. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/dts/stm32mp15-scmi.dtsi | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/arch/arm/dts/stm32mp15-scmi.dtsi b/arch/arm/dts/stm32mp15-scmi.dtsi index 543f24c2f4f..ad2584213d9 100644 --- a/arch/arm/dts/stm32mp15-scmi.dtsi +++ b/arch/arm/dts/stm32mp15-scmi.dtsi @@ -16,7 +16,6 @@ #address-cells = <1>; #size-cells = <0>; linaro,optee-channel-id = <0>; - shmem = <&scmi_shm>; scmi_clk: protocol@14 { reg = <0x14>; @@ -60,21 +59,6 @@ }; }; }; - - soc { - scmi_sram: sram@2ffff000 { - compatible = "mmio-sram"; - reg = <0x2ffff000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0 0x2ffff000 0x1000>; - - scmi_shm: scmi-sram@0 { - compatible = "arm,scmi-shmem"; - reg = <0 0x80>; - }; - }; - }; }; ®11 { From 3fce6bf213095121411fd8d8eb116a8cb1784141 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 10 Jul 2023 10:44:10 +0200 Subject: [PATCH 23/54] ARM: dts: stm32mp13: remove shmem for scmi-optee CFG_STM32MP1_SCMI_SHM_SYSRAM will be disabled by default for STM32MP13x SoCs in next OP-TEE version and the OP-TEE SMCI server uses the OP-TEE native shared memory registered by clients. To be compatible by default with this configuration this patch removes the shared memory in the SCMI configuration and the associated reserved memory in SRAM. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/dts/stm32mp13-u-boot.dtsi | 8 -------- arch/arm/dts/stm32mp131.dtsi | 14 -------------- 2 files changed, 22 deletions(-) diff --git a/arch/arm/dts/stm32mp13-u-boot.dtsi b/arch/arm/dts/stm32mp13-u-boot.dtsi index 726cd1a7e47..aa5cfc6e41d 100644 --- a/arch/arm/dts/stm32mp13-u-boot.dtsi +++ b/arch/arm/dts/stm32mp13-u-boot.dtsi @@ -108,14 +108,6 @@ bootph-all; }; -&scmi_shm { - bootph-all; -}; - -&scmi_sram { - bootph-all; -}; - &syscfg { bootph-all; }; diff --git a/arch/arm/dts/stm32mp131.dtsi b/arch/arm/dts/stm32mp131.dtsi index d163c267e34..d23bbc3639d 100644 --- a/arch/arm/dts/stm32mp131.dtsi +++ b/arch/arm/dts/stm32mp131.dtsi @@ -40,7 +40,6 @@ #address-cells = <1>; #size-cells = <0>; linaro,optee-channel-id = <0>; - shmem = <&scmi_shm>; scmi_clk: protocol@14 { reg = <0x14>; @@ -106,19 +105,6 @@ interrupt-parent = <&intc>; ranges; - scmi_sram: sram@2ffff000 { - compatible = "mmio-sram"; - reg = <0x2ffff000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0 0x2ffff000 0x1000>; - - scmi_shm: scmi-sram@0 { - compatible = "arm,scmi-shmem"; - reg = <0 0x80>; - }; - }; - timers2: timer@40000000 { #address-cells = <1>; #size-cells = <0>; From eb48efce260aefc0eceec90bd4d9adcd881f1b14 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 22 Aug 2023 11:10:20 +0200 Subject: [PATCH 24/54] lib: parameter check in hash_calculate If hash_calculate is invoked with region_count = 0, it will try to hash INT_MAX regions. We should check this parameter. * Avoid a comparison with different signedness. * Check that region_count is at least 1. * Avoid a superfluous assignment. Fixes: b37b46f042cc ("rsa: Use checksum algorithms from struct hash_algo") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- lib/hash-checksum.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/hash-checksum.c b/lib/hash-checksum.c index 8f2a42f9a08..68c290d64d8 100644 --- a/lib/hash-checksum.c +++ b/lib/hash-checksum.c @@ -23,8 +23,10 @@ int hash_calculate(const char *name, struct hash_algo *algo; int ret = 0; void *ctx; - uint32_t i; - i = 0; + int i; + + if (region_count < 1) + return -EINVAL; ret = hash_progressive_lookup_algo(name, &algo); if (ret) From 018346770b04e32caf75d5730301f3ba52ed005f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 26 Aug 2023 03:53:41 +0200 Subject: [PATCH 25/54] cmd: fix gpt setenv Do not assume that partitions are continuously numbered starting at 1. Having a partition table with a single partition 63 is valid. Fixes: 12fc1f3bb223 ("cmd: gpt: add eMMC and GPT support") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- cmd/gpt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/gpt.c b/cmd/gpt.c index 007a68eaa72..d0e165d5394 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -786,10 +786,8 @@ static int gpt_setenv(struct blk_desc *desc, const char *name) for (i = 1; i < part_drv->max_entries; i++) { ret = part_drv->get_info(desc, i, &pinfo); - if (ret) { - /* no more entries in table */ - break; - } + if (ret) + continue; if (!strcmp(name, (const char *)pinfo.name)) { /* match found, setup environment variables */ From 41cd23b7be6e097daa5c2b1eda5539de227bf745 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 26 Aug 2023 03:53:42 +0200 Subject: [PATCH 26/54] cmd: fix gpt enumerate Do not assume that partitions are numbered continuously starting at 1. Only a single partition table type can exist on a block device. If we found a GPT partition table, we must not re-enumerate with the MBR partition driver which would find the protective partition. Fixes: 12fc1f3bb223 ("cmd: gpt: add eMMC and GPT support") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- cmd/gpt.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/gpt.c b/cmd/gpt.c index d0e165d5394..99ca0a61630 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -691,12 +691,13 @@ static int gpt_enumerate(struct blk_desc *desc) int ret; int i; + if (part_drv->test(desc)) + continue; + for (i = 1; i < part_drv->max_entries; i++) { ret = part_drv->get_info(desc, i, &pinfo); - if (ret) { - /* no more entries in table */ - break; - } + if (ret) + continue; ptr = &part_list[str_len]; tmp_len = strlen((const char *)pinfo.name); @@ -711,9 +712,10 @@ static int gpt_enumerate(struct blk_desc *desc) /* One byte for space(" ") delimiter */ ptr[tmp_len] = ' '; } + if (*part_list) + part_list[strlen(part_list) - 1] = 0; + break; } - if (*part_list) - part_list[strlen(part_list) - 1] = 0; debug("setenv gpt_partition_list %s\n", part_list); return env_set("gpt_partition_list", part_list); From eeef584015209cd8f23d438f8a29e8065838d34f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 26 Aug 2023 03:53:43 +0200 Subject: [PATCH 27/54] cmd: let gpt_partition_entry be hexadecimal In commands like 'ls mmc 0:f' the partition number is hexadecimal. In command 'gpt setenv' variable gpt_partition_entry needs to be set to a hexadecimal value to allow its use as a parameter in a subsequent command. Fixes: 57f8cf1b9aea ("cmd: fix gpt enumerate") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- cmd/gpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/gpt.c b/cmd/gpt.c index 99ca0a61630..964056bd28b 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -744,7 +744,7 @@ static int gpt_setenv_part_variables(struct disk_partition *pinfo, int i) if (ret) goto fail; - ret = env_set_ulong("gpt_partition_entry", i); + ret = env_set_hex("gpt_partition_entry", i); if (ret) goto fail; From 96c4fec7019a3c5d4410c01d2f5ecbc6a547dc81 Mon Sep 17 00:00:00 2001 From: Sumit Garg Date: Thu, 24 Aug 2023 18:14:20 +0530 Subject: [PATCH 28/54] doc: board: sdm845: Explicitly add boot.img flashing command Signed-off-by: Sumit Garg Use code-block. Fix length of two heading underlines. Signed-off-by: Heinrich Schuchardt --- doc/board/qualcomm/sdm845.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/board/qualcomm/sdm845.rst b/doc/board/qualcomm/sdm845.rst index 71879c2a6e3..d3f218e835e 100644 --- a/doc/board/qualcomm/sdm845.rst +++ b/doc/board/qualcomm/sdm845.rst @@ -38,9 +38,10 @@ and FIT image instead of ``initramfs``. Android bootloader expect gzipped kernel with appended dtb, so let's mimic linux to satisfy stock bootloader. Boards ------------- +------ + starqlte -^^^^^^^^^^^^ +^^^^^^^^ The starqltechn is a production board for Samsung S9 (SM-G9600) phone, based on the Qualcomm SDM845 SoC. @@ -149,7 +150,11 @@ Steps: mkbootimg --kernel u-boot.bin.gz-dtb --ramdisk db845c.itb \ --output boot.img --pagesize 4096 --base 0x80000000 -- Flash boot.img using db845c fastboot method. +- Flash boot.img using db845c fastboot method: + + .. code-block:: bash + + sudo fastboot flash boot boot.img More information can be found on the `DragonBoard 845c page`_. From 1cfcc2298fc6c1d661db2f7b5110e2c63e0ef756 Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Thu, 24 Aug 2023 10:40:35 -0500 Subject: [PATCH 29/54] doc: sphinx: Add sphinx-prompt Sphinx-prompt[1] helps bring-in '.. prompt::' option that allows a better rendered documentation, yet be able to copy paste without picking up the prompt from rendered documentation. [1] https://lore.kernel.org/all/87fs48rgto.fsf@baylibre.com/ Suggested-by: Mattijs Korpershoek Signed-off-by: Nishanth Menon Reviewed-by: Heinrich Schuchardt --- doc/conf.py | 2 +- doc/sphinx/requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 00f24136647..5e2ff1c8f5e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -39,7 +39,7 @@ needs_sphinx = '2.4.4' extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'kfigure', 'sphinx.ext.ifconfig', # 'automarkup', 'maintainers_include', 'sphinx.ext.autosectionlabel', - 'kernel_abi', 'kernel_feat'] + 'kernel_abi', 'kernel_feat', 'sphinx-prompt'] # # cdomain is badly broken in Sphinx 3+. Leaving it out generates *most* diff --git a/doc/sphinx/requirements.txt b/doc/sphinx/requirements.txt index 4f411f78d03..6ccbe527ee7 100644 --- a/doc/sphinx/requirements.txt +++ b/doc/sphinx/requirements.txt @@ -15,6 +15,7 @@ requests==2.31.0 six==1.16.0 snowballstemmer==2.2.0 Sphinx==3.4.3 +sphinx-prompt==1.5.0 sphinx-rtd-theme==1.0.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 From febc7f100996c84649a80ee92339b04bbe900314 Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Thu, 24 Aug 2023 10:40:36 -0500 Subject: [PATCH 30/54] doc: board: ti: k3: Convert to sphinx-prompt Sphinx-prompt provides a handy scheme to provide documentation that renders nicely and yet provides a scheme to copy paste for users without having to hand-edit the copied text as is the result of code-block [1] https://lore.kernel.org/all/87fs48rgto.fsf@baylibre.com/ Reported-by: Simon Glass Suggested-by: Mattijs Korpershoek Signed-off-by: Nishanth Menon Signed-off-by: Heinrich Schuchardt --- doc/board/ti/k3.rst | 112 ++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index 1175b776ad4..ec447358ac3 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -194,13 +194,13 @@ All of that to say you will need both a 32bit and 64bit cross compiler .. k3_rst_include_end_common_env_vars_desc .. k3_rst_include_start_common_env_vars_defn -.. code-block:: bash +.. prompt:: bash - $ export CC32=arm-linux-gnueabihf- - $ export CC64=aarch64-linux-gnu- - $ export LNX_FW_PATH=path/to/ti-linux-firmware - $ export TFA_PATH=path/to/trusted-firmware-a - $ export OPTEE_PATH=path/to/optee_os + export CC32=arm-linux-gnueabihf- + export CC64=aarch64-linux-gnu- + export LNX_FW_PATH=path/to/ti-linux-firmware + export TFA_PATH=path/to/trusted-firmware-a + export OPTEE_PATH=path/to/optee_os .. k3_rst_include_end_common_env_vars_defn We will also need some common environment variables set up for the various @@ -244,11 +244,11 @@ Building tiboot3.bin uses the split binary flow) .. k3_rst_include_start_build_steps_spl_r5 -.. code-block:: bash +.. prompt:: bash - $ # inside u-boot source - $ make $UBOOT_CFG_CORTEXR - $ make CROSS_COMPILE=$CC32 BINMAN_INDIRS=$LNX_FW_PATH + # inside u-boot source + make $UBOOT_CFG_CORTEXR + make CROSS_COMPILE=$CC32 BINMAN_INDIRS=$LNX_FW_PATH .. k3_rst_include_end_build_steps_spl_r5 At this point you should have all the needed binaries to boot the wakeup @@ -280,11 +280,11 @@ firmware if your device using a split firmware. application cores on the main domain. .. k3_rst_include_start_build_steps_tfa -.. code-block:: bash +.. prompt:: bash - $ # inside trusted-firmware-a source - $ make CROSS_COMPILE=$CC64 ARCH=aarch64 PLAT=k3 SPD=opteed $TFA_EXTRA_ARGS \ - TARGET_BOARD=$TFA_BOARD + # inside trusted-firmware-a source + make CROSS_COMPILE=$CC64 ARCH=aarch64 PLAT=k3 SPD=opteed $TFA_EXTRA_ARGS \ + TARGET_BOARD=$TFA_BOARD .. k3_rst_include_end_build_steps_tfa Typically all `j7*` devices will use `TARGET_BOARD=generic` or `TARGET_BOARD @@ -296,11 +296,11 @@ use the `lite` option. using the TrustZone technology built into the core. .. k3_rst_include_start_build_steps_optee -.. code-block:: bash +.. prompt:: bash - $ # inside optee_os source - $ make CROSS_COMPILE=$CC32 CROSS_COMPILE64=$CC64 CFG_ARM64_core=y $OPTEE_EXTRA_ARGS \ - PLATFORM=$OPTEE_PLATFORM + # inside optee_os source + make CROSS_COMPILE=$CC32 CROSS_COMPILE64=$CC64 CFG_ARM64_core=y $OPTEE_EXTRA_ARGS \ + PLATFORM=$OPTEE_PLATFORM .. k3_rst_include_end_build_steps_optee 4. Finally, after TF-A has initialized the main domain and OP-TEE has @@ -308,11 +308,11 @@ use the `lite` option. 64bit core in the main domain. .. k3_rst_include_start_build_steps_uboot -.. code-block:: bash +.. prompt:: bash - $ # inside u-boot source - $ make $UBOOT_CFG_CORTEXA - $ make CROSS_COMPILE=$CC64 BINMAN_INDIRS=$LNX_FW_PATH \ + # inside u-boot source + make $UBOOT_CFG_CORTEXA + make CROSS_COMPILE=$CC64 BINMAN_INDIRS=$LNX_FW_PATH \ BL31=$TFA_PATH/build/k3/$TFA_BOARD/release/bl31.bin \ TEE=$OPTEE_PATH/out/arm-plat-k3/core/tee-raw.bin .. k3_rst_include_end_build_steps_uboot @@ -407,14 +407,14 @@ and the same can be extended to other platforms be passing to mkimage for signing the fitImage and embedding the key in the u-boot dtb. - .. code-block:: bash + .. prompt:: bash mkimage -r -f fitImage.its -k $UBOOT_PATH/board/ti/keys -K $UBOOT_PATH/build/a72/dts/dt.dtb For signing a secondary platform, pass the -K parameter to that DTB - .. code-block:: bash + .. prompt:: bash mkimage -f fitImage.its -k $UBOOT_PATH/board/ti/keys -K $UBOOT_PATH/build/a72/arch/arm/dts/k3-j721e-sk.dtb @@ -473,10 +473,11 @@ then the saveenv command and can be used across various bootmodes too. **Writing to MMC/EMMC** -.. code-block:: +.. prompt:: bash + :prompts: => - => env export -t $loadaddr - => fatwrite mmc ${mmcdev} ${loadaddr} ${bootenvfile} ${filesize} + env export -t $loadaddr + fatwrite mmc ${mmcdev} ${loadaddr} ${bootenvfile} ${filesize} **Reading from MMC/EMMC** @@ -486,10 +487,11 @@ mmcdev) and set the environments. If manually needs to be done then the environment can be read from the filesystem and then imported -.. code-block:: +.. prompt:: bash + :prompts: => - => fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} - => env import -t ${loadaddr} ${filesize} + fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} + env import -t ${loadaddr} ${filesize} .. _k3_rst_refer_openocd: @@ -546,7 +548,7 @@ Refer to the release notes corresponding to the `OpenOCD version box support by OpenOCD. The board-specific documentation will cover the details and any adapter/dongle recommendations. -.. code-block:: bash +.. prompt:: bash openocd -v @@ -564,21 +566,21 @@ systems, but equivalent instructions should exist for systems with other package managers. Please refer to the `OpenOCD Documentation `_ for more recent installation steps. -.. code-block:: bash +.. prompt:: bash - $ # Check the packages to be installed: needs deb-src in sources.list - $ sudo apt build-dep openocd - $ # The following list is NOT complete - please check the latest - $ sudo apt-get install libtool pkg-config texinfo libusb-dev \ + # Check the packages to be installed: needs deb-src in sources.list + sudo apt build-dep openocd + # The following list is NOT complete - please check the latest + sudo apt-get install libtool pkg-config texinfo libusb-dev \ libusb-1.0.0-dev libftdi-dev libhidapi-dev autoconf automake - $ git clone https://github.com/openocd-org/openocd.git openocd - $ cd openocd - $ git submodule init - $ git submodule update - $ ./bootstrap - $ ./configure --prefix=/usr/local/ - $ make -j`nproc` - $ sudo make install + git clone https://github.com/openocd-org/openocd.git openocd + cd openocd + git submodule init + git submodule update + ./bootstrap + ./configure --prefix=/usr/local/ + make -j`nproc` + sudo make install .. note:: @@ -594,28 +596,28 @@ The step is not necessary if the distribution supports the OpenOCD, but if building from a source, ensure that the udev rules are installed correctly to ensure a sane system. -.. code-block:: bash +.. prompt:: bash # Go to the OpenOCD source directory - $ cd openocd - # Copy the udev rules to the correct system location - $ sudo cp ./contrib/60-openocd.rules \ + cd openocd + Copy the udev rules to the correct system location + sudo cp ./contrib/60-openocd.rules \ ./src/jtag/drivers/libjaylink/contrib/99-libjaylink.rules \ /etc/udev/rules.d/ # Get Udev to load the new rules up - $ sudo udevadm control --reload-rules + sudo udevadm control --reload-rules # Use the new rules on existing connected devices - $ sudo udevadm trigger + sudo udevadm trigger Step 2: Setup GDB ^^^^^^^^^^^^^^^^^ Most systems come with gdb-multiarch package. -.. code-block:: bash +.. prompt:: bash # Install gdb-multiarch package - $ sudo apt-get install gdb-multiarch + sudo apt-get install gdb-multiarch Though using GDB natively is normal, developers with interest in using IDE may find a few of these interesting: @@ -828,7 +830,7 @@ Startup OpenOCD to debug the platform as follows: .. k3_rst_include_start_openocd_cfg_XDS110 -.. code-block:: bash +.. prompt:: bash openocd -f board/{board_of_choice}.cfg @@ -842,7 +844,7 @@ Startup OpenOCD to debug the platform as follows: `_ to decide if the SoC is supported or not. -.. code-block:: bash +.. prompt:: bash openocd -f openocd_connect.cfg @@ -917,7 +919,7 @@ To debug using this server, use GDB directly or your preferred GDB-based IDE. To start up GDB in the terminal, run the following command. -.. code-block:: bash +.. prompt:: bash gdb-multiarch From 143c9a7e9d686d7b2e2a7a1c26cf0c4d82660cc6 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 23 Aug 2023 23:49:55 +0200 Subject: [PATCH 31/54] doc: describe TPL/VPL/SPL boot This is a stub describing how TPL, VPL, and SPL load the next boot stages on a detail level for users. For sure we will need a few patches on top to catch the whole complexity. Signed-off-by: Heinrich Schuchardt Reviewed-by: Paul Barker --- doc/usage/index.rst | 1 + doc/usage/spl_boot.rst | 321 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 322 insertions(+) create mode 100644 doc/usage/spl_boot.rst diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 3326ec82fff..f45a7f55024 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -4,6 +4,7 @@ Use U-Boot .. toctree:: :maxdepth: 1 + spl_boot blkmap dfu environment diff --git a/doc/usage/spl_boot.rst b/doc/usage/spl_boot.rst new file mode 100644 index 00000000000..93419f158af --- /dev/null +++ b/doc/usage/spl_boot.rst @@ -0,0 +1,321 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Booting from TPL/SPL +==================== + +The main U-Boot binary may be too large to be loaded directly by the Boot ROM. +This was the original driver for splitting up U-Boot into multiple boot stages. + +U-Boot typically goes through the following boot phases where TPL, VPL, and SPL +are optional. While many boards use SPL only few use TPL. + +TPL + Tertiary Program Loader. Very early init, as tiny as possible. This loads SPL + (or VPL if enabled). + +VPL + Verifying Program Loader. Optional verification step, which can select one of + several SPL binaries, if A/B verified boot is enabled. Implementation of the + VPL logic is work-in-progress. For now it just boots into SPL. + +SPL + Secondary Program Loader. Sets up SDRAM and loads U-Boot proper. It may also + load other firmware components. + +U-Boot + U-Boot proper. This is the only stage containing command. It also implements + logic to load an operating system, e.g. via UEFI. + +.. note:: + + The naming convention on the PowerPC architecture deviates from the other + archtitectures. Here the boot sequence is SPL->TPL->U-Boot. + +Further usages for U-Boot SPL comprise: + +* launching BL31 of ARM Trusted Firmware which invokes U-Boot as BL33 +* launching EDK II +* launching Linux, e.g. :doc:`Falcon Mode <../develop/falcon>` +* launching RISC-V OpenSBI which invokes main U-Boot + +Target binaries +--------------- + +Binaries loaded by SPL/TPL can be: + +* raw binaries where the entry address equals the start address. This is the + only binary format supported by TPL. +* :doc:`FIT ` images +* legacy U-Boot images + +Configuration +~~~~~~~~~~~~~ + +Raw images are only supported in SPL if CONFIG_SPL_RAW_IMAGE_SUPPORT=y. + +CONFIG_SPL_FIT=y and CONFIG_SPL_LOAD_FIT=y are needed to load FIT images. + +CONFIG_SPL_LEGACY_IMAGE_FORMAT=y is needed to load legacy U-Boot images. +CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK=y enables checking the CRC32 of legacy U-Boot +images. + +Image load methods +------------------ + +The image boot methods available for a board must be defined in two places: + +The board code implements a function board_boot_order() enumerating up to +five boot methods and the sequence in which they are tried. (The maximum +number of boot methods is currently hard coded as variable spl_boot_list[]). +If there is only one boot method function, spl_boot_device() may be implemented +instead. + +The configuration controls which of these boot methods are actually available. + +Loading from block devices +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +MMC1, MMC2, MMC2_2 + These methods read an image from SD card or eMMC. The first digit after + 'MMC' indicates the device number. Required configuration settings include: + + * CONFIG_SPL_MMC=y or CONFIG_TPL_MMC=y + + To use a PCI connected MMC controller you need to additionally specify: + + * CONFIG_SPL_PCI=y + + * CONFIG_SPL_PCI_PNP=y + + * CONFIG_MMC=y + + * CONFIG_MMC_PCI=y + + * CONFIG_MMC_SDHCI=y + + To load from a file system use: + + * CONFIG_SPL_FS_FAT=y or CONFIG_SPL_FS_EXT=y + + * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="" + +NVMe + This methods load the image from an NVMe drive. + Required configuration settings include: + + * CONFIG_SPL_PCI=y + + * CONFIG_SPL_PCI_PNP=y + + * CONFIG_SPL_NVME=y + + * CONFIG_SPL_NVME_PCI=y + + * CONFIG_SPL_NVME_BOOT_DEVICE (number of the NVMe device) + + * CONFIG_SYS_NVME_BOOT_PARTITION (partition to read from) + + To load from a file system use: + + * CONFIG_SPL_FS_FAT=y or CONFIG_SPL_FS_EXT=y + + * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="" + +SATA + This method reads an image from a SATA drive. + Required configuration settings include: + + * CONFIG_SPL_SATA=y or CONFIG_TPL_SATA=y + + To use a PCIe connecte SATA controller you additionally need: + + * CONFIG_SPL_PCI=y + + * CONFIG_SPL_SATA=y + + * CONFIG_SPL_AHCI_PCI=y + + * CONFIG_SPL_PCI_PNP=y + + To load from a file system use: + + * CONFIG_SPL_FS_FAT=y + + * CONFIG_SYS_SATA_FAT_BOOT_PARTITION= + + * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="" + +USB + The USB method loads an image from a USB block device. + Required configuration settings include: + + * CONFIG_SPL_USB_HOST=y + + * CONFIG_SPL_USB_STORAGE=y + + To use a PCI connected USB 3.0 controller you additionally need: + + * CONFIG_SPL_FS_FAT=y + + * CONFIG_SPL_PCI=y + + * CONFIG_SPL_PCI_PNP=y + + * CONFIG_USB=y + + * CONFIG_USB_XHCI_HCD=y + + * CONFIG_USB_XHCI_PCI=y + + To load from a file system use: + + * CONFIG_SPL_FS_FAT=y or CONFIG_SPL_FS_EXT=y + + * CONFIG_SYS_USB_FAT_BOOT_PARTITION= + + * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="" + +Loading from raw flash devices +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +NAND + This method loads the image from NAND flash. To read from raw NAND the + following configuration settings are required: + + * CONFIG_SPL_NAND_SUPPORT=y or CONFIG_TPL_NAND_SUPPORT=y + + If CONFIG_SPL_NAND_RAW_ONLY=y only raw images can be loaded. + + For using UBI (Unsorted Block Images) volumes to read from NAND the + following configuration settings are required: + + * CONFIG_SPL_UBI=y or CONFIG_TPL_UBI=y + + The UBI volume to read can either be specified + + * by name using CONFIG_SPL_UBI_LOAD_BY_VOLNAME or + + * by number using CONFIG_SPL_UBI_LOAD_MONITOR_ID. + +NOR + This method loads the image from NOR flash. + Required configuration settings include: + + * CONFIG_SPL_NOR_SUPPORT=y or CONFIG_TPL_NOR_SUPPORT=y + +OneNAND + This methods loads the image from a OneNAND device. To read from raw OneNAND + the following configuration settings are required: + + * CONFIG_SPL_ONENAND_SUPPORT=y or CONFIG_TPL_ONENAND_SUPPORT=y + + For using the Ubi file system to read from NAND the following configuration + settings are required: + + * CONFIG_SPL_UBI=y or CONFIG_TPL_UBI=y + +SPI + This method loads an image form SPI NOR flash. + Required configuration settings include: + + * CONFIG_SPL_DM_SPI=y + + * CONFIG_SPL_SPI_FLASH=y + + * CONFIG_SPI_LOAD=y or CONFIG_TPL_SPI_LOAD=y + + +Sunxi SPI + This method which is specific to Allwinner SoCs loads an image form SPI NOR + flash. Required configuration settings include: + + * CONFIG_SPL_SPI_SUNXI=y + +Loading from other devices +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +BOOTROM + The binary is loaded by the boot ROM. + Required configuration settings include: + + * CONFIG_SPL_BOOTROM_SUPPORT=y or CONFIG_TPL_BOOTROM_SUPPORT=y + +DFU + :doc:`Device Firmware Upgrade ` is used to load the binary into RAM. + Required configuration settings include: + + * CONFIG_DFU=y + + * CONFIG_SPL_RAM_SUPPORT=y or CONFIG TPL_RAM_SUPPORT=y + +Ethernet + This method loads an image over Ethernet. The BOOTP protocol is used to find + a TFTP server and binary name. The binary is downloaded via the TFTP + protocol. Required configuration settings include: + + * CONFIG_SPL_NET=y or CONFIG_TPL_NET=y + + * CONFIG_SPL_ETH_DEVICE=y or CONFIG_DM_USB_GADGET=y + +FEL + This method does not actually load an image for U-Boot. + FEL is a routine contained in the boot ROM of Allwinner SoCs which serves + for the initial programming or recovery via USB + +RAM + This method uses an image preloaded into RAM. + Required configuration settings include: + + * CONFIG_SPL_RAM_SUPPORT=y or CONFIG_TPL_RAM_SUPPORT=y + + * CONFIG_RAM_DEVICE=y + +Sandbox file + On the sandbox this method loads an image from the host file system. + +Sandbox image + On the sandbox this method loads an image from the host file system. + +Semihosting + When running in an ARM or RISC-V virtual machine the semihosting method can + be used to load an image from the host file system. + Required configuration settings include: + + * CONFIG_SPL_SEMIHOSTING=y + + * CONFIG_SPL_SEMIHOSTING_FALLBACK=y + + * CONFIG_SPL_FS_LOAD_PAYLOAD_NAME= + +UART + This method loads an image via the Y-Modem protocol from the UART. + Required configuration settings include: + + * CONFIG_SPL_YMODEM_SUPPORT=y or CONFIG_TPL_YMODEM_SUPPORT=y + +USB SDP + This method loads the image using the Serial Download Protocol as + implemented by the boot ROM of the i.MX family of SoCs. + + Required configuration settings include: + + * CONFIG_SPL_SERIAL=y + + * CONFIG_SPL_USB_SDP_SUPPORT=y or CONFIG_TPL_USB_SDP_SUPPORT + +VBE Simple + This method is used by the VPL stage to extract the next stage image from + the loaded image. + + Required configuration settings include: + + * CONFIG_VPL=y + + * CONFIG_SPL_BOOTMETH_VBE_SIMPLE_FW=y or CONFIG_TPL_BOOTMETH_VBE_SIMPLE_FW=y + +XIP + This method executes an image in place. + + Required configuration settings include: + + * CONFIG_SPL_XIP_SUPPORT From cc889bd0754e50a3cd50e8ed3094388480fbec86 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 24 Aug 2023 17:21:09 +0300 Subject: [PATCH 32/54] efi_loader: delete handle from events when a protocol is uninstalled When a notification event is registered for a protocol the handle of the protocol is added in our event notification list. When all the protocols of the handle are uninstalled we delete the handle but we do not remove it from the event notification list. Clean up the protocol removal functions and add a wrapper which - Removes the to-be deleted handle from any lists it participates - Remove the handle if no more protocols are present Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 89 +++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 24 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 0e89c8505b1..0b7579cb5af 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -61,7 +61,7 @@ static volatile gd_t *efi_gd, *app_gd; static efi_status_t efi_uninstall_protocol (efi_handle_t handle, const efi_guid_t *protocol, - void *protocol_interface); + void *protocol_interface, bool preserve); /* 1 if inside U-Boot code, 0 if inside EFI payload code */ static int entry_count = 1; @@ -207,6 +207,36 @@ static bool efi_event_is_queued(struct efi_event *event) return !!event->queue_link.next; } +/** + * efi_purge_handle() - Clean the deleted handle from the various lists + * @handle: handle to remove + * + * Return: status code + */ +static efi_status_t efi_purge_handle(efi_handle_t handle) +{ + struct efi_register_notify_event *item; + + if (!list_empty(&handle->protocols)) + return EFI_ACCESS_DENIED; + /* The handle is about to be freed. Remove it from events */ + list_for_each_entry(item, &efi_register_notify_events, link) { + struct efi_protocol_notification *hitem, *hnext; + + list_for_each_entry_safe(hitem, hnext, &item->handles, link) { + if (handle == hitem->handle) { + list_del(&hitem->link); + free(hitem); + } + } + } + /* The last protocol has been removed, delete the handle. */ + list_del(&handle->link); + free(handle); + + return EFI_SUCCESS; +} + /** * efi_process_event_queue() - process event queue */ @@ -615,7 +645,7 @@ static efi_status_t efi_remove_all_protocols(const efi_handle_t handle) efi_status_t ret; ret = efi_uninstall_protocol(handle, &protocol->guid, - protocol->protocol_interface); + protocol->protocol_interface, true); if (ret != EFI_SUCCESS) return ret; } @@ -639,10 +669,7 @@ efi_status_t efi_delete_handle(efi_handle_t handle) return ret; } - list_del(&handle->link); - free(handle); - - return ret; + return efi_purge_handle(handle); } /** @@ -1356,6 +1383,8 @@ reconnect: * @handle: handle from which the protocol shall be removed * @protocol: GUID of the protocol to be removed * @protocol_interface: interface to be removed + * @preserve: preserve or delete the handle and remove it from any + * list it participates if no protocols remain * * This function DOES NOT delete a handle without installed protocol. * @@ -1363,7 +1392,7 @@ reconnect: */ static efi_status_t efi_uninstall_protocol (efi_handle_t handle, const efi_guid_t *protocol, - void *protocol_interface) + void *protocol_interface, bool preserve) { struct efi_handler *handler; struct efi_open_protocol_info_item *item; @@ -1397,6 +1426,14 @@ static efi_status_t efi_uninstall_protocol goto out; } r = efi_remove_protocol(handle, protocol, protocol_interface); + if (r != EFI_SUCCESS) + return r; + /* + * We don't care about the return value here since the + * handle might have more protocols installed + */ + if (!preserve) + efi_purge_handle(handle); out: return r; } @@ -1422,15 +1459,10 @@ static efi_status_t EFIAPI efi_uninstall_protocol_interface EFI_ENTRY("%p, %pUs, %p", handle, protocol, protocol_interface); - ret = efi_uninstall_protocol(handle, protocol, protocol_interface); + ret = efi_uninstall_protocol(handle, protocol, protocol_interface, false); if (ret != EFI_SUCCESS) goto out; - /* If the last protocol has been removed, delete the handle. */ - if (list_empty(&handle->protocols)) { - list_del(&handle->link); - free(handle); - } out: return EFI_EXIT(ret); } @@ -2785,7 +2817,7 @@ static efi_status_t EFIAPI efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle, efi_va_list argptr) { - const efi_guid_t *protocol; + const efi_guid_t *protocol, *next_protocol; void *protocol_interface; efi_status_t ret = EFI_SUCCESS; size_t i = 0; @@ -2795,25 +2827,34 @@ efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle, return EFI_INVALID_PARAMETER; efi_va_copy(argptr_copy, argptr); + protocol = efi_va_arg(argptr, efi_guid_t*); for (;;) { - protocol = efi_va_arg(argptr, efi_guid_t*); + /* + * If efi_uninstall_protocol() fails we need to be able to + * reinstall the previously uninstalled protocols on the same + * handle. + * Instead of calling efi_uninstall_protocol(...,..., false) + * and potentially removing the handle, only allow the handle + * removal on the last protocol that we requested to uninstall. + * That way we can preserve the handle in case the latter fails + */ + bool preserve = true; + if (!protocol) break; protocol_interface = efi_va_arg(argptr, void*); + next_protocol = efi_va_arg(argptr, efi_guid_t*); + if (!next_protocol) + preserve = false; ret = efi_uninstall_protocol(handle, protocol, - protocol_interface); + protocol_interface, preserve); if (ret != EFI_SUCCESS) break; i++; + protocol = next_protocol; } - if (ret == EFI_SUCCESS) { - /* If the last protocol has been removed, delete the handle. */ - if (list_empty(&handle->protocols)) { - list_del(&handle->link); - free(handle); - } + if (ret == EFI_SUCCESS) goto out; - } /* If an error occurred undo all changes. */ for (; i; --i) { @@ -3712,7 +3753,7 @@ static efi_status_t EFIAPI efi_reinstall_protocol_interface( new_interface); /* Uninstall protocol but do not delete handle */ - ret = efi_uninstall_protocol(handle, protocol, old_interface); + ret = efi_uninstall_protocol(handle, protocol, old_interface, true); if (ret != EFI_SUCCESS) goto out; From d167062c48a822ae754f1b1c75e97233184b8a0e Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 18 Aug 2023 15:54:10 +0100 Subject: [PATCH 33/54] boot: Fix reference to bootmenu doc The Kconfig references a readme file that's moved and converted to rst so update the reference. Signed-off-by: Peter Robinson Reviewed-by: Simon Glass --- boot/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/Kconfig b/boot/Kconfig index e8fb03b8016..86c2787dc53 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -1439,7 +1439,7 @@ config AUTOBOOT_MENU_SHOW This enables the boot menu, controlled by environment variables defined by the board. The menu starts after running the 'preboot' environmnent variable (if enabled) and before handling the boot delay. - See README.bootmenu for more details. + See doc/usage/cmd/bootmenu.rst for more details. config BOOTMENU_DISABLE_UBOOT_CONSOLE bool "Disallow bootmenu to enter the U-Boot console" From d389efc44898f9b5b3d07e810253b6fb73c55e3c Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Thu, 3 Aug 2023 18:52:58 +0200 Subject: [PATCH 34/54] arm: dts: mediatek: convert gmac link mode to 2500base-x for r3 Ethernet on Bananapi-r3 is broken after commit bd70f3cea353 ("net: mediatek: add support for SGMII 1Gbps auto-negotiation mode") because changes from this commit were not applied to bpi-r3 devicetree too: commit aef54ea16cac ("arm: dts: medaitek: convert gmac link mode to 2500base-x") Signed-off-by: Frank Wunderlich Reviewed-by: Weijie Gao --- arch/arm/dts/mt7986a-bpi-r3-sd.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/mt7986a-bpi-r3-sd.dts b/arch/arm/dts/mt7986a-bpi-r3-sd.dts index 15256302b86..c156a813634 100644 --- a/arch/arm/dts/mt7986a-bpi-r3-sd.dts +++ b/arch/arm/dts/mt7986a-bpi-r3-sd.dts @@ -76,12 +76,12 @@ ð { status = "okay"; mediatek,gmac-id = <0>; - phy-mode = "sgmii"; + phy-mode = "2500base-x"; mediatek,switch = "mt7531"; reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; fixed-link { - speed = <1000>; + speed = <2500>; full-duplex; }; }; From 5986d46f8efb20532d494242fccb051267f92e1a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 19 Aug 2023 16:49:35 -0600 Subject: [PATCH 35/54] bootstd: Adjust the default bootmeth order The existing distro scripts check extlinux and scripts before EFI. Adjust the default ordering to do the same, to avoid breaking existing flows. Add some documentation, mentioning that this order will likely change in future. Signed-off-by: Simon Glass Reported-by: Da Xue --- boot/bootmeth_extlinux.c | 3 ++- boot/bootmeth_script.c | 3 ++- doc/develop/bootstd.rst | 8 +++++++- test/boot/bootflow.c | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c index 6b2b8400383..aa2a4591ebd 100644 --- a/boot/bootmeth_extlinux.c +++ b/boot/bootmeth_extlinux.c @@ -184,7 +184,8 @@ static const struct udevice_id extlinux_bootmeth_ids[] = { { } }; -U_BOOT_DRIVER(bootmeth_extlinux) = { +/* Put an number before 'extlinux' to provide a default ordering */ +U_BOOT_DRIVER(bootmeth_1extlinux) = { .name = "bootmeth_extlinux", .id = UCLASS_BOOTMETH, .of_match = extlinux_bootmeth_ids, diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c index a4050c384df..58c57a2d4b5 100644 --- a/boot/bootmeth_script.c +++ b/boot/bootmeth_script.c @@ -243,7 +243,8 @@ static const struct udevice_id script_bootmeth_ids[] = { { } }; -U_BOOT_DRIVER(bootmeth_script) = { +/* Put an number before 'script' to provide a default ordering */ +U_BOOT_DRIVER(bootmeth_2script) = { .name = "bootmeth_script", .id = UCLASS_BOOTMETH, .of_match = script_bootmeth_ids, diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst index ec313653578..c47de273ab1 100644 --- a/doc/develop/bootstd.rst +++ b/doc/develop/bootstd.rst @@ -132,6 +132,9 @@ above bootdev scanning. Controlling ordering -------------------- +By default, faster bootdevs (or those which are assumed to be faster) are used +first, since they are more likely to be able to boot the device quickly. + Several options are available to control the ordering of boot scanning: @@ -151,6 +154,10 @@ bootdevs and their sequence numbers. bootmeths ~~~~~~~~~ +By default bootmeths are checked in name order. Use `bootmeth list` to see the +ordering. Note that the `extlinux` and `script` bootmeth is first, to preserve the behaviour +used by the old distro scripts. + This environment variable can be used to control the list of bootmeths used and their ordering for example:: @@ -164,7 +171,6 @@ controlled by aliases. The :ref:`usage/cmd/bootmeth:bootmeth command` (`bootmeth order`) operates in the same way as setting this variable. - Bootdev uclass -------------- diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 8a4e090e9bc..1c91a942e98 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; -extern U_BOOT_DRIVER(bootmeth_script); +extern U_BOOT_DRIVER(bootmeth_2script); static int inject_response(struct unit_test_state *uts) { @@ -525,7 +525,7 @@ static int prep_mmc4_bootdev(struct unit_test_state *uts) /* Enable the script bootmeth too */ ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd)); - ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_script), + ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_2script), "bootmeth_script", 0, ofnode_null(), &dev)); /* Change the order to include mmc4 */ From b982a850d04c1fac04df676b28d93ad26f6984d0 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Mon, 21 Aug 2023 08:59:10 -0500 Subject: [PATCH 36/54] configs: Enable CONFIG_DM_SCSI in am57xx_hs_evm_usb This should have already been enabled but was missed when converting the base platform defconfig, fix this here. Fixes: 3c5aa6caccab ("configs: Enable CONFIG_BLK in am57xx_evm and am57xx_hs_evm") Signed-off-by: Andrew Davis Reviewed-by: Tom Rini Reviewed-by: Simon Glass --- configs/am57xx_hs_evm_usb_defconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig index 404e714d4f0..9ed59ac9aec 100644 --- a/configs/am57xx_hs_evm_usb_defconfig +++ b/configs/am57xx_hs_evm_usb_defconfig @@ -70,7 +70,7 @@ CONFIG_NET_RETRY_COUNT=10 CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y -CONFIG_SCSI_AHCI=y +CONFIG_DWC_AHCI=y CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_USB_FUNCTION_FASTBOOT=y @@ -102,7 +102,7 @@ CONFIG_PMIC_PALMAS=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_PALMAS=y CONFIG_PALMAS_POWER=y -CONFIG_SCSI_AHCI_PLAT=y +CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y From dcde1f95bfa6d634f0cf7b7c0f6f71b3c08c6fa2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 21 Aug 2023 20:38:23 +0100 Subject: [PATCH 37/54] configs: set CONFIG_LMB_MAX_REGIONS=64 for MT7988 boards Similar to MT7981 and MT7986 also MT7988 can have a high number of reserved-memory regions used by the various hardware offloading subsystems. Raise CONFIG_LMB_MAX_REGIONS to 64 to avoid errors when trying to boot Linux with more then 6 reserved regions: ERROR: reserving fdt memory region failed (addr=4f700000 size=240000 flags=4) ERROR: reserving fdt memory region failed (addr=15194000 size=1000 flags=4) ERROR: reserving fdt memory region failed (addr=15294000 size=1000 flags=4) ERROR: reserving fdt memory region failed (addr=15394000 size=1000 flags=4) ERROR: Failed to allocate 0xb161 bytes below 0x80000000. device tree - allocation error Fixes: bc4adc97cfb ("board: mediatek: add MT7988 reference boards") Reported-by: Lorenzo Bianconi Signed-off-by: Daniel Golle --- configs/mt7988_rfb_defconfig | 1 + configs/mt7988_sd_rfb_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/mt7988_rfb_defconfig b/configs/mt7988_rfb_defconfig index dc97bb36ea7..ced52edecf0 100644 --- a/configs/mt7988_rfb_defconfig +++ b/configs/mt7988_rfb_defconfig @@ -81,3 +81,4 @@ CONFIG_MTK_SPIM=y CONFIG_LZO=y CONFIG_HEXDUMP=y # CONFIG_EFI_LOADER is not set +CONFIG_LMB_MAX_REGIONS=64 diff --git a/configs/mt7988_sd_rfb_defconfig b/configs/mt7988_sd_rfb_defconfig index 421999da869..670f5eae185 100644 --- a/configs/mt7988_sd_rfb_defconfig +++ b/configs/mt7988_sd_rfb_defconfig @@ -69,3 +69,4 @@ CONFIG_MTK_SPIM=y CONFIG_LZO=y CONFIG_HEXDUMP=y # CONFIG_EFI_LOADER is not set +CONFIG_LMB_MAX_REGIONS=64 From 04f7e9538557072500d96447438a4d35f2a64204 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 20 Aug 2023 13:31:26 -0400 Subject: [PATCH 38/54] Azure: Set the timeout for jobs to the maximum As per current Azure Pipelines documentation we qualify for 3600 minutes per job, if specified, as the timeout. The default unspecified timeout is 60 minutes. Rework things to specify 0 as the timeout (and so maximum allowed) so that we don't have failures due to running slightly past 60 minutes total. Link: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#timeouts Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- .azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 53a83eef7db..0304be8a60f 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -468,6 +468,7 @@ stages: - stage: world_build jobs: - job: build_the_world + timeoutInMinutes: 0 # Use the maximum allowed displayName: 'Build the World' pool: vmImage: $(ubuntu_vm) From 70bd47198402f5faea381428639ced55e893f70b Mon Sep 17 00:00:00 2001 From: Oleksandr Suvorov Date: Wed, 23 Aug 2023 17:56:27 +0300 Subject: [PATCH 39/54] spl: crypto: fix including SHA* object files in SPL If one of SHA* algorithms is disabled in u-boot, its code is not included in SPL even if a given SHA* option is enabled in SPL. Fix this. Fixes: 603d15a572d ("spl: cypto: Bring back SPL_ versions of SHA") Signed-off-by: Oleksandr Suvorov Reviewed-by: Tom Rini --- lib/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 8d8ccc8bbc3..9fa573525b8 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -72,9 +72,9 @@ obj-$(CONFIG_ECDSA) += ecdsa/ obj-$(CONFIG_$(SPL_)RSA) += rsa/ obj-$(CONFIG_HASH) += hash-checksum.o obj-$(CONFIG_BLAKE2) += blake2/blake2b.o -obj-$(CONFIG_SHA1) += sha1.o -obj-$(CONFIG_SHA256) += sha256.o -obj-$(CONFIG_SHA512) += sha512.o +obj-$(CONFIG_$(SPL_)SHA1) += sha1.o +obj-$(CONFIG_$(SPL_)SHA256) += sha256.o +obj-$(CONFIG_$(SPL_)SHA512) += sha512.o obj-$(CONFIG_CRYPT_PW) += crypt/ obj-$(CONFIG_$(SPL_)ASN1_DECODER) += asn1_decoder.o From fa140172cb6e98ee8a820289e5106cbfbdcc79c3 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 24 Aug 2023 00:12:47 +0200 Subject: [PATCH 40/54] MAINTAINERS: remove Wolfgang Denk Signed-off-by: Heinrich Schuchardt --- MAINTAINERS | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 84de9de5319..17309e25f28 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1015,7 +1015,6 @@ F: tools/mkeficapsule.c ENVIRONMENT M: Joe Hershberger -R: Wolfgang Denk S: Maintained F: env/ F: include/env* @@ -1025,7 +1024,6 @@ F: tools/mkenvimage.c ENVIRONMENT AS TEXT M: Simon Glass -R: Wolfgang Denk S: Maintained F: doc/usage/environment.rst F: scripts/env2string.awk @@ -1343,8 +1341,7 @@ F: drivers/power/ F: include/power/ POWERPC -M: Wolfgang Denk -S: Maintained +S: Orphan (Since 2022-10-21) F: arch/powerpc/ POWERPC MPC8XX From 98244a85507d7ba77ffab56d458eef25629271ec Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 23 Aug 2023 19:18:01 -0600 Subject: [PATCH 41/54] imx: Drop unneeded phandle in FIT template Adding a phandle to a template node is not allowed, since when the node is instantiated multiple times, we end up with duplicate phandles. Drop this invalid constructs. Signed-off-by: Simon Glass Acked-by: Tim Harvey --- arch/arm/dts/imx8mm-cl-iot-gate-optee-u-boot.dtsi | 2 ++ arch/arm/dts/imx8mm-u-boot.dtsi | 2 +- arch/arm/dts/imx8mn-u-boot.dtsi | 2 +- arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi | 2 ++ arch/arm/dts/imx8mp-u-boot.dtsi | 4 ++-- arch/arm/dts/imx8qm-u-boot.dtsi | 2 +- arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 8 ++++---- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/arm/dts/imx8mm-cl-iot-gate-optee-u-boot.dtsi b/arch/arm/dts/imx8mm-cl-iot-gate-optee-u-boot.dtsi index 484e31824b8..d93e1cbd8a7 100644 --- a/arch/arm/dts/imx8mm-cl-iot-gate-optee-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-cl-iot-gate-optee-u-boot.dtsi @@ -41,9 +41,11 @@ }; }; +/* This cannot work since it refers to a template node &binman_configuration { loadables = "atf", "fip"; }; +*/ &fec1 { phy-reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>; diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi index 035282bf0b0..6085128e24e 100644 --- a/arch/arm/dts/imx8mm-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-u-boot.dtsi @@ -140,7 +140,7 @@ configurations { default = "@config-DEFAULT-SEQ"; - binman_configuration: @config-SEQ { + @config-SEQ { description = "NAME"; fdt = "fdt-SEQ"; firmware = "uboot"; diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi index 5046b38e4e2..bc57566a108 100644 --- a/arch/arm/dts/imx8mn-u-boot.dtsi +++ b/arch/arm/dts/imx8mn-u-boot.dtsi @@ -204,7 +204,7 @@ configurations { default = "@config-DEFAULT-SEQ"; - binman_configuration: @config-SEQ { + @config-SEQ { description = "NAME"; fdt = "fdt-SEQ"; firmware = "uboot"; diff --git a/arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi b/arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi index f3fb44046d5..c4ea536b29b 100644 --- a/arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi @@ -162,6 +162,8 @@ }; }; +/* This cannot work since it refers to a template node &binman_configuration { loadables = "atf", "fip"; }; +*/ diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi index 36e7444a627..200938a9807 100644 --- a/arch/arm/dts/imx8mp-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-u-boot.dtsi @@ -146,7 +146,7 @@ type = "flat_dt"; compression = "none"; - uboot_fdt_blob: blob-ext { + blob-ext { filename = "u-boot.dtb"; }; }; @@ -155,7 +155,7 @@ configurations { default = "@config-DEFAULT-SEQ"; - binman_configuration: @config-SEQ { + @config-SEQ { description = "NAME"; fdt = "fdt-SEQ"; firmware = "uboot"; diff --git a/arch/arm/dts/imx8qm-u-boot.dtsi b/arch/arm/dts/imx8qm-u-boot.dtsi index a3e0af48109..d316e869516 100644 --- a/arch/arm/dts/imx8qm-u-boot.dtsi +++ b/arch/arm/dts/imx8qm-u-boot.dtsi @@ -112,7 +112,7 @@ configurations { default = "@config-DEFAULT-SEQ"; - binman_configuration: @config-SEQ { + @config-SEQ { description = "NAME"; fdt = "fdt-SEQ"; firmware = "uboot"; diff --git a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi index 3ecb461b011..64318d09cf0 100644 --- a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +++ b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi @@ -41,7 +41,7 @@ os = "arm-trusted-firmware"; load = ; entry = ; - atf: atf-bl31 { + atf-bl31 { }; }; @@ -53,7 +53,7 @@ os = "tee"; load = <0x9e800000>; entry = <0x9e800000>; - tee: tee-os { + tee-os { }; }; @@ -78,7 +78,7 @@ compression = "none"; load = ; entry = ; - u_boot_spl_nodtb: blob-ext { + blob-ext { filename = "spl/u-boot-spl-nodtb.bin"; }; }; @@ -88,7 +88,7 @@ type = "flat_dt"; arch = "arm"; compression = "none"; - spl_am65x_evm_dtb: blob-ext { + blob-ext { filename = "spl/dts/k3-am65-iot2050-spl.dtb"; }; }; From bbbf04cc7da1b60ed6b342700ec366f27d49546e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 23 Aug 2023 19:18:02 -0600 Subject: [PATCH 42/54] Revert "binman: Add a temporary hack for duplicate phandles" The affected boards have been fixed, so drop this hack. This reverts commit 288ae53cb73605500b7fc01e5919753c878466be. Signed-off-by: Simon Glass Acked-by: Tim Harvey --- Makefile | 6 ------ tools/binman/cmdline.py | 2 -- tools/binman/control.py | 5 ----- tools/dtoc/fdt.py | 12 ++++-------- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 9b90204bfe6..033daf1695c 100644 --- a/Makefile +++ b/Makefile @@ -1328,11 +1328,6 @@ u-boot.ldr: u-boot # Use 'make BINMAN_VERBOSE=3' to set vebosity level default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE)) -# Temporary workaround for Venice boards -ifneq ($(CONFIG_TARGET_IMX8MM_VENICE),$(CONFIG_TARGET_IMX8MN_VENICE),$(CONFIG_TARGET_IMX8MP_VENICE),) -ignore_dups := --ignore-dup-phandles -endif - quiet_cmd_binman = BINMAN $@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ $(foreach f,$(BINMAN_TOOLPATHS),--toolpath $(f)) \ @@ -1354,7 +1349,6 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ -a spl-dtb=$(CONFIG_SPL_OF_REAL) \ -a tpl-dtb=$(CONFIG_TPL_OF_REAL) \ -a pre-load-key-path=${PRE_LOAD_KEY_PATH} \ - $(ignore_dups) \ $(BINMAN_$(@F)) OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py index 39c61c2c032..9632ec115e5 100644 --- a/tools/binman/cmdline.py +++ b/tools/binman/cmdline.py @@ -126,8 +126,6 @@ controlled by a description in the board device tree.''' help='Comma-separated list of bintools to consider missing (for testing)') build_parser.add_argument('-i', '--image', type=str, action='append', help='Image filename to build (if not specified, build all)') - build_parser.add_argument('--ignore-dup-phandles', action='store_true', - help='Temporary option to ignore duplicate phandles') build_parser.add_argument('-I', '--indir', action='append', help='Add a path to the list of directories to use for input files') build_parser.add_argument('-m', '--map', action='store_true', diff --git a/tools/binman/control.py b/tools/binman/control.py index 45948955812..c6d3205b8c2 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -22,7 +22,6 @@ from binman import bintool from binman import cbfs_util from binman import elf from binman import entry -from dtoc import fdt from dtoc import fdt_util from u_boot_pylib import command from u_boot_pylib import tools @@ -817,10 +816,6 @@ def Binman(args): cbfs_util.VERBOSE = args.verbosity > 2 state.use_fake_dtb = args.fake_dtb - # Temporary hack - if args.ignore_dup_phandles: # pragma: no cover - fdt.IGNORE_DUP_PHANDLES = True - # Normally we replace the 'u-boot' etype with 'u-boot-expanded', etc. # When running tests this can be disabled using this flag. When not # updating the FDT in image, it is not needed by binman, but we use it diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 0b20d52f313..5963925146a 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -15,9 +15,6 @@ from libfdt import QUIET_NOTFOUND from u_boot_pylib import tools from u_boot_pylib import tout -# Temporary hack -IGNORE_DUP_PHANDLES = False - # This deals with a device tree, presenting it as an assortment of Node and # Prop objects, representing nodes and properties, respectively. This file # contains the base classes and defines the high-level API. You can use @@ -342,11 +339,10 @@ class Node: if phandle: dup = self._fdt.phandle_to_node.get(phandle) if dup: - if not IGNORE_DUP_PHANDLES: - raise ValueError( - f'Duplicate phandle {phandle} in nodes {dup.path} and {self.path}') - else: - self._fdt.phandle_to_node[phandle] = self + raise ValueError( + f'Duplicate phandle {phandle} in nodes {dup.path} and {self.path}') + + self._fdt.phandle_to_node[phandle] = self offset = fdt_obj.first_subnode(self.Offset(), QUIET_NOTFOUND) while offset >= 0: From c91feda87ce33c81acc51cc4bf69d613c4fe89de Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Fri, 25 Aug 2023 16:47:11 +0300 Subject: [PATCH 43/54] Revert "arm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee" This reverts commit c5b68ef8af3c2f515c1f5b8d63a69359a85d753b. CONFIG_OPTEE_TZDRAM_SIZE is used by imx6-based SoCs as well. Move the option back. Signed-off-by: Ricardo Salveti Signed-off-by: Oleksandr Suvorov --- arch/arm/mach-imx/mx7/Kconfig | 8 -------- lib/optee/Kconfig | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-imx/mx7/Kconfig b/arch/arm/mach-imx/mx7/Kconfig index 0bb18f65200..3c0208e13dd 100644 --- a/arch/arm/mach-imx/mx7/Kconfig +++ b/arch/arm/mach-imx/mx7/Kconfig @@ -24,14 +24,6 @@ config SPL_TEXT_BASE depends on SPL default 0x00912000 -config OPTEE_TZDRAM_SIZE - hex "Amount of Trust-Zone RAM for the OPTEE image" - default 0x0000000 - depends on OPTEE_LIB - help - The size of pre-allocated Trust Zone DRAM to allocate for the OPTEE - runtime. - choice prompt "MX7 board select" optional diff --git a/lib/optee/Kconfig b/lib/optee/Kconfig index 517136a4485..e6834d4d3e1 100644 --- a/lib/optee/Kconfig +++ b/lib/optee/Kconfig @@ -11,6 +11,14 @@ config OPTEE_IMAGE This option enable the OPTEE specific checks done before booting an OPTEE image created with mkimage +config OPTEE_TZDRAM_SIZE + hex "Amount of Trust-Zone RAM for the OPTEE image" + default 0x0000000 + depends on OPTEE_LIB + help + The size of pre-allocated Trust Zone DRAM to allocate for the OPTEE + runtime. + config BOOTM_OPTEE bool "Support OPTEE bootm command" select BOOTM_LINUX From 6a407076b284881fae548abfcd37989fba265a98 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 28 Aug 2023 21:13:32 +0200 Subject: [PATCH 44/54] dm: event: document all events Provide Sphinx documentation for all events. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/event.h | 97 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 91 insertions(+), 6 deletions(-) diff --git a/include/event.h b/include/event.h index bb38ba98e73..f5c5d30a645 100644 --- a/include/event.h +++ b/include/event.h @@ -19,29 +19,114 @@ * @EVT_DM_PRE_PROBE: Device is about to be probed */ enum event_t { - EVT_NONE, + /** + * @EVT_NONE: This zero value is not used for events. + */ + EVT_NONE = 0, + + /** + * @EVT_TEST: This event is used in unit tests. + */ EVT_TEST, - /* Events related to driver model */ + /** + * @EVT_DM_POST_INIT_F: + * This event is triggered after pre-relocation initialization of the + * driver model. Its parameter is NULL. + * A non-zero return code from the event handler let's the boot process + * fail. + */ EVT_DM_POST_INIT_F, + + /** + * @EVT_DM_POST_INIT_R: + * This event is triggered after post-relocation initialization of the + * driver model. Its parameter is NULL. + * A non-zero return code from the event handler let's the boot process + * fail. + */ EVT_DM_POST_INIT_R, + + /** + * @EVT_DM_PRE_PROBE: + * This event is triggered before probing a device. Its parameter is the + * device to be probed. + * A non-zero return code from the event handler lets the device not + * being probed. + */ EVT_DM_PRE_PROBE, + + /** + * @EVT_DM_POST_PROBE: + * This event is triggered after probing a device. Its parameter is the + * device that was probed. + * A non-zero return code from the event handler leaves the device in + * the unprobed state and therefore not usable. + */ EVT_DM_POST_PROBE, + + /** + * @EVT_DM_PRE_REMOVE: + * This event is triggered after removing a device. Its parameter is + * the device to be removed. + * A non-zero return code from the event handler stops the removal of + * the device before any changes. + */ EVT_DM_PRE_REMOVE, + + /** + * @EVT_DM_POST_REMOVE: + * This event is triggered before removing a device. Its parameter is + * the device that was removed. + * A non-zero return code stops from the event handler the removal of + * the device after all removal changes. The previous state is not + * restored. All children will be gone and the device may not be + * functional. + */ EVT_DM_POST_REMOVE, - /* Init hooks */ + /** + * @EVT_MISC_INIT_F: + * This event is triggered during the initialization sequence before + * relocation. Its parameter is NULL. + * A non-zero return code from the event handler let's the boot process + * fail. + */ EVT_MISC_INIT_F, - /* Fpga load hook */ + /** + * @EVT_FPGA_LOAD: + * The FPGA load hook is called after loading an FPGA with a new binary. + * Its parameter is of type struct event_fpga_load and contains + * information about the loaded image. + */ EVT_FPGA_LOAD, - /* Device tree fixups before booting */ + /** + * @EVT_FT_FIXUP: + * This event is triggered during device-tree fix up after all + * other device-tree fixups have been executed. + * Its parameter is of type struct event_ft_fixup which contains + * the address of the device-tree to fix up and the list of images to be + * booted. + * A non-zero return code from the event handler let's booting the + * images fail. + */ EVT_FT_FIXUP, - /* To be called once, before calling main_loop() */ + /** + * @EVT_MAIN_LOOP: + * This event is triggered immediately before calling main_loop() which + * is the entry point of the command line. Its parameter is NULL. + * A non-zero return value causes the boot to fail. + */ EVT_MAIN_LOOP, + /** + * @EVT_COUNT: + * This constants holds the maximum event number + 1 and is used when + * looping over all event classes. + */ EVT_COUNT }; From 91f19550d108b1b02c1d02ddbcb4d78cbdd299ce Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 28 Aug 2023 21:13:33 +0200 Subject: [PATCH 45/54] doc: add events.h to documentation Add the events.h include to the API documentation. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- doc/api/event.rst | 9 +++++++++ doc/api/index.rst | 1 + 2 files changed, 10 insertions(+) create mode 100644 doc/api/event.rst diff --git a/doc/api/event.rst b/doc/api/event.rst new file mode 100644 index 00000000000..8a57d438322 --- /dev/null +++ b/doc/api/event.rst @@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Events +====== + +The concept of events is decribed :doc:`here <../develop/event>`. + +.. kernel-doc:: include/event.h + :internal: diff --git a/doc/api/index.rst b/doc/api/index.rst index 3a80ae0635a..2f0218c47a3 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -10,6 +10,7 @@ U-Boot API documentation dfu dm efi + event getopt linker_lists lmb From 0926de236221dedcd4cf9b4f461198de14bea01d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 28 Aug 2023 22:40:47 +0200 Subject: [PATCH 46/54] video: fix typo in video_sync_all documentation %s/there/their/ Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- include/video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/video.h b/include/video.h index 269915160b4..16f7a83f8d5 100644 --- a/include/video.h +++ b/include/video.h @@ -260,7 +260,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, int video_sync(struct udevice *vid, bool force); /** - * video_sync_all() - Sync all devices' frame buffers with there hardware + * video_sync_all() - Sync all devices' frame buffers with their hardware * * This calls video_sync() on all active video devices. */ From 4d1fea9ad1184a03c45836c3ba54c021ef795df1 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Tue, 29 Aug 2023 00:01:53 +0200 Subject: [PATCH 47/54] doc: board: toradex: minor documentation update - Update SPDX-License-Identifier from obsolete GPL-2.0+ to GPL-2.0-or-later. - Add links to product websites of SoM and carrier board where missing. - Add information about update U-Boot wrapper where missing. - Add sectionauthor where missing. - Update information about imx-seco from version 3.7.4 to 3.8.1. - Various minor grammatic and spelling fixes. - Improve whitespace by adding or removing new lines. - Change from code-block for output to just Output::. Signed-off-by: Marcel Ziswiler --- doc/board/toradex/apalis-imx8.rst | 22 +++++++++++++---- doc/board/toradex/colibri-imx8x.rst | 31 ++++++++++++++++------- doc/board/toradex/colibri_imx7.rst | 38 +++++++++++++++-------------- doc/board/toradex/verdin-am62.rst | 8 +++--- doc/board/toradex/verdin-imx8mm.rst | 9 +++---- doc/board/toradex/verdin-imx8mp.rst | 9 +++---- 6 files changed, 71 insertions(+), 46 deletions(-) diff --git a/doc/board/toradex/apalis-imx8.rst b/doc/board/toradex/apalis-imx8.rst index 849b1172bd4..ffc4c7d222a 100644 --- a/doc/board/toradex/apalis-imx8.rst +++ b/doc/board/toradex/apalis-imx8.rst @@ -1,7 +1,11 @@ -.. SPDX-License-Identifier: GPL-2.0+ +.. SPDX-License-Identifier: GPL-2.0-or-later +.. sectionauthor:: Marcel Ziswiler -Apalis iMX8QM V1.0B Module -========================== +Apalis iMX8 Module +================== + +- SoM: https://www.toradex.com/computer-on-modules/apalis-arm-family/nxp-imx-8 +- Carrier board: https://www.toradex.com/products/carrier-board/apalis-evaluation-board Quick Start ----------- @@ -49,6 +53,7 @@ Copy the following firmware to the U-Boot folder: Build U-Boot ------------ + .. code-block:: bash $ make apalis-imx8_defconfig @@ -61,8 +66,8 @@ Get the latest version of the universal update utility (uuu) aka ``mfgtools 3.0` https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2FNXPmicro%2Fmfgtools%2Freleases -Put the module into USB recovery aka serial downloader mode, connect USB device -to your host and execute uuu: +Put the module into USB recovery aka serial downloader mode, connect the USB +device to your host and execute ``uuu``: .. code-block:: bash @@ -80,3 +85,10 @@ partition and boot: setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 mmc dev 0 1 mmc write ${loadaddr} 0x0 ${blkcnt} + +As a convenience, instead of the last three commands, one may also use the +update U-Boot wrapper: + +.. code-block:: bash + + > run update_uboot diff --git a/doc/board/toradex/colibri-imx8x.rst b/doc/board/toradex/colibri-imx8x.rst index 545568c844a..9e61d98c6b1 100644 --- a/doc/board/toradex/colibri-imx8x.rst +++ b/doc/board/toradex/colibri-imx8x.rst @@ -1,7 +1,11 @@ -.. SPDX-License-Identifier: GPL-2.0+ +.. SPDX-License-Identifier: GPL-2.0-or-later +.. sectionauthor:: Marcel Ziswiler -Colibri iMX8QXP V1.0D Module -============================ +Colibri iMX8X Module +==================== + +- SoM: https://www.toradex.com/computer-on-modules/colibri-arm-family/nxp-imx-8x +- Carrier board: https://www.toradex.com/products/carrier-board/colibri-evaluation-board Quick Start ----------- @@ -23,18 +27,19 @@ Get and Build the ARM Trusted Firmware Get scfw_tcm.bin and ahab-container.img --------------------------------------- + .. code-block:: bash $ wget https://github.com/toradex/i.MX-System-Controller-Firmware/raw/master/src/scfw_export_mx8qx_b0/build_mx8qx_b0/mx8qx-colibri-scfw-tcm.bin - $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-3.7.4.bin - $ sh imx-seco-3.7.4.bin --auto-accept + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-3.8.1.bin + $ sh imx-seco-3.8.1.bin --auto-accept Copy the following firmware to the U-Boot folder: .. code-block:: bash $ cp imx-atf/build/imx8qx/release/bl31.bin . - $ cp imx-seco-3.7.4/firmware/seco/mx8qxc0-ahab-container.img mx8qx-ahab-container.img + $ cp imx-seco-3.8.1/firmware/seco/mx8qxc0-ahab-container.img mx8qx-ahab-container.img Build U-Boot ------------ @@ -51,8 +56,8 @@ Get the latest version of the universal update utility (uuu) aka ``mfgtools 3.0` https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2FNXPmicro%2Fmfgtools%2Freleases -Put the module into USB recovery aka serial downloader mode, connect USB device -to your host and execute ``uuu``: +Put the module into USB recovery aka serial downloader mode, connect the USB +device to your host and execute ``uuu``: .. code-block:: bash @@ -61,7 +66,8 @@ to your host and execute ``uuu``: Flash the U-Boot Binary into the eMMC ------------------------------------- -Burn the ``u-boot-dtb.imx`` binary to the primary eMMC hardware boot area partition: +Burn the ``u-boot-dtb.imx`` binary to the primary eMMC hardware boot area +partition and boot: .. code-block:: bash @@ -69,3 +75,10 @@ Burn the ``u-boot-dtb.imx`` binary to the primary eMMC hardware boot area partit setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 mmc dev 0 1 mmc write ${loadaddr} 0x0 ${blkcnt} + +As a convenience, instead of the last three commands, one may also use the +update U-Boot wrapper: + +.. code-block:: bash + + > run update_uboot diff --git a/doc/board/toradex/colibri_imx7.rst b/doc/board/toradex/colibri_imx7.rst index a30e721379e..6532878932c 100644 --- a/doc/board/toradex/colibri_imx7.rst +++ b/doc/board/toradex/colibri_imx7.rst @@ -1,7 +1,11 @@ -.. SPDX-License-Identifier: GPL-2.0+ +.. SPDX-License-Identifier: GPL-2.0-or-later +.. sectionauthor:: Igor Opaniuk -Colibri iMX7 -============ +Colibri iMX7 Modules +==================== + +- SoM: https://www.toradex.com/computer-on-modules/colibri-arm-family/nxp-freescale-imx7 +- Carrier board: https://www.toradex.com/products/carrier-board/colibri-evaluation-board Quick Start ----------- @@ -21,11 +25,11 @@ Build U-Boot $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig $ make -After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific -image, ready for flashing (but check next section for additional +After the build succeeds, you will obtain the final ``u-boot-dtb.imx`` IMX +specific image, ready for flashing (but check next section for additional adjustments). -Final IMX program image includes (section ``6.6.7`` from `IMX7DRM +The final IMX program image includes (section ``6.6.7`` from `IMX7DRM `_): * **Image vector table** (IVT) for BootROM @@ -34,21 +38,20 @@ Final IMX program image includes (section ``6.6.7`` from `IMX7DRM * **Device configuration data** * **User image**: U-Boot image (``u-boot-dtb.bin``) - IMX image adjustments prior to flashing --------------------------------------- 1. U-Boot for both Colibri iMX7 NAND and eMMC versions is built with HABv4 support (`AN4581.pdf `_) -enabled by default, which requires to generate a proper +enabled by default, which requires generating a proper Command Sequence File (CSF) by srktool from NXP (not included in the U-Boot tree, check additional details in introduction_habv4.txt) and concatenate it to the final ``u-boot-dtb.imx``. -2. In case if you don't want to generate a proper ``CSF`` (for any reason), -you still need to pad the IMX image so i has the same size as specified in -in **Boot Data** section of IMX image. +2. In case you don't want to generate a proper ``CSF`` (for any reason), +you still need to pad the IMX image so it has the same size as specified in +the **Boot Data** section of the IMX image. To obtain this value, run: .. code-block:: bash @@ -78,11 +81,11 @@ and then pad the image: $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \ u-boot-dtb.imx u-boot-dtb.imx.zero-padded -3. Also, according to requirement from ``6.6.7.1``, the final image -should have ``0x400`` offset for initial IVT table. +3. Also, according to the requirement from ``6.6.7.1``, the final image +should have ``0x400`` offset for the initial IVT table. -For eMMC setup we handle this by flashing it to ``0x400``, howewer -for NAND setup we adjust the image prior to flashing, adding padding in the +For eMMC setup we handle this by flashing it to ``0x400``, however +for NAND setup we adjust the image prior to flashing, adding padding at the beginning of the image. .. code-block:: bash @@ -97,7 +100,6 @@ boot area partition: .. code-block:: bash - => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 => mmc dev 0 1 @@ -117,8 +119,8 @@ Flash U-Boot IMX image to NAND Using update_uboot script ------------------------- -You can also usb U-Boot env update_uboot script, -which wraps all eMMC/NAND specific command invocation: +You can also use U-Boot env update_uboot script, +which wraps all eMMC/NAND specific command invocations: .. code-block:: bash diff --git a/doc/board/toradex/verdin-am62.rst b/doc/board/toradex/verdin-am62.rst index 36db149cda0..ecc7e0777cb 100644 --- a/doc/board/toradex/verdin-am62.rst +++ b/doc/board/toradex/verdin-am62.rst @@ -24,12 +24,14 @@ For an overview of the TI AM62 SoC boot flow please head over to: Sources: -------- + .. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_boot_sources :end-before: .. k3_rst_include_end_boot_sources Build procedure: ---------------- + 0. Setup the environment variables: .. include:: ../ti/k3.rst @@ -50,7 +52,7 @@ Set the variables corresponding to this platform: $ export UBOOT_CFG_CORTEXR=verdin-am62_r5_defconfig $ export UBOOT_CFG_CORTEXA=verdin-am62_a53_defconfig $ export TFA_BOARD=lite - $ # we dont use any extra TFA parameters + $ # we don't use any extra TFA parameters $ unset TFA_EXTRA_ARGS $ export OPTEE_PLATFORM=k3-am62x $ export OPTEE_EXTRA_ARGS="CFG_WITH_SOFTWARE_PRNG=y" @@ -75,9 +77,7 @@ Flash to eMMC Boot ---- -Output: - -.. code-block:: none +Output:: U-Boot SPL 2023.10-rc1-00210-gb678170a34c (Aug 03 2023 - 00:09:14 +0200) SYSFW ABI: 3.1 (firmware rev 0x0009 '9.0.1--v09.00.01 (Kool Koala)') diff --git a/doc/board/toradex/verdin-imx8mm.rst b/doc/board/toradex/verdin-imx8mm.rst index cc39030450f..6e150e9aec7 100644 --- a/doc/board/toradex/verdin-imx8mm.rst +++ b/doc/board/toradex/verdin-imx8mm.rst @@ -46,6 +46,7 @@ Get the DDR Firmware Build U-Boot ------------ + .. code-block:: bash $ export CROSS_COMPILE=aarch64-linux-gnu- @@ -61,7 +62,7 @@ Flash to eMMC > setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 > mmc dev 0 1 && mmc write ${loadaddr} 0x2 ${blkcnt} -As a convenience, instead of the last two commands one may also use the update +As a convenience, instead of the last two commands, one may also use the update U-Boot wrapper: .. code-block:: bash @@ -71,16 +72,14 @@ U-Boot wrapper: Boot ---- -ATF, U-Boot proper and u-boot.dtb images are packed into FIT image, +ATF, U-Boot proper and u-boot.dtb images are packed into a FIT image, which is loaded and parsed by SPL. Boot sequence is: * SPL ---> ATF (TF-A) ---> U-Boot proper -Output: - -.. code-block:: none +Output:: U-Boot SPL 2021.10-rc2-00028-gee010ba1129 (Aug 23 2021 - 16:56:02 +0200) Normal Boot diff --git a/doc/board/toradex/verdin-imx8mp.rst b/doc/board/toradex/verdin-imx8mp.rst index bdc4d0c2cb5..9ee605f64d5 100644 --- a/doc/board/toradex/verdin-imx8mp.rst +++ b/doc/board/toradex/verdin-imx8mp.rst @@ -46,6 +46,7 @@ Get the DDR Firmware Build U-Boot ------------ + .. code-block:: bash $ export CROSS_COMPILE=aarch64-linux-gnu- @@ -61,7 +62,7 @@ Flash to eMMC > setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 > mmc dev 2 1 && mmc write ${loadaddr} 0x0 ${blkcnt} -As a convenience, instead of the last two commands one may also use the update +As a convenience, instead of the last two commands, one may also use the update U-Boot wrapper: .. code-block:: bash @@ -71,16 +72,14 @@ U-Boot wrapper: Boot ---- -ATF, U-Boot proper and u-boot.dtb images are packed into FIT image, +ATF, U-Boot proper and u-boot.dtb images are packed into a FIT image, which is loaded and parsed by SPL. Boot sequence is: * SPL ---> ATF (TF-A) ---> U-Boot proper -Output: - -.. code-block:: none +Output:: U-Boot SPL 2022.04-rc1-00164-g21a0312611-dirty (Feb 07 2022 - 11:34:04 +0100) Quad die, dual rank failed, attempting dual die, single rank configuration. From b4b7eed4994413f1d02596593b8c4c1143bee142 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Tue, 29 Aug 2023 00:01:54 +0200 Subject: [PATCH 48/54] doc: board: toradex: verdin-am62: document update u-boot wrapper Now with the update U-Boot wrappers having been sorted out, document their usage. Signed-off-by: Marcel Ziswiler --- doc/board/toradex/verdin-am62.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/board/toradex/verdin-am62.rst b/doc/board/toradex/verdin-am62.rst index ecc7e0777cb..e8d90273288 100644 --- a/doc/board/toradex/verdin-am62.rst +++ b/doc/board/toradex/verdin-am62.rst @@ -74,6 +74,20 @@ Flash to eMMC => fatload mmc 1 ${loadaddr} u-boot.img => mmc write ${loadaddr} 0x1400 0x2000 +As a convenience, instead of having to remember all those addresses and sizes, +one may also use the update U-Boot wrappers: + +.. code-block:: bash + + > tftpboot ${loadaddr} tiboot3-am62x-gp-verdin.bin + > run update_tiboot3 + + > tftpboot ${loadaddr} tispl.bin + > run update_tispl + + > tftpboot ${loadaddr} u-boot.img + > run update_uboot + Boot ---- From 1fa11cdcfebe7f2477ad383971b5abbe3525a015 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Thu, 31 Aug 2023 10:51:34 -0600 Subject: [PATCH 49/54] cmd: gpt: Remove confusing help text This help text appears to be a fragment of the text shown when CONFIG_CMD_GPT_RENAME is enabled, but is confusing so remove it. Signed-off-by: Joshua Watt Reviewed-by: Heinrich Schuchardt --- cmd/gpt.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/gpt.c b/cmd/gpt.c index 964056bd28b..fe9e06681ce 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -1060,8 +1060,6 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, " gpt_partition_name, gpt_partition_entry\n" " gpt enumerate mmc 0\n" " - store list of partitions to gpt_partition_list environment variable\n" - " read \n" - " - read GPT into a data structure for manipulation\n" " gpt guid \n" " - print disk GUID\n" " gpt guid \n" From 44c5d7764bf458ef0a8093ddf3422dfebbf7b00c Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Thu, 31 Aug 2023 10:51:35 -0600 Subject: [PATCH 50/54] doc: Add gpt command documentation Adds initial documentation for the gpt command Signed-off-by: Joshua Watt --- doc/usage/cmd/gpt.rst | 184 ++++++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + 2 files changed, 185 insertions(+) create mode 100644 doc/usage/cmd/gpt.rst diff --git a/doc/usage/cmd/gpt.rst b/doc/usage/cmd/gpt.rst new file mode 100644 index 00000000000..6387c8116fe --- /dev/null +++ b/doc/usage/cmd/gpt.rst @@ -0,0 +1,184 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +gpt command +=========== + +Synopsis +-------- + +:: + + gpt enumerate + gpt guid [] + gpt read [] + gpt rename + gpt repair + gpt setenv + gpt swap + gpt verify [] + gpt write + +Description +----------- + +The gpt command lets users read, create, modify, or verify the GPT (GUID +Partition Table) partition layout. + +Common arguments: + +interface + interface for accessing the block device (mmc, sata, scsi, usb, ....) + +dev + device number + +partition string + Describes the GPT partition layout for a disk. The syntax is similar to + the one used by the :doc:`mbr command ` command. The string contains + one or more partition descriptors, each separated by a ";". Each descriptor + contains one or more fields, with each field separated by a ",". Fields are + either of the form "key=value" to set a specific value, or simple "flag" to + set a boolean flag + + The first descriptor can optionally be used to describe parameters for the + whole disk with the following fields: + + * uuid_disk=UUID - Set the UUID for the disk + + Partition descriptors can have the following fields: + + * name= - The partition name, required + * start= - The partition start offset in bytes, required + * size= - The partition size in bytes or "-" to expand it to the whole free area + * bootable - Set the legacy bootable flag + * uuid= - The partition UUID, optional if CONFIG_RANDOM_UUID=y is enabled + * type= - The partition type GUID, requires CONFIG_PARTITION_TYPE_GUID=y + + + If 'uuid' is not specified, but CONFIG_RANDOM_UUID is enabled, a random UUID + will be generated for the partition + +gpt enumerate +~~~~~~~~~~~~~ + +Sets the variable 'gpt_partition_list' to be a list of all the partition names +on the device. + +gpt guid +~~~~~~~~ + +Report the GUID of a disk. If 'varname' is specified, the command will set the +variable to the GUID, otherwise it will be printed out. + +gpt read +~~~~~~~~ + +Prints the current state of the GPT partition table. If 'varname' is specified, +the variable will be filled with a partition string in the same format as a +'', suitable for passing to other 'gpt' commands. If the +argument is omitted, a human readable description is printed out. +CONFIG_CMD_GPT_RENAME=y is required. + +gpt rename +~~~~~~~~~~ + +Renames all partitions named 'part' to be 'name'. CONFIG_CMD_GPT_RENAME=y is +required. + +gpt repair +~~~~~~~~~~ + +Repairs the GPT partition tables if it they become corrupted. + +gpt setenv +~~~~~~~~~~ + +The 'gpt setenv' command will set a series of environment variables with +information about the partition named ''. The variables are: + +gpt_partition_addr + the starting offset of the partition in blocks as a hexadecimal number + +gpt_partition_size + the size of the partition in blocks as a hexadecimal number + +gpt_partition_name + the name of the partition + +gpt_partition_entry + the partition number in the table, e.g. 1, 2, 3, etc. + +gpt swap +~~~~~~~~ + +Changes the names of all partitions that are named 'name1' to be 'name2', and +all partitions named 'name2' to be 'name1'. CONFIG_CMD_GPT_RENAME=y is +required. + +gpt verify +~~~~~~~~~~ + +Sets return value $? to 0 (true) if the partition layout on the +specified disk matches the one in the provided partition string, and 1 (false) +if it does not match. If no partition string is specified, the command will +check if the disk is partitioned or not. + +gpt write +~~~~~~~~~ + +(Re)writes the partition table on the disk to match the provided +partition string. It returns 0 on success or 1 on failure. + +Configuration +------------- + +To use the 'gpt' command you must specify CONFIG_CMD_GPT=y. To enable 'gpt +read', 'gpt swap' and 'gpt rename', you must specify CONFIG_CMD_GPT_RENAME=y. + +Examples +~~~~~~~~ +Create 6 partitions on a disk:: + + => setenv gpt_parts 'uuid_disk=bec9fc2a-86c1-483d-8a0e-0109732277d7; + name=boot,start=4M,size=128M,bootable,type=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7, + name=rootfs,size=3072M,type=0fc63daf-8483-4772-8e79-3d69d8477de4; + name=system-data,size=512M,type=0fc63daf-8483-4772-8e79-3d69d8477de4; + name=[ext],size=-,type=0fc63daf-8483-4772-8e79-3d69d8477de4; + name=user,size=-,type=0fc63daf-8483-4772-8e79-3d69d8477de4; + name=modules,size=100M,type=0fc63daf-8483-4772-8e79-3d69d8477de4; + name=ramdisk,size=8M,type=0fc63daf-8483-4772-8e79-3d69d8477de4 + => gpt write mmc 0 $gpt_parts + + +Verify that the device matches the partition layout described in the variable +$gpt_parts:: + + => gpt verify mmc 0 $gpt_parts + + +Get the information about the partition named 'rootfs':: + + => gpt setenv mmc 0 rootfs + => echo ${gpt_partition_addr} + 2000 + => echo ${gpt_partition_size} + 14a000 + => echo ${gpt_partition_name} + rootfs + => echo ${gpt_partition_entry} + 2 + +Get the list of partition names on the disk:: + + => gpt enumerate + => echo gpt_partition_list + boot rootfs system-data [ext] user modules ramdisk + + +Get the GUID for a disk:: + + => gpt guid mmc 0 + bec9fc2a-86c1-483d-8a0e-0109732277d7 + => gpt guid mmc gpt_disk_uuid + => echo ${gpt_disk_uuid} + bec9fc2a-86c1-483d-8a0e-0109732277d7 diff --git a/doc/usage/index.rst b/doc/usage/index.rst index f45a7f55024..fa702920faa 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -66,6 +66,7 @@ Shell commands cmd/for cmd/fwu_mdata cmd/gpio + cmd/gpt cmd/host cmd/imxtract cmd/load From c771e5b8c2a186fb072b6c6f571d4a3cc86efba9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 27 Jul 2023 15:54:28 -0600 Subject: [PATCH 51/54] arm: rpi: Switch to standard boot Drop use of the distro scripts and use standard boot instead. We don't need to specify the mmc devices individually, since they are used in order from 0 to 2, and standard boot uses that order anyway. Signed-off-by: Simon Glass --- configs/rpi_0_w_defconfig | 1 + configs/rpi_2_defconfig | 1 + configs/rpi_3_32b_defconfig | 1 + configs/rpi_3_b_plus_defconfig | 1 + configs/rpi_3_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/rpi_defconfig | 1 + include/configs/rpi.h | 38 ++-------------------------------- 10 files changed, 11 insertions(+), 36 deletions(-) diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig index 5da334a8bcf..7554e671e2c 100644 --- a/configs/rpi_0_w_defconfig +++ b/configs/rpi_0_w_defconfig @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-zero-w" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig index 99086216071..653f78bec1e 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig @@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2836-rpi-2-b" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig index 80885aa9488..305f1dacfd4 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig index 0acce8b883f..f36f1258aa6 100644 --- a/configs/rpi_3_b_plus_defconfig +++ b/configs/rpi_3_b_plus_defconfig @@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b-plus" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig index bb6fe128061..a0d8be42537 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig @@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index f6213340971..71f61c52e52 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index bbc0fd6c649..fa2c05da21e 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index 5d9a273cb92..3e64573b70b 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig index 550b8dcb958..4b8e402c89d 100644 --- a/configs/rpi_defconfig +++ b/configs/rpi_defconfig @@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 4da982f7357..4160db2d8e1 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -122,47 +122,13 @@ "fdt_addr_r=0x02600000\0" \ "ramdisk_addr_r=0x02700000\0" -#if IS_ENABLED(CONFIG_CMD_MMC) - #define BOOT_TARGET_MMC(func) \ - func(MMC, mmc, 0) \ - func(MMC, mmc, 1) \ - func(MMC, mmc, 2) -#else - #define BOOT_TARGET_MMC(func) -#endif - -#if IS_ENABLED(CONFIG_CMD_USB) - #define BOOT_TARGET_USB(func) func(USB, usb, 0) -#else - #define BOOT_TARGET_USB(func) -#endif - -#if CONFIG_IS_ENABLED(CMD_PXE) - #define BOOT_TARGET_PXE(func) func(PXE, pxe, na) -#else - #define BOOT_TARGET_PXE(func) -#endif - -#if CONFIG_IS_ENABLED(CMD_DHCP) - #define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na) -#else - #define BOOT_TARGET_DHCP(func) -#endif - -#define BOOT_TARGET_DEVICES(func) \ - BOOT_TARGET_MMC(func) \ - BOOT_TARGET_USB(func) \ - BOOT_TARGET_PXE(func) \ - BOOT_TARGET_DHCP(func) - -#include +#define BOOT_TARGETS "mmc usb pxe dhcp" #define CFG_EXTRA_ENV_SETTINGS \ "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ ENV_DEVICE_SETTINGS \ ENV_DFU_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV - + "boot_targets=" BOOT_TARGETS "\0" #endif From 90f626a5d8603dc3bffe30d8be19de284853b5d6 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 27 Jul 2023 15:54:29 -0600 Subject: [PATCH 52/54] rpi: Disable DISTRO_DEFAULTS Disable this option to reclaim some space, since bootstd requires less functionality to operate (e.g. hush parser). Signed-off-by: Simon Glass --- configs/rpi_0_w_defconfig | 1 - configs/rpi_2_defconfig | 1 - configs/rpi_3_32b_defconfig | 1 - configs/rpi_3_b_plus_defconfig | 1 - configs/rpi_3_defconfig | 1 - configs/rpi_4_32b_defconfig | 1 - configs/rpi_4_defconfig | 1 - configs/rpi_arm64_defconfig | 1 - configs/rpi_defconfig | 1 - 9 files changed, 9 deletions(-) diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig index 7554e671e2c..3167bfbe48f 100644 --- a/configs/rpi_0_w_defconfig +++ b/configs/rpi_0_w_defconfig @@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig index 653f78bec1e..883dab16170 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig @@ -15,7 +15,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig index 305f1dacfd4..5ff7d987a43 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig @@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig index f36f1258aa6..31f2a6eb310 100644 --- a/configs/rpi_3_b_plus_defconfig +++ b/configs/rpi_3_b_plus_defconfig @@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig index a0d8be42537..fa6e1507d64 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig @@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index 71f61c52e52..55bf6c0770f 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index fa2c05da21e..6679cce9a16 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index 3e64573b70b..26e29ffb5a1 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_PCI=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig index 4b8e402c89d..0ac5efec717 100644 --- a/configs/rpi_defconfig +++ b/configs/rpi_defconfig @@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y -CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set From fc2af2d978b525e188b15d909e321caf9445bdb0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 27 Jul 2023 15:54:30 -0600 Subject: [PATCH 53/54] arm: rpi: Switch to a text environment Use the new environment format so we can drop most of the config.h file. Signed-off-by: Simon Glass --- board/raspberrypi/rpi/rpi.env | 77 ++++++++++++++++++++++++++ include/configs/rpi.h | 100 ---------------------------------- 2 files changed, 77 insertions(+), 100 deletions(-) create mode 100644 board/raspberrypi/rpi/rpi.env diff --git a/board/raspberrypi/rpi/rpi.env b/board/raspberrypi/rpi/rpi.env new file mode 100644 index 00000000000..30228285edd --- /dev/null +++ b/board/raspberrypi/rpi/rpi.env @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* environment for Raspberry Pi boards */ + +dhcpuboot=usb start; dhcp u-boot.uimg; bootm + +/* Environment */ +stdin=serial,usbkbd +stdout=serial,vidconsole +stderr=serial,vidconsole + +/* DFU over USB/UDC */ +#ifdef CONFIG_CMD_DFU +dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1; + config.txt fat 0 1; +#ifdef CONFIG_ARM64 +dfu_alt_info+=Image fat 0 1 +#else +dfu_alt_info+=zImage fat 0 1 +#endif +#endif /* CONFIG_CMD_DFU */ + +/* + * Memory layout for where various images get loaded by boot scripts: + * + * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. + * + * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, + * newer versions place it in high memory. So prevent U-Boot from doing its own + * DTB + initrd relocation so that we won't accidentally relocate the initrd + * over the firmware-loaded DTB and generally try to lay out things starting + * from the bottom of RAM. + * + * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, + * it must be within the first 128M of RAM in order for the kernel's + * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed + * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The + * decompressor also likes to relocate itself to right past the end of the + * decompressed kernel, so in total the sum of the compressed and + * decompressed kernel needs to be reserved. + * + * For Aarch64, the kernel image is uncompressed and must be loaded at + * text_offset bytes (specified in the header of the Image) into a 2MB + * boundary. The 'booti' command relocates the image if necessary. Linux uses + * a default text_offset of 0x80000. In summary, loading at 0x80000 + * satisfies all these constraints and reserving memory up to 0x02400000 + * permits fairly large (roughly 36M) kernels. + * + * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't + * conflict with something else. Reserving 1M for each of them at + * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. + * + * On ARM, both the DTB and any possible initrd must be loaded such that they + * fit inside the lowmem mapping in Linux. In practice, this usually means not + * more than ~700M away from the start of the kernel image but this number can + * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line + * parameter given to the kernel. So reserving memory from low to high + * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for + * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. + * Even with the smallest possible CPU-GPU memory split of the CPU getting + * only 64M, the remaining 25M starting at 0x02700000 should allow quite + * large initrds before they start colliding with U-Boot. + */ +#ifdef CONFIG_ARM64 +fdt_high=ffffffffffffffff +initrd_high=ffffffffffffffff +#else +fdt_high=ffffffff +initrd_high=ffffffff +#endif +kernel_addr_r=0x00080000 +scriptaddr=0x02400000 +pxefile_addr_r=0x02500000 +fdt_addr_r=0x02600000 +ramdisk_addr_r=0x02700000 + +boot_targets=mmc usb pxe dhcp diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 4160db2d8e1..8e56bdc84a8 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -13,8 +13,6 @@ #include #endif -/* Architecture, CPU, etc.*/ - /* Use SoC timer for AArch32, but architected timer for AArch64 */ #ifndef CONFIG_ARM64 #define CFG_SYS_TIMER_RATE 1000000 @@ -33,102 +31,4 @@ */ #define CFG_SYS_SDRAM_SIZE SZ_128M -/* Devices */ -/* LCD */ - -/* DFU over USB/UDC */ -#ifdef CONFIG_CMD_DFU -#ifdef CONFIG_ARM64 -#define KERNEL_FILENAME "Image" -#else -#define KERNEL_FILENAME "zImage" -#endif - -#define ENV_DFU_SETTINGS \ - "dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;" \ - "config.txt fat 0 1;" \ - KERNEL_FILENAME " fat 0 1\0" -#else -#define ENV_DFU_SETTINGS "" -#endif - -/* Console configuration */ - -/* Environment */ - -/* Shell */ - -/* Environment */ -#define ENV_DEVICE_SETTINGS \ - "stdin=serial,usbkbd\0" \ - "stdout=serial,vidconsole\0" \ - "stderr=serial,vidconsole\0" - -#ifdef CONFIG_ARM64 -#define FDT_HIGH "ffffffffffffffff" -#define INITRD_HIGH "ffffffffffffffff" -#else -#define FDT_HIGH "ffffffff" -#define INITRD_HIGH "ffffffff" -#endif - -/* - * Memory layout for where various images get loaded by boot scripts: - * - * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. - * - * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, - * newer versions place it in high memory. So prevent U-Boot from doing its own - * DTB + initrd relocation so that we won't accidentally relocate the initrd - * over the firmware-loaded DTB and generally try to lay out things starting - * from the bottom of RAM. - * - * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, - * it must be within the first 128M of RAM in order for the kernel's - * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed - * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The - * decompressor also likes to relocate itself to right past the end of the - * decompressed kernel, so in total the sum of the compressed and and - * decompressed kernel needs to be reserved. - * - * For Aarch64, the kernel image is uncompressed and must be loaded at - * text_offset bytes (specified in the header of the Image) into a 2MB - * boundary. The 'booti' command relocates the image if necessary. Linux uses - * a default text_offset of 0x80000. In summary, loading at 0x80000 - * satisfies all these constraints and reserving memory up to 0x02400000 - * permits fairly large (roughly 36M) kernels. - * - * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't - * conflict with something else. Reserving 1M for each of them at - * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. - * - * On ARM, both the DTB and any possible initrd must be loaded such that they - * fit inside the lowmem mapping in Linux. In practice, this usually means not - * more than ~700M away from the start of the kernel image but this number can - * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line - * parameter given to the kernel. So reserving memory from low to high - * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for - * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. - * Even with the smallest possible CPU-GPU memory split of the CPU getting - * only 64M, the remaining 25M starting at 0x02700000 should allow quite - * large initrds before they start colliding with U-Boot. - */ -#define ENV_MEM_LAYOUT_SETTINGS \ - "fdt_high=" FDT_HIGH "\0" \ - "initrd_high=" INITRD_HIGH "\0" \ - "kernel_addr_r=0x00080000\0" \ - "scriptaddr=0x02400000\0" \ - "pxefile_addr_r=0x02500000\0" \ - "fdt_addr_r=0x02600000\0" \ - "ramdisk_addr_r=0x02700000\0" - -#define BOOT_TARGETS "mmc usb pxe dhcp" - -#define CFG_EXTRA_ENV_SETTINGS \ - "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ - ENV_DEVICE_SETTINGS \ - ENV_DFU_SETTINGS \ - ENV_MEM_LAYOUT_SETTINGS \ - "boot_targets=" BOOT_TARGETS "\0" - #endif From b27eeca112c1b9eef6f06a320a4310d766ac5659 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 4 Sep 2023 10:39:43 -0400 Subject: [PATCH 54/54] Prepare v2023.10-rc4 Signed-off-by: Tom Rini --- Makefile | 2 +- doc/develop/release_cycle.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 033daf1695c..9be24c4ec61 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ VERSION = 2023 PATCHLEVEL = 10 SUBLEVEL = -EXTRAVERSION = -rc3 +EXTRAVERSION = -rc4 NAME = # *DOCUMENTATION* diff --git a/doc/develop/release_cycle.rst b/doc/develop/release_cycle.rst index 50d33df4211..346cf29ef39 100644 --- a/doc/develop/release_cycle.rst +++ b/doc/develop/release_cycle.rst @@ -70,7 +70,7 @@ For the next scheduled release, release candidates were made on:: * U-Boot v2023.10-rc3 was released on Mon 21 August 2023. -.. * U-Boot v2023.10-rc4 was released on Mon 04 September 2023. +* U-Boot v2023.10-rc4 was released on Mon 04 September 2023. .. * U-Boot v2023.10-rc5 was released on Mon 18 September 2023.