blob: ecd373e054bfddea9e76e8a26ad56c884ad8d0e8 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Heiko Schocher565a09c2011-11-01 20:00:29 +00002/*
3 * Copyright (C) 2011
4 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
Heiko Schocher565a09c2011-11-01 20:00:29 +00005 */
6
7#include <common.h>
8#include <nand.h>
9
10/*
11 * The main entry for NAND booting. It's necessary that SDRAM is already
12 * configured and available since this code loads the main U-Boot image
13 * from NAND into SDRAM and starts it from there.
14 */
15void nand_boot(void)
16{
Heiko Schocher565a09c2011-11-01 20:00:29 +000017 __attribute__((noreturn)) void (*uboot)(void);
18
19 /*
20 * Load U-Boot image from NAND into RAM
21 */
Anatolij Gustschin8eb4d982011-12-03 06:46:09 +000022 nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
Heiko Schocher565a09c2011-11-01 20:00:29 +000023 CONFIG_SYS_NAND_U_BOOT_SIZE,
Anatolij Gustschin8eb4d982011-12-03 06:46:09 +000024 (void *)CONFIG_SYS_NAND_U_BOOT_DST);
Heiko Schocher565a09c2011-11-01 20:00:29 +000025
26#ifdef CONFIG_NAND_ENV_DST
Anatolij Gustschin8eb4d982011-12-03 06:46:09 +000027 nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
28 (void *)CONFIG_NAND_ENV_DST);
Heiko Schocher565a09c2011-11-01 20:00:29 +000029
30#ifdef CONFIG_ENV_OFFSET_REDUND
Anatolij Gustschin8eb4d982011-12-03 06:46:09 +000031 nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
32 (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
Heiko Schocher565a09c2011-11-01 20:00:29 +000033#endif
34#endif
35
36 /*
37 * Jump to U-Boot image
38 */
39 uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
40 (*uboot)();
41}