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

ARM: pm: omap34xx: remove get_*_restore_pointer functions, directly use entry points

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>
Acked-by: Jean Pihet <j-pihet@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Kevin Hilman and committed by
Russell King
14c79bbe 076f2cc4

+16 -52
+4 -3
arch/arm/mach-omap2/control.c
··· 286 286 scratchpad_contents.boot_config_ptr = 0x0; 287 287 if (cpu_is_omap3630()) 288 288 scratchpad_contents.public_restore_ptr = 289 - virt_to_phys(get_omap3630_restore_pointer()); 289 + virt_to_phys(omap3_restore_3630); 290 290 else if (omap_rev() != OMAP3430_REV_ES3_0 && 291 291 omap_rev() != OMAP3430_REV_ES3_1) 292 292 scratchpad_contents.public_restore_ptr = 293 - virt_to_phys(get_restore_pointer()); 293 + virt_to_phys(omap3_restore); 294 294 else 295 295 scratchpad_contents.public_restore_ptr = 296 - virt_to_phys(get_es3_restore_pointer()); 296 + virt_to_phys(omap3_restore_es3); 297 + 297 298 if (omap_type() == OMAP2_DEVICE_TYPE_GP) 298 299 scratchpad_contents.secure_ram_restore_ptr = 0x0; 299 300 else
+3 -3
arch/arm/mach-omap2/control.h
··· 386 386 387 387 extern void omap3_save_scratchpad_contents(void); 388 388 extern void omap3_clear_scratchpad_contents(void); 389 - extern u32 *get_restore_pointer(void); 390 - extern u32 *get_es3_restore_pointer(void); 391 - extern u32 *get_omap3630_restore_pointer(void); 389 + extern void omap3_restore(void); 390 + extern void omap3_restore_es3(void); 391 + extern void omap3_restore_3630(void); 392 392 extern u32 omap3_arm_context[128]; 393 393 extern void omap3_control_save_context(void); 394 394 extern void omap3_control_restore_context(void);
+9 -46
arch/arm/mach-omap2/sleep34xx.S
··· 74 74 * API functions 75 75 */ 76 76 77 - /* 78 - * The "get_*restore_pointer" functions are used to provide a 79 - * physical restore address where the ROM code jumps while waking 80 - * up from MPU OFF/OSWR state. 81 - * The restore pointer is stored into the scratchpad. 82 - */ 83 - 84 - .text 85 - /* Function call to get the restore pointer for resume from OFF */ 86 - ENTRY(get_restore_pointer) 87 - stmfd sp!, {lr} @ save registers on stack 88 - adr r0, restore 89 - ldmfd sp!, {pc} @ restore regs and return 90 - ENDPROC(get_restore_pointer) 91 - .align 92 - ENTRY(get_restore_pointer_sz) 93 - .word . - get_restore_pointer 94 - 95 - .text 96 - /* Function call to get the restore pointer for 3630 resume from OFF */ 97 - ENTRY(get_omap3630_restore_pointer) 98 - stmfd sp!, {lr} @ save registers on stack 99 - adr r0, restore_3630 100 - ldmfd sp!, {pc} @ restore regs and return 101 - ENDPROC(get_omap3630_restore_pointer) 102 - .align 103 - ENTRY(get_omap3630_restore_pointer_sz) 104 - .word . - get_omap3630_restore_pointer 105 - 106 - .text 107 - /* Function call to get the restore pointer for ES3 to resume from OFF */ 108 - ENTRY(get_es3_restore_pointer) 109 - stmfd sp!, {lr} @ save registers on stack 110 - adr r0, restore_es3 111 - ldmfd sp!, {pc} @ restore regs and return 112 - ENDPROC(get_es3_restore_pointer) 113 - .align 114 - ENTRY(get_es3_restore_pointer_sz) 115 - .word . - get_es3_restore_pointer 116 - 117 77 .text 118 78 /* 119 79 * L2 cache needs to be toggled for stable OFF mode functionality on 3630. ··· 276 316 * restore_3630: applies to 36xx 277 317 * restore: common code for 3xxx 278 318 */ 279 - restore_es3: 319 + ENTRY(omap3_restore_es3) 280 320 ldr r5, pm_prepwstst_core_p 281 321 ldr r4, [r5] 282 322 and r4, r4, #0x3 283 323 cmp r4, #0x0 @ Check if previous power state of CORE is OFF 284 - bne restore 324 + bne omap3_restore 285 325 adr r0, es3_sdrc_fix 286 326 ldr r1, sram_base 287 327 ldr r2, es3_sdrc_fix_sz ··· 293 333 bne copy_to_sram 294 334 ldr r1, sram_base 295 335 blx r1 296 - b restore 336 + b omap3_restore 337 + ENDPROC(omap3_restore_es3) 297 338 298 - restore_3630: 339 + ENTRY(omap3_restore_3630) 299 340 ldr r1, pm_prepwstst_core_p 300 341 ldr r2, [r1] 301 342 and r2, r2, #0x3 302 343 cmp r2, #0x0 @ Check if previous power state of CORE is OFF 303 - bne restore 344 + bne omap3_restore 304 345 /* Disable RTA before giving control */ 305 346 ldr r1, control_mem_rta 306 347 mov r2, #OMAP36XX_RTA_DISABLE 307 348 str r2, [r1] 349 + ENDPROC(omap3_restore_3630) 308 350 309 351 /* Fall through to common code for the remaining logic */ 310 352 311 - restore: 353 + ENTRY(omap3_restore) 312 354 /* 313 355 * Read the pwstctrl register to check the reason for mpu reset. 314 356 * This tells us what was lost. ··· 400 438 401 439 /* Now branch to the common CPU resume function */ 402 440 b cpu_resume 441 + ENDPROC(omap3_restore) 403 442 404 443 .ltorg 405 444