pm.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /* linux/arch/arm/mach-s3c2410/pm.c
  2. *
  3. * Copyright (c) 2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * S3C2410 Power Manager (Suspend-To-RAM) support
  7. *
  8. * See Documentation/arm/Samsung-S3C24XX/Suspend.txt for more information
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. * Parts based on arch/arm/mach-pxa/pm.c
  25. *
  26. * Thanks to Dimitry Andric for debugging
  27. *
  28. * Modifications:
  29. * 10-Mar-2005 LCVR Changed S3C2410_VA_UART to S3C24XX_VA_UART
  30. */
  31. #include <linux/config.h>
  32. #include <linux/init.h>
  33. #include <linux/suspend.h>
  34. #include <linux/errno.h>
  35. #include <linux/time.h>
  36. #include <linux/interrupt.h>
  37. #include <linux/crc32.h>
  38. #include <linux/ioport.h>
  39. #include <linux/delay.h>
  40. #include <asm/hardware.h>
  41. #include <asm/io.h>
  42. #include <asm/arch/regs-serial.h>
  43. #include <asm/arch/regs-clock.h>
  44. #include <asm/arch/regs-gpio.h>
  45. #include <asm/arch/regs-mem.h>
  46. #include <asm/arch/regs-irq.h>
  47. #include <asm/mach/time.h>
  48. #include "pm.h"
  49. /* for external use */
  50. unsigned long s3c_pm_flags;
  51. /* cache functions from arch/arm/mm/proc-arm920.S */
  52. #ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
  53. extern void arm920_flush_kern_cache_all(void);
  54. #else
  55. static void arm920_flush_kern_cache_all(void) { }
  56. #endif
  57. #define PFX "s3c24xx-pm: "
  58. static struct sleep_save core_save[] = {
  59. SAVE_ITEM(S3C2410_LOCKTIME),
  60. SAVE_ITEM(S3C2410_CLKCON),
  61. /* we restore the timings here, with the proviso that the board
  62. * brings the system up in an slower, or equal frequency setting
  63. * to the original system.
  64. *
  65. * if we cannot guarantee this, then things are going to go very
  66. * wrong here, as we modify the refresh and both pll settings.
  67. */
  68. SAVE_ITEM(S3C2410_BWSCON),
  69. SAVE_ITEM(S3C2410_BANKCON0),
  70. SAVE_ITEM(S3C2410_BANKCON1),
  71. SAVE_ITEM(S3C2410_BANKCON2),
  72. SAVE_ITEM(S3C2410_BANKCON3),
  73. SAVE_ITEM(S3C2410_BANKCON4),
  74. SAVE_ITEM(S3C2410_BANKCON5),
  75. SAVE_ITEM(S3C2410_CLKDIVN),
  76. SAVE_ITEM(S3C2410_MPLLCON),
  77. SAVE_ITEM(S3C2410_UPLLCON),
  78. SAVE_ITEM(S3C2410_CLKSLOW),
  79. SAVE_ITEM(S3C2410_REFRESH),
  80. };
  81. /* this lot should be really saved by the IRQ code */
  82. static struct sleep_save irq_save[] = {
  83. SAVE_ITEM(S3C2410_EXTINT0),
  84. SAVE_ITEM(S3C2410_EXTINT1),
  85. SAVE_ITEM(S3C2410_EXTINT2),
  86. SAVE_ITEM(S3C2410_EINFLT0),
  87. SAVE_ITEM(S3C2410_EINFLT1),
  88. SAVE_ITEM(S3C2410_EINFLT2),
  89. SAVE_ITEM(S3C2410_EINFLT3),
  90. SAVE_ITEM(S3C2410_EINTMASK),
  91. SAVE_ITEM(S3C2410_INTMSK)
  92. };
  93. static struct sleep_save gpio_save[] = {
  94. SAVE_ITEM(S3C2410_GPACON),
  95. SAVE_ITEM(S3C2410_GPADAT),
  96. SAVE_ITEM(S3C2410_GPBCON),
  97. SAVE_ITEM(S3C2410_GPBDAT),
  98. SAVE_ITEM(S3C2410_GPBUP),
  99. SAVE_ITEM(S3C2410_GPCCON),
  100. SAVE_ITEM(S3C2410_GPCDAT),
  101. SAVE_ITEM(S3C2410_GPCUP),
  102. SAVE_ITEM(S3C2410_GPDCON),
  103. SAVE_ITEM(S3C2410_GPDDAT),
  104. SAVE_ITEM(S3C2410_GPDUP),
  105. SAVE_ITEM(S3C2410_GPECON),
  106. SAVE_ITEM(S3C2410_GPEDAT),
  107. SAVE_ITEM(S3C2410_GPEUP),
  108. SAVE_ITEM(S3C2410_GPFCON),
  109. SAVE_ITEM(S3C2410_GPFDAT),
  110. SAVE_ITEM(S3C2410_GPFUP),
  111. SAVE_ITEM(S3C2410_GPGCON),
  112. SAVE_ITEM(S3C2410_GPGDAT),
  113. SAVE_ITEM(S3C2410_GPGUP),
  114. SAVE_ITEM(S3C2410_GPHCON),
  115. SAVE_ITEM(S3C2410_GPHDAT),
  116. SAVE_ITEM(S3C2410_GPHUP),
  117. SAVE_ITEM(S3C2410_DCLKCON),
  118. };
  119. #ifdef CONFIG_S3C2410_PM_DEBUG
  120. #define SAVE_UART(va) \
  121. SAVE_ITEM((va) + S3C2410_ULCON), \
  122. SAVE_ITEM((va) + S3C2410_UCON), \
  123. SAVE_ITEM((va) + S3C2410_UFCON), \
  124. SAVE_ITEM((va) + S3C2410_UMCON), \
  125. SAVE_ITEM((va) + S3C2410_UBRDIV)
  126. static struct sleep_save uart_save[] = {
  127. SAVE_UART(S3C24XX_VA_UART0),
  128. SAVE_UART(S3C24XX_VA_UART1),
  129. #ifndef CONFIG_CPU_S3C2400
  130. SAVE_UART(S3C24XX_VA_UART2),
  131. #endif
  132. };
  133. /* debug
  134. *
  135. * we send the debug to printascii() to allow it to be seen if the
  136. * system never wakes up from the sleep
  137. */
  138. extern void printascii(const char *);
  139. static void pm_dbg(const char *fmt, ...)
  140. {
  141. va_list va;
  142. char buff[256];
  143. va_start(va, fmt);
  144. vsprintf(buff, fmt, va);
  145. va_end(va);
  146. printascii(buff);
  147. }
  148. static void s3c2410_pm_debug_init(void)
  149. {
  150. unsigned long tmp = __raw_readl(S3C2410_CLKCON);
  151. /* re-start uart clocks */
  152. tmp |= S3C2410_CLKCON_UART0;
  153. tmp |= S3C2410_CLKCON_UART1;
  154. tmp |= S3C2410_CLKCON_UART2;
  155. __raw_writel(tmp, S3C2410_CLKCON);
  156. udelay(10);
  157. }
  158. #define DBG(fmt...) pm_dbg(fmt)
  159. #else
  160. #define DBG(fmt...) printk(KERN_DEBUG fmt)
  161. #define s3c2410_pm_debug_init() do { } while(0)
  162. static struct sleep_save uart_save[] = {};
  163. #endif
  164. #if defined(CONFIG_S3C2410_PM_CHECK) && CONFIG_S3C2410_PM_CHECK_CHUNKSIZE != 0
  165. /* suspend checking code...
  166. *
  167. * this next area does a set of crc checks over all the installed
  168. * memory, so the system can verify if the resume was ok.
  169. *
  170. * CONFIG_S3C2410_PM_CHECK_CHUNKSIZE defines the block-size for the CRC,
  171. * increasing it will mean that the area corrupted will be less easy to spot,
  172. * and reducing the size will cause the CRC save area to grow
  173. */
  174. #define CHECK_CHUNKSIZE (CONFIG_S3C2410_PM_CHECK_CHUNKSIZE * 1024)
  175. static u32 crc_size; /* size needed for the crc block */
  176. static u32 *crcs; /* allocated over suspend/resume */
  177. typedef u32 *(run_fn_t)(struct resource *ptr, u32 *arg);
  178. /* s3c2410_pm_run_res
  179. *
  180. * go thorugh the given resource list, and look for system ram
  181. */
  182. static void s3c2410_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)
  183. {
  184. while (ptr != NULL) {
  185. if (ptr->child != NULL)
  186. s3c2410_pm_run_res(ptr->child, fn, arg);
  187. if ((ptr->flags & IORESOURCE_MEM) &&
  188. strcmp(ptr->name, "System RAM") == 0) {
  189. DBG("Found system RAM at %08lx..%08lx\n",
  190. ptr->start, ptr->end);
  191. arg = (fn)(ptr, arg);
  192. }
  193. ptr = ptr->sibling;
  194. }
  195. }
  196. static void s3c2410_pm_run_sysram(run_fn_t fn, u32 *arg)
  197. {
  198. s3c2410_pm_run_res(&iomem_resource, fn, arg);
  199. }
  200. static u32 *s3c2410_pm_countram(struct resource *res, u32 *val)
  201. {
  202. u32 size = (u32)(res->end - res->start)+1;
  203. size += CHECK_CHUNKSIZE-1;
  204. size /= CHECK_CHUNKSIZE;
  205. DBG("Area %08lx..%08lx, %d blocks\n", res->start, res->end, size);
  206. *val += size * sizeof(u32);
  207. return val;
  208. }
  209. /* s3c2410_pm_prepare_check
  210. *
  211. * prepare the necessary information for creating the CRCs. This
  212. * must be done before the final save, as it will require memory
  213. * allocating, and thus touching bits of the kernel we do not
  214. * know about.
  215. */
  216. static void s3c2410_pm_check_prepare(void)
  217. {
  218. crc_size = 0;
  219. s3c2410_pm_run_sysram(s3c2410_pm_countram, &crc_size);
  220. DBG("s3c2410_pm_prepare_check: %u checks needed\n", crc_size);
  221. crcs = kmalloc(crc_size+4, GFP_KERNEL);
  222. if (crcs == NULL)
  223. printk(KERN_ERR "Cannot allocated CRC save area\n");
  224. }
  225. static u32 *s3c2410_pm_makecheck(struct resource *res, u32 *val)
  226. {
  227. unsigned long addr, left;
  228. for (addr = res->start; addr < res->end;
  229. addr += CHECK_CHUNKSIZE) {
  230. left = res->end - addr;
  231. if (left > CHECK_CHUNKSIZE)
  232. left = CHECK_CHUNKSIZE;
  233. *val = crc32_le(~0, phys_to_virt(addr), left);
  234. val++;
  235. }
  236. return val;
  237. }
  238. /* s3c2410_pm_check_store
  239. *
  240. * compute the CRC values for the memory blocks before the final
  241. * sleep.
  242. */
  243. static void s3c2410_pm_check_store(void)
  244. {
  245. if (crcs != NULL)
  246. s3c2410_pm_run_sysram(s3c2410_pm_makecheck, crcs);
  247. }
  248. /* in_region
  249. *
  250. * return TRUE if the area defined by ptr..ptr+size contatins the
  251. * what..what+whatsz
  252. */
  253. static inline int in_region(void *ptr, int size, void *what, size_t whatsz)
  254. {
  255. if ((what+whatsz) < ptr)
  256. return 0;
  257. if (what > (ptr+size))
  258. return 0;
  259. return 1;
  260. }
  261. static u32 *s3c2410_pm_runcheck(struct resource *res, u32 *val)
  262. {
  263. void *save_at = phys_to_virt(s3c2410_sleep_save_phys);
  264. unsigned long addr;
  265. unsigned long left;
  266. void *ptr;
  267. u32 calc;
  268. for (addr = res->start; addr < res->end;
  269. addr += CHECK_CHUNKSIZE) {
  270. left = res->end - addr;
  271. if (left > CHECK_CHUNKSIZE)
  272. left = CHECK_CHUNKSIZE;
  273. ptr = phys_to_virt(addr);
  274. if (in_region(ptr, left, crcs, crc_size)) {
  275. DBG("skipping %08lx, has crc block in\n", addr);
  276. goto skip_check;
  277. }
  278. if (in_region(ptr, left, save_at, 32*4 )) {
  279. DBG("skipping %08lx, has save block in\n", addr);
  280. goto skip_check;
  281. }
  282. /* calculate and check the checksum */
  283. calc = crc32_le(~0, ptr, left);
  284. if (calc != *val) {
  285. printk(KERN_ERR PFX "Restore CRC error at "
  286. "%08lx (%08x vs %08x)\n", addr, calc, *val);
  287. DBG("Restore CRC error at %08lx (%08x vs %08x)\n",
  288. addr, calc, *val);
  289. }
  290. skip_check:
  291. val++;
  292. }
  293. return val;
  294. }
  295. /* s3c2410_pm_check_restore
  296. *
  297. * check the CRCs after the restore event and free the memory used
  298. * to hold them
  299. */
  300. static void s3c2410_pm_check_restore(void)
  301. {
  302. if (crcs != NULL) {
  303. s3c2410_pm_run_sysram(s3c2410_pm_runcheck, crcs);
  304. kfree(crcs);
  305. crcs = NULL;
  306. }
  307. }
  308. #else
  309. #define s3c2410_pm_check_prepare() do { } while(0)
  310. #define s3c2410_pm_check_restore() do { } while(0)
  311. #define s3c2410_pm_check_store() do { } while(0)
  312. #endif
  313. /* helper functions to save and restore register state */
  314. void s3c2410_pm_do_save(struct sleep_save *ptr, int count)
  315. {
  316. for (; count > 0; count--, ptr++) {
  317. ptr->val = __raw_readl(ptr->reg);
  318. DBG("saved %p value %08lx\n", ptr->reg, ptr->val);
  319. }
  320. }
  321. /* s3c2410_pm_do_restore
  322. *
  323. * restore the system from the given list of saved registers
  324. *
  325. * Note, we do not use DBG() in here, as the system may not have
  326. * restore the UARTs state yet
  327. */
  328. void s3c2410_pm_do_restore(struct sleep_save *ptr, int count)
  329. {
  330. for (; count > 0; count--, ptr++) {
  331. printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n",
  332. ptr->reg, ptr->val, __raw_readl(ptr->reg));
  333. __raw_writel(ptr->val, ptr->reg);
  334. }
  335. }
  336. /* s3c2410_pm_do_restore_core
  337. *
  338. * similar to s3c2410_pm_do_restore_core
  339. *
  340. * WARNING: Do not put any debug in here that may effect memory or use
  341. * peripherals, as things may be changing!
  342. */
  343. static void s3c2410_pm_do_restore_core(struct sleep_save *ptr, int count)
  344. {
  345. for (; count > 0; count--, ptr++) {
  346. __raw_writel(ptr->val, ptr->reg);
  347. }
  348. }
  349. /* s3c2410_pm_show_resume_irqs
  350. *
  351. * print any IRQs asserted at resume time (ie, we woke from)
  352. */
  353. static void s3c2410_pm_show_resume_irqs(int start, unsigned long which,
  354. unsigned long mask)
  355. {
  356. int i;
  357. which &= ~mask;
  358. for (i = 0; i <= 31; i++) {
  359. if ((which) & (1L<<i)) {
  360. DBG("IRQ %d asserted at resume\n", start+i);
  361. }
  362. }
  363. }
  364. /* s3c2410_pm_check_resume_pin
  365. *
  366. * check to see if the pin is configured correctly for sleep mode, and
  367. * make any necessary adjustments if it is not
  368. */
  369. static void s3c2410_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
  370. {
  371. unsigned long irqstate;
  372. unsigned long pinstate;
  373. int irq = s3c2410_gpio_getirq(pin);
  374. if (irqoffs < 4)
  375. irqstate = s3c_irqwake_intmask & (1L<<irqoffs);
  376. else
  377. irqstate = s3c_irqwake_eintmask & (1L<<irqoffs);
  378. pinstate = s3c2410_gpio_getcfg(pin);
  379. pinstate >>= S3C2410_GPIO_OFFSET(pin)*2;
  380. if (!irqstate) {
  381. if (pinstate == 0x02)
  382. DBG("Leaving IRQ %d (pin %d) enabled\n", irq, pin);
  383. } else {
  384. if (pinstate == 0x02) {
  385. DBG("Disabling IRQ %d (pin %d)\n", irq, pin);
  386. s3c2410_gpio_cfgpin(pin, 0x00);
  387. }
  388. }
  389. }
  390. /* s3c2410_pm_configure_extint
  391. *
  392. * configure all external interrupt pins
  393. */
  394. static void s3c2410_pm_configure_extint(void)
  395. {
  396. int pin;
  397. /* for each of the external interrupts (EINT0..EINT15) we
  398. * need to check wether it is an external interrupt source,
  399. * and then configure it as an input if it is not
  400. */
  401. for (pin = S3C2410_GPF0; pin <= S3C2410_GPF7; pin++) {
  402. s3c2410_pm_check_resume_pin(pin, pin - S3C2410_GPF0);
  403. }
  404. for (pin = S3C2410_GPG0; pin <= S3C2410_GPG7; pin++) {
  405. s3c2410_pm_check_resume_pin(pin, (pin - S3C2410_GPG0)+8);
  406. }
  407. }
  408. #define any_allowed(mask, allow) (((mask) & (allow)) != (allow))
  409. /* s3c2410_pm_enter
  410. *
  411. * central control for sleep/resume process
  412. */
  413. static int s3c2410_pm_enter(suspend_state_t state)
  414. {
  415. unsigned long regs_save[16];
  416. unsigned long tmp;
  417. /* ensure the debug is initialised (if enabled) */
  418. s3c2410_pm_debug_init();
  419. DBG("s3c2410_pm_enter(%d)\n", state);
  420. if (state != PM_SUSPEND_MEM) {
  421. printk(KERN_ERR PFX "error: only PM_SUSPEND_MEM supported\n");
  422. return -EINVAL;
  423. }
  424. /* check if we have anything to wake-up with... bad things seem
  425. * to happen if you suspend with no wakeup (system will often
  426. * require a full power-cycle)
  427. */
  428. if (!any_allowed(s3c_irqwake_intmask, s3c_irqwake_intallow) &&
  429. !any_allowed(s3c_irqwake_eintmask, s3c_irqwake_eintallow)) {
  430. printk(KERN_ERR PFX "No sources enabled for wake-up!\n");
  431. printk(KERN_ERR PFX "Aborting sleep\n");
  432. return -EINVAL;
  433. }
  434. /* prepare check area if configured */
  435. s3c2410_pm_check_prepare();
  436. /* store the physical address of the register recovery block */
  437. s3c2410_sleep_save_phys = virt_to_phys(regs_save);
  438. DBG("s3c2410_sleep_save_phys=0x%08lx\n", s3c2410_sleep_save_phys);
  439. /* ensure at least GESTATUS3 has the resume address */
  440. __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2410_GSTATUS3);
  441. DBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
  442. DBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
  443. /* save all necessary core registers not covered by the drivers */
  444. s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save));
  445. s3c2410_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
  446. s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save));
  447. s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save));
  448. /* set the irq configuration for wake */
  449. s3c2410_pm_configure_extint();
  450. DBG("sleep: irq wakeup masks: %08lx,%08lx\n",
  451. s3c_irqwake_intmask, s3c_irqwake_eintmask);
  452. __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK);
  453. __raw_writel(s3c_irqwake_eintmask, S3C2410_EINTMASK);
  454. /* ack any outstanding external interrupts before we go to sleep */
  455. __raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND);
  456. /* flush cache back to ram */
  457. arm920_flush_kern_cache_all();
  458. s3c2410_pm_check_store();
  459. /* send the cpu to sleep... */
  460. __raw_writel(0x00, S3C2410_CLKCON); /* turn off clocks over sleep */
  461. s3c2410_cpu_suspend(regs_save);
  462. /* restore the cpu state */
  463. cpu_init();
  464. /* unset the return-from-sleep flag, to ensure reset */
  465. tmp = __raw_readl(S3C2410_GSTATUS2);
  466. tmp &= S3C2410_GSTATUS2_OFFRESET;
  467. __raw_writel(tmp, S3C2410_GSTATUS2);
  468. /* restore the system state */
  469. s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
  470. s3c2410_pm_do_restore(gpio_save, ARRAY_SIZE(gpio_save));
  471. s3c2410_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
  472. s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save));
  473. s3c2410_pm_debug_init();
  474. /* check what irq (if any) restored the system */
  475. DBG("post sleep: IRQs 0x%08x, 0x%08x\n",
  476. __raw_readl(S3C2410_SRCPND),
  477. __raw_readl(S3C2410_EINTPEND));
  478. s3c2410_pm_show_resume_irqs(IRQ_EINT0, __raw_readl(S3C2410_SRCPND),
  479. s3c_irqwake_intmask);
  480. s3c2410_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND),
  481. s3c_irqwake_eintmask);
  482. DBG("post sleep, preparing to return\n");
  483. s3c2410_pm_check_restore();
  484. /* ok, let's return from sleep */
  485. DBG("S3C2410 PM Resume (post-restore)\n");
  486. return 0;
  487. }
  488. /*
  489. * Called after processes are frozen, but before we shut down devices.
  490. */
  491. static int s3c2410_pm_prepare(suspend_state_t state)
  492. {
  493. return 0;
  494. }
  495. /*
  496. * Called after devices are re-setup, but before processes are thawed.
  497. */
  498. static int s3c2410_pm_finish(suspend_state_t state)
  499. {
  500. return 0;
  501. }
  502. /*
  503. * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
  504. */
  505. static struct pm_ops s3c2410_pm_ops = {
  506. .pm_disk_mode = PM_DISK_FIRMWARE,
  507. .prepare = s3c2410_pm_prepare,
  508. .enter = s3c2410_pm_enter,
  509. .finish = s3c2410_pm_finish,
  510. };
  511. /* s3c2410_pm_init
  512. *
  513. * Attach the power management functions. This should be called
  514. * from the board specific initialisation if the board supports
  515. * it.
  516. */
  517. int __init s3c2410_pm_init(void)
  518. {
  519. printk("S3C2410 Power Management, (c) 2004 Simtec Electronics\n");
  520. pm_set_ops(&s3c2410_pm_ops);
  521. return 0;
  522. }