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/mx50.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]
88 setup_pll PLL3_BASE_ADDR, 400
90 /* Switch peripheral to PLL3 */
91 /* Set periph_clk_sel[1:0]=0b10 to PLL3 */
93 ldr r0, CCM_BASE_ADDR_W
94 ldr r1, [r0, #CLKCTL_CBCDR]
95 orr r1, r1, #(3 << 25)
96 eor r1, r1, #(3 << 25)
97 orr r1, r1, #(2 << 25)
98 str r1, [r0, #CLKCTL_CBCDR]
100 /* make sure change is effective */
101 1: ldr r1, [r0, #CLKCTL_CDHIPR]
105 setup_pll PLL2_BASE_ADDR, CONFIG_SYS_PLL2_FREQ
107 /* Switch peripheral to PLL2 */
108 /* Set periph_clk_sel[1:0]=0b01 to PLL2 */
110 ldr r0, CCM_BASE_ADDR_W
111 ldr r1, [r0, #CLKCTL_CBCDR]
112 orr r1, r1, #(3 << 25)
113 eor r1, r1, #(3 << 25)
114 orr r1, r1, #(1 << 25)
116 orr r1, r1, #(CONFIG_SYS_AHB_PODF << 10)
117 orr r1, r1, #(CONFIG_SYS_AXIA_PODF << 16)
118 orr r1, r1, #(CONFIG_SYS_AXIB_PODF << 19)
119 str r1, [r0, #CLKCTL_CBCDR]
121 /* make sure change is effective */
122 1: ldr r1, [r0, #CLKCTL_CDHIPR]
126 setup_pll PLL3_BASE_ADDR, 216
128 /* Set the platform clock dividers */
129 ldr r0, PLATFORM_BASE_ADDR_W
130 ldr r1, PLATFORM_CLOCK_DIV_W
131 str r1, [r0, #PLATFORM_ICGC]
133 /* ARM2 run at full speed */
134 ldr r0, CCM_BASE_ADDR_W
136 str r1, [r0, #CLKCTL_CACRR]
138 /* make sure change is effective */
139 1: ldr r1, [r0, #CLKCTL_CDHIPR]
143 /* Restore the default values in the Gate registers */
145 str r1, [r0, #CLKCTL_CCGR0]
146 str r1, [r0, #CLKCTL_CCGR1]
147 str r1, [r0, #CLKCTL_CCGR2]
148 str r1, [r0, #CLKCTL_CCGR3]
149 str r1, [r0, #CLKCTL_CCGR4]
150 str r1, [r0, #CLKCTL_CCGR5]
151 str r1, [r0, #CLKCTL_CCGR6]
152 str r1, [r0, #CLKCTL_CCGR7]
154 /* for cko - for ARM div by 8 */
156 add r1, r1, #0x00000F0
157 str r1, [r0, #CLKCTL_CCOSR]
160 .section ".text.init", "x"
165 #ifdef ENABLE_IMPRECISE_ABORT
166 mrs r1, spsr /* save old spsr */
167 mrs r0, cpsr /* read out the cpsr */
168 bic r0, r0, #0x100 /* clear the A bit */
169 msr spsr, r0 /* update spsr */
170 add lr, pc, #0x8 /* update lr */
171 movs pc, lr /* update cpsr */
176 msr spsr, r1 /* restore old spsr */
179 /* ARM errata ID #468414 */
180 mrc 15, 0, r1, c1, c0, 1
181 orr r1, r1, #(1 << 5) /* enable L1NEON bit */
182 mcr 15, 0, r1, c1, c0, 1
188 init_clock /* not finished */
192 /* Board level setting value */
193 CCM_BASE_ADDR_W: .word CCM_BASE_ADDR
194 W_DP_OP_800: .word DP_OP_800
195 W_DP_MFD_800: .word DP_MFD_800
196 W_DP_MFN_800: .word DP_MFN_800
197 W_DP_OP_600: .word DP_OP_600
198 W_DP_MFD_600: .word DP_MFD_600
199 W_DP_MFN_600: .word DP_MFN_600
200 W_DP_OP_400: .word DP_OP_400
201 W_DP_MFD_400: .word DP_MFD_400
202 W_DP_MFN_400: .word DP_MFN_400
203 W_DP_OP_216: .word DP_OP_216
204 W_DP_MFD_216: .word DP_MFD_216
205 W_DP_MFN_216: .word DP_MFN_216
206 PLATFORM_BASE_ADDR_W: .word ARM_BASE_ADDR
207 PLATFORM_CLOCK_DIV_W: .word 0x00000124