pmc.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2010 Google, Inc
  4. * Copyright (c) 2014 NVIDIA Corporation
  5. *
  6. * Author:
  7. * Colin Cross <ccross@google.com>
  8. */
  9. #ifndef __SOC_TEGRA_PMC_H__
  10. #define __SOC_TEGRA_PMC_H__
  11. #include <linux/reboot.h>
  12. #include <soc/tegra/pm.h>
  13. struct clk;
  14. struct reset_control;
  15. bool tegra_pmc_cpu_is_powered(unsigned int cpuid);
  16. int tegra_pmc_cpu_power_on(unsigned int cpuid);
  17. int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);
  18. /*
  19. * powergate and I/O rail APIs
  20. */
  21. #define TEGRA_POWERGATE_CPU 0
  22. #define TEGRA_POWERGATE_3D 1
  23. #define TEGRA_POWERGATE_VENC 2
  24. #define TEGRA_POWERGATE_PCIE 3
  25. #define TEGRA_POWERGATE_VDEC 4
  26. #define TEGRA_POWERGATE_L2 5
  27. #define TEGRA_POWERGATE_MPE 6
  28. #define TEGRA_POWERGATE_HEG 7
  29. #define TEGRA_POWERGATE_SATA 8
  30. #define TEGRA_POWERGATE_CPU1 9
  31. #define TEGRA_POWERGATE_CPU2 10
  32. #define TEGRA_POWERGATE_CPU3 11
  33. #define TEGRA_POWERGATE_CELP 12
  34. #define TEGRA_POWERGATE_3D1 13
  35. #define TEGRA_POWERGATE_CPU0 14
  36. #define TEGRA_POWERGATE_C0NC 15
  37. #define TEGRA_POWERGATE_C1NC 16
  38. #define TEGRA_POWERGATE_SOR 17
  39. #define TEGRA_POWERGATE_DIS 18
  40. #define TEGRA_POWERGATE_DISB 19
  41. #define TEGRA_POWERGATE_XUSBA 20
  42. #define TEGRA_POWERGATE_XUSBB 21
  43. #define TEGRA_POWERGATE_XUSBC 22
  44. #define TEGRA_POWERGATE_VIC 23
  45. #define TEGRA_POWERGATE_IRAM 24
  46. #define TEGRA_POWERGATE_NVDEC 25
  47. #define TEGRA_POWERGATE_NVJPG 26
  48. #define TEGRA_POWERGATE_AUD 27
  49. #define TEGRA_POWERGATE_DFD 28
  50. #define TEGRA_POWERGATE_VE2 29
  51. #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2
  52. #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
  53. /**
  54. * enum tegra_io_pad - I/O pad group identifier
  55. *
  56. * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad
  57. * can be used to control the common voltage signal level and power state of
  58. * the pins of the given pad.
  59. */
  60. enum tegra_io_pad {
  61. TEGRA_IO_PAD_AUDIO,
  62. TEGRA_IO_PAD_AUDIO_HV,
  63. TEGRA_IO_PAD_BB,
  64. TEGRA_IO_PAD_CAM,
  65. TEGRA_IO_PAD_COMP,
  66. TEGRA_IO_PAD_CONN,
  67. TEGRA_IO_PAD_CSIA,
  68. TEGRA_IO_PAD_CSIB,
  69. TEGRA_IO_PAD_CSIC,
  70. TEGRA_IO_PAD_CSID,
  71. TEGRA_IO_PAD_CSIE,
  72. TEGRA_IO_PAD_CSIF,
  73. TEGRA_IO_PAD_CSIG,
  74. TEGRA_IO_PAD_CSIH,
  75. TEGRA_IO_PAD_DAP3,
  76. TEGRA_IO_PAD_DAP5,
  77. TEGRA_IO_PAD_DBG,
  78. TEGRA_IO_PAD_DEBUG_NONAO,
  79. TEGRA_IO_PAD_DMIC,
  80. TEGRA_IO_PAD_DMIC_HV,
  81. TEGRA_IO_PAD_DP,
  82. TEGRA_IO_PAD_DSI,
  83. TEGRA_IO_PAD_DSIB,
  84. TEGRA_IO_PAD_DSIC,
  85. TEGRA_IO_PAD_DSID,
  86. TEGRA_IO_PAD_EDP,
  87. TEGRA_IO_PAD_EMMC,
  88. TEGRA_IO_PAD_EMMC2,
  89. TEGRA_IO_PAD_EQOS,
  90. TEGRA_IO_PAD_GPIO,
  91. TEGRA_IO_PAD_GP_PWM2,
  92. TEGRA_IO_PAD_GP_PWM3,
  93. TEGRA_IO_PAD_HDMI,
  94. TEGRA_IO_PAD_HDMI_DP0,
  95. TEGRA_IO_PAD_HDMI_DP1,
  96. TEGRA_IO_PAD_HDMI_DP2,
  97. TEGRA_IO_PAD_HDMI_DP3,
  98. TEGRA_IO_PAD_HSIC,
  99. TEGRA_IO_PAD_HV,
  100. TEGRA_IO_PAD_LVDS,
  101. TEGRA_IO_PAD_MIPI_BIAS,
  102. TEGRA_IO_PAD_NAND,
  103. TEGRA_IO_PAD_PEX_BIAS,
  104. TEGRA_IO_PAD_PEX_CLK_BIAS,
  105. TEGRA_IO_PAD_PEX_CLK1,
  106. TEGRA_IO_PAD_PEX_CLK2,
  107. TEGRA_IO_PAD_PEX_CLK3,
  108. TEGRA_IO_PAD_PEX_CLK_2_BIAS,
  109. TEGRA_IO_PAD_PEX_CLK_2,
  110. TEGRA_IO_PAD_PEX_CNTRL,
  111. TEGRA_IO_PAD_PEX_CTL2,
  112. TEGRA_IO_PAD_PEX_L0_RST,
  113. TEGRA_IO_PAD_PEX_L1_RST,
  114. TEGRA_IO_PAD_PEX_L5_RST,
  115. TEGRA_IO_PAD_PWR_CTL,
  116. TEGRA_IO_PAD_SDMMC1,
  117. TEGRA_IO_PAD_SDMMC1_HV,
  118. TEGRA_IO_PAD_SDMMC2,
  119. TEGRA_IO_PAD_SDMMC2_HV,
  120. TEGRA_IO_PAD_SDMMC3,
  121. TEGRA_IO_PAD_SDMMC3_HV,
  122. TEGRA_IO_PAD_SDMMC4,
  123. TEGRA_IO_PAD_SOC_GPIO10,
  124. TEGRA_IO_PAD_SOC_GPIO12,
  125. TEGRA_IO_PAD_SOC_GPIO13,
  126. TEGRA_IO_PAD_SOC_GPIO53,
  127. TEGRA_IO_PAD_SPI,
  128. TEGRA_IO_PAD_SPI_HV,
  129. TEGRA_IO_PAD_SYS_DDC,
  130. TEGRA_IO_PAD_UART,
  131. TEGRA_IO_PAD_UART4,
  132. TEGRA_IO_PAD_UART5,
  133. TEGRA_IO_PAD_UFS,
  134. TEGRA_IO_PAD_USB0,
  135. TEGRA_IO_PAD_USB1,
  136. TEGRA_IO_PAD_USB2,
  137. TEGRA_IO_PAD_USB3,
  138. TEGRA_IO_PAD_USB_BIAS,
  139. TEGRA_IO_PAD_AO_HV,
  140. };
  141. #ifdef CONFIG_SOC_TEGRA_PMC
  142. int tegra_powergate_power_on(unsigned int id);
  143. int tegra_powergate_power_off(unsigned int id);
  144. int tegra_powergate_remove_clamping(unsigned int id);
  145. /* Must be called with clk disabled, and returns with clk enabled */
  146. int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
  147. struct reset_control *rst);
  148. int tegra_io_pad_power_enable(enum tegra_io_pad id);
  149. int tegra_io_pad_power_disable(enum tegra_io_pad id);
  150. void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
  151. void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
  152. bool tegra_pmc_core_domain_state_synced(void);
  153. #else
  154. static inline int tegra_powergate_power_on(unsigned int id)
  155. {
  156. return -ENOSYS;
  157. }
  158. static inline int tegra_powergate_power_off(unsigned int id)
  159. {
  160. return -ENOSYS;
  161. }
  162. static inline int tegra_powergate_remove_clamping(unsigned int id)
  163. {
  164. return -ENOSYS;
  165. }
  166. static inline int tegra_powergate_sequence_power_up(unsigned int id,
  167. struct clk *clk,
  168. struct reset_control *rst)
  169. {
  170. return -ENOSYS;
  171. }
  172. static inline int tegra_io_pad_power_enable(enum tegra_io_pad id)
  173. {
  174. return -ENOSYS;
  175. }
  176. static inline int tegra_io_pad_power_disable(enum tegra_io_pad id)
  177. {
  178. return -ENOSYS;
  179. }
  180. static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
  181. {
  182. return -ENOSYS;
  183. }
  184. static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
  185. {
  186. }
  187. static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode)
  188. {
  189. }
  190. static inline bool tegra_pmc_core_domain_state_synced(void)
  191. {
  192. return false;
  193. }
  194. #endif /* CONFIG_SOC_TEGRA_PMC */
  195. #if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP)
  196. enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
  197. #else
  198. static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
  199. {
  200. return TEGRA_SUSPEND_NONE;
  201. }
  202. #endif
  203. #endif /* __SOC_TEGRA_PMC_H__ */