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