Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 |
| 3 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 6 | */ |
| 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 | */ |
| 16 | void nand_boot(void) |
| 17 | { |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 18 | __attribute__((noreturn)) void (*uboot)(void); |
| 19 | |
| 20 | /* |
| 21 | * Load U-Boot image from NAND into RAM |
| 22 | */ |
Anatolij Gustschin | 8eb4d98 | 2011-12-03 06:46:09 +0000 | [diff] [blame] | 23 | nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 24 | CONFIG_SYS_NAND_U_BOOT_SIZE, |
Anatolij Gustschin | 8eb4d98 | 2011-12-03 06:46:09 +0000 | [diff] [blame] | 25 | (void *)CONFIG_SYS_NAND_U_BOOT_DST); |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 26 | |
| 27 | #ifdef CONFIG_NAND_ENV_DST |
Anatolij Gustschin | 8eb4d98 | 2011-12-03 06:46:09 +0000 | [diff] [blame] | 28 | nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, |
| 29 | (void *)CONFIG_NAND_ENV_DST); |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 30 | |
| 31 | #ifdef CONFIG_ENV_OFFSET_REDUND |
Anatolij Gustschin | 8eb4d98 | 2011-12-03 06:46:09 +0000 | [diff] [blame] | 32 | nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, |
| 33 | (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); |
Heiko Schocher | 565a09c | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 34 | #endif |
| 35 | #endif |
| 36 | |
| 37 | /* |
| 38 | * Jump to U-Boot image |
| 39 | */ |
| 40 | uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START; |
| 41 | (*uboot)(); |
| 42 | } |