k3-psil-am62.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com
  4. */
  5. #include <linux/kernel.h>
  6. #include "k3-psil-priv.h"
  7. #define PSIL_PDMA_XY_PKT(x) \
  8. { \
  9. .thread_id = x, \
  10. .ep_config = { \
  11. .ep_type = PSIL_EP_PDMA_XY, \
  12. .mapped_channel_id = -1, \
  13. .default_flow_id = -1, \
  14. .pkt_mode = 1, \
  15. }, \
  16. }
  17. #define PSIL_ETHERNET(x, ch, flow_base, flow_cnt) \
  18. { \
  19. .thread_id = x, \
  20. .ep_config = { \
  21. .ep_type = PSIL_EP_NATIVE, \
  22. .pkt_mode = 1, \
  23. .needs_epib = 1, \
  24. .psd_size = 16, \
  25. .mapped_channel_id = ch, \
  26. .flow_start = flow_base, \
  27. .flow_num = flow_cnt, \
  28. .default_flow_id = flow_base, \
  29. }, \
  30. }
  31. #define PSIL_SAUL(x, ch, flow_base, flow_cnt, default_flow, tx) \
  32. { \
  33. .thread_id = x, \
  34. .ep_config = { \
  35. .ep_type = PSIL_EP_NATIVE, \
  36. .pkt_mode = 1, \
  37. .needs_epib = 1, \
  38. .psd_size = 64, \
  39. .mapped_channel_id = ch, \
  40. .flow_start = flow_base, \
  41. .flow_num = flow_cnt, \
  42. .default_flow_id = default_flow, \
  43. .notdpkt = tx, \
  44. }, \
  45. }
  46. #define PSIL_PDMA_MCASP(x) \
  47. { \
  48. .thread_id = x, \
  49. .ep_config = { \
  50. .ep_type = PSIL_EP_PDMA_XY, \
  51. .pdma_acc32 = 1, \
  52. .pdma_burst = 1, \
  53. }, \
  54. }
  55. #define PSIL_CSI2RX(x) \
  56. { \
  57. .thread_id = x, \
  58. .ep_config = { \
  59. .ep_type = PSIL_EP_NATIVE, \
  60. }, \
  61. }
  62. /* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */
  63. static struct psil_ep am62_src_ep_map[] = {
  64. /* SAUL */
  65. PSIL_SAUL(0x7504, 20, 35, 8, 35, 0),
  66. PSIL_SAUL(0x7505, 21, 35, 8, 36, 0),
  67. PSIL_SAUL(0x7506, 22, 43, 8, 43, 0),
  68. PSIL_SAUL(0x7507, 23, 43, 8, 44, 0),
  69. /* PDMA_MAIN0 - SPI0-3 */
  70. PSIL_PDMA_XY_PKT(0x4302),
  71. PSIL_PDMA_XY_PKT(0x4303),
  72. PSIL_PDMA_XY_PKT(0x4304),
  73. PSIL_PDMA_XY_PKT(0x4305),
  74. PSIL_PDMA_XY_PKT(0x4306),
  75. PSIL_PDMA_XY_PKT(0x4307),
  76. PSIL_PDMA_XY_PKT(0x4308),
  77. PSIL_PDMA_XY_PKT(0x4309),
  78. PSIL_PDMA_XY_PKT(0x430a),
  79. PSIL_PDMA_XY_PKT(0x430b),
  80. PSIL_PDMA_XY_PKT(0x430c),
  81. PSIL_PDMA_XY_PKT(0x430d),
  82. /* PDMA_MAIN1 - UART0-6 */
  83. PSIL_PDMA_XY_PKT(0x4400),
  84. PSIL_PDMA_XY_PKT(0x4401),
  85. PSIL_PDMA_XY_PKT(0x4402),
  86. PSIL_PDMA_XY_PKT(0x4403),
  87. PSIL_PDMA_XY_PKT(0x4404),
  88. PSIL_PDMA_XY_PKT(0x4405),
  89. PSIL_PDMA_XY_PKT(0x4406),
  90. /* PDMA_MAIN2 - MCASP0-2 */
  91. PSIL_PDMA_MCASP(0x4500),
  92. PSIL_PDMA_MCASP(0x4501),
  93. PSIL_PDMA_MCASP(0x4502),
  94. /* CPSW3G */
  95. PSIL_ETHERNET(0x4600, 19, 19, 16),
  96. /* CSI2RX */
  97. PSIL_CSI2RX(0x4700),
  98. PSIL_CSI2RX(0x4701),
  99. PSIL_CSI2RX(0x4702),
  100. PSIL_CSI2RX(0x4703),
  101. PSIL_CSI2RX(0x4704),
  102. PSIL_CSI2RX(0x4705),
  103. PSIL_CSI2RX(0x4706),
  104. PSIL_CSI2RX(0x4707),
  105. PSIL_CSI2RX(0x4708),
  106. PSIL_CSI2RX(0x4709),
  107. PSIL_CSI2RX(0x470a),
  108. PSIL_CSI2RX(0x470b),
  109. PSIL_CSI2RX(0x470c),
  110. PSIL_CSI2RX(0x470d),
  111. PSIL_CSI2RX(0x470e),
  112. PSIL_CSI2RX(0x470f),
  113. PSIL_CSI2RX(0x4710),
  114. PSIL_CSI2RX(0x4711),
  115. PSIL_CSI2RX(0x4712),
  116. PSIL_CSI2RX(0x4713),
  117. PSIL_CSI2RX(0x4714),
  118. PSIL_CSI2RX(0x4715),
  119. PSIL_CSI2RX(0x4716),
  120. PSIL_CSI2RX(0x4717),
  121. PSIL_CSI2RX(0x4718),
  122. PSIL_CSI2RX(0x4719),
  123. PSIL_CSI2RX(0x471a),
  124. PSIL_CSI2RX(0x471b),
  125. PSIL_CSI2RX(0x471c),
  126. PSIL_CSI2RX(0x471d),
  127. PSIL_CSI2RX(0x471e),
  128. PSIL_CSI2RX(0x471f),
  129. };
  130. /* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */
  131. static struct psil_ep am62_dst_ep_map[] = {
  132. /* SAUL */
  133. PSIL_SAUL(0xf500, 27, 83, 8, 83, 1),
  134. PSIL_SAUL(0xf501, 28, 91, 8, 91, 1),
  135. /* PDMA_MAIN0 - SPI0-3 */
  136. PSIL_PDMA_XY_PKT(0xc302),
  137. PSIL_PDMA_XY_PKT(0xc303),
  138. PSIL_PDMA_XY_PKT(0xc304),
  139. PSIL_PDMA_XY_PKT(0xc305),
  140. PSIL_PDMA_XY_PKT(0xc306),
  141. PSIL_PDMA_XY_PKT(0xc307),
  142. PSIL_PDMA_XY_PKT(0xc308),
  143. PSIL_PDMA_XY_PKT(0xc309),
  144. PSIL_PDMA_XY_PKT(0xc30a),
  145. PSIL_PDMA_XY_PKT(0xc30b),
  146. PSIL_PDMA_XY_PKT(0xc30c),
  147. PSIL_PDMA_XY_PKT(0xc30d),
  148. /* PDMA_MAIN1 - UART0-6 */
  149. PSIL_PDMA_XY_PKT(0xc400),
  150. PSIL_PDMA_XY_PKT(0xc401),
  151. PSIL_PDMA_XY_PKT(0xc402),
  152. PSIL_PDMA_XY_PKT(0xc403),
  153. PSIL_PDMA_XY_PKT(0xc404),
  154. PSIL_PDMA_XY_PKT(0xc405),
  155. PSIL_PDMA_XY_PKT(0xc406),
  156. /* PDMA_MAIN2 - MCASP0-2 */
  157. PSIL_PDMA_MCASP(0xc500),
  158. PSIL_PDMA_MCASP(0xc501),
  159. PSIL_PDMA_MCASP(0xc502),
  160. /* CPSW3G */
  161. PSIL_ETHERNET(0xc600, 19, 19, 8),
  162. PSIL_ETHERNET(0xc601, 20, 27, 8),
  163. PSIL_ETHERNET(0xc602, 21, 35, 8),
  164. PSIL_ETHERNET(0xc603, 22, 43, 8),
  165. PSIL_ETHERNET(0xc604, 23, 51, 8),
  166. PSIL_ETHERNET(0xc605, 24, 59, 8),
  167. PSIL_ETHERNET(0xc606, 25, 67, 8),
  168. PSIL_ETHERNET(0xc607, 26, 75, 8),
  169. };
  170. struct psil_ep_map am62_ep_map = {
  171. .name = "am62",
  172. .src = am62_src_ep_map,
  173. .src_count = ARRAY_SIZE(am62_src_ep_map),
  174. .dst = am62_dst_ep_map,
  175. .dst_count = ARRAY_SIZE(am62_dst_ep_map),
  176. };