]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/cpu/arm920t/at91rm9200/lowlevel_init.S
omap4: clock init support for omap4460
[karo-tx-uboot.git] / arch / arm / cpu / arm920t / at91rm9200 / lowlevel_init.S
1 /*
2  * Memory Setup stuff - taken from blob memsetup.S
3  *
4  * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
5  *                     Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
6  *
7  * Modified for the at91rm9200dk board by
8  * (C) Copyright 2004
9  * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
10  *
11  * See file CREDITS for list of people who contributed to this
12  * project.
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License as
16  * published by the Free Software Foundation; either version 2 of
17  * the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27  * MA 02111-1307 USA
28  */
29
30 #include <config.h>
31 #include <version.h>
32
33 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
34 /*
35  * some parameters for the board
36  *
37  * This is based on rm9200dk.cfg for the BDI2000 from ABATRON which in
38  * turn is based on the boot.bin code from ATMEL
39  *
40  */
41 #include <asm/arch/AT91RM9200.h>
42
43 _MTEXT_BASE:
44 #undef START_FROM_MEM
45 #ifdef START_FROM_MEM
46         .word   CONFIG_SYS_TEXT_BASE-PHYS_FLASH_1
47 #else
48         .word   CONFIG_SYS_TEXT_BASE
49 #endif
50
51 .globl lowlevel_init
52 lowlevel_init:
53         /* Get the CKGR Base Address */
54         ldr     r1, =AT91C_BASE_CKGR
55         /* Main oscillator Enable register */
56 #ifdef CONFIG_SYS_USE_MAIN_OSCILLATOR
57         ldr     r0, =0x0000FF01         /* Enable main oscillator,  OSCOUNT = 0xFF */
58 #else
59         ldr     r0, =0x0000FF00         /* Disable main oscillator, OSCOUNT = 0xFF */
60 #endif
61         str     r0, [r1, #AT91C_CKGR_MOR]
62         /* Add loop to compensate Main Oscillator startup time */
63         ldr     r0, =0x00000010
64 LoopOsc:
65         subs    r0, r0, #1
66         bhi     LoopOsc
67
68         /* memory control configuration */
69         /* this isn't very elegant, but  what the heck */
70         ldr     r0, =SMRDATA
71         ldr     r1, _MTEXT_BASE
72         sub     r0, r0, r1
73         add     r2, r0, #80
74 0:
75         /* the address */
76         ldr     r1, [r0], #4
77         /* the value */
78         ldr     r3, [r0], #4
79         str     r3, [r1]
80         cmp     r2, r0
81         bne     0b
82         /* delay - this is all done by guess */
83         ldr     r0, =0x00010000
84         /* (vs reading PMC_SR for LOCKA, LOCKB ... or MOSCS earlier) */
85 1:
86         subs    r0, r0, #1
87         bhi     1b
88         ldr     r0, =SMRDATA1
89         ldr     r1, _MTEXT_BASE
90         sub     r0, r0, r1
91         add     r2, r0, #176
92 2:
93         /* the address */
94         ldr     r1, [r0], #4
95         /* the value */
96         ldr     r3, [r0], #4
97         str     r3, [r1]
98         cmp     r2, r0
99         bne     2b
100
101         /* switch from FastBus to Asynchronous clock mode */
102         mrc     p15, 0, r0, c1, c0, 0
103         orr     r0, r0, #0xC0000000     @ set bit 31 (iA) and 30 (nF)
104         mcr     p15, 0, r0, c1, c0, 0
105
106         /* everything is fine now */
107         mov     pc, lr
108
109         .ltorg
110
111 SMRDATA:
112         .word AT91C_EBI_CFGR
113         .word CONFIG_SYS_EBI_CFGR_VAL
114         .word AT91C_SMC_CSR0
115         .word CONFIG_SYS_SMC_CSR0_VAL
116         .word AT91C_PLLAR
117         .word CONFIG_SYS_PLLAR_VAL
118         .word AT91C_PLLBR
119         .word CONFIG_SYS_PLLBR_VAL
120         .word AT91C_MCKR
121         .word CONFIG_SYS_MCKR_VAL
122         /* here there's a delay */
123 SMRDATA1:
124         .word AT91C_PIOC_ASR
125         .word CONFIG_SYS_PIOC_ASR_VAL
126         .word AT91C_PIOC_BSR
127         .word CONFIG_SYS_PIOC_BSR_VAL
128         .word AT91C_PIOC_PDR
129         .word CONFIG_SYS_PIOC_PDR_VAL
130         .word AT91C_EBI_CSA
131         .word CONFIG_SYS_EBI_CSA_VAL
132         .word AT91C_SDRC_CR
133         .word CONFIG_SYS_SDRC_CR_VAL
134         .word AT91C_SDRC_MR
135         .word CONFIG_SYS_SDRC_MR_VAL
136         .word CONFIG_SYS_SDRAM
137         .word CONFIG_SYS_SDRAM_VAL
138         .word AT91C_SDRC_MR
139         .word CONFIG_SYS_SDRC_MR_VAL1
140         .word CONFIG_SYS_SDRAM
141         .word CONFIG_SYS_SDRAM_VAL
142         .word CONFIG_SYS_SDRAM
143         .word CONFIG_SYS_SDRAM_VAL
144         .word CONFIG_SYS_SDRAM
145         .word CONFIG_SYS_SDRAM_VAL
146         .word CONFIG_SYS_SDRAM
147         .word CONFIG_SYS_SDRAM_VAL
148         .word CONFIG_SYS_SDRAM
149         .word CONFIG_SYS_SDRAM_VAL
150         .word CONFIG_SYS_SDRAM
151         .word CONFIG_SYS_SDRAM_VAL
152         .word CONFIG_SYS_SDRAM
153         .word CONFIG_SYS_SDRAM_VAL
154         .word CONFIG_SYS_SDRAM
155         .word CONFIG_SYS_SDRAM_VAL
156         .word AT91C_SDRC_MR
157         .word CONFIG_SYS_SDRC_MR_VAL2
158         .word CONFIG_SYS_SDRAM1
159         .word CONFIG_SYS_SDRAM_VAL
160         .word AT91C_SDRC_TR
161         .word CONFIG_SYS_SDRC_TR_VAL
162         .word CONFIG_SYS_SDRAM
163         .word CONFIG_SYS_SDRAM_VAL
164         .word AT91C_SDRC_MR
165         .word CONFIG_SYS_SDRC_MR_VAL3
166         .word CONFIG_SYS_SDRAM
167         .word CONFIG_SYS_SDRAM_VAL
168         /* SMRDATA1 is 176 bytes long */
169 #endif /* CONFIG_SKIP_LOWLEVEL_INIT */