mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-04 14:00:19 +00:00 
			
		
		
		
	mach-snapdragon: dynamic load addresses
Heavily inspired by Apple board code. Use the LMB allocator to configure load addresses at runtime, and implement a lookup table for selecting a devicetree. As some Qualcomm RBx boards have different RAM capacities and base addresses, it isn't possible to hardcode these regions. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404 Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
This commit is contained in:
		
							parent
							
								
									059d526af3
								
							
						
					
					
						commit
						a2364d97ff
					
				@ -1096,6 +1096,7 @@ config ARCH_SNAPDRAGON
 | 
				
			|||||||
	select OF_SEPARATE
 | 
						select OF_SEPARATE
 | 
				
			||||||
	select SMEM
 | 
						select SMEM
 | 
				
			||||||
	select SPMI
 | 
						select SPMI
 | 
				
			||||||
 | 
						select BOARD_LATE_INIT
 | 
				
			||||||
	select OF_BOARD
 | 
						select OF_BOARD
 | 
				
			||||||
	select SAVE_PREV_BL_FDT_ADDR
 | 
						select SAVE_PREV_BL_FDT_ADDR
 | 
				
			||||||
	select LINUX_KERNEL_IMAGE_HEADER
 | 
						select LINUX_KERNEL_IMAGE_HEADER
 | 
				
			||||||
 | 
				
			|||||||
@ -22,6 +22,7 @@
 | 
				
			|||||||
#include <linux/bug.h>
 | 
					#include <linux/bug.h>
 | 
				
			||||||
#include <linux/psci.h>
 | 
					#include <linux/psci.h>
 | 
				
			||||||
#include <linux/sizes.h>
 | 
					#include <linux/sizes.h>
 | 
				
			||||||
 | 
					#include <lmb.h>
 | 
				
			||||||
#include <malloc.h>
 | 
					#include <malloc.h>
 | 
				
			||||||
#include <usb.h>
 | 
					#include <usb.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -159,6 +160,39 @@ int board_init(void)
 | 
				
			|||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void __weak qcom_late_init(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define KERNEL_COMP_SIZE	SZ_64M
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define addr_alloc(lmb, size) lmb_alloc(lmb, size, SZ_2M)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Stolen from arch/arm/mach-apple/board.c */
 | 
				
			||||||
 | 
					int board_late_init(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct lmb lmb;
 | 
				
			||||||
 | 
						u32 status = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* We need to be fairly conservative here as we support boards with just 1G of TOTAL RAM */
 | 
				
			||||||
 | 
						status |= env_set_hex("kernel_addr_r", addr_alloc(&lmb, SZ_128M));
 | 
				
			||||||
 | 
						status |= env_set_hex("ramdisk_addr_r", addr_alloc(&lmb, SZ_128M));
 | 
				
			||||||
 | 
						status |= env_set_hex("kernel_comp_addr_r", addr_alloc(&lmb, KERNEL_COMP_SIZE));
 | 
				
			||||||
 | 
						status |= env_set_hex("kernel_comp_size", KERNEL_COMP_SIZE);
 | 
				
			||||||
 | 
						status |= env_set_hex("scriptaddr", addr_alloc(&lmb, SZ_4M));
 | 
				
			||||||
 | 
						status |= env_set_hex("pxefile_addr_r", addr_alloc(&lmb, SZ_4M));
 | 
				
			||||||
 | 
						status |= env_set_hex("fdt_addr_r", addr_alloc(&lmb, SZ_2M));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (status)
 | 
				
			||||||
 | 
							log_warning("%s: Failed to set run time variables\n", __func__);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						qcom_late_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void build_mem_map(void)
 | 
					static void build_mem_map(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
				
			|||||||
@ -88,7 +88,7 @@ int misc_init_r(void)
 | 
				
			|||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int board_late_init(void)
 | 
					int qcom_late_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char serial[16];
 | 
						char serial[16];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user