4 #include <linux/list.h>
5 #include <linux/seq_file.h>
6 #include <linux/cpufreq.h>
13 void (*init
)(struct clk
*clk
);
14 int (*enable
)(struct clk
*clk
);
15 void (*disable
)(struct clk
*clk
);
16 unsigned long (*recalc
)(struct clk
*clk
);
17 int (*set_rate
)(struct clk
*clk
, unsigned long rate
, int algo_id
);
18 int (*set_parent
)(struct clk
*clk
, struct clk
*parent
);
19 long (*round_rate
)(struct clk
*clk
, unsigned long rate
);
23 struct list_head node
;
28 struct clk
**parent_table
; /* list of parents to */
29 unsigned short parent_num
; /* choose between */
30 unsigned char src_shift
; /* source clock field in the */
31 unsigned char src_width
; /* configuration register */
34 struct list_head children
;
35 struct list_head sibling
; /* node for children */
42 void __iomem
*enable_reg
;
43 unsigned int enable_bit
;
45 unsigned long arch_flags
;
47 struct dentry
*dentry
;
48 struct cpufreq_frequency_table
*freq_table
;
51 #define CLK_ENABLE_ON_INIT (1 << 0)
53 /* drivers/sh/clk.c */
54 unsigned long followparent_recalc(struct clk
*);
55 void recalculate_root_clocks(void);
56 void propagate_rate(struct clk
*);
57 int clk_reparent(struct clk
*child
, struct clk
*parent
);
58 int clk_register(struct clk
*);
59 void clk_unregister(struct clk
*);
60 void clk_enable_init_clocks(void);
63 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
65 * @rate: desired clock rate in Hz
66 * @algo_id: algorithm id to be passed down to ops->set_rate
68 * Returns success (0) or negative errno.
70 int clk_set_rate_ex(struct clk
*clk
, unsigned long rate
, int algo_id
);
92 struct clk_div_mult_table
{
93 unsigned int *divisors
;
94 unsigned int nr_divisors
;
95 unsigned int *multipliers
;
96 unsigned int nr_multipliers
;
99 struct cpufreq_frequency_table
;
100 void clk_rate_table_build(struct clk
*clk
,
101 struct cpufreq_frequency_table
*freq_table
,
103 struct clk_div_mult_table
*src_table
,
104 unsigned long *bitmap
);
106 long clk_rate_table_round(struct clk
*clk
,
107 struct cpufreq_frequency_table
*freq_table
,
110 int clk_rate_table_find(struct clk
*clk
,
111 struct cpufreq_frequency_table
*freq_table
,
114 #define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \
117 .enable_reg = (void __iomem *)_enable_reg, \
118 .enable_bit = _enable_bit, \
122 int sh_clk_mstp32_register(struct clk
*clks
, int nr
);
124 #define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
127 .enable_reg = (void __iomem *)_reg, \
128 .enable_bit = _shift, \
129 .arch_flags = _div_bitmap, \
133 struct clk_div4_table
{
134 struct clk_div_mult_table
*div_mult_table
;
135 void (*kick
)(struct clk
*clk
);
138 int sh_clk_div4_register(struct clk
*clks
, int nr
,
139 struct clk_div4_table
*table
);
140 int sh_clk_div4_enable_register(struct clk
*clks
, int nr
,
141 struct clk_div4_table
*table
);
142 int sh_clk_div4_reparent_register(struct clk
*clks
, int nr
,
143 struct clk_div4_table
*table
);
145 #define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \
146 _num_parents, _src_shift, _src_width) \
149 .enable_reg = (void __iomem *)_reg, \
151 .parent_table = _parents, \
152 .parent_num = _num_parents, \
153 .src_shift = _src_shift, \
154 .src_width = _src_width, \
157 #define SH_CLK_DIV6(_parent, _reg, _flags) \
158 SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0)
160 int sh_clk_div6_register(struct clk
*clks
, int nr
);
161 int sh_clk_div6_reparent_register(struct clk
*clks
, int nr
);
163 #endif /* __SH_CLOCK_H */