hw_host1x04_channel.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2013 NVIDIA Corporation.
  4. */
  5. /*
  6. * Function naming determines intended use:
  7. *
  8. * <x>_r(void) : Returns the offset for register <x>.
  9. *
  10. * <x>_w(void) : Returns the word offset for word (4 byte) element <x>.
  11. *
  12. * <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits.
  13. *
  14. * <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted
  15. * and masked to place it at field <y> of register <x>. This value
  16. * can be |'d with others to produce a full register value for
  17. * register <x>.
  18. *
  19. * <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This
  20. * value can be ~'d and then &'d to clear the value of field <y> for
  21. * register <x>.
  22. *
  23. * <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted
  24. * to place it at field <y> of register <x>. This value can be |'d
  25. * with others to produce a full register value for <x>.
  26. *
  27. * <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register
  28. * <x> value 'r' after being shifted to place its LSB at bit 0.
  29. * This value is suitable for direct comparison with other unshifted
  30. * values appropriate for use in field <y> of register <x>.
  31. *
  32. * <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for
  33. * field <y> of register <x>. This value is suitable for direct
  34. * comparison with unshifted values appropriate for use in field <y>
  35. * of register <x>.
  36. */
  37. #ifndef HOST1X_HW_HOST1X04_CHANNEL_H
  38. #define HOST1X_HW_HOST1X04_CHANNEL_H
  39. static inline u32 host1x_channel_fifostat_r(void)
  40. {
  41. return 0x0;
  42. }
  43. #define HOST1X_CHANNEL_FIFOSTAT \
  44. host1x_channel_fifostat_r()
  45. static inline u32 host1x_channel_fifostat_cfempty_v(u32 r)
  46. {
  47. return (r >> 11) & 0x1;
  48. }
  49. #define HOST1X_CHANNEL_FIFOSTAT_CFEMPTY_V(r) \
  50. host1x_channel_fifostat_cfempty_v(r)
  51. static inline u32 host1x_channel_dmastart_r(void)
  52. {
  53. return 0x14;
  54. }
  55. #define HOST1X_CHANNEL_DMASTART \
  56. host1x_channel_dmastart_r()
  57. static inline u32 host1x_channel_dmaput_r(void)
  58. {
  59. return 0x18;
  60. }
  61. #define HOST1X_CHANNEL_DMAPUT \
  62. host1x_channel_dmaput_r()
  63. static inline u32 host1x_channel_dmaget_r(void)
  64. {
  65. return 0x1c;
  66. }
  67. #define HOST1X_CHANNEL_DMAGET \
  68. host1x_channel_dmaget_r()
  69. static inline u32 host1x_channel_dmaend_r(void)
  70. {
  71. return 0x20;
  72. }
  73. #define HOST1X_CHANNEL_DMAEND \
  74. host1x_channel_dmaend_r()
  75. static inline u32 host1x_channel_dmactrl_r(void)
  76. {
  77. return 0x24;
  78. }
  79. #define HOST1X_CHANNEL_DMACTRL \
  80. host1x_channel_dmactrl_r()
  81. static inline u32 host1x_channel_dmactrl_dmastop(void)
  82. {
  83. return 1 << 0;
  84. }
  85. #define HOST1X_CHANNEL_DMACTRL_DMASTOP \
  86. host1x_channel_dmactrl_dmastop()
  87. static inline u32 host1x_channel_dmactrl_dmastop_v(u32 r)
  88. {
  89. return (r >> 0) & 0x1;
  90. }
  91. #define HOST1X_CHANNEL_DMACTRL_DMASTOP_V(r) \
  92. host1x_channel_dmactrl_dmastop_v(r)
  93. static inline u32 host1x_channel_dmactrl_dmagetrst(void)
  94. {
  95. return 1 << 1;
  96. }
  97. #define HOST1X_CHANNEL_DMACTRL_DMAGETRST \
  98. host1x_channel_dmactrl_dmagetrst()
  99. static inline u32 host1x_channel_dmactrl_dmainitget(void)
  100. {
  101. return 1 << 2;
  102. }
  103. #define HOST1X_CHANNEL_DMACTRL_DMAINITGET \
  104. host1x_channel_dmactrl_dmainitget()
  105. static inline u32 host1x_channel_channelctrl_r(void)
  106. {
  107. return 0x98;
  108. }
  109. #define HOST1X_CHANNEL_CHANNELCTRL \
  110. host1x_channel_channelctrl_r()
  111. static inline u32 host1x_channel_channelctrl_kernel_filter_gbuffer_f(u32 v)
  112. {
  113. return (v & 0x1) << 2;
  114. }
  115. #define HOST1X_CHANNEL_CHANNELCTRL_KERNEL_FILTER_GBUFFER(v) \
  116. host1x_channel_channelctrl_kernel_filter_gbuffer_f(v)
  117. #endif