1*9c92ab61SThomas 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, 116eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_CLK2_BIAS, 117c641ec6eSThierry Reding TEGRA_IO_PAD_PEX_CLK3, 11821b49910SLaxman Dewangan TEGRA_IO_PAD_PEX_CNTRL, 119eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_CTL2, 120eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_L0_RST_N, 121eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_L1_RST_N, 122eac9c48aSThierry Reding TEGRA_IO_PAD_PEX_L5_RST_N, 123eac9c48aSThierry Reding TEGRA_IO_PAD_PWR_CTL, 12421b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC1, 125c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC1_HV, 126c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC2, 127c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC2_HV, 12821b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC3, 129c641ec6eSThierry Reding TEGRA_IO_PAD_SDMMC3_HV, 13021b49910SLaxman Dewangan TEGRA_IO_PAD_SDMMC4, 131eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO10, 132eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO12, 133eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO13, 134eac9c48aSThierry Reding TEGRA_IO_PAD_SOC_GPIO53, 13521b49910SLaxman Dewangan TEGRA_IO_PAD_SPI, 13621b49910SLaxman Dewangan TEGRA_IO_PAD_SPI_HV, 13721b49910SLaxman Dewangan TEGRA_IO_PAD_SYS_DDC, 13821b49910SLaxman Dewangan TEGRA_IO_PAD_UART, 139eac9c48aSThierry Reding TEGRA_IO_PAD_UART4, 140eac9c48aSThierry Reding TEGRA_IO_PAD_UART5, 141c641ec6eSThierry Reding TEGRA_IO_PAD_UFS, 14221b49910SLaxman Dewangan TEGRA_IO_PAD_USB0, 14321b49910SLaxman Dewangan TEGRA_IO_PAD_USB1, 14421b49910SLaxman Dewangan TEGRA_IO_PAD_USB2, 14521b49910SLaxman Dewangan TEGRA_IO_PAD_USB3, 14621b49910SLaxman Dewangan TEGRA_IO_PAD_USB_BIAS, 14713136a47SAapo Vienamo TEGRA_IO_PAD_AO_HV, 14821b49910SLaxman Dewangan }; 14921b49910SLaxman Dewangan 15021b49910SLaxman Dewangan /* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */ 15121b49910SLaxman Dewangan #define TEGRA_IO_RAIL_HDMI TEGRA_IO_PAD_HDMI 15221b49910SLaxman Dewangan #define TEGRA_IO_RAIL_LVDS TEGRA_IO_PAD_LVDS 15321b49910SLaxman Dewangan 154bd737038SArnd Bergmann #ifdef CONFIG_SOC_TEGRA_PMC 15570293ed0SJon Hunter int tegra_powergate_power_on(unsigned int id); 15670293ed0SJon Hunter int tegra_powergate_power_off(unsigned int id); 15770293ed0SJon Hunter int tegra_powergate_remove_clamping(unsigned int id); 1587232398aSThierry Reding 1597232398aSThierry Reding /* Must be called with clk disabled, and returns with clk enabled */ 16070293ed0SJon Hunter int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk, 1617232398aSThierry Reding struct reset_control *rst); 1627232398aSThierry Reding 16321b49910SLaxman Dewangan int tegra_io_pad_power_enable(enum tegra_io_pad id); 16421b49910SLaxman Dewangan int tegra_io_pad_power_disable(enum tegra_io_pad id); 16521b49910SLaxman Dewangan 16621b49910SLaxman Dewangan /* deprecated, use tegra_io_pad_power_{enable,disable}() instead */ 16770293ed0SJon Hunter int tegra_io_rail_power_on(unsigned int id); 16870293ed0SJon Hunter int tegra_io_rail_power_off(unsigned int id); 169bd737038SArnd Bergmann 170bd737038SArnd Bergmann enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); 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 1747232398aSThierry Reding #else 17570293ed0SJon Hunter static inline int tegra_powergate_power_on(unsigned int id) 1767232398aSThierry Reding { 1777232398aSThierry Reding return -ENOSYS; 1787232398aSThierry Reding } 1797232398aSThierry Reding 18070293ed0SJon Hunter static inline int tegra_powergate_power_off(unsigned int id) 1817232398aSThierry Reding { 1827232398aSThierry Reding return -ENOSYS; 1837232398aSThierry Reding } 1847232398aSThierry Reding 18570293ed0SJon Hunter static inline int tegra_powergate_remove_clamping(unsigned int id) 1867232398aSThierry Reding { 1877232398aSThierry Reding return -ENOSYS; 1887232398aSThierry Reding } 1897232398aSThierry Reding 19070293ed0SJon Hunter static inline int tegra_powergate_sequence_power_up(unsigned int id, 19170293ed0SJon Hunter struct clk *clk, 1927232398aSThierry Reding struct reset_control *rst) 1937232398aSThierry Reding { 1947232398aSThierry Reding return -ENOSYS; 1957232398aSThierry Reding } 1967232398aSThierry Reding 19721b49910SLaxman Dewangan static inline int tegra_io_pad_power_enable(enum tegra_io_pad id) 19821b49910SLaxman Dewangan { 19921b49910SLaxman Dewangan return -ENOSYS; 20021b49910SLaxman Dewangan } 20121b49910SLaxman Dewangan 20221b49910SLaxman Dewangan static inline int tegra_io_pad_power_disable(enum tegra_io_pad id) 20321b49910SLaxman Dewangan { 20421b49910SLaxman Dewangan return -ENOSYS; 20521b49910SLaxman Dewangan } 20621b49910SLaxman Dewangan 20721b49910SLaxman Dewangan static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id) 20821b49910SLaxman Dewangan { 20921b49910SLaxman Dewangan return -ENOSYS; 21021b49910SLaxman Dewangan } 21121b49910SLaxman Dewangan 21270293ed0SJon Hunter static inline int tegra_io_rail_power_on(unsigned int id) 2137232398aSThierry Reding { 2147232398aSThierry Reding return -ENOSYS; 2157232398aSThierry Reding } 2167232398aSThierry Reding 21770293ed0SJon Hunter static inline int tegra_io_rail_power_off(unsigned int id) 2187232398aSThierry Reding { 2197232398aSThierry Reding return -ENOSYS; 2207232398aSThierry Reding } 221bd737038SArnd Bergmann 222bd737038SArnd Bergmann static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void) 223bd737038SArnd Bergmann { 224bd737038SArnd Bergmann return TEGRA_SUSPEND_NONE; 225bd737038SArnd Bergmann } 226bd737038SArnd Bergmann 227bd737038SArnd Bergmann static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode) 228bd737038SArnd Bergmann { 229bd737038SArnd Bergmann } 230bd737038SArnd Bergmann 231bd737038SArnd Bergmann static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode) 232bd737038SArnd Bergmann { 233bd737038SArnd Bergmann } 234bd737038SArnd Bergmann 235bd737038SArnd Bergmann #endif /* CONFIG_SOC_TEGRA_PMC */ 2367232398aSThierry Reding 2377232398aSThierry Reding #endif /* __SOC_TEGRA_PMC_H__ */ 238