libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY
Commit e2f88dfd2d ("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>
			
			
This commit is contained in:
		
							parent
							
								
									f7f191ee41
								
							
						
					
					
						commit
						63c0941726
					
				
							
								
								
									
										5
									
								
								Kconfig
								
								
								
								
							
							
						
						
									
										5
									
								
								Kconfig
								
								
								
								
							|  | @ -298,9 +298,8 @@ config SYS_CLK_FREQ | ||||||
| 	help | 	help | ||||||
| 	  TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture | 	  TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture | ||||||
| 
 | 
 | ||||||
| config ARCH_FIXUP_FDT | config ARCH_FIXUP_FDT_MEMORY | ||||||
| 	bool "Enable arch_fixup_fdt() call" | 	bool "Enable arch_fixup_memory_banks() call" | ||||||
| 	depends on ARM || MIPS |  | ||||||
| 	default y | 	default y | ||||||
| 	help | 	help | ||||||
| 	  Enable FDT memory map syncup before OS boot. This feature can be | 	  Enable FDT memory map syncup before OS boot. This feature can be | ||||||
|  |  | ||||||
|  | @ -37,6 +37,11 @@ void arch_lmb_reserve(struct lmb *lmb) | ||||||
| 	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp)); | 	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) | static int cleanup_before_linux(void) | ||||||
| { | { | ||||||
| 	disable_interrupts(); | 	disable_interrupts(); | ||||||
|  |  | ||||||
|  | @ -25,7 +25,6 @@ | ||||||
| 
 | 
 | ||||||
| DECLARE_GLOBAL_DATA_PTR; | DECLARE_GLOBAL_DATA_PTR; | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_ARCH_FIXUP_FDT |  | ||||||
| int arch_fixup_fdt(void *blob) | int arch_fixup_fdt(void *blob) | ||||||
| { | { | ||||||
| 	bd_t *bd = gd->bd; | 	bd_t *bd = gd->bd; | ||||||
|  | @ -61,4 +60,3 @@ int arch_fixup_fdt(void *blob) | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  | @ -414,10 +414,8 @@ void boot_prep_vxworks(bootm_headers_t *images) | ||||||
| 	if (images->ft_addr) { | 	if (images->ft_addr) { | ||||||
| 		off = fdt_path_offset(images->ft_addr, "/memory"); | 		off = fdt_path_offset(images->ft_addr, "/memory"); | ||||||
| 		if (off < 0) { | 		if (off < 0) { | ||||||
| #ifdef CONFIG_ARCH_FIXUP_FDT |  | ||||||
| 			if (arch_fixup_fdt(images->ft_addr)) | 			if (arch_fixup_fdt(images->ft_addr)) | ||||||
| 				puts("## WARNING: fixup memory failed!\n"); | 				puts("## WARNING: fixup memory failed!\n"); | ||||||
| #endif |  | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -17,6 +17,11 @@ | ||||||
| 
 | 
 | ||||||
| DECLARE_GLOBAL_DATA_PTR; | DECLARE_GLOBAL_DATA_PTR; | ||||||
| 
 | 
 | ||||||
|  | int arch_fixup_fdt(void *blob) | ||||||
|  | { | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| int do_bootm_linux(int flag, int argc, char * const argv[], | int do_bootm_linux(int flag, int argc, char * const argv[], | ||||||
| 		   bootm_headers_t *images) | 		   bootm_headers_t *images) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -253,7 +253,6 @@ static int boot_reloc_fdt(bootm_headers_t *images) | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_ARCH_FIXUP_FDT |  | ||||||
| int arch_fixup_fdt(void *blob) | int arch_fixup_fdt(void *blob) | ||||||
| { | { | ||||||
| #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) | #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) | ||||||
|  | @ -265,7 +264,6 @@ int arch_fixup_fdt(void *blob) | ||||||
| 	return 0; | 	return 0; | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| #endif |  | ||||||
| 
 | 
 | ||||||
| static int boot_setup_fdt(bootm_headers_t *images) | static int boot_setup_fdt(bootm_headers_t *images) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -38,6 +38,11 @@ static void set_clocks_in_mhz (bd_t *kbd); | ||||||
| #define CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE	(768*1024*1024) | #define CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE	(768*1024*1024) | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | int arch_fixup_fdt(void *blob) | ||||||
|  | { | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static void boot_jump_linux(bootm_headers_t *images) | static void boot_jump_linux(bootm_headers_t *images) | ||||||
| { | { | ||||||
| 	void	(*kernel)(bd_t *, ulong r4, ulong r5, ulong r6, | 	void	(*kernel)(bd_t *, ulong r4, ulong r5, ulong r6, | ||||||
|  |  | ||||||
|  | @ -50,6 +50,11 @@ int bootz_setup(ulong image, ulong *start, ulong *end) | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | int arch_fixup_fdt(void *blob) | ||||||
|  | { | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) | 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)) { | 	if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) { | ||||||
|  |  | ||||||
|  | @ -26,6 +26,11 @@ DECLARE_GLOBAL_DATA_PTR; | ||||||
| 
 | 
 | ||||||
| #define COMMAND_LINE_OFFSET 0x9000 | #define COMMAND_LINE_OFFSET 0x9000 | ||||||
| 
 | 
 | ||||||
|  | int arch_fixup_fdt(void *blob) | ||||||
|  | { | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| __weak void board_quiesce_devices(void) | __weak void board_quiesce_devices(void) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -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); | 	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 |  * 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; | 	return 0; | ||||||
| } | } | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| int fdt_fixup_memory(void *blob, u64 start, u64 size) | int fdt_fixup_memory(void *blob, u64 start, u64 size) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -474,12 +474,10 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob, | ||||||
| 		printf("ERROR: /chosen node create failed\n"); | 		printf("ERROR: /chosen node create failed\n"); | ||||||
| 		goto err; | 		goto err; | ||||||
| 	} | 	} | ||||||
| #ifdef CONFIG_ARCH_FIXUP_FDT |  | ||||||
| 	if (arch_fixup_fdt(blob) < 0) { | 	if (arch_fixup_fdt(blob) < 0) { | ||||||
| 		printf("ERROR: arch-specific fdt fixup failed\n"); | 		printf("ERROR: arch-specific fdt fixup failed\n"); | ||||||
| 		goto err; | 		goto err; | ||||||
| 	} | 	} | ||||||
| #endif |  | ||||||
| 	if (IMAGE_OF_BOARD_SETUP) { | 	if (IMAGE_OF_BOARD_SETUP) { | ||||||
| 		fdt_ret = ft_board_setup(blob, gd->bd); | 		fdt_ret = ft_board_setup(blob, gd->bd); | ||||||
| 		if (fdt_ret) { | 		if (fdt_ret) { | ||||||
|  |  | ||||||
|  | @ -93,7 +93,15 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size); | ||||||
|  *			property will be left untouched. |  *			property will be left untouched. | ||||||
|  * @return 0 if ok, or -1 or -FDT_ERR_... on error |  * @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); | 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); | void fdt_fixup_ethernet(void *fdt); | ||||||
| int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, | int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue