xref: /OK3568_Linux_fs/u-boot/drivers/mtd/nand/raw/nand_spl_load.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2011
3  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <nand.h>
10 
11 /*
12  * The main entry for NAND booting. It's necessary that SDRAM is already
13  * configured and available since this code loads the main U-Boot image
14  * from NAND into SDRAM and starts it from there.
15  */
nand_boot(void)16 void nand_boot(void)
17 {
18 	__attribute__((noreturn)) void (*uboot)(void);
19 
20 	/*
21 	 * Load U-Boot image from NAND into RAM
22 	 */
23 	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
24 			CONFIG_SYS_NAND_U_BOOT_SIZE,
25 			(void *)CONFIG_SYS_NAND_U_BOOT_DST);
26 
27 #ifdef CONFIG_NAND_ENV_DST
28 	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
29 			(void *)CONFIG_NAND_ENV_DST);
30 
31 #ifdef CONFIG_ENV_OFFSET_REDUND
32 	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
33 			(void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
34 #endif
35 #endif
36 
37 	/*
38 	 * Jump to U-Boot image
39 	 */
40 	uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
41 	(*uboot)();
42 }
43