1 /* SPDX-License-Identifier: GPL-2.0-only */ << 2 /* 1 /* 3 * Copyright (c) 2010 Google, Inc 2 * Copyright (c) 2010 Google, Inc 4 * Copyright (c) 2014 NVIDIA Corporation 3 * Copyright (c) 2014 NVIDIA Corporation 5 * 4 * 6 * Author: 5 * Author: 7 * Colin Cross <ccross@google.com> 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 * 8 */ 17 */ 9 18 10 #ifndef __SOC_TEGRA_PMC_H__ 19 #ifndef __SOC_TEGRA_PMC_H__ 11 #define __SOC_TEGRA_PMC_H__ 20 #define __SOC_TEGRA_PMC_H__ 12 21 13 #include <linux/reboot.h> 22 #include <linux/reboot.h> 14 23 15 #include <soc/tegra/pm.h> 24 #include <soc/tegra/pm.h> 16 25 17 struct clk; 26 struct clk; 18 struct reset_control; 27 struct reset_control; 19 28 20 bool tegra_pmc_cpu_is_powered(unsigned int cpu 29 bool tegra_pmc_cpu_is_powered(unsigned int cpuid); 21 int tegra_pmc_cpu_power_on(unsigned int cpuid) 30 int tegra_pmc_cpu_power_on(unsigned int cpuid); 22 int tegra_pmc_cpu_remove_clamping(unsigned int 31 int tegra_pmc_cpu_remove_clamping(unsigned int cpuid); 23 32 24 /* 33 /* 25 * powergate and I/O rail APIs 34 * powergate and I/O rail APIs 26 */ 35 */ 27 36 28 #define TEGRA_POWERGATE_CPU 0 37 #define TEGRA_POWERGATE_CPU 0 29 #define TEGRA_POWERGATE_3D 1 38 #define TEGRA_POWERGATE_3D 1 30 #define TEGRA_POWERGATE_VENC 2 39 #define TEGRA_POWERGATE_VENC 2 31 #define TEGRA_POWERGATE_PCIE 3 40 #define TEGRA_POWERGATE_PCIE 3 32 #define TEGRA_POWERGATE_VDEC 4 41 #define TEGRA_POWERGATE_VDEC 4 33 #define TEGRA_POWERGATE_L2 5 42 #define TEGRA_POWERGATE_L2 5 34 #define TEGRA_POWERGATE_MPE 6 43 #define TEGRA_POWERGATE_MPE 6 35 #define TEGRA_POWERGATE_HEG 7 44 #define TEGRA_POWERGATE_HEG 7 36 #define TEGRA_POWERGATE_SATA 8 45 #define TEGRA_POWERGATE_SATA 8 37 #define TEGRA_POWERGATE_CPU1 9 46 #define TEGRA_POWERGATE_CPU1 9 38 #define TEGRA_POWERGATE_CPU2 10 47 #define TEGRA_POWERGATE_CPU2 10 39 #define TEGRA_POWERGATE_CPU3 11 48 #define TEGRA_POWERGATE_CPU3 11 40 #define TEGRA_POWERGATE_CELP 12 49 #define TEGRA_POWERGATE_CELP 12 41 #define TEGRA_POWERGATE_3D1 13 50 #define TEGRA_POWERGATE_3D1 13 42 #define TEGRA_POWERGATE_CPU0 14 51 #define TEGRA_POWERGATE_CPU0 14 43 #define TEGRA_POWERGATE_C0NC 15 52 #define TEGRA_POWERGATE_C0NC 15 44 #define TEGRA_POWERGATE_C1NC 16 53 #define TEGRA_POWERGATE_C1NC 16 45 #define TEGRA_POWERGATE_SOR 17 54 #define TEGRA_POWERGATE_SOR 17 46 #define TEGRA_POWERGATE_DIS 18 55 #define TEGRA_POWERGATE_DIS 18 47 #define TEGRA_POWERGATE_DISB 19 56 #define TEGRA_POWERGATE_DISB 19 48 #define TEGRA_POWERGATE_XUSBA 20 57 #define TEGRA_POWERGATE_XUSBA 20 49 #define TEGRA_POWERGATE_XUSBB 21 58 #define TEGRA_POWERGATE_XUSBB 21 50 #define TEGRA_POWERGATE_XUSBC 22 59 #define TEGRA_POWERGATE_XUSBC 22 51 #define TEGRA_POWERGATE_VIC 23 60 #define TEGRA_POWERGATE_VIC 23 52 #define TEGRA_POWERGATE_IRAM 24 61 #define TEGRA_POWERGATE_IRAM 24 53 #define TEGRA_POWERGATE_NVDEC 25 62 #define TEGRA_POWERGATE_NVDEC 25 54 #define TEGRA_POWERGATE_NVJPG 26 63 #define TEGRA_POWERGATE_NVJPG 26 55 #define TEGRA_POWERGATE_AUD 27 64 #define TEGRA_POWERGATE_AUD 27 56 #define TEGRA_POWERGATE_DFD 28 65 #define TEGRA_POWERGATE_DFD 28 57 #define TEGRA_POWERGATE_VE2 29 66 #define TEGRA_POWERGATE_VE2 29 58 #define TEGRA_POWERGATE_MAX TEGRA_POWERGAT 67 #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2 59 68 60 #define TEGRA_POWERGATE_3D0 TEGRA_POWERGAT 69 #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D 61 70 62 /** 71 /** 63 * enum tegra_io_pad - I/O pad group identifie 72 * enum tegra_io_pad - I/O pad group identifier 64 * 73 * 65 * I/O pins on Tegra SoCs are grouped into so- 74 * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad 66 * can be used to control the common voltage s 75 * can be used to control the common voltage signal level and power state of 67 * the pins of the given pad. 76 * the pins of the given pad. 68 */ 77 */ 69 enum tegra_io_pad { 78 enum tegra_io_pad { 70 TEGRA_IO_PAD_AUDIO, 79 TEGRA_IO_PAD_AUDIO, 71 TEGRA_IO_PAD_AUDIO_HV, 80 TEGRA_IO_PAD_AUDIO_HV, 72 TEGRA_IO_PAD_BB, 81 TEGRA_IO_PAD_BB, 73 TEGRA_IO_PAD_CAM, 82 TEGRA_IO_PAD_CAM, 74 TEGRA_IO_PAD_COMP, 83 TEGRA_IO_PAD_COMP, 75 TEGRA_IO_PAD_CONN, 84 TEGRA_IO_PAD_CONN, 76 TEGRA_IO_PAD_CSIA, 85 TEGRA_IO_PAD_CSIA, 77 TEGRA_IO_PAD_CSIB, 86 TEGRA_IO_PAD_CSIB, 78 TEGRA_IO_PAD_CSIC, 87 TEGRA_IO_PAD_CSIC, 79 TEGRA_IO_PAD_CSID, 88 TEGRA_IO_PAD_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132 TEGRA_IO_PAD_PWR_CTL, 125 TEGRA_IO_PAD_SDMMC1, 133 TEGRA_IO_PAD_SDMMC1, 126 TEGRA_IO_PAD_SDMMC1_HV, 134 TEGRA_IO_PAD_SDMMC1_HV, 127 TEGRA_IO_PAD_SDMMC2, 135 TEGRA_IO_PAD_SDMMC2, 128 TEGRA_IO_PAD_SDMMC2_HV, 136 TEGRA_IO_PAD_SDMMC2_HV, 129 TEGRA_IO_PAD_SDMMC3, 137 TEGRA_IO_PAD_SDMMC3, 130 TEGRA_IO_PAD_SDMMC3_HV, 138 TEGRA_IO_PAD_SDMMC3_HV, 131 TEGRA_IO_PAD_SDMMC4, 139 TEGRA_IO_PAD_SDMMC4, 132 TEGRA_IO_PAD_SOC_GPIO10, 140 TEGRA_IO_PAD_SOC_GPIO10, 133 TEGRA_IO_PAD_SOC_GPIO12, 141 TEGRA_IO_PAD_SOC_GPIO12, 134 TEGRA_IO_PAD_SOC_GPIO13, 142 TEGRA_IO_PAD_SOC_GPIO13, 135 TEGRA_IO_PAD_SOC_GPIO53, 143 TEGRA_IO_PAD_SOC_GPIO53, 136 TEGRA_IO_PAD_SPI, 144 TEGRA_IO_PAD_SPI, 137 TEGRA_IO_PAD_SPI_HV, 145 TEGRA_IO_PAD_SPI_HV, 138 TEGRA_IO_PAD_SYS_DDC, 146 TEGRA_IO_PAD_SYS_DDC, 139 TEGRA_IO_PAD_UART, 147 TEGRA_IO_PAD_UART, 140 TEGRA_IO_PAD_UART4, 148 TEGRA_IO_PAD_UART4, 141 TEGRA_IO_PAD_UART5, 149 TEGRA_IO_PAD_UART5, 142 TEGRA_IO_PAD_UFS, 150 TEGRA_IO_PAD_UFS, 143 TEGRA_IO_PAD_USB0, 151 TEGRA_IO_PAD_USB0, 144 TEGRA_IO_PAD_USB1, 152 TEGRA_IO_PAD_USB1, 145 TEGRA_IO_PAD_USB2, 153 TEGRA_IO_PAD_USB2, 146 TEGRA_IO_PAD_USB3, 154 TEGRA_IO_PAD_USB3, 147 TEGRA_IO_PAD_USB_BIAS, 155 TEGRA_IO_PAD_USB_BIAS, 148 TEGRA_IO_PAD_AO_HV, 156 TEGRA_IO_PAD_AO_HV, 149 }; 157 }; 150 158 >> 159 /* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */ >> 160 #define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI >> 161 #define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS >> 162 151 #ifdef CONFIG_SOC_TEGRA_PMC 163 #ifdef CONFIG_SOC_TEGRA_PMC >> 164 int tegra_powergate_is_powered(unsigned int id); 152 int tegra_powergate_power_on(unsigned int id); 165 int tegra_powergate_power_on(unsigned int id); 153 int tegra_powergate_power_off(unsigned int id) 166 int tegra_powergate_power_off(unsigned int id); 154 int tegra_powergate_remove_clamping(unsigned i 167 int tegra_powergate_remove_clamping(unsigned int id); 155 168 156 /* Must be called with clk disabled, and retur 169 /* Must be called with clk disabled, and returns with clk enabled */ 157 int tegra_powergate_sequence_power_up(unsigned 170 int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk, 158 struct r 171 struct reset_control *rst); 159 172 160 int tegra_io_pad_power_enable(enum tegra_io_pa 173 int tegra_io_pad_power_enable(enum tegra_io_pad id); 161 int tegra_io_pad_power_disable(enum tegra_io_p 174 int tegra_io_pad_power_disable(enum tegra_io_pad id); 162 175 >> 176 /* deprecated, use tegra_io_pad_power_{enable,disable}() instead */ >> 177 int tegra_io_rail_power_on(unsigned int id); >> 178 int tegra_io_rail_power_off(unsigned int id); >> 179 >> 180 enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); 163 void tegra_pmc_set_suspend_mode(enum tegra_sus 181 void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); 164 void tegra_pmc_enter_suspend_mode(enum tegra_s 182 void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); 165 183 166 bool tegra_pmc_core_domain_state_synced(void); << 167 << 168 #else 184 #else >> 185 static inline int tegra_powergate_is_powered(unsigned int id) >> 186 { >> 187 return -ENOSYS; >> 188 } >> 189 169 static inline int tegra_powergate_power_on(uns 190 static inline int tegra_powergate_power_on(unsigned int id) 170 { 191 { 171 return -ENOSYS; 192 return -ENOSYS; 172 } 193 } 173 194 174 static inline int tegra_powergate_power_off(un 195 static inline int tegra_powergate_power_off(unsigned int id) 175 { 196 { 176 return -ENOSYS; 197 return -ENOSYS; 177 } 198 } 178 199 179 static inline int tegra_powergate_remove_clamp 200 static inline int tegra_powergate_remove_clamping(unsigned int id) 180 { 201 { 181 return -ENOSYS; 202 return -ENOSYS; 182 } 203 } 183 204 184 static inline int tegra_powergate_sequence_pow 205 static inline int tegra_powergate_sequence_power_up(unsigned int id, 185 206 struct clk *clk, 186 207 struct reset_control *rst) 187 { 208 { 188 return -ENOSYS; 209 return -ENOSYS; 189 } 210 } 190 211 191 static inline int tegra_io_pad_power_enable(en 212 static inline int tegra_io_pad_power_enable(enum tegra_io_pad id) 192 { 213 { 193 return -ENOSYS; 214 return -ENOSYS; 194 } 215 } 195 216 196 static inline int tegra_io_pad_power_disable(e 217 static inline int tegra_io_pad_power_disable(enum tegra_io_pad id) 197 { 218 { 198 return -ENOSYS; 219 return -ENOSYS; 199 } 220 } 200 221 201 static inline int tegra_io_pad_get_voltage(enu 222 static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id) 202 { 223 { 203 return -ENOSYS; 224 return -ENOSYS; 204 } 225 } 205 226 206 static inline void tegra_pmc_set_suspend_mode( !! 227 static inline int tegra_io_rail_power_on(unsigned int id) 207 { 228 { >> 229 return -ENOSYS; 208 } 230 } 209 231 210 static inline void tegra_pmc_enter_suspend_mod !! 232 static inline int tegra_io_rail_power_off(unsigned int id) 211 { 233 { >> 234 return -ENOSYS; 212 } 235 } 213 236 214 static inline bool tegra_pmc_core_domain_state !! 237 static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void) 215 { 238 { 216 return false; !! 239 return TEGRA_SUSPEND_NONE; 217 } 240 } 218 241 219 #endif /* CONFIG_SOC_TEGRA_PMC */ !! 242 static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode) >> 243 { >> 244 } 220 245 221 #if defined(CONFIG_SOC_TEGRA_PMC) && defined(C !! 246 static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode) 222 enum tegra_suspend_mode tegra_pmc_get_suspend_ << 223 #else << 224 static inline enum tegra_suspend_mode tegra_pm << 225 { 247 { 226 return TEGRA_SUSPEND_NONE; << 227 } 248 } 228 #endif !! 249 >> 250 #endif /* CONFIG_SOC_TEGRA_PMC */ 229 251 230 #endif /* __SOC_TEGRA_PMC_H__ */ 252 #endif /* __SOC_TEGRA_PMC_H__ */ 231 253
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.