OMAP PM fixes for 2.6.33-rc
cover OMAP PM fixes for 2.6.33-rc
Here's a set of fixes from the OMAP PM brach intended for 2.6.33-rc. This series applies on top Tony's omap-fixes-for-linus branch.
They can be also viewed/pulled from:
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git pm-fixes
Kevin Hilman (1):
OMAP: timekeeping: time should not stop during suspend
Manjunatha GK (1):
OMAP3: PM debug: fix build error when !CONFIG_DEBUG_FS
Peter Ujfalusi (1):
OMAP3: PM: Enable wake-up from McBSP2, 3 and 4 modules
Roel Kluin (1):
OMAP: omap3_pm_get_suspend_state() error ignored in
pwrdm_suspend_get()
Sanjeev Premi (1):
OMAP3: PM: Remove duplicate code blocks
Sripathy, Vishwanath (1):
OMAP3: PM: Removing redundant and potentially dangerous PRCM
configration
Tero Kristo (7):
OMAP2/3: DMTIMER: Clear pending interrupts when stopping a timer
OMAP3: PM: Ack pending interrupts before entering suspend
OMAP3: PM: Enable system control module autoidle
OMAP3: PM: Disable interrupt controller AUTOIDLE before WFI
OMAP3: CPUidle: Fixed timer resolution
OMAP3: Fixed ARM aux ctrl register save/restore
OMAP3: PM: Force write last pad config register into save area
arch/arm/mach-omap2/cpuidle34xx.c | 2 +- arch/arm/mach-omap2/irq.c | 18 +++++++++++++ arch/arm/mach-omap2/pm-debug.c | 8 +++--- arch/arm/mach-omap2/pm.h | 8 ++++- arch/arm/mach-omap2/pm34xx.c | 43 ++++++++++++++++--------------- arch/arm/mach-omap2/prcm.c | 11 -------- arch/arm/mach-omap2/sleep34xx.S | 13 ++++++--- arch/arm/plat-omap/common.c | 26 +++++++++++++++++++ arch/arm/plat-omap/dmtimer.c | 10 +++++++ arch/arm/plat-omap/include/plat/irqs.h | 3 ++ 10 files changed, 99 insertions(+), 43 deletions(-)
PATCH 1/13 OMAP2/3: DMTIMER: Clear pending interrupts when stopping a timer
From: Tero Kristo <[email protected]>
OMAP GP timers keep running for a few cycles after they are stopped, which can cause the timer to expire and generate an interrupt. The pending interrupt will prevent e.g. OMAP from entering suspend, thus we ack it manually.
--- arch/arm/plat-omap/dmtimer.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/plat-omap/dmtimer.c +10 -0
@@ -551,6 +551,16 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)if (l &OMAP_TIMER_CTRL_ST ) { l &= ~0x1 ;omap_dm_timer_write_reg (timer,OMAP_TIMER_CTRL_REG , l); +/* Readback to make sure write has completed */ +omap_dm_timer_read_reg (timer,OMAP_TIMER_CTRL_REG ); +/* +* Wait for functional clock period x 3.5 to make sure that +* timer is stopped +*/ +udelay (3500000 /clk_get_rate (timer->fclk) +1 ); +/* Ack possibly pending interrupt */ +omap_dm_timer_write_reg (timer,OMAP_TIMER_STAT_REG , +OMAP_TIMER_INT_OVERFLOW ); } }EXPORT_SYMBOL_GPL (omap_dm_timer_stop);
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 2/13 OMAP3: PM: Ack pending interrupts before entering suspend
From: Tero Kristo <[email protected]>
Suspending drivers may still generate interrupts just before their suspend is completed. Any pending interrupts here will prevent sleep.
--- arch/arm/mach-omap2/irq.c | 6 ++++++ arch/arm/mach-omap2/pm34xx.c | 2 ++ arch/arm/plat-omap/include/plat/irqs.h | 1 + 3 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/irq.c +6 -0
@@ -274,4 +274,10 @@ void omap_intc_restore_context(void) }/* MIRs are saved and restore with other PRCM registers */ } + +void omap3_intc_suspend (void ) +{ +/* A pending interrupt would prevent OMAP from entering suspend */ +omap_ack_irq (0 ); +}#endif /* CONFIG_ARCH_OMAP3 */
arch/arm/mach-omap2/pm34xx.c +2 -0
@@ -578,6 +578,8 @@ static int omap3_pm_suspend(void) }omap_uart_prepare_suspend (); +omap3_intc_suspend (); +omap_sram_idle (); restore:
arch/arm/plat-omap/include/plat/irqs.h +1 -0
@@ -499,6 +499,7 @@ extern void omap_init_irq(void);extern int omap_irq_pending (void );void omap_intc_save_context (void );void omap_intc_restore_context (void ); +void omap3_intc_suspend (void );#endif #include <mach/hardware.h>
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 3/13 OMAP3: PM: Enable system control module autoidle
From: Tero Kristo <[email protected]>
Enable the auto-idle feature of the SCM block to save some additional power.
--- arch/arm/mach-omap2/pm34xx.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm34xx.c +2 -0
@@ -837,6 +837,8 @@ static void __init prcm_setup_regs(void) CM_AUTOIDLE); } +omap_ctrl_writel (OMAP3430_AUTOIDLE ,OMAP2_CONTROL_SYSCONFIG ); +/* * Set all plls to autoidle. This is needed until autoidle is * enabled by clockfw
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 4/13 OMAP3: PM: Disable interrupt controller AUTOIDLE before WFI
From: Tero Kristo <[email protected]>
OMAP interrupt controller goes to unknown state when there is right combination of l3,l4 sleep/wake-up transitions, l4 autoidle in interrupt controller and some interrupt. When this happens, interrupts are not delivered to ARM anymore and ARM will remain in WFI (wait for interrupt) until interrupt controller is forced to wake-up (i.e. lauterbach).
--- arch/arm/mach-omap2/irq.c | 12 ++++++++++++ arch/arm/mach-omap2/pm34xx.c | 2 ++ arch/arm/plat-omap/include/plat/irqs.h | 2 ++ 3 files changed, 16 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/irq.c +12 -0
@@ -280,4 +280,16 @@ void omap3_intc_suspend(void)/* A pending interrupt would prevent OMAP from entering suspend */ omap_ack_irq(0); } + +void omap3_intc_prepare_idle (void ) +{ +/* Disable autoidle as it can stall interrupt controller */ +intc_bank_write_reg (0 , &irq_banks[0 ],INTC_SYSCONFIG ); +} + +void omap3_intc_resume_idle (void ) +{ +/* Re-enable autoidle */ +intc_bank_write_reg (1 , &irq_banks[0 ],INTC_SYSCONFIG ); +}#endif /* CONFIG_ARCH_OMAP3 */
arch/arm/mach-omap2/pm34xx.c +2 -0
@@ -392,6 +392,7 @@ void omap_sram_idle(void)prm_set_mod_reg_bits (OMAP3430_EN_IO ,WKUP_MOD ,PM_WKEN );omap3_enable_io_chain (); } +omap3_intc_prepare_idle ();/* * On EMU/HS devices ROM code restores a SRDC value
@@ -438,6 +439,7 @@ void omap_sram_idle(void)OMAP3430_GR_MOD , OMAP3_PRM_VOLTCTRL_OFFSET); } +omap3_intc_resume_idle ();/* PER */ if (per_next_state <PWRDM_POWER_ON ) {
arch/arm/plat-omap/include/plat/irqs.h +2 -0
@@ -500,6 +500,8 @@ extern int omap_irq_pending(void);void omap_intc_save_context (void );void omap_intc_restore_context (void );void omap3_intc_suspend (void ); +void omap3_intc_prepare_idle (void ); +void omap3_intc_resume_idle (void );#endif #include <mach/hardware.h>
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 5/13 OMAP3: PM: Remove duplicate code blocks
From: Sanjeev Premi <[email protected]>
This patch removes code blocks that are repeated
in function prcm_setup_regs().
--- arch/arm/mach-omap2/pm34xx.c | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-)
arch/arm/mach-omap2/pm34xx.c +0 -18
@@ -910,24 +910,6 @@ static void __init prcm_setup_regs(void)/* Clear any pending PRCM interrupts */ prm_write_mod_reg (0 ,OCP_MOD ,OMAP3_PRM_IRQSTATUS_MPU_OFFSET ); -/* Don't attach IVA interrupts */ -prm_write_mod_reg (0 ,WKUP_MOD ,OMAP3430_PM_IVAGRPSEL ); -prm_write_mod_reg (0 ,CORE_MOD ,OMAP3430_PM_IVAGRPSEL1 ); -prm_write_mod_reg (0 ,CORE_MOD ,OMAP3430ES2_PM_IVAGRPSEL3 ); -prm_write_mod_reg (0 ,OMAP3430_PER_MOD ,OMAP3430_PM_IVAGRPSEL ); - -/* Clear any pending 'reset' flags */ -prm_write_mod_reg (0xffffffff ,MPU_MOD ,RM_RSTST ); -prm_write_mod_reg (0xffffffff ,CORE_MOD ,RM_RSTST ); -prm_write_mod_reg (0xffffffff ,OMAP3430_PER_MOD ,RM_RSTST ); -prm_write_mod_reg (0xffffffff ,OMAP3430_EMU_MOD ,RM_RSTST ); -prm_write_mod_reg (0xffffffff ,OMAP3430_NEON_MOD ,RM_RSTST ); -prm_write_mod_reg (0xffffffff ,OMAP3430_DSS_MOD ,RM_RSTST ); -prm_write_mod_reg (0xffffffff ,OMAP3430ES2_USBHOST_MOD ,RM_RSTST ); - -/* Clear any pending PRCM interrupts */ -prm_write_mod_reg (0 ,OCP_MOD ,OMAP3_PRM_IRQSTATUS_MPU_OFFSET ); -omap3_iva_idle ();omap3_d2d_idle (); }
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 6/13 OMAP3: CPUidle: Fixed timer resolution
From: Tero Kristo <[email protected]>
Previously used u32 as temporary data storage that wraps around at 4.294s.
--- arch/arm/mach-omap2/cpuidle34xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +1 -1
@@ -137,7 +137,7 @@ return_sleep_time:local_irq_enable ();local_fiq_enable (); -return (u32 )timespec_to_ns (&ts_idle)/1000 ; +return ts_idle.tv_nsec /NSEC_PER_USEC + ts_idle.tv_sec *USEC_PER_SEC ; }/**
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 7/13 OMAP3: Fixed ARM aux ctrl register save/restore
From: Tero Kristo <[email protected]>
Current value is stored on SDRAM and it is written back during wakeup. Previously a static value of 0x72 was written there.
--- arch/arm/mach-omap2/sleep34xx.S | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +9 -4
@@ -245,7 +245,8 @@ restore: mov r1, #0 @ set task id for ROM code in r1 mov r2, #4 @ set some flags in r2, r6 mov r6, #0xff - adr r3, write_aux_control_params @ r3 points to parameters + ldr r4, scratchpad_base + ldr r3, [r4, #0xBC] @ r3 points to parameters mcr p15, 0, r0, c7, c10, 4 @ data write barrier mcr p15, 0, r0, c7, c10, 5 @ data memory barrier .word 0xE1600071 @ call SMI monitor (smi #1)
@@ -253,14 +254,14 @@ restore: b logic_l1_restore l2_inv_api_params: .word 0x1, 0x00 -write_aux_control_params: - .word 0x1, 0x72 l2_inv_gp: /* Execute smi to invalidate L2 cache */ mov r12, #0x1 @ set up to invalide L2 smi: .word 0xE1600070 @ Call SMI monitor (smieq) /* Write to Aux control register to set some bits */ - mov r0, #0x72 + ldr r4, scratchpad_base + ldr r3, [r4,#0xBC] + ldr r0, [r3,#4] mov r12, #0x3 .word 0xE1600070 @ Call SMI monitor (smieq) logic_l1_restore:
@@ -271,6 +272,7 @@ logic_l1_restore: ldr r4, scratchpad_base ldr r3, [r4,#0xBC] + adds r3, r3, #8 ldmia r3!, {r4-r6} mov sp, r4 msr spsr_cxsf, r5
@@ -387,6 +389,9 @@ usettbr0: save_context_wfi: /*b save_context_wfi*/ @ enable to debug save code mov r8, r0 /* Store SDRAM address in r8 */ + mrc p15, 0, r5, c1, c0, 1 @ Read Auxiliary Control Register + mov r4, #0x1 @ Number of parameters for restore call + stmia r8!, {r4-r5} /* Check what that target sleep state is:stored in r1*/ /* 1 - Only L1 and logic lost */ /* 2 - Only L2 lost */
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 8/13 OMAP3: PM: Removing redundant and potentially dangerous PRCM configration
From: Sripathy, Vishwanath <[email protected]>
As part of Core domain context restoration while coming out of off mode
there are some registers being restored which are not required to be restored. ROM code will have restored them already. Overwriting some of them can have potential side effect. Eg: CM_CLKEN_PLL register should not be written while dpll is locked. Tested on OMAP 3430 SDP for suspend/resume and off mode with sleep_while_idle enabled.
--- arch/arm/mach-omap2/prcm.c | 11 ----------- 1 files changed, 0 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/prcm.c +0 -11
@@ -44,7 +44,6 @@ struct omap3_prcm_regs {u32 iva2_cm_clksel2;u32 cm_sysconfig;u32 sgx_cm_clksel; -u32 wkup_cm_clksel;u32 dss_cm_clksel;u32 cam_cm_clksel;u32 per_cm_clksel;
@@ -53,7 +52,6 @@ struct omap3_prcm_regs {u32 pll_cm_autoidle2;u32 pll_cm_clksel4;u32 pll_cm_clksel5; -u32 pll_cm_clken;u32 pll_cm_clken2;u32 cm_polctrl;u32 iva2_cm_fclken;
@@ -77,7 +75,6 @@ struct omap3_prcm_regs {u32 usbhost_cm_iclken;u32 iva2_cm_autiidle2;u32 mpu_cm_autoidle2; -u32 pll_cm_autoidle;u32 iva2_cm_clkstctrl;u32 mpu_cm_clkstctrl;u32 core_cm_clkstctrl;
@@ -274,7 +271,6 @@ void omap3_prcm_save_context(void) prcm_context.cm_sysconfig =__raw_readl (OMAP3430_CM_SYSCONFIG ); prcm_context.sgx_cm_clksel =cm_read_mod_reg (OMAP3430ES2_SGX_MOD ,CM_CLKSEL ); - prcm_context.wkup_cm_clksel =cm_read_mod_reg (WKUP_MOD ,CM_CLKSEL ); prcm_context.dss_cm_clksel =cm_read_mod_reg (OMAP3430_DSS_MOD ,CM_CLKSEL ); prcm_context.cam_cm_clksel =
@@ -291,8 +287,6 @@ void omap3_prcm_save_context(void)cm_read_mod_reg (PLL_MOD ,OMAP3430ES2_CM_CLKSEL4 ); prcm_context.pll_cm_clksel5 =cm_read_mod_reg (PLL_MOD ,OMAP3430ES2_CM_CLKSEL5 ); - prcm_context.pll_cm_clken = -cm_read_mod_reg (PLL_MOD ,CM_CLKEN ); prcm_context.pll_cm_clken2 =cm_read_mod_reg (PLL_MOD ,OMAP3430ES2_CM_CLKEN2 ); prcm_context.cm_polctrl =__raw_readl (OMAP3430_CM_POLCTRL );
@@ -338,8 +332,6 @@ void omap3_prcm_save_context(void)cm_read_mod_reg (OMAP3430_IVA2_MOD ,CM_AUTOIDLE2 ); prcm_context.mpu_cm_autoidle2 =cm_read_mod_reg (MPU_MOD ,CM_AUTOIDLE2 ); - prcm_context.pll_cm_autoidle = -cm_read_mod_reg (PLL_MOD ,CM_AUTOIDLE ); prcm_context.iva2_cm_clkstctrl =cm_read_mod_reg (OMAP3430_IVA2_MOD ,CM_CLKSTCTRL ); prcm_context.mpu_cm_clkstctrl =
@@ -431,7 +423,6 @@ void omap3_prcm_restore_context(void)__raw_writel (prcm_context.cm_sysconfig,OMAP3430_CM_SYSCONFIG );cm_write_mod_reg (prcm_context.sgx_cm_clksel,OMAP3430ES2_SGX_MOD ,CM_CLKSEL ); -cm_write_mod_reg (prcm_context.wkup_cm_clksel,WKUP_MOD ,CM_CLKSEL );cm_write_mod_reg (prcm_context.dss_cm_clksel,OMAP3430_DSS_MOD ,CM_CLKSEL ); cm_write_mod_reg(prcm_context.cam_cm_clksel, OMAP3430_CAM_MOD,
@@ -448,7 +439,6 @@ void omap3_prcm_restore_context(void) OMAP3430ES2_CM_CLKSEL4);cm_write_mod_reg (prcm_context.pll_cm_clksel5,PLL_MOD ,OMAP3430ES2_CM_CLKSEL5 ); -cm_write_mod_reg (prcm_context.pll_cm_clken,PLL_MOD ,CM_CLKEN );cm_write_mod_reg (prcm_context.pll_cm_clken2,PLL_MOD ,OMAP3430ES2_CM_CLKEN2 );__raw_writel (prcm_context.cm_polctrl,OMAP3430_CM_POLCTRL );
@@ -487,7 +477,6 @@ void omap3_prcm_restore_context(void)cm_write_mod_reg (prcm_context.iva2_cm_autiidle2,OMAP3430_IVA2_MOD ,CM_AUTOIDLE2 );cm_write_mod_reg (prcm_context.mpu_cm_autoidle2,MPU_MOD ,CM_AUTOIDLE2 ); -cm_write_mod_reg (prcm_context.pll_cm_autoidle,PLL_MOD ,CM_AUTOIDLE );cm_write_mod_reg (prcm_context.iva2_cm_clkstctrl,OMAP3430_IVA2_MOD ,CM_CLKSTCTRL );cm_write_mod_reg (prcm_context.mpu_cm_clkstctrl,MPU_MOD ,CM_CLKSTCTRL );
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 9/13 OMAP3: PM debug: fix build error when !CONFIG_DEBUG_FS
From: Manjunatha GK <[email protected]>
The PM debug code fails to build on when CONFIG_DEBUG_FS is not enabled.
Build error log:arch/arm/mach-omap2/built-in.o: In function `omap_sram_idle':arch/arm/mach-omap2/pm34xx.c:449: undefined reference to pm_dbg_regset_save' arch/arm/mach-omap2/pm34xx.c:460: undefined reference to pm_dbg_regset_save' arch/arm/mach-omap2/built-in.o: In function `configure_vc':arch/arm/mach-omap2/pm34xx.c:1237: undefined reference to pm_dbg_regset_init' arch/arm/mach-omap2/pm34xx.c:1238: undefined reference to pm_dbg_regset_init'
make: *** [.tmp_vmlinux1] Error 1
This patch fixes the above errors.
Kernel booting is tested on omap zoom2 and zoom3 boards.
--- arch/arm/mach-omap2/pm-debug.c | 2 -- arch/arm/mach-omap2/pm.h | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/pm-debug.c +0 -2
@@ -604,6 +604,4 @@ static int __init pm_dbg_init(void) }arch_initcall (pm_dbg_init); -#else -void pm_dbg_update_time (struct powerdomain *pwrdm,int prev) {}#endif
arch/arm/mach-omap2/pm.h +6 -2
@@ -32,12 +32,16 @@ extern struct omap_dm_timer *gptimer_wakeup;#ifdef CONFIG_PM_DEBUG extern void omap2_pm_dump (int mode,int resume,unsigned int us);extern int omap2_pm_debug; +#else +#define omap2_pm_dump (mode, resume, us) do {} while (0); +#define omap2_pm_debug 0 +#endif + +#if defined(CONFIG_PM_DEBUG ) && defined(CONFIG_DEBUG_FS )extern void pm_dbg_update_time (struct powerdomain *pwrdm,int prev);extern int pm_dbg_regset_save (int reg_set);extern int pm_dbg_regset_init (int reg_set);#else -#define omap2_pm_dump (mode, resume, us) do {} while (0); -#define omap2_pm_debug 0#define pm_dbg_update_time (pwrdm, prev) do {} while (0);#define pm_dbg_regset_save (reg_set) do {} while (0);#define pm_dbg_regset_init (reg_set) do {} while (0);
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 10/13 OMAP3: PM: Enable wake-up from McBSP2, 3 and 4 modules
From: Peter Ujfalusi <[email protected]>
Wake-up from McBSP ports are needed, especially when the THRESHOLD dma mode is in use for audio playback.
--- arch/arm/mach-omap2/pm34xx.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/pm34xx.c +6 -2
@@ -884,12 +884,16 @@ static void __init prcm_setup_regs(void)/* Enable wakeups in PER */ prm_write_mod_reg (OMAP3430_EN_GPIO2 |OMAP3430_EN_GPIO3 |OMAP3430_EN_GPIO4 |OMAP3430_EN_GPIO5 | -OMAP3430_EN_GPIO6 |OMAP3430_EN_UART3 , +OMAP3430_EN_GPIO6 |OMAP3430_EN_UART3 | +OMAP3430_EN_MCBSP2 |OMAP3430_EN_MCBSP3 | +OMAP3430_EN_MCBSP4 ,OMAP3430_PER_MOD ,PM_WKEN );/* and allow them to wake up MPU */ prm_write_mod_reg (OMAP3430_GRPSEL_GPIO2 |OMAP3430_EN_GPIO3 |OMAP3430_GRPSEL_GPIO4 |OMAP3430_EN_GPIO5 | -OMAP3430_GRPSEL_GPIO6 |OMAP3430_EN_UART3 , +OMAP3430_GRPSEL_GPIO6 |OMAP3430_EN_UART3 | +OMAP3430_EN_MCBSP2 |OMAP3430_EN_MCBSP3 | +OMAP3430_EN_MCBSP4 ,OMAP3430_PER_MOD ,OMAP3430_PM_MPUGRPSEL );/* Don't attach IVA interrupts */
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 11/13 OMAP: omap3_pm_get_suspend_state() error ignored in pwrdm_suspend_get()
From: Roel Kluin <[email protected]>
val is an u64 pointer, we need an int to check the error.
--- arch/arm/mach-omap2/pm-debug.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/pm-debug.c +4 -2
@@ -488,9 +488,11 @@ int pm_dbg_regset_init(int reg_set)static int pwrdm_suspend_get (void *data,u64 *val) { - *val =omap3_pm_get_suspend_state ((struct powerdomain *)data); +int ret; + ret =omap3_pm_get_suspend_state ((struct powerdomain *)data); + *val = ret; -if (*val >=0 ) +if (ret >=0 )return 0 ;return *val; }
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 12/13 OMAP3: PM: Force write last pad config register into save area
From: Tero Kristo <[email protected]>
Due to OMAP3 erratas 1.157, 1.185 the save of the last pad register (ETK_D14 and ETK_D15) can fail sometimes when there is simultaneous OCP access to the SCM register area. Fixed by writing the last register to the save area.
Also, optimized the delay loop for the HW save to include an udelay(1), which limits the number of unnecessary HW accesses to SCM register area during the save.
--- arch/arm/mach-omap2/pm34xx.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/pm34xx.c +10 -1
@@ -26,6 +26,7 @@#include <linux/err.h> #include <linux/gpio.h> #include <linux/clk.h> +#include <linux/delay.h> #include <plat/sram.h> #include <plat/clockdomain.h>
@@ -126,7 +127,15 @@ static void omap3_core_save_context(void)/* wait for the save to complete */ while (!(omap_ctrl_readl (OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS ) &PADCONF_SAVE_DONE )) - ; +udelay (1 ); + +/* +* Force write last pad into memory, as this can fail in some +* cases according to erratas 1.157, 1.185 +*/ +omap_ctrl_writel (omap_ctrl_readl (OMAP343X_PADCONF_ETK_D14 ), +OMAP343X_CONTROL_MEM_WKUP +0x2a0 ); +/* Save the Interrupt controller context */ omap_intc_save_context ();/* Save the GPMC context */
Signature · 1 line
1.6.6.rc2.1.g42108
PATCH 13/13 OMAP: timekeeping: time should not stop during suspend
During suspend, the kernel timekeeping subsystem is shut down. Before suspend and upon resume, it uses a weak function read_persistent_clock() to determine the amount of time that elapsed during suspend.
This function was not implemented on OMAP, so from the timekeeping subsystem perspective (and thus userspace as well) it appeared that no time elapsed during suspend.
This patch uses the 32k sync timer as a the persistent clock.
NOTE: This does *NOT* fully handle wrapping of the 32k sync timer, so
more than one wrapping of the 32k sync timer during suspend may cause problems. Also note there are not interrupts when the 32k sync timer wraps, so something else has to be done.
--- arch/arm/plat-omap/common.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/plat-omap/common.c +26 -0
@@ -172,6 +172,32 @@ unsigned long long sched_clock(void) clocksource_32k.mult, clocksource_32k.shift); } +/** +* read_persistent_clock - Return time from a persistent clock. +* +* Reads the time from a source which isn't disabled during PM, the +* 32k sync timer. Convert the cycles elapsed since last read into +* nsecs and adds to a monotonically increasing timespec. +*/ +static struct timespec persistent_ts; +static cycles_t cycles, last_cycles; +void read_persistent_clock (struct timespec *ts) +{ +unsigned long long nsecs; +cycles_t delta; +struct timespec *tsp = &persistent_ts; + + last_cycles = cycles; + cycles = clocksource_32k.read (&clocksource_32k); + delta = cycles - last_cycles; + + nsecs =clocksource_cyc2ns (delta, + clocksource_32k.mult, clocksource_32k.shift); + +timespec_add_ns (tsp, nsecs); + *ts = *tsp; +} +static int __init omap_init_clocksource_32k (void ) {static char err[]__initdata =KERN_ERR
Signature · 1 line
1.6.6.rc2.1.g42108
RE: [PATCH 01/13] OMAP2/3: DMTIMER: Clear pending interrupts when stopping a timer
In reply to Kevin HilmanQuoted 27 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Friday, January 08, 2010 11:29 PM
To: [email protected]
Cc: Tero Kristo
Subject: [PATCH 01/13] OMAP2/3: DMTIMER: Clear pending interrupts when stopping a timerFrom: Tero Kristo <[email protected]>
OMAP GP timers keep running for a few cycles after they are stopped, which can cause the timer to expire and generate an interrupt. The pending interrupt will prevent e.g. OMAP from entering suspend, thus we ack it manually.
Signed-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/plat-omap/dmtimer.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)arch/arm/plat-omap/dmtimer.c +0
-0
arch/arm/plat-omap/dmtimer.c void omap_dm_timer_stop(struct omap_dm_timer *timer) · line 555
Quoted 5 lines
arch/arm/plat-omap/dmtimer.c +2
-0@@ -551,6 +551,16 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)if (l &OMAP_TIMER_CTRL_ST ) { l &= ~0x1 ;omap_dm_timer_write_reg (timer,OMAP_TIMER_CTRL_REG , l); +/* Readback to make sure write has completed */ +omap_dm_timer_read_reg (timer,OMAP_TIMER_CTRL_REG );
Hopefully compiler don't optimize your readback.
Quoted 18 lines
arch/arm/plat-omap/dmtimer.c +8
-1+/* +* Wait for functional clock period x 3.5 to make sure that +* timer is stopped +*/ +udelay (3500000 /clk_get_rate (timer->fclk) +1 ); +/* Ack possibly pending interrupt */ +omap_dm_timer_write_reg (timer,OMAP_TIMER_STAT_REG , +OMAP_TIMER_INT_OVERFLOW ); } }EXPORT_SYMBOL_GPL (omap_dm_timer_stop); --1.6.6.rc2.1.g42108
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 01/13] OMAP2/3: DMTIMER: Clear pending interrupts when stopping a timer
Hello Santosh,
Quoted 21 lines · Santosh
Quoted 21 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Friday, January 08, 2010 11:29 PM
To: [email protected]
Cc: Tero Kristo
Subject: [PATCH 01/13] OMAP2/3: DMTIMER: Clear pending interrupts when stopping a timerFrom: Tero Kristo <[email protected]>
OMAP GP timers keep running for a few cycles after they are stopped, which can cause the timer to expire and generate an interrupt. The pending interrupt will prevent e.g. OMAP from entering suspend, thus we ack it manually.
Signed-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/plat-omap/dmtimer.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
Quoted 11 lines
arch/arm/plat-omap/dmtimer.c void omap_dm_timer_stop(struct omap_dm_timer *timer) · line 555
Quoted 10 lines
arch/arm/plat-omap/dmtimer.c +2
-0@@ -551,6 +551,16 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)if (l &OMAP_TIMER_CTRL_ST ) { l &= ~0x1 ;omap_dm_timer_write_reg (timer,OMAP_TIMER_CTRL_REG , l); +/* Readback to make sure write has completed */ +omap_dm_timer_read_reg (timer,OMAP_TIMER_CTRL_REG );Hopefully compiler don't optimize your readback.
It can't - if it does, it is a gcc bug. omap_dm_timer_read_reg() ultimately calls __raw_readl() which uses the 'volatile' keyword:
http://en.wikipedia.org/wiki/Volatile_variable
...
Separately from the compiler, one must also ensure that the ARM core itself does not cache the readback. This is handled by mapping the GPTIMER memory space as MT_DEVICE in mach-omap2/io.c. See also the MT_DEVICE section in arch/arm/mm/mmu.c. Further details are in the ARMv7 Architecture Reference Manual, section A3.5.5, "Device Memory".
- Paul
[PATCH 14/13] DSS PM_WKEN to refill DMA
In reply to Kevin HilmanFrom: Subramani Venkatesh <[email protected]>
Currently, DSS doesnot wakeup when there is a DMA request. DSS wake up event must be enabled so that the DMA request to refill the FIFO will wake up the CORE domain.
---
One more PM fix for the 2.6.33-rc series.
This has been added to my pm-fixes branch.
arch/arm/mach-omap2/pm34xx.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm34xx.c +5 -0
@@ -739,6 +739,11 @@ static void __init prcm_setup_regs(void)prm_write_mod_reg (0 ,OMAP3430_IVA2_MOD ,PM_WKDEP );prm_write_mod_reg (0 ,MPU_MOD ,PM_WKDEP );prm_write_mod_reg (0 ,OMAP3430_DSS_MOD ,PM_WKDEP ); + +/* Enable PM_WKEN to support DSS LPR */ +prm_write_mod_reg (OMAP3430_PM_WKEN_DSS_EN_DSS , +OMAP3430_DSS_MOD ,PM_WKEN ); +prm_write_mod_reg (0 ,OMAP3430_NEON_MOD ,PM_WKDEP );prm_write_mod_reg (0 ,OMAP3430_CAM_MOD ,PM_WKDEP );prm_write_mod_reg (0 ,OMAP3430_PER_MOD ,PM_WKDEP );
Signature · 1 line
1.6.6
[PATCH 15/13] PM debug: Fix warning when no CONFIG_DEBUG_FS
In reply to Kevin HilmanFrom: Aguirre, Sergio <[email protected]>
Quoted 1 line
From
ec3f04ec8cf4851fceb249acf832755b7aad1766Mon Sep 17 00:00:00 2001
From: Sergio Aguirre <[email protected]>
Date: Thu, 14 Jan 2010 11:01:15 -0600
Subject: [PATCH] PM debug: Fix warning when no CONFIG_DEBUG_FS
Fix following warning when CONFIG_DEBUG_FS wasn't selected:
arch/arm/mach-omap2/pm-debug.c:57: warning: 'pm_dbg_init' declared 'static' but never defined
---
OK, this should be the last of the PM fixes for this round.
arch/arm/mach-omap2/pm-debug.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/pm-debug.c +2 -2
@@ -54,8 +54,6 @@ int omap2_pm_debug; regs[reg_count++].val = \ __raw_readl(OMAP2_L4_IO_ADDRESS(0x480fe000 + (off))) -static int __init pm_dbg_init (void ); -void omap2_pm_dump (int mode,int resume,unsigned int us) { struct reg {
@@ -167,6 +165,8 @@ struct dentry *pm_dbg_dir;static int pm_dbg_init_done; +static int __init pm_dbg_init (void ); +enum {DEBUG_FILE_COUNTERS =0 ,DEBUG_FILE_TIMERS ,
Signature · 1 line
1.6.6
Quoted 6 lines · Kevin Hilman
Here's a set of fixes from the OMAP PM brach intended for 2.6.33-rc. This series applies on top Tony's omap-fixes-for-linus branch.
They can be also viewed/pulled from:
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.gitpm-fixes
Tony,
In addition to adding patches 14 & 15, I've rebased this after your
latest update to -rc4. My pm-fixes branch is now based on your current
omap-fixes branch.
Kevin