0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __ARCH_ARM_MACH_OMAP2_CLOCKDOMAIN_H
0012 #define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAIN_H
0013
0014 #include <linux/init.h>
0015
0016 #include "powerdomain.h"
0017 #include "clock.h"
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #define CLKDM_CAN_FORCE_SLEEP (1 << 0)
0045 #define CLKDM_CAN_FORCE_WAKEUP (1 << 1)
0046 #define CLKDM_CAN_ENABLE_AUTO (1 << 2)
0047 #define CLKDM_CAN_DISABLE_AUTO (1 << 3)
0048 #define CLKDM_NO_AUTODEPS (1 << 4)
0049 #define CLKDM_ACTIVE_WITH_MPU (1 << 5)
0050 #define CLKDM_MISSING_IDLE_REPORTING (1 << 6)
0051
0052 #define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
0053 #define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
0054 #define CLKDM_CAN_HWSUP_SWSUP (CLKDM_CAN_SWSUP | CLKDM_CAN_HWSUP)
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068 struct clkdm_autodep {
0069 union {
0070 const char *name;
0071 struct clockdomain *ptr;
0072 } clkdm;
0073 };
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 struct clkdm_dep {
0088 const char *clkdm_name;
0089 struct clockdomain *clkdm;
0090 s16 wkdep_usecount;
0091 s16 sleepdep_usecount;
0092 };
0093
0094
0095 #define _CLKDM_FLAG_HWSUP_ENABLED BIT(0)
0096
0097 struct omap_hwmod;
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 struct clockdomain {
0124 const char *name;
0125 union {
0126 const char *name;
0127 struct powerdomain *ptr;
0128 } pwrdm;
0129 const u16 clktrctrl_mask;
0130 const u8 flags;
0131 u8 _flags;
0132 const u8 dep_bit;
0133 const u8 prcm_partition;
0134 const u16 cm_inst;
0135 const u16 clkdm_offs;
0136 struct clkdm_dep *wkdep_srcs;
0137 struct clkdm_dep *sleepdep_srcs;
0138 int usecount;
0139 int forcewake_count;
0140 struct list_head node;
0141 u32 context;
0142 };
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163 struct clkdm_ops {
0164 int (*clkdm_add_wkdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0165 int (*clkdm_del_wkdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0166 int (*clkdm_read_wkdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0167 int (*clkdm_clear_all_wkdeps)(struct clockdomain *clkdm);
0168 int (*clkdm_add_sleepdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0169 int (*clkdm_del_sleepdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0170 int (*clkdm_read_sleepdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0171 int (*clkdm_clear_all_sleepdeps)(struct clockdomain *clkdm);
0172 int (*clkdm_sleep)(struct clockdomain *clkdm);
0173 int (*clkdm_wakeup)(struct clockdomain *clkdm);
0174 void (*clkdm_allow_idle)(struct clockdomain *clkdm);
0175 void (*clkdm_deny_idle)(struct clockdomain *clkdm);
0176 int (*clkdm_clk_enable)(struct clockdomain *clkdm);
0177 int (*clkdm_clk_disable)(struct clockdomain *clkdm);
0178 int (*clkdm_save_context)(struct clockdomain *clkdm);
0179 int (*clkdm_restore_context)(struct clockdomain *clkdm);
0180 };
0181
0182 int clkdm_register_platform_funcs(struct clkdm_ops *co);
0183 int clkdm_register_autodeps(struct clkdm_autodep *ia);
0184 int clkdm_register_clkdms(struct clockdomain **c);
0185 int clkdm_complete_init(void);
0186
0187 struct clockdomain *clkdm_lookup(const char *name);
0188
0189 int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
0190 void *user);
0191 struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm);
0192
0193 int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0194 int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0195 int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0196 int clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
0197 int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0198 int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0199 int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
0200 int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
0201
0202 void clkdm_allow_idle_nolock(struct clockdomain *clkdm);
0203 void clkdm_allow_idle(struct clockdomain *clkdm);
0204 void clkdm_deny_idle_nolock(struct clockdomain *clkdm);
0205 void clkdm_deny_idle(struct clockdomain *clkdm);
0206 bool clkdm_in_hwsup(struct clockdomain *clkdm);
0207 bool clkdm_missing_idle_reporting(struct clockdomain *clkdm);
0208
0209 int clkdm_wakeup_nolock(struct clockdomain *clkdm);
0210 int clkdm_wakeup(struct clockdomain *clkdm);
0211 int clkdm_sleep_nolock(struct clockdomain *clkdm);
0212 int clkdm_sleep(struct clockdomain *clkdm);
0213
0214 int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
0215 int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
0216 int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
0217 int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
0218
0219 void clkdm_save_context(void);
0220 void clkdm_restore_context(void);
0221
0222 extern void __init omap242x_clockdomains_init(void);
0223 extern void __init omap243x_clockdomains_init(void);
0224 extern void __init omap3xxx_clockdomains_init(void);
0225 extern void __init am33xx_clockdomains_init(void);
0226 extern void __init ti814x_clockdomains_init(void);
0227 extern void __init ti816x_clockdomains_init(void);
0228 extern void __init omap44xx_clockdomains_init(void);
0229 extern void __init omap54xx_clockdomains_init(void);
0230 extern void __init dra7xx_clockdomains_init(void);
0231 void am43xx_clockdomains_init(void);
0232
0233 extern void clkdm_add_autodeps(struct clockdomain *clkdm);
0234 extern void clkdm_del_autodeps(struct clockdomain *clkdm);
0235
0236 extern struct clkdm_ops omap2_clkdm_operations;
0237 extern struct clkdm_ops omap3_clkdm_operations;
0238 extern struct clkdm_ops omap4_clkdm_operations;
0239 extern struct clkdm_ops am33xx_clkdm_operations;
0240 extern struct clkdm_ops am43xx_clkdm_operations;
0241
0242 extern struct clkdm_dep gfx_24xx_wkdeps[];
0243 extern struct clkdm_dep dsp_24xx_wkdeps[];
0244 extern struct clockdomain wkup_common_clkdm;
0245
0246 #endif