0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/of_address.h>
0011 #include <linux/kernel.h>
0012 #include <linux/suspend.h>
0013 #include <linux/io.h>
0014
0015 #include "common.h"
0016 #include "hardware.h"
0017
0018 static int mx27_suspend_enter(suspend_state_t state)
0019 {
0020 void __iomem *ccm_base;
0021 struct device_node *np;
0022 u32 cscr;
0023
0024 np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm");
0025 ccm_base = of_iomap(np, 0);
0026 BUG_ON(!ccm_base);
0027
0028 switch (state) {
0029 case PM_SUSPEND_MEM:
0030
0031 cscr = imx_readl(ccm_base);
0032 cscr &= 0xFFFFFFFC;
0033 imx_writel(cscr, ccm_base);
0034
0035 cpu_do_idle();
0036 break;
0037
0038 default:
0039 return -EINVAL;
0040 }
0041 return 0;
0042 }
0043
0044 static const struct platform_suspend_ops mx27_suspend_ops = {
0045 .enter = mx27_suspend_enter,
0046 .valid = suspend_valid_only_mem,
0047 };
0048
0049 void __init imx27_pm_init(void)
0050 {
0051 suspend_set_ops(&mx27_suspend_ops);
0052 }