Skip to contentSkip to conversation

sh: Rework SuperH Mobile sleep mode code

PATCH Applied Magnus Damm 1 participant 1 message Oct 30, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/9 sh: Rework SuperH Mobile sleep mode code

From: Magnus Damm <[email protected]>

Rework the SuperH Mobile sleep code from including board specific code to allowing each board to provide pre/post code snippets. These snippets should contain sdram management code to enter and leave self-refresh.

---

 arch/sh/include/asm/suspend.h       |   27 +++
 arch/sh/kernel/asm-offsets.c        |   10 +
 arch/sh/kernel/cpu/shmobile/pm.c    |   54 ++++++-
 arch/sh/kernel/cpu/shmobile/sleep.S |  244 +++++++++++++----------------------
 4 files changed, 171 insertions(+), 164 deletions(-)
arch/sh/include/asm/suspend.h +27 -0
@@ -34,6 +34,33 @@ extern struct atomic_notifier_head sh_mo
 void sh_mobile_register_self_refresh(unsigned long flags,
 				     void *pre_start, void *pre_end,
 				     void *post_start, void *post_end);
+
+/* register structure for address/data information */
+struct sh_sleep_regs {
+	unsigned long stbcr;
+};
+
+/* data area for low-level sleep code */
+struct sh_sleep_data {
+	/* current sleep mode (SUSP_SH_...) */
+	unsigned long mode;
+
+	/* addresses of board specific self-refresh snippets */
+	unsigned long sf_pre;
+	unsigned long sf_post;
+
+	/* register state saved and restored by the assembly code */
+	unsigned long vbr;
+	unsigned long spc;
+	unsigned long sr;
+
+	/* structure for keeping register addresses */
+	struct sh_sleep_regs addr;
+
+	/* structure for saving/restoring register state */
+	struct sh_sleep_regs data;
+};
+
 #endif
 
 /* flags passed to assembly suspend code */
arch/sh/kernel/asm-offsets.c +10 -0
@@ -34,5 +34,15 @@ int main(void)
 	DEFINE(PBE_NEXT, offsetof(struct pbe, next));
 	DEFINE(SWSUSP_ARCH_REGS_SIZE, sizeof(struct swsusp_arch_regs));
 #endif
+
+	DEFINE(SH_SLEEP_MODE, offsetof(struct sh_sleep_data, mode));
+	DEFINE(SH_SLEEP_SF_PRE, offsetof(struct sh_sleep_data, sf_pre));
+	DEFINE(SH_SLEEP_SF_POST, offsetof(struct sh_sleep_data, sf_post));
+	DEFINE(SH_SLEEP_VBR, offsetof(struct sh_sleep_data, vbr));
+	DEFINE(SH_SLEEP_SPC, offsetof(struct sh_sleep_data, spc));
+	DEFINE(SH_SLEEP_SR, offsetof(struct sh_sleep_data, sr));
+	DEFINE(SH_SLEEP_BASE_ADDR, offsetof(struct sh_sleep_data, addr));
+	DEFINE(SH_SLEEP_BASE_DATA, offsetof(struct sh_sleep_data, data));
+	DEFINE(SH_SLEEP_REG_STBCR, offsetof(struct sh_sleep_regs, stbcr));
 	return 0;
 }
arch/sh/kernel/cpu/shmobile/pm.c +43 -11

79 lines not on this page · raw message

arch/sh/kernel/cpu/shmobile/sleep.S +91 -153

294 lines not on this page · raw message