Commit 1835f1d7 authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP2: Move sleep.S into sleep24xx.S

Some register offsets are different for 242x and 243x. This
will allow compiling sleep code for both chips into the same
kernel. Pass the addresses for SDRC_DDLA_CTRL and SDRC_POWER to the
omap24xx_cpu_suspend instead of loading the values since the only.

Also fix a bug to call omap2_sram_suspend with the value of SDRC_DLLA_CTRL
instead of the address as that's what omap24xx_cpu_suspend expects to
determine between DDR and SDR. This bug has not been noticed as
the boards seem to have DDR instead of SDR.

Note that some PM patches are still missing. The PM patches will
be added later on once the base files are in sync with linux-omap
tree.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6e81176d
...@@ -14,7 +14,10 @@ obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o ...@@ -14,7 +14,10 @@ obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o
obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o
# Power Management # Power Management
obj-$(CONFIG_PM) += pm.o sleep.o ifeq ($(CONFIG_PM),y)
obj-y += pm.o
obj-$(CONFIG_ARCH_OMAP24XX) += sleep24xx.o
endif
# Clock framework # Clock framework
obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
* Texas Instruments, <www.ti.com> * Texas Instruments, <www.ti.com>
* Richard Woodruff <r-woodruff2@ti.com> * Richard Woodruff <r-woodruff2@ti.com>
* *
* (C) Copyright 2006 Nokia Corporation
* Fixed idle loop sleep
* Igor Stoppa <igor.stoppa@nokia.com>
*
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
...@@ -26,6 +30,8 @@ ...@@ -26,6 +30,8 @@
#include <mach/io.h> #include <mach/io.h>
#include <mach/pm.h> #include <mach/pm.h>
#include <mach/omap24xx.h>
#include "sdrc.h" #include "sdrc.h"
/* First address of reserved address space? apparently valid for OMAP2 & 3 */ /* First address of reserved address space? apparently valid for OMAP2 & 3 */
...@@ -52,15 +58,14 @@ ENTRY(omap24xx_idle_loop_suspend_sz) ...@@ -52,15 +58,14 @@ ENTRY(omap24xx_idle_loop_suspend_sz)
.word . - omap24xx_idle_loop_suspend .word . - omap24xx_idle_loop_suspend
/* /*
* omap242x_cpu_suspend() - Forces OMAP into deep sleep state by completing * omap24xx_cpu_suspend() - Forces OMAP into deep sleep state by completing
* SDRC shutdown then ARM shutdown. Upon wake MPU is back on so just restore * SDRC shutdown then ARM shutdown. Upon wake MPU is back on so just restore
* SDRC. * SDRC.
* *
* Input: * Input:
* R0 : DLL ctrl value pre-Sleep * R0 : DLL ctrl value pre-Sleep
* R1 : Processor+Revision * R1 : SDRC_DLLA_CTRL
* 2420: 0x21 = 242xES1, 0x26 = 242xES2.2 * R2 : SDRC_POWER
* 2430: 0x31 = 2430ES1, 0x32 = 2430ES2
* *
* The if the DPLL is going to AutoIdle. It seems like the DPLL may be back on * The if the DPLL is going to AutoIdle. It seems like the DPLL may be back on
* when we get called, but the DLL probably isn't. We will wait a bit more in * when we get called, but the DLL probably isn't. We will wait a bit more in
...@@ -80,15 +85,14 @@ ENTRY(omap24xx_idle_loop_suspend_sz) ...@@ -80,15 +85,14 @@ ENTRY(omap24xx_idle_loop_suspend_sz)
*/ */
ENTRY(omap24xx_cpu_suspend) ENTRY(omap24xx_cpu_suspend)
stmfd sp!, {r0 - r12, lr} @ save registers on stack stmfd sp!, {r0 - r12, lr} @ save registers on stack
mov r3, #0x0 @ clear for mrc call mov r3, #0x0 @ clear for mcr call
mcr p15, 0, r3, c7, c10, 4 @ memory barrier, hope SDR/DDR finished mcr p15, 0, r3, c7, c10, 4 @ memory barrier, hope SDR/DDR finished
nop nop
nop nop
ldr r3, A_SDRC_POWER @ addr of sdrc power ldr r4, [r2] @ read SDRC_POWER
ldr r4, [r3] @ value of sdrc power
orr r4, r4, #0x40 @ enable self refresh on idle req orr r4, r4, #0x40 @ enable self refresh on idle req
mov r5, #0x2000 @ set delay (DPLL relock + DLL relock) mov r5, #0x2000 @ set delay (DPLL relock + DLL relock)
str r4, [r3] @ make it so str r4, [r2] @ make it so
mov r2, #0 mov r2, #0
nop nop
mcr p15, 0, r2, c7, c0, 4 @ wait for interrupt mcr p15, 0, r2, c7, c0, 4 @ wait for interrupt
...@@ -97,14 +101,13 @@ loop: ...@@ -97,14 +101,13 @@ loop:
subs r5, r5, #0x1 @ awake, wait just a bit subs r5, r5, #0x1 @ awake, wait just a bit
bne loop bne loop
/* The DPLL has on before we take the DDR out of self refresh */ /* The DPLL has to be on before we take the DDR out of self refresh */
bic r4, r4, #0x40 @ now clear self refresh bit. bic r4, r4, #0x40 @ now clear self refresh bit.
str r4, [r3] @ put vlaue back. str r4, [r2] @ write to SDRC_POWER
ldr r4, A_SDRC0 @ make a clock happen ldr r4, A_SDRC0 @ make a clock happen
ldr r4, [r4] ldr r4, [r4] @ read A_SDRC0
nop @ start auto refresh only after clk ok nop @ start auto refresh only after clk ok
movs r0, r0 @ see if DDR or SDR movs r0, r0 @ see if DDR or SDR
ldrne r1, A_SDRC_DLLA_CTRL_S @ get addr of DLL ctrl
strne r0, [r1] @ rewrite DLLA to force DLL reload strne r0, [r1] @ rewrite DLLA to force DLL reload
addne r1, r1, #0x8 @ move to DLLB addne r1, r1, #0x8 @ move to DLLB
strne r0, [r1] @ rewrite DLLB to force DLL reload strne r0, [r1] @ rewrite DLLB to force DLL reload
...@@ -116,13 +119,8 @@ loop2: ...@@ -116,13 +119,8 @@ loop2:
/* resume*/ /* resume*/
ldmfd sp!, {r0 - r12, pc} @ restore regs and return ldmfd sp!, {r0 - r12, pc} @ restore regs and return
A_SDRC_POWER:
.word OMAP242X_SDRC_REGADDR(SDRC_POWER)
A_SDRC0: A_SDRC0:
.word A_SDRC0_V .word A_SDRC0_V
A_SDRC_DLLA_CTRL_S:
.word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL)
ENTRY(omap24xx_cpu_suspend_sz) ENTRY(omap24xx_cpu_suspend_sz)
.word . - omap24xx_cpu_suspend .word . - omap24xx_cpu_suspend
...@@ -135,7 +135,8 @@ extern void omap_pm_suspend(void); ...@@ -135,7 +135,8 @@ extern void omap_pm_suspend(void);
extern void omap730_cpu_suspend(unsigned short, unsigned short); extern void omap730_cpu_suspend(unsigned short, unsigned short);
extern void omap1510_cpu_suspend(unsigned short, unsigned short); extern void omap1510_cpu_suspend(unsigned short, unsigned short);
extern void omap1610_cpu_suspend(unsigned short, unsigned short); extern void omap1610_cpu_suspend(unsigned short, unsigned short);
extern void omap24xx_cpu_suspend(u32 dll_ctrl, u32 cpu_revision); extern void omap24xx_cpu_suspend(u32 dll_ctrl, void __iomem *sdrc_dlla_ctrl,
void __iomem *sdrc_power);
extern void omap730_idle_loop_suspend(void); extern void omap730_idle_loop_suspend(void);
extern void omap1510_idle_loop_suspend(void); extern void omap1510_idle_loop_suspend(void);
extern void omap1610_idle_loop_suspend(void); extern void omap1610_idle_loop_suspend(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment