2 * linux/arch/arm/mach-omap3/sram.S
4 * Omap3 specific functions that need to be run in internal SRAM
7 * Texas Instruments Inc.
8 * Rajendra Nayak <rnayak@ti.com>
11 * Texas Instruments, <www.ti.com>
12 * Richard Woodruff <r-woodruff2@ti.com>
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,
29 #include <linux/linkage.h>
30 #include <asm/assembler.h>
31 #include <mach/hardware.h>
41 * Change frequency of core dpll
42 * r0 = sdrc_rfr_ctrl r1 = sdrc_actim_ctrla r2 = sdrc_actim_ctrlb r3 = M2
43 * r4 = Unlock SDRC DLL? (1 = yes, 0 = no) -- only unlock DLL for
46 ENTRY(omap3_sram_configure_core_dpll)
47 stmfd sp!, {r1-r12, lr} @ store regs to stack
48 ldr r4, [sp, #52] @ pull extra args off the stack
49 dsb @ flush buffered writes to interconnect
55 bl sdram_in_selfrefresh @ put the SDRAM in self refresh
56 bl configure_core_dpll
63 isb @ prevent speculative exec past here
64 mov r0, #0 @ return value
65 ldmfd sp!, {r1-r12, pc} @ restore regs and return
67 ldr r11, omap3_sdrc_dlla_ctrl
70 str r12, [r11] @ (no OCP barrier needed)
73 ldr r11, omap3_sdrc_dlla_ctrl
76 str r12, [r11] @ (no OCP barrier needed)
79 ldr r11, omap3_sdrc_power @ read the SDRC_POWER register
80 ldr r12, [r11] @ read the contents of SDRC_POWER
81 mov r9, r12 @ keep a copy of SDRC_POWER bits
82 orr r12, r12, #0x40 @ enable self refresh on idle req
83 bic r12, r12, #0x4 @ clear PWDENA
84 str r12, [r11] @ write back to SDRC_POWER register
85 ldr r12, [r11] @ posted-write barrier for SDRC
86 ldr r11, omap3_cm_iclken1_core @ read the CM_ICLKEN1_CORE reg
88 bic r12, r12, #0x2 @ disable iclk bit for SDRC
91 ldr r11, omap3_cm_idlest1_core
93 and r12, r12, #0x2 @ check for SDRC idle
98 ldr r11, omap3_cm_clksel1_pll
100 ldr r10, core_m2_mask_val @ modify m2 for core dpll
102 orr r12, r12, r3, lsl #0x1B @ r3 contains the M2 val
104 ldr r12, [r11] @ posted-write barrier for CM
105 mov r12, #0x800 @ wait for the clock to stabilise
124 ldr r11, omap3_cm_iclken1_core
126 orr r12, r12, #0x2 @ enable iclk bit for SDRC
129 ldr r11, omap3_cm_idlest1_core
134 restore_sdrc_power_val:
135 ldr r11, omap3_sdrc_power
136 str r9, [r11] @ restore SDRC_POWER, no barrier needed
139 ldr r11, omap3_sdrc_dlla_status
146 ldr r11, omap3_sdrc_dlla_status
153 ldr r11, omap3_sdrc_rfr_ctrl
155 ldr r11, omap3_sdrc_actim_ctrla
157 ldr r11, omap3_sdrc_actim_ctrlb
159 ldr r2, [r11] @ posted-write barrier for SDRC
163 .word OMAP34XX_SDRC_REGADDR(SDRC_POWER)
164 omap3_cm_clksel1_pll:
165 .word OMAP34XX_CM_REGADDR(PLL_MOD, CM_CLKSEL1)
166 omap3_cm_idlest1_core:
167 .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST)
168 omap3_cm_iclken1_core:
169 .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1)
171 .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0)
172 omap3_sdrc_actim_ctrla:
173 .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0)
174 omap3_sdrc_actim_ctrlb:
175 .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0)
176 omap3_sdrc_dlla_status:
177 .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS)
178 omap3_sdrc_dlla_ctrl:
179 .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL)
183 ENTRY(omap3_sram_configure_core_dpll_sz)
184 .word . - omap3_sram_configure_core_dpll