2 * Most of this taken from Redboot hal_platform_setup.h with cleanup
4 * NOTE: I haven't clean this up considerably, just enough to get it
5 * running. See hal_platform_setup.h for the source. See
6 * board/cradle/lowlevel_init.S for another PXA250 setup that is
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 #include <asm/arch/pxa-regs.h>
32 DRAM_SIZE: .long CFG_DRAM_SIZE
34 /* wait for coprocessor write complete */
36 mrc p15,0,\reg,c2,c0,0
48 /* Set up GPIO pins first ----------------------------------------- */
51 /* GPIO41, 42, 43, 44, 45, 46, 47, 48 */
52 ldr r0, =0x40E10438 @ GPIO41 FFRXD
56 ldr r0, =0x40E1043C @ GPIO42 FFTXD
60 ldr r0, =0x40E10440 @ GPIO43 FFCTS
64 ldr r0, =0x40E10444 @ GPIO 44 FFDCD
68 ldr r0, =0x40E10448 @ GPIO 45 FFDSR
72 ldr r0, =0x40E1044C @ GPIO 46 FFRI
76 ldr r0, =0x40E10450 @ GPIO 47 FFDTR
80 ldr r0, =0x40E10454 @ GPIO 48
84 /* tebrandt - ASCR, clear the RDH bit */
87 bic r1, r1, #0x80000000
90 /* ---------------------------------------------------------------- */
91 /* Enable memory interface */
93 /* The sequence below is based on the recommended init steps */
94 /* detailed in the Intel PXA250 Operating Systems Developers Guide, */
96 /* ---------------------------------------------------------------- */
98 /* ---------------------------------------------------------------- */
99 /* Step 1: Wait for at least 200 microsedonds to allow internal */
100 /* clocks to settle. Only necessary after hard reset... */
101 /* FIXME: can be optimized later */
102 /* ---------------------------------------------------------------- */
104 ldr r3, =OSCR /* reset the OS Timer Count to zero */
107 ldr r4, =0x300 /* really 0x2E1 is about 200usec, */
108 /* so 0x300 should be plenty */
116 /* configure the MEMCLKCFG register */
120 ldr r2, [r1] @ DELAY UNTIL WRITTEN
122 /* set CSADRCFG[0] to data flash SRAM mode */
126 ldr r2, [r1] @ DELAY UNTIL WRITTEN
128 /* set CSADRCFG[1] to data flash SRAM mode */
132 ldr r2, [r1] @ DELAY UNTIL WRITTEN
134 /* set MSC 0 register for SRAM memory */
138 ldr r2, [r1] @ DELAY UNTIL WRITTEN
140 /* set CSADRCFG[2] to data flash SRAM mode */
144 ldr r2, [r1] @ DELAY UNTIL WRITTEN
146 /* set CSADRCFG[3] to VLIO mode */
150 ldr r2, [r1] @ DELAY UNTIL WRITTEN
152 /* set MSC 1 register for VLIO memory */
156 ldr r2, [r1] @ DELAY UNTIL WRITTEN
159 /* This does not work in Zylonite. -SC */
166 /* Configure ACCR Register */
172 /* Configure MDCNFG Register */
173 ldr r0, =MDCNFG @ MDCNFG
178 /* Perform Resistive Compensation by configuring RCOMP register */
179 ldr r1, =RCOMP @ RCOMP
184 /* Configure MDMRS Register for SDCS0 */
185 ldr r1, =MDMRS @ MDMRS
192 /* Configure MDMRS Register for SDCS1 */
193 ldr r1, =MDMRS @ MDMRS
200 /* Configure MDREFR */
201 ldr r1, =MDREFR @ MDREFR
212 /* DDR Read-Strobe Delay Calibration */
213 /* bl ddr_calibration */
215 /* Here we assume the hardware calibration alwasy be successful. -SC */
216 /* Set DMCEN bit in MDCNFG Register */
217 ldr r0, =MDCNFG @ MDCNFG
219 orr r1, r1, #0x40000000 @ enable SDRAM for Normal Access
222 /* scrub/init SDRAM if enabled/present */
223 ldr r11, =0xa0000000 //RAM_BASE // base address of SDRAM
224 ldr r12, =0x04000000 // size of memory to scrub
225 mov r8,r12 // save DRAM size
226 mov r0, #0 // scrub with 0x0000:0000
234 10: /* fastScrubLoop */
235 subs r12, r12, #32 // 32 bytes/line
241 /* Mask all interrupts */
243 mcr p6, 0, r1, c1, c0, 0 @ ICMR
245 /* Disable software and data breakpoints */
247 mcr p15,0,r0,c14,c8,0 // ibcr0
248 mcr p15,0,r0,c14,c9,0 // ibcr1
249 mcr p15,0,r0,c14,c4,0 // dbcon
251 /* Enable all debug functionality */
253 mcr p14,0,r0,c10,c0,0 // dcsr
257 /* We are finished with Intel's memory controller initialisation */
260 /* ---------------------------------------------------------------- */
261 /* End lowlevel_init */
262 /* ---------------------------------------------------------------- */