[U-Boot] [PATCH v3] libfdt: Introduce new ARCH_FIXUP_FDT option

Add new Kconfig option to disable arch_fixup_fdt() calls for cases where U-Boot shouldn't update memory setup in DTB file. One example of usage of this option is to boot OS with different memory setup than U-Boot use.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
Changes in v3: - Fix MIPS macro
Changes in v2: - Change logic to be possitive - sjg
Kconfig | 9 +++++++++ arch/arm/lib/bootm-fdt.c | 2 ++ arch/arm/lib/bootm.c | 2 ++ arch/mips/lib/bootm.c | 2 ++ common/image-fdt.c | 7 ++----- 5 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/Kconfig b/Kconfig index ef12f9fbee40..626e82f88dfe 100644 --- a/Kconfig +++ b/Kconfig @@ -342,6 +342,15 @@ config SYS_CLK_FREQ help TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture
+config ARCH_FIXUP_FDT + bool "Enable arch_fixup_fdt() call" + depends on ARM || MIPS + default y + help + Enable FDT memory map syncup before OS boot. This feature can be + used for booting OS with different memory setup where the part of + the memory location should be used for different purpose. + endmenu # Boot images
source "common/Kconfig" diff --git a/arch/arm/lib/bootm-fdt.c b/arch/arm/lib/bootm-fdt.c index 4481f9e2fa9c..a51755070bc9 100644 --- a/arch/arm/lib/bootm-fdt.c +++ b/arch/arm/lib/bootm-fdt.c @@ -25,6 +25,7 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_ARCH_FIXUP_FDT int arch_fixup_fdt(void *blob) { bd_t *bd = gd->bd; @@ -60,3 +61,4 @@ int arch_fixup_fdt(void *blob)
return 0; } +#endif diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index c20ef227fb4e..f9ed7fe38ab8 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -367,8 +367,10 @@ void boot_prep_vxworks(bootm_headers_t *images) if (images->ft_addr) { off = fdt_path_offset(images->ft_addr, "/memory"); if (off < 0) { +#ifdef CONFIG_ARCH_FIXUP_FDT if (arch_fixup_fdt(images->ft_addr)) puts("## WARNING: fixup memory failed!\n"); +#endif } } #endif diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index aa0475a4954e..0c6a4ab3b329 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -253,6 +253,7 @@ static int boot_reloc_fdt(bootm_headers_t *images) #endif }
+#ifdef CONFIG_ARCH_FIXUP_FDT int arch_fixup_fdt(void *blob) { #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) @@ -264,6 +265,7 @@ int arch_fixup_fdt(void *blob) return 0; #endif } +#endif
static int boot_setup_fdt(bootm_headers_t *images) { diff --git a/common/image-fdt.c b/common/image-fdt.c index 6cac7dbb7f8b..d6ee225d409e 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -458,11 +458,6 @@ __weak int ft_verify_fdt(void *fdt) return 1; }
-__weak int arch_fixup_fdt(void *blob) -{ - return 0; -} - int image_setup_libfdt(bootm_headers_t *images, void *blob, int of_size, struct lmb *lmb) { @@ -479,10 +474,12 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob, printf("ERROR: /chosen node create failed\n"); goto err; } +#ifdef CONFIG_ARCH_FIXUP_FDT if (arch_fixup_fdt(blob) < 0) { printf("ERROR: arch-specific fdt fixup failed\n"); goto err; } +#endif if (IMAGE_OF_BOARD_SETUP) { fdt_ret = ft_board_setup(blob, gd->bd); if (fdt_ret) {

On 28 July 2016 at 01:06, Michal Simek michal.simek@xilinx.com wrote:
Add new Kconfig option to disable arch_fixup_fdt() calls for cases where U-Boot shouldn't update memory setup in DTB file. One example of usage of this option is to boot OS with different memory setup than U-Boot use.
Signed-off-by: Michal Simek michal.simek@xilinx.com
Changes in v3:
- Fix MIPS macro
Changes in v2:
- Change logic to be possitive - sjg
Kconfig | 9 +++++++++ arch/arm/lib/bootm-fdt.c | 2 ++ arch/arm/lib/bootm.c | 2 ++ arch/mips/lib/bootm.c | 2 ++ common/image-fdt.c | 7 ++----- 5 files changed, 17 insertions(+), 5 deletions(-)
Acked-by: Simon Glass sjg@chromium.org

On 31 July 2016 at 19:03, Simon Glass sjg@chromium.org wrote:
Acked-by: Simon Glass sjg@chromium.org
Acked-by: Simon Glass sjg@chromium.org

On 1.8.2016 03:03, Simon Glass wrote:
On 28 July 2016 at 01:06, Michal Simek michal.simek@xilinx.com wrote:
Add new Kconfig option to disable arch_fixup_fdt() calls for cases where U-Boot shouldn't update memory setup in DTB file. One example of usage of this option is to boot OS with different memory setup than U-Boot use.
Signed-off-by: Michal Simek michal.simek@xilinx.com
Changes in v3:
- Fix MIPS macro
Changes in v2:
- Change logic to be possitive - sjg
Kconfig | 9 +++++++++ arch/arm/lib/bootm-fdt.c | 2 ++ arch/arm/lib/bootm.c | 2 ++ arch/mips/lib/bootm.c | 2 ++ common/image-fdt.c | 7 ++----- 5 files changed, 17 insertions(+), 5 deletions(-)
Acked-by: Simon Glass sjg@chromium.org
I have to send PR with xilinx changes to fix others critical issues that's why I would include this to my PR. I expect that this should be fine for you.
Thanks, Michal

On 1 August 2016 at 00:37, Michal Simek michal.simek@xilinx.com wrote:
On 1.8.2016 03:03, Simon Glass wrote:
On 28 July 2016 at 01:06, Michal Simek michal.simek@xilinx.com wrote:
Add new Kconfig option to disable arch_fixup_fdt() calls for cases where U-Boot shouldn't update memory setup in DTB file. One example of usage of this option is to boot OS with different memory setup than U-Boot use.
Signed-off-by: Michal Simek michal.simek@xilinx.com
Changes in v3:
- Fix MIPS macro
Changes in v2:
- Change logic to be possitive - sjg
Kconfig | 9 +++++++++ arch/arm/lib/bootm-fdt.c | 2 ++ arch/arm/lib/bootm.c | 2 ++ arch/mips/lib/bootm.c | 2 ++ common/image-fdt.c | 7 ++----- 5 files changed, 17 insertions(+), 5 deletions(-)
Acked-by: Simon Glass sjg@chromium.org
I have to send PR with xilinx changes to fix others critical issues that's why I would include this to my PR. I expect that this should be fine for you.
OK that's fine. I'm about to send a pull request with this, but there should be no conflict.
Applied to u-boot-dm, thanks!
- Simon
participants (2)
-
Michal Simek
-
Simon Glass