0001
0002
0003
0004
0005
0006
0007 #include <linux/kernel.h>
0008 #include <linux/init.h>
0009 #include <linux/cpuidle.h>
0010 #include <linux/io.h>
0011 #include <linux/export.h>
0012 #include <linux/time.h>
0013
0014 #include <asm/cpuidle.h>
0015
0016 #include "cpu.h"
0017 #include "map.h"
0018
0019 #include "regs-sys-s3c64xx.h"
0020 #include "regs-syscon-power-s3c64xx.h"
0021
0022 static int s3c64xx_enter_idle(struct cpuidle_device *dev,
0023 struct cpuidle_driver *drv,
0024 int index)
0025 {
0026 unsigned long tmp;
0027
0028
0029 tmp = __raw_readl(S3C64XX_PWR_CFG);
0030 tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
0031 tmp |= S3C64XX_PWRCFG_CFG_WFI_IDLE;
0032 __raw_writel(tmp, S3C64XX_PWR_CFG);
0033
0034 cpu_do_idle();
0035
0036 return index;
0037 }
0038
0039 static struct cpuidle_driver s3c64xx_cpuidle_driver = {
0040 .name = "s3c64xx_cpuidle",
0041 .owner = THIS_MODULE,
0042 .states = {
0043 {
0044 .enter = s3c64xx_enter_idle,
0045 .exit_latency = 1,
0046 .target_residency = 1,
0047 .name = "IDLE",
0048 .desc = "System active, ARM gated",
0049 },
0050 },
0051 .state_count = 1,
0052 };
0053
0054 static int __init s3c64xx_init_cpuidle(void)
0055 {
0056 if (soc_is_s3c64xx())
0057 return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
0058 return 0;
0059 }
0060 device_initcall(s3c64xx_init_cpuidle);