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> |
Eric Miao | f113fe4 | 2010-11-23 17:00:03 +0800 | [diff] [blame] | 12 | #include <linux/sysdev.h> |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 13 | |
| 14 | #include <mach/pxa2xx-regs.h> |
| 15 | |
| 16 | #include "clock.h" |
| 17 | |
| 18 | void clk_pxa2xx_cken_enable(struct clk *clk) |
| 19 | { |
| 20 | CKEN |= 1 << clk->cken; |
| 21 | } |
| 22 | |
| 23 | void clk_pxa2xx_cken_disable(struct clk *clk) |
| 24 | { |
| 25 | CKEN &= ~(1 << clk->cken); |
| 26 | } |
| 27 | |
| 28 | const struct clkops clk_pxa2xx_cken_ops = { |
| 29 | .enable = clk_pxa2xx_cken_enable, |
| 30 | .disable = clk_pxa2xx_cken_disable, |
| 31 | }; |
Eric Miao | f113fe4 | 2010-11-23 17:00:03 +0800 | [diff] [blame] | 32 | |
| 33 | #ifdef CONFIG_PM |
| 34 | static uint32_t saved_cken; |
| 35 | |
| 36 | static int pxa2xx_clock_suspend(struct sys_device *d, pm_message_t state) |
| 37 | { |
| 38 | saved_cken = CKEN; |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | static int pxa2xx_clock_resume(struct sys_device *d) |
| 43 | { |
| 44 | CKEN = saved_cken; |
| 45 | return 0; |
| 46 | } |
| 47 | #else |
| 48 | #define pxa2xx_clock_suspend NULL |
| 49 | #define pxa2xx_clock_resume NULL |
| 50 | #endif |
| 51 | |
| 52 | struct sysdev_class pxa2xx_clock_sysclass = { |
| 53 | .name = "pxa2xx-clock", |
| 54 | .suspend = pxa2xx_clock_suspend, |
| 55 | .resume = pxa2xx_clock_resume, |
| 56 | }; |
Eric Miao | aae8224 | 2010-11-23 17:07:48 +0800 | [diff] [blame] | 57 | |
| 58 | static int __init pxa2xx_clock_init(void) |
| 59 | { |
| 60 | if (cpu_is_pxa2xx()) |
| 61 | return sysdev_class_register(&pxa2xx_clock_sysclass); |
| 62 | return 0; |
| 63 | } |
| 64 | postcore_initcall(pxa2xx_clock_init); |