Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/clock-pxa2xx.c |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | */ |
| 8 | |
| 9 | #include <linux/module.h> |
| 10 | #include <linux/kernel.h> |
| 11 | #include <linux/init.h> |
Rob Herring | 23019a7 | 2012-03-20 14:33:19 -0500 | [diff] [blame] | 12 | #include <linux/io.h> |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 13 | #include <linux/syscore_ops.h> |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 14 | |
| 15 | #include <mach/pxa2xx-regs.h> |
| 16 | |
| 17 | #include "clock.h" |
| 18 | |
| 19 | void clk_pxa2xx_cken_enable(struct clk *clk) |
| 20 | { |
| 21 | CKEN |= 1 << clk->cken; |
| 22 | } |
| 23 | |
| 24 | void clk_pxa2xx_cken_disable(struct clk *clk) |
| 25 | { |
| 26 | CKEN &= ~(1 << clk->cken); |
| 27 | } |
| 28 | |
| 29 | const struct clkops clk_pxa2xx_cken_ops = { |
| 30 | .enable = clk_pxa2xx_cken_enable, |
| 31 | .disable = clk_pxa2xx_cken_disable, |
| 32 | }; |
Eric Miao | f113fe4 | 2010-11-23 17:00:03 +0800 | [diff] [blame] | 33 | |
| 34 | #ifdef CONFIG_PM |
| 35 | static uint32_t saved_cken; |
| 36 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 37 | static int pxa2xx_clock_suspend(void) |
Eric Miao | f113fe4 | 2010-11-23 17:00:03 +0800 | [diff] [blame] | 38 | { |
| 39 | saved_cken = CKEN; |
| 40 | return 0; |
| 41 | } |
| 42 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 43 | static void pxa2xx_clock_resume(void) |
Eric Miao | f113fe4 | 2010-11-23 17:00:03 +0800 | [diff] [blame] | 44 | { |
| 45 | CKEN = saved_cken; |
Eric Miao | f113fe4 | 2010-11-23 17:00:03 +0800 | [diff] [blame] | 46 | } |
| 47 | #else |
| 48 | #define pxa2xx_clock_suspend NULL |
| 49 | #define pxa2xx_clock_resume NULL |
| 50 | #endif |
| 51 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 52 | struct syscore_ops pxa2xx_clock_syscore_ops = { |
Eric Miao | f113fe4 | 2010-11-23 17:00:03 +0800 | [diff] [blame] | 53 | .suspend = pxa2xx_clock_suspend, |
| 54 | .resume = pxa2xx_clock_resume, |
| 55 | }; |