* [PATCH] OMAP3: PM: remove get_*_restore_pointer functions, directly use entry points
@ 2011-06-24 0:16 Kevin Hilman
2011-06-24 0:25 ` Santosh Shilimkar
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kevin Hilman @ 2011-06-24 0:16 UTC (permalink / raw)
To: linux-arm-kernel
Upon return from off-mode, the ROM code jumps to a restore function
saved in the scratchpad. Based on SoC revision or errata, this
restore entry point is different. Current code uses some helper
functions in sleep34xx.S (get_*_restore_pointer) to get the restore
function entry point.
When returning from off-mode, this code is executed from SDRAM, so
there's no reason to use these helper functions when using the SDRAM
entry points directly would work just fine.
This patch uses ENTRY/ENDPROC to create "real" entry points for these
functions, and uses those values directly when writing the scratchpad.
Tested all three entry points
- restore_es3: 3430/n900
- restore_3630: 3630/Zoom3
- restore: 3530/Overo
Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Jean Pihet <jean.pihet@newoldbits.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
Applies on top of Russell's suspend cleanup/rejig, and available
(along with Russell's series) in my pm-wip/idle-suspend branch.
Russell, since it depends on your series, feel free to add it to your
series if you like. Or if you prefer, we can take it through the OMAP
tree.
arch/arm/mach-omap2/control.c | 7 ++--
arch/arm/mach-omap2/control.h | 6 ++--
arch/arm/mach-omap2/sleep34xx.S | 61 +++++++-------------------------------
3 files changed, 19 insertions(+), 55 deletions(-)
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index da53ba3..aab884f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -286,14 +286,15 @@ void omap3_save_scratchpad_contents(void)
scratchpad_contents.boot_config_ptr = 0x0;
if (cpu_is_omap3630())
scratchpad_contents.public_restore_ptr =
- virt_to_phys(get_omap3630_restore_pointer());
+ virt_to_phys(omap3_restore_3630);
else if (omap_rev() != OMAP3430_REV_ES3_0 &&
omap_rev() != OMAP3430_REV_ES3_1)
scratchpad_contents.public_restore_ptr =
- virt_to_phys(get_restore_pointer());
+ virt_to_phys(omap3_restore);
else
scratchpad_contents.public_restore_ptr =
- virt_to_phys(get_es3_restore_pointer());
+ virt_to_phys(omap3_restore_es3);
+
if (omap_type() == OMAP2_DEVICE_TYPE_GP)
scratchpad_contents.secure_ram_restore_ptr = 0x0;
else
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index a016c8b..d4ef75d 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -386,9 +386,9 @@ extern void omap4_ctrl_pad_writel(u32 val, u16 offset);
extern void omap3_save_scratchpad_contents(void);
extern void omap3_clear_scratchpad_contents(void);
-extern u32 *get_restore_pointer(void);
-extern u32 *get_es3_restore_pointer(void);
-extern u32 *get_omap3630_restore_pointer(void);
+extern void omap3_restore(void);
+extern void omap3_restore_es3(void);
+extern void omap3_restore_3630(void);
extern u32 omap3_arm_context[128];
extern void omap3_control_save_context(void);
extern void omap3_control_restore_context(void);
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 9a1349e..177f70f 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -74,46 +74,6 @@
* API functions
*/
-/*
- * The "get_*restore_pointer" functions are used to provide a
- * physical restore address where the ROM code jumps while waking
- * up from MPU OFF/OSWR state.
- * The restore pointer is stored into the scratchpad.
- */
-
- .text
-/* Function call to get the restore pointer for resume from OFF */
-ENTRY(get_restore_pointer)
- stmfd sp!, {lr} @ save registers on stack
- adr r0, restore
- ldmfd sp!, {pc} @ restore regs and return
-ENDPROC(get_restore_pointer)
- .align
-ENTRY(get_restore_pointer_sz)
- .word . - get_restore_pointer
-
- .text
-/* Function call to get the restore pointer for 3630 resume from OFF */
-ENTRY(get_omap3630_restore_pointer)
- stmfd sp!, {lr} @ save registers on stack
- adr r0, restore_3630
- ldmfd sp!, {pc} @ restore regs and return
-ENDPROC(get_omap3630_restore_pointer)
- .align
-ENTRY(get_omap3630_restore_pointer_sz)
- .word . - get_omap3630_restore_pointer
-
- .text
-/* Function call to get the restore pointer for ES3 to resume from OFF */
-ENTRY(get_es3_restore_pointer)
- stmfd sp!, {lr} @ save registers on stack
- adr r0, restore_es3
- ldmfd sp!, {pc} @ restore regs and return
-ENDPROC(get_es3_restore_pointer)
- .align
-ENTRY(get_es3_restore_pointer_sz)
- .word . - get_es3_restore_pointer
-
.text
/*
* L2 cache needs to be toggled for stable OFF mode functionality on 3630.
@@ -316,12 +276,12 @@ omap3_do_wfi:
* restore_3630: applies to 36xx
* restore: common code for 3xxx
*/
-restore_es3:
+ENTRY(omap3_restore_es3)
ldr r5, pm_prepwstst_core_p
ldr r4, [r5]
and r4, r4, #0x3
cmp r4, #0x0 @ Check if previous power state of CORE is OFF
- bne restore
+ bne omap3_restore
adr r0, es3_sdrc_fix
ldr r1, sram_base
ldr r2, es3_sdrc_fix_sz
@@ -333,22 +293,24 @@ copy_to_sram:
bne copy_to_sram
ldr r1, sram_base
blx r1
- b restore
-
-restore_3630:
+ b omap3_restore
+ENDPROC(omap3_restore_es3)
+
+ENTRY(omap3_restore_3630)
ldr r1, pm_prepwstst_core_p
ldr r2, [r1]
and r2, r2, #0x3
cmp r2, #0x0 @ Check if previous power state of CORE is OFF
- bne restore
+ bne omap3_restore
/* Disable RTA before giving control */
ldr r1, control_mem_rta
mov r2, #OMAP36XX_RTA_DISABLE
str r2, [r1]
-
+ENDPROC(omap3_restore_3630)
+
/* Fall through to common code for the remaining logic */
-restore:
+ENTRY(omap3_restore)
/*
* Read the pwstctrl register to check the reason for mpu reset.
* This tells us what was lost.
@@ -438,7 +400,8 @@ skipl2reen:
/* Now branch to the common CPU resume function */
b cpu_resume
-
+ENDPROC(omap3_restore)
+
.ltorg
/*
--
1.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] OMAP3: PM: remove get_*_restore_pointer functions, directly use entry points
2011-06-24 0:16 [PATCH] OMAP3: PM: remove get_*_restore_pointer functions, directly use entry points Kevin Hilman
@ 2011-06-24 0:25 ` Santosh Shilimkar
2011-06-24 7:55 ` Russell King - ARM Linux
2011-06-24 8:24 ` Jean Pihet
2 siblings, 0 replies; 4+ messages in thread
From: Santosh Shilimkar @ 2011-06-24 0:25 UTC (permalink / raw)
To: linux-arm-kernel
On 6/24/2011 5:46 AM, Kevin Hilman wrote:
> Upon return from off-mode, the ROM code jumps to a restore function
> saved in the scratchpad. Based on SoC revision or errata, this
> restore entry point is different. Current code uses some helper
> functions in sleep34xx.S (get_*_restore_pointer) to get the restore
> function entry point.
>
> When returning from off-mode, this code is executed from SDRAM, so
> there's no reason to use these helper functions when using the SDRAM
> entry points directly would work just fine.
>
> This patch uses ENTRY/ENDPROC to create "real" entry points for these
> functions, and uses those values directly when writing the scratchpad.
>
> Tested all three entry points
> - restore_es3: 3430/n900
> - restore_3630: 3630/Zoom3
> - restore: 3530/Overo
>
> Suggested-by: Russell King<rmk+kernel@arm.linux.org.uk>
> Cc: Jean Pihet<jean.pihet@newoldbits.com>
> Signed-off-by: Kevin Hilman<khilman@ti.com>
> ---
This is a nice change. In general now omap3 suspend code
is looking much cleaner and after Jean's DDR patch, it would
be even better.
For this patch, my ack if you need one
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] OMAP3: PM: remove get_*_restore_pointer functions, directly use entry points
2011-06-24 0:16 [PATCH] OMAP3: PM: remove get_*_restore_pointer functions, directly use entry points Kevin Hilman
2011-06-24 0:25 ` Santosh Shilimkar
@ 2011-06-24 7:55 ` Russell King - ARM Linux
2011-06-24 8:24 ` Jean Pihet
2 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2011-06-24 7:55 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jun 23, 2011 at 05:16:14PM -0700, Kevin Hilman wrote:
> Applies on top of Russell's suspend cleanup/rejig, and available
> (along with Russell's series) in my pm-wip/idle-suspend branch.
>
> Russell, since it depends on your series, feel free to add it to your
> series if you like. Or if you prefer, we can take it through the OMAP
> tree.
Thanks, I've picked it up, and changed the prefix on the subject line
to match the rest of my series. Also cleaned up the trailing tabs
and added Santosh's ack.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] OMAP3: PM: remove get_*_restore_pointer functions, directly use entry points
2011-06-24 0:16 [PATCH] OMAP3: PM: remove get_*_restore_pointer functions, directly use entry points Kevin Hilman
2011-06-24 0:25 ` Santosh Shilimkar
2011-06-24 7:55 ` Russell King - ARM Linux
@ 2011-06-24 8:24 ` Jean Pihet
2 siblings, 0 replies; 4+ messages in thread
From: Jean Pihet @ 2011-06-24 8:24 UTC (permalink / raw)
To: linux-arm-kernel
Kevin,
On Fri, Jun 24, 2011 at 2:16 AM, Kevin Hilman <khilman@ti.com> wrote:
> Upon return from off-mode, the ROM code jumps to a restore function
> saved in the scratchpad. ?Based on SoC revision or errata, this
> restore entry point is different. ?Current code uses some helper
> functions in sleep34xx.S (get_*_restore_pointer) to get the restore
> function entry point.
>
> When returning from off-mode, this code is executed from SDRAM, so
> there's no reason to use these helper functions when using the SDRAM
> entry points directly would work just fine.
>
> This patch uses ENTRY/ENDPROC to create "real" entry points for these
> functions, and uses those values directly when writing the scratchpad.
>
> Tested all three entry points
> - restore_es3: 3430/n900
> - restore_3630: 3630/Zoom3
> - restore: 3530/Overo
>
> Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Cc: Jean Pihet <jean.pihet@newoldbits.com>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
This makes sense. FWIW:
Acked-by: Jean Pihet <j-pihet@ti.com
Thanks,
Jean
> ---
> Applies on top of Russell's suspend cleanup/rejig, and available
> (along with Russell's series) in my pm-wip/idle-suspend branch.
>
> Russell, since it depends on your series, feel free to add it to your
> series if you like. ?Or if you prefer, we can take it through the OMAP
> tree.
>
> ?arch/arm/mach-omap2/control.c ? | ? ?7 ++--
> ?arch/arm/mach-omap2/control.h ? | ? ?6 ++--
> ?arch/arm/mach-omap2/sleep34xx.S | ? 61 +++++++-------------------------------
> ?3 files changed, 19 insertions(+), 55 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
> index da53ba3..aab884f 100644
> --- a/arch/arm/mach-omap2/control.c
> +++ b/arch/arm/mach-omap2/control.c
> @@ -286,14 +286,15 @@ void omap3_save_scratchpad_contents(void)
> ? ? ? ?scratchpad_contents.boot_config_ptr = 0x0;
> ? ? ? ?if (cpu_is_omap3630())
> ? ? ? ? ? ? ? ?scratchpad_contents.public_restore_ptr =
> - ? ? ? ? ? ? ? ? ? ? ? virt_to_phys(get_omap3630_restore_pointer());
> + ? ? ? ? ? ? ? ? ? ? ? virt_to_phys(omap3_restore_3630);
> ? ? ? ?else if (omap_rev() != OMAP3430_REV_ES3_0 &&
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?omap_rev() != OMAP3430_REV_ES3_1)
> ? ? ? ? ? ? ? ?scratchpad_contents.public_restore_ptr =
> - ? ? ? ? ? ? ? ? ? ? ? virt_to_phys(get_restore_pointer());
> + ? ? ? ? ? ? ? ? ? ? ? virt_to_phys(omap3_restore);
> ? ? ? ?else
> ? ? ? ? ? ? ? ?scratchpad_contents.public_restore_ptr =
> - ? ? ? ? ? ? ? ? ? ? ? virt_to_phys(get_es3_restore_pointer());
> + ? ? ? ? ? ? ? ? ? ? ? virt_to_phys(omap3_restore_es3);
> +
> ? ? ? ?if (omap_type() == OMAP2_DEVICE_TYPE_GP)
> ? ? ? ? ? ? ? ?scratchpad_contents.secure_ram_restore_ptr = 0x0;
> ? ? ? ?else
> diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
> index a016c8b..d4ef75d 100644
> --- a/arch/arm/mach-omap2/control.h
> +++ b/arch/arm/mach-omap2/control.h
> @@ -386,9 +386,9 @@ extern void omap4_ctrl_pad_writel(u32 val, u16 offset);
>
> ?extern void omap3_save_scratchpad_contents(void);
> ?extern void omap3_clear_scratchpad_contents(void);
> -extern u32 *get_restore_pointer(void);
> -extern u32 *get_es3_restore_pointer(void);
> -extern u32 *get_omap3630_restore_pointer(void);
> +extern void omap3_restore(void);
> +extern void omap3_restore_es3(void);
> +extern void omap3_restore_3630(void);
> ?extern u32 omap3_arm_context[128];
> ?extern void omap3_control_save_context(void);
> ?extern void omap3_control_restore_context(void);
> diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
> index 9a1349e..177f70f 100644
> --- a/arch/arm/mach-omap2/sleep34xx.S
> +++ b/arch/arm/mach-omap2/sleep34xx.S
> @@ -74,46 +74,6 @@
> ?* API functions
> ?*/
>
> -/*
> - * The "get_*restore_pointer" functions are used to provide a
> - * physical restore address where the ROM code jumps while waking
> - * up from MPU OFF/OSWR state.
> - * The restore pointer is stored into the scratchpad.
> - */
> -
> - ? ? ? .text
> -/* Function call to get the restore pointer for resume from OFF */
> -ENTRY(get_restore_pointer)
> - ? ? ? stmfd ? sp!, {lr} ? ? ? @ save registers on stack
> - ? ? ? adr ? ? r0, restore
> - ? ? ? ldmfd ? sp!, {pc} ? ? ? @ restore regs and return
> -ENDPROC(get_restore_pointer)
> - ? ? ? .align
> -ENTRY(get_restore_pointer_sz)
> - ? ? ? .word ? . - get_restore_pointer
> -
> - ? ? ? .text
> -/* Function call to get the restore pointer for 3630 resume from OFF */
> -ENTRY(get_omap3630_restore_pointer)
> - ? ? ? stmfd ? sp!, {lr} ? ? ? @ save registers on stack
> - ? ? ? adr ? ? r0, restore_3630
> - ? ? ? ldmfd ? sp!, {pc} ? ? ? @ restore regs and return
> -ENDPROC(get_omap3630_restore_pointer)
> - ? ? ? .align
> -ENTRY(get_omap3630_restore_pointer_sz)
> - ? ? ? .word ? . - get_omap3630_restore_pointer
> -
> - ? ? ? .text
> -/* Function call to get the restore pointer for ES3 to resume from OFF */
> -ENTRY(get_es3_restore_pointer)
> - ? ? ? stmfd ? sp!, {lr} ? ? ? @ save registers on stack
> - ? ? ? adr ? ? r0, restore_es3
> - ? ? ? ldmfd ? sp!, {pc} ? ? ? @ restore regs and return
> -ENDPROC(get_es3_restore_pointer)
> - ? ? ? .align
> -ENTRY(get_es3_restore_pointer_sz)
> - ? ? ? .word ? . - get_es3_restore_pointer
> -
> ? ? ? ?.text
> ?/*
> ?* L2 cache needs to be toggled for stable OFF mode functionality on 3630.
> @@ -316,12 +276,12 @@ omap3_do_wfi:
> ?* ?restore_3630: applies to 36xx
> ?* ?restore: common code for 3xxx
> ?*/
> -restore_es3:
> +ENTRY(omap3_restore_es3)
> ? ? ? ?ldr ? ? r5, pm_prepwstst_core_p
> ? ? ? ?ldr ? ? r4, [r5]
> ? ? ? ?and ? ? r4, r4, #0x3
> ? ? ? ?cmp ? ? r4, #0x0 ? ? ? ?@ Check if previous power state of CORE is OFF
> - ? ? ? bne ? ? restore
> + ? ? ? bne ? ? omap3_restore
> ? ? ? ?adr ? ? r0, es3_sdrc_fix
> ? ? ? ?ldr ? ? r1, sram_base
> ? ? ? ?ldr ? ? r2, es3_sdrc_fix_sz
> @@ -333,22 +293,24 @@ copy_to_sram:
> ? ? ? ?bne ? ? copy_to_sram
> ? ? ? ?ldr ? ? r1, sram_base
> ? ? ? ?blx ? ? r1
> - ? ? ? b ? ? ? restore
> -
> -restore_3630:
> + ? ? ? b ? ? ? omap3_restore
> +ENDPROC(omap3_restore_es3)
> +
> +ENTRY(omap3_restore_3630)
> ? ? ? ?ldr ? ? r1, pm_prepwstst_core_p
> ? ? ? ?ldr ? ? r2, [r1]
> ? ? ? ?and ? ? r2, r2, #0x3
> ? ? ? ?cmp ? ? r2, #0x0 ? ? ? ?@ Check if previous power state of CORE is OFF
> - ? ? ? bne ? ? restore
> + ? ? ? bne ? ? omap3_restore
> ? ? ? ?/* Disable RTA before giving control */
> ? ? ? ?ldr ? ? r1, control_mem_rta
> ? ? ? ?mov ? ? r2, #OMAP36XX_RTA_DISABLE
> ? ? ? ?str ? ? r2, [r1]
> -
> +ENDPROC(omap3_restore_3630)
> +
> ? ? ? ?/* Fall through to common code for the remaining logic */
>
> -restore:
> +ENTRY(omap3_restore)
> ? ? ? ?/*
> ? ? ? ? * Read the pwstctrl register to check the reason for mpu reset.
> ? ? ? ? * This tells us what was lost.
> @@ -438,7 +400,8 @@ skipl2reen:
>
> ? ? ? ?/* Now branch to the common CPU resume function */
> ? ? ? ?b ? ? ? cpu_resume
> -
> +ENDPROC(omap3_restore)
> +
> ? ? ? ?.ltorg
>
> ?/*
> --
> 1.7.4
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-24 8:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-24 0:16 [PATCH] OMAP3: PM: remove get_*_restore_pointer functions, directly use entry points Kevin Hilman
2011-06-24 0:25 ` Santosh Shilimkar
2011-06-24 7:55 ` Russell King - ARM Linux
2011-06-24 8:24 ` Jean Pihet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).