0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __SOC_TEGRA_PMC_H__
0011 #define __SOC_TEGRA_PMC_H__
0012
0013 #include <linux/reboot.h>
0014
0015 #include <soc/tegra/pm.h>
0016
0017 struct clk;
0018 struct reset_control;
0019
0020 bool tegra_pmc_cpu_is_powered(unsigned int cpuid);
0021 int tegra_pmc_cpu_power_on(unsigned int cpuid);
0022 int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);
0023
0024
0025
0026
0027
0028 #define TEGRA_POWERGATE_CPU 0
0029 #define TEGRA_POWERGATE_3D 1
0030 #define TEGRA_POWERGATE_VENC 2
0031 #define TEGRA_POWERGATE_PCIE 3
0032 #define TEGRA_POWERGATE_VDEC 4
0033 #define TEGRA_POWERGATE_L2 5
0034 #define TEGRA_POWERGATE_MPE 6
0035 #define TEGRA_POWERGATE_HEG 7
0036 #define TEGRA_POWERGATE_SATA 8
0037 #define TEGRA_POWERGATE_CPU1 9
0038 #define TEGRA_POWERGATE_CPU2 10
0039 #define TEGRA_POWERGATE_CPU3 11
0040 #define TEGRA_POWERGATE_CELP 12
0041 #define TEGRA_POWERGATE_3D1 13
0042 #define TEGRA_POWERGATE_CPU0 14
0043 #define TEGRA_POWERGATE_C0NC 15
0044 #define TEGRA_POWERGATE_C1NC 16
0045 #define TEGRA_POWERGATE_SOR 17
0046 #define TEGRA_POWERGATE_DIS 18
0047 #define TEGRA_POWERGATE_DISB 19
0048 #define TEGRA_POWERGATE_XUSBA 20
0049 #define TEGRA_POWERGATE_XUSBB 21
0050 #define TEGRA_POWERGATE_XUSBC 22
0051 #define TEGRA_POWERGATE_VIC 23
0052 #define TEGRA_POWERGATE_IRAM 24
0053 #define TEGRA_POWERGATE_NVDEC 25
0054 #define TEGRA_POWERGATE_NVJPG 26
0055 #define TEGRA_POWERGATE_AUD 27
0056 #define TEGRA_POWERGATE_DFD 28
0057 #define TEGRA_POWERGATE_VE2 29
0058 #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2
0059
0060 #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
0061
0062
0063
0064
0065
0066
0067
0068
0069 enum tegra_io_pad {
0070 TEGRA_IO_PAD_AUDIO,
0071 TEGRA_IO_PAD_AUDIO_HV,
0072 TEGRA_IO_PAD_BB,
0073 TEGRA_IO_PAD_CAM,
0074 TEGRA_IO_PAD_COMP,
0075 TEGRA_IO_PAD_CONN,
0076 TEGRA_IO_PAD_CSIA,
0077 TEGRA_IO_PAD_CSIB,
0078 TEGRA_IO_PAD_CSIC,
0079 TEGRA_IO_PAD_CSID,
0080 TEGRA_IO_PAD_CSIE,
0081 TEGRA_IO_PAD_CSIF,
0082 TEGRA_IO_PAD_CSIG,
0083 TEGRA_IO_PAD_CSIH,
0084 TEGRA_IO_PAD_DAP3,
0085 TEGRA_IO_PAD_DAP5,
0086 TEGRA_IO_PAD_DBG,
0087 TEGRA_IO_PAD_DEBUG_NONAO,
0088 TEGRA_IO_PAD_DMIC,
0089 TEGRA_IO_PAD_DMIC_HV,
0090 TEGRA_IO_PAD_DP,
0091 TEGRA_IO_PAD_DSI,
0092 TEGRA_IO_PAD_DSIB,
0093 TEGRA_IO_PAD_DSIC,
0094 TEGRA_IO_PAD_DSID,
0095 TEGRA_IO_PAD_EDP,
0096 TEGRA_IO_PAD_EMMC,
0097 TEGRA_IO_PAD_EMMC2,
0098 TEGRA_IO_PAD_EQOS,
0099 TEGRA_IO_PAD_GPIO,
0100 TEGRA_IO_PAD_GP_PWM2,
0101 TEGRA_IO_PAD_GP_PWM3,
0102 TEGRA_IO_PAD_HDMI,
0103 TEGRA_IO_PAD_HDMI_DP0,
0104 TEGRA_IO_PAD_HDMI_DP1,
0105 TEGRA_IO_PAD_HDMI_DP2,
0106 TEGRA_IO_PAD_HDMI_DP3,
0107 TEGRA_IO_PAD_HSIC,
0108 TEGRA_IO_PAD_HV,
0109 TEGRA_IO_PAD_LVDS,
0110 TEGRA_IO_PAD_MIPI_BIAS,
0111 TEGRA_IO_PAD_NAND,
0112 TEGRA_IO_PAD_PEX_BIAS,
0113 TEGRA_IO_PAD_PEX_CLK_BIAS,
0114 TEGRA_IO_PAD_PEX_CLK1,
0115 TEGRA_IO_PAD_PEX_CLK2,
0116 TEGRA_IO_PAD_PEX_CLK3,
0117 TEGRA_IO_PAD_PEX_CLK_2_BIAS,
0118 TEGRA_IO_PAD_PEX_CLK_2,
0119 TEGRA_IO_PAD_PEX_CNTRL,
0120 TEGRA_IO_PAD_PEX_CTL2,
0121 TEGRA_IO_PAD_PEX_L0_RST_N,
0122 TEGRA_IO_PAD_PEX_L1_RST_N,
0123 TEGRA_IO_PAD_PEX_L5_RST_N,
0124 TEGRA_IO_PAD_PWR_CTL,
0125 TEGRA_IO_PAD_SDMMC1,
0126 TEGRA_IO_PAD_SDMMC1_HV,
0127 TEGRA_IO_PAD_SDMMC2,
0128 TEGRA_IO_PAD_SDMMC2_HV,
0129 TEGRA_IO_PAD_SDMMC3,
0130 TEGRA_IO_PAD_SDMMC3_HV,
0131 TEGRA_IO_PAD_SDMMC4,
0132 TEGRA_IO_PAD_SOC_GPIO10,
0133 TEGRA_IO_PAD_SOC_GPIO12,
0134 TEGRA_IO_PAD_SOC_GPIO13,
0135 TEGRA_IO_PAD_SOC_GPIO53,
0136 TEGRA_IO_PAD_SPI,
0137 TEGRA_IO_PAD_SPI_HV,
0138 TEGRA_IO_PAD_SYS_DDC,
0139 TEGRA_IO_PAD_UART,
0140 TEGRA_IO_PAD_UART4,
0141 TEGRA_IO_PAD_UART5,
0142 TEGRA_IO_PAD_UFS,
0143 TEGRA_IO_PAD_USB0,
0144 TEGRA_IO_PAD_USB1,
0145 TEGRA_IO_PAD_USB2,
0146 TEGRA_IO_PAD_USB3,
0147 TEGRA_IO_PAD_USB_BIAS,
0148 TEGRA_IO_PAD_AO_HV,
0149 };
0150
0151
0152 #define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI
0153 #define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS
0154
0155 #ifdef CONFIG_SOC_TEGRA_PMC
0156 int tegra_powergate_power_on(unsigned int id);
0157 int tegra_powergate_power_off(unsigned int id);
0158 int tegra_powergate_remove_clamping(unsigned int id);
0159
0160
0161 int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
0162 struct reset_control *rst);
0163
0164 int tegra_io_pad_power_enable(enum tegra_io_pad id);
0165 int tegra_io_pad_power_disable(enum tegra_io_pad id);
0166
0167
0168 int tegra_io_rail_power_on(unsigned int id);
0169 int tegra_io_rail_power_off(unsigned int id);
0170
0171 void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
0172 void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
0173
0174 bool tegra_pmc_core_domain_state_synced(void);
0175
0176 #else
0177 static inline int tegra_powergate_power_on(unsigned int id)
0178 {
0179 return -ENOSYS;
0180 }
0181
0182 static inline int tegra_powergate_power_off(unsigned int id)
0183 {
0184 return -ENOSYS;
0185 }
0186
0187 static inline int tegra_powergate_remove_clamping(unsigned int id)
0188 {
0189 return -ENOSYS;
0190 }
0191
0192 static inline int tegra_powergate_sequence_power_up(unsigned int id,
0193 struct clk *clk,
0194 struct reset_control *rst)
0195 {
0196 return -ENOSYS;
0197 }
0198
0199 static inline int tegra_io_pad_power_enable(enum tegra_io_pad id)
0200 {
0201 return -ENOSYS;
0202 }
0203
0204 static inline int tegra_io_pad_power_disable(enum tegra_io_pad id)
0205 {
0206 return -ENOSYS;
0207 }
0208
0209 static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
0210 {
0211 return -ENOSYS;
0212 }
0213
0214 static inline int tegra_io_rail_power_on(unsigned int id)
0215 {
0216 return -ENOSYS;
0217 }
0218
0219 static inline int tegra_io_rail_power_off(unsigned int id)
0220 {
0221 return -ENOSYS;
0222 }
0223
0224 static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
0225 {
0226 }
0227
0228 static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode)
0229 {
0230 }
0231
0232 static inline bool tegra_pmc_core_domain_state_synced(void)
0233 {
0234 return false;
0235 }
0236
0237 #endif
0238
0239 #if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP)
0240 enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
0241 #else
0242 static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
0243 {
0244 return TEGRA_SUSPEND_NONE;
0245 }
0246 #endif
0247
0248 #endif