Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9503d21 authored by Russell King's avatar Russell King
Browse files

ARM: pm: pxa: move cpu_suspend into C code



We don't need a veneer for cpu_suspend, it can be called directly from
C code now.  Move it into the PXA CPU suspend functions, along with
the accumulator register saving/restoring.

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 372c0ac8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ struct pxa_cpu_pm_fns {
extern struct pxa_cpu_pm_fns *pxa_cpu_pm_fns;

/* sleep.S */
extern void pxa25x_cpu_suspend(unsigned int, long);
extern void pxa27x_cpu_suspend(unsigned int, long);
extern void pxa25x_finish_suspend(unsigned long);
extern void pxa27x_finish_suspend(unsigned long);

extern int pxa_pm_enter(suspend_state_t state);
extern int pxa_pm_prepare(void);
+2 −1
Original line number Diff line number Diff line
@@ -244,7 +244,8 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)

	switch (state) {
	case PM_SUSPEND_MEM:
		pxa25x_cpu_suspend(PWRMODE_SLEEP, PLAT_PHYS_OFFSET - PAGE_OFFSET);
		cpu_suspend(0, PHYS_OFFSET - PAGE_OFFSET, PWRMODE_SLEEP,
			    pxa25x_finish_suspend);
		break;
	}
}
+10 −1
Original line number Diff line number Diff line
@@ -284,6 +284,11 @@ void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
void pxa27x_cpu_pm_enter(suspend_state_t state)
{
	extern void pxa_cpu_standby(void);
#ifndef CONFIG_IWMMXT
	u64 acc0;

	asm volatile("mra %Q0, %R0, acc0" : "=r" (acc0));
#endif

	/* ensure voltage-change sequencer not initiated, which hangs */
	PCFR &= ~PCFR_FVC;
@@ -299,7 +304,11 @@ void pxa27x_cpu_pm_enter(suspend_state_t state)
		pxa_cpu_standby();
		break;
	case PM_SUSPEND_MEM:
		pxa27x_cpu_suspend(pwrmode, PLAT_PHYS_OFFSET - PAGE_OFFSET);
		cpu_suspend(0, PHYS_OFFSET - PAGE_OFFSET, pwrmode,
			    pxa27x_finish_suspend);
#ifndef CONFIG_IWMMXT
		asm volatile("mar acc0, %Q0, %R0" : "=r" (acc0));
#endif
		break;
	}
}
+11 −2
Original line number Diff line number Diff line
@@ -141,8 +141,13 @@ static void pxa3xx_cpu_pm_suspend(void)
{
	volatile unsigned long *p = (volatile void *)0xc0000000;
	unsigned long saved_data = *p;
#ifndef CONFIG_IWMMXT
	u64 acc0;

	extern void pxa3xx_cpu_suspend(long);
	asm volatile("mra %Q0, %R0, acc0" : "=r" (acc0));
#endif

	extern void pxa3xx_finish_suspend(unsigned long);

	/* resuming from D2 requires the HSIO2/BOOT/TPM clocks enabled */
	CKENA |= (1 << CKEN_BOOT) | (1 << CKEN_TPM);
@@ -162,11 +167,15 @@ static void pxa3xx_cpu_pm_suspend(void)
	/* overwrite with the resume address */
	*p = virt_to_phys(cpu_resume);

	pxa3xx_cpu_suspend(PLAT_PHYS_OFFSET - PAGE_OFFSET);
	cpu_suspend(0, PHYS_OFFSET - PAGE_OFFSET, 0, pxa3xx_finish_suspend);

	*p = saved_data;

	AD3ER = 0;

#ifndef CONFIG_IWMMXT
	asm volatile("mar acc0, %Q0, %R0" : "=r" (acc0));
#endif
}

static void pxa3xx_cpu_pm_enter(suspend_state_t state)
+6 −52
Original line number Diff line number Diff line
@@ -24,22 +24,9 @@

#ifdef CONFIG_PXA3xx
/*
 * pxa3xx_cpu_suspend() - forces CPU into sleep state (S2D3C4)
 *
 * r0 = v:p offset
 * pxa3xx_finish_suspend() - forces CPU into sleep state (S2D3C4)
 */
ENTRY(pxa3xx_cpu_suspend)

#ifndef CONFIG_IWMMXT
	mra	r2, r3, acc0
#endif
	stmfd	sp!, {r2 - r12, lr}	@ save registers on stack
	mov	r1, r0
	adr	r3, BSYM(pxa3xx_finish_suspend)
	bl	cpu_suspend
	b	pxa_cpu_resume

pxa3xx_finish_suspend:
ENTRY(pxa3xx_finish_suspend)
	mov	r0, #0x06		@ S2D3C4 mode
	mcr	p14, 0, r0, c7, c0, 0	@ enter sleep

@@ -48,25 +35,13 @@ pxa3xx_finish_suspend:

#ifdef CONFIG_PXA27x
/*
 * pxa27x_cpu_suspend()
 * pxa27x_finish_suspend()
 *
 * Forces CPU into sleep state.
 *
 * r0 = value for PWRMODE M field for desired sleep state
 * r1 = v:p offset
 */
ENTRY(pxa27x_cpu_suspend)

#ifndef CONFIG_IWMMXT
	mra	r2, r3, acc0
#endif
	stmfd	sp!, {r2 - r12, lr}		@ save registers on stack
	mov	r2, r0				@ save sleep mode
	adr	r3, BSYM(pxa27x_finish_suspend)
	bl	cpu_suspend
	b	pxa_cpu_resume

pxa27x_finish_suspend:
ENTRY(pxa27x_finish_suspend)
	@ Put the processor to sleep
	@ (also workaround for sighting 28071)

@@ -103,22 +78,14 @@ pxa27x_finish_suspend:

#ifdef CONFIG_PXA25x
/*
 * pxa25x_cpu_suspend()
 * pxa25x_finish_suspend()
 *
 * Forces CPU into sleep state.
 *
 * r0 = value for PWRMODE M field for desired sleep state
 * r1 = v:p offset
 */

ENTRY(pxa25x_cpu_suspend)
	stmfd	sp!, {r2 - r12, lr}		@ save registers on stack
	mov	r2, r0				@ save sleep mode
	adr	r3, BSYM(pxa25x_finish_suspend)
	bl	cpu_suspend
	b	pxa_cpu_resume

pxa25x_finish_suspend:
ENTRY(pxa25x_finish_suspend)
	@ prepare value for sleep mode
	mov	r1, r0				@ sleep mode

@@ -202,16 +169,3 @@ pxa_cpu_do_suspend:
	mcr	p14, 0, r1, c7, c0, 0		@ PWRMODE

20:	b	20b				@ loop waiting for sleep

/*
 * pxa_cpu_resume()
 *
 * entry point from bootloader into kernel during resume
 */
	.align 5
pxa_cpu_resume:
	ldmfd	sp!, {r2, r3}
#ifndef CONFIG_IWMMXT
	mar	acc0, r2, r3
#endif
	ldmfd	sp!, {r4 - r12, pc}		@ return to caller
Loading