aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-07-26 18:34:27 -0400
committerPaul Walmsley <paul@pwsan.com>2010-07-26 18:34:27 -0400
commitb3c1cff6985a78dcf2842960f866b07230ccef10 (patch)
treeab7d9bb670195814b9222951c8f02b6f57d0773f /arch/arm/plat-omap
parent25499d9353e8cc6b0cf205684b3ebc535f8b9372 (diff)
OMAP: clock: add kerneldoc for structures; move flags closer to structs
Add kerneldoc for struct clk, struct clksel_rate, struct clksel. Move flag macros for struct clk.flags and struct clksel_rate.flags closer to the structures. Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h130
1 files changed, 107 insertions, 23 deletions
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index dfc472ca0cc4..fef4696dcf67 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -19,6 +19,22 @@ struct module;
19struct clk; 19struct clk;
20struct clockdomain; 20struct clockdomain;
21 21
22/**
23 * struct clkops - some clock function pointers
24 * @enable: fn ptr that enables the current clock in hardware
25 * @disable: fn ptr that enables the current clock in hardware
26 * @find_idlest: function returning the IDLEST register for the clock's IP blk
27 * @find_companion: function returning the "companion" clk reg for the clock
28 *
29 * A "companion" clk is an accompanying clock to the one being queried
30 * that must be enabled for the IP module connected to the clock to
31 * become accessible by the hardware. Neither @find_idlest nor
32 * @find_companion should be needed; that information is IP
33 * block-specific; the hwmod code has been created to handle this, but
34 * until hwmod data is ready and drivers have been converted to use PM
35 * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
36 * @find_companion must, unfortunately, remain.
37 */
22struct clkops { 38struct clkops {
23 int (*enable)(struct clk *); 39 int (*enable)(struct clk *);
24 void (*disable)(struct clk *); 40 void (*disable)(struct clk *);
@@ -30,12 +46,45 @@ struct clkops {
30 46
31#ifdef CONFIG_ARCH_OMAP2PLUS 47#ifdef CONFIG_ARCH_OMAP2PLUS
32 48
49/* struct clksel_rate.flags possibilities */
50#define RATE_IN_242X (1 << 0)
51#define RATE_IN_243X (1 << 1)
52#define RATE_IN_3XXX (1 << 2) /* rates common to all OMAP3 */
53#define RATE_IN_3430ES2 (1 << 3) /* 3430ES2 rates only */
54#define RATE_IN_36XX (1 << 4)
55#define RATE_IN_4430 (1 << 5)
56
57#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
58#define RATE_IN_3430ES2PLUS (RATE_IN_3430ES2 | RATE_IN_36XX)
59
60/**
61 * struct clksel_rate - register bitfield values corresponding to clk divisors
62 * @val: register bitfield value (shifted to bit 0)
63 * @div: clock divisor corresponding to @val
64 * @flags: (see "struct clksel_rate.flags possibilities" above)
65 *
66 * @val should match the value of a read from struct clk.clksel_reg
67 * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
68 *
69 * @div is the divisor that should be applied to the parent clock's rate
70 * to produce the current clock's rate.
71 *
72 * XXX @flags probably should be replaced with an struct omap_chip.
73 */
33struct clksel_rate { 74struct clksel_rate {
34 u32 val; 75 u32 val;
35 u8 div; 76 u8 div;
36 u8 flags; 77 u8 flags;
37}; 78};
38 79
80/**
81 * struct clksel - available parent clocks, and a pointer to their divisors
82 * @parent: struct clk * to a possible parent clock
83 * @rates: available divisors for this parent clock
84 *
85 * A struct clksel is always associated with one or more struct clks
86 * and one or more struct clksel_rates.
87 */
39struct clksel { 88struct clksel {
40 struct clk *parent; 89 struct clk *parent;
41 const struct clksel_rate *rates; 90 const struct clksel_rate *rates;
@@ -116,6 +165,60 @@ struct dpll_data {
116 165
117#endif 166#endif
118 167
168/* struct clk.flags possibilities */
169#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
170#define CLOCK_IDLE_CONTROL (1 << 1)
171#define CLOCK_NO_IDLE_PARENT (1 << 2)
172#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
173#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
174
175/**
176 * struct clk - OMAP struct clk
177 * @node: list_head connecting this clock into the full clock list
178 * @ops: struct clkops * for this clock
179 * @name: the name of the clock in the hardware (used in hwmod data and debug)
180 * @parent: pointer to this clock's parent struct clk
181 * @children: list_head connecting to the child clks' @sibling list_heads
182 * @sibling: list_head connecting this clk to its parent clk's @children
183 * @rate: current clock rate
184 * @enable_reg: register to write to enable the clock (see @enable_bit)
185 * @recalc: fn ptr that returns the clock's current rate
186 * @set_rate: fn ptr that can change the clock's current rate
187 * @round_rate: fn ptr that can round the clock's current rate
188 * @init: fn ptr to do clock-specific initialization
189 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
190 * @usecount: number of users that have requested this clock to be enabled
191 * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
192 * @flags: see "struct clk.flags possibilities" above
193 * @clksel_reg: for clksel clks, register va containing src/divisor select
194 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
195 * @clksel: for clksel clks, pointer to struct clksel for this clock
196 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
197 * @clkdm_name: clockdomain name that this clock is contained in
198 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
199 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
200 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
201 *
202 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
203 * clock code converted to use clksel.
204 *
205 * XXX @usecount is poorly named. It should be "enable_count" or
206 * something similar. "users" in the description refers to kernel
207 * code (core code or drivers) that have called clk_enable() and not
208 * yet called clk_disable(); the usecount of parent clocks is also
209 * incremented by the clock code when clk_enable() is called on child
210 * clocks and decremented by the clock code when clk_disable() is
211 * called on child clocks.
212 *
213 * XXX @clkdm, @usecount, @children, @sibling should be marked for
214 * internal use only.
215 *
216 * @children and @sibling are used to optimize parent-to-child clock
217 * tree traversals. (child-to-parent traversals use @parent.)
218 *
219 * XXX The notion of the clock's current rate probably needs to be
220 * separated from the clock's target rate.
221 */
119struct clk { 222struct clk {
120 struct list_head node; 223 struct list_head node;
121 const struct clkops *ops; 224 const struct clkops *ops;
@@ -129,8 +232,8 @@ struct clk {
129 int (*set_rate)(struct clk *, unsigned long); 232 int (*set_rate)(struct clk *, unsigned long);
130 long (*round_rate)(struct clk *, unsigned long); 233 long (*round_rate)(struct clk *, unsigned long);
131 void (*init)(struct clk *); 234 void (*init)(struct clk *);
132 __u8 enable_bit; 235 u8 enable_bit;
133 __s8 usecount; 236 s8 usecount;
134 u8 fixed_div; 237 u8 fixed_div;
135 u8 flags; 238 u8 flags;
136#ifdef CONFIG_ARCH_OMAP2PLUS 239#ifdef CONFIG_ARCH_OMAP2PLUS
@@ -141,8 +244,8 @@ struct clk {
141 const char *clkdm_name; 244 const char *clkdm_name;
142 struct clockdomain *clkdm; 245 struct clockdomain *clkdm;
143#else 246#else
144 __u8 rate_offset; 247 u8 rate_offset;
145 __u8 src_offset; 248 u8 src_offset;
146#endif 249#endif
147#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) 250#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
148 struct dentry *dent; /* For visible tree hierarchy */ 251 struct dentry *dent; /* For visible tree hierarchy */
@@ -188,23 +291,4 @@ extern const struct clkops clkops_null;
188 291
189extern struct clk dummy_ck; 292extern struct clk dummy_ck;
190 293
191/* Clock flags */
192#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
193#define CLOCK_IDLE_CONTROL (1 << 1)
194#define CLOCK_NO_IDLE_PARENT (1 << 2)
195#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
196#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
197
198/* Clksel_rate flags */
199#define RATE_IN_242X (1 << 0)
200#define RATE_IN_243X (1 << 1)
201#define RATE_IN_3XXX (1 << 2) /* rates common to all OMAP3 */
202#define RATE_IN_3430ES2 (1 << 3) /* 3430ES2 rates only */
203#define RATE_IN_36XX (1 << 4)
204#define RATE_IN_4430 (1 << 5)
205
206#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
207
208#define RATE_IN_3430ES2PLUS (RATE_IN_3430ES2 | RATE_IN_36XX)
209
210#endif 294#endif