2 * Copyright (C) 2010 Jaccon Bastiaansen <jaccon.bastiaansen@gmail.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 #include <mach/imx-regs.h>
23 .section ".text_bare_init","ax"
25 .globl board_init_lowlevel
28 /* Save lr, because it is overwritten by the calls to mem_delay. */
32 * Initialize the AHB-Lite IP Interface (AIPI) module (to enable access to
33 * on chip peripherals) as described in section 7.2 of rev3 of the i.MX21
51 * Configure CPU core clock (266MHz), peripheral clock (133MHz) and enable
52 * the clock to peripherals.
64 * SDRAM and SDRAM controller configuration
68 * CSD1 not required, because the MX21ADS board only contains 64Mbyte.
69 * CS3 can therefore be made available.
75 /* Skip SDRAM initialization if we run from RAM */
106 /* Set mode register */
114 /* Back to Normal Mode */
118 /* Set NFC_CLK to 24MHz */
123 #ifdef CONFIG_NAND_IMX_BOOT
124 ldr sp, =TEXT_BASE - 4 /* Setup a temporary stack in SDRAM */
126 ldr r0, =IMX_NFC_BASE /* start of NFC SRAM */
127 ldr r2, =IMX_NFC_BASE + 0x800 /* end of NFC SRAM */
129 /* skip NAND boot if not running from NFC space */
135 /* Move ourselves out of NFC SRAM */
139 ldmia r0!, {r3-r9} /* copy from source address [r0] */
140 stmia r1!, {r3-r9} /* copy to target address [r1] */
141 cmp r0, r2 /* until source end addreee [r2] */
144 ldr pc, =1f /* Jump to SDRAM */
146 bl nand_boot /* Load barebox from NAND Flash */
148 ldr r1, =IMX_NFC_BASE - TEXT_BASE
149 sub r10, r10, r1 /* adjust return address from NFC */
151 #endif /* CONFIG_NAND_IMX_BOOT */
157 * spin for a while. we need to wait at least 200 usecs.
161 spin: subs r4, r4, #1