tegra_cpu_car.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
  3. *
  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.
  7. *
  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
  11. * more details.
  12. *
  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/>.
  15. */
  16. #ifndef __MACH_TEGRA_CPU_CAR_H
  17. #define __MACH_TEGRA_CPU_CAR_H
  18. /*
  19. * Tegra CPU clock and reset control ops
  20. *
  21. * wait_for_reset:
  22. * keep waiting until the CPU in reset state
  23. * put_in_reset:
  24. * put the CPU in reset state
  25. * out_of_reset:
  26. * release the CPU from reset state
  27. * enable_clock:
  28. * CPU clock un-gate
  29. * disable_clock:
  30. * CPU clock gate
  31. */
  32. struct tegra_cpu_car_ops {
  33. void (*wait_for_reset)(u32 cpu);
  34. void (*put_in_reset)(u32 cpu);
  35. void (*out_of_reset)(u32 cpu);
  36. void (*enable_clock)(u32 cpu);
  37. void (*disable_clock)(u32 cpu);
  38. };
  39. extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
  40. static inline void tegra_wait_cpu_in_reset(u32 cpu)
  41. {
  42. if (WARN_ON(!tegra_cpu_car_ops->wait_for_reset))
  43. return;
  44. tegra_cpu_car_ops->wait_for_reset(cpu);
  45. }
  46. static inline void tegra_put_cpu_in_reset(u32 cpu)
  47. {
  48. if (WARN_ON(!tegra_cpu_car_ops->put_in_reset))
  49. return;
  50. tegra_cpu_car_ops->put_in_reset(cpu);
  51. }
  52. static inline void tegra_cpu_out_of_reset(u32 cpu)
  53. {
  54. if (WARN_ON(!tegra_cpu_car_ops->out_of_reset))
  55. return;
  56. tegra_cpu_car_ops->out_of_reset(cpu);
  57. }
  58. static inline void tegra_enable_cpu_clock(u32 cpu)
  59. {
  60. if (WARN_ON(!tegra_cpu_car_ops->enable_clock))
  61. return;
  62. tegra_cpu_car_ops->enable_clock(cpu);
  63. }
  64. static inline void tegra_disable_cpu_clock(u32 cpu)
  65. {
  66. if (WARN_ON(!tegra_cpu_car_ops->disable_clock))
  67. return;
  68. tegra_cpu_car_ops->disable_clock(cpu);
  69. }
  70. void tegra20_cpu_car_ops_init(void);
  71. void tegra30_cpu_car_ops_init(void);
  72. #endif /* __MACH_TEGRA_CPU_CAR_H */