xref: /linux/include/soc/tegra/pmc.h (revision bd737038d555468198495230f4233b9ba92e774c)
17232398aSThierry Reding /*
27232398aSThierry Reding  * Copyright (c) 2010 Google, Inc
37232398aSThierry Reding  * Copyright (c) 2014 NVIDIA Corporation
47232398aSThierry Reding  *
57232398aSThierry Reding  * Author:
67232398aSThierry Reding  *	Colin Cross <ccross@google.com>
77232398aSThierry Reding  *
87232398aSThierry Reding  * This software is licensed under the terms of the GNU General Public
97232398aSThierry Reding  * License version 2, as published by the Free Software Foundation, and
107232398aSThierry Reding  * may be copied, distributed, and modified under those terms.
117232398aSThierry Reding  *
127232398aSThierry Reding  * This program is distributed in the hope that it will be useful,
137232398aSThierry Reding  * but WITHOUT ANY WARRANTY; without even the implied warranty of
147232398aSThierry Reding  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
157232398aSThierry Reding  * GNU General Public License for more details.
167232398aSThierry Reding  *
177232398aSThierry Reding  */
187232398aSThierry Reding 
197232398aSThierry Reding #ifndef __SOC_TEGRA_PMC_H__
207232398aSThierry Reding #define __SOC_TEGRA_PMC_H__
217232398aSThierry Reding 
227232398aSThierry Reding #include <linux/reboot.h>
237232398aSThierry Reding 
247232398aSThierry Reding #include <soc/tegra/pm.h>
257232398aSThierry Reding 
267232398aSThierry Reding struct clk;
277232398aSThierry Reding struct reset_control;
287232398aSThierry Reding 
297232398aSThierry Reding #ifdef CONFIG_SMP
3070293ed0SJon Hunter bool tegra_pmc_cpu_is_powered(unsigned int cpuid);
3170293ed0SJon Hunter int tegra_pmc_cpu_power_on(unsigned int cpuid);
3270293ed0SJon Hunter int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);
337232398aSThierry Reding #endif /* CONFIG_SMP */
347232398aSThierry Reding 
357232398aSThierry Reding /*
367232398aSThierry Reding  * powergate and I/O rail APIs
377232398aSThierry Reding  */
387232398aSThierry Reding 
397232398aSThierry Reding #define TEGRA_POWERGATE_CPU	0
407232398aSThierry Reding #define TEGRA_POWERGATE_3D	1
417232398aSThierry Reding #define TEGRA_POWERGATE_VENC	2
427232398aSThierry Reding #define TEGRA_POWERGATE_PCIE	3
437232398aSThierry Reding #define TEGRA_POWERGATE_VDEC	4
447232398aSThierry Reding #define TEGRA_POWERGATE_L2	5
457232398aSThierry Reding #define TEGRA_POWERGATE_MPE	6
467232398aSThierry Reding #define TEGRA_POWERGATE_HEG	7
477232398aSThierry Reding #define TEGRA_POWERGATE_SATA	8
487232398aSThierry Reding #define TEGRA_POWERGATE_CPU1	9
497232398aSThierry Reding #define TEGRA_POWERGATE_CPU2	10
507232398aSThierry Reding #define TEGRA_POWERGATE_CPU3	11
517232398aSThierry Reding #define TEGRA_POWERGATE_CELP	12
527232398aSThierry Reding #define TEGRA_POWERGATE_3D1	13
537232398aSThierry Reding #define TEGRA_POWERGATE_CPU0	14
547232398aSThierry Reding #define TEGRA_POWERGATE_C0NC	15
557232398aSThierry Reding #define TEGRA_POWERGATE_C1NC	16
567232398aSThierry Reding #define TEGRA_POWERGATE_SOR	17
577232398aSThierry Reding #define TEGRA_POWERGATE_DIS	18
587232398aSThierry Reding #define TEGRA_POWERGATE_DISB	19
597232398aSThierry Reding #define TEGRA_POWERGATE_XUSBA	20
607232398aSThierry Reding #define TEGRA_POWERGATE_XUSBB	21
617232398aSThierry Reding #define TEGRA_POWERGATE_XUSBC	22
627232398aSThierry Reding #define TEGRA_POWERGATE_VIC	23
637232398aSThierry Reding #define TEGRA_POWERGATE_IRAM	24
64c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVDEC	25
65c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVJPG	26
66c2fe4694SThierry Reding #define TEGRA_POWERGATE_AUD	27
67c2fe4694SThierry Reding #define TEGRA_POWERGATE_DFD	28
68c2fe4694SThierry Reding #define TEGRA_POWERGATE_VE2	29
69a3804512SJon Hunter #define TEGRA_POWERGATE_MAX	TEGRA_POWERGATE_VE2
707232398aSThierry Reding 
717232398aSThierry Reding #define TEGRA_POWERGATE_3D0	TEGRA_POWERGATE_3D
727232398aSThierry Reding 
7321b49910SLaxman Dewangan /**
7421b49910SLaxman Dewangan  * enum tegra_io_pad - I/O pad group identifier
7521b49910SLaxman Dewangan  *
7621b49910SLaxman Dewangan  * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad
7721b49910SLaxman Dewangan  * can be used to control the common voltage signal level and power state of
7821b49910SLaxman Dewangan  * the pins of the given pad.
7921b49910SLaxman Dewangan  */
8021b49910SLaxman Dewangan enum tegra_io_pad {
8121b49910SLaxman Dewangan 	TEGRA_IO_PAD_AUDIO,
8221b49910SLaxman Dewangan 	TEGRA_IO_PAD_AUDIO_HV,
8321b49910SLaxman Dewangan 	TEGRA_IO_PAD_BB,
8421b49910SLaxman Dewangan 	TEGRA_IO_PAD_CAM,
8521b49910SLaxman Dewangan 	TEGRA_IO_PAD_COMP,
8621b49910SLaxman Dewangan 	TEGRA_IO_PAD_CSIA,
8721b49910SLaxman Dewangan 	TEGRA_IO_PAD_CSIB,
8821b49910SLaxman Dewangan 	TEGRA_IO_PAD_CSIC,
8921b49910SLaxman Dewangan 	TEGRA_IO_PAD_CSID,
9021b49910SLaxman Dewangan 	TEGRA_IO_PAD_CSIE,
9121b49910SLaxman Dewangan 	TEGRA_IO_PAD_CSIF,
9221b49910SLaxman Dewangan 	TEGRA_IO_PAD_DBG,
9321b49910SLaxman Dewangan 	TEGRA_IO_PAD_DEBUG_NONAO,
9421b49910SLaxman Dewangan 	TEGRA_IO_PAD_DMIC,
9521b49910SLaxman Dewangan 	TEGRA_IO_PAD_DP,
9621b49910SLaxman Dewangan 	TEGRA_IO_PAD_DSI,
9721b49910SLaxman Dewangan 	TEGRA_IO_PAD_DSIB,
9821b49910SLaxman Dewangan 	TEGRA_IO_PAD_DSIC,
9921b49910SLaxman Dewangan 	TEGRA_IO_PAD_DSID,
10021b49910SLaxman Dewangan 	TEGRA_IO_PAD_EMMC,
10121b49910SLaxman Dewangan 	TEGRA_IO_PAD_EMMC2,
10221b49910SLaxman Dewangan 	TEGRA_IO_PAD_GPIO,
10321b49910SLaxman Dewangan 	TEGRA_IO_PAD_HDMI,
10421b49910SLaxman Dewangan 	TEGRA_IO_PAD_HSIC,
10521b49910SLaxman Dewangan 	TEGRA_IO_PAD_HV,
10621b49910SLaxman Dewangan 	TEGRA_IO_PAD_LVDS,
10721b49910SLaxman Dewangan 	TEGRA_IO_PAD_MIPI_BIAS,
10821b49910SLaxman Dewangan 	TEGRA_IO_PAD_NAND,
10921b49910SLaxman Dewangan 	TEGRA_IO_PAD_PEX_BIAS,
11021b49910SLaxman Dewangan 	TEGRA_IO_PAD_PEX_CLK1,
11121b49910SLaxman Dewangan 	TEGRA_IO_PAD_PEX_CLK2,
11221b49910SLaxman Dewangan 	TEGRA_IO_PAD_PEX_CNTRL,
11321b49910SLaxman Dewangan 	TEGRA_IO_PAD_SDMMC1,
11421b49910SLaxman Dewangan 	TEGRA_IO_PAD_SDMMC3,
11521b49910SLaxman Dewangan 	TEGRA_IO_PAD_SDMMC4,
11621b49910SLaxman Dewangan 	TEGRA_IO_PAD_SPI,
11721b49910SLaxman Dewangan 	TEGRA_IO_PAD_SPI_HV,
11821b49910SLaxman Dewangan 	TEGRA_IO_PAD_SYS_DDC,
11921b49910SLaxman Dewangan 	TEGRA_IO_PAD_UART,
12021b49910SLaxman Dewangan 	TEGRA_IO_PAD_USB0,
12121b49910SLaxman Dewangan 	TEGRA_IO_PAD_USB1,
12221b49910SLaxman Dewangan 	TEGRA_IO_PAD_USB2,
12321b49910SLaxman Dewangan 	TEGRA_IO_PAD_USB3,
12421b49910SLaxman Dewangan 	TEGRA_IO_PAD_USB_BIAS,
12521b49910SLaxman Dewangan };
12621b49910SLaxman Dewangan 
12721b49910SLaxman Dewangan /* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */
12821b49910SLaxman Dewangan #define TEGRA_IO_RAIL_HDMI	TEGRA_IO_PAD_HDMI
12921b49910SLaxman Dewangan #define TEGRA_IO_RAIL_LVDS	TEGRA_IO_PAD_LVDS
13021b49910SLaxman Dewangan 
13121b49910SLaxman Dewangan /**
13221b49910SLaxman Dewangan  * enum tegra_io_pad_voltage - voltage level of the I/O pad's source rail
13321b49910SLaxman Dewangan  * @TEGRA_IO_PAD_1800000UV: 1.8 V
13421b49910SLaxman Dewangan  * @TEGRA_IO_PAD_3300000UV: 3.3 V
13521b49910SLaxman Dewangan  */
13621b49910SLaxman Dewangan enum tegra_io_pad_voltage {
13721b49910SLaxman Dewangan 	TEGRA_IO_PAD_1800000UV,
13821b49910SLaxman Dewangan 	TEGRA_IO_PAD_3300000UV,
13921b49910SLaxman Dewangan };
1407232398aSThierry Reding 
141*bd737038SArnd Bergmann #ifdef CONFIG_SOC_TEGRA_PMC
14270293ed0SJon Hunter int tegra_powergate_is_powered(unsigned int id);
14370293ed0SJon Hunter int tegra_powergate_power_on(unsigned int id);
14470293ed0SJon Hunter int tegra_powergate_power_off(unsigned int id);
14570293ed0SJon Hunter int tegra_powergate_remove_clamping(unsigned int id);
1467232398aSThierry Reding 
1477232398aSThierry Reding /* Must be called with clk disabled, and returns with clk enabled */
14870293ed0SJon Hunter int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
1497232398aSThierry Reding 				      struct reset_control *rst);
1507232398aSThierry Reding 
15121b49910SLaxman Dewangan int tegra_io_pad_power_enable(enum tegra_io_pad id);
15221b49910SLaxman Dewangan int tegra_io_pad_power_disable(enum tegra_io_pad id);
15321b49910SLaxman Dewangan int tegra_io_pad_set_voltage(enum tegra_io_pad id,
15421b49910SLaxman Dewangan 			     enum tegra_io_pad_voltage voltage);
15521b49910SLaxman Dewangan int tegra_io_pad_get_voltage(enum tegra_io_pad id);
15621b49910SLaxman Dewangan 
15721b49910SLaxman Dewangan /* deprecated, use tegra_io_pad_power_{enable,disable}() instead */
15870293ed0SJon Hunter int tegra_io_rail_power_on(unsigned int id);
15970293ed0SJon Hunter int tegra_io_rail_power_off(unsigned int id);
160*bd737038SArnd Bergmann 
161*bd737038SArnd Bergmann enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
162*bd737038SArnd Bergmann void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
163*bd737038SArnd Bergmann void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
164*bd737038SArnd Bergmann 
1657232398aSThierry Reding #else
16670293ed0SJon Hunter static inline int tegra_powergate_is_powered(unsigned int id)
1677232398aSThierry Reding {
1687232398aSThierry Reding 	return -ENOSYS;
1697232398aSThierry Reding }
1707232398aSThierry Reding 
17170293ed0SJon Hunter static inline int tegra_powergate_power_on(unsigned int id)
1727232398aSThierry Reding {
1737232398aSThierry Reding 	return -ENOSYS;
1747232398aSThierry Reding }
1757232398aSThierry Reding 
17670293ed0SJon Hunter static inline int tegra_powergate_power_off(unsigned int id)
1777232398aSThierry Reding {
1787232398aSThierry Reding 	return -ENOSYS;
1797232398aSThierry Reding }
1807232398aSThierry Reding 
18170293ed0SJon Hunter static inline int tegra_powergate_remove_clamping(unsigned int id)
1827232398aSThierry Reding {
1837232398aSThierry Reding 	return -ENOSYS;
1847232398aSThierry Reding }
1857232398aSThierry Reding 
18670293ed0SJon Hunter static inline int tegra_powergate_sequence_power_up(unsigned int id,
18770293ed0SJon Hunter 						    struct clk *clk,
1887232398aSThierry Reding 						    struct reset_control *rst)
1897232398aSThierry Reding {
1907232398aSThierry Reding 	return -ENOSYS;
1917232398aSThierry Reding }
1927232398aSThierry Reding 
19321b49910SLaxman Dewangan static inline int tegra_io_pad_power_enable(enum tegra_io_pad id)
19421b49910SLaxman Dewangan {
19521b49910SLaxman Dewangan 	return -ENOSYS;
19621b49910SLaxman Dewangan }
19721b49910SLaxman Dewangan 
19821b49910SLaxman Dewangan static inline int tegra_io_pad_power_disable(enum tegra_io_pad id)
19921b49910SLaxman Dewangan {
20021b49910SLaxman Dewangan 	return -ENOSYS;
20121b49910SLaxman Dewangan }
20221b49910SLaxman Dewangan 
20321b49910SLaxman Dewangan static inline int tegra_io_pad_set_voltage(enum tegra_io_pad id,
20421b49910SLaxman Dewangan 					   enum tegra_io_pad_voltage voltage)
20521b49910SLaxman Dewangan {
20621b49910SLaxman Dewangan 	return -ENOSYS;
20721b49910SLaxman Dewangan }
20821b49910SLaxman Dewangan 
20921b49910SLaxman Dewangan static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
21021b49910SLaxman Dewangan {
21121b49910SLaxman Dewangan 	return -ENOSYS;
21221b49910SLaxman Dewangan }
21321b49910SLaxman Dewangan 
21470293ed0SJon Hunter static inline int tegra_io_rail_power_on(unsigned int id)
2157232398aSThierry Reding {
2167232398aSThierry Reding 	return -ENOSYS;
2177232398aSThierry Reding }
2187232398aSThierry Reding 
21970293ed0SJon Hunter static inline int tegra_io_rail_power_off(unsigned int id)
2207232398aSThierry Reding {
2217232398aSThierry Reding 	return -ENOSYS;
2227232398aSThierry Reding }
223*bd737038SArnd Bergmann 
224*bd737038SArnd Bergmann static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
225*bd737038SArnd Bergmann {
226*bd737038SArnd Bergmann 	return TEGRA_SUSPEND_NONE;
227*bd737038SArnd Bergmann }
228*bd737038SArnd Bergmann 
229*bd737038SArnd Bergmann static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
230*bd737038SArnd Bergmann {
231*bd737038SArnd Bergmann }
232*bd737038SArnd Bergmann 
233*bd737038SArnd Bergmann static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode)
234*bd737038SArnd Bergmann {
235*bd737038SArnd Bergmann }
236*bd737038SArnd Bergmann 
237*bd737038SArnd Bergmann #endif /* CONFIG_SOC_TEGRA_PMC */
2387232398aSThierry Reding 
2397232398aSThierry Reding #endif /* __SOC_TEGRA_PMC_H__ */
240