flowctrl.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Functions and macros to control the flowcontroller
  4. *
  5. * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
  6. */
  7. #ifndef __SOC_TEGRA_FLOWCTRL_H__
  8. #define __SOC_TEGRA_FLOWCTRL_H__
  9. #define FLOW_CTRL_HALT_CPU0_EVENTS 0x0
  10. #define FLOW_CTRL_WAITEVENT (2 << 29)
  11. #define FLOW_CTRL_WAIT_FOR_INTERRUPT (4 << 29)
  12. #define FLOW_CTRL_JTAG_RESUME (1 << 28)
  13. #define FLOW_CTRL_SCLK_RESUME (1 << 27)
  14. #define FLOW_CTRL_HALT_CPU_IRQ (1 << 10)
  15. #define FLOW_CTRL_HALT_CPU_FIQ (1 << 8)
  16. #define FLOW_CTRL_HALT_LIC_IRQ (1 << 11)
  17. #define FLOW_CTRL_HALT_LIC_FIQ (1 << 10)
  18. #define FLOW_CTRL_HALT_GIC_IRQ (1 << 9)
  19. #define FLOW_CTRL_HALT_GIC_FIQ (1 << 8)
  20. #define FLOW_CTRL_CPU0_CSR 0x8
  21. #define FLOW_CTRL_CSR_INTR_FLAG (1 << 15)
  22. #define FLOW_CTRL_CSR_EVENT_FLAG (1 << 14)
  23. #define FLOW_CTRL_CSR_ENABLE_EXT_CRAIL (1 << 13)
  24. #define FLOW_CTRL_CSR_ENABLE_EXT_NCPU (1 << 12)
  25. #define FLOW_CTRL_CSR_ENABLE_EXT_MASK ( \
  26. FLOW_CTRL_CSR_ENABLE_EXT_NCPU | \
  27. FLOW_CTRL_CSR_ENABLE_EXT_CRAIL)
  28. #define FLOW_CTRL_CSR_ENABLE (1 << 0)
  29. #define FLOW_CTRL_HALT_CPU1_EVENTS 0x14
  30. #define FLOW_CTRL_CPU1_CSR 0x18
  31. #define TEGRA20_FLOW_CTRL_CSR_WFE_CPU0 (1 << 4)
  32. #define TEGRA20_FLOW_CTRL_CSR_WFE_BITMAP (3 << 4)
  33. #define TEGRA20_FLOW_CTRL_CSR_WFI_BITMAP 0
  34. #define TEGRA30_FLOW_CTRL_CSR_WFI_CPU0 (1 << 8)
  35. #define TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP (0xF << 4)
  36. #define TEGRA30_FLOW_CTRL_CSR_WFI_BITMAP (0xF << 8)
  37. #ifndef __ASSEMBLY__
  38. #ifdef CONFIG_SOC_TEGRA_FLOWCTRL
  39. u32 flowctrl_read_cpu_csr(unsigned int cpuid);
  40. void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value);
  41. void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value);
  42. void flowctrl_cpu_suspend_enter(unsigned int cpuid);
  43. void flowctrl_cpu_suspend_exit(unsigned int cpuid);
  44. #else
  45. static inline u32 flowctrl_read_cpu_csr(unsigned int cpuid)
  46. {
  47. return 0;
  48. }
  49. static inline void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
  50. {
  51. }
  52. static inline void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) {}
  53. static inline void flowctrl_cpu_suspend_enter(unsigned int cpuid)
  54. {
  55. }
  56. static inline void flowctrl_cpu_suspend_exit(unsigned int cpuid)
  57. {
  58. }
  59. #endif /* CONFIG_SOC_TEGRA_FLOWCTRL */
  60. #endif /* __ASSEMBLY */
  61. #endif /* __SOC_TEGRA_FLOWCTRL_H__ */