static int sa11x0_pm_enter(suspend_state_t state) { unsigned long gpio, sleep_save[SLEEP_SAVE_COUNT]; gpio = GPLR; SAVE(GPDR); SAVE(GAFR); SAVE(PPDR); SAVE(PPSR); SAVE(PPAR); SAVE(PSDR); SAVE(Ser1SDCR0); RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR; PSPR = virt_to_phys(sa1100_cpu_resume); sa1100_cpu_suspend(); cpu_init(); PSPR = 0; ICLR = 0; ICCR = 1; ICMR = 0; RESTORE(GPDR); RESTORE(GAFR); RESTORE(PPDR); RESTORE(PPSR); RESTORE(PPAR); RESTORE(PSDR); RESTORE(Ser1SDCR0); GPSR = gpio; GPCR = ~gpio; PSSR = PSSR_PH; return 0; }
static int sa11x0_pm_enter(suspend_state_t state) { unsigned long gpio, sleep_save[SLEEP_SAVE_SIZE]; struct timespec delta, rtc; /* preserve current time */ rtc.tv_sec = RCNR; rtc.tv_nsec = 0; save_time_delta(&delta, &rtc); gpio = GPLR; /* save vital registers */ SAVE(GPDR); SAVE(GAFR); SAVE(PPDR); SAVE(PPSR); SAVE(PPAR); SAVE(PSDR); SAVE(Ser1SDCR0); /* Clear previous reset status */ RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR; /* set resume return address */ PSPR = virt_to_phys(sa1100_cpu_resume); /* go zzz */ sa1100_cpu_suspend(); cpu_init(); /* * Ensure not to come back here if it wasn't intended */ PSPR = 0; /* * Ensure interrupt sources are disabled; we will re-init * the interrupt subsystem via the device manager. */ ICLR = 0; ICCR = 1; ICMR = 0; /* restore registers */ RESTORE(GPDR); RESTORE(GAFR); RESTORE(PPDR); RESTORE(PPSR); RESTORE(PPAR); RESTORE(PSDR); RESTORE(Ser1SDCR0); GPSR = gpio; GPCR = ~gpio; /* * Clear the peripheral sleep-hold bit. */ PSSR = PSSR_PH; /* restore current time */ rtc.tv_sec = RCNR; restore_time_delta(&delta, &rtc); return 0; }
static int sa11x0_pm_enter(suspend_state_t state) { unsigned long gpio, sleep_save[SLEEP_SAVE_COUNT]; gpio = GPLR; /* save vital registers */ SAVE(GPDR); SAVE(GAFR); SAVE(PPDR); SAVE(PPSR); SAVE(PPAR); SAVE(PSDR); SAVE(Ser1SDCR0); /* Clear previous reset status */ RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR; /* set resume return address */ PSPR = virt_to_phys(cpu_resume); /* go zzz */ sa1100_cpu_suspend(PLAT_PHYS_OFFSET - PAGE_OFFSET); cpu_init(); /* * Ensure not to come back here if it wasn't intended */ PSPR = 0; /* * Ensure interrupt sources are disabled; we will re-init * the interrupt subsystem via the device manager. */ ICLR = 0; ICCR = 1; ICMR = 0; /* restore registers */ RESTORE(GPDR); RESTORE(GAFR); RESTORE(PPDR); RESTORE(PPSR); RESTORE(PPAR); RESTORE(PSDR); RESTORE(Ser1SDCR0); GPSR = gpio; GPCR = ~gpio; /* * Clear the peripheral sleep-hold bit. */ PSSR = PSSR_PH; return 0; }
int pm_do_suspend(void) { unsigned long sleep_save[SLEEP_SAVE_SIZE]; cli(); leds_event(led_stop); /* preserve current time */ RCNR = xtime.tv_sec; /* save vital registers */ SAVE(OSCR); SAVE(OSMR0); SAVE(OSMR1); SAVE(OSMR2); SAVE(OSMR3); SAVE(OIER); SAVE(GPDR); SAVE(GRER); SAVE(GFER); SAVE(GAFR); SAVE(PPDR); SAVE(PPSR); SAVE(PPAR); SAVE(PSDR); SAVE(Ser1SDCR0); SAVE(ICMR); /* ... maybe a global variable initialized by arch code to set this? */ GRER = PWER; GFER = 0; GEDR = GEDR; /* Clear previous reset status */ RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR; /* set resume return address */ PSPR = virt_to_phys(sa1100_cpu_resume); /* go zzz */ sa1100_cpu_suspend(); /* ensure not to come back here if it wasn't intended */ PSPR = 0; #ifdef DEBUG printk(KERN_DEBUG "*** made it back from resume\n"); #endif /* restore registers */ RESTORE(GPDR); RESTORE(GRER); RESTORE(GFER); RESTORE(GAFR); /* clear any edge detect bit */ GEDR = GEDR; RESTORE(PPDR); RESTORE(PPSR); RESTORE(PPAR); RESTORE(PSDR); RESTORE(Ser1SDCR0); PSSR = PSSR_PH; RESTORE(OSMR0); RESTORE(OSMR1); RESTORE(OSMR2); RESTORE(OSMR3); RESTORE(OSCR); RESTORE(OIER); ICLR = 0; ICCR = 1; RESTORE(ICMR); /* restore current time */ xtime.tv_sec = RCNR; leds_event(led_start); sti(); /* * Restore the CPU frequency settings. */ #ifdef CONFIG_CPU_FREQ cpufreq_restore(); #endif return 0; }