diff options
author | Rajendra Nayak <rnayak@ti.com> | 2009-05-28 08:43:06 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-02-23 14:05:05 -0500 |
commit | a89b6f006201469a74dfc0cc4e953648b6a1c69d (patch) | |
tree | 45fcb38420022f1d8cc4a77c2420f35fd0f3612a /arch | |
parent | 5a1b1d3a9efad6bd53d01ff02e86626d1a51d697 (diff) |
OMAP3: PM: add scratchpad locking function
This patch implements locking using the semaphore in scratchpad
memory preventing any concurrent access to scratchpad from OMAP
and Baseband/Modem processor.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/sleep34xx.S | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index 22fcc14e63be..12a8ba0e0a3c 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S | |||
@@ -33,6 +33,8 @@ | |||
33 | #include "prm.h" | 33 | #include "prm.h" |
34 | #include "sdrc.h" | 34 | #include "sdrc.h" |
35 | 35 | ||
36 | #define SDRC_SCRATCHPAD_SEM_V 0xfa00291c | ||
37 | |||
36 | #define PM_PREPWSTST_CORE_V OMAP34XX_PRM_REGADDR(CORE_MOD, \ | 38 | #define PM_PREPWSTST_CORE_V OMAP34XX_PRM_REGADDR(CORE_MOD, \ |
37 | OMAP3430_PM_PREPWSTST) | 39 | OMAP3430_PM_PREPWSTST) |
38 | #define PM_PREPWSTST_CORE_P 0x48306AE8 | 40 | #define PM_PREPWSTST_CORE_P 0x48306AE8 |
@@ -57,6 +59,37 @@ | |||
57 | #define SDRC_DLLA_STATUS_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) | 59 | #define SDRC_DLLA_STATUS_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) |
58 | #define SDRC_DLLA_CTRL_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL) | 60 | #define SDRC_DLLA_CTRL_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL) |
59 | 61 | ||
62 | .text | ||
63 | /* Function to aquire the semaphore in scratchpad */ | ||
64 | ENTRY(lock_scratchpad_sem) | ||
65 | stmfd sp!, {lr} @ save registers on stack | ||
66 | wait_sem: | ||
67 | mov r0,#1 | ||
68 | ldr r1, sdrc_scratchpad_sem | ||
69 | wait_loop: | ||
70 | ldr r2, [r1] @ load the lock value | ||
71 | cmp r2, r0 @ is the lock free ? | ||
72 | beq wait_loop @ not free... | ||
73 | swp r2, r0, [r1] @ semaphore free so lock it and proceed | ||
74 | cmp r2, r0 @ did we succeed ? | ||
75 | beq wait_sem @ no - try again | ||
76 | ldmfd sp!, {pc} @ restore regs and return | ||
77 | sdrc_scratchpad_sem: | ||
78 | .word SDRC_SCRATCHPAD_SEM_V | ||
79 | ENTRY(lock_scratchpad_sem_sz) | ||
80 | .word . - lock_scratchpad_sem | ||
81 | |||
82 | .text | ||
83 | /* Function to release the scratchpad semaphore */ | ||
84 | ENTRY(unlock_scratchpad_sem) | ||
85 | stmfd sp!, {lr} @ save registers on stack | ||
86 | ldr r3, sdrc_scratchpad_sem | ||
87 | mov r2,#0 | ||
88 | str r2,[r3] | ||
89 | ldmfd sp!, {pc} @ restore regs and return | ||
90 | ENTRY(unlock_scratchpad_sem_sz) | ||
91 | .word . - unlock_scratchpad_sem | ||
92 | |||
60 | .text | 93 | .text |
61 | /* Function call to get the restore pointer for resume from OFF */ | 94 | /* Function call to get the restore pointer for resume from OFF */ |
62 | ENTRY(get_restore_pointer) | 95 | ENTRY(get_restore_pointer) |