2 * (C) Copyright 2007 OpenMoko, Inc.
4 * Configuation settings for the OPENMOKO Neo GTA02 Linux GSM phone
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 #include <neo_gta02.h>
27 /* if we are injected by JTAG, the script sets _istag content to nonzero */
31 /* it's at a fixed address (+0x8) so we can breakpoint it in the JTAG script
32 * we need to go through this hassle because before this moment, SDRAM is not
33 * working so we can't prep it from JTAG
37 ldr pc, _start_armboot
46 * These are defined in the board-specific linker script.
58 * set the cpu to SVC32 mode
65 # define pWTCON 0x53000000
72 * mask all IRQs by setting all bits in the INTMR - default
74 # define INTMSK 0x4A000008 /* Interupt-Controller base addresses */
75 # define INTSUBMSK 0x4A00001C
76 # define INTSUBMSK_val 0x0000ffff
82 ldr r1, =INTSUBMSK_val
87 /* Make sure we get FCLK:HCLK:PCLK = 1:3:6 */
88 # define CAMDIVN 0x4C000018
94 /* Clock asynchronous mode */
95 mrc p15, 0, r1, c1, c0, 0
96 orr r1, r1, #0xc0000000
97 mcr p15, 0, r1, c1, c0, 0
99 #define LOCKTIME 0x4c000000
105 # define UPLLCON 0x4c000008
106 # define MPLLCON_val ((142 << 12) + (7 << 4) + 1)
107 # define UPLLCON_val (( 88 << 12) + (8 << 4) + 2)
113 /* Page 7-19, seven nops between UPLL and MPLL */
123 str r1, [r0, #-4] /* MPLLCON */
125 # define CLKDIVN 0x4C000014 /* clock divisor register */
126 # define CLKDIVN_val 7 /* FCLK:HCLK:PCLK = 1:3:6 */
128 /* FCLK:HCLK:PCLK = 1:3:6 */
133 /* enable only CPU peripheral block clocks we actually use */
134 ldr r0, =0x4c00000c /* clkcon */
135 ldr r1, =0x3d10 /* uart, pwm, gpio, nand clocks on */
138 /* gpio UART2 init, H port */
143 /* enable KEEPACT(GPJ8) to make sure PMU keeps us alive */
144 ldr r0, =0x56000000 /* GPJ base */
145 ldr r1, [r0, #0xd0] /* GPJCON */
146 orr r1, r1, #(1 << 16)
149 ldr r1, [r0, #0xd4] /* GPJDAT */
150 orr r1, r1, #(1 << 8)
173 /* reset nand controller, or it is dead to us */
176 ldr r2, =0xfff0 @ initial value tacls=3,rph0=7,rph1=7
182 orr r3, r3, #1 @ enable nand controller
185 /* >> CFG_VIDEO_LOGO_MAX_SIZE */
186 #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
189 ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
190 sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
191 sub sp, r0, #12 /* leave 3 words for abort-stack */
194 ldr r0, _bss_start /* find start of bss segment */
195 ldr r1, _bss_end /* stop here */
196 mov r2, #0x00000000 /* clear */
199 str r2, [r0] /* clear loop... */
204 /* we are going to jump into the C part of the init now */
206 b _steppingstone_done
209 *************************************************************************
211 * CPU_init_critical registers
213 * setup important registers
214 * setup memory timing
216 *************************************************************************
222 * flush v4 I/D caches
225 mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
226 mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
229 * disable MMU stuff and caches
231 mrc p15, 0, r0, c1, c0, 0
232 bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
233 bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
234 orr r0, r0, #0x00000002 @ set bit 2 (A) Align
235 orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
236 mcr p15, 0, r0, c1, c0, 0
239 * before relocating, we have to setup RAM timing
240 * because memory timing is board-dependend, you will
241 * find a lowlevel_init.S in your board directory.