]>
Commit | Line | Data |
---|---|---|
ce1e3262 | 1 | /* |
ce1e3262 | 2 | * Copyright (c) 2010 Google, Inc |
7232398a | 3 | * Copyright (c) 2014 NVIDIA Corporation |
ce1e3262 CC |
4 | * |
5 | * Author: | |
6 | * Colin Cross <ccross@google.com> | |
7 | * | |
8 | * This software is licensed under the terms of the GNU General Public | |
9 | * License version 2, as published by the Free Software Foundation, and | |
10 | * may be copied, distributed, and modified under those terms. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | */ | |
18 | ||
7232398a TR |
19 | #ifndef __SOC_TEGRA_PMC_H__ |
20 | #define __SOC_TEGRA_PMC_H__ | |
21 | ||
22 | #include <linux/reboot.h> | |
23 | ||
24 | #include <soc/tegra/pm.h> | |
ce1e3262 | 25 | |
a25186eb | 26 | struct clk; |
80b28791 | 27 | struct reset_control; |
a25186eb | 28 | |
7232398a | 29 | #ifdef CONFIG_SMP |
70293ed0 JH |
30 | bool tegra_pmc_cpu_is_powered(unsigned int cpuid); |
31 | int tegra_pmc_cpu_power_on(unsigned int cpuid); | |
32 | int tegra_pmc_cpu_remove_clamping(unsigned int cpuid); | |
7232398a TR |
33 | #endif /* CONFIG_SMP */ |
34 | ||
35 | /* | |
36 | * powergate and I/O rail APIs | |
37 | */ | |
38 | ||
ce1e3262 CC |
39 | #define TEGRA_POWERGATE_CPU 0 |
40 | #define TEGRA_POWERGATE_3D 1 | |
41 | #define TEGRA_POWERGATE_VENC 2 | |
42 | #define TEGRA_POWERGATE_PCIE 3 | |
43 | #define TEGRA_POWERGATE_VDEC 4 | |
44 | #define TEGRA_POWERGATE_L2 5 | |
45 | #define TEGRA_POWERGATE_MPE 6 | |
6cafa97d PDS |
46 | #define TEGRA_POWERGATE_HEG 7 |
47 | #define TEGRA_POWERGATE_SATA 8 | |
48 | #define TEGRA_POWERGATE_CPU1 9 | |
49 | #define TEGRA_POWERGATE_CPU2 10 | |
50 | #define TEGRA_POWERGATE_CPU3 11 | |
51 | #define TEGRA_POWERGATE_CELP 12 | |
52 | #define TEGRA_POWERGATE_3D1 13 | |
bd6a9ddc TR |
53 | #define TEGRA_POWERGATE_CPU0 14 |
54 | #define TEGRA_POWERGATE_C0NC 15 | |
55 | #define TEGRA_POWERGATE_C1NC 16 | |
9a716579 | 56 | #define TEGRA_POWERGATE_SOR 17 |
bd6a9ddc TR |
57 | #define TEGRA_POWERGATE_DIS 18 |
58 | #define TEGRA_POWERGATE_DISB 19 | |
59 | #define TEGRA_POWERGATE_XUSBA 20 | |
60 | #define TEGRA_POWERGATE_XUSBB 21 | |
61 | #define TEGRA_POWERGATE_XUSBC 22 | |
9a716579 TR |
62 | #define TEGRA_POWERGATE_VIC 23 |
63 | #define TEGRA_POWERGATE_IRAM 24 | |
c2fe4694 TR |
64 | #define TEGRA_POWERGATE_NVDEC 25 |
65 | #define TEGRA_POWERGATE_NVJPG 26 | |
66 | #define TEGRA_POWERGATE_AUD 27 | |
67 | #define TEGRA_POWERGATE_DFD 28 | |
68 | #define TEGRA_POWERGATE_VE2 29 | |
a3804512 | 69 | #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2 |
6cafa97d | 70 | |
6cafa97d | 71 | #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D |
ce1e3262 | 72 | |
21b49910 LD |
73 | /** |
74 | * enum tegra_io_pad - I/O pad group identifier | |
75 | * | |
76 | * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad | |
77 | * can be used to control the common voltage signal level and power state of | |
78 | * the pins of the given pad. | |
79 | */ | |
80 | enum tegra_io_pad { | |
81 | TEGRA_IO_PAD_AUDIO, | |
82 | TEGRA_IO_PAD_AUDIO_HV, | |
83 | TEGRA_IO_PAD_BB, | |
84 | TEGRA_IO_PAD_CAM, | |
85 | TEGRA_IO_PAD_COMP, | |
86 | TEGRA_IO_PAD_CSIA, | |
87 | TEGRA_IO_PAD_CSIB, | |
88 | TEGRA_IO_PAD_CSIC, | |
89 | TEGRA_IO_PAD_CSID, | |
90 | TEGRA_IO_PAD_CSIE, | |
91 | TEGRA_IO_PAD_CSIF, | |
92 | TEGRA_IO_PAD_DBG, | |
93 | TEGRA_IO_PAD_DEBUG_NONAO, | |
94 | TEGRA_IO_PAD_DMIC, | |
95 | TEGRA_IO_PAD_DP, | |
96 | TEGRA_IO_PAD_DSI, | |
97 | TEGRA_IO_PAD_DSIB, | |
98 | TEGRA_IO_PAD_DSIC, | |
99 | TEGRA_IO_PAD_DSID, | |
100 | TEGRA_IO_PAD_EMMC, | |
101 | TEGRA_IO_PAD_EMMC2, | |
102 | TEGRA_IO_PAD_GPIO, | |
103 | TEGRA_IO_PAD_HDMI, | |
104 | TEGRA_IO_PAD_HSIC, | |
105 | TEGRA_IO_PAD_HV, | |
106 | TEGRA_IO_PAD_LVDS, | |
107 | TEGRA_IO_PAD_MIPI_BIAS, | |
108 | TEGRA_IO_PAD_NAND, | |
109 | TEGRA_IO_PAD_PEX_BIAS, | |
110 | TEGRA_IO_PAD_PEX_CLK1, | |
111 | TEGRA_IO_PAD_PEX_CLK2, | |
112 | TEGRA_IO_PAD_PEX_CNTRL, | |
113 | TEGRA_IO_PAD_SDMMC1, | |
114 | TEGRA_IO_PAD_SDMMC3, | |
115 | TEGRA_IO_PAD_SDMMC4, | |
116 | TEGRA_IO_PAD_SPI, | |
117 | TEGRA_IO_PAD_SPI_HV, | |
118 | TEGRA_IO_PAD_SYS_DDC, | |
119 | TEGRA_IO_PAD_UART, | |
120 | TEGRA_IO_PAD_USB0, | |
121 | TEGRA_IO_PAD_USB1, | |
122 | TEGRA_IO_PAD_USB2, | |
123 | TEGRA_IO_PAD_USB3, | |
124 | TEGRA_IO_PAD_USB_BIAS, | |
125 | }; | |
126 | ||
127 | /* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */ | |
128 | #define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI | |
129 | #define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS | |
130 | ||
131 | /** | |
132 | * enum tegra_io_pad_voltage - voltage level of the I/O pad's source rail | |
133 | * @TEGRA_IO_PAD_1800000UV: 1.8 V | |
134 | * @TEGRA_IO_PAD_3300000UV: 3.3 V | |
135 | */ | |
136 | enum tegra_io_pad_voltage { | |
137 | TEGRA_IO_PAD_1800000UV, | |
138 | TEGRA_IO_PAD_3300000UV, | |
139 | }; | |
9d4450ae | 140 | |
bd737038 | 141 | #ifdef CONFIG_SOC_TEGRA_PMC |
70293ed0 JH |
142 | int tegra_powergate_is_powered(unsigned int id); |
143 | int tegra_powergate_power_on(unsigned int id); | |
144 | int tegra_powergate_power_off(unsigned int id); | |
145 | int tegra_powergate_remove_clamping(unsigned int id); | |
ce1e3262 CC |
146 | |
147 | /* Must be called with clk disabled, and returns with clk enabled */ | |
70293ed0 | 148 | int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk, |
80b28791 | 149 | struct reset_control *rst); |
9d4450ae | 150 | |
21b49910 LD |
151 | int tegra_io_pad_power_enable(enum tegra_io_pad id); |
152 | int tegra_io_pad_power_disable(enum tegra_io_pad id); | |
153 | int tegra_io_pad_set_voltage(enum tegra_io_pad id, | |
154 | enum tegra_io_pad_voltage voltage); | |
155 | int tegra_io_pad_get_voltage(enum tegra_io_pad id); | |
156 | ||
157 | /* deprecated, use tegra_io_pad_power_{enable,disable}() instead */ | |
70293ed0 JH |
158 | int tegra_io_rail_power_on(unsigned int id); |
159 | int tegra_io_rail_power_off(unsigned int id); | |
bd737038 AB |
160 | |
161 | enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); | |
162 | void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); | |
163 | void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); | |
164 | ||
9886e1fd | 165 | #else |
70293ed0 | 166 | static inline int tegra_powergate_is_powered(unsigned int id) |
9886e1fd TR |
167 | { |
168 | return -ENOSYS; | |
169 | } | |
170 | ||
70293ed0 | 171 | static inline int tegra_powergate_power_on(unsigned int id) |
9886e1fd TR |
172 | { |
173 | return -ENOSYS; | |
174 | } | |
175 | ||
70293ed0 | 176 | static inline int tegra_powergate_power_off(unsigned int id) |
9886e1fd TR |
177 | { |
178 | return -ENOSYS; | |
179 | } | |
180 | ||
70293ed0 | 181 | static inline int tegra_powergate_remove_clamping(unsigned int id) |
9886e1fd TR |
182 | { |
183 | return -ENOSYS; | |
184 | } | |
185 | ||
70293ed0 JH |
186 | static inline int tegra_powergate_sequence_power_up(unsigned int id, |
187 | struct clk *clk, | |
f53f4159 | 188 | struct reset_control *rst) |
9886e1fd TR |
189 | { |
190 | return -ENOSYS; | |
191 | } | |
9d4450ae | 192 | |
21b49910 LD |
193 | static inline int tegra_io_pad_power_enable(enum tegra_io_pad id) |
194 | { | |
195 | return -ENOSYS; | |
196 | } | |
197 | ||
198 | static inline int tegra_io_pad_power_disable(enum tegra_io_pad id) | |
199 | { | |
200 | return -ENOSYS; | |
201 | } | |
202 | ||
203 | static inline int tegra_io_pad_set_voltage(enum tegra_io_pad id, | |
204 | enum tegra_io_pad_voltage voltage) | |
205 | { | |
206 | return -ENOSYS; | |
207 | } | |
208 | ||
209 | static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id) | |
210 | { | |
211 | return -ENOSYS; | |
212 | } | |
213 | ||
70293ed0 | 214 | static inline int tegra_io_rail_power_on(unsigned int id) |
9d4450ae TR |
215 | { |
216 | return -ENOSYS; | |
217 | } | |
218 | ||
70293ed0 | 219 | static inline int tegra_io_rail_power_off(unsigned int id) |
9d4450ae TR |
220 | { |
221 | return -ENOSYS; | |
222 | } | |
bd737038 AB |
223 | |
224 | static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void) | |
225 | { | |
226 | return TEGRA_SUSPEND_NONE; | |
227 | } | |
228 | ||
229 | static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode) | |
230 | { | |
231 | } | |
232 | ||
233 | static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode) | |
234 | { | |
235 | } | |
236 | ||
237 | #endif /* CONFIG_SOC_TEGRA_PMC */ | |
ce1e3262 | 238 | |
7232398a | 239 | #endif /* __SOC_TEGRA_PMC_H__ */ |