From: Kristoffer E. <kri...@gm...> - 2007-05-17 21:27:07
|
Greetings, Paul, not sure how much comments are wanted or needed. I believe the pm code could use it though, since it takes alot of time going through the hardware manuals to see whats being done. patch_text_short: Trivial patch, adding comments and correcting include/var names. patch_txt_long This patch adds some comments in the hp6xx power managment code. Its quite needed in order to understand what its trying to do (or if needing to bugtrack it). Also changed STBCR, STBCR2 to the more correct names of sh7709_STBCR... to better comply with the naming scheme. linux/apm.h is replaced with linux/apm-emulation.h signed-off-by: Kristoffer Ericson <kri...@gm...> diff --git a/arch/sh/boards/hp6xx/pm.c b/arch/sh/boards/hp6xx/pm.c index 8143d1b..3c8c086 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 sh7709_STBCR 0xffffff82 /* STBCR (Standby control register) */ +#define sh7709_STBCR2 0xffffff88 /* STBCR2 (Standby control register 2) */ +/* 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,45 @@ static int hp6x0_pm_enter(suspend_state_t state) #endif #ifdef CONFIG_HD64461_ENABLER - outb(0, HD64461_PCC1CSCIER); + outb(0, HD64461_PCC1CSCIER); /* Turn off all channel 1 interrupts */ - scr = inb(HD64461_PCC1SCR); - scr |= HD64461_PCCSCR_VCC1; - outb(scr, HD64461_PCC1SCR); + scr = inb(HD64461_PCC1SCR); /* Channel 1 (PCMCIA) - card Status Change */ + scr |= HD64461_PCCSCR_VCC1; /* Channel 1 voltage pin */ + outb(scr, HD64461_PCC1SCR); /* Low level power to channel 1 */ - hd64461_stbcr = inw(HD64461_STBCR); - hd64461_stbcr |= HD64461_STBCR_SPC1ST; - outw(hd64461_stbcr, HD64461_STBCR); + hd64461_stbcr = inw(HD64461_STBCR); /* Save current hd64461 standby control register */ + hd64461_stbcr |= HD64461_STBCR_SPC1ST; /* Stop clocksupply to channel 1 */ + outw(hd64461_stbcr, HD64461_STBCR); /* Send it out */ #endif ctrl_outb(0x1f, DACR); - stbcr = ctrl_inb(STBCR); - ctrl_outb(0x01, STBCR); + /* Save current state and halt clocksupply to SCI */ + stbcr = ctrl_inb(sh7709_STBCR); + ctrl_outb(0x01, sh7709_STBCR); - stbcr2 = ctrl_inb(STBCR2); - ctrl_outb(0x7f , STBCR2); + /* Save current state and drop all clocksupply */ + stbcr2 = ctrl_inb(sh7709_STBCR2); + ctrl_outb(0x7f , sh7709_STBCR2); + /* Enable all data buses */ 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); + ctrl_outb(stbcr, sh7709_STBCR); + ctrl_outb(stbcr2, sh7709_STBCR2); #ifdef CONFIG_HD64461_ENABLER + /* Lets activate our channel 1 again */ hd64461_stbcr = inw(HD64461_STBCR); hd64461_stbcr &= ~HD64461_STBCR_SPC1ST; outw(hd64461_stbcr, HD64461_STBCR); + /* turn on all interrupts on channel 1 again */ outb(0x4c, HD64461_PCC1CSCIER); outb(0x00, HD64461_PCC1CSCR); #endif |