diff options
author | Tero Kristo <t-kristo@ti.com> | 2011-12-16 16:36:58 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2011-12-16 16:36:58 -0500 |
commit | 91285b6fa296657d92dc2225100fb94aee869bf2 (patch) | |
tree | ad06e6b86a2da5e09eb9222e73ed82286ac06542 /arch/arm/mach-omap2/prm44xx.c | |
parent | 0a84a91c37ada296ffe7147e73af99b5654628ec (diff) |
ARM: OMAP: PRCM: add suspend prepare / finish support
PRCM chain handler needs to disable forwarding of interrupts during
suspend, because runtime PM is disabled and most of the drivers
are potentially not able to handle interrupts coming at this time.
This patch masks all the PRCM interrupt events if a PRCM interrupt
occurs during suspend, but does not ack them. Once suspend finish
is called, all the masked events will be re-enabled, which causes
immediate PRCM interrupt and handles the postponed event.
The suspend prepare and complete callbacks will be called from
pm34xx.c / pm44xx.c files in the following patches.
The functions defined in this patch should eventually be moved to
suspend->prepare and suspend->finish driver hooks, once the PRCM
chain handler will be made as its own driver.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
[paul@pwsan.com: add kerneldoc, add omap_prcm_irq_setup.saved_mask, add fn
ptrs for save_and_clear_irqen() and restore_irqen()]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/prm44xx.c')
-rw-r--r-- | arch/arm/mach-omap2/prm44xx.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index 9b21154f0162..c4be5d94a019 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c | |||
@@ -163,3 +163,51 @@ void omap44xx_prm_ocp_barrier(void) | |||
163 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | 163 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, |
164 | OMAP4_REVISION_PRM_OFFSET); | 164 | OMAP4_REVISION_PRM_OFFSET); |
165 | } | 165 | } |
166 | |||
167 | /** | ||
168 | * omap44xx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU* regs | ||
169 | * @saved_mask: ptr to a u32 array to save IRQENABLE bits | ||
170 | * | ||
171 | * Save the PRM_IRQENABLE_MPU and PRM_IRQENABLE_MPU_2 registers to | ||
172 | * @saved_mask. @saved_mask must be allocated by the caller. | ||
173 | * Intended to be used in the PRM interrupt handler suspend callback. | ||
174 | * The OCP barrier is needed to ensure the write to disable PRM | ||
175 | * interrupts reaches the PRM before returning; otherwise, spurious | ||
176 | * interrupts might occur. No return value. | ||
177 | */ | ||
178 | void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask) | ||
179 | { | ||
180 | saved_mask[0] = | ||
181 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | ||
182 | OMAP4_PRM_IRQSTATUS_MPU_OFFSET); | ||
183 | saved_mask[1] = | ||
184 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | ||
185 | OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET); | ||
186 | |||
187 | omap4_prm_write_inst_reg(0, OMAP4430_PRM_DEVICE_INST, | ||
188 | OMAP4_PRM_IRQENABLE_MPU_OFFSET); | ||
189 | omap4_prm_write_inst_reg(0, OMAP4430_PRM_DEVICE_INST, | ||
190 | OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); | ||
191 | |||
192 | /* OCP barrier */ | ||
193 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | ||
194 | OMAP4_REVISION_PRM_OFFSET); | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * omap44xx_prm_restore_irqen - set PRM_IRQENABLE_MPU* registers from args | ||
199 | * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously | ||
200 | * | ||
201 | * Restore the PRM_IRQENABLE_MPU and PRM_IRQENABLE_MPU_2 registers from | ||
202 | * @saved_mask. Intended to be used in the PRM interrupt handler resume | ||
203 | * callback to restore values saved by omap44xx_prm_save_and_clear_irqen(). | ||
204 | * No OCP barrier should be needed here; any pending PRM interrupts will fire | ||
205 | * once the writes reach the PRM. No return value. | ||
206 | */ | ||
207 | void omap44xx_prm_restore_irqen(u32 *saved_mask) | ||
208 | { | ||
209 | omap4_prm_write_inst_reg(saved_mask[0], OMAP4430_PRM_DEVICE_INST, | ||
210 | OMAP4_PRM_IRQENABLE_MPU_OFFSET); | ||
211 | omap4_prm_write_inst_reg(saved_mask[1], OMAP4430_PRM_DEVICE_INST, | ||
212 | OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); | ||
213 | } | ||