pm-imx27.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/of_address.h>
  10. #include <linux/kernel.h>
  11. #include <linux/suspend.h>
  12. #include <linux/io.h>
  13. #include "common.h"
  14. #include "hardware.h"
  15. static int mx27_suspend_enter(suspend_state_t state)
  16. {
  17. void __iomem *ccm_base;
  18. struct device_node *np;
  19. u32 cscr;
  20. np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm");
  21. ccm_base = of_iomap(np, 0);
  22. BUG_ON(!ccm_base);
  23. switch (state) {
  24. case PM_SUSPEND_MEM:
  25. /* Clear MPEN and SPEN to disable MPLL/SPLL */
  26. cscr = imx_readl(ccm_base);
  27. cscr &= 0xFFFFFFFC;
  28. imx_writel(cscr, ccm_base);
  29. /* Executes WFI */
  30. cpu_do_idle();
  31. break;
  32. default:
  33. return -EINVAL;
  34. }
  35. return 0;
  36. }
  37. static const struct platform_suspend_ops mx27_suspend_ops = {
  38. .enter = mx27_suspend_enter,
  39. .valid = suspend_valid_only_mem,
  40. };
  41. void __init imx27_pm_init(void)
  42. {
  43. suspend_set_ops(&mx27_suspend_ops);
  44. }