Skip to content

Commit

Permalink
[ARM] pxa: Allow platforms to override PSPR setting
Browse files Browse the repository at this point in the history
Currently, we set PSPR just before entering sleep mode.  However,
some platforms have different requirements for setting PSPR in
order to properly wake up.

Set PSPR earlier in the suspend cycle so that platforms can
change the setting by using a sysdev driver instead.

Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King authored and Russell King committed Sep 9, 2008
1 parent 63bef54 commit 4104980
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
2 changes: 2 additions & 0 deletions arch/arm/mach-pxa/include/mach/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct pxa_cpu_pm_fns {
void (*restore)(unsigned long *);
int (*valid)(suspend_state_t state);
void (*enter)(suspend_state_t state);
int (*prepare)(void);
void (*finish)(void);
};

extern struct pxa_cpu_pm_fns *pxa_cpu_pm_fns;
Expand Down
18 changes: 18 additions & 0 deletions arch/arm/mach-pxa/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,27 @@ static int pxa_pm_valid(suspend_state_t state)
return -EINVAL;
}

static int pxa_pm_prepare(void)
{
int ret = 0;

if (pxa_cpu_pm_fns && pxa_cpu_pm_fns->prepare)
ret = pxa_cpu_pm_fns->prepare();

return ret;
}

static void pxa_pm_finish(void)
{
if (pxa_cpu_pm_fns && pxa_cpu_pm_fns->finish)
pxa_cpu_pm_fns->finish();
}

static struct platform_suspend_ops pxa_pm_ops = {
.valid = pxa_pm_valid,
.enter = pxa_pm_enter,
.prepare = pxa_pm_prepare,
.finish = pxa_pm_finish,
};

static int __init pxa_pm_init(void)
Expand Down
20 changes: 15 additions & 5 deletions arch/arm/mach-pxa/pxa25x.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,6 @@ static void pxa25x_cpu_pm_save(unsigned long *sleep_save)

static void pxa25x_cpu_pm_restore(unsigned long *sleep_save)
{
/* ensure not to come back here if it wasn't intended */
PSPR = 0;

/* restore registers */
RESTORE(GAFR0_L); RESTORE(GAFR0_U);
RESTORE(GAFR1_L); RESTORE(GAFR1_U);
Expand All @@ -256,19 +253,32 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)

switch (state) {
case PM_SUSPEND_MEM:
/* set resume return address */
PSPR = virt_to_phys(pxa_cpu_resume);
pxa25x_cpu_suspend(PWRMODE_SLEEP);
break;
}
}

static int pxa25x_cpu_pm_prepare(void)
{
/* set resume return address */
PSPR = virt_to_phys(pxa_cpu_resume);
return 0;
}

static void pxa25x_cpu_pm_finish(void)
{
/* ensure not to come back here if it wasn't intended */
PSPR = 0;
}

static struct pxa_cpu_pm_fns pxa25x_cpu_pm_fns = {
.save_count = SLEEP_SAVE_COUNT,
.valid = suspend_valid_only_mem,
.save = pxa25x_cpu_pm_save,
.restore = pxa25x_cpu_pm_restore,
.enter = pxa25x_cpu_pm_enter,
.prepare = pxa25x_cpu_pm_prepare,
.finish = pxa25x_cpu_pm_finish,
};

static void __init pxa25x_init_pm(void)
Expand Down
20 changes: 15 additions & 5 deletions arch/arm/mach-pxa/pxa27x.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ void pxa27x_cpu_pm_save(unsigned long *sleep_save)

void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
{
/* ensure not to come back here if it wasn't intended */
PSPR = 0;

/* restore registers */
RESTORE(GAFR0_L); RESTORE(GAFR0_U);
RESTORE(GAFR1_L); RESTORE(GAFR1_U);
Expand Down Expand Up @@ -259,8 +256,6 @@ void pxa27x_cpu_pm_enter(suspend_state_t state)
pxa_cpu_standby();
break;
case PM_SUSPEND_MEM:
/* set resume return address */
PSPR = virt_to_phys(pxa_cpu_resume);
pxa27x_cpu_suspend(PWRMODE_SLEEP);
break;
}
Expand All @@ -271,12 +266,27 @@ static int pxa27x_cpu_pm_valid(suspend_state_t state)
return state == PM_SUSPEND_MEM || state == PM_SUSPEND_STANDBY;
}

static int pxa27x_cpu_pm_prepare(void)
{
/* set resume return address */
PSPR = virt_to_phys(pxa_cpu_resume);
return 0;
}

static void pxa27x_cpu_pm_finish(void)
{
/* ensure not to come back here if it wasn't intended */
PSPR = 0;
}

static struct pxa_cpu_pm_fns pxa27x_cpu_pm_fns = {
.save_count = SLEEP_SAVE_COUNT,
.save = pxa27x_cpu_pm_save,
.restore = pxa27x_cpu_pm_restore,
.valid = pxa27x_cpu_pm_valid,
.enter = pxa27x_cpu_pm_enter,
.prepare = pxa27x_cpu_pm_prepare,
.finish = pxa27x_cpu_pm_finish,
};

static void __init pxa27x_init_pm(void)
Expand Down

0 comments on commit 4104980

Please sign in to comment.