1*7232398aSThierry Reding /* 2*7232398aSThierry Reding * Copyright (c) 2010 Google, Inc 3*7232398aSThierry Reding * Copyright (c) 2014 NVIDIA Corporation 4*7232398aSThierry Reding * 5*7232398aSThierry Reding * Author: 6*7232398aSThierry Reding * Colin Cross <ccross@google.com> 7*7232398aSThierry Reding * 8*7232398aSThierry Reding * This software is licensed under the terms of the GNU General Public 9*7232398aSThierry Reding * License version 2, as published by the Free Software Foundation, and 10*7232398aSThierry Reding * may be copied, distributed, and modified under those terms. 11*7232398aSThierry Reding * 12*7232398aSThierry Reding * This program is distributed in the hope that it will be useful, 13*7232398aSThierry Reding * but WITHOUT ANY WARRANTY; without even the implied warranty of 14*7232398aSThierry Reding * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*7232398aSThierry Reding * GNU General Public License for more details. 16*7232398aSThierry Reding * 17*7232398aSThierry Reding */ 18*7232398aSThierry Reding 19*7232398aSThierry Reding #ifndef __SOC_TEGRA_PMC_H__ 20*7232398aSThierry Reding #define __SOC_TEGRA_PMC_H__ 21*7232398aSThierry Reding 22*7232398aSThierry Reding #include <linux/reboot.h> 23*7232398aSThierry Reding 24*7232398aSThierry Reding #include <soc/tegra/pm.h> 25*7232398aSThierry Reding 26*7232398aSThierry Reding struct clk; 27*7232398aSThierry Reding struct reset_control; 28*7232398aSThierry Reding 29*7232398aSThierry Reding void tegra_pmc_restart(enum reboot_mode mode, const char *cmd); 30*7232398aSThierry Reding 31*7232398aSThierry Reding #ifdef CONFIG_PM_SLEEP 32*7232398aSThierry Reding enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); 33*7232398aSThierry Reding void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); 34*7232398aSThierry Reding void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); 35*7232398aSThierry Reding #endif /* CONFIG_PM_SLEEP */ 36*7232398aSThierry Reding 37*7232398aSThierry Reding #ifdef CONFIG_SMP 38*7232398aSThierry Reding bool tegra_pmc_cpu_is_powered(int cpuid); 39*7232398aSThierry Reding int tegra_pmc_cpu_power_on(int cpuid); 40*7232398aSThierry Reding int tegra_pmc_cpu_remove_clamping(int cpuid); 41*7232398aSThierry Reding #endif /* CONFIG_SMP */ 42*7232398aSThierry Reding 43*7232398aSThierry Reding /* 44*7232398aSThierry Reding * powergate and I/O rail APIs 45*7232398aSThierry Reding */ 46*7232398aSThierry Reding 47*7232398aSThierry Reding #define TEGRA_POWERGATE_CPU 0 48*7232398aSThierry Reding #define TEGRA_POWERGATE_3D 1 49*7232398aSThierry Reding #define TEGRA_POWERGATE_VENC 2 50*7232398aSThierry Reding #define TEGRA_POWERGATE_PCIE 3 51*7232398aSThierry Reding #define TEGRA_POWERGATE_VDEC 4 52*7232398aSThierry Reding #define TEGRA_POWERGATE_L2 5 53*7232398aSThierry Reding #define TEGRA_POWERGATE_MPE 6 54*7232398aSThierry Reding #define TEGRA_POWERGATE_HEG 7 55*7232398aSThierry Reding #define TEGRA_POWERGATE_SATA 8 56*7232398aSThierry Reding #define TEGRA_POWERGATE_CPU1 9 57*7232398aSThierry Reding #define TEGRA_POWERGATE_CPU2 10 58*7232398aSThierry Reding #define TEGRA_POWERGATE_CPU3 11 59*7232398aSThierry Reding #define TEGRA_POWERGATE_CELP 12 60*7232398aSThierry Reding #define TEGRA_POWERGATE_3D1 13 61*7232398aSThierry Reding #define TEGRA_POWERGATE_CPU0 14 62*7232398aSThierry Reding #define TEGRA_POWERGATE_C0NC 15 63*7232398aSThierry Reding #define TEGRA_POWERGATE_C1NC 16 64*7232398aSThierry Reding #define TEGRA_POWERGATE_SOR 17 65*7232398aSThierry Reding #define TEGRA_POWERGATE_DIS 18 66*7232398aSThierry Reding #define TEGRA_POWERGATE_DISB 19 67*7232398aSThierry Reding #define TEGRA_POWERGATE_XUSBA 20 68*7232398aSThierry Reding #define TEGRA_POWERGATE_XUSBB 21 69*7232398aSThierry Reding #define TEGRA_POWERGATE_XUSBC 22 70*7232398aSThierry Reding #define TEGRA_POWERGATE_VIC 23 71*7232398aSThierry Reding #define TEGRA_POWERGATE_IRAM 24 72*7232398aSThierry Reding 73*7232398aSThierry Reding #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D 74*7232398aSThierry Reding 75*7232398aSThierry Reding #define TEGRA_IO_RAIL_CSIA 0 76*7232398aSThierry Reding #define TEGRA_IO_RAIL_CSIB 1 77*7232398aSThierry Reding #define TEGRA_IO_RAIL_DSI 2 78*7232398aSThierry Reding #define TEGRA_IO_RAIL_MIPI_BIAS 3 79*7232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_BIAS 4 80*7232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CLK1 5 81*7232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CLK2 6 82*7232398aSThierry Reding #define TEGRA_IO_RAIL_USB0 9 83*7232398aSThierry Reding #define TEGRA_IO_RAIL_USB1 10 84*7232398aSThierry Reding #define TEGRA_IO_RAIL_USB2 11 85*7232398aSThierry Reding #define TEGRA_IO_RAIL_USB_BIAS 12 86*7232398aSThierry Reding #define TEGRA_IO_RAIL_NAND 13 87*7232398aSThierry Reding #define TEGRA_IO_RAIL_UART 14 88*7232398aSThierry Reding #define TEGRA_IO_RAIL_BB 15 89*7232398aSThierry Reding #define TEGRA_IO_RAIL_AUDIO 17 90*7232398aSThierry Reding #define TEGRA_IO_RAIL_HSIC 19 91*7232398aSThierry Reding #define TEGRA_IO_RAIL_COMP 22 92*7232398aSThierry Reding #define TEGRA_IO_RAIL_HDMI 28 93*7232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CNTRL 32 94*7232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC1 33 95*7232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC3 34 96*7232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC4 35 97*7232398aSThierry Reding #define TEGRA_IO_RAIL_CAM 36 98*7232398aSThierry Reding #define TEGRA_IO_RAIL_RES 37 99*7232398aSThierry Reding #define TEGRA_IO_RAIL_HV 38 100*7232398aSThierry Reding #define TEGRA_IO_RAIL_DSIB 39 101*7232398aSThierry Reding #define TEGRA_IO_RAIL_DSIC 40 102*7232398aSThierry Reding #define TEGRA_IO_RAIL_DSID 41 103*7232398aSThierry Reding #define TEGRA_IO_RAIL_CSIE 44 104*7232398aSThierry Reding #define TEGRA_IO_RAIL_LVDS 57 105*7232398aSThierry Reding #define TEGRA_IO_RAIL_SYS_DDC 58 106*7232398aSThierry Reding 107*7232398aSThierry Reding #ifdef CONFIG_ARCH_TEGRA 108*7232398aSThierry Reding int tegra_powergate_is_powered(int id); 109*7232398aSThierry Reding int tegra_powergate_power_on(int id); 110*7232398aSThierry Reding int tegra_powergate_power_off(int id); 111*7232398aSThierry Reding int tegra_powergate_remove_clamping(int id); 112*7232398aSThierry Reding 113*7232398aSThierry Reding /* Must be called with clk disabled, and returns with clk enabled */ 114*7232398aSThierry Reding int tegra_powergate_sequence_power_up(int id, struct clk *clk, 115*7232398aSThierry Reding struct reset_control *rst); 116*7232398aSThierry Reding 117*7232398aSThierry Reding int tegra_io_rail_power_on(int id); 118*7232398aSThierry Reding int tegra_io_rail_power_off(int id); 119*7232398aSThierry Reding #else 120*7232398aSThierry Reding static inline int tegra_powergate_is_powered(int id) 121*7232398aSThierry Reding { 122*7232398aSThierry Reding return -ENOSYS; 123*7232398aSThierry Reding } 124*7232398aSThierry Reding 125*7232398aSThierry Reding static inline int tegra_powergate_power_on(int id) 126*7232398aSThierry Reding { 127*7232398aSThierry Reding return -ENOSYS; 128*7232398aSThierry Reding } 129*7232398aSThierry Reding 130*7232398aSThierry Reding static inline int tegra_powergate_power_off(int id) 131*7232398aSThierry Reding { 132*7232398aSThierry Reding return -ENOSYS; 133*7232398aSThierry Reding } 134*7232398aSThierry Reding 135*7232398aSThierry Reding static inline int tegra_powergate_remove_clamping(int id) 136*7232398aSThierry Reding { 137*7232398aSThierry Reding return -ENOSYS; 138*7232398aSThierry Reding } 139*7232398aSThierry Reding 140*7232398aSThierry Reding static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk, 141*7232398aSThierry Reding struct reset_control *rst) 142*7232398aSThierry Reding { 143*7232398aSThierry Reding return -ENOSYS; 144*7232398aSThierry Reding } 145*7232398aSThierry Reding 146*7232398aSThierry Reding static inline int tegra_io_rail_power_on(int id) 147*7232398aSThierry Reding { 148*7232398aSThierry Reding return -ENOSYS; 149*7232398aSThierry Reding } 150*7232398aSThierry Reding 151*7232398aSThierry Reding static inline int tegra_io_rail_power_off(int id) 152*7232398aSThierry Reding { 153*7232398aSThierry Reding return -ENOSYS; 154*7232398aSThierry Reding } 155*7232398aSThierry Reding #endif /* CONFIG_ARCH_TEGRA */ 156*7232398aSThierry Reding 157*7232398aSThierry Reding #endif /* __SOC_TEGRA_PMC_H__ */ 158