omap4xxx-bandgap.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * OMAP4xxx 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 __OMAP4XXX_BANDGAP_H
  24. #define __OMAP4XXX_BANDGAP_H
  25. /**
  26. * *** OMAP4430 ***
  27. *
  28. * Below, in sequence, are the Register definitions,
  29. * the bitfields and the temperature definitions for OMAP4430.
  30. */
  31. /**
  32. * OMAP4430 register definitions
  33. *
  34. * Registers are defined as offsets. The offsets are
  35. * relative to FUSE_OPP_BGAP on 4430.
  36. */
  37. /* OMAP4430.FUSE_OPP_BGAP */
  38. #define OMAP4430_FUSE_OPP_BGAP 0x0
  39. /* OMAP4430.TEMP_SENSOR */
  40. #define OMAP4430_TEMP_SENSOR_CTRL_OFFSET 0xCC
  41. /**
  42. * Register and bit definitions for OMAP4430
  43. *
  44. * All the macros bellow define the required bits for
  45. * controlling temperature on OMAP4430. Bit defines are
  46. * grouped by register.
  47. */
  48. /* OMAP4430.TEMP_SENSOR bits */
  49. #define OMAP4430_BGAP_TEMPSOFF_MASK BIT(12)
  50. #define OMAP4430_BGAP_TSHUT_MASK BIT(11)
  51. #define OMAP4430_SINGLE_MODE_MASK BIT(10)
  52. #define OMAP4430_BGAP_TEMP_SENSOR_SOC_MASK BIT(9)
  53. #define OMAP4430_BGAP_TEMP_SENSOR_EOCZ_MASK BIT(8)
  54. #define OMAP4430_BGAP_TEMP_SENSOR_DTEMP_MASK (0xff << 0)
  55. /**
  56. * Temperature limits and thresholds for OMAP4430
  57. *
  58. * All the macros bellow are definitions for handling the
  59. * ADC conversions and representation of temperature limits
  60. * and thresholds for OMAP4430.
  61. */
  62. /*
  63. * ADC conversion table limits. Ignore values outside the TRM listed
  64. * range to avoid bogus thermal shutdowns. See omap4430 TRM chapter
  65. * "18.4.10.2.3 ADC Codes Versus Temperature".
  66. */
  67. #define OMAP4430_ADC_START_VALUE 13
  68. #define OMAP4430_ADC_END_VALUE 107
  69. /* bandgap clock limits (no control on 4430) */
  70. #define OMAP4430_MAX_FREQ 32768
  71. #define OMAP4430_MIN_FREQ 32768
  72. /* sensor limits */
  73. #define OMAP4430_MIN_TEMP -40000
  74. #define OMAP4430_MAX_TEMP 125000
  75. #define OMAP4430_HYST_VAL 5000
  76. /**
  77. * *** OMAP4460 *** Applicable for OMAP4470
  78. *
  79. * Below, in sequence, are the Register definitions,
  80. * the bitfields and the temperature definitions for OMAP4460.
  81. */
  82. /**
  83. * OMAP4460 register definitions
  84. *
  85. * Registers are defined as offsets. The offsets are
  86. * relative to FUSE_OPP_BGAP on 4460.
  87. */
  88. /* OMAP4460.FUSE_OPP_BGAP */
  89. #define OMAP4460_FUSE_OPP_BGAP 0x0
  90. /* OMAP4460.TEMP_SENSOR */
  91. #define OMAP4460_TEMP_SENSOR_CTRL_OFFSET 0xCC
  92. /* OMAP4460.BANDGAP_CTRL */
  93. #define OMAP4460_BGAP_CTRL_OFFSET 0x118
  94. /* OMAP4460.BANDGAP_COUNTER */
  95. #define OMAP4460_BGAP_COUNTER_OFFSET 0x11C
  96. /* OMAP4460.BANDGAP_THRESHOLD */
  97. #define OMAP4460_BGAP_THRESHOLD_OFFSET 0x120
  98. /* OMAP4460.TSHUT_THRESHOLD */
  99. #define OMAP4460_BGAP_TSHUT_OFFSET 0x124
  100. /* OMAP4460.BANDGAP_STATUS */
  101. #define OMAP4460_BGAP_STATUS_OFFSET 0x128
  102. /**
  103. * Register bitfields for OMAP4460
  104. *
  105. * All the macros bellow define the required bits for
  106. * controlling temperature on OMAP4460. Bit defines are
  107. * grouped by register.
  108. */
  109. /* OMAP4460.TEMP_SENSOR bits */
  110. #define OMAP4460_BGAP_TEMPSOFF_MASK BIT(13)
  111. #define OMAP4460_BGAP_TEMP_SENSOR_SOC_MASK BIT(11)
  112. #define OMAP4460_BGAP_TEMP_SENSOR_EOCZ_MASK BIT(10)
  113. #define OMAP4460_BGAP_TEMP_SENSOR_DTEMP_MASK (0x3ff << 0)
  114. /* OMAP4460.BANDGAP_CTRL bits */
  115. #define OMAP4460_SINGLE_MODE_MASK BIT(31)
  116. #define OMAP4460_MASK_HOT_MASK BIT(1)
  117. #define OMAP4460_MASK_COLD_MASK BIT(0)
  118. /* OMAP4460.BANDGAP_COUNTER bits */
  119. #define OMAP4460_COUNTER_MASK (0xffffff << 0)
  120. /* OMAP4460.BANDGAP_THRESHOLD bits */
  121. #define OMAP4460_T_HOT_MASK (0x3ff << 16)
  122. #define OMAP4460_T_COLD_MASK (0x3ff << 0)
  123. /* OMAP4460.TSHUT_THRESHOLD bits */
  124. #define OMAP4460_TSHUT_HOT_MASK (0x3ff << 16)
  125. #define OMAP4460_TSHUT_COLD_MASK (0x3ff << 0)
  126. /* OMAP4460.BANDGAP_STATUS bits */
  127. #define OMAP4460_CLEAN_STOP_MASK BIT(3)
  128. #define OMAP4460_BGAP_ALERT_MASK BIT(2)
  129. #define OMAP4460_HOT_FLAG_MASK BIT(1)
  130. #define OMAP4460_COLD_FLAG_MASK BIT(0)
  131. /**
  132. * Temperature limits and thresholds for OMAP4460
  133. *
  134. * All the macros bellow are definitions for handling the
  135. * ADC conversions and representation of temperature limits
  136. * and thresholds for OMAP4460.
  137. */
  138. /* ADC conversion table limits */
  139. #define OMAP4460_ADC_START_VALUE 530
  140. #define OMAP4460_ADC_END_VALUE 932
  141. /* bandgap clock limits */
  142. #define OMAP4460_MAX_FREQ 1500000
  143. #define OMAP4460_MIN_FREQ 1000000
  144. /* sensor limits */
  145. #define OMAP4460_MIN_TEMP -40000
  146. #define OMAP4460_MAX_TEMP 123000
  147. #define OMAP4460_HYST_VAL 5000
  148. /* interrupts thresholds */
  149. #define OMAP4460_TSHUT_HOT 900 /* 122 deg C */
  150. #define OMAP4460_TSHUT_COLD 895 /* 100 deg C */
  151. #define OMAP4460_T_HOT 800 /* 73 deg C */
  152. #define OMAP4460_T_COLD 795 /* 71 deg C */
  153. #endif /* __OMAP4XXX_BANDGAP_H */