@@ -9,4 +9,18 @@ struct sleep_save_sp {
extern void cpu_resume(void);
extern int cpu_suspend(unsigned long, int (*)(unsigned long));
+/*
+ * Generate a SRAM trampoline for resume.
+ * @proc: SoC, should match argument used with SRAM_SECTIONS().
+ * @func: C or asm function to call at resume.
+ * @stack: Stack to use before calling func.
+ */
+#define ARM_SRAM_RESUME(proc, func, stack) \
+void __naked __noreturn __sram_##proc proc##_resume_trampoline(void) \
+{ \
+ __asm__ __volatile__("mov sp, %0" : : "r"((stack)) : "sp"); \
+ func(); \
+}
+
+
#endif
Add a helper that generates a short snippet of code that loads the stack pointer and calls a c (or asm) function. The code gets placed into a SRAM section for loading into SRAM. Signed-off-by: Russ Dill <Russ.Dill@ti.com> --- arch/arm/include/asm/suspend.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)