blob: 7ac9bf4d1206dc2fdd1e8d7d6ac134bc93aa2352 [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
Tom Riniabb9a042024-05-18 20:20:43 -06007#include <common.h>
Heiko Schocher565a09c2011-11-01 20:00:29 +00008#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,
Tom Rinib4213492022-11-12 17:36:51 -050023 CFG_SYS_NAND_U_BOOT_SIZE,
24 (void *)CFG_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 */
Tom Rinib4213492022-11-12 17:36:51 -050039 uboot = (void *)CFG_SYS_NAND_U_BOOT_START;
Heiko Schocher565a09c2011-11-01 20:00:29 +000040 (*uboot)();
41}