clockdomain.h (08cb9703e2922db297d8f83ec110bde37823e021) clockdomain.h (a5ffef6af127721a813d70f87cd8cc348ea9d6ab)
1/*
2 * arch/arm/plat-omap/include/mach/clockdomain.h
3 *
4 * OMAP2/3 clockdomain framework functions
5 *
6 * Copyright (C) 2008 Texas Instruments, Inc.
7 * Copyright (C) 2008-2011 Nokia Corporation
8 *

--- 31 unchanged lines hidden (view full) ---

40
41#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
42#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
43#define CLKDM_CAN_HWSUP_SWSUP (CLKDM_CAN_SWSUP | CLKDM_CAN_HWSUP)
44
45/**
46 * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
47 * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
1/*
2 * arch/arm/plat-omap/include/mach/clockdomain.h
3 *
4 * OMAP2/3 clockdomain framework functions
5 *
6 * Copyright (C) 2008 Texas Instruments, Inc.
7 * Copyright (C) 2008-2011 Nokia Corporation
8 *

--- 31 unchanged lines hidden (view full) ---

40
41#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
42#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
43#define CLKDM_CAN_HWSUP_SWSUP (CLKDM_CAN_SWSUP | CLKDM_CAN_HWSUP)
44
45/**
46 * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
47 * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
48 * @omap_chip: OMAP chip types that this autodep is valid on
49 *
50 * A clockdomain that should have wkdeps and sleepdeps added when a
51 * clockdomain should stay active in hwsup mode; and conversely,
52 * removed when the clockdomain should be allowed to go inactive in
53 * hwsup mode.
54 *
55 * Autodeps are deprecated and should be removed after
56 * omap_hwmod-based fine-grained module idle control is added.
57 */
58struct clkdm_autodep {
59 union {
60 const char *name;
61 struct clockdomain *ptr;
62 } clkdm;
48 *
49 * A clockdomain that should have wkdeps and sleepdeps added when a
50 * clockdomain should stay active in hwsup mode; and conversely,
51 * removed when the clockdomain should be allowed to go inactive in
52 * hwsup mode.
53 *
54 * Autodeps are deprecated and should be removed after
55 * omap_hwmod-based fine-grained module idle control is added.
56 */
57struct clkdm_autodep {
58 union {
59 const char *name;
60 struct clockdomain *ptr;
61 } clkdm;
63 const struct omap_chip_id omap_chip;
64};
65
66/**
67 * struct clkdm_dep - encode dependencies between clockdomains
68 * @clkdm_name: clockdomain name
69 * @clkdm: pointer to the struct clockdomain of @clkdm_name
62};
63
64/**
65 * struct clkdm_dep - encode dependencies between clockdomains
66 * @clkdm_name: clockdomain name
67 * @clkdm: pointer to the struct clockdomain of @clkdm_name
70 * @omap_chip: OMAP chip types that this dependency is valid on
71 * @wkdep_usecount: Number of wakeup dependencies causing this clkdm to wake
72 * @sleepdep_usecount: Number of sleep deps that could prevent clkdm from idle
73 *
74 * Statically defined. @clkdm is resolved from @clkdm_name at runtime and
75 * should not be pre-initialized.
76 *
77 * XXX Should also include hardware (fixed) dependencies.
78 */
79struct clkdm_dep {
80 const char *clkdm_name;
81 struct clockdomain *clkdm;
82 atomic_t wkdep_usecount;
83 atomic_t sleepdep_usecount;
68 * @wkdep_usecount: Number of wakeup dependencies causing this clkdm to wake
69 * @sleepdep_usecount: Number of sleep deps that could prevent clkdm from idle
70 *
71 * Statically defined. @clkdm is resolved from @clkdm_name at runtime and
72 * should not be pre-initialized.
73 *
74 * XXX Should also include hardware (fixed) dependencies.
75 */
76struct clkdm_dep {
77 const char *clkdm_name;
78 struct clockdomain *clkdm;
79 atomic_t wkdep_usecount;
80 atomic_t sleepdep_usecount;
84 const struct omap_chip_id omap_chip;
85};
86
87/* Possible flags for struct clockdomain._flags */
88#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0)
89
90/**
91 * struct clockdomain - OMAP clockdomain
92 * @name: clockdomain name
93 * @pwrdm: powerdomain containing this clockdomain
94 * @clktrctrl_reg: CLKSTCTRL reg for the given clock domain
95 * @clktrctrl_mask: CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg
96 * @flags: Clockdomain capability flags
97 * @_flags: Flags for use only by internal clockdomain code
98 * @dep_bit: Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit
99 * @prcm_partition: (OMAP4 only) PRCM partition ID for this clkdm's registers
100 * @cm_inst: (OMAP4 only) CM instance register offset
101 * @clkdm_offs: (OMAP4 only) CM clockdomain register offset
102 * @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up
103 * @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact
81};
82
83/* Possible flags for struct clockdomain._flags */
84#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0)
85
86/**
87 * struct clockdomain - OMAP clockdomain
88 * @name: clockdomain name
89 * @pwrdm: powerdomain containing this clockdomain
90 * @clktrctrl_reg: CLKSTCTRL reg for the given clock domain
91 * @clktrctrl_mask: CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg
92 * @flags: Clockdomain capability flags
93 * @_flags: Flags for use only by internal clockdomain code
94 * @dep_bit: Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit
95 * @prcm_partition: (OMAP4 only) PRCM partition ID for this clkdm's registers
96 * @cm_inst: (OMAP4 only) CM instance register offset
97 * @clkdm_offs: (OMAP4 only) CM clockdomain register offset
98 * @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up
99 * @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact
104 * @omap_chip: OMAP chip types that this clockdomain is valid on
105 * @usecount: Usecount tracking
106 * @node: list_head to link all clockdomains together
107 *
108 * @prcm_partition should be a macro from mach-omap2/prcm44xx.h (OMAP4 only)
109 * @cm_inst should be a macro ending in _INST from the OMAP4 CM instance
110 * definitions (OMAP4 only)
111 * @clkdm_offs should be a macro ending in _CDOFFS from the OMAP4 CM instance
112 * definitions (OMAP4 only)

--- 8 unchanged lines hidden (view full) ---

121 const u8 flags;
122 u8 _flags;
123 const u8 dep_bit;
124 const u8 prcm_partition;
125 const s16 cm_inst;
126 const u16 clkdm_offs;
127 struct clkdm_dep *wkdep_srcs;
128 struct clkdm_dep *sleepdep_srcs;
100 * @usecount: Usecount tracking
101 * @node: list_head to link all clockdomains together
102 *
103 * @prcm_partition should be a macro from mach-omap2/prcm44xx.h (OMAP4 only)
104 * @cm_inst should be a macro ending in _INST from the OMAP4 CM instance
105 * definitions (OMAP4 only)
106 * @clkdm_offs should be a macro ending in _CDOFFS from the OMAP4 CM instance
107 * definitions (OMAP4 only)

--- 8 unchanged lines hidden (view full) ---

116 const u8 flags;
117 u8 _flags;
118 const u8 dep_bit;
119 const u8 prcm_partition;
120 const s16 cm_inst;
121 const u16 clkdm_offs;
122 struct clkdm_dep *wkdep_srcs;
123 struct clkdm_dep *sleepdep_srcs;
129 const struct omap_chip_id omap_chip;
130 atomic_t usecount;
131 struct list_head node;
132 spinlock_t lock;
133};
134
135/**
136 * struct clkdm_ops - Arch specific function implementations
137 * @clkdm_add_wkdep: Add a wakeup dependency between clk domains

--- 55 unchanged lines hidden (view full) ---

193int clkdm_wakeup(struct clockdomain *clkdm);
194int clkdm_sleep(struct clockdomain *clkdm);
195
196int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
197int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
198int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
199int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
200
124 atomic_t usecount;
125 struct list_head node;
126 spinlock_t lock;
127};
128
129/**
130 * struct clkdm_ops - Arch specific function implementations
131 * @clkdm_add_wkdep: Add a wakeup dependency between clk domains

--- 55 unchanged lines hidden (view full) ---

187int clkdm_wakeup(struct clockdomain *clkdm);
188int clkdm_sleep(struct clockdomain *clkdm);
189
190int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
191int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
192int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
193int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
194
201extern void __init omap2xxx_clockdomains_init(void);
195extern void __init omap242x_clockdomains_init(void);
196extern void __init omap243x_clockdomains_init(void);
202extern void __init omap3xxx_clockdomains_init(void);
203extern void __init omap44xx_clockdomains_init(void);
204extern void _clkdm_add_autodeps(struct clockdomain *clkdm);
205extern void _clkdm_del_autodeps(struct clockdomain *clkdm);
206
207extern struct clkdm_ops omap2_clkdm_operations;
208extern struct clkdm_ops omap3_clkdm_operations;
209extern struct clkdm_ops omap4_clkdm_operations;
210
197extern void __init omap3xxx_clockdomains_init(void);
198extern void __init omap44xx_clockdomains_init(void);
199extern void _clkdm_add_autodeps(struct clockdomain *clkdm);
200extern void _clkdm_del_autodeps(struct clockdomain *clkdm);
201
202extern struct clkdm_ops omap2_clkdm_operations;
203extern struct clkdm_ops omap3_clkdm_operations;
204extern struct clkdm_ops omap4_clkdm_operations;
205
206extern struct clkdm_dep gfx_24xx_wkdeps[];
207extern struct clkdm_dep dsp_24xx_wkdeps[];
208extern struct clockdomain wkup_common_clkdm;
209extern struct clockdomain prm_common_clkdm;
210extern struct clockdomain cm_common_clkdm;
211
211#endif
212#endif