diff options
| -rw-r--r-- | arch/arm/mach-omap2/sram34xx.S | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S index d13f1cc4bd58..37a1e1fc0ab6 100644 --- a/arch/arm/mach-omap2/sram34xx.S +++ b/arch/arm/mach-omap2/sram34xx.S | |||
| @@ -3,13 +3,12 @@ | |||
| 3 | * | 3 | * |
| 4 | * Omap3 specific functions that need to be run in internal SRAM | 4 | * Omap3 specific functions that need to be run in internal SRAM |
| 5 | * | 5 | * |
| 6 | * (C) Copyright 2007 | 6 | * Copyright (C) 2004, 2007, 2008 Texas Instruments, Inc. |
| 7 | * Texas Instruments Inc. | 7 | * Copyright (C) 2008 Nokia Corporation |
| 8 | * Rajendra Nayak <rnayak@ti.com> | ||
| 9 | * | 8 | * |
| 10 | * (C) Copyright 2004 | 9 | * Rajendra Nayak <rnayak@ti.com> |
| 11 | * Texas Instruments, <www.ti.com> | ||
| 12 | * Richard Woodruff <r-woodruff2@ti.com> | 10 | * Richard Woodruff <r-woodruff2@ti.com> |
| 11 | * Paul Walmsley | ||
| 13 | * | 12 | * |
| 14 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU General Public License as | 14 | * modify it under the terms of the GNU General Public License as |
| @@ -38,13 +37,16 @@ | |||
| 38 | .text | 37 | .text |
| 39 | 38 | ||
| 40 | /* | 39 | /* |
| 41 | * Change frequency of core dpll | 40 | * omap3_sram_configure_core_dpll - change DPLL3 M2 divider |
| 42 | * r0 = sdrc_rfr_ctrl r1 = sdrc_actim_ctrla r2 = sdrc_actim_ctrlb r3 = M2 | 41 | * r0 = new SDRC_RFR_CTRL register contents |
| 43 | * r4 = Unlock SDRC DLL? (1 = yes, 0 = no) -- only unlock DLL for | 42 | * r1 = new SDRC_ACTIM_CTRLA register contents |
| 43 | * r2 = new SDRC_ACTIM_CTRLB register contents | ||
| 44 | * r3 = new M2 divider setting (only 1 and 2 supported right now) | ||
| 45 | * r4 = unlock SDRC DLL? (1 = yes, 0 = no). Only unlock DLL for | ||
| 44 | * SDRC rates < 83MHz | 46 | * SDRC rates < 83MHz |
| 45 | * r5 = number of MPU cycles to wait for SDRC to stabilize after | 47 | * r5 = number of MPU cycles to wait for SDRC to stabilize after |
| 46 | * reprogramming the SDRC when switching to a slower MPU speed | 48 | * reprogramming the SDRC when switching to a slower MPU speed |
| 47 | * r6 = SDRC_MR_0 register value | 49 | * r6 = new SDRC_MR_0 register value |
| 48 | * | 50 | * |
| 49 | */ | 51 | */ |
| 50 | ENTRY(omap3_sram_configure_core_dpll) | 52 | ENTRY(omap3_sram_configure_core_dpll) |
| @@ -53,22 +55,22 @@ ENTRY(omap3_sram_configure_core_dpll) | |||
| 53 | ldr r5, [sp, #56] @ load extra args from the stack | 55 | ldr r5, [sp, #56] @ load extra args from the stack |
| 54 | ldr r6, [sp, #60] @ load extra args from the stack | 56 | ldr r6, [sp, #60] @ load extra args from the stack |
| 55 | dsb @ flush buffered writes to interconnect | 57 | dsb @ flush buffered writes to interconnect |
| 56 | cmp r3, #0x2 | 58 | cmp r3, #0x2 @ if increasing SDRC clk rate, |
| 57 | blne configure_sdrc | 59 | blne configure_sdrc @ program the SDRC regs early (for RFR) |
| 58 | cmp r4, #0x1 | 60 | cmp r4, #0x1 @ set the intended DLL state |
| 59 | bleq unlock_dll | 61 | bleq unlock_dll |
| 60 | blne lock_dll | 62 | blne lock_dll |
| 61 | bl sdram_in_selfrefresh @ put the SDRAM in self refresh | 63 | bl sdram_in_selfrefresh @ put SDRAM in self refresh, idle SDRC |
| 62 | bl configure_core_dpll | 64 | bl configure_core_dpll @ change the DPLL3 M2 divider |
| 63 | bl enable_sdrc | 65 | bl enable_sdrc @ take SDRC out of idle |
| 64 | cmp r4, #0x1 | 66 | cmp r4, #0x1 @ wait for DLL status to change |
| 65 | bleq wait_dll_unlock | 67 | bleq wait_dll_unlock |
| 66 | blne wait_dll_lock | 68 | blne wait_dll_lock |
| 67 | cmp r3, #0x1 | 69 | cmp r3, #0x1 @ if increasing SDRC clk rate, |
| 68 | beq return_to_sdram | 70 | beq return_to_sdram @ return to SDRAM code, otherwise, |
| 69 | bl configure_sdrc | 71 | bl configure_sdrc @ reprogram SDRC regs now |
| 70 | mov r12, r5 @ if slowing, wait for SDRC to stabilize | 72 | mov r12, r5 |
| 71 | bl wait_clk_stable | 73 | bl wait_clk_stable @ wait for SDRC to stabilize |
| 72 | return_to_sdram: | 74 | return_to_sdram: |
| 73 | isb @ prevent speculative exec past here | 75 | isb @ prevent speculative exec past here |
| 74 | mov r0, #0 @ return value | 76 | mov r0, #0 @ return value |
| @@ -93,6 +95,7 @@ sdram_in_selfrefresh: | |||
| 93 | bic r12, r12, #0x4 @ clear PWDENA | 95 | bic r12, r12, #0x4 @ clear PWDENA |
| 94 | str r12, [r11] @ write back to SDRC_POWER register | 96 | str r12, [r11] @ write back to SDRC_POWER register |
| 95 | ldr r12, [r11] @ posted-write barrier for SDRC | 97 | ldr r12, [r11] @ posted-write barrier for SDRC |
| 98 | idle_sdrc: | ||
| 96 | ldr r11, omap3_cm_iclken1_core @ read the CM_ICLKEN1_CORE reg | 99 | ldr r11, omap3_cm_iclken1_core @ read the CM_ICLKEN1_CORE reg |
| 97 | ldr r12, [r11] | 100 | ldr r12, [r11] |
| 98 | bic r12, r12, #0x2 @ disable iclk bit for SDRC | 101 | bic r12, r12, #0x2 @ disable iclk bit for SDRC |
