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