OMAP clockdomain/powerdomain: remove runtime register/unregister
[deliverable/linux.git] / arch / arm / plat-omap / include / plat / clockdomain.h
CommitLineData
d459bfe0 1/*
5b74c676 2 * arch/arm/plat-omap/include/mach/clockdomain.h
d459bfe0
PW
3 *
4 * OMAP2/3 clockdomain framework functions
5 *
6 * Copyright (C) 2008 Texas Instruments, Inc.
55ed9694 7 * Copyright (C) 2008-2009 Nokia Corporation
d459bfe0
PW
8 *
9 * Written by Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __ASM_ARM_ARCH_OMAP_CLOCKDOMAIN_H
17#define __ASM_ARM_ARCH_OMAP_CLOCKDOMAIN_H
18
ce491cf8
TL
19#include <plat/powerdomain.h>
20#include <plat/clock.h>
21#include <plat/cpu.h>
d459bfe0
PW
22
23/* Clockdomain capability flags */
24#define CLKDM_CAN_FORCE_SLEEP (1 << 0)
25#define CLKDM_CAN_FORCE_WAKEUP (1 << 1)
26#define CLKDM_CAN_ENABLE_AUTO (1 << 2)
27#define CLKDM_CAN_DISABLE_AUTO (1 << 3)
28
29#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
30#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
31#define CLKDM_CAN_HWSUP_SWSUP (CLKDM_CAN_SWSUP | CLKDM_CAN_HWSUP)
32
33/* OMAP24XX CM_CLKSTCTRL_*.AUTOSTATE_* register bit values */
34#define OMAP24XX_CLKSTCTRL_DISABLE_AUTO 0x0
35#define OMAP24XX_CLKSTCTRL_ENABLE_AUTO 0x1
36
37/* OMAP3XXX CM_CLKSTCTRL_*.CLKTRCTRL_* register bit values */
38#define OMAP34XX_CLKSTCTRL_DISABLE_AUTO 0x0
39#define OMAP34XX_CLKSTCTRL_FORCE_SLEEP 0x1
40#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP 0x2
41#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3
42
43/*
55ed9694
PW
44 * struct clkdm_autodep - a clockdomain that should have wkdeps
45 * and sleepdeps added when a clockdomain should stay active in hwsup mode;
46 * and conversely, removed when the clockdomain should be allowed to go
d459bfe0
PW
47 * inactive in hwsup mode.
48 */
55ed9694 49struct clkdm_autodep {
d459bfe0 50
5b74c676 51 union {
55ed9694 52 /* Name of the clockdomain to add a wkdep/sleepdep on */
5b74c676 53 const char *name;
d459bfe0 54
55ed9694
PW
55 /* Clockdomain pointer (looked up at clkdm_init() time) */
56 struct clockdomain *ptr;
57 } clkdm;
d459bfe0
PW
58
59 /* OMAP chip types that this clockdomain dep is valid on */
60 const struct omap_chip_id omap_chip;
61
62};
63
55ed9694
PW
64/* Encodes dependencies between clockdomains - statically defined */
65struct clkdm_dep {
66
67 /* Clockdomain name */
68 const char *clkdm_name;
69
70 /* Clockdomain pointer - resolved by the clockdomain code */
71 struct clockdomain *clkdm;
72
73 /* Flags to mark OMAP chip restrictions, etc. */
74 const struct omap_chip_id omap_chip;
75
76};
77
d459bfe0
PW
78struct clockdomain {
79
80 /* Clockdomain name */
81 const char *name;
82
5b74c676
PW
83 union {
84 /* Powerdomain enclosing this clockdomain */
85 const char *name;
86
87 /* Powerdomain pointer assigned at clkdm_register() */
88 struct powerdomain *ptr;
89 } pwrdm;
d459bfe0 90
84c0c39a
AP
91 /* CLKSTCTRL reg for the given clock domain*/
92 void __iomem *clkstctrl_reg;
93
d459bfe0
PW
94 /* CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg */
95 const u16 clktrctrl_mask;
96
97 /* Clockdomain capability flags */
98 const u8 flags;
99
55ed9694
PW
100 /* Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit */
101 const u8 dep_bit;
102
103 /* Clockdomains that can be told to wake this powerdomain up */
104 struct clkdm_dep *wkdep_srcs;
105
106 /* Clockdomains that can be told to keep this clkdm from inactivity */
107 struct clkdm_dep *sleepdep_srcs;
108
d459bfe0
PW
109 /* OMAP chip types that this clockdomain is valid on */
110 const struct omap_chip_id omap_chip;
111
112 /* Usecount tracking */
113 atomic_t usecount;
114
d459bfe0
PW
115 struct list_head node;
116
117};
118
55ed9694 119void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps);
d459bfe0
PW
120struct clockdomain *clkdm_lookup(const char *name);
121
a23456e9
PDS
122int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
123 void *user);
d459bfe0
PW
124struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm);
125
55ed9694
PW
126int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
127int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
128int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
129int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
130int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
131int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
132
d459bfe0
PW
133void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
134void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
135
136int omap2_clkdm_wakeup(struct clockdomain *clkdm);
137int omap2_clkdm_sleep(struct clockdomain *clkdm);
138
139int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
140int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
141
142#endif
This page took 0.183576 seconds and 5 git commands to generate.