Marek Vasut | 411b9ea | 2011-10-31 14:17:21 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Voipac PXA270 OneNAND SPL |
| 3 | * |
| 4 | * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com> |
| 5 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Marek Vasut | 411b9ea | 2011-10-31 14:17:21 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <config.h> |
| 11 | #include <asm/io.h> |
| 12 | #include <onenand_uboot.h> |
Marek Vasut | 4438a45 | 2011-11-26 11:17:32 +0100 | [diff] [blame] | 13 | #include <asm/arch/pxa.h> |
Marek Vasut | 411b9ea | 2011-10-31 14:17:21 +0100 | [diff] [blame] | 14 | |
| 15 | void board_init_f(unsigned long unused) |
| 16 | { |
| 17 | extern uint32_t _end; |
| 18 | uint32_t tmp; |
| 19 | |
| 20 | asm volatile("mov %0, pc" : "=r"(tmp)); |
| 21 | tmp >>= 24; |
| 22 | |
| 23 | /* The code runs from OneNAND RAM, copy SPL to SRAM and execute it. */ |
| 24 | if (tmp == 0) { |
| 25 | tmp = (uint32_t)&_end - CONFIG_SPL_TEXT_BASE; |
| 26 | onenand_spl_load_image(0, tmp, (void *)CONFIG_SPL_TEXT_BASE); |
| 27 | asm volatile("mov pc, %0" : : "r"(CONFIG_SPL_TEXT_BASE)); |
| 28 | } |
| 29 | |
| 30 | /* Hereby, the code runs from (S)RAM, copy U-Boot and execute it. */ |
| 31 | arch_cpu_init(); |
Marek Vasut | f68d2a2 | 2011-11-26 11:18:57 +0100 | [diff] [blame] | 32 | pxa2xx_dram_init(); |
Marek Vasut | 411b9ea | 2011-10-31 14:17:21 +0100 | [diff] [blame] | 33 | onenand_spl_load_image(CONFIG_SPL_ONENAND_LOAD_ADDR, |
| 34 | CONFIG_SPL_ONENAND_LOAD_SIZE, |
| 35 | (void *)CONFIG_SYS_TEXT_BASE); |
| 36 | asm volatile("mov pc, %0" : : "r"(CONFIG_SYS_TEXT_BASE)); |
| 37 | |
| 38 | for (;;) |
| 39 | ; |
| 40 | } |
| 41 | |
| 42 | void __attribute__((noreturn)) hang(void) |
| 43 | { |
| 44 | for (;;) |
| 45 | ; |
| 46 | } |