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 | * |
| 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> |
| 29 | |
| 30 | extern void pxa_dram_init(void); |
| 31 | |
| 32 | void board_init_f(unsigned long unused) |
| 33 | { |
| 34 | extern uint32_t _end; |
| 35 | uint32_t tmp; |
| 36 | |
| 37 | asm volatile("mov %0, pc" : "=r"(tmp)); |
| 38 | tmp >>= 24; |
| 39 | |
| 40 | /* The code runs from OneNAND RAM, copy SPL to SRAM and execute it. */ |
| 41 | if (tmp == 0) { |
| 42 | tmp = (uint32_t)&_end - CONFIG_SPL_TEXT_BASE; |
| 43 | onenand_spl_load_image(0, tmp, (void *)CONFIG_SPL_TEXT_BASE); |
| 44 | asm volatile("mov pc, %0" : : "r"(CONFIG_SPL_TEXT_BASE)); |
| 45 | } |
| 46 | |
| 47 | /* Hereby, the code runs from (S)RAM, copy U-Boot and execute it. */ |
| 48 | arch_cpu_init(); |
| 49 | pxa_dram_init(); |
| 50 | onenand_spl_load_image(CONFIG_SPL_ONENAND_LOAD_ADDR, |
| 51 | CONFIG_SPL_ONENAND_LOAD_SIZE, |
| 52 | (void *)CONFIG_SYS_TEXT_BASE); |
| 53 | asm volatile("mov pc, %0" : : "r"(CONFIG_SYS_TEXT_BASE)); |
| 54 | |
| 55 | for (;;) |
| 56 | ; |
| 57 | } |
| 58 | |
| 59 | void __attribute__((noreturn)) hang(void) |
| 60 | { |
| 61 | for (;;) |
| 62 | ; |
| 63 | } |
| 64 | |
| 65 | void icache_disable(void) {} |
| 66 | void dcache_disable(void) {} |