omap5xxx-bandgap.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * OMAP5xxx bandgap registers, bitfields and temperature definitions
  3. *
  4. * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
  5. * Contact:
  6. * Eduardo Valentin <eduardo.valentin@ti.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. *
  22. */
  23. #ifndef __OMAP5XXX_BANDGAP_H
  24. #define __OMAP5XXX_BANDGAP_H
  25. /**
  26. * *** OMAP5430 ***
  27. *
  28. * Below, in sequence, are the Register definitions,
  29. * the bitfields and the temperature definitions for OMAP5430.
  30. */
  31. /**
  32. * OMAP5430 register definitions
  33. *
  34. * Registers are defined as offsets. The offsets are
  35. * relative to FUSE_OPP_BGAP_GPU on 5430.
  36. *
  37. * Register below are grouped by domain (not necessarily in offset order)
  38. */
  39. /* OMAP5430.GPU register offsets */
  40. #define OMAP5430_FUSE_OPP_BGAP_GPU 0x0
  41. #define OMAP5430_TEMP_SENSOR_GPU_OFFSET 0x150
  42. #define OMAP5430_BGAP_THRESHOLD_GPU_OFFSET 0x1A8
  43. #define OMAP5430_BGAP_TSHUT_GPU_OFFSET 0x1B4
  44. #define OMAP5430_BGAP_CUMUL_DTEMP_GPU_OFFSET 0x1C0
  45. #define OMAP5430_BGAP_DTEMP_GPU_0_OFFSET 0x1F4
  46. #define OMAP5430_BGAP_DTEMP_GPU_1_OFFSET 0x1F8
  47. #define OMAP5430_BGAP_DTEMP_GPU_2_OFFSET 0x1FC
  48. #define OMAP5430_BGAP_DTEMP_GPU_3_OFFSET 0x200
  49. #define OMAP5430_BGAP_DTEMP_GPU_4_OFFSET 0x204
  50. /* OMAP5430.MPU register offsets */
  51. #define OMAP5430_FUSE_OPP_BGAP_MPU 0x4
  52. #define OMAP5430_TEMP_SENSOR_MPU_OFFSET 0x14C
  53. #define OMAP5430_BGAP_THRESHOLD_MPU_OFFSET 0x1A4
  54. #define OMAP5430_BGAP_TSHUT_MPU_OFFSET 0x1B0
  55. #define OMAP5430_BGAP_CUMUL_DTEMP_MPU_OFFSET 0x1BC
  56. #define OMAP5430_BGAP_DTEMP_MPU_0_OFFSET 0x1E0
  57. #define OMAP5430_BGAP_DTEMP_MPU_1_OFFSET 0x1E4
  58. #define OMAP5430_BGAP_DTEMP_MPU_2_OFFSET 0x1E8
  59. #define OMAP5430_BGAP_DTEMP_MPU_3_OFFSET 0x1EC
  60. #define OMAP5430_BGAP_DTEMP_MPU_4_OFFSET 0x1F0
  61. /* OMAP5430.MPU register offsets */
  62. #define OMAP5430_FUSE_OPP_BGAP_CORE 0x8
  63. #define OMAP5430_TEMP_SENSOR_CORE_OFFSET 0x154
  64. #define OMAP5430_BGAP_THRESHOLD_CORE_OFFSET 0x1AC
  65. #define OMAP5430_BGAP_TSHUT_CORE_OFFSET 0x1B8
  66. #define OMAP5430_BGAP_CUMUL_DTEMP_CORE_OFFSET 0x1C4
  67. #define OMAP5430_BGAP_DTEMP_CORE_0_OFFSET 0x208
  68. #define OMAP5430_BGAP_DTEMP_CORE_1_OFFSET 0x20C
  69. #define OMAP5430_BGAP_DTEMP_CORE_2_OFFSET 0x210
  70. #define OMAP5430_BGAP_DTEMP_CORE_3_OFFSET 0x214
  71. #define OMAP5430_BGAP_DTEMP_CORE_4_OFFSET 0x218
  72. /* OMAP5430.common register offsets */
  73. #define OMAP5430_BGAP_CTRL_OFFSET 0x1A0
  74. #define OMAP5430_BGAP_STATUS_OFFSET 0x1C8
  75. /**
  76. * Register bitfields for OMAP5430
  77. *
  78. * All the macros bellow define the required bits for
  79. * controlling temperature on OMAP5430. Bit defines are
  80. * grouped by register.
  81. */
  82. /* OMAP5430.TEMP_SENSOR */
  83. #define OMAP5430_BGAP_TEMP_SENSOR_SOC_MASK BIT(12)
  84. #define OMAP5430_BGAP_TEMPSOFF_MASK BIT(11)
  85. #define OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK BIT(10)
  86. #define OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK (0x3ff << 0)
  87. /* OMAP5430.BANDGAP_CTRL */
  88. #define OMAP5430_MASK_SIDLEMODE_MASK (0x3 << 30)
  89. #define OMAP5430_MASK_COUNTER_DELAY_MASK (0x7 << 27)
  90. #define OMAP5430_MASK_FREEZE_CORE_MASK BIT(23)
  91. #define OMAP5430_MASK_FREEZE_GPU_MASK BIT(22)
  92. #define OMAP5430_MASK_FREEZE_MPU_MASK BIT(21)
  93. #define OMAP5430_MASK_CLEAR_CORE_MASK BIT(20)
  94. #define OMAP5430_MASK_CLEAR_GPU_MASK BIT(19)
  95. #define OMAP5430_MASK_CLEAR_MPU_MASK BIT(18)
  96. #define OMAP5430_MASK_CLEAR_ACCUM_CORE_MASK BIT(17)
  97. #define OMAP5430_MASK_CLEAR_ACCUM_GPU_MASK BIT(16)
  98. #define OMAP5430_MASK_CLEAR_ACCUM_MPU_MASK BIT(15)
  99. #define OMAP5430_MASK_HOT_CORE_MASK BIT(5)
  100. #define OMAP5430_MASK_COLD_CORE_MASK BIT(4)
  101. #define OMAP5430_MASK_HOT_GPU_MASK BIT(3)
  102. #define OMAP5430_MASK_COLD_GPU_MASK BIT(2)
  103. #define OMAP5430_MASK_HOT_MPU_MASK BIT(1)
  104. #define OMAP5430_MASK_COLD_MPU_MASK BIT(0)
  105. /* OMAP5430.BANDGAP_COUNTER */
  106. #define OMAP5430_COUNTER_MASK (0xffffff << 0)
  107. /* OMAP5430.BANDGAP_THRESHOLD */
  108. #define OMAP5430_T_HOT_MASK (0x3ff << 16)
  109. #define OMAP5430_T_COLD_MASK (0x3ff << 0)
  110. /* OMAP5430.TSHUT_THRESHOLD */
  111. #define OMAP5430_TSHUT_HOT_MASK (0x3ff << 16)
  112. #define OMAP5430_TSHUT_COLD_MASK (0x3ff << 0)
  113. /* OMAP5430.BANDGAP_CUMUL_DTEMP_MPU */
  114. #define OMAP5430_CUMUL_DTEMP_MPU_MASK (0xffffffff << 0)
  115. /* OMAP5430.BANDGAP_CUMUL_DTEMP_GPU */
  116. #define OMAP5430_CUMUL_DTEMP_GPU_MASK (0xffffffff << 0)
  117. /* OMAP5430.BANDGAP_CUMUL_DTEMP_CORE */
  118. #define OMAP5430_CUMUL_DTEMP_CORE_MASK (0xffffffff << 0)
  119. /* OMAP5430.BANDGAP_STATUS */
  120. #define OMAP5430_BGAP_ALERT_MASK BIT(31)
  121. #define OMAP5430_HOT_CORE_FLAG_MASK BIT(5)
  122. #define OMAP5430_COLD_CORE_FLAG_MASK BIT(4)
  123. #define OMAP5430_HOT_GPU_FLAG_MASK BIT(3)
  124. #define OMAP5430_COLD_GPU_FLAG_MASK BIT(2)
  125. #define OMAP5430_HOT_MPU_FLAG_MASK BIT(1)
  126. #define OMAP5430_COLD_MPU_FLAG_MASK BIT(0)
  127. /**
  128. * Temperature limits and thresholds for OMAP5430
  129. *
  130. * All the macros bellow are definitions for handling the
  131. * ADC conversions and representation of temperature limits
  132. * and thresholds for OMAP5430. Definitions are grouped
  133. * by temperature domain.
  134. */
  135. /* OMAP5430.common temperature definitions */
  136. /* ADC conversion table limits */
  137. #define OMAP5430_ADC_START_VALUE 540
  138. #define OMAP5430_ADC_END_VALUE 945
  139. /* OMAP5430.GPU temperature definitions */
  140. /* bandgap clock limits */
  141. #define OMAP5430_GPU_MAX_FREQ 1500000
  142. #define OMAP5430_GPU_MIN_FREQ 1000000
  143. /* sensor limits */
  144. #define OMAP5430_GPU_MIN_TEMP -40000
  145. #define OMAP5430_GPU_MAX_TEMP 125000
  146. #define OMAP5430_GPU_HYST_VAL 5000
  147. /* interrupts thresholds */
  148. #define OMAP5430_GPU_TSHUT_HOT 915
  149. #define OMAP5430_GPU_TSHUT_COLD 900
  150. #define OMAP5430_GPU_T_HOT 800
  151. #define OMAP5430_GPU_T_COLD 795
  152. /* OMAP5430.MPU temperature definitions */
  153. /* bandgap clock limits */
  154. #define OMAP5430_MPU_MAX_FREQ 1500000
  155. #define OMAP5430_MPU_MIN_FREQ 1000000
  156. /* sensor limits */
  157. #define OMAP5430_MPU_MIN_TEMP -40000
  158. #define OMAP5430_MPU_MAX_TEMP 125000
  159. #define OMAP5430_MPU_HYST_VAL 5000
  160. /* interrupts thresholds */
  161. #define OMAP5430_MPU_TSHUT_HOT 915
  162. #define OMAP5430_MPU_TSHUT_COLD 900
  163. #define OMAP5430_MPU_T_HOT 800
  164. #define OMAP5430_MPU_T_COLD 795
  165. /* OMAP5430.CORE temperature definitions */
  166. /* bandgap clock limits */
  167. #define OMAP5430_CORE_MAX_FREQ 1500000
  168. #define OMAP5430_CORE_MIN_FREQ 1000000
  169. /* sensor limits */
  170. #define OMAP5430_CORE_MIN_TEMP -40000
  171. #define OMAP5430_CORE_MAX_TEMP 125000
  172. #define OMAP5430_CORE_HYST_VAL 5000
  173. /* interrupts thresholds */
  174. #define OMAP5430_CORE_TSHUT_HOT 915
  175. #define OMAP5430_CORE_TSHUT_COLD 900
  176. #define OMAP5430_CORE_T_HOT 800
  177. #define OMAP5430_CORE_T_COLD 795
  178. #endif /* __OMAP5XXX_BANDGAP_H */