19c92ab61SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 27232398aSThierry Reding /* 37232398aSThierry Reding * Copyright (c) 2010 Google, Inc 47232398aSThierry Reding * Copyright (c) 2014 NVIDIA Corporation 57232398aSThierry Reding * 67232398aSThierry Reding * Author: 77232398aSThierry Reding * Colin Cross <ccross@google.com> 87232398aSThierry Reding */ 97232398aSThierry Reding 107232398aSThierry Reding #ifndef __SOC_TEGRA_PMC_H__ 117232398aSThierry Reding #define __SOC_TEGRA_PMC_H__ 127232398aSThierry Reding 137232398aSThierry Reding #include <linux/reboot.h> 147232398aSThierry Reding 157232398aSThierry Reding #include <soc/tegra/pm.h> 167232398aSThierry Reding 177232398aSThierry Reding struct clk; 187232398aSThierry Reding struct reset_control; 197232398aSThierry Reding 2070293ed0SJon Hunter bool tegra_pmc_cpu_is_powered(unsigned int cpuid); 2170293ed0SJon Hunter int tegra_pmc_cpu_power_on(unsigned int cpuid); 2270293ed0SJon Hunter int tegra_pmc_cpu_remove_clamping(unsigned int cpuid); 237232398aSThierry Reding 247232398aSThierry Reding /* 257232398aSThierry Reding * powergate and I/O rail APIs 267232398aSThierry Reding */ 277232398aSThierry Reding 287232398aSThierry Reding #define TEGRA_POWERGATE_CPU 0 297232398aSThierry Reding #define TEGRA_POWERGATE_3D 1 307232398aSThierry Reding #define TEGRA_POWERGATE_VENC 2 317232398aSThierry Reding #define TEGRA_POWERGATE_PCIE 3 327232398aSThierry Reding #define TEGRA_POWERGATE_VDEC 4 337232398aSThierry Reding #define TEGRA_POWERGATE_L2 5 347232398aSThierry Reding #define TEGRA_POWERGATE_MPE 6 357232398aSThierry Reding #define TEGRA_POWERGATE_HEG 7 367232398aSThierry Reding #define TEGRA_POWERGATE_SATA 8 377232398aSThierry Reding #define TEGRA_POWERGATE_CPU1 9 387232398aSThierry Reding #define TEGRA_POWERGATE_CPU2 10 397232398aSThierry Reding #define TEGRA_POWERGATE_CPU3 11 407232398aSThierry Reding #define TEGRA_POWERGATE_CELP 12 417232398aSThierry Reding #define TEGRA_POWERGATE_3D1 13 427232398aSThierry Reding #define TEGRA_POWERGATE_CPU0 14 437232398aSThierry Reding #define TEGRA_POWERGATE_C0NC 15 447232398aSThierry Reding #define TEGRA_POWERGATE_C1NC 16 457232398aSThierry Reding #define TEGRA_POWERGATE_SOR 17 467232398aSThierry Reding #define TEGRA_POWERGATE_DIS 18 477232398aSThierry Reding #define TEGRA_POWERGATE_DISB 19 487232398aSThierry Reding #define TEGRA_POWERGATE_XUSBA 20 497232398aSThierry Reding #define TEGRA_POWERGATE_XUSBB 21 507232398aSThierry Reding #define TEGRA_POWERGATE_XUSBC 22 517232398aSThierry Reding #define TEGRA_POWERGATE_VIC 23 527232398aSThierry Reding #define TEGRA_POWERGATE_IRAM 24 53c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVDEC 25 54c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVJPG 26 55c2fe4694SThierry Reding #define TEGRA_POWERGATE_AUD 27 56c2fe4694SThierry Reding #define TEGRA_POWERGATE_DFD 28 57c2fe4694SThierry Reding #define TEGRA_POWERGATE_VE2 29 58a3804512SJon Hunter #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2 597232398aSThierry Reding 607232398aSThierry Reding #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D 617232398aSThierry Reding 6221b49910SLaxman Dewangan /** 6321b49910SLaxman Dewangan * enum tegra_io_pad - I/O pad group identifier 6421b49910SLaxman Dewangan * 6521b49910SLaxman Dewangan * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad 6621b49910SLaxman Dewangan * can be used to control the common voltage signal level and power state of 6721b49910SLaxman Dewangan * the pins of the given pad. 6821b49910SLaxman Dewangan */ 6921b49910SLaxman Dewangan enum tegra_io_pad { 7021b49910SLaxman Dewangan TEGRA_IO_PAD_AUDIO, 7121b49910SLaxman Dewangan TEGRA_IO_PAD_AUDIO_HV, 7221b49910SLaxman Dewangan TEGRA_IO_PAD_BB, 7321b49910SLaxman Dewangan TEGRA_IO_PAD_CAM, 7421b49910SLaxman Dewangan TEGRA_IO_PAD_COMP, 75c641ec6eSThierry Reding TEGRA_IO_PAD_CONN, 7621b49910SLaxman Dewangan TEGRA_IO_PAD_CSIA, 7721b49910SLaxman Dewangan TEGRA_IO_PAD_CSIB, 7821b49910SLaxman Dewangan TEGRA_IO_PAD_CSIC, 7921b49910SLaxman Dewangan TEGRA_IO_PAD_CSID, 8021b49910SLaxman Dewangan TEGRA_IO_PAD_CSIE, 8121b49910SLaxman Dewangan TEGRA_IO_PAD_CSIF, 82eac9c48aSThierry Reding TEGRA_IO_PAD_CSIG, 83eac9c48aSThierry Reding TEGRA_IO_PAD_CSIH, 84eac9c48aSThierry Reding TEGRA_IO_PAD_DAP3, 85eac9c48aSThierry Reding TEGRA_IO_PAD_DAP5, 8621b49910SLaxman Dewangan TEGRA_IO_PAD_DBG, 8721b49910SLaxman Dewangan TEGRA_IO_PAD_DEBUG_NONAO, 8821b49910SLaxman Dewangan TEGRA_IO_PAD_DMIC, 89c641ec6eSThierry Reding TEGRA_IO_PAD_DMIC_HV, 9021b49910SLaxman Dewangan TEGRA_IO_PAD_DP, 9121b49910SLaxman Dewangan TEGRA_IO_PAD_DSI, 9221b49910SLaxman Dewangan TEGRA_IO_PAD_DSIB, 9321b49910SLaxman Dewangan TEGRA_IO_PAD_DSIC, 9421b49910SLaxman Dewangan TEGRA_IO_PAD_DSID, 95c641ec6eSThierry Reding TEGRA_IO_PAD_EDP, 9621b49910SLaxman Dewangan TEGRA_IO_PAD_EMMC, 9721b49910SLaxman Dewangan TEGRA_IO_PAD_EMMC2, 98eac9c48aSThierry Reding TEGRA_IO_PAD_EQOS, 9921b49910SLaxman Dewangan TEGRA_IO_PAD_GPIO, 100eac9c48aSThierry Reding TEGRA_IO_PAD_GP_PWM2, 101eac9c48aSThierry Reding TEGRA_IO_PAD_GP_PWM3, 10221b49910SLaxman Dewangan TEGRA_IO_PAD_HDMI, 103c641ec6eSThierry Reding TEGRA_IO_PAD_HDMI_DP0, 104c641ec6eSThierry Reding TEGRA_IO_PAD_HDMI_DP1, 105eac9c48aSThierry Reding TEGRA_IO_PAD_HDMI_DP2, 106eac9c48aSThierry Reding TEGRA_IO_PAD_HDMI_DP3, 10721b49910SLaxman Dewangan TEGRA_IO_PAD_HSIC, 10821b49910SLaxman Dewangan TEGRA_IO_PAD_HV, 10921b49910SLaxman Dewangan TEGRA_IO_PAD_LVDS, 11021b49910SLaxman Dewangan TEGRA_IO_PAD_MIPI_BIAS, 11121b49910SLaxman Dewangan TEGRA_IO_PAD_NAND, 11221b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_BIAS, 113c641ec6eSThierry Reding TEGRA_IO_PAD_PEX_CLK_BIAS, 11421b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_CLK1, 11521b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_CLK2, 116c641ec6eSThierry Reding TEGRA_IO_PAD_PEX_CLK3, 11704fac241SVenkat Reddy Talla TEGRA_IO_PAD_PEX_CLK_2_BIAS, 11804fac241SVenkat Reddy Talla TEGRA_IO_PAD_PEX_CLK_2, 11921b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_CNTRL, 120eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_CTL2, 121*c9c4ddb2SPetlozu Pravareshwar TEGRA_IO_PAD_PEX_L0_RST, 122*c9c4ddb2SPetlozu Pravareshwar TEGRA_IO_PAD_PEX_L1_RST, 123*c9c4ddb2SPetlozu Pravareshwar TEGRA_IO_PAD_PEX_L5_RST, 124eac9c48aSThierry Reding TEGRA_IO_PAD_PWR_CTL, 12521b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC1, 126c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC1_HV, 127c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC2, 128c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC2_HV, 12921b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC3, 130c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC3_HV, 13121b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC4, 132eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO10, 133eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO12, 134eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO13, 135eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO53, 13621b49910SLaxman Dewangan TEGRA_IO_PAD_SPI, 13721b49910SLaxman Dewangan TEGRA_IO_PAD_SPI_HV, 13821b49910SLaxman Dewangan TEGRA_IO_PAD_SYS_DDC, 13921b49910SLaxman Dewangan TEGRA_IO_PAD_UART, 140eac9c48aSThierry Reding TEGRA_IO_PAD_UART4, 141eac9c48aSThierry Reding TEGRA_IO_PAD_UART5, 142c641ec6eSThierry Reding TEGRA_IO_PAD_UFS, 14321b49910SLaxman Dewangan TEGRA_IO_PAD_USB0, 14421b49910SLaxman Dewangan TEGRA_IO_PAD_USB1, 14521b49910SLaxman Dewangan TEGRA_IO_PAD_USB2, 14621b49910SLaxman Dewangan TEGRA_IO_PAD_USB3, 14721b49910SLaxman Dewangan TEGRA_IO_PAD_USB_BIAS, 14813136a47SAapo Vienamo TEGRA_IO_PAD_AO_HV, 14921b49910SLaxman Dewangan }; 15021b49910SLaxman Dewangan 15121b49910SLaxman Dewangan /* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */ 15221b49910SLaxman Dewangan #define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI 15321b49910SLaxman Dewangan #define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS 15421b49910SLaxman Dewangan 155bd737038SArnd Bergmann #ifdef CONFIG_SOC_TEGRA_PMC 15670293ed0SJon Hunter int tegra_powergate_power_on(unsigned int id); 15770293ed0SJon Hunter int tegra_powergate_power_off(unsigned int id); 15870293ed0SJon Hunter int tegra_powergate_remove_clamping(unsigned int id); 1597232398aSThierry Reding 1607232398aSThierry Reding /* Must be called with clk disabled, and returns with clk enabled */ 16170293ed0SJon Hunter int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk, 1627232398aSThierry Reding struct reset_control *rst); 1637232398aSThierry Reding 16421b49910SLaxman Dewangan int tegra_io_pad_power_enable(enum tegra_io_pad id); 16521b49910SLaxman Dewangan int tegra_io_pad_power_disable(enum tegra_io_pad id); 16621b49910SLaxman Dewangan 16721b49910SLaxman Dewangan /* deprecated, use tegra_io_pad_power_{enable,disable}() instead */ 16870293ed0SJon Hunter int tegra_io_rail_power_on(unsigned int id); 16970293ed0SJon Hunter int tegra_io_rail_power_off(unsigned int id); 170bd737038SArnd Bergmann 171bd737038SArnd Bergmann void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); 172bd737038SArnd Bergmann void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); 173bd737038SArnd Bergmann 17441bafa69SDmitry Osipenko bool tegra_pmc_core_domain_state_synced(void); 17541bafa69SDmitry Osipenko 1767232398aSThierry Reding #else 17770293ed0SJon Hunter static inline int tegra_powergate_power_on(unsigned int id) 1787232398aSThierry Reding { 1797232398aSThierry Reding return -ENOSYS; 1807232398aSThierry Reding } 1817232398aSThierry Reding 18270293ed0SJon Hunter static inline int tegra_powergate_power_off(unsigned int id) 1837232398aSThierry Reding { 1847232398aSThierry Reding return -ENOSYS; 1857232398aSThierry Reding } 1867232398aSThierry Reding 18770293ed0SJon Hunter static inline int tegra_powergate_remove_clamping(unsigned int id) 1887232398aSThierry Reding { 1897232398aSThierry Reding return -ENOSYS; 1907232398aSThierry Reding } 1917232398aSThierry Reding 19270293ed0SJon Hunter static inline int tegra_powergate_sequence_power_up(unsigned int id, 19370293ed0SJon Hunter struct clk *clk, 1947232398aSThierry Reding struct reset_control *rst) 1957232398aSThierry Reding { 1967232398aSThierry Reding return -ENOSYS; 1977232398aSThierry Reding } 1987232398aSThierry Reding 19921b49910SLaxman Dewangan static inline int tegra_io_pad_power_enable(enum tegra_io_pad id) 20021b49910SLaxman Dewangan { 20121b49910SLaxman Dewangan return -ENOSYS; 20221b49910SLaxman Dewangan } 20321b49910SLaxman Dewangan 20421b49910SLaxman Dewangan static inline int tegra_io_pad_power_disable(enum tegra_io_pad id) 20521b49910SLaxman Dewangan { 20621b49910SLaxman Dewangan return -ENOSYS; 20721b49910SLaxman Dewangan } 20821b49910SLaxman Dewangan 20921b49910SLaxman Dewangan static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id) 21021b49910SLaxman Dewangan { 21121b49910SLaxman Dewangan return -ENOSYS; 21221b49910SLaxman Dewangan } 21321b49910SLaxman Dewangan 21470293ed0SJon Hunter static inline int tegra_io_rail_power_on(unsigned int id) 2157232398aSThierry Reding { 2167232398aSThierry Reding return -ENOSYS; 2177232398aSThierry Reding } 2187232398aSThierry Reding 21970293ed0SJon Hunter static inline int tegra_io_rail_power_off(unsigned int id) 2207232398aSThierry Reding { 2217232398aSThierry Reding return -ENOSYS; 2227232398aSThierry Reding } 223bd737038SArnd Bergmann 224bd737038SArnd Bergmann static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode) 225bd737038SArnd Bergmann { 226bd737038SArnd Bergmann } 227bd737038SArnd Bergmann 228bd737038SArnd Bergmann static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode) 229bd737038SArnd Bergmann { 230bd737038SArnd Bergmann } 231bd737038SArnd Bergmann 23241bafa69SDmitry Osipenko static inline bool tegra_pmc_core_domain_state_synced(void) 23341bafa69SDmitry Osipenko { 23441bafa69SDmitry Osipenko return false; 23541bafa69SDmitry Osipenko } 23641bafa69SDmitry Osipenko 237bd737038SArnd Bergmann #endif /* CONFIG_SOC_TEGRA_PMC */ 2387232398aSThierry Reding 239b1018eb7SArnd Bergmann #if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP) 240b1018eb7SArnd Bergmann enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); 241b1018eb7SArnd Bergmann #else 242b1018eb7SArnd Bergmann static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void) 243b1018eb7SArnd Bergmann { 244b1018eb7SArnd Bergmann return TEGRA_SUSPEND_NONE; 245b1018eb7SArnd Bergmann } 246b1018eb7SArnd Bergmann #endif 247b1018eb7SArnd Bergmann 2487232398aSThierry Reding #endif /* __SOC_TEGRA_PMC_H__ */ 249