blob: 5a25644641bb73e7da2e5babaaac70b997cf722d [file] [log] [blame]
Heiko Schocher435199f2011-11-01 20:00:29 +00001/*
2 * Copyright (C) 2011
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Heiko Schocher435199f2011-11-01 20:00:29 +00006 */
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 */
16void nand_boot(void)
17{
Heiko Schocher435199f2011-11-01 20:00:29 +000018 __attribute__((noreturn)) void (*uboot)(void);
19
20 /*
21 * Load U-Boot image from NAND into RAM
22 */
Anatolij Gustschinb7fde582011-12-03 06:46:09 +000023 nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
Heiko Schocher435199f2011-11-01 20:00:29 +000024 CONFIG_SYS_NAND_U_BOOT_SIZE,
Anatolij Gustschinb7fde582011-12-03 06:46:09 +000025 (void *)CONFIG_SYS_NAND_U_BOOT_DST);
Heiko Schocher435199f2011-11-01 20:00:29 +000026
27#ifdef CONFIG_NAND_ENV_DST
Anatolij Gustschinb7fde582011-12-03 06:46:09 +000028 nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
29 (void *)CONFIG_NAND_ENV_DST);
Heiko Schocher435199f2011-11-01 20:00:29 +000030
31#ifdef CONFIG_ENV_OFFSET_REDUND
Anatolij Gustschinb7fde582011-12-03 06:46:09 +000032 nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
33 (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
Heiko Schocher435199f2011-11-01 20:00:29 +000034#endif
35#endif
36
37 /*
38 * Jump to U-Boot image
39 */
40 uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
41 (*uboot)();
42}