smp_scu.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASMARM_ARCH_SCU_H
  3. #define __ASMARM_ARCH_SCU_H
  4. #define SCU_PM_NORMAL 0
  5. #define SCU_PM_DORMANT 2
  6. #define SCU_PM_POWEROFF 3
  7. #ifndef __ASSEMBLER__
  8. #include <linux/errno.h>
  9. #include <asm/cputype.h>
  10. static inline bool scu_a9_has_base(void)
  11. {
  12. return read_cpuid_part() == ARM_CPU_PART_CORTEX_A9;
  13. }
  14. static inline unsigned long scu_a9_get_base(void)
  15. {
  16. unsigned long pa;
  17. asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (pa));
  18. return pa;
  19. }
  20. #ifdef CONFIG_HAVE_ARM_SCU
  21. unsigned int scu_get_core_count(void __iomem *);
  22. int scu_power_mode(void __iomem *, unsigned int);
  23. int scu_cpu_power_enable(void __iomem *, unsigned int);
  24. int scu_get_cpu_power_mode(void __iomem *scu_base, unsigned int logical_cpu);
  25. #else
  26. static inline unsigned int scu_get_core_count(void __iomem *scu_base)
  27. {
  28. return 0;
  29. }
  30. static inline int scu_power_mode(void __iomem *scu_base, unsigned int mode)
  31. {
  32. return -EINVAL;
  33. }
  34. static inline int scu_cpu_power_enable(void __iomem *scu_base,
  35. unsigned int mode)
  36. {
  37. return -EINVAL;
  38. }
  39. static inline int scu_get_cpu_power_mode(void __iomem *scu_base,
  40. unsigned int logical_cpu)
  41. {
  42. return -EINVAL;
  43. }
  44. #endif
  45. #if defined(CONFIG_SMP) && defined(CONFIG_HAVE_ARM_SCU)
  46. void scu_enable(void __iomem *scu_base);
  47. #else
  48. static inline void scu_enable(void __iomem *scu_base) {}
  49. #endif
  50. #endif
  51. #endif