diff options
| -rw-r--r-- | arch/arm/mach-omap2/sleep34xx.S | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index a05c348885ac..0c1b33511fed 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S | |||
| @@ -64,6 +64,11 @@ | |||
| 64 | #define SDRC_DLLA_STATUS_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) | 64 | #define SDRC_DLLA_STATUS_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) |
| 65 | #define SDRC_DLLA_CTRL_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL) | 65 | #define SDRC_DLLA_CTRL_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL) |
| 66 | 66 | ||
| 67 | /* | ||
| 68 | * This file needs be built unconditionally as ARM to interoperate correctly | ||
| 69 | * with non-Thumb-2-capable firmware. | ||
| 70 | */ | ||
| 71 | .arm | ||
| 67 | 72 | ||
| 68 | /* | 73 | /* |
| 69 | * API functions | 74 | * API functions |
| @@ -82,6 +87,8 @@ ENTRY(get_restore_pointer) | |||
| 82 | stmfd sp!, {lr} @ save registers on stack | 87 | stmfd sp!, {lr} @ save registers on stack |
| 83 | adr r0, restore | 88 | adr r0, restore |
| 84 | ldmfd sp!, {pc} @ restore regs and return | 89 | ldmfd sp!, {pc} @ restore regs and return |
| 90 | ENDPROC(get_restore_pointer) | ||
| 91 | .align | ||
| 85 | ENTRY(get_restore_pointer_sz) | 92 | ENTRY(get_restore_pointer_sz) |
| 86 | .word . - get_restore_pointer | 93 | .word . - get_restore_pointer |
| 87 | 94 | ||
| @@ -91,6 +98,8 @@ ENTRY(get_omap3630_restore_pointer) | |||
| 91 | stmfd sp!, {lr} @ save registers on stack | 98 | stmfd sp!, {lr} @ save registers on stack |
| 92 | adr r0, restore_3630 | 99 | adr r0, restore_3630 |
| 93 | ldmfd sp!, {pc} @ restore regs and return | 100 | ldmfd sp!, {pc} @ restore regs and return |
| 101 | ENDPROC(get_omap3630_restore_pointer) | ||
| 102 | .align | ||
| 94 | ENTRY(get_omap3630_restore_pointer_sz) | 103 | ENTRY(get_omap3630_restore_pointer_sz) |
| 95 | .word . - get_omap3630_restore_pointer | 104 | .word . - get_omap3630_restore_pointer |
| 96 | 105 | ||
| @@ -100,6 +109,8 @@ ENTRY(get_es3_restore_pointer) | |||
| 100 | stmfd sp!, {lr} @ save registers on stack | 109 | stmfd sp!, {lr} @ save registers on stack |
| 101 | adr r0, restore_es3 | 110 | adr r0, restore_es3 |
| 102 | ldmfd sp!, {pc} @ restore regs and return | 111 | ldmfd sp!, {pc} @ restore regs and return |
| 112 | ENDPROC(get_es3_restore_pointer) | ||
| 113 | .align | ||
| 103 | ENTRY(get_es3_restore_pointer_sz) | 114 | ENTRY(get_es3_restore_pointer_sz) |
| 104 | .word . - get_es3_restore_pointer | 115 | .word . - get_es3_restore_pointer |
| 105 | 116 | ||
| @@ -113,8 +124,10 @@ ENTRY(enable_omap3630_toggle_l2_on_restore) | |||
| 113 | stmfd sp!, {lr} @ save registers on stack | 124 | stmfd sp!, {lr} @ save registers on stack |
| 114 | /* Setup so that we will disable and enable l2 */ | 125 | /* Setup so that we will disable and enable l2 */ |
| 115 | mov r1, #0x1 | 126 | mov r1, #0x1 |
| 116 | str r1, l2dis_3630 | 127 | adrl r2, l2dis_3630 @ may be too distant for plain adr |
| 128 | str r1, [r2] | ||
| 117 | ldmfd sp!, {pc} @ restore regs and return | 129 | ldmfd sp!, {pc} @ restore regs and return |
| 130 | ENDPROC(enable_omap3630_toggle_l2_on_restore) | ||
| 118 | 131 | ||
| 119 | .text | 132 | .text |
| 120 | /* Function to call rom code to save secure ram context */ | 133 | /* Function to call rom code to save secure ram context */ |
| @@ -139,12 +152,14 @@ ENTRY(save_secure_ram_context) | |||
| 139 | nop | 152 | nop |
| 140 | nop | 153 | nop |
| 141 | ldmfd sp!, {r1-r12, pc} | 154 | ldmfd sp!, {r1-r12, pc} |
| 155 | .align | ||
| 142 | sram_phy_addr_mask: | 156 | sram_phy_addr_mask: |
| 143 | .word SRAM_BASE_P | 157 | .word SRAM_BASE_P |
| 144 | high_mask: | 158 | high_mask: |
| 145 | .word 0xffff | 159 | .word 0xffff |
| 146 | api_params: | 160 | api_params: |
| 147 | .word 0x4, 0x0, 0x0, 0x1, 0x1 | 161 | .word 0x4, 0x0, 0x0, 0x1, 0x1 |
| 162 | ENDPROC(save_secure_ram_context) | ||
| 148 | ENTRY(save_secure_ram_context_sz) | 163 | ENTRY(save_secure_ram_context_sz) |
| 149 | .word . - save_secure_ram_context | 164 | .word . - save_secure_ram_context |
| 150 | 165 | ||
| @@ -279,8 +294,18 @@ clean_l2: | |||
| 279 | * - 'might' have to copy address, load and jump to it | 294 | * - 'might' have to copy address, load and jump to it |
| 280 | */ | 295 | */ |
| 281 | ldr r1, kernel_flush | 296 | ldr r1, kernel_flush |
| 282 | mov lr, pc | 297 | blx r1 |
| 283 | bx r1 | 298 | /* |
| 299 | * The kernel doesn't interwork: v7_flush_dcache_all in particluar will | ||
| 300 | * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled. | ||
| 301 | * This sequence switches back to ARM. Note that .align may insert a | ||
| 302 | * nop: bx pc needs to be word-aligned in order to work. | ||
| 303 | */ | ||
| 304 | THUMB( .thumb ) | ||
| 305 | THUMB( .align ) | ||
| 306 | THUMB( bx pc ) | ||
| 307 | THUMB( nop ) | ||
| 308 | .arm | ||
| 284 | 309 | ||
| 285 | omap3_do_wfi: | 310 | omap3_do_wfi: |
| 286 | ldr r4, sdrc_power @ read the SDRC_POWER register | 311 | ldr r4, sdrc_power @ read the SDRC_POWER register |
| @@ -438,6 +463,7 @@ skipl2dis: | |||
| 438 | #endif | 463 | #endif |
| 439 | b logic_l1_restore | 464 | b logic_l1_restore |
| 440 | 465 | ||
| 466 | .align | ||
| 441 | l2_inv_api_params: | 467 | l2_inv_api_params: |
| 442 | .word 0x1, 0x00 | 468 | .word 0x1, 0x00 |
| 443 | l2_inv_gp: | 469 | l2_inv_gp: |
| @@ -607,6 +633,7 @@ usettbr0: | |||
| 607 | 633 | ||
| 608 | /* This function implements the erratum ID i443 WA, applies to 34xx >= ES3.0 */ | 634 | /* This function implements the erratum ID i443 WA, applies to 34xx >= ES3.0 */ |
| 609 | .text | 635 | .text |
| 636 | .align 3 | ||
| 610 | ENTRY(es3_sdrc_fix) | 637 | ENTRY(es3_sdrc_fix) |
| 611 | ldr r4, sdrc_syscfg @ get config addr | 638 | ldr r4, sdrc_syscfg @ get config addr |
| 612 | ldr r5, [r4] @ get value | 639 | ldr r5, [r4] @ get value |
| @@ -634,6 +661,7 @@ ENTRY(es3_sdrc_fix) | |||
| 634 | str r5, [r4] @ kick off refreshes | 661 | str r5, [r4] @ kick off refreshes |
| 635 | bx lr | 662 | bx lr |
| 636 | 663 | ||
| 664 | .align | ||
| 637 | sdrc_syscfg: | 665 | sdrc_syscfg: |
| 638 | .word SDRC_SYSCONFIG_P | 666 | .word SDRC_SYSCONFIG_P |
| 639 | sdrc_mr_0: | 667 | sdrc_mr_0: |
| @@ -648,6 +676,7 @@ sdrc_emr2_1: | |||
| 648 | .word SDRC_EMR2_1_P | 676 | .word SDRC_EMR2_1_P |
| 649 | sdrc_manual_1: | 677 | sdrc_manual_1: |
| 650 | .word SDRC_MANUAL_1_P | 678 | .word SDRC_MANUAL_1_P |
| 679 | ENDPROC(es3_sdrc_fix) | ||
| 651 | ENTRY(es3_sdrc_fix_sz) | 680 | ENTRY(es3_sdrc_fix_sz) |
| 652 | .word . - es3_sdrc_fix | 681 | .word . - es3_sdrc_fix |
| 653 | 682 | ||
| @@ -682,6 +711,12 @@ wait_sdrc_ready: | |||
| 682 | bic r5, r5, #0x40 | 711 | bic r5, r5, #0x40 |
| 683 | str r5, [r4] | 712 | str r5, [r4] |
| 684 | 713 | ||
| 714 | /* | ||
| 715 | * PC-relative stores lead to undefined behaviour in Thumb-2: use a r7 as a | ||
| 716 | * base instead. | ||
| 717 | * Be careful not to clobber r7 when maintaing this code. | ||
| 718 | */ | ||
| 719 | |||
| 685 | is_dll_in_lock_mode: | 720 | is_dll_in_lock_mode: |
| 686 | /* Is dll in lock mode? */ | 721 | /* Is dll in lock mode? */ |
| 687 | ldr r4, sdrc_dlla_ctrl | 722 | ldr r4, sdrc_dlla_ctrl |
| @@ -689,10 +724,11 @@ is_dll_in_lock_mode: | |||
| 689 | tst r5, #0x4 | 724 | tst r5, #0x4 |
| 690 | bxne lr @ Return if locked | 725 | bxne lr @ Return if locked |
| 691 | /* wait till dll locks */ | 726 | /* wait till dll locks */ |
| 727 | adr r7, kick_counter | ||
| 692 | wait_dll_lock_timed: | 728 | wait_dll_lock_timed: |
| 693 | ldr r4, wait_dll_lock_counter | 729 | ldr r4, wait_dll_lock_counter |
| 694 | add r4, r4, #1 | 730 | add r4, r4, #1 |
| 695 | str r4, wait_dll_lock_counter | 731 | str r4, [r7, #wait_dll_lock_counter - kick_counter] |
| 696 | ldr r4, sdrc_dlla_status | 732 | ldr r4, sdrc_dlla_status |
| 697 | /* Wait 20uS for lock */ | 733 | /* Wait 20uS for lock */ |
| 698 | mov r6, #8 | 734 | mov r6, #8 |
| @@ -718,9 +754,10 @@ kick_dll: | |||
| 718 | dsb | 754 | dsb |
| 719 | ldr r4, kick_counter | 755 | ldr r4, kick_counter |
| 720 | add r4, r4, #1 | 756 | add r4, r4, #1 |
| 721 | str r4, kick_counter | 757 | str r4, [r7] @ kick_counter |
| 722 | b wait_dll_lock_timed | 758 | b wait_dll_lock_timed |
| 723 | 759 | ||
| 760 | .align | ||
| 724 | cm_idlest1_core: | 761 | cm_idlest1_core: |
| 725 | .word CM_IDLEST1_CORE_V | 762 | .word CM_IDLEST1_CORE_V |
| 726 | cm_idlest_ckgen: | 763 | cm_idlest_ckgen: |
| @@ -763,6 +800,7 @@ kick_counter: | |||
| 763 | .word 0 | 800 | .word 0 |
| 764 | wait_dll_lock_counter: | 801 | wait_dll_lock_counter: |
| 765 | .word 0 | 802 | .word 0 |
| 803 | ENDPROC(omap34xx_cpu_suspend) | ||
| 766 | 804 | ||
| 767 | ENTRY(omap34xx_cpu_suspend_sz) | 805 | ENTRY(omap34xx_cpu_suspend_sz) |
| 768 | .word . - omap34xx_cpu_suspend | 806 | .word . - omap34xx_cpu_suspend |
