2 * Board specific setup info
5 * Texas Instruments, <www.ti.com>
6 * Richard Woodruff <r-woodruff2@ti.com>
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <asm/arch/omap2420.h>
30 #include <asm/arch/mem.h>
31 #include <asm/arch/clocks.h>
34 .word TEXT_BASE /* sdram load addr from config.mk */
36 /**************************************************************************
37 * cpy_clk_code: relocates clock code into SRAM where its safer to execute
38 * R1 = SRAM destination address.
39 *************************************************************************/
42 /* Copy DPLL code into SRAM */
43 adr r0, go_to_speed /* get addr of clock setting code */
44 mov r2, #384 /* r2 size to copy (div by 32 bytes) */
45 mov r1, r1 /* r1 <- dest address (passed in) */
46 add r2, r2, r0 /* r2 <- source end address */
48 ldmia r0!, {r3-r10} /* copy from source address [r0] */
49 stmia r1!, {r3-r10} /* copy to target address [r1] */
50 cmp r0, r2 /* until source end address [r2] */
52 mov pc, lr /* back to caller */
54 /* ****************************************************************************
55 * go_to_speed: -Moves to bypass, -Commits clock dividers, -puts dpll at speed
56 * -executed from SRAM.
57 * R0 = PRCM_CLKCFG_CTRL - addr of valid reg
58 * R1 = CM_CLKEN_PLL - addr dpll ctlr reg
60 * R3 = CM_IDLEST_CKGEN - addr dpll lock wait
61 ******************************************************************************/
64 sub sp, sp, #0x4 /* get some stack space */
65 str r4, [sp] /* save r4's value */
67 /* move into fast relock bypass */
73 ldr r8, [r4] /* wait for bypass to take effect */
78 /* set new dpll dividers _after_ in bypass */
83 /* now prepare GPMC (flash) for new dpll speed */
84 /* flash needs to be stable when we jump back to it */
93 orr r8, r8, #0x3 /* up gpmc divider */
96 /* setup to 2x loop though code. The first loop pre-loads the
97 * icache, the 2nd commits the prcm config, and locks the dpll
99 mov r4, #0x1000 /* spin spin spin */
100 mov r8, #0x4 /* first pass condition & set registers */
103 ldrne r8, [r3] /* DPLL lock check */
109 streq r8, [r0] /* commit dividers (2nd time) */
112 sub r4, r4, #0x1 /* Loop currently necessary else bad jumps */
119 streq r2, [r1] /* lock dpll (2nd time) */
122 sub r4, r4, #0x1 /* loop currently necessary else bad jumps */
129 ldreq r8, [r3] /* get lock condition for dpll */
130 cmp r8, #0x4 /* first time though? */
132 moveq r8, #0x2 /* set to dpll check condition. */
133 beq 3b /* if condition not true branch */
136 add sp, sp, #0x4 /* return stack space */
137 mov pc, lr /* back to caller, locked */
139 _go_to_speed: .word go_to_speed
141 /* these constants need to be close for PIC code */
145 .word H4_24XX_GPMC_CONFIG3_0
149 .word H4_24XX_GPMC_CONFIG4_0
155 .word CM_IDLEST_CKGEN
159 .word DPLL_VAL /* DPLL setting (300MHz default) */
164 str ip, [sp] /* stash old link register */
165 mov ip, lr /* save link reg across call */
166 bl s_init /* go setup pll,mux,memory */
167 ldr ip, [sp] /* restore save ip */
168 mov lr, ip /* restore link reg */
170 /* map interrupt controller */
171 ldr r0, VAL_INTH_SETUP
172 mcr p15, 0, r0, c15, c2, 4
174 /* back to arch calling code */
177 /* the literal pools origin */
183 .word PERIFERAL_PORT_BASE
185 .word LOW_LEVEL_SRAM_STACK