hotplug.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (c) 2015 MediaTek Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef _HOTPLUG
  15. #define _HOTPLUG
  16. #include <linux/kernel.h>
  17. #include <linux/atomic.h>
  18. #define BOOTROM_BASE (0x00000000)
  19. #define BOOTSRAM_BASE (0x00100000)
  20. #define CCI400_BASE (0xF0390000)
  21. #define INFRACFG_AO_BASE (0xF0001000)
  22. #define MCUCFG_BASE (0xF0200000)
  23. /* log */
  24. #define HOTPLUG_LOG_NONE 0
  25. #define HOTPLUG_LOG_WITH_DEBUG 1
  26. #define HOTPLUG_LOG_WITH_WARN 2
  27. #define HOTPLUG_LOG_PRINT HOTPLUG_LOG_WITH_WARN
  28. #if (HOTPLUG_LOG_PRINT == HOTPLUG_LOG_NONE)
  29. #define HOTPLUG_INFO(fmt, args...)
  30. #elif (HOTPLUG_LOG_PRINT == HOTPLUG_LOG_WITH_DEBUG)
  31. #define HOTPLUG_INFO(fmt, args...) pr_debug("[Power/hotplug] "fmt, ##args)
  32. #elif (HOTPLUG_LOG_PRINT == HOTPLUG_LOG_WITH_WARN)
  33. #define HOTPLUG_INFO(fmt, args...) pr_warn("[Power/hotplug] "fmt, ##args)
  34. #endif
  35. /* profilling */
  36. /* #define CONFIG_HOTPLUG_PROFILING */
  37. #define CONFIG_HOTPLUG_PROFILING_COUNT 100
  38. /* register address - bootrom power*/
  39. #define BOOTROM_BOOT_ADDR (INFRACFG_AO_BASE + 0x800)
  40. #define BOOTROM_SEC_CTRL (INFRACFG_AO_BASE + 0x804)
  41. #define SW_ROM_PD (1U << 31)
  42. /* register address - CCI400 */
  43. #define CCI400_STATUS (CCI400_BASE + 0x000C)
  44. #define CHANGE_PENDING (1U << 0)
  45. #define CCI400_SI4_BASE (CCI400_BASE + 0x5000)
  46. #define CCI400_SI4_SNOOP_CONTROL (CCI400_SI4_BASE)
  47. #define CCI400_SI3_BASE (CCI400_BASE + 0x4000)
  48. #define CCI400_SI3_SNOOP_CONTROL (CCI400_SI3_BASE)
  49. #define DVM_MSG_REQ (1U << 1)
  50. #define SNOOP_REQ (1U << 0)
  51. /* register address - acinactm */
  52. #define MP0_AXI_CONFIG (MCUCFG_BASE + 0x02C)
  53. #define MP1_AXI_CONFIG (MCUCFG_BASE + 0x22C)
  54. #define ACINACTM (1U << 4)
  55. /* register address - aa64naa32 */
  56. #define MP0_MISC_CONFIG3 (MCUCFG_BASE + 0x03C)
  57. #define MP1_MISC_CONFIG3 (MCUCFG_BASE + 0x23C)
  58. #define REG_WRITE(addr, value) mt_reg_sync_writel(value, addr)
  59. /* power on/off cpu*/
  60. #define CONFIG_HOTPLUG_WITH_POWER_CTRL
  61. /* global variable */
  62. extern atomic_t hotplug_cpu_count;
  63. extern void __disable_dcache(void);
  64. extern void __enable_dcache(void);
  65. extern void __inner_clean_dcache_L2(void);
  66. extern void inner_dcache_flush_L1(void);
  67. extern void inner_dcache_flush_L2(void);
  68. extern void __switch_to_smp(void);
  69. extern void __switch_to_amp(void);
  70. extern void __disable_dcache__inner_flush_dcache_L1(void);
  71. extern void
  72. __disable_dcache__inner_flush_dcache_L1__inner_clean_dcache_L2(void);
  73. extern void
  74. __disable_dcache__inner_flush_dcache_L1__inner_flush_dcache_L2(void);
  75. /* mt cpu hotplug callback for smp_operations */
  76. extern int mt_cpu_kill(unsigned int cpu);
  77. extern void mt_cpu_die(unsigned int cpu);
  78. extern int mt_cpu_disable(unsigned int cpu);
  79. #endif