Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 |
| 3 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
| 7 | * published by the Free Software Foundation; either version 2 of |
| 8 | * the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 18 | * MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #include <common.h> |
| 22 | #include <nand.h> |
| 23 | |
| 24 | /* |
| 25 | * The main entry for NAND booting. It's necessary that SDRAM is already |
| 26 | * configured and available since this code loads the main U-Boot image |
| 27 | * from NAND into SDRAM and starts it from there. |
| 28 | */ |
| 29 | void nand_boot(void) |
| 30 | { |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 31 | __attribute__((noreturn)) void (*uboot)(void); |
| 32 | |
| 33 | /* |
| 34 | * Load U-Boot image from NAND into RAM |
| 35 | */ |
Anatolij Gustschin | b7fde58 | 2011-12-03 06:46:09 +0000 | [diff] [blame] | 36 | nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 37 | CONFIG_SYS_NAND_U_BOOT_SIZE, |
Anatolij Gustschin | b7fde58 | 2011-12-03 06:46:09 +0000 | [diff] [blame] | 38 | (void *)CONFIG_SYS_NAND_U_BOOT_DST); |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 39 | |
| 40 | #ifdef CONFIG_NAND_ENV_DST |
Anatolij Gustschin | b7fde58 | 2011-12-03 06:46:09 +0000 | [diff] [blame] | 41 | nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, |
| 42 | (void *)CONFIG_NAND_ENV_DST); |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 43 | |
| 44 | #ifdef CONFIG_ENV_OFFSET_REDUND |
Anatolij Gustschin | b7fde58 | 2011-12-03 06:46:09 +0000 | [diff] [blame] | 45 | nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, |
| 46 | (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); |
Heiko Schocher | 435199f | 2011-11-01 20:00:29 +0000 | [diff] [blame] | 47 | #endif |
| 48 | #endif |
| 49 | |
| 50 | /* |
| 51 | * Jump to U-Boot image |
| 52 | */ |
| 53 | uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START; |
| 54 | (*uboot)(); |
| 55 | } |