2 * Board specific setup info
5 * Texas Instruments, <www.ti.com>
6 * Manikandan Pillai <mani.pillai@ti.com>
7 * This file is copied from board/omap3evm/platform.S
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,
29 #include <asm/arch/cpu.h>
30 #include <asm/arch/mem.h>
31 #include <asm/arch/clocks.h>
34 .word TEXT_BASE /* sdram load addr from config.mk */
36 #if !defined(CFG_NAND_BOOT) && !defined(CFG_NAND_BOOT)
37 /**************************************************************************
38 * cpy_clk_code: relocates clock code into SRAM where its safer to execute
39 * R1 = SRAM destination address.
40 *************************************************************************/
43 /* Copy DPLL code into SRAM */
44 adr r0, go_to_speed /* get addr of clock setting code */
45 mov r2, #384 /* r2 size to copy (div by 32 bytes) */
46 mov r1, r1 /* r1 <- dest address (passed in) */
47 add r2, r2, r0 /* r2 <- source end address */
49 ldmia r0!, {r3-r10} /* copy from source address [r0] */
50 stmia r1!, {r3-r10} /* copy to target address [r1] */
51 cmp r0, r2 /* until source end address [r2] */
53 mov pc, lr /* back to caller */
55 /* ****************************************************************************
56 * NOTE: 3430 X-loader currently does not use this code.
57 * It could be removed its is kept for compatabily with u-boot.
59 * go_to_speed: -Moves to bypass, -Commits clock dividers, -puts dpll at speed
60 * -executed from SRAM.
61 * R0 = CM_CLKEN_PLL-bypass value
62 * R1 = CM_CLKSEL1_PLL-m, n, and divider values
63 * R2 = CM_CLKSEL_CORE-divider values
64 * R3 = CM_IDLEST_CKGEN - addr dpll lock wait
66 * Note: If core unlocks/relocks and SDRAM is running fast already it gets
67 * confused. A reset of the controller gets it back. Taking away its
68 * L3 when its not in self refresh seems bad for it. Normally, this code
69 * runs from flash before SDR is init so that should be ok.
70 ******************************************************************************/
75 /* move into fast relock bypass */
79 ldr r5, [r3] /* get status */
80 and r5, r5, #0x1 /* isolate core status */
81 cmp r5, #0x1 /* still locked? */
82 beq wait1 /* if lock, loop */
84 /* set new dpll dividers _after_ in bypass */
86 str r1, [r5] /* set m, n, m2 */
88 str r2, [r5] /* set l3/l4/.. dividers*/
89 ldr r5, pll_div_add3 /* wkup */
90 ldr r2, pll_div_val3 /* rsm val */
92 ldr r5, pll_div_add4 /* gfx */
95 ldr r5, pll_div_add5 /* emu */
99 /* now prepare GPMC (flash) for new dpll speed */
100 /* flash needs to be stable when we jump back to it */
101 ldr r5, flash_cfg3_addr
102 ldr r2, flash_cfg3_val
104 ldr r5, flash_cfg4_addr
105 ldr r2, flash_cfg4_val
107 ldr r5, flash_cfg5_addr
108 ldr r2, flash_cfg5_val
110 ldr r5, flash_cfg1_addr
112 orr r2, r2, #0x3 /* up gpmc divider */
115 /* lock DPLL3 and wait a bit */
116 orr r0, r0, #0x7 /* set up for lock mode */
117 str r0, [r4] /* lock */
118 nop /* ARM slow at this point working at sys_clk */
123 ldr r5, [r3] /* get status */
124 and r5, r5, #0x1 /* isolate core status */
125 cmp r5, #0x1 /* still locked? */
126 bne wait2 /* if lock, loop */
132 mov pc, lr /* back to caller, locked */
134 _go_to_speed: .word go_to_speed
136 /* these constants need to be close for PIC code */
137 /* The Nor has to be in the Flash Base CS0 for this condition to happen */
139 .word (GPMC_CONFIG_CS0 + GPMC_CONFIG1)
141 .word (GPMC_CONFIG_CS0 + GPMC_CONFIG3)
143 .word STNOR_GPMC_CONFIG3
145 .word (GPMC_CONFIG_CS0 + GPMC_CONFIG4)
147 .word STNOR_GPMC_CONFIG4
149 .word STNOR_GPMC_CONFIG5
151 .word (GPMC_CONFIG_CS0 + GPMC_CONFIG5)
161 .word (WKUP_RSM << 1)
176 str ip, [sp] /* stash old link register */
177 mov ip, lr /* save link reg across call */
178 bl s_init /* go setup pll,mux,memory */
179 ldr ip, [sp] /* restore save ip */
180 mov lr, ip /* restore link reg */
182 /* back to arch calling code */
185 /* the literal pools origin */
191 .word LOW_LEVEL_SRAM_STACK
194 /* DPLL(1-4) PARAM TABLES */
195 /* Each of the tables has M, N, FREQSEL, M2 values defined for nominal
196 * OPP (1.2V). The fields are defined according to dpll_param struct(clock.c).
197 * The values are defined for all possible sysclk and for ES1 and ES2.
262 .globl get_mpu_dpll_param
264 adr r0, mpu_dpll_param
329 .globl get_iva_dpll_param
331 adr r0, iva_dpll_param
395 .globl get_core_dpll_param
397 adr r0, core_dpll_param
400 /* PER DPLL values are same for both ES1 and ES2 */
432 .globl get_per_dpll_param
434 adr r0, per_dpll_param