pm-imx27.c 983 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * i.MX27 Power Management Routines
  3. *
  4. * Based on Freescale's BSP
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License.
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/suspend.h>
  11. #include <linux/io.h>
  12. #include <mach/hardware.h>
  13. static int mx27_suspend_enter(suspend_state_t state)
  14. {
  15. u32 cscr;
  16. switch (state) {
  17. case PM_SUSPEND_MEM:
  18. /* Clear MPEN and SPEN to disable MPLL/SPLL */
  19. cscr = __raw_readl(MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
  20. cscr &= 0xFFFFFFFC;
  21. __raw_writel(cscr, MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
  22. /* Executes WFI */
  23. cpu_do_idle();
  24. break;
  25. default:
  26. return -EINVAL;
  27. }
  28. return 0;
  29. }
  30. static const struct platform_suspend_ops mx27_suspend_ops = {
  31. .enter = mx27_suspend_enter,
  32. .valid = suspend_valid_only_mem,
  33. };
  34. static int __init mx27_pm_init(void)
  35. {
  36. if (!cpu_is_mx27())
  37. return 0;
  38. suspend_set_ops(&mx27_suspend_ops);
  39. return 0;
  40. }
  41. device_initcall(mx27_pm_init);