Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: Add R-standby sleep mode support

Add R-standby specific bits to the SuperH Mobile sleep code.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

authored by

Magnus Damm and committed by
Paul Mundt
bb3e0eed 03625e71

+26 -7
+5
arch/sh/include/asm/suspend.h
··· 38 38 /* register structure for address/data information */ 39 39 struct sh_sleep_regs { 40 40 unsigned long stbcr; 41 + unsigned long bar; 41 42 42 43 /* MMU */ 43 44 unsigned long pteh; ··· 64 63 unsigned long sf_pre; 65 64 unsigned long sf_post; 66 65 66 + /* address of resume code */ 67 + unsigned long resume; 68 + 67 69 /* register state saved and restored by the assembly code */ 68 70 unsigned long vbr; 69 71 unsigned long spc; 70 72 unsigned long sr; 73 + unsigned long sp; 71 74 72 75 /* structure for keeping register addresses */ 73 76 struct sh_sleep_regs addr;
+3
arch/sh/kernel/asm-offsets.c
··· 38 38 DEFINE(SH_SLEEP_MODE, offsetof(struct sh_sleep_data, mode)); 39 39 DEFINE(SH_SLEEP_SF_PRE, offsetof(struct sh_sleep_data, sf_pre)); 40 40 DEFINE(SH_SLEEP_SF_POST, offsetof(struct sh_sleep_data, sf_post)); 41 + DEFINE(SH_SLEEP_RESUME, offsetof(struct sh_sleep_data, resume)); 41 42 DEFINE(SH_SLEEP_VBR, offsetof(struct sh_sleep_data, vbr)); 42 43 DEFINE(SH_SLEEP_SPC, offsetof(struct sh_sleep_data, spc)); 43 44 DEFINE(SH_SLEEP_SR, offsetof(struct sh_sleep_data, sr)); 45 + DEFINE(SH_SLEEP_SP, offsetof(struct sh_sleep_data, sp)); 44 46 DEFINE(SH_SLEEP_BASE_ADDR, offsetof(struct sh_sleep_data, addr)); 45 47 DEFINE(SH_SLEEP_BASE_DATA, offsetof(struct sh_sleep_data, data)); 46 48 DEFINE(SH_SLEEP_REG_STBCR, offsetof(struct sh_sleep_regs, stbcr)); 49 + DEFINE(SH_SLEEP_REG_BAR, offsetof(struct sh_sleep_regs, bar)); 47 50 DEFINE(SH_SLEEP_REG_PTEH, offsetof(struct sh_sleep_regs, pteh)); 48 51 DEFINE(SH_SLEEP_REG_PTEL, offsetof(struct sh_sleep_regs, ptel)); 49 52 DEFINE(SH_SLEEP_REG_TTB, offsetof(struct sh_sleep_regs, ttb));
+6 -7
arch/sh/kernel/cpu/shmobile/pm.c
··· 33 33 #define SUSP_MODE_SLEEP (SUSP_SH_SLEEP) 34 34 #define SUSP_MODE_SLEEP_SF (SUSP_SH_SLEEP | SUSP_SH_SF) 35 35 #define SUSP_MODE_STANDBY_SF (SUSP_SH_STANDBY | SUSP_SH_SF) 36 - 37 - /* 38 - * The following modes are not there yet: 39 - * 40 - * R-standby mode is unsupported, but will be added in the future 41 - * U-standby mode is low priority since it needs bootloader hacks 42 - */ 36 + #define SUSP_MODE_RSTANDBY (SUSP_SH_RSTANDBY | SUSP_SH_MMU | SUSP_SH_SF) 37 + /* 38 + * U-standby mode is unsupported since it needs bootloader hacks 39 + */ 43 40 44 41 #ifdef CONFIG_CPU_SUBTYPE_SH7724 45 42 #define RAM_BASE 0xfd800000 /* RSMEM */ ··· 87 90 /* part 0: data area */ 88 91 sdp = onchip_mem; 89 92 sdp->addr.stbcr = 0xa4150020; /* STBCR */ 93 + sdp->addr.bar = 0xa4150040; /* BAR */ 90 94 sdp->addr.pteh = 0xff000000; /* PTEH */ 91 95 sdp->addr.ptel = 0xff000004; /* PTEL */ 92 96 sdp->addr.ttb = 0xff000008; /* TTB */ ··· 122 124 vp = onchip_mem + 0x600; /* located at interrupt vector */ 123 125 n = &sh_mobile_sleep_resume_end - &sh_mobile_sleep_resume_start; 124 126 memcpy(vp, &sh_mobile_sleep_resume_start, n); 127 + sdp->resume = (unsigned long)vp; 125 128 126 129 sh_mobile_sleep_supported |= flags; 127 130 }
+12
arch/sh/kernel/cpu/shmobile/sleep.S
··· 48 48 stc sr, r0 49 49 mov.l r0, @(SH_SLEEP_SR, r5) 50 50 51 + /* save sp */ 52 + mov.l r15, @(SH_SLEEP_SP, r5) 53 + 51 54 /* save stbcr */ 52 55 bsr save_register 53 56 mov #SH_SLEEP_REG_STBCR, r0 ··· 127 124 test_rstandby: 128 125 tst #SUSP_SH_RSTANDBY, r0 129 126 bt test_ustandby 127 + 128 + /* setup BAR register */ 129 + bsr get_register 130 + mov #SH_SLEEP_REG_BAR, r0 131 + mov.l @(SH_SLEEP_RESUME, r5), r1 132 + mov.l r1, @r0 130 133 131 134 /* set mode to "r-standby mode" */ 132 135 bra do_sleep ··· 211 202 /* setup ssr with saved sr */ 212 203 mov.l @(SH_SLEEP_SR, r5), r0 213 204 ldc r0, ssr 205 + 206 + /* restore sp */ 207 + mov.l @(SH_SLEEP_SP, r5), r15 214 208 215 209 /* restore sleep mode register */ 216 210 bsr restore_register