aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/hp6xx/pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/hp6xx/pm.c')
-rw-r--r--arch/sh/boards/hp6xx/pm.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/arch/sh/boards/hp6xx/pm.c b/arch/sh/boards/hp6xx/pm.c
index d22f6eac9ccabb..6a2112aeb7c041 100644
--- a/arch/sh/boards/hp6xx/pm.c
+++ b/arch/sh/boards/hp6xx/pm.c
@@ -10,14 +10,25 @@
#include <linux/suspend.h>
#include <linux/errno.h>
#include <linux/time.h>
+#include <linux/apm-emulation.h>
#include <asm/io.h>
#include <asm/hd64461.h>
#include <asm/hp6xx.h>
#include <asm/cpu/dac.h>
#include <asm/pm.h>
-#define STBCR 0xffffff82
-#define STBCR2 0xffffff88
+#define STBCR 0xffffff82 /* STBCR (Standby control register) SH7709A */
+#define STBCR2 0xffffff88 /* STBCR2 (Standby control register 2) SH7709A */
+/* 1 = true, 0 = false
+ bit 0 - Clock supply to SCI1 (IRDA) halted
+ bit 1 - Clock supply to SCI2 (SCIF) halted
+ bit 2 - Clock supply to ADC halted and all registers initialized
+ bit 3 - Clock supply to DAC halted
+ bit 4 - Clock supply to DMAC halted
+ bit 5 - Clock supply to UBC is halted
+ bit 6 - Pins MD5 to MD0 are changed in standby mode
+ bit 7 - Reserved
+*/
static int hp6x0_pm_enter(suspend_state_t state)
{
@@ -28,38 +39,48 @@ static int hp6x0_pm_enter(suspend_state_t state)
#endif
#ifdef CONFIG_HD64461_ENABLER
+ /* disable all CF interrupts */
outb(0, HD64461_PCC1CSCIER);
-
scr = inb(HD64461_PCC1SCR);
scr |= HD64461_PCCSCR_VCC1;
outb(scr, HD64461_PCC1SCR);
+ /* get standby status of all devices */
hd64461_stbcr = inw(HD64461_STBCR);
+ /* add standby mode to CF slot */
hd64461_stbcr |= HD64461_STBCR_SPC1ST;
outw(hd64461_stbcr, HD64461_STBCR);
#endif
- ctrl_outb(0x1f, DACR);
+ /* chan 0/1 D/A conversion and DA 0/1 output are enabled */
+ outb(0x1f, DACR);
- stbcr = ctrl_inb(STBCR);
- ctrl_outb(0x01, STBCR);
+ /* halt clocksupply to SCI */
+ stbcr = inb(STBCR);
+ outb(0x01, STBCR);
- stbcr2 = ctrl_inb(STBCR2);
- ctrl_outb(0x7f , STBCR2);
+ /* state and drop all clocksupply */
+ stbcr2 = inb(STBCR2);
+ outb(0x7f , STBCR2);
+ /* allow IO Ports D + C, disallow A + B */
outw(0xf07f, HD64461_SCPUCR);
+ /* Zzzzz */
pm_enter();
+ /* wakeup, Lets restore the old values */
outw(0, HD64461_SCPUCR);
- ctrl_outb(stbcr, STBCR);
- ctrl_outb(stbcr2, STBCR2);
+ outb(stbcr, STBCR);
+ outb(stbcr2, STBCR2);
#ifdef CONFIG_HD64461_ENABLER
+ /* get standby status of all devices */
hd64461_stbcr = inw(HD64461_STBCR);
+ /* remove standby mode for CF slot */
hd64461_stbcr &= ~HD64461_STBCR_SPC1ST;
outw(hd64461_stbcr, HD64461_STBCR);
-
+ /* turn on CF interrupt again */
outb(0x4c, HD64461_PCC1CSCIER);
outb(0x00, HD64461_PCC1CSCR);
#endif