2 * Board specific setup info
5 * Texas Instruments, <www.ti.com>
6 * Kshitij Gupta <Kshitij@ti.com>
8 * Modified for OMAP 1610 H2 board by Nishant Kamat, Jan 2004
10 * Modified for OMAP 5912 OSK board by Rishi Bhattacharya, Apr 2004
11 * See file CREDITS for list of people who contributed to this
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
33 #if defined(CONFIG_OMAP1610)
34 #include <./configs/omap1510.h>
39 .word TEXT_BASE /* sdram load addr from config.mk */
44 /*------------------------------------------------------*
45 * Ensure i-cache is enabled *
46 * To configure TC regs without fetching instruction *
47 *------------------------------------------------------*/
48 mrc p15, 0, r0, c1, c0
50 mcr p15, 0, r0, c1, c0
52 /*------------------------------------------------------*
53 *mask all IRQs by setting all bits in the INTMR default*
54 *------------------------------------------------------*/
61 /*------------------------------------------------------*
62 * Set up ARM CLM registers (IDLECT1) *
63 *------------------------------------------------------*/
64 ldr r0, REG_ARM_IDLECT1
65 ldr r1, VAL_ARM_IDLECT1
68 /*------------------------------------------------------*
69 * Set up ARM CLM registers (IDLECT2) *
70 *------------------------------------------------------*/
71 ldr r0, REG_ARM_IDLECT2
72 ldr r1, VAL_ARM_IDLECT2
75 /*------------------------------------------------------*
76 * Set up ARM CLM registers (IDLECT3) *
77 *------------------------------------------------------*/
78 ldr r0, REG_ARM_IDLECT3
79 ldr r1, VAL_ARM_IDLECT3
82 mov r1, #0x01 /* PER_EN bit */
83 ldr r0, REG_ARM_RSTCT2
84 strh r1, [r0] /* CLKM; Peripheral reset. */
86 /* Set CLKM to Sync-Scalable */
94 cmp r2, #0x100 /* wait for any bubbles to finish */
101 /* a few nops to let settle */
114 /* Ramp up the clock to 96Mhz */
115 ldr r1, VAL_DPLL1_CTL
116 ldr r0, REG_DPLL1_CTL
118 ands r1, r1, #0x10 /* Check if PLL is enabled. */
119 beq lock_end /* Do not look for lock if BYPASS selected */
122 ands r1, r1, #0x01 /* Check the LOCK bit.*/
123 beq 2b /* loop until bit goes hi. */
126 /*------------------------------------------------------*
127 * Turn off the watchdog during init... *
128 *------------------------------------------------------*/
130 ldr r1, WATCHDOG_VAL1
132 ldr r1, WATCHDOG_VAL2
153 /* Set memory timings corresponding to the new clock speed */
154 ldr r3, VAL_SDRAM_CONFIG_SDF0
156 /* Check execution location to determine current execution location
157 * and branch to appropriate initialization code.
159 mov r0, #0x10000000 /* Load physical SDRAM base. */
160 mov r1, pc /* Get current execution location. */
161 cmp r1, r0 /* Compare. */
162 bge skip_sdram /* Skip over EMIF-fast initialization if running from SDRAM. */
164 /* identify the device revision, -- TMX or TMP(TMS) */
165 ldr r0, REG_DEVICE_ID
168 ldr r0, VAL_DEVICE_ID_TMP
174 /* Enable TMP/TMS device new features */
176 ldr r1, REG_TC_EMIFF_DOUBLER
179 /* Enable new ac parameters */
181 ldr r1, REG_SDRAM_CONFIG2
184 ldr r3, VAL_SDRAM_CONFIG_SDF1
189 * Delay for SDRAM initialization.
191 mov r0, #0x1800 /* value should be checked */
193 subs r0, r0, #0x1 /* Decrement count */
197 * Set SDRAM control values. Disable refresh before MRS command.
200 /* mobile ddr operation */
201 ldr r0, REG_SDRAM_OPERATION
205 /* config register */
206 ldr r0, REG_SDRAM_CONFIG
209 /* manual command register */
210 ldr r0, REG_SDRAM_MANUAL_CMD
212 /* issue set cke high */
213 mov r1, #CMD_SDRAM_CKE_SET_HIGH
217 mov r1, #CMD_SDRAM_NOP
223 bne waitMDDR1 /* delay loop */
225 /* issue precharge */
226 mov r1, #CMD_SDRAM_PRECHARGE
229 /* issue autorefresh x 2 */
230 mov r1, #CMD_SDRAM_AUTOREFRESH
234 /* mrs register ddr mobile */
235 ldr r0, REG_SDRAM_MRS
239 /* emrs1 low-power register */
240 ldr r0, REG_SDRAM_EMRS1
241 /* self refresh on all banks */
245 ldr r0, REG_DLL_URD_CONTROL
246 ldr r1, DLL_URD_CONTROL_VAL
249 ldr r0, REG_DLL_LRD_CONTROL
250 ldr r1, DLL_LRD_CONTROL_VAL
253 ldr r0, REG_DLL_WRT_CONTROL
254 ldr r1, DLL_WRT_CONTROL_VAL
264 * Delay for SDRAM initialization.
268 subs r0, r0, #1 /* Decrement count. */
273 ldr r0, REG_SDRAM_CONFIG
278 ldr r1, VAL_TC_EMIFS_CS0_CONFIG
279 ldr r0, REG_TC_EMIFS_CS0_CONFIG
280 str r1, [r0] /* Chip Select 0 */
282 ldr r1, VAL_TC_EMIFS_CS1_CONFIG
283 ldr r0, REG_TC_EMIFS_CS1_CONFIG
284 str r1, [r0] /* Chip Select 1 */
286 ldr r1, VAL_TC_EMIFS_CS3_CONFIG
287 ldr r0, REG_TC_EMIFS_CS3_CONFIG
288 str r1, [r0] /* Chip Select 3 */
290 ldr r1, VAL_TC_EMIFS_DWS
291 ldr r0, REG_TC_EMIFS_DWS
292 str r1, [r0] /* Enable EMIFS.RDY for CS1 (ether) */
294 #ifdef CONFIG_H2_OMAP1610
295 /* inserting additional 2 clock cycle hold time for LAN */
296 ldr r0, REG_TC_EMIFS_CS1_ADVANCED
297 ldr r1, VAL_TC_EMIFS_CS1_ADVANCED
300 /* Start MPU Timer 1 */
301 ldr r0, REG_MPU_LOAD_TIMER
302 ldr r1, VAL_MPU_LOAD_TIMER
305 ldr r0, REG_MPU_CNTL_TIMER
306 ldr r1, VAL_MPU_CNTL_TIMER
309 /* back to arch calling code */
312 /* the literal pools origin */
315 REG_DEVICE_ID: /* 32 bits */
319 REG_TC_EMIFS_CS0_CONFIG: /* 32 bits */
321 REG_TC_EMIFS_CS1_CONFIG: /* 32 bits */
323 REG_TC_EMIFS_CS2_CONFIG: /* 32 bits */
325 REG_TC_EMIFS_CS3_CONFIG: /* 32 bits */
327 REG_TC_EMIFS_DWS: /* 32 bits */
329 #ifdef CONFIG_H2_OMAP1610
330 REG_TC_EMIFS_CS1_ADVANCED: /* 32 bits */
334 /* MPU clock/reset/power mode control registers */
335 REG_ARM_CKCTL: /* 16 bits */
337 REG_ARM_IDLECT3: /* 16 bits */
339 REG_ARM_IDLECT2: /* 16 bits */
341 REG_ARM_IDLECT1: /* 16 bits */
343 REG_ARM_RSTCT2: /* 16 bits */
345 REG_ARM_SYSST: /* 16 bits */
348 /* DPLL control registers */
349 REG_DPLL1_CTL: /* 16 bits */
352 /* Watch Dog register */
353 /* secure watchdog stop */
356 /* watchdog write pending */
365 /* SDRAM config is: auto refresh enabled, 16 bit 4 bank,
366 counter @8192 rows, 10 ns, 8 burst */
371 REG_TC_EMIFF_DOUBLER: /* 32 bits */
374 /* Operation register */
378 /* Manual command register */
379 REG_SDRAM_MANUAL_CMD:
382 /* SDRAM MRS (New) config is: CAS latency is 2, burst length 8 */
386 /* SDRAM MRS (New) config is: CAS latency is 2, burst length 8 */
390 /* WRT DLL register */
394 .word 0x03f00002 /* Phase of 72deg, write offset +31 */
396 /* URD DLL register */
400 .word 0x00800002 /* Phase of 72deg, read offset +31 */
402 /* LRD DLL register */
406 .word 0x00800002 /* read offset +31 */
424 /* 96 MHz Samsung Mobile DDR */
425 /* Original setting for TMX device */
426 VAL_SDRAM_CONFIG_SDF0:
429 /* NEW_SYS_FREQ mode (valid only TMP/TMS devices) */
430 VAL_SDRAM_CONFIG_SDF1:
434 .word 0x2000 /* was: 0x3000, now use CLK_REF for timer input */
438 #ifdef CONFIG_OSK_OMAP5912
439 VAL_TC_EMIFS_CS0_CONFIG:
441 VAL_TC_EMIFS_CS1_CONFIG:
443 VAL_TC_EMIFS_CS2_CONFIG:
445 VAL_TC_EMIFS_CS3_CONFIG:
447 VAL_TC_EMIFS_DWS: /* Enable EMIFS.RDY for CS1 access (ether) */
449 VAL_DEVICE_ID_TMP: /* TMP/TMS=0xb65f, TMX=0xb58c */
453 #ifdef CONFIG_H2_OMAP1610
454 VAL_TC_EMIFS_CS0_CONFIG:
456 VAL_TC_EMIFS_CS1_CONFIG:
458 VAL_TC_EMIFS_CS2_CONFIG:
460 VAL_TC_EMIFS_CS3_CONFIG:
462 VAL_TC_EMIFS_CS1_ADVANCED:
474 .equ CMD_SDRAM_NOP, 0x00000000
475 .equ CMD_SDRAM_PRECHARGE, 0x00000001
476 .equ CMD_SDRAM_AUTOREFRESH, 0x00000002
477 .equ CMD_SDRAM_CKE_SET_HIGH, 0x00000007