diff options
author | Olof Johansson <olof@lixom.net> | 2012-03-08 17:53:14 +0100 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-03-08 17:53:14 +0100 |
commit | d60d506e6baaf423148c458df3ece0c1d440dce4 (patch) | |
tree | c25c44e70ebaaddcbe39559df5c5cd260e956be4 /arch/arm/mach-s3c24xx/pm-s3c2416.c | |
parent | Merge branch 'next/cleanup-use-static' of git://git.kernel.org/pub/scm/linux/... (diff) | |
parent | ARM: S3C24XX: remove call to s3c24xx_setup_clocks (diff) | |
download | linux-d60d506e6baaf423148c458df3ece0c1d440dce4.tar.xz linux-d60d506e6baaf423148c458df3ece0c1d440dce4.zip |
Merge branch 'next/cleanup-s3c24xx' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/cleanup
* 'next/cleanup-s3c24xx' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung: (24 commits)
ARM: S3C24XX: remove call to s3c24xx_setup_clocks
ARM: S3C24XX: add get_rate for clk_p on S3C2416/2443
ARM: S3C24XX: add get_rate for clk_h on S3C2416/2443
ARM: S3C24XX: remove XXX_setup_clocks method from S3C2443
ARM: S3C24XX: remove obsolete S3C2416_DMA option
ARM: S3C24XX: Reuse S3C2443 dma for S3C2416
ARM: S3C24XX: Fix indentation of dma-s3c2443
ARM: S3C24XX: Move device setup files to mach directory
ARM: S3C24XX: Consolidate Simtec extensions
ARM: S3C24XX: move simtec-specific code to mach directory
ARM: S3C24XX: Move common-smdk code to mach directory
ARM: S3C24XX: Move s3c2443-clock.c to mach-s3c24xx
ARM: s3c2410_defconfig: update s3c2410_defconfig
ARM: S3C2443: move mach-s3c2443/* into mach-s3c24xx/
ARM: S3C2440: move mach-s3c2440/* into mach-s3c24xx/
ARM: S3C2416: move mach-s3c2416/* into mach-s3c24xx/
ARM: S3C2412: move mach-s3c2412/* into mach-s3c24xx/
ARM: S3C2410: move mach-s3c2410/* into mach-s3c24xx/
ARM: S3C24XX: change the ARCH_S3C2410 to ARCH_S3C24XX
ARM: S3C2410: move s3c2410_baseclk_add to clock.h
...
Diffstat (limited to 'arch/arm/mach-s3c24xx/pm-s3c2416.c')
-rw-r--r-- | arch/arm/mach-s3c24xx/pm-s3c2416.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2416.c b/arch/arm/mach-s3c24xx/pm-s3c2416.c new file mode 100644 index 000000000000..1bd4817b8eb8 --- /dev/null +++ b/arch/arm/mach-s3c24xx/pm-s3c2416.c @@ -0,0 +1,83 @@ +/* linux/arch/arm/mach-s3c2416/pm.c + * + * Copyright (c) 2010 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM support) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include <linux/device.h> +#include <linux/syscore_ops.h> +#include <linux/io.h> + +#include <asm/cacheflush.h> + +#include <mach/regs-power.h> +#include <mach/regs-s3c2443-clock.h> + +#include <plat/cpu.h> +#include <plat/pm.h> + +extern void s3c2412_sleep_enter(void); + +static int s3c2416_cpu_suspend(unsigned long arg) +{ + /* enable wakeup sources regardless of battery state */ + __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG); + + /* set the mode as sleep, 2BED represents "Go to BED" */ + __raw_writel(0x2BED, S3C2443_PWRMODE); + + s3c2412_sleep_enter(); + + panic("sleep resumed to originator?"); +} + +static void s3c2416_pm_prepare(void) +{ + /* + * write the magic value u-boot uses to check for resume into + * the INFORM0 register, and ensure INFORM1 is set to the + * correct address to resume from. + */ + __raw_writel(0x2BED, S3C2412_INFORM0); + __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); +} + +static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif) +{ + pm_cpu_prep = s3c2416_pm_prepare; + pm_cpu_sleep = s3c2416_cpu_suspend; + + return 0; +} + +static struct subsys_interface s3c2416_pm_interface = { + .name = "s3c2416_pm", + .subsys = &s3c2416_subsys, + .add_dev = s3c2416_pm_add, +}; + +static __init int s3c2416_pm_init(void) +{ + return subsys_interface_register(&s3c2416_pm_interface); +} + +arch_initcall(s3c2416_pm_init); + + +static void s3c2416_pm_resume(void) +{ + /* unset the return-from-sleep amd inform flags */ + __raw_writel(0x0, S3C2443_PWRMODE); + __raw_writel(0x0, S3C2412_INFORM0); + __raw_writel(0x0, S3C2412_INFORM1); +} + +struct syscore_ops s3c2416_pm_syscore_ops = { + .resume = s3c2416_pm_resume, +}; |