2 * Board specific setup info
5 * Texas Instruments, <www.ti.com>
7 * -- Some bits of code used from rrload's head_OMAP1510.s --
8 * Copyright (C) 2002 RidgeRun, Inc.
10 * SPDX-License-Identifier: GPL-2.0+
16 #if defined(CONFIG_OMAP1510)
17 #include <./configs/omap1510.h>
20 #define OMAP1510_CLKS ((1<<EN_XORPCK)|(1<<EN_PERCK)|(1<<EN_TIMCK)|(1<<EN_GPIOCK))
24 .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */
30 * Configure 1510 pins functions to match our board.
32 ldr r0, REG_PULL_DWN_CTRL_0
33 ldr r1, VAL_PULL_DWN_CTRL_0
35 ldr r0, REG_PULL_DWN_CTRL_1
36 ldr r1, VAL_PULL_DWN_CTRL_1
38 ldr r0, REG_PULL_DWN_CTRL_2
39 ldr r1, VAL_PULL_DWN_CTRL_2
41 ldr r0, REG_PULL_DWN_CTRL_3
42 ldr r1, VAL_PULL_DWN_CTRL_3
44 ldr r0, REG_FUNC_MUX_CTRL_4
45 ldr r1, VAL_FUNC_MUX_CTRL_4
47 ldr r0, REG_FUNC_MUX_CTRL_5
48 ldr r1, VAL_FUNC_MUX_CTRL_5
50 ldr r0, REG_FUNC_MUX_CTRL_6
51 ldr r1, VAL_FUNC_MUX_CTRL_6
53 ldr r0, REG_FUNC_MUX_CTRL_7
54 ldr r1, VAL_FUNC_MUX_CTRL_7
56 ldr r0, REG_FUNC_MUX_CTRL_8
57 ldr r1, VAL_FUNC_MUX_CTRL_8
59 ldr r0, REG_FUNC_MUX_CTRL_9
60 ldr r1, VAL_FUNC_MUX_CTRL_9
62 ldr r0, REG_FUNC_MUX_CTRL_A
63 ldr r1, VAL_FUNC_MUX_CTRL_A
65 ldr r0, REG_FUNC_MUX_CTRL_B
66 ldr r1, VAL_FUNC_MUX_CTRL_B
68 ldr r0, REG_FUNC_MUX_CTRL_C
69 ldr r1, VAL_FUNC_MUX_CTRL_C
71 ldr r0, REG_FUNC_MUX_CTRL_D
72 ldr r1, VAL_FUNC_MUX_CTRL_D
74 ldr r0, REG_VOLTAGE_CTRL_0
75 ldr r1, VAL_VOLTAGE_CTRL_0
77 ldr r0, REG_TEST_DBG_CTRL_0
78 ldr r1, VAL_TEST_DBG_CTRL_0
80 ldr r0, REG_MOD_CONF_CTRL_0
81 ldr r1, VAL_MOD_CONF_CTRL_0
84 /* Move to 1510 mode */
85 ldr r0, REG_COMP_MODE_CTRL_0
86 ldr r1, VAL_COMP_MODE_CTRL_0
89 /* Set up Traffic Ctlr*/
90 ldr r0, REG_TC_IMIF_PRIO
93 ldr r0, REG_TC_EMIFS_PRIO
95 ldr r0, REG_TC_EMIFF_PRIO
98 ldr r0, REG_TC_EMIFS_CONFIG
100 bic r1, r1, #0x08 /* clear the global power-down enable PDE bit */
101 bic r1, r1, #0x01 /* write protect flash by clearing the WP bit */
102 str r1, [r0] /* EMIFS GlB Configuration. (value 0x12 most likely) */
104 /* Setup some clock domains */
105 ldr r1, =OMAP1510_CLKS
106 ldr r0, REG_ARM_IDLECT2
107 strh r1, [r0] /* CLKM, Clock domain control. */
109 mov r1, #0x01 /* PER_EN bit */
110 ldr r0, REG_ARM_RSTCT2
111 strh r1, [r0] /* CLKM; Peripheral reset. */
113 /* Set CLKM to Sync-Scalable */
114 /* I supposidly need to enable the dsp clock before switching */
116 ldr r0, REG_ARM_SYSST
120 subs r0, r0, #0x1 /* wait for any bubbles to finish */
123 ldr r1, VAL_ARM_CKCTL /* use 12Mhz ref, PER must be <= 50Mhz so /2 */
124 ldr r0, REG_ARM_CKCTL
128 ldr r1, VAL_DPLL1_CTL
129 ldr r0, REG_DPLL1_CTL
131 ands r1, r1, #0x10 /* Check if PLL is enabled. */
132 beq lock_end /* Do not look for lock if BYPASS selected */
135 ands r1, r1, #0x01 /* Check the LOCK bit. */
136 beq 2b /* ...loop until bit goes hi. */
139 /* Set memory timings corresponding to the new clock speed */
141 /* Check execution location to determine current execution location
142 * and branch to appropriate initialization code.
144 mov r0, #0x10000000 /* Load physical SDRAM base. */
145 mov r1, pc /* Get current execution location. */
146 /* Zero all but top 6 bits of PC, as they alone detect whether an
147 * address is in the range 0x1000:0000-0x13ff:ffff, the 64M sized
148 * valid range for SDRAM on the OMAP 1510/5910.
150 and r1, r1, #0xfc000000
151 cmp r1, r0 /* Compare. */
152 beq skip_sdram /* Skip over EMIF-fast initialization
153 * if running from SDRAM.
157 * Delay for SDRAM initialization.
159 mov r3, #0x1800 /* value should be checked */
161 subs r3, r3, #0x1 /* Decrement count */
165 * Set SDRAM control values. Disable refresh before MRS command.
167 ldr r0, VAL_TC_EMIFF_SDRAM_CONFIG /* get good value */
168 bic r3, r0, #0xC /* (BIT3|BIT2) ulConfig with auto-refresh disabled. */
169 orr r3, r3, #0x8000000 /* (BIT27) Disable CLK when Power down or Self-Refresh */
170 orr r3, r3, #0x4000000 /* BIT26 Power Down Enable */
171 ldr r2, REG_TC_EMIFF_SDRAM_CONFIG /* Point to configuration register. */
172 str r3, [r2] /* Store the passed value with AR disabled. */
174 ldr r1, VAL_TC_EMIFF_MRS /* get MRS value */
175 ldr r2, REG_TC_EMIFF_MRS /* Point to MRS register. */
176 str r1, [r2] /* Store the passed value.*/
178 ldr r2, REG_TC_EMIFF_SDRAM_CONFIG /* Point to configuration register. */
179 str r0, [r2] /* Store the passed value. */
182 * Delay for SDRAM initialization.
186 subs r3, r3, #1 /* Decrement count. */
192 ldr r1, VAL_TC_EMIFS_CS0_CONFIG
193 ldr r0, REG_TC_EMIFS_CS0_CONFIG
194 str r1, [r0] /* Chip Select 0 */
195 ldr r1, VAL_TC_EMIFS_CS1_CONFIG
196 ldr r0, REG_TC_EMIFS_CS1_CONFIG
197 str r1, [r0] /* Chip Select 1 */
198 ldr r1, VAL_TC_EMIFS_CS2_CONFIG
199 ldr r0, REG_TC_EMIFS_CS2_CONFIG
200 str r1, [r0] /* Chip Select 2 */
201 ldr r1, VAL_TC_EMIFS_CS3_CONFIG
202 ldr r0, REG_TC_EMIFS_CS3_CONFIG
203 str r1, [r0] /* Chip Select 3 */
205 /* Next, Enable the RS232 Line Drivers in the FPGA. */
206 /* Also, power on the audio CODEC's amplifier here, */
207 /* which will make a noise on the audio output. */
208 /* This is done here instead of in the kernel so there */
209 /* isn't a loud popping noise at the start of each */
211 /* Also, disable the CODEC's clocks. */
212 /* omap1510-HelenP1 [specific] */
214 ldr r0, REG_FPGA_POWER
216 ldr r2, REG_FPGA_DIP_SWITCH
219 movne r1, #0x62 /* Enable the RS232 Line Drivers in the EPLD */
221 ldr r0, REG_FPGA_AUDIO
222 mov r1, #0x0 /* Disable sound driver (CODEC clocks) */
225 /* back to arch calling code */
228 /* the literal pools origin */
231 /* OMAP configuration registers */
232 REG_FUNC_MUX_CTRL_0: /* 32 bits */
234 REG_FUNC_MUX_CTRL_1: /* 32 bits */
236 REG_FUNC_MUX_CTRL_2: /* 32 bits */
238 REG_COMP_MODE_CTRL_0: /* 32 bits */
240 REG_FUNC_MUX_CTRL_3: /* 32 bits */
242 REG_FUNC_MUX_CTRL_4: /* 32 bits */
244 REG_FUNC_MUX_CTRL_5: /* 32 bits */
246 REG_FUNC_MUX_CTRL_6: /* 32 bits */
248 REG_FUNC_MUX_CTRL_7: /* 32 bits */
250 REG_FUNC_MUX_CTRL_8: /* 32 bits */
252 REG_FUNC_MUX_CTRL_9: /* 32 bits */
254 REG_FUNC_MUX_CTRL_A: /* 32 bits */
256 REG_FUNC_MUX_CTRL_B: /* 32 bits */
258 REG_FUNC_MUX_CTRL_C: /* 32 bits */
260 REG_FUNC_MUX_CTRL_D: /* 32 bits */
262 REG_PULL_DWN_CTRL_0: /* 32 bits */
264 REG_PULL_DWN_CTRL_1: /* 32 bits */
266 REG_PULL_DWN_CTRL_2: /* 32 bits */
268 REG_PULL_DWN_CTRL_3: /* 32 bits */
270 REG_VOLTAGE_CTRL_0: /* 32 bits */
272 REG_TEST_DBG_CTRL_0: /* 32 bits */
274 REG_MOD_CONF_CTRL_0: /* 32 bits */
276 REG_TC_IMIF_PRIO: /* 32 bits */
278 REG_TC_EMIFS_PRIO: /* 32 bits */
280 REG_TC_EMIFF_PRIO: /* 32 bits */
282 REG_TC_EMIFS_CONFIG: /* 32 bits */
284 REG_TC_EMIFS_CS0_CONFIG: /* 32 bits */
286 REG_TC_EMIFS_CS1_CONFIG: /* 32 bits */
288 REG_TC_EMIFS_CS2_CONFIG: /* 32 bits */
290 REG_TC_EMIFS_CS3_CONFIG: /* 32 bits */
292 REG_TC_EMIFF_SDRAM_CONFIG: /* 32 bits */
294 REG_TC_EMIFF_MRS: /* 32 bits */
296 /* MPU clock/reset/power mode control registers */
297 REG_ARM_CKCTL: /* 16 bits */
299 REG_ARM_IDLECT2: /* 16 bits */
301 REG_ARM_RSTCT2: /* 16 bits */
303 REG_ARM_SYSST: /* 16 bits */
305 /* DPLL control registers */
306 REG_DPLL1_CTL: /* 16 bits */
308 /* identification code register */
309 REG_IDCODE: /* 32 bits */
312 /* Innovator specific */
313 REG_FPGA_LED_DIGIT: /* 8 bits (not used on Innovator) */
315 REG_FPGA_POWER: /* 8 bits */
317 REG_FPGA_AUDIO: /* 8 bits (not used on Innovator) */
319 REG_FPGA_DIP_SWITCH: /* 8 bits (not used on Innovator) */
322 VAL_COMP_MODE_CTRL_0:
355 /* See Errata 4.13, This works around a SRAM bug, for chips below ES2.5 .
356 * This slows down internal SRAM accesses.
365 VAL_TC_EMIFS_CS1_CONFIG_PRELIM:
367 VAL_TC_EMIFS_CS2_CONFIG_PRELIM:
369 VAL_TC_EMIFS_CS0_CONFIG:
371 VAL_TC_EMIFS_CS1_CONFIG:
373 VAL_TC_EMIFS_CS2_CONFIG:
375 VAL_TC_EMIFS_CS3_CONFIG:
377 VAL_TC_EMIFF_SDRAM_CONFIG: