diff options
Diffstat (limited to 'arch/arm/mach-pxa/clock.c')
| -rw-r--r-- | arch/arm/mach-pxa/clock.c | 105 |
1 files changed, 19 insertions, 86 deletions
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c index df5ae2710ab..4d466102a02 100644 --- a/arch/arm/mach-pxa/clock.c +++ b/arch/arm/mach-pxa/clock.c @@ -3,58 +3,15 @@ */ #include <linux/module.h> #include <linux/kernel.h> -#include <linux/list.h> -#include <linux/errno.h> -#include <linux/err.h> -#include <linux/string.h> #include <linux/clk.h> #include <linux/spinlock.h> -#include <linux/platform_device.h> #include <linux/delay.h> +#include <linux/clkdev.h> -#include <asm/arch/pxa-regs.h> -#include <asm/hardware.h> - -#include "devices.h" -#include "generic.h" #include "clock.h" -static LIST_HEAD(clocks); -static DEFINE_MUTEX(clocks_mutex); static DEFINE_SPINLOCK(clocks_lock); -static struct clk *clk_lookup(struct device *dev, const char *id) -{ - struct clk *p; - - list_for_each_entry(p, &clocks, node) - if (strcmp(id, p->name) == 0 && p->dev == dev) - return p; - - return NULL; -} - -struct clk *clk_get(struct device *dev, const char *id) -{ - struct clk *p, *clk = ERR_PTR(-ENOENT); - - mutex_lock(&clocks_mutex); - p = clk_lookup(dev, id); - if (!p) - p = clk_lookup(NULL, id); - if (p) - clk = p; - mutex_unlock(&clocks_mutex); - - return clk; -} -EXPORT_SYMBOL(clk_get); - -void clk_put(struct clk *clk) -{ -} -EXPORT_SYMBOL(clk_put); - int clk_enable(struct clk *clk) { unsigned long flags; @@ -96,58 +53,34 @@ unsigned long clk_get_rate(struct clk *clk) } EXPORT_SYMBOL(clk_get_rate); - -static void clk_gpio27_enable(struct clk *clk) +int clk_set_rate(struct clk *clk, unsigned long rate) { - pxa_gpio_mode(GPIO11_3_6MHz_MD); -} - -static void clk_gpio27_disable(struct clk *clk) -{ -} + unsigned long flags; + int ret = -EINVAL; -static const struct clkops clk_gpio27_ops = { - .enable = clk_gpio27_enable, - .disable = clk_gpio27_disable, -}; + if (clk->ops->setrate) { + spin_lock_irqsave(&clocks_lock, flags); + ret = clk->ops->setrate(clk, rate); + spin_unlock_irqrestore(&clocks_lock, flags); + } + return ret; +} +EXPORT_SYMBOL(clk_set_rate); -void clk_cken_enable(struct clk *clk) +void clk_dummy_enable(struct clk *clk) { - CKEN |= 1 << clk->cken; } -void clk_cken_disable(struct clk *clk) +void clk_dummy_disable(struct clk *clk) { - CKEN &= ~(1 << clk->cken); } -const struct clkops clk_cken_ops = { - .enable = clk_cken_enable, - .disable = clk_cken_disable, +const struct clkops clk_dummy_ops = { + .enable = clk_dummy_enable, + .disable = clk_dummy_disable, }; -static struct clk common_clks[] = { - { - .name = "GPIO27_CLK", - .ops = &clk_gpio27_ops, - .rate = 3686400, - }, +struct clk clk_dummy = { + .ops = &clk_dummy_ops, }; - -void clks_register(struct clk *clks, size_t num) -{ - int i; - - mutex_lock(&clocks_mutex); - for (i = 0; i < num; i++) - list_add(&clks[i].node, &clocks); - mutex_unlock(&clocks_mutex); -} - -static int __init clk_init(void) -{ - clks_register(common_clks, ARRAY_SIZE(common_clks)); - return 0; -} -arch_initcall(clk_init); |
