2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef __MACH_TEGRA_CPU_CAR_H
18 #define __MACH_TEGRA_CPU_CAR_H
21 * Tegra CPU clock and reset control ops
24 * keep waiting until the CPU in reset state
26 * put the CPU in reset state
28 * release the CPU from reset state
34 * CPU is ready for rail off
36 * save the clock settings when CPU go into low-power state
38 * restore the clock settings when CPU exit low-power state
40 struct tegra_cpu_car_ops {
41 void (*wait_for_reset)(u32 cpu);
42 void (*put_in_reset)(u32 cpu);
43 void (*out_of_reset)(u32 cpu);
44 void (*enable_clock)(u32 cpu);
45 void (*disable_clock)(u32 cpu);
46 #ifdef CONFIG_PM_SLEEP
47 bool (*rail_off_ready)(void);
48 void (*suspend)(void);
53 extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
55 static inline void tegra_wait_cpu_in_reset(u32 cpu)
57 if (WARN_ON(!tegra_cpu_car_ops->wait_for_reset))
60 tegra_cpu_car_ops->wait_for_reset(cpu);
63 static inline void tegra_put_cpu_in_reset(u32 cpu)
65 if (WARN_ON(!tegra_cpu_car_ops->put_in_reset))
68 tegra_cpu_car_ops->put_in_reset(cpu);
71 static inline void tegra_cpu_out_of_reset(u32 cpu)
73 if (WARN_ON(!tegra_cpu_car_ops->out_of_reset))
76 tegra_cpu_car_ops->out_of_reset(cpu);
79 static inline void tegra_enable_cpu_clock(u32 cpu)
81 if (WARN_ON(!tegra_cpu_car_ops->enable_clock))
84 tegra_cpu_car_ops->enable_clock(cpu);
87 static inline void tegra_disable_cpu_clock(u32 cpu)
89 if (WARN_ON(!tegra_cpu_car_ops->disable_clock))
92 tegra_cpu_car_ops->disable_clock(cpu);
95 #ifdef CONFIG_PM_SLEEP
96 static inline bool tegra_cpu_rail_off_ready(void)
98 if (WARN_ON(!tegra_cpu_car_ops->rail_off_ready))
101 return tegra_cpu_car_ops->rail_off_ready();
104 static inline void tegra_cpu_clock_suspend(void)
106 if (WARN_ON(!tegra_cpu_car_ops->suspend))
109 tegra_cpu_car_ops->suspend();
112 static inline void tegra_cpu_clock_resume(void)
114 if (WARN_ON(!tegra_cpu_car_ops->resume))
117 tegra_cpu_car_ops->resume();
121 void tegra20_cpu_car_ops_init(void);
122 void tegra30_cpu_car_ops_init(void);
124 #endif /* __MACH_TEGRA_CPU_CAR_H */