blob: 47f44c3589c1421a1525dfa146182bcb5ee90c40 [file] [log] [blame]
Marek Vasut411b9ea2011-10-31 14:17:21 +01001/*
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 Vasut4438a452011-11-26 11:17:32 +010029#include <asm/arch/pxa.h>
Marek Vasut411b9ea2011-10-31 14:17:21 +010030
31void 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 Vasutf68d2a22011-11-26 11:18:57 +010048 pxa2xx_dram_init();
Marek Vasut411b9ea2011-10-31 14:17:21 +010049 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
58void __attribute__((noreturn)) hang(void)
59{
60 for (;;)
61 ;
62}