Skip to contentSkip to conversation

sh: rework SuperH Mobile sleep code exception handling

PATCH New Magnus Damm 1 participant 1 message Aug 17, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: rework SuperH Mobile sleep code exception handling

From: Magnus Damm <[email protected]>

This patch updates the exception handling in the sleep code for SuperH Mobile. With the patch applied the sleep code always rewrites the VBR and resumes from the exception vector, re-initializes hardware and jumps straight to the original interrupt vector.

Tested on sh7722 and sh7724 with "Sleep Mode", "Sleep Mode + SF" and "Software Standby Mode + SF" with CONFIG_SUSPEND.

---

 arch/sh/kernel/cpu/shmobile/pm.c    |   16 ---
 arch/sh/kernel/cpu/shmobile/sleep.S |  161 +++++++++++++++++++++++------------
 2 files changed, 110 insertions(+), 67 deletions(-)
arch/sh/kernel/cpu/shmobile/pm.c +2 -14
@@ -41,23 +41,11 @@ extern const unsigned int sh_mobile_stan
 
 void sh_mobile_call_standby(unsigned long mode)
 {
-	extern void *vbr_base;
 	void *onchip_mem = (void *)ILRAM_BASE;
-	void (*standby_onchip_mem)(unsigned long) = onchip_mem;
-
-	/* Note: Wake up from sleep may generate exceptions!
-	 * Setup VBR to point to on-chip ram if self-refresh is
-	 * going to be used.
-	 */
-	if (mode & SUSP_SH_SF)
-		asm volatile("ldc %0, vbr" : : "r" (onchip_mem) : "memory");
+	void (*standby_onchip_mem)(unsigned long, unsigned long) = onchip_mem;
 
 	/* Let assembly snippet in on-chip memory handle the rest */
-	standby_onchip_mem(mode);
-
-	/* Put VBR back in System RAM again */
-	if (mode & SUSP_SH_SF)
-		asm volatile("ldc %0, vbr" : : "r" (&vbr_base) : "memory");
+	standby_onchip_mem(mode, ILRAM_BASE);
 }
 
 static int sh_pm_enter(suspend_state_t state)
arch/sh/kernel/cpu/shmobile/sleep.S +108 -53

230 lines not on this page · raw message