xref: /linux/include/soc/tegra/pmc.h (revision c2fe4694d8ac0f997f6d7088437b710fc4e4a185)
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_PM_SLEEP
307232398aSThierry Reding enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
317232398aSThierry Reding void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
327232398aSThierry Reding void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
337232398aSThierry Reding #endif /* CONFIG_PM_SLEEP */
347232398aSThierry Reding 
357232398aSThierry Reding #ifdef CONFIG_SMP
367232398aSThierry Reding bool tegra_pmc_cpu_is_powered(int cpuid);
377232398aSThierry Reding int tegra_pmc_cpu_power_on(int cpuid);
387232398aSThierry Reding int tegra_pmc_cpu_remove_clamping(int cpuid);
397232398aSThierry Reding #endif /* CONFIG_SMP */
407232398aSThierry Reding 
417232398aSThierry Reding /*
427232398aSThierry Reding  * powergate and I/O rail APIs
437232398aSThierry Reding  */
447232398aSThierry Reding 
457232398aSThierry Reding #define TEGRA_POWERGATE_CPU	0
467232398aSThierry Reding #define TEGRA_POWERGATE_3D	1
477232398aSThierry Reding #define TEGRA_POWERGATE_VENC	2
487232398aSThierry Reding #define TEGRA_POWERGATE_PCIE	3
497232398aSThierry Reding #define TEGRA_POWERGATE_VDEC	4
507232398aSThierry Reding #define TEGRA_POWERGATE_L2	5
517232398aSThierry Reding #define TEGRA_POWERGATE_MPE	6
527232398aSThierry Reding #define TEGRA_POWERGATE_HEG	7
537232398aSThierry Reding #define TEGRA_POWERGATE_SATA	8
547232398aSThierry Reding #define TEGRA_POWERGATE_CPU1	9
557232398aSThierry Reding #define TEGRA_POWERGATE_CPU2	10
567232398aSThierry Reding #define TEGRA_POWERGATE_CPU3	11
577232398aSThierry Reding #define TEGRA_POWERGATE_CELP	12
587232398aSThierry Reding #define TEGRA_POWERGATE_3D1	13
597232398aSThierry Reding #define TEGRA_POWERGATE_CPU0	14
607232398aSThierry Reding #define TEGRA_POWERGATE_C0NC	15
617232398aSThierry Reding #define TEGRA_POWERGATE_C1NC	16
627232398aSThierry Reding #define TEGRA_POWERGATE_SOR	17
637232398aSThierry Reding #define TEGRA_POWERGATE_DIS	18
647232398aSThierry Reding #define TEGRA_POWERGATE_DISB	19
657232398aSThierry Reding #define TEGRA_POWERGATE_XUSBA	20
667232398aSThierry Reding #define TEGRA_POWERGATE_XUSBB	21
677232398aSThierry Reding #define TEGRA_POWERGATE_XUSBC	22
687232398aSThierry Reding #define TEGRA_POWERGATE_VIC	23
697232398aSThierry Reding #define TEGRA_POWERGATE_IRAM	24
70*c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVDEC	25
71*c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVJPG	26
72*c2fe4694SThierry Reding #define TEGRA_POWERGATE_AUD	27
73*c2fe4694SThierry Reding #define TEGRA_POWERGATE_DFD	28
74*c2fe4694SThierry Reding #define TEGRA_POWERGATE_VE2	29
757232398aSThierry Reding 
767232398aSThierry Reding #define TEGRA_POWERGATE_3D0	TEGRA_POWERGATE_3D
777232398aSThierry Reding 
787232398aSThierry Reding #define TEGRA_IO_RAIL_CSIA	0
797232398aSThierry Reding #define TEGRA_IO_RAIL_CSIB	1
807232398aSThierry Reding #define TEGRA_IO_RAIL_DSI	2
817232398aSThierry Reding #define TEGRA_IO_RAIL_MIPI_BIAS	3
827232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_BIAS	4
837232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CLK1	5
847232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CLK2	6
857232398aSThierry Reding #define TEGRA_IO_RAIL_USB0	9
867232398aSThierry Reding #define TEGRA_IO_RAIL_USB1	10
877232398aSThierry Reding #define TEGRA_IO_RAIL_USB2	11
887232398aSThierry Reding #define TEGRA_IO_RAIL_USB_BIAS	12
897232398aSThierry Reding #define TEGRA_IO_RAIL_NAND	13
907232398aSThierry Reding #define TEGRA_IO_RAIL_UART	14
917232398aSThierry Reding #define TEGRA_IO_RAIL_BB	15
927232398aSThierry Reding #define TEGRA_IO_RAIL_AUDIO	17
937232398aSThierry Reding #define TEGRA_IO_RAIL_HSIC	19
947232398aSThierry Reding #define TEGRA_IO_RAIL_COMP	22
957232398aSThierry Reding #define TEGRA_IO_RAIL_HDMI	28
967232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CNTRL	32
977232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC1	33
987232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC3	34
997232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC4	35
1007232398aSThierry Reding #define TEGRA_IO_RAIL_CAM	36
1017232398aSThierry Reding #define TEGRA_IO_RAIL_RES	37
1027232398aSThierry Reding #define TEGRA_IO_RAIL_HV	38
1037232398aSThierry Reding #define TEGRA_IO_RAIL_DSIB	39
1047232398aSThierry Reding #define TEGRA_IO_RAIL_DSIC	40
1057232398aSThierry Reding #define TEGRA_IO_RAIL_DSID	41
1067232398aSThierry Reding #define TEGRA_IO_RAIL_CSIE	44
1077232398aSThierry Reding #define TEGRA_IO_RAIL_LVDS	57
1087232398aSThierry Reding #define TEGRA_IO_RAIL_SYS_DDC	58
1097232398aSThierry Reding 
1107232398aSThierry Reding #ifdef CONFIG_ARCH_TEGRA
1117232398aSThierry Reding int tegra_powergate_is_powered(int id);
1127232398aSThierry Reding int tegra_powergate_power_on(int id);
1137232398aSThierry Reding int tegra_powergate_power_off(int id);
1147232398aSThierry Reding int tegra_powergate_remove_clamping(int id);
1157232398aSThierry Reding 
1167232398aSThierry Reding /* Must be called with clk disabled, and returns with clk enabled */
1177232398aSThierry Reding int tegra_powergate_sequence_power_up(int id, struct clk *clk,
1187232398aSThierry Reding 				      struct reset_control *rst);
1197232398aSThierry Reding 
1207232398aSThierry Reding int tegra_io_rail_power_on(int id);
1217232398aSThierry Reding int tegra_io_rail_power_off(int id);
1227232398aSThierry Reding #else
1237232398aSThierry Reding static inline int tegra_powergate_is_powered(int id)
1247232398aSThierry Reding {
1257232398aSThierry Reding 	return -ENOSYS;
1267232398aSThierry Reding }
1277232398aSThierry Reding 
1287232398aSThierry Reding static inline int tegra_powergate_power_on(int id)
1297232398aSThierry Reding {
1307232398aSThierry Reding 	return -ENOSYS;
1317232398aSThierry Reding }
1327232398aSThierry Reding 
1337232398aSThierry Reding static inline int tegra_powergate_power_off(int id)
1347232398aSThierry Reding {
1357232398aSThierry Reding 	return -ENOSYS;
1367232398aSThierry Reding }
1377232398aSThierry Reding 
1387232398aSThierry Reding static inline int tegra_powergate_remove_clamping(int id)
1397232398aSThierry Reding {
1407232398aSThierry Reding 	return -ENOSYS;
1417232398aSThierry Reding }
1427232398aSThierry Reding 
1437232398aSThierry Reding static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk,
1447232398aSThierry Reding 						    struct reset_control *rst)
1457232398aSThierry Reding {
1467232398aSThierry Reding 	return -ENOSYS;
1477232398aSThierry Reding }
1487232398aSThierry Reding 
1497232398aSThierry Reding static inline int tegra_io_rail_power_on(int id)
1507232398aSThierry Reding {
1517232398aSThierry Reding 	return -ENOSYS;
1527232398aSThierry Reding }
1537232398aSThierry Reding 
1547232398aSThierry Reding static inline int tegra_io_rail_power_off(int id)
1557232398aSThierry Reding {
1567232398aSThierry Reding 	return -ENOSYS;
1577232398aSThierry Reding }
1587232398aSThierry Reding #endif /* CONFIG_ARCH_TEGRA */
1597232398aSThierry Reding 
1607232398aSThierry Reding #endif /* __SOC_TEGRA_PMC_H__ */
161