OMAP: powerdomain: Move static allocations from powerdomains.h to a .c file
[deliverable/linux.git] / arch / arm / plat-omap / include / plat / powerdomain.h
CommitLineData
ad67ef68
PW
1/*
2 * OMAP2/3 powerdomain control
3 *
55ed9694
PW
4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation
ad67ef68
PW
6 *
7 * Written by Paul Walmsley
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef ASM_ARM_ARCH_OMAP_POWERDOMAIN
15#define ASM_ARM_ARCH_OMAP_POWERDOMAIN
16
17#include <linux/types.h>
18#include <linux/list.h>
19
20#include <asm/atomic.h>
21
ce491cf8 22#include <plat/cpu.h>
ad67ef68
PW
23
24
25/* Powerdomain basic power states */
26#define PWRDM_POWER_OFF 0x0
27#define PWRDM_POWER_RET 0x1
28#define PWRDM_POWER_INACTIVE 0x2
29#define PWRDM_POWER_ON 0x3
30
2354eb5a
PW
31#define PWRDM_MAX_PWRSTS 4
32
ad67ef68 33/* Powerdomain allowable state bitfields */
d3353e16 34#define PWRSTS_ON (1 << PWRDM_POWER_ON)
bb722f33 35#define PWRSTS_OFF (1 << PWRDM_POWER_OFF)
ad67ef68
PW
36#define PWRSTS_OFF_ON ((1 << PWRDM_POWER_OFF) | \
37 (1 << PWRDM_POWER_ON))
38
39#define PWRSTS_OFF_RET ((1 << PWRDM_POWER_OFF) | \
40 (1 << PWRDM_POWER_RET))
41
f37c6dfa
AP
42#define PWRSTS_RET_ON ((1 << PWRDM_POWER_RET) | \
43 (1 << PWRDM_POWER_ON))
44
ad67ef68
PW
45#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | (1 << PWRDM_POWER_ON))
46
47
0b7cbfb5
PW
48/* Powerdomain flags */
49#define PWRDM_HAS_HDWR_SAR (1 << 0) /* hardware save-and-restore support */
3863c74b
TG
50#define PWRDM_HAS_MPU_QUIRK (1 << 1) /* MPU pwr domain has MEM bank 0 bits
51 * in MEM bank 1 position. This is
52 * true for OMAP3430
53 */
90dbc7b0
RN
54#define PWRDM_HAS_LOWPOWERSTATECHANGE (1 << 2) /*
55 * support to transition from a
56 * sleep state to a lower sleep
57 * state without waking up the
58 * powerdomain
59 */
0b7cbfb5 60
ad67ef68 61/*
38900c27
AP
62 * Number of memory banks that are power-controllable. On OMAP4430, the
63 * maximum is 5.
ad67ef68 64 */
38900c27 65#define PWRDM_MAX_MEM_BANKS 5
ad67ef68 66
8420bb13
PW
67/*
68 * Maximum number of clockdomains that can be associated with a powerdomain.
38900c27 69 * CORE powerdomain on OMAP4 is the worst case
8420bb13 70 */
38900c27 71#define PWRDM_MAX_CLKDMS 9
8420bb13 72
ad67ef68
PW
73/* XXX A completely arbitrary number. What is reasonable here? */
74#define PWRDM_TRANSITION_BAILOUT 100000
75
8420bb13 76struct clockdomain;
ad67ef68
PW
77struct powerdomain;
78
f0271d65
PW
79/**
80 * struct powerdomain - OMAP powerdomain
81 * @name: Powerdomain name
82 * @omap_chip: represents the OMAP chip types containing this pwrdm
83 * @prcm_offs: the address offset from CM_BASE/PRM_BASE
84 * @pwrsts: Possible powerdomain power states
85 * @pwrsts_logic_ret: Possible logic power states when pwrdm in RETENTION
86 * @flags: Powerdomain flags
87 * @banks: Number of software-controllable memory banks in this powerdomain
88 * @pwrsts_mem_ret: Possible memory bank pwrstates when pwrdm in RETENTION
89 * @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON
90 * @pwrdm_clkdms: Clockdomains in this powerdomain
91 * @node: list_head linking all powerdomains
92 * @state:
93 * @state_counter:
94 * @timer:
95 * @state_timer:
96 */
ad67ef68 97struct powerdomain {
ad67ef68 98 const char *name;
ad67ef68 99 const struct omap_chip_id omap_chip;
e0594b44 100 const s16 prcm_offs;
ad67ef68 101 const u8 pwrsts;
ad67ef68 102 const u8 pwrsts_logic_ret;
0b7cbfb5 103 const u8 flags;
ad67ef68 104 const u8 banks;
ad67ef68 105 const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS];
ad67ef68 106 const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS];
8420bb13 107 struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS];
ad67ef68 108 struct list_head node;
ba20bb12 109 int state;
2354eb5a 110 unsigned state_counter[PWRDM_MAX_PWRSTS];
cde08f81
TG
111 unsigned ret_logic_off_counter;
112 unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS];
331b93f4
PDS
113
114#ifdef CONFIG_PM_DEBUG
115 s64 timer;
2354eb5a 116 s64 state_timer[PWRDM_MAX_PWRSTS];
331b93f4 117#endif
ad67ef68
PW
118};
119
120
74bea6b9 121void pwrdm_fw_init(void);
ad67ef68
PW
122void pwrdm_init(struct powerdomain **pwrdm_list);
123
ad67ef68
PW
124struct powerdomain *pwrdm_lookup(const char *name);
125
a23456e9
PDS
126int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
127 void *user);
ee894b18
AB
128int pwrdm_for_each_nolock(int (*fn)(struct powerdomain *pwrdm, void *user),
129 void *user);
ad67ef68 130
8420bb13
PW
131int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
132int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
133int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
134 int (*fn)(struct powerdomain *pwrdm,
135 struct clockdomain *clkdm));
136
ad67ef68
PW
137int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
138
139int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
140int pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
fecb494b 141int pwrdm_read_pwrst(struct powerdomain *pwrdm);
ad67ef68
PW
142int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm);
143int pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm);
144
145int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst);
146int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst);
147int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst);
148
149int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm);
150int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm);
1e3d0d2b 151int pwrdm_read_logic_retst(struct powerdomain *pwrdm);
ad67ef68
PW
152int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
153int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
1e3d0d2b 154int pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
ad67ef68 155
0b7cbfb5
PW
156int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm);
157int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm);
158bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm);
159
ad67ef68
PW
160int pwrdm_wait_transition(struct powerdomain *pwrdm);
161
ba20bb12
PDS
162int pwrdm_state_switch(struct powerdomain *pwrdm);
163int pwrdm_clkdm_state_switch(struct clockdomain *clkdm);
164int pwrdm_pre_transition(void);
165int pwrdm_post_transition(void);
04aeae77 166int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
ba20bb12 167
ad67ef68 168#endif
This page took 0.2008 seconds and 5 git commands to generate.