flowctrl.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Functions and macros to control the flowcontroller
  3. *
  4. * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __SOC_TEGRA_FLOWCTRL_H__
  19. #define __SOC_TEGRA_FLOWCTRL_H__
  20. #define FLOW_CTRL_HALT_CPU0_EVENTS 0x0
  21. #define FLOW_CTRL_WAITEVENT (2 << 29)
  22. #define FLOW_CTRL_WAIT_FOR_INTERRUPT (4 << 29)
  23. #define FLOW_CTRL_JTAG_RESUME (1 << 28)
  24. #define FLOW_CTRL_SCLK_RESUME (1 << 27)
  25. #define FLOW_CTRL_HALT_CPU_IRQ (1 << 10)
  26. #define FLOW_CTRL_HALT_CPU_FIQ (1 << 8)
  27. #define FLOW_CTRL_HALT_LIC_IRQ (1 << 11)
  28. #define FLOW_CTRL_HALT_LIC_FIQ (1 << 10)
  29. #define FLOW_CTRL_HALT_GIC_IRQ (1 << 9)
  30. #define FLOW_CTRL_HALT_GIC_FIQ (1 << 8)
  31. #define FLOW_CTRL_CPU0_CSR 0x8
  32. #define FLOW_CTRL_CSR_INTR_FLAG (1 << 15)
  33. #define FLOW_CTRL_CSR_EVENT_FLAG (1 << 14)
  34. #define FLOW_CTRL_CSR_ENABLE_EXT_CRAIL (1 << 13)
  35. #define FLOW_CTRL_CSR_ENABLE_EXT_NCPU (1 << 12)
  36. #define FLOW_CTRL_CSR_ENABLE_EXT_MASK ( \
  37. FLOW_CTRL_CSR_ENABLE_EXT_NCPU | \
  38. FLOW_CTRL_CSR_ENABLE_EXT_CRAIL)
  39. #define FLOW_CTRL_CSR_ENABLE (1 << 0)
  40. #define FLOW_CTRL_HALT_CPU1_EVENTS 0x14
  41. #define FLOW_CTRL_CPU1_CSR 0x18
  42. #define TEGRA20_FLOW_CTRL_CSR_WFE_CPU0 (1 << 4)
  43. #define TEGRA20_FLOW_CTRL_CSR_WFE_BITMAP (3 << 4)
  44. #define TEGRA20_FLOW_CTRL_CSR_WFI_BITMAP 0
  45. #define TEGRA30_FLOW_CTRL_CSR_WFI_CPU0 (1 << 8)
  46. #define TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP (0xF << 4)
  47. #define TEGRA30_FLOW_CTRL_CSR_WFI_BITMAP (0xF << 8)
  48. #ifndef __ASSEMBLY__
  49. #ifdef CONFIG_SOC_TEGRA_FLOWCTRL
  50. u32 flowctrl_read_cpu_csr(unsigned int cpuid);
  51. void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value);
  52. void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value);
  53. void flowctrl_cpu_suspend_enter(unsigned int cpuid);
  54. void flowctrl_cpu_suspend_exit(unsigned int cpuid);
  55. #else
  56. static inline u32 flowctrl_read_cpu_csr(unsigned int cpuid)
  57. {
  58. return 0;
  59. }
  60. static inline void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
  61. {
  62. }
  63. static inline void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) {}
  64. static inline void flowctrl_cpu_suspend_enter(unsigned int cpuid)
  65. {
  66. }
  67. static inline void flowctrl_cpu_suspend_exit(unsigned int cpuid)
  68. {
  69. }
  70. #endif /* CONFIG_SOC_TEGRA_FLOWCTRL */
  71. #endif /* __ASSEMBLY */
  72. #endif /* __SOC_TEGRA_FLOWCTRL_H__ */