| 1 |
|
| 2 | |
| 3 | * Copyright (c) 2010 Google, Inc
|
| 4 | * Copyright (c) 2014 NVIDIA Corporation
|
| 5 | *
|
| 6 | * Author:
|
| 7 | * Colin Cross <[email protected]>
|
| 8 |
|
| 9 |
|
| 10 | #ifndef __SOC_TEGRA_PMC_H__
|
| 11 | #define __SOC_TEGRA_PMC_H__
|
| 12 |
|
| 13 | #include <linux/reboot.h>
|
| 14 |
|
| 15 | #include <soc/tegra/pm.h>
|
| 16 |
|
| 17 | struct clk;
|
| 18 | struct reset_control;
|
| 19 | struct tegra_pmc;
|
| 20 |
|
| 21 | |
| 22 | * powergate and I/O rail APIs
|
| 23 |
|
| 24 |
|
| 25 | #define TEGRA_POWERGATE_CPU 0
|
| 26 | #define TEGRA_POWERGATE_3D 1
|
| 27 | #define TEGRA_POWERGATE_VENC 2
|
| 28 | #define TEGRA_POWERGATE_PCIE 3
|
| 29 | #define TEGRA_POWERGATE_VDEC 4
|
| 30 | #define TEGRA_POWERGATE_L2 5
|
| 31 | #define TEGRA_POWERGATE_MPE 6
|
| 32 | #define TEGRA_POWERGATE_HEG 7
|
| 33 | #define TEGRA_POWERGATE_SATA 8
|
| 34 | #define TEGRA_POWERGATE_CPU1 9
|
| 35 | #define TEGRA_POWERGATE_CPU2 10
|
| 36 | #define TEGRA_POWERGATE_CPU3 11
|
| 37 | #define TEGRA_POWERGATE_CELP 12
|
| 38 | #define TEGRA_POWERGATE_3D1 13
|
| 39 | #define TEGRA_POWERGATE_CPU0 14
|
| 40 | #define TEGRA_POWERGATE_C0NC 15
|
| 41 | #define TEGRA_POWERGATE_C1NC 16
|
| 42 | #define TEGRA_POWERGATE_SOR 17
|
| 43 | #define TEGRA_POWERGATE_DIS 18
|
| 44 | #define TEGRA_POWERGATE_DISB 19
|
| 45 | #define TEGRA_POWERGATE_XUSBA 20
|
| 46 | #define TEGRA_POWERGATE_XUSBB 21
|
| 47 | #define TEGRA_POWERGATE_XUSBC 22
|
| 48 | #define TEGRA_POWERGATE_VIC 23
|
| 49 | #define TEGRA_POWERGATE_IRAM 24
|
| 50 | #define TEGRA_POWERGATE_NVDEC 25
|
| 51 | #define TEGRA_POWERGATE_NVJPG 26
|
| 52 | #define TEGRA_POWERGATE_AUD 27
|
| 53 | #define TEGRA_POWERGATE_DFD 28
|
| 54 | #define TEGRA_POWERGATE_VE2 29
|
| 55 | #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2
|
| 56 |
|
| 57 | #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
|
| 58 |
|
| 59 | |
| 60 | * enum tegra_io_pad - I/O pad group identifier
|
| 61 | *
|
| 62 | * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad
|
| 63 | * can be used to control the common voltage signal level and power state of
|
| 64 | * the pins of the given pad.
|
| 65 |
|
| 66 | enum tegra_io_pad {
|
| 67 | TEGRA_IO_PAD_AUDIO,
|
| 68 | TEGRA_IO_PAD_AUDIO_HV,
|
| 69 | TEGRA_IO_PAD_BB,
|
| 70 | TEGRA_IO_PAD_CAM,
|
| 71 | TEGRA_IO_PAD_COMP,
|
| 72 | TEGRA_IO_PAD_CONN,
|
| 73 | TEGRA_IO_PAD_CSIA,
|
| 74 | TEGRA_IO_PAD_CSIB,
|
| 75 | TEGRA_IO_PAD_CSIC,
|
| 76 | TEGRA_IO_PAD_CSID,
|
| 77 | TEGRA_IO_PAD_CSIE,
|
| 78 | TEGRA_IO_PAD_CSIF,
|
| 79 | TEGRA_IO_PAD_CSIG,
|
| 80 | TEGRA_IO_PAD_CSIH,
|
| 81 | TEGRA_IO_PAD_DAP3,
|
| 82 | TEGRA_IO_PAD_DAP5,
|
| 83 | TEGRA_IO_PAD_DBG,
|
| 84 | TEGRA_IO_PAD_DEBUG_NONAO,
|
| 85 | TEGRA_IO_PAD_DMIC,
|
| 86 | TEGRA_IO_PAD_DMIC_HV,
|
| 87 | TEGRA_IO_PAD_DP,
|
| 88 | TEGRA_IO_PAD_DSI,
|
| 89 |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2,
|
| 125 | TEGRA_IO_PAD_SDMMC2_HV,
|
| 126 | TEGRA_IO_PAD_SDMMC3,
|
| 127 | TEGRA_IO_PAD_SDMMC3_HV,
|
| 128 | TEGRA_IO_PAD_SDMMC4,
|
| 129 | TEGRA_IO_PAD_SOC_GPIO10,
|
| 130 | TEGRA_IO_PAD_SOC_GPIO12,
|
| 131 | TEGRA_IO_PAD_SOC_GPIO13,
|
| 132 | TEGRA_IO_PAD_SOC_GPIO53,
|
| 133 | TEGRA_IO_PAD_SPI,
|
| 134 | TEGRA_IO_PAD_SPI_HV,
|
| 135 | TEGRA_IO_PAD_SYS_DDC,
|
| 136 | TEGRA_IO_PAD_UART,
|
| 137 | TEGRA_IO_PAD_UART4,
|
| 138 | TEGRA_IO_PAD_UART5,
|
| 139 | TEGRA_IO_PAD_UFS,
|
| 140 | TEGRA_IO_PAD_USB0,
|
| 141 | TEGRA_IO_PAD_USB1,
|
| 142 | TEGRA_IO_PAD_USB2,
|
| 143 | TEGRA_IO_PAD_USB3,
|
| 144 | TEGRA_IO_PAD_USB_BIAS,
|
| 145 | TEGRA_IO_PAD_AO_HV,
|
| 146 | };
|
| 147 |
|
| 148 | #ifdef CONFIG_SOC_TEGRA_PMC
|
| 149 | struct tegra_pmc *devm_tegra_pmc_get(struct device *dev);
|
| 150 |
|
| 151 | int tegra_pmc_powergate_power_on(struct tegra_pmc *pmc, unsigned int id);
|
| 152 | int tegra_pmc_powergate_power_off(struct tegra_pmc *pmc, unsigned int id);
|
| 153 | int tegra_pmc_powergate_remove_clamping(struct tegra_pmc *pmc, unsigned int id);
|
| 154 |
|
| 155 |
|
| 156 | int tegra_pmc_powergate_sequence_power_up(struct tegra_pmc *pmc,
|
| 157 | unsigned int id, struct clk *clk,
|
| 158 | struct reset_control *rst);
|
| 159 | int tegra_pmc_io_pad_power_enable(struct tegra_pmc *pmc, enum tegra_io_pad id);
|
| 160 | int tegra_pmc_io_pad_power_disable(struct tegra_pmc *pmc, enum tegra_io_pad id);
|
| 161 |
|
| 162 | #else
|
| 163 | static inline struct tegra_pmc *devm_tegra_pmc_get(struct device *dev)
|
| 164 | {
|
| 165 | return ERR_PTR(-ENOSYS);
|
| 166 | }
|
| 167 |
|
| 168 | static inline int
|
| 169 | tegra_pmc_powergate_power_on(struct tegra_pmc *pmc, unsigned int id)
|
| 170 | {
|
| 171 | return -ENOSYS;
|
| 172 | }
|
| 173 |
|
| 174 | static inline int
|
| 175 | tegra_pmc_powergate_power_off(struct tegra_pmc *pmc, unsigned int id)
|
| 176 | {
|
| 177 | return -ENOSYS;
|
| 178 | }
|
| 179 |
|
| 180 | static inline int
|
| 181 | tegra_pmc_powergate_remove_clamping(struct tegra_pmc *pmc, unsigned int id)
|
| 182 | {
|
| 183 | return -ENOSYS;
|
| 184 | }
|
| 185 |
|
| 186 |
|
| 187 | static inline int
|
| 188 | tegra_pmc_powergate_sequence_power_up(struct tegra_pmc *pmc, unsigned int id,
|
| 189 | struct clk *clk,
|
| 190 | struct reset_control *rst)
|
| 191 | {
|
| 192 | return -ENOSYS;
|
| 193 | }
|
| 194 |
|
| 195 | static inline int
|
| 196 | tegra_pmc_io_pad_power_enable(struct tegra_pmc *pmc, enum tegra_io_pad id)
|
| 197 | {
|
| 198 | return -ENOSYS;
|
| 199 | }
|
| 200 |
|
| 201 | static inline int
|
| 202 | tegra_pmc_io_pad_power_disable(struct tegra_pmc *pmc, enum tegra_io_pad id)
|
| 203 | {
|
| 204 | return -ENOSYS;
|
| 205 | }
|
| 206 | #endif
|
| 207 |
|
| 208 |
|
| 209 | #if defined(CONFIG_ARM)
|
| 210 | bool tegra_pmc_cpu_is_powered(unsigned int cpuid);
|
| 211 | int tegra_pmc_cpu_power_on(unsigned int cpuid);
|
| 212 | int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);
|
| 213 |
|
| 214 | #if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP)
|
| 215 | enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
|
| 216 | void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
|
| 217 | void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
|
| 218 | #else
|
| 219 | static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
|
| 220 | {
|
| 221 | return TEGRA_SUSPEND_NONE;
|
| 222 | }
|
| 223 |
|
| 224 | static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
|
| 225 | {
|
| 226 | }
|
| 227 |
|
| 228 | static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode)
|
| 229 | {
|
| 230 | }
|
| 231 | #endif
|
| 232 | #endif
|
| 233 |
|
| 234 | #if defined(CONFIG_ARM) && defined(CONFIG_SOC_TEGRA_PMC)
|
| 235 | bool tegra_pmc_core_domain_state_synced(void);
|
| 236 | #else
|
| 237 |
|
| 238 | static inline bool tegra_pmc_core_domain_state_synced(void)
|
| 239 | {
|
| 240 | return false;
|
| 241 | }
|
| 242 | #endif
|
| 243 |
|
| 244 | #endif
|