sh: move the hp6xx pm code
Move the not-so-generic pm code from arch/sh/kernel/pm.c to the platform directory together with the rest of the hp6xx pm code. This is done to let non-hp6xx platforms enable CONFIG_PM. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:

zatwierdzone przez
Paul Mundt

rodzic
04645185d0
commit
3e51762759
@@ -10,15 +10,91 @@
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/hd64461.h>
|
||||
#include <mach/hp6xx.h>
|
||||
#include <cpu/dac.h>
|
||||
#include <asm/pm.h>
|
||||
#include <asm/freq.h>
|
||||
#include <asm/watchdog.h>
|
||||
|
||||
#define INTR_OFFSET 0x600
|
||||
|
||||
#define STBCR 0xffffff82
|
||||
#define STBCR2 0xffffff88
|
||||
|
||||
#define STBCR_STBY 0x80
|
||||
#define STBCR_MSTP2 0x04
|
||||
|
||||
#define MCR 0xffffff68
|
||||
#define RTCNT 0xffffff70
|
||||
|
||||
#define MCR_RMODE 2
|
||||
#define MCR_RFSH 4
|
||||
|
||||
extern u8 wakeup_start;
|
||||
extern u8 wakeup_end;
|
||||
|
||||
static void pm_enter(void)
|
||||
{
|
||||
u8 stbcr, csr;
|
||||
u16 frqcr, mcr;
|
||||
u32 vbr_new, vbr_old;
|
||||
|
||||
set_bl_bit();
|
||||
|
||||
/* set wdt */
|
||||
csr = sh_wdt_read_csr();
|
||||
csr &= ~WTCSR_TME;
|
||||
csr |= WTCSR_CKS_4096;
|
||||
sh_wdt_write_csr(csr);
|
||||
csr = sh_wdt_read_csr();
|
||||
sh_wdt_write_cnt(0);
|
||||
|
||||
/* disable PLL1 */
|
||||
frqcr = ctrl_inw(FRQCR);
|
||||
frqcr &= ~(FRQCR_PLLEN | FRQCR_PSTBY);
|
||||
ctrl_outw(frqcr, FRQCR);
|
||||
|
||||
/* enable standby */
|
||||
stbcr = ctrl_inb(STBCR);
|
||||
ctrl_outb(stbcr | STBCR_STBY | STBCR_MSTP2, STBCR);
|
||||
|
||||
/* set self-refresh */
|
||||
mcr = ctrl_inw(MCR);
|
||||
ctrl_outw(mcr & ~MCR_RFSH, MCR);
|
||||
|
||||
/* set interrupt handler */
|
||||
asm volatile("stc vbr, %0" : "=r" (vbr_old));
|
||||
vbr_new = get_zeroed_page(GFP_ATOMIC);
|
||||
udelay(50);
|
||||
memcpy((void*)(vbr_new + INTR_OFFSET),
|
||||
&wakeup_start, &wakeup_end - &wakeup_start);
|
||||
asm volatile("ldc %0, vbr" : : "r" (vbr_new));
|
||||
|
||||
ctrl_outw(0, RTCNT);
|
||||
ctrl_outw(mcr | MCR_RFSH | MCR_RMODE, MCR);
|
||||
|
||||
cpu_sleep();
|
||||
|
||||
asm volatile("ldc %0, vbr" : : "r" (vbr_old));
|
||||
|
||||
free_page(vbr_new);
|
||||
|
||||
/* enable PLL1 */
|
||||
frqcr = ctrl_inw(FRQCR);
|
||||
frqcr |= FRQCR_PSTBY;
|
||||
ctrl_outw(frqcr, FRQCR);
|
||||
udelay(50);
|
||||
frqcr |= FRQCR_PLLEN;
|
||||
ctrl_outw(frqcr, FRQCR);
|
||||
|
||||
ctrl_outb(stbcr, STBCR);
|
||||
|
||||
clear_bl_bit();
|
||||
}
|
||||
|
||||
static int hp6x0_pm_enter(suspend_state_t state)
|
||||
{
|
||||
u8 stbcr, stbcr2;
|
||||
|
Reference in New Issue
Block a user