diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/sleep34xx.S | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index aa43da5176eb..24ecb0a5cce1 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S | |||
@@ -42,6 +42,7 @@ | |||
42 | OMAP3430_PM_PREPWSTST) | 42 | OMAP3430_PM_PREPWSTST) |
43 | #define PM_PWSTCTRL_MPU_P OMAP3430_PRM_BASE + MPU_MOD + OMAP2_PM_PWSTCTRL | 43 | #define PM_PWSTCTRL_MPU_P OMAP3430_PRM_BASE + MPU_MOD + OMAP2_PM_PWSTCTRL |
44 | #define CM_IDLEST1_CORE_V OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST1) | 44 | #define CM_IDLEST1_CORE_V OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST1) |
45 | #define CM_IDLEST_CKGEN_V OMAP34XX_CM_REGADDR(PLL_MOD, CM_IDLEST) | ||
45 | #define SRAM_BASE_P 0x40200000 | 46 | #define SRAM_BASE_P 0x40200000 |
46 | #define CONTROL_STAT 0x480022F0 | 47 | #define CONTROL_STAT 0x480022F0 |
47 | #define SCRATCHPAD_MEM_OFFS 0x310 /* Move this as correct place is | 48 | #define SCRATCHPAD_MEM_OFFS 0x310 /* Move this as correct place is |
@@ -555,31 +556,67 @@ skip_l2_inval: | |||
555 | 556 | ||
556 | /* Make sure SDRC accesses are ok */ | 557 | /* Make sure SDRC accesses are ok */ |
557 | wait_sdrc_ok: | 558 | wait_sdrc_ok: |
559 | |||
560 | /* DPLL3 must be locked before accessing the SDRC. Maybe the HW ensures this. */ | ||
561 | ldr r4, cm_idlest_ckgen | ||
562 | wait_dpll3_lock: | ||
563 | ldr r5, [r4] | ||
564 | tst r5, #1 | ||
565 | beq wait_dpll3_lock | ||
566 | |||
558 | ldr r4, cm_idlest1_core | 567 | ldr r4, cm_idlest1_core |
568 | wait_sdrc_ready: | ||
559 | ldr r5, [r4] | 569 | ldr r5, [r4] |
560 | and r5, r5, #0x2 | 570 | tst r5, #0x2 |
561 | cmp r5, #0 | 571 | bne wait_sdrc_ready |
562 | bne wait_sdrc_ok | 572 | /* allow DLL powerdown upon hw idle req */ |
563 | ldr r4, sdrc_power | 573 | ldr r4, sdrc_power |
564 | ldr r5, [r4] | 574 | ldr r5, [r4] |
565 | bic r5, r5, #0x40 | 575 | bic r5, r5, #0x40 |
566 | str r5, [r4] | 576 | str r5, [r4] |
567 | wait_dll_lock: | 577 | is_dll_in_lock_mode: |
578 | |||
568 | /* Is dll in lock mode? */ | 579 | /* Is dll in lock mode? */ |
569 | ldr r4, sdrc_dlla_ctrl | 580 | ldr r4, sdrc_dlla_ctrl |
570 | ldr r5, [r4] | 581 | ldr r5, [r4] |
571 | tst r5, #0x4 | 582 | tst r5, #0x4 |
572 | bxne lr | 583 | bxne lr |
573 | /* wait till dll locks */ | 584 | /* wait till dll locks */ |
574 | ldr r4, sdrc_dlla_status | 585 | wait_dll_lock_timed: |
586 | ldr r4, wait_dll_lock_counter | ||
587 | add r4, r4, #1 | ||
588 | str r4, wait_dll_lock_counter | ||
589 | ldr r4, sdrc_dlla_status | ||
590 | mov r6, #8 /* Wait 20uS for lock */ | ||
591 | wait_dll_lock: | ||
592 | subs r6, r6, #0x1 | ||
593 | beq kick_dll | ||
575 | ldr r5, [r4] | 594 | ldr r5, [r4] |
576 | and r5, r5, #0x4 | 595 | and r5, r5, #0x4 |
577 | cmp r5, #0x4 | 596 | cmp r5, #0x4 |
578 | bne wait_dll_lock | 597 | bne wait_dll_lock |
579 | bx lr | 598 | bx lr |
580 | 599 | ||
600 | /* disable/reenable DLL if not locked */ | ||
601 | kick_dll: | ||
602 | ldr r4, sdrc_dlla_ctrl | ||
603 | ldr r5, [r4] | ||
604 | mov r6, r5 | ||
605 | bic r6, #(1<<3) /* disable dll */ | ||
606 | str r6, [r4] | ||
607 | dsb | ||
608 | orr r6, r6, #(1<<3) /* enable dll */ | ||
609 | str r6, [r4] | ||
610 | dsb | ||
611 | ldr r4, kick_counter | ||
612 | add r4, r4, #1 | ||
613 | str r4, kick_counter | ||
614 | b wait_dll_lock_timed | ||
615 | |||
581 | cm_idlest1_core: | 616 | cm_idlest1_core: |
582 | .word CM_IDLEST1_CORE_V | 617 | .word CM_IDLEST1_CORE_V |
618 | cm_idlest_ckgen: | ||
619 | .word CM_IDLEST_CKGEN_V | ||
583 | sdrc_dlla_status: | 620 | sdrc_dlla_status: |
584 | .word SDRC_DLLA_STATUS_V | 621 | .word SDRC_DLLA_STATUS_V |
585 | sdrc_dlla_ctrl: | 622 | sdrc_dlla_ctrl: |
@@ -616,5 +653,13 @@ control_stat: | |||
616 | .word CONTROL_STAT | 653 | .word CONTROL_STAT |
617 | kernel_flush: | 654 | kernel_flush: |
618 | .word v7_flush_dcache_all | 655 | .word v7_flush_dcache_all |
656 | /* | ||
657 | * When exporting to userspace while the counters are in SRAM, | ||
658 | * these 2 words need to be at the end to facilitate retrival! | ||
659 | */ | ||
660 | kick_counter: | ||
661 | .word 0 | ||
662 | wait_dll_lock_counter: | ||
663 | .word 0 | ||
619 | ENTRY(omap34xx_cpu_suspend_sz) | 664 | ENTRY(omap34xx_cpu_suspend_sz) |
620 | .word . - omap34xx_cpu_suspend | 665 | .word . - omap34xx_cpu_suspend |