libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sat, 26 Nov 2016 02:02:10 +0000 (11:02 +0900)
committerSimon Glass <sjg@chromium.org>
Sat, 3 Dec 2016 03:54:34 +0000 (20:54 -0700)
Commit e2f88dfd2d96 ("libfdt: Introduce new ARCH_FIXUP_FDT option")
allows us to skip memory setup of DTB, but a problem for ARM is that
spin_table_update_dt() and psci_update_dt() are skipped as well if
CONFIG_ARCH_FIXUP_FDT is disabled.

This commit allows us to skip only fdt_fixup_memory_banks() instead
of the whole of arch_fixup_fdt().  It will be useful when we want to
use a memory node from a kernel DTB as is, but need some fixups for
Spin-Table/PSCI.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Acked-by: Simon Glass <sjg@chromium.org>
Fixed build error for x86:
Signed-off-by: Simon Glass <sjg@chromium.org>
12 files changed:
Kconfig
arch/arc/lib/bootm.c
arch/arm/lib/bootm-fdt.c
arch/arm/lib/bootm.c
arch/microblaze/lib/bootm.c
arch/mips/lib/bootm.c
arch/powerpc/lib/bootm.c
arch/sandbox/lib/bootm.c
arch/x86/lib/bootm.c
common/fdt_support.c
common/image-fdt.c
include/fdt_support.h

diff --git a/Kconfig b/Kconfig
index 529858a79dab58af5c86da3dc8ce0c927159913a..58a9d9b743949263401d9444df5729f95dcb9363 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -298,9 +298,8 @@ 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
+config ARCH_FIXUP_FDT_MEMORY
+       bool "Enable arch_fixup_memory_banks() call"
        default y
        help
          Enable FDT memory map syncup before OS boot. This feature can be
index 04d9d9cce574cf0c98306f959bf1fedfb730a699..57981490467a817c64f1bd75dc77cf4a9c85c6b7 100644 (file)
@@ -37,6 +37,11 @@ void arch_lmb_reserve(struct lmb *lmb)
        lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
 }
 
+int arch_fixup_fdt(void *blob)
+{
+       return 0;
+}
+
 static int cleanup_before_linux(void)
 {
        disable_interrupts();
index a51755070bc93bad6cb4e05618613afb07c58d9c..4481f9e2fa9ceb26f2f54f21e67f6b825c016601 100644 (file)
@@ -25,7 +25,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_ARCH_FIXUP_FDT
 int arch_fixup_fdt(void *blob)
 {
        bd_t *bd = gd->bd;
@@ -61,4 +60,3 @@ int arch_fixup_fdt(void *blob)
 
        return 0;
 }
-#endif
index 35e6b06733b8f8c9e00060d0e1efb4b98f25df77..4eee13a59c4be22269751a2bc0e4278379f451d1 100644 (file)
@@ -414,10 +414,8 @@ 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
index 3eb3440be841c42096063246131d1d9b7c3cc4ba..2732203b93e7f30489aa97b3d31f401ad28ee045 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int arch_fixup_fdt(void *blob)
+{
+       return 0;
+}
+
 int do_bootm_linux(int flag, int argc, char * const argv[],
                   bootm_headers_t *images)
 {
index 9fec4ad43860717263ea04d1981d0711d3c44502..be877625a8ecaf9d7fa9c8ec826b169597432f8b 100644 (file)
@@ -253,7 +253,6 @@ 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)
@@ -265,7 +264,6 @@ int arch_fixup_fdt(void *blob)
        return 0;
 #endif
 }
-#endif
 
 static int boot_setup_fdt(bootm_headers_t *images)
 {
index ef15e7ac92f292dd482cf65cf7bf9d2c05da91dc..17c5ed173cb229db521adb8259c637d624d959ad 100644 (file)
@@ -38,6 +38,11 @@ static void set_clocks_in_mhz (bd_t *kbd);
 #define CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE       (768*1024*1024)
 #endif
 
+int arch_fixup_fdt(void *blob)
+{
+       return 0;
+}
+
 static void boot_jump_linux(bootm_headers_t *images)
 {
        void    (*kernel)(bd_t *, ulong r4, ulong r5, ulong r6,
index 0c9a7979d23142fbc3d96d1722c7d8cd4d6b3c09..4cdd18fe14b28cb102eb625b78412613d58e76b0 100644 (file)
@@ -50,6 +50,11 @@ int bootz_setup(ulong image, ulong *start, ulong *end)
        return ret;
 }
 
+int arch_fixup_fdt(void *blob)
+{
+       return 0;
+}
+
 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 {
        if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
index 80fadef34e99c44b6080bcb2f49e257393f00759..e5e63f6888e3975993a03b78fff3199609bb65f5 100644 (file)
@@ -26,6 +26,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define COMMAND_LINE_OFFSET 0x9000
 
+int arch_fixup_fdt(void *blob)
+{
+       return 0;
+}
+
 __weak void board_quiesce_devices(void)
 {
 }
index 0609470dfb8bbaddcd4d8a2fab178d1b2fb481c6..c9f7019e38e8de1469f506cdd57353fd27d8e134 100644 (file)
@@ -381,6 +381,7 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,
        do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create);
 }
 
+#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY
 /*
  * fdt_pack_reg - pack address and size array into the "reg"-suitable stream
  */
@@ -459,6 +460,7 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
        }
        return 0;
 }
+#endif
 
 int fdt_fixup_memory(void *blob, u64 start, u64 size)
 {
index 5454227fc9963213b18fe799e337333e95fee228..e7540be8d631c4a1cbe08e2fb7ed70306dfa61a9 100644 (file)
@@ -474,12 +474,10 @@ 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) {
index 506bc5a9f690b0bb6c8ad108feb3e87056bbda04..955c1217133117668acdb9ee4cf3ad7fbaecde03 100644 (file)
@@ -93,7 +93,15 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size);
  *                     property will be left untouched.
  * @return 0 if ok, or -1 or -FDT_ERR_... on error
  */
+#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY
 int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks);
+#else
+static inline int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[],
+                                        int banks)
+{
+       return 0;
+}
+#endif
 
 void fdt_fixup_ethernet(void *fdt);
 int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,