Marek Vasut | d7a3545 | 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 | * |
| 6 | * See file CREDITS for list of people who contributed to this |
| 7 | * project. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as |
| 11 | * published by the Free Software Foundation; either version 2 of |
| 12 | * the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 22 | * MA 02111-1307 USA |
| 23 | */ |
| 24 | |
| 25 | #include <common.h> |
| 26 | #include <config.h> |
| 27 | #include <asm/io.h> |
| 28 | #include <onenand_uboot.h> |
Marek Vasut | 71d058b | 2011-11-26 11:17:32 +0100 | [diff] [blame] | 29 | #include <asm/arch/pxa.h> |
Marek Vasut | d7a3545 | 2011-10-31 14:17:21 +0100 | [diff] [blame] | 30 | |
| 31 | void board_init_f(unsigned long unused) |
| 32 | { |
| 33 | extern uint32_t _end; |
| 34 | uint32_t tmp; |
| 35 | |
| 36 | asm volatile("mov %0, pc" : "=r"(tmp)); |
| 37 | tmp >>= 24; |
| 38 | |
| 39 | /* The code runs from OneNAND RAM, copy SPL to SRAM and execute it. */ |
| 40 | if (tmp == 0) { |
| 41 | tmp = (uint32_t)&_end - CONFIG_SPL_TEXT_BASE; |
| 42 | onenand_spl_load_image(0, tmp, (void *)CONFIG_SPL_TEXT_BASE); |
| 43 | asm volatile("mov pc, %0" : : "r"(CONFIG_SPL_TEXT_BASE)); |
| 44 | } |
| 45 | |
| 46 | /* Hereby, the code runs from (S)RAM, copy U-Boot and execute it. */ |
| 47 | arch_cpu_init(); |
Marek Vasut | 08341be | 2011-11-26 11:18:57 +0100 | [diff] [blame] | 48 | pxa2xx_dram_init(); |
Marek Vasut | d7a3545 | 2011-10-31 14:17:21 +0100 | [diff] [blame] | 49 | onenand_spl_load_image(CONFIG_SPL_ONENAND_LOAD_ADDR, |
| 50 | CONFIG_SPL_ONENAND_LOAD_SIZE, |
| 51 | (void *)CONFIG_SYS_TEXT_BASE); |
| 52 | asm volatile("mov pc, %0" : : "r"(CONFIG_SYS_TEXT_BASE)); |
| 53 | |
| 54 | for (;;) |
| 55 | ; |
| 56 | } |
| 57 | |
| 58 | void __attribute__((noreturn)) hang(void) |
| 59 | { |
| 60 | for (;;) |
| 61 | ; |
| 62 | } |