17232398aSThierry Reding /* 27232398aSThierry Reding * Copyright (c) 2010 Google, Inc 37232398aSThierry Reding * Copyright (c) 2014 NVIDIA Corporation 47232398aSThierry Reding * 57232398aSThierry Reding * Author: 67232398aSThierry Reding * Colin Cross <ccross@google.com> 77232398aSThierry Reding * 87232398aSThierry Reding * This software is licensed under the terms of the GNU General Public 97232398aSThierry Reding * License version 2, as published by the Free Software Foundation, and 107232398aSThierry Reding * may be copied, distributed, and modified under those terms. 117232398aSThierry Reding * 127232398aSThierry Reding * This program is distributed in the hope that it will be useful, 137232398aSThierry Reding * but WITHOUT ANY WARRANTY; without even the implied warranty of 147232398aSThierry Reding * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 157232398aSThierry Reding * GNU General Public License for more details. 167232398aSThierry Reding * 177232398aSThierry Reding */ 187232398aSThierry Reding 197232398aSThierry Reding #ifndef __SOC_TEGRA_PMC_H__ 207232398aSThierry Reding #define __SOC_TEGRA_PMC_H__ 217232398aSThierry Reding 227232398aSThierry Reding #include <linux/reboot.h> 237232398aSThierry Reding 247232398aSThierry Reding #include <soc/tegra/pm.h> 257232398aSThierry Reding 267232398aSThierry Reding struct clk; 277232398aSThierry Reding struct reset_control; 287232398aSThierry Reding 297232398aSThierry Reding #ifdef CONFIG_SMP 3070293ed0SJon Hunter bool tegra_pmc_cpu_is_powered(unsigned int cpuid); 3170293ed0SJon Hunter int tegra_pmc_cpu_power_on(unsigned int cpuid); 3270293ed0SJon Hunter int tegra_pmc_cpu_remove_clamping(unsigned int cpuid); 337232398aSThierry Reding #endif /* CONFIG_SMP */ 347232398aSThierry Reding 357232398aSThierry Reding /* 367232398aSThierry Reding * powergate and I/O rail APIs 377232398aSThierry Reding */ 387232398aSThierry Reding 397232398aSThierry Reding #define TEGRA_POWERGATE_CPU 0 407232398aSThierry Reding #define TEGRA_POWERGATE_3D 1 417232398aSThierry Reding #define TEGRA_POWERGATE_VENC 2 427232398aSThierry Reding #define TEGRA_POWERGATE_PCIE 3 437232398aSThierry Reding #define TEGRA_POWERGATE_VDEC 4 447232398aSThierry Reding #define TEGRA_POWERGATE_L2 5 457232398aSThierry Reding #define TEGRA_POWERGATE_MPE 6 467232398aSThierry Reding #define TEGRA_POWERGATE_HEG 7 477232398aSThierry Reding #define TEGRA_POWERGATE_SATA 8 487232398aSThierry Reding #define TEGRA_POWERGATE_CPU1 9 497232398aSThierry Reding #define TEGRA_POWERGATE_CPU2 10 507232398aSThierry Reding #define TEGRA_POWERGATE_CPU3 11 517232398aSThierry Reding #define TEGRA_POWERGATE_CELP 12 527232398aSThierry Reding #define TEGRA_POWERGATE_3D1 13 537232398aSThierry Reding #define TEGRA_POWERGATE_CPU0 14 547232398aSThierry Reding #define TEGRA_POWERGATE_C0NC 15 557232398aSThierry Reding #define TEGRA_POWERGATE_C1NC 16 567232398aSThierry Reding #define TEGRA_POWERGATE_SOR 17 577232398aSThierry Reding #define TEGRA_POWERGATE_DIS 18 587232398aSThierry Reding #define TEGRA_POWERGATE_DISB 19 597232398aSThierry Reding #define TEGRA_POWERGATE_XUSBA 20 607232398aSThierry Reding #define TEGRA_POWERGATE_XUSBB 21 617232398aSThierry Reding #define TEGRA_POWERGATE_XUSBC 22 627232398aSThierry Reding #define TEGRA_POWERGATE_VIC 23 637232398aSThierry Reding #define TEGRA_POWERGATE_IRAM 24 64c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVDEC 25 65c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVJPG 26 66c2fe4694SThierry Reding #define TEGRA_POWERGATE_AUD 27 67c2fe4694SThierry Reding #define TEGRA_POWERGATE_DFD 28 68c2fe4694SThierry Reding #define TEGRA_POWERGATE_VE2 29 69a3804512SJon Hunter #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2 707232398aSThierry Reding 717232398aSThierry Reding #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D 727232398aSThierry Reding 7321b49910SLaxman Dewangan /** 7421b49910SLaxman Dewangan * enum tegra_io_pad - I/O pad group identifier 7521b49910SLaxman Dewangan * 7621b49910SLaxman Dewangan * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad 7721b49910SLaxman Dewangan * can be used to control the common voltage signal level and power state of 7821b49910SLaxman Dewangan * the pins of the given pad. 7921b49910SLaxman Dewangan */ 8021b49910SLaxman Dewangan enum tegra_io_pad { 8121b49910SLaxman Dewangan TEGRA_IO_PAD_AUDIO, 8221b49910SLaxman Dewangan TEGRA_IO_PAD_AUDIO_HV, 8321b49910SLaxman Dewangan TEGRA_IO_PAD_BB, 8421b49910SLaxman Dewangan TEGRA_IO_PAD_CAM, 8521b49910SLaxman Dewangan TEGRA_IO_PAD_COMP, 86c641ec6eSThierry Reding TEGRA_IO_PAD_CONN, 8721b49910SLaxman Dewangan TEGRA_IO_PAD_CSIA, 8821b49910SLaxman Dewangan TEGRA_IO_PAD_CSIB, 8921b49910SLaxman Dewangan TEGRA_IO_PAD_CSIC, 9021b49910SLaxman Dewangan TEGRA_IO_PAD_CSID, 9121b49910SLaxman Dewangan TEGRA_IO_PAD_CSIE, 9221b49910SLaxman Dewangan TEGRA_IO_PAD_CSIF, 93*eac9c48aSThierry Reding TEGRA_IO_PAD_CSIG, 94*eac9c48aSThierry Reding TEGRA_IO_PAD_CSIH, 95*eac9c48aSThierry Reding TEGRA_IO_PAD_DAP3, 96*eac9c48aSThierry Reding TEGRA_IO_PAD_DAP5, 9721b49910SLaxman Dewangan TEGRA_IO_PAD_DBG, 9821b49910SLaxman Dewangan TEGRA_IO_PAD_DEBUG_NONAO, 9921b49910SLaxman Dewangan TEGRA_IO_PAD_DMIC, 100c641ec6eSThierry Reding TEGRA_IO_PAD_DMIC_HV, 10121b49910SLaxman Dewangan TEGRA_IO_PAD_DP, 10221b49910SLaxman Dewangan TEGRA_IO_PAD_DSI, 10321b49910SLaxman Dewangan TEGRA_IO_PAD_DSIB, 10421b49910SLaxman Dewangan TEGRA_IO_PAD_DSIC, 10521b49910SLaxman Dewangan TEGRA_IO_PAD_DSID, 106c641ec6eSThierry Reding TEGRA_IO_PAD_EDP, 10721b49910SLaxman Dewangan TEGRA_IO_PAD_EMMC, 10821b49910SLaxman Dewangan TEGRA_IO_PAD_EMMC2, 109*eac9c48aSThierry Reding TEGRA_IO_PAD_EQOS, 11021b49910SLaxman Dewangan TEGRA_IO_PAD_GPIO, 111*eac9c48aSThierry Reding TEGRA_IO_PAD_GP_PWM2, 112*eac9c48aSThierry Reding TEGRA_IO_PAD_GP_PWM3, 11321b49910SLaxman Dewangan TEGRA_IO_PAD_HDMI, 114c641ec6eSThierry Reding TEGRA_IO_PAD_HDMI_DP0, 115c641ec6eSThierry Reding TEGRA_IO_PAD_HDMI_DP1, 116*eac9c48aSThierry Reding TEGRA_IO_PAD_HDMI_DP2, 117*eac9c48aSThierry Reding TEGRA_IO_PAD_HDMI_DP3, 11821b49910SLaxman Dewangan TEGRA_IO_PAD_HSIC, 11921b49910SLaxman Dewangan TEGRA_IO_PAD_HV, 12021b49910SLaxman Dewangan TEGRA_IO_PAD_LVDS, 12121b49910SLaxman Dewangan TEGRA_IO_PAD_MIPI_BIAS, 12221b49910SLaxman Dewangan TEGRA_IO_PAD_NAND, 12321b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_BIAS, 124c641ec6eSThierry Reding TEGRA_IO_PAD_PEX_CLK_BIAS, 12521b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_CLK1, 12621b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_CLK2, 127*eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_CLK2_BIAS, 128c641ec6eSThierry Reding TEGRA_IO_PAD_PEX_CLK3, 12921b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_CNTRL, 130*eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_CTL2, 131*eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_L0_RST_N, 132*eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_L1_RST_N, 133*eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_L5_RST_N, 134*eac9c48aSThierry Reding TEGRA_IO_PAD_PWR_CTL, 13521b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC1, 136c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC1_HV, 137c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC2, 138c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC2_HV, 13921b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC3, 140c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC3_HV, 14121b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC4, 142*eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO10, 143*eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO12, 144*eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO13, 145*eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO53, 14621b49910SLaxman Dewangan TEGRA_IO_PAD_SPI, 14721b49910SLaxman Dewangan TEGRA_IO_PAD_SPI_HV, 14821b49910SLaxman Dewangan TEGRA_IO_PAD_SYS_DDC, 14921b49910SLaxman Dewangan TEGRA_IO_PAD_UART, 150*eac9c48aSThierry Reding TEGRA_IO_PAD_UART4, 151*eac9c48aSThierry Reding TEGRA_IO_PAD_UART5, 152c641ec6eSThierry Reding TEGRA_IO_PAD_UFS, 15321b49910SLaxman Dewangan TEGRA_IO_PAD_USB0, 15421b49910SLaxman Dewangan TEGRA_IO_PAD_USB1, 15521b49910SLaxman Dewangan TEGRA_IO_PAD_USB2, 15621b49910SLaxman Dewangan TEGRA_IO_PAD_USB3, 15721b49910SLaxman Dewangan TEGRA_IO_PAD_USB_BIAS, 15813136a47SAapo Vienamo TEGRA_IO_PAD_AO_HV, 15921b49910SLaxman Dewangan }; 16021b49910SLaxman Dewangan 16121b49910SLaxman Dewangan /* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */ 16221b49910SLaxman Dewangan #define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI 16321b49910SLaxman Dewangan #define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS 16421b49910SLaxman Dewangan 165bd737038SArnd Bergmann #ifdef CONFIG_SOC_TEGRA_PMC 16670293ed0SJon Hunter int tegra_powergate_is_powered(unsigned int id); 16770293ed0SJon Hunter int tegra_powergate_power_on(unsigned int id); 16870293ed0SJon Hunter int tegra_powergate_power_off(unsigned int id); 16970293ed0SJon Hunter int tegra_powergate_remove_clamping(unsigned int id); 1707232398aSThierry Reding 1717232398aSThierry Reding /* Must be called with clk disabled, and returns with clk enabled */ 17270293ed0SJon Hunter int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk, 1737232398aSThierry Reding struct reset_control *rst); 1747232398aSThierry Reding 17521b49910SLaxman Dewangan int tegra_io_pad_power_enable(enum tegra_io_pad id); 17621b49910SLaxman Dewangan int tegra_io_pad_power_disable(enum tegra_io_pad id); 17721b49910SLaxman Dewangan 17821b49910SLaxman Dewangan /* deprecated, use tegra_io_pad_power_{enable,disable}() instead */ 17970293ed0SJon Hunter int tegra_io_rail_power_on(unsigned int id); 18070293ed0SJon Hunter int tegra_io_rail_power_off(unsigned int id); 181bd737038SArnd Bergmann 182bd737038SArnd Bergmann enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); 183bd737038SArnd Bergmann void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); 184bd737038SArnd Bergmann void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); 185bd737038SArnd Bergmann 1867232398aSThierry Reding #else 18770293ed0SJon Hunter static inline int tegra_powergate_is_powered(unsigned int id) 1887232398aSThierry Reding { 1897232398aSThierry Reding return -ENOSYS; 1907232398aSThierry Reding } 1917232398aSThierry Reding 19270293ed0SJon Hunter static inline int tegra_powergate_power_on(unsigned int id) 1937232398aSThierry Reding { 1947232398aSThierry Reding return -ENOSYS; 1957232398aSThierry Reding } 1967232398aSThierry Reding 19770293ed0SJon Hunter static inline int tegra_powergate_power_off(unsigned int id) 1987232398aSThierry Reding { 1997232398aSThierry Reding return -ENOSYS; 2007232398aSThierry Reding } 2017232398aSThierry Reding 20270293ed0SJon Hunter static inline int tegra_powergate_remove_clamping(unsigned int id) 2037232398aSThierry Reding { 2047232398aSThierry Reding return -ENOSYS; 2057232398aSThierry Reding } 2067232398aSThierry Reding 20770293ed0SJon Hunter static inline int tegra_powergate_sequence_power_up(unsigned int id, 20870293ed0SJon Hunter struct clk *clk, 2097232398aSThierry Reding struct reset_control *rst) 2107232398aSThierry Reding { 2117232398aSThierry Reding return -ENOSYS; 2127232398aSThierry Reding } 2137232398aSThierry Reding 21421b49910SLaxman Dewangan static inline int tegra_io_pad_power_enable(enum tegra_io_pad id) 21521b49910SLaxman Dewangan { 21621b49910SLaxman Dewangan return -ENOSYS; 21721b49910SLaxman Dewangan } 21821b49910SLaxman Dewangan 21921b49910SLaxman Dewangan static inline int tegra_io_pad_power_disable(enum tegra_io_pad id) 22021b49910SLaxman Dewangan { 22121b49910SLaxman Dewangan return -ENOSYS; 22221b49910SLaxman Dewangan } 22321b49910SLaxman Dewangan 22421b49910SLaxman Dewangan static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id) 22521b49910SLaxman Dewangan { 22621b49910SLaxman Dewangan return -ENOSYS; 22721b49910SLaxman Dewangan } 22821b49910SLaxman Dewangan 22970293ed0SJon Hunter static inline int tegra_io_rail_power_on(unsigned int id) 2307232398aSThierry Reding { 2317232398aSThierry Reding return -ENOSYS; 2327232398aSThierry Reding } 2337232398aSThierry Reding 23470293ed0SJon Hunter static inline int tegra_io_rail_power_off(unsigned int id) 2357232398aSThierry Reding { 2367232398aSThierry Reding return -ENOSYS; 2377232398aSThierry Reding } 238bd737038SArnd Bergmann 239bd737038SArnd Bergmann static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void) 240bd737038SArnd Bergmann { 241bd737038SArnd Bergmann return TEGRA_SUSPEND_NONE; 242bd737038SArnd Bergmann } 243bd737038SArnd Bergmann 244bd737038SArnd Bergmann static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode) 245bd737038SArnd Bergmann { 246bd737038SArnd Bergmann } 247bd737038SArnd Bergmann 248bd737038SArnd Bergmann static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode) 249bd737038SArnd Bergmann { 250bd737038SArnd Bergmann } 251bd737038SArnd Bergmann 252bd737038SArnd Bergmann #endif /* CONFIG_SOC_TEGRA_PMC */ 2537232398aSThierry Reding 2547232398aSThierry Reding #endif /* __SOC_TEGRA_PMC_H__ */ 255