hw_host1x02_uclass.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * Copyright (c) 2013 NVIDIA Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. /*
  18. * Function naming determines intended use:
  19. *
  20. * <x>_r(void) : Returns the offset for register <x>.
  21. *
  22. * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
  23. *
  24. * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
  25. *
  26. * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted
  27. * and masked to place it at field <y> of register <x>. This value
  28. * can be |'d with others to produce a full register value for
  29. * register <x>.
  30. *
  31. * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This
  32. * value can be ~'d and then &'d to clear the value of field <y> for
  33. * register <x>.
  34. *
  35. * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted
  36. * to place it at field <y> of register <x>. This value can be |'d
  37. * with others to produce a full register value for <x>.
  38. *
  39. * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register
  40. * <x> value 'r' after being shifted to place its LSB at bit 0.
  41. * This value is suitable for direct comparison with other unshifted
  42. * values appropriate for use in field <y> of register <x>.
  43. *
  44. * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for
  45. * field <y> of register <x>. This value is suitable for direct
  46. * comparison with unshifted values appropriate for use in field <y>
  47. * of register <x>.
  48. */
  49. #ifndef HOST1X_HW_HOST1X02_UCLASS_H
  50. #define HOST1X_HW_HOST1X02_UCLASS_H
  51. static inline u32 host1x_uclass_incr_syncpt_r(void)
  52. {
  53. return 0x0;
  54. }
  55. #define HOST1X_UCLASS_INCR_SYNCPT \
  56. host1x_uclass_incr_syncpt_r()
  57. static inline u32 host1x_uclass_incr_syncpt_cond_f(u32 v)
  58. {
  59. return (v & 0xff) << 8;
  60. }
  61. #define HOST1X_UCLASS_INCR_SYNCPT_COND_F(v) \
  62. host1x_uclass_incr_syncpt_cond_f(v)
  63. static inline u32 host1x_uclass_incr_syncpt_indx_f(u32 v)
  64. {
  65. return (v & 0xff) << 0;
  66. }
  67. #define HOST1X_UCLASS_INCR_SYNCPT_INDX_F(v) \
  68. host1x_uclass_incr_syncpt_indx_f(v)
  69. static inline u32 host1x_uclass_wait_syncpt_r(void)
  70. {
  71. return 0x8;
  72. }
  73. #define HOST1X_UCLASS_WAIT_SYNCPT \
  74. host1x_uclass_wait_syncpt_r()
  75. static inline u32 host1x_uclass_wait_syncpt_indx_f(u32 v)
  76. {
  77. return (v & 0xff) << 24;
  78. }
  79. #define HOST1X_UCLASS_WAIT_SYNCPT_INDX_F(v) \
  80. host1x_uclass_wait_syncpt_indx_f(v)
  81. static inline u32 host1x_uclass_wait_syncpt_thresh_f(u32 v)
  82. {
  83. return (v & 0xffffff) << 0;
  84. }
  85. #define HOST1X_UCLASS_WAIT_SYNCPT_THRESH_F(v) \
  86. host1x_uclass_wait_syncpt_thresh_f(v)
  87. static inline u32 host1x_uclass_wait_syncpt_base_r(void)
  88. {
  89. return 0x9;
  90. }
  91. #define HOST1X_UCLASS_WAIT_SYNCPT_BASE \
  92. host1x_uclass_wait_syncpt_base_r()
  93. static inline u32 host1x_uclass_wait_syncpt_base_indx_f(u32 v)
  94. {
  95. return (v & 0xff) << 24;
  96. }
  97. #define HOST1X_UCLASS_WAIT_SYNCPT_BASE_INDX_F(v) \
  98. host1x_uclass_wait_syncpt_base_indx_f(v)
  99. static inline u32 host1x_uclass_wait_syncpt_base_base_indx_f(u32 v)
  100. {
  101. return (v & 0xff) << 16;
  102. }
  103. #define HOST1X_UCLASS_WAIT_SYNCPT_BASE_BASE_INDX_F(v) \
  104. host1x_uclass_wait_syncpt_base_base_indx_f(v)
  105. static inline u32 host1x_uclass_wait_syncpt_base_offset_f(u32 v)
  106. {
  107. return (v & 0xffff) << 0;
  108. }
  109. #define HOST1X_UCLASS_WAIT_SYNCPT_BASE_OFFSET_F(v) \
  110. host1x_uclass_wait_syncpt_base_offset_f(v)
  111. static inline u32 host1x_uclass_load_syncpt_base_r(void)
  112. {
  113. return 0xb;
  114. }
  115. #define HOST1X_UCLASS_LOAD_SYNCPT_BASE \
  116. host1x_uclass_load_syncpt_base_r()
  117. static inline u32 host1x_uclass_load_syncpt_base_base_indx_f(u32 v)
  118. {
  119. return (v & 0xff) << 24;
  120. }
  121. #define HOST1X_UCLASS_LOAD_SYNCPT_BASE_BASE_INDX_F(v) \
  122. host1x_uclass_load_syncpt_base_base_indx_f(v)
  123. static inline u32 host1x_uclass_load_syncpt_base_value_f(u32 v)
  124. {
  125. return (v & 0xffffff) << 0;
  126. }
  127. #define HOST1X_UCLASS_LOAD_SYNCPT_BASE_VALUE_F(v) \
  128. host1x_uclass_load_syncpt_base_value_f(v)
  129. static inline u32 host1x_uclass_incr_syncpt_base_base_indx_f(u32 v)
  130. {
  131. return (v & 0xff) << 24;
  132. }
  133. #define HOST1X_UCLASS_INCR_SYNCPT_BASE_BASE_INDX_F(v) \
  134. host1x_uclass_incr_syncpt_base_base_indx_f(v)
  135. static inline u32 host1x_uclass_incr_syncpt_base_offset_f(u32 v)
  136. {
  137. return (v & 0xffffff) << 0;
  138. }
  139. #define HOST1X_UCLASS_INCR_SYNCPT_BASE_OFFSET_F(v) \
  140. host1x_uclass_incr_syncpt_base_offset_f(v)
  141. static inline u32 host1x_uclass_indoff_r(void)
  142. {
  143. return 0x2d;
  144. }
  145. #define HOST1X_UCLASS_INDOFF \
  146. host1x_uclass_indoff_r()
  147. static inline u32 host1x_uclass_indoff_indbe_f(u32 v)
  148. {
  149. return (v & 0xf) << 28;
  150. }
  151. #define HOST1X_UCLASS_INDOFF_INDBE_F(v) \
  152. host1x_uclass_indoff_indbe_f(v)
  153. static inline u32 host1x_uclass_indoff_autoinc_f(u32 v)
  154. {
  155. return (v & 0x1) << 27;
  156. }
  157. #define HOST1X_UCLASS_INDOFF_AUTOINC_F(v) \
  158. host1x_uclass_indoff_autoinc_f(v)
  159. static inline u32 host1x_uclass_indoff_indmodid_f(u32 v)
  160. {
  161. return (v & 0xff) << 18;
  162. }
  163. #define HOST1X_UCLASS_INDOFF_INDMODID_F(v) \
  164. host1x_uclass_indoff_indmodid_f(v)
  165. static inline u32 host1x_uclass_indoff_indroffset_f(u32 v)
  166. {
  167. return (v & 0xffff) << 2;
  168. }
  169. #define HOST1X_UCLASS_INDOFF_INDROFFSET_F(v) \
  170. host1x_uclass_indoff_indroffset_f(v)
  171. static inline u32 host1x_uclass_indoff_rwn_read_v(void)
  172. {
  173. return 1;
  174. }
  175. #define HOST1X_UCLASS_INDOFF_INDROFFSET_F(v) \
  176. host1x_uclass_indoff_indroffset_f(v)
  177. #endif