2 * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
4 * Copyright (C) 2010 Freescale Semiconductor, Inc.
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 <asm/arch/mx53.h>
26 * L2CC Cache setup/invalidation/disable
29 /* explicitly disable L2 cache */
30 mrc 15, 0, r0, c1, c0, 1
32 mcr 15, 0, r0, c1, c0, 1
34 /* reconfigure L2 cache aux control reg */
35 mov r0, #0xC0 /* tag RAM */
36 add r0, r0, #0x4 /* data RAM */
37 orr r0, r0, #(1 << 24) /* disable write allocate delay */
38 orr r0, r0, #(1 << 23) /* disable write allocate combine */
39 orr r0, r0, #(1 << 22) /* disable write allocate */
41 mcr 15, 1, r0, c9, c0, 2
44 /* AIPS setup - Only setup MPROTx registers.
45 * The PACR default values are good.*/
48 * Set all MPROTx to be non-bufferable, trusted for R/W,
49 * not forced to user-mode.
51 ldr r0, =AIPS1_BASE_ADDR
55 ldr r0, =AIPS2_BASE_ADDR
60 .macro setup_pll pll, freq
63 str r1, [r0, #PLL_DP_CTL]
65 str r1, [r0, #PLL_DP_CONFIG]
68 str r1, [r0, #PLL_DP_OP]
69 str r1, [r0, #PLL_DP_HFS_OP]
71 ldr r1, W_DP_MFD_\freq
72 str r1, [r0, #PLL_DP_MFD]
73 str r1, [r0, #PLL_DP_HFS_MFD]
75 ldr r1, W_DP_MFN_\freq
76 str r1, [r0, #PLL_DP_MFN]
77 str r1, [r0, #PLL_DP_HFS_MFN]
80 str r1, [r0, #PLL_DP_CTL]
81 1: ldr r1, [r0, #PLL_DP_CTL]
87 ldr r0, CCM_BASE_ADDR_W
89 /* Switch ARM to step clock */
91 str r1, [r0, #CLKCTL_CCSR]
93 setup_pll PLL1_BASE_ADDR, 800
95 setup_pll PLL3_BASE_ADDR, 400
97 /* Switch peripheral to PLL3 */
98 ldr r0, CCM_BASE_ADDR_W
99 ldr r1, CCM_VAL_0x00015154
100 str r1, [r0, #CLKCTL_CBCMR]
101 ldr r1, CCM_VAL_0x02888945
102 orr r1, r1, #(1 << 16)
103 str r1, [r0, #CLKCTL_CBCDR]
104 /* make sure change is effective */
105 1: ldr r1, [r0, #CLKCTL_CDHIPR]
109 setup_pll PLL2_BASE_ADDR, CONFIG_SYS_PLL2_FREQ
111 /* Switch peripheral to PLL2 */
112 ldr r0, CCM_BASE_ADDR_W
113 ldr r1, CCM_VAL_0x00808145
114 orr r1, r1, #(CONFIG_SYS_AHB_PODF << 10)
115 orr r1, r1, #(CONFIG_SYS_AXIA_PODF << 16)
116 orr r1, r1, #(CONFIG_SYS_AXIB_PODF << 19)
117 str r1, [r0, #CLKCTL_CBCDR]
119 ldr r1, CCM_VAL_0x00016154
120 str r1, [r0, #CLKCTL_CBCMR]
122 /* make sure change is effective */
123 1: ldr r1, [r0, #CLKCTL_CDHIPR]
127 setup_pll PLL3_BASE_ADDR, 216
129 /* Set the platform clock dividers */
130 ldr r0, PLATFORM_BASE_ADDR_W
131 ldr r1, PLATFORM_CLOCK_DIV_W
132 str r1, [r0, #PLATFORM_ICGC]
134 ldr r0, CCM_BASE_ADDR_W
136 str r1, [r0, #CLKCTL_CACRR]
138 /* Switch ARM back to PLL 1. */
140 str r1, [r0, #CLKCTL_CCSR]
142 ldr r1, [r0, #CLKCTL_CSCDR1]
146 str r1, [r0, #CLKCTL_CSCDR1]
148 /* Restore the default values in the Gate registers */
150 str r1, [r0, #CLKCTL_CCGR0]
151 str r1, [r0, #CLKCTL_CCGR1]
152 str r1, [r0, #CLKCTL_CCGR2]
153 str r1, [r0, #CLKCTL_CCGR3]
154 str r1, [r0, #CLKCTL_CCGR4]
155 str r1, [r0, #CLKCTL_CCGR5]
156 str r1, [r0, #CLKCTL_CCGR6]
157 str r1, [r0, #CLKCTL_CCGR7]
160 str r1, [r0, #CLKCTL_CCDR]
162 /* for cko - for ARM div by 8 */
164 add r1, r1, #0x00000F0
165 str r1, [r0, #CLKCTL_CCOSR]
168 .section ".text.init", "x"
173 #ifdef ENABLE_IMPRECISE_ABORT
174 mrs r1, spsr /* save old spsr */
175 mrs r0, cpsr /* read out the cpsr */
176 bic r0, r0, #0x100 /* clear the A bit */
177 msr spsr, r0 /* update spsr */
178 add lr, pc, #0x8 /* update lr */
179 movs pc, lr /* update cpsr */
184 msr spsr, r1 /* restore old spsr */
187 /* ARM errata ID #468414 */
188 mrc 15, 0, r1, c1, c0, 1
189 orr r1, r1, #(1 << 5) /* enable L1NEON bit */
190 mcr 15, 0, r1, c1, c0, 1
200 /* Board level setting value */
201 CCM_BASE_ADDR_W: .word CCM_BASE_ADDR
202 CCM_VAL_0x00016154: .word 0x00016154
203 CCM_VAL_0x00808145: .word 0x00808145
204 CCM_VAL_0x00015154: .word 0x00015154
205 CCM_VAL_0x02888945: .word 0x02888945
206 W_DP_OP_800: .word DP_OP_800
207 W_DP_MFD_800: .word DP_MFD_800
208 W_DP_MFN_800: .word DP_MFN_800
209 W_DP_OP_600: .word DP_OP_600
210 W_DP_MFD_600: .word DP_MFD_600
211 W_DP_MFN_600: .word DP_MFN_600
212 W_DP_OP_400: .word DP_OP_400
213 W_DP_MFD_400: .word DP_MFD_400
214 W_DP_MFN_400: .word DP_MFN_400
215 W_DP_OP_216: .word DP_OP_216
216 W_DP_MFD_216: .word DP_MFD_216
217 W_DP_MFN_216: .word DP_MFN_216
218 PLATFORM_BASE_ADDR_W: .word ARM_BASE_ADDR
219 PLATFORM_CLOCK_DIV_W: .word 0x00000124