2 #include <linux/clkdev.h>
4 #include <linux/init.h>
5 #include <linux/kernel.h>
6 #include <linux/module.h>
8 #include <mach/board.h>
12 #define RATE_FIXED (1 << 1) /* Fixed clock rate */
13 #define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */
14 #define IS_PD (1 << 2) /* Power Domain */
16 #define MHZ (1000*1000)
20 struct list_head node;
23 struct list_head children;
24 struct list_head sibling; /* node for children */
27 int (*mode)(struct clk *clk, int on);
28 unsigned long (*recalc)(struct clk *); /* if null, follow parent */
29 int (*set_rate)(struct clk *, unsigned long);
30 long (*round_rate)(struct clk *, unsigned long);
31 struct clk* (*get_parent)(struct clk *); /* get clk's parent from the hardware. default is clksel_get_parent if parents present */
32 int (*set_parent)(struct clk *, struct clk *); /* default is clksel_set_parent if parents present */
41 u8 clksel_parent_mask;
42 u8 clksel_parent_shift;
46 static struct clk xin24m = {
52 #define CLK(dev, con, ck) \
59 static struct clk_lookup clks[] = {
60 CLK("rk30_i2c.0", "i2c", &xin24m),
61 CLK("rk30_i2c.1", "i2c", &xin24m),
62 CLK("rk30_i2c.2", "i2c", &xin24m),
63 CLK("rk30_i2c.3", "i2c", &xin24m),
64 CLK("rk30_i2c.4", "i2c", &xin24m),
65 CLK("rk29xx_spim.0", "spi", &xin24m),
66 CLK("rk29xx_spim.1", "spi", &xin24m),
69 void __init rk30_clock_init(void)
71 struct clk_lookup *lk;
73 for (lk = clks; lk < clks + ARRAY_SIZE(clks); lk++) {
78 int clk_enable(struct clk *clk)
82 if (clk == NULL || IS_ERR(clk))
87 EXPORT_SYMBOL(clk_enable);
89 void clk_disable(struct clk *clk)
91 if (clk == NULL || IS_ERR(clk))
94 EXPORT_SYMBOL(clk_disable);
96 unsigned long clk_get_rate(struct clk *clk)
100 EXPORT_SYMBOL(clk_get_rate);
102 int clk_set_rate(struct clk *clk, unsigned long rate)
106 if (clk == NULL || IS_ERR(clk))
111 EXPORT_SYMBOL(clk_set_rate);