Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 1 | From: Mauro Salvini <m.salvini@koansoftware.com> |
| 2 | To: u-boot@lists.denx.de |
| 3 | Subject: [PATCH] rpi: always set fdt_addr with firmware-provided FDT address |
| 4 | Date: Wed, 12 May 2021 14:39:45 +0200 [thread overview] |
| 5 | Message-ID: <20210512123945.25649-1-m.salvini@koansoftware.com> (raw) |
| 6 | |
| 7 | Raspberry firmware prepares the FDT blob in memory at an address |
| 8 | that depends on both the memory size and the blob size [1]. |
| 9 | After commit ade243a211d6 ("rpi: passthrough of the firmware provided FDT |
| 10 | blob") this FDT is passed to kernel through fdt_addr environment variable, |
| 11 | handled in set_fdt_addr() function in board file. |
| 12 | |
| 13 | When u-boot environment is persistently saved, if a change happens |
| 14 | in loaded FDT (e.g. for a new overlay applied), firmware produces a FDT |
| 15 | address different from the saved one, but u-boot still use the saved |
| 16 | one because set_fdt_addr() function does not overwrite the fdt_addr |
| 17 | variable. So, for example, if there is a script that uses fdt commands for |
| 18 | e.g. manipulate the bootargs, boot hangs with error |
| 19 | |
| 20 | libfdt fdt_check_header(): FDT_ERR_BADMAGIC |
| 21 | |
| 22 | Removing the fdt_addr variable in saved environment allows to boot. |
| 23 | |
| 24 | With this patch set_fdt_addr() function always overwrite fdt_addr value. |
| 25 | |
| 26 | [1] https://www.raspberrypi.org/forums//viewtopic.php?f=107&t=134018 |
| 27 | |
| 28 | Signed-off-by: Mauro Salvini <m.salvini@koansoftware.com> |
| 29 | Cc: C?dric Schieli <cschieli@gmail.com> |
| 30 | Cc: Matthias Brugger <mbrugger@suse.com> |
| 31 | --- |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame^] | 32 | Upstream-Status: Pending |
| 33 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 34 | board/raspberrypi/rpi/rpi.c | 3 --- |
| 35 | 1 file changed, 3 deletions(-) |
| 36 | |
| 37 | diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c |
| 38 | index df52a4689f..611013471e 100644 |
| 39 | --- a/board/raspberrypi/rpi/rpi.c |
| 40 | +++ b/board/raspberrypi/rpi/rpi.c |
| 41 | @@ -318,9 +318,6 @@ static void set_fdtfile(void) |
| 42 | */ |
| 43 | static void set_fdt_addr(void) |
| 44 | { |
| 45 | - if (env_get("fdt_addr")) |
| 46 | - return; |
| 47 | - |
| 48 | if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC) |
| 49 | return; |
| 50 | |
| 51 | -- |
| 52 | 2.17.1 |