17 #include <linux/errno.h>
19 #include <linux/serial_core.h>
22 #include <asm/cacheflush.h>
23 #include <asm/suspend.h>
24 #include <mach/hardware.h>
28 #include <mach/regs-clock.h>
29 #include <mach/regs-irq.h>
33 #include <mach/pm-core.h>
45 #ifdef CONFIG_SAMSUNG_PM_DEBUG
46 extern void printascii(
const char *);
48 void s3c_pm_dbg(
const char *
fmt, ...)
63 s3c_pm_debug_init_uart();
67 #define s3c_pm_debug_init() do { } while(0)
75 #ifdef CONFIG_SAMSUNG_PM_DEBUG
77 static struct pm_uart_save uart_save[CONFIG_SERIAL_SAMSUNG_UARTS];
92 S3C_PMDBG(
"UART[%d]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n",
96 static void s3c_pm_save_uarts(
void)
101 for (uart = 0; uart < CONFIG_SERIAL_SAMSUNG_UARTS; uart++, save++)
102 s3c_pm_save_uart(uart, save);
105 static void s3c_pm_restore_uart(
unsigned int uart,
struct pm_uart_save *save)
109 s3c_pm_arch_update_uart(regs, save);
121 static void s3c_pm_restore_uarts(
void)
126 for (uart = 0; uart < CONFIG_SERIAL_SAMSUNG_UARTS; uart++, save++)
127 s3c_pm_restore_uart(uart, save);
130 static void s3c_pm_save_uarts(
void) { }
131 static void s3c_pm_restore_uarts(
void) { }
148 state ?
"enabled" :
"disabled", data->
irq);
151 s3c_irqwake_eintmask |=
bit;
153 s3c_irqwake_eintmask &= ~bit;
170 for (; count > 0; count--, ptr++) {
189 for (; count > 0; count--, ptr++) {
210 for (; count > 0; count--, ptr++)
226 for (i = 0; i <= 31; i++) {
227 if (which & (1L<<i)) {
228 S3C_PMDBG(
"IRQ %d asserted at resume\n", start+i);
237 #define any_allowed(mask, allow) (((mask) & (allow)) != (allow))
272 samsung_pm_saved_gpios();
280 S3C_PMDBG(
"sleep: irq wakeup masks: %08lx,%08lx\n",
281 s3c_irqwake_intmask, s3c_irqwake_eintmask);
283 s3c_pm_arch_prepare_irqs();
297 s3c_pm_arch_stop_clocks();
308 s3c_pm_restore_uarts();
310 s3c_pm_restored_gpios();
316 s3c_pm_arch_show_resume_irqs();
318 S3C_PMDBG(
"%s: post sleep, preparing to return\n", __func__);
321 s3c_pm_debug_smdkled(1 << 1, 0);
327 S3C_PMDBG(
"S3C PM Resume (post-restore)\n");
331 static int s3c_pm_prepare(
void)
339 static void s3c_pm_finish(
void)
345 .enter = s3c_pm_enter,
346 .prepare = s3c_pm_prepare,
347 .finish = s3c_pm_finish,
360 printk(
"S3C Power Management, Copyright 2004 Simtec Electronics\n");