[ARM] pxa: update defconfig for Verdex Pro
[linux-2.6/verdex.git] / arch / arm / mach-pxa / clock.c
blob49ae38292310c2b1058c433f7e2a16fbe378756f
1 /*
2 * linux/arch/arm/mach-sa1100/clock.c
3 */
4 #include <linux/module.h>
5 #include <linux/kernel.h>
6 #include <linux/list.h>
7 #include <linux/errno.h>
8 #include <linux/err.h>
9 #include <linux/string.h>
10 #include <linux/clk.h>
11 #include <linux/spinlock.h>
12 #include <linux/platform_device.h>
13 #include <linux/delay.h>
15 #include <asm/clkdev.h>
16 #include <mach/pxa2xx-regs.h>
17 #include <mach/hardware.h>
19 #include "devices.h"
20 #include "generic.h"
21 #include "clock.h"
23 static DEFINE_SPINLOCK(clocks_lock);
25 int clk_enable(struct clk *clk)
27 unsigned long flags;
29 spin_lock_irqsave(&clocks_lock, flags);
30 if (clk->enabled++ == 0)
31 clk->ops->enable(clk);
32 spin_unlock_irqrestore(&clocks_lock, flags);
34 if (clk->delay)
35 udelay(clk->delay);
37 return 0;
39 EXPORT_SYMBOL(clk_enable);
41 void clk_disable(struct clk *clk)
43 unsigned long flags;
45 WARN_ON(clk->enabled == 0);
47 spin_lock_irqsave(&clocks_lock, flags);
48 if (--clk->enabled == 0)
49 clk->ops->disable(clk);
50 spin_unlock_irqrestore(&clocks_lock, flags);
52 EXPORT_SYMBOL(clk_disable);
54 unsigned long clk_get_rate(struct clk *clk)
56 unsigned long rate;
58 rate = clk->rate;
59 if (clk->ops->getrate)
60 rate = clk->ops->getrate(clk);
62 return rate;
64 EXPORT_SYMBOL(clk_get_rate);
67 void clk_cken_enable(struct clk *clk)
69 CKEN |= 1 << clk->cken;
72 void clk_cken_disable(struct clk *clk)
74 CKEN &= ~(1 << clk->cken);
77 const struct clkops clk_cken_ops = {
78 .enable = clk_cken_enable,
79 .disable = clk_cken_disable,
82 void clks_register(struct clk_lookup *clks, size_t num)
84 int i;
86 for (i = 0; i < num; i++)
87 clkdev_add(&clks[i]);