From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tero Kristo Subject: [PATCH 17/19] ARM: OMAP4: put cpu1 back to sleep if no wake request Date: Fri, 20 Apr 2012 12:33:50 +0300 Message-ID: <1334914432-26456-18-git-send-email-t-kristo@ti.com> References: <1334914432-26456-1-git-send-email-t-kristo@ti.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from arroyo.ext.ti.com ([192.94.94.40]:53169 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752147Ab2DTJeu (ORCPT ); Fri, 20 Apr 2012 05:34:50 -0400 In-Reply-To: <1334914432-26456-1-git-send-email-t-kristo@ti.com> Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: linux-omap@vger.kernel.org, khilman@ti.com, paul@pwsan.com Cc: linux-arm-kernel@lists.infradead.org If AUX_CORE_BOOT0 does not indicate wakeup request for cpu1, put it back to off. This is needed during wakeup from device off to prevent cpu1 from being stuck indefinitely in the wakeup loop and also to prevent wakeup problem on GP chips with device off mode. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/omap-headsmp.S | 45 ++++++++++++++++++++++++++++++++--- 1 files changed, 41 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S index d602555..59c6578 100644 --- a/arch/arm/mach-omap2/omap-headsmp.S +++ b/arch/arm/mach-omap2/omap-headsmp.S @@ -17,8 +17,37 @@ #include #include +#include +#include "prcm_mpu44xx.h" + +#define CPU1_PWRSTCTRL (OMAP4430_PRCM_MPU_BASE + OMAP4430_PRCM_MPU_CPU1_INST + \ + OMAP4_PM_CPU1_PWRSTCTRL_OFFSET) __CPUINIT + +ENTRY(omap_cpu1_off) + ldr r12, =CPU1_PWRSTCTRL + ldr r0, [r12] + and r0, #3 + cmp r0, #2 + beq exit_cpu1_off + + mov r0, #0x3 + mov r1, #0x0 + ldr r12, =OMAP4_MON_SCU_PWR_INDEX + dsb + smc #0 + + isb + dsb + dmb + wfi + nop + nop +exit_cpu1_off: + mov pc, lr +ENDPROC(omap_cpu1_off) + /* * OMAP4 specific entry point for secondary CPU to jump from ROM * code. This routine also provides a holding flag into which @@ -27,32 +56,40 @@ * register AuxCoreBoot0. */ ENTRY(omap_secondary_startup) -hold: ldr r12,=0x103 + ldr r12,=0x103 dsb smc #0 @ read from AuxCoreBoot0 mov r0, r0, lsr #9 mrc p15, 0, r4, c0, c0, 5 and r4, r4, #0x0f cmp r0, r4 - bne hold + beq omap_cont_boot + + bl omap_cpu1_off + b omap_secondary_startup /* * we've been released from the wait loop,secondary_stack * should now contain the SVC stack for this core */ +omap_cont_boot: b secondary_startup ENDPROC(omap_secondary_startup) ENTRY(omap_secondary_startup_4460) -hold_2: ldr r12,=0x103 + ldr r12,=0x103 dsb smc #0 @ read from AuxCoreBoot0 mov r0, r0, lsr #9 mrc p15, 0, r4, c0, c0, 5 and r4, r4, #0x0f cmp r0, r4 - bne hold_2 + beq omap4460_cont_boot + + bl omap_cpu1_off + b omap_secondary_startup_4460 +omap4460_cont_boot: /* * GIC distributor control register has changed between * CortexA9 r1pX and r2pX. The Control Register secure -- 1.7.4.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: t-kristo@ti.com (Tero Kristo) Date: Fri, 20 Apr 2012 12:33:50 +0300 Subject: [PATCH 17/19] ARM: OMAP4: put cpu1 back to sleep if no wake request In-Reply-To: <1334914432-26456-1-git-send-email-t-kristo@ti.com> References: <1334914432-26456-1-git-send-email-t-kristo@ti.com> Message-ID: <1334914432-26456-18-git-send-email-t-kristo@ti.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org If AUX_CORE_BOOT0 does not indicate wakeup request for cpu1, put it back to off. This is needed during wakeup from device off to prevent cpu1 from being stuck indefinitely in the wakeup loop and also to prevent wakeup problem on GP chips with device off mode. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/omap-headsmp.S | 45 ++++++++++++++++++++++++++++++++--- 1 files changed, 41 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S index d602555..59c6578 100644 --- a/arch/arm/mach-omap2/omap-headsmp.S +++ b/arch/arm/mach-omap2/omap-headsmp.S @@ -17,8 +17,37 @@ #include #include +#include +#include "prcm_mpu44xx.h" + +#define CPU1_PWRSTCTRL (OMAP4430_PRCM_MPU_BASE + OMAP4430_PRCM_MPU_CPU1_INST + \ + OMAP4_PM_CPU1_PWRSTCTRL_OFFSET) __CPUINIT + +ENTRY(omap_cpu1_off) + ldr r12, =CPU1_PWRSTCTRL + ldr r0, [r12] + and r0, #3 + cmp r0, #2 + beq exit_cpu1_off + + mov r0, #0x3 + mov r1, #0x0 + ldr r12, =OMAP4_MON_SCU_PWR_INDEX + dsb + smc #0 + + isb + dsb + dmb + wfi + nop + nop +exit_cpu1_off: + mov pc, lr +ENDPROC(omap_cpu1_off) + /* * OMAP4 specific entry point for secondary CPU to jump from ROM * code. This routine also provides a holding flag into which @@ -27,32 +56,40 @@ * register AuxCoreBoot0. */ ENTRY(omap_secondary_startup) -hold: ldr r12,=0x103 + ldr r12,=0x103 dsb smc #0 @ read from AuxCoreBoot0 mov r0, r0, lsr #9 mrc p15, 0, r4, c0, c0, 5 and r4, r4, #0x0f cmp r0, r4 - bne hold + beq omap_cont_boot + + bl omap_cpu1_off + b omap_secondary_startup /* * we've been released from the wait loop,secondary_stack * should now contain the SVC stack for this core */ +omap_cont_boot: b secondary_startup ENDPROC(omap_secondary_startup) ENTRY(omap_secondary_startup_4460) -hold_2: ldr r12,=0x103 + ldr r12,=0x103 dsb smc #0 @ read from AuxCoreBoot0 mov r0, r0, lsr #9 mrc p15, 0, r4, c0, c0, 5 and r4, r4, #0x0f cmp r0, r4 - bne hold_2 + beq omap4460_cont_boot + + bl omap_cpu1_off + b omap_secondary_startup_4460 +omap4460_cont_boot: /* * GIC distributor control register has changed between * CortexA9 r1pX and r2pX. The Control Register secure -- 1.7.4.1