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_PM_SLEEP 307232398aSThierry Reding enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); 317232398aSThierry Reding void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); 327232398aSThierry Reding void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); 337232398aSThierry Reding #endif /* CONFIG_PM_SLEEP */ 347232398aSThierry Reding 357232398aSThierry Reding #ifdef CONFIG_SMP 3670293ed0SJon Hunter bool tegra_pmc_cpu_is_powered(unsigned int cpuid); 3770293ed0SJon Hunter int tegra_pmc_cpu_power_on(unsigned int cpuid); 3870293ed0SJon Hunter int tegra_pmc_cpu_remove_clamping(unsigned int cpuid); 397232398aSThierry Reding #endif /* CONFIG_SMP */ 407232398aSThierry Reding 417232398aSThierry Reding /* 427232398aSThierry Reding * powergate and I/O rail APIs 437232398aSThierry Reding */ 447232398aSThierry Reding 457232398aSThierry Reding #define TEGRA_POWERGATE_CPU 0 467232398aSThierry Reding #define TEGRA_POWERGATE_3D 1 477232398aSThierry Reding #define TEGRA_POWERGATE_VENC 2 487232398aSThierry Reding #define TEGRA_POWERGATE_PCIE 3 497232398aSThierry Reding #define TEGRA_POWERGATE_VDEC 4 507232398aSThierry Reding #define TEGRA_POWERGATE_L2 5 517232398aSThierry Reding #define TEGRA_POWERGATE_MPE 6 527232398aSThierry Reding #define TEGRA_POWERGATE_HEG 7 537232398aSThierry Reding #define TEGRA_POWERGATE_SATA 8 547232398aSThierry Reding #define TEGRA_POWERGATE_CPU1 9 557232398aSThierry Reding #define TEGRA_POWERGATE_CPU2 10 567232398aSThierry Reding #define TEGRA_POWERGATE_CPU3 11 577232398aSThierry Reding #define TEGRA_POWERGATE_CELP 12 587232398aSThierry Reding #define TEGRA_POWERGATE_3D1 13 597232398aSThierry Reding #define TEGRA_POWERGATE_CPU0 14 607232398aSThierry Reding #define TEGRA_POWERGATE_C0NC 15 617232398aSThierry Reding #define TEGRA_POWERGATE_C1NC 16 627232398aSThierry Reding #define TEGRA_POWERGATE_SOR 17 637232398aSThierry Reding #define TEGRA_POWERGATE_DIS 18 647232398aSThierry Reding #define TEGRA_POWERGATE_DISB 19 657232398aSThierry Reding #define TEGRA_POWERGATE_XUSBA 20 667232398aSThierry Reding #define TEGRA_POWERGATE_XUSBB 21 677232398aSThierry Reding #define TEGRA_POWERGATE_XUSBC 22 687232398aSThierry Reding #define TEGRA_POWERGATE_VIC 23 697232398aSThierry Reding #define TEGRA_POWERGATE_IRAM 24 70c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVDEC 25 71c2fe4694SThierry Reding #define TEGRA_POWERGATE_NVJPG 26 72c2fe4694SThierry Reding #define TEGRA_POWERGATE_AUD 27 73c2fe4694SThierry Reding #define TEGRA_POWERGATE_DFD 28 74c2fe4694SThierry Reding #define TEGRA_POWERGATE_VE2 29 75*a3804512SJon Hunter #define TEGRA_POWERGATE_MAX TEGRA_POWERGATE_VE2 767232398aSThierry Reding 777232398aSThierry Reding #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D 787232398aSThierry Reding 797232398aSThierry Reding #define TEGRA_IO_RAIL_CSIA 0 807232398aSThierry Reding #define TEGRA_IO_RAIL_CSIB 1 817232398aSThierry Reding #define TEGRA_IO_RAIL_DSI 2 827232398aSThierry Reding #define TEGRA_IO_RAIL_MIPI_BIAS 3 837232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_BIAS 4 847232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CLK1 5 857232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CLK2 6 867232398aSThierry Reding #define TEGRA_IO_RAIL_USB0 9 877232398aSThierry Reding #define TEGRA_IO_RAIL_USB1 10 887232398aSThierry Reding #define TEGRA_IO_RAIL_USB2 11 897232398aSThierry Reding #define TEGRA_IO_RAIL_USB_BIAS 12 907232398aSThierry Reding #define TEGRA_IO_RAIL_NAND 13 917232398aSThierry Reding #define TEGRA_IO_RAIL_UART 14 927232398aSThierry Reding #define TEGRA_IO_RAIL_BB 15 937232398aSThierry Reding #define TEGRA_IO_RAIL_AUDIO 17 947232398aSThierry Reding #define TEGRA_IO_RAIL_HSIC 19 957232398aSThierry Reding #define TEGRA_IO_RAIL_COMP 22 967232398aSThierry Reding #define TEGRA_IO_RAIL_HDMI 28 977232398aSThierry Reding #define TEGRA_IO_RAIL_PEX_CNTRL 32 987232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC1 33 997232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC3 34 1007232398aSThierry Reding #define TEGRA_IO_RAIL_SDMMC4 35 1017232398aSThierry Reding #define TEGRA_IO_RAIL_CAM 36 1027232398aSThierry Reding #define TEGRA_IO_RAIL_RES 37 1037232398aSThierry Reding #define TEGRA_IO_RAIL_HV 38 1047232398aSThierry Reding #define TEGRA_IO_RAIL_DSIB 39 1057232398aSThierry Reding #define TEGRA_IO_RAIL_DSIC 40 1067232398aSThierry Reding #define TEGRA_IO_RAIL_DSID 41 1077232398aSThierry Reding #define TEGRA_IO_RAIL_CSIE 44 1087232398aSThierry Reding #define TEGRA_IO_RAIL_LVDS 57 1097232398aSThierry Reding #define TEGRA_IO_RAIL_SYS_DDC 58 1107232398aSThierry Reding 1117232398aSThierry Reding #ifdef CONFIG_ARCH_TEGRA 11270293ed0SJon Hunter int tegra_powergate_is_powered(unsigned int id); 11370293ed0SJon Hunter int tegra_powergate_power_on(unsigned int id); 11470293ed0SJon Hunter int tegra_powergate_power_off(unsigned int id); 11570293ed0SJon Hunter int tegra_powergate_remove_clamping(unsigned int id); 1167232398aSThierry Reding 1177232398aSThierry Reding /* Must be called with clk disabled, and returns with clk enabled */ 11870293ed0SJon Hunter int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk, 1197232398aSThierry Reding struct reset_control *rst); 1207232398aSThierry Reding 12170293ed0SJon Hunter int tegra_io_rail_power_on(unsigned int id); 12270293ed0SJon Hunter int tegra_io_rail_power_off(unsigned int id); 1237232398aSThierry Reding #else 12470293ed0SJon Hunter static inline int tegra_powergate_is_powered(unsigned int id) 1257232398aSThierry Reding { 1267232398aSThierry Reding return -ENOSYS; 1277232398aSThierry Reding } 1287232398aSThierry Reding 12970293ed0SJon Hunter static inline int tegra_powergate_power_on(unsigned int id) 1307232398aSThierry Reding { 1317232398aSThierry Reding return -ENOSYS; 1327232398aSThierry Reding } 1337232398aSThierry Reding 13470293ed0SJon Hunter static inline int tegra_powergate_power_off(unsigned int id) 1357232398aSThierry Reding { 1367232398aSThierry Reding return -ENOSYS; 1377232398aSThierry Reding } 1387232398aSThierry Reding 13970293ed0SJon Hunter static inline int tegra_powergate_remove_clamping(unsigned int id) 1407232398aSThierry Reding { 1417232398aSThierry Reding return -ENOSYS; 1427232398aSThierry Reding } 1437232398aSThierry Reding 14470293ed0SJon Hunter static inline int tegra_powergate_sequence_power_up(unsigned int id, 14570293ed0SJon Hunter struct clk *clk, 1467232398aSThierry Reding struct reset_control *rst) 1477232398aSThierry Reding { 1487232398aSThierry Reding return -ENOSYS; 1497232398aSThierry Reding } 1507232398aSThierry Reding 15170293ed0SJon Hunter static inline int tegra_io_rail_power_on(unsigned int id) 1527232398aSThierry Reding { 1537232398aSThierry Reding return -ENOSYS; 1547232398aSThierry Reding } 1557232398aSThierry Reding 15670293ed0SJon Hunter static inline int tegra_io_rail_power_off(unsigned int id) 1577232398aSThierry Reding { 1587232398aSThierry Reding return -ENOSYS; 1597232398aSThierry Reding } 1607232398aSThierry Reding #endif /* CONFIG_ARCH_TEGRA */ 1617232398aSThierry Reding 1627232398aSThierry Reding #endif /* __SOC_TEGRA_PMC_H__ */ 163