Commit e2f88dfd2d9671945877daf5a8c9223b864c34d1

Authored by Michal Simek
Committed by Simon Glass
1 parent 26fb8db0f4

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>
Acked-by: Simon Glass <sjg@chromium.org>

Showing 5 changed files with 17 additions and 5 deletions Side-by-side Diff

... ... @@ -342,6 +342,15 @@
342 342 help
343 343 TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture
344 344  
  345 +config ARCH_FIXUP_FDT
  346 + bool "Enable arch_fixup_fdt() call"
  347 + depends on ARM || MIPS
  348 + default y
  349 + help
  350 + Enable FDT memory map syncup before OS boot. This feature can be
  351 + used for booting OS with different memory setup where the part of
  352 + the memory location should be used for different purpose.
  353 +
345 354 endmenu # Boot images
346 355  
347 356 source "common/Kconfig"
arch/arm/lib/bootm-fdt.c
... ... @@ -25,6 +25,7 @@
25 25  
26 26 DECLARE_GLOBAL_DATA_PTR;
27 27  
  28 +#ifdef CONFIG_ARCH_FIXUP_FDT
28 29 int arch_fixup_fdt(void *blob)
29 30 {
30 31 bd_t *bd = gd->bd;
... ... @@ -60,4 +61,5 @@
60 61  
61 62 return 0;
62 63 }
  64 +#endif
arch/arm/lib/bootm.c
... ... @@ -367,8 +367,10 @@
367 367 if (images->ft_addr) {
368 368 off = fdt_path_offset(images->ft_addr, "/memory");
369 369 if (off < 0) {
  370 +#ifdef CONFIG_ARCH_FIXUP_FDT
370 371 if (arch_fixup_fdt(images->ft_addr))
371 372 puts("## WARNING: fixup memory failed!\n");
  373 +#endif
372 374 }
373 375 }
374 376 #endif
arch/mips/lib/bootm.c
... ... @@ -253,6 +253,7 @@
253 253 #endif
254 254 }
255 255  
  256 +#ifdef CONFIG_ARCH_FIXUP_FDT
256 257 int arch_fixup_fdt(void *blob)
257 258 {
258 259 #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT)
... ... @@ -264,6 +265,7 @@
264 265 return 0;
265 266 #endif
266 267 }
  268 +#endif
267 269  
268 270 static int boot_setup_fdt(bootm_headers_t *images)
269 271 {
... ... @@ -458,11 +458,6 @@
458 458 return 1;
459 459 }
460 460  
461   -__weak int arch_fixup_fdt(void *blob)
462   -{
463   - return 0;
464   -}
465   -
466 461 int image_setup_libfdt(bootm_headers_t *images, void *blob,
467 462 int of_size, struct lmb *lmb)
468 463 {
469 464  
... ... @@ -479,10 +474,12 @@
479 474 printf("ERROR: /chosen node create failed\n");
480 475 goto err;
481 476 }
  477 +#ifdef CONFIG_ARCH_FIXUP_FDT
482 478 if (arch_fixup_fdt(blob) < 0) {
483 479 printf("ERROR: arch-specific fdt fixup failed\n");
484 480 goto err;
485 481 }
  482 +#endif
486 483 if (IMAGE_OF_BOARD_SETUP) {
487 484 fdt_ret = ft_board_setup(blob, gd->bd);
488 485 if (fdt_ret) {