ipa_data-v4.2.c 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* Copyright (C) 2019-2024 Linaro Ltd. */
  3. #include <linux/array_size.h>
  4. #include <linux/log2.h>
  5. #include "../ipa_data.h"
  6. #include "../ipa_endpoint.h"
  7. #include "../ipa_mem.h"
  8. #include "../ipa_version.h"
  9. /** enum ipa_resource_type - IPA resource types for an SoC having IPA v4.2 */
  10. enum ipa_resource_type {
  11. /* Source resource types; first must have value 0 */
  12. IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0,
  13. IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
  14. IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
  15. IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
  16. IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
  17. /* Destination resource types; first must have value 0 */
  18. IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0,
  19. IPA_RESOURCE_TYPE_DST_DPS_DMARS,
  20. };
  21. /* Resource groups used for an SoC having IPA v4.2 */
  22. enum ipa_rsrc_group_id {
  23. /* Source resource group identifiers */
  24. IPA_RSRC_GROUP_SRC_UL_DL = 0,
  25. IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
  26. /* Destination resource group identifiers */
  27. IPA_RSRC_GROUP_DST_UL_DL_DPL = 0,
  28. IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
  29. };
  30. /* QSB configuration data for an SoC having IPA v4.2 */
  31. static const struct ipa_qsb_data ipa_qsb_data[] = {
  32. [IPA_QSB_MASTER_DDR] = {
  33. .max_writes = 8,
  34. .max_reads = 12,
  35. /* no outstanding read byte (beat) limit */
  36. },
  37. };
  38. /* Endpoint configuration data for an SoC having IPA v4.2 */
  39. static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
  40. [IPA_ENDPOINT_AP_COMMAND_TX] = {
  41. .ee_id = GSI_EE_AP,
  42. .channel_id = 1,
  43. .endpoint_id = 6,
  44. .toward_ipa = true,
  45. .channel = {
  46. .tre_count = 256,
  47. .event_count = 256,
  48. .tlv_count = 20,
  49. },
  50. .endpoint = {
  51. .config = {
  52. .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
  53. .dma_mode = true,
  54. .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
  55. .tx = {
  56. .seq_type = IPA_SEQ_DMA,
  57. },
  58. },
  59. },
  60. },
  61. [IPA_ENDPOINT_AP_LAN_RX] = {
  62. .ee_id = GSI_EE_AP,
  63. .channel_id = 2,
  64. .endpoint_id = 8,
  65. .toward_ipa = false,
  66. .channel = {
  67. .tre_count = 256,
  68. .event_count = 256,
  69. .tlv_count = 6,
  70. },
  71. .endpoint = {
  72. .config = {
  73. .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
  74. .aggregation = true,
  75. .status_enable = true,
  76. .rx = {
  77. .buffer_size = 8192,
  78. .pad_align = ilog2(sizeof(u32)),
  79. .aggr_time_limit = 500,
  80. },
  81. },
  82. },
  83. },
  84. [IPA_ENDPOINT_AP_MODEM_TX] = {
  85. .ee_id = GSI_EE_AP,
  86. .channel_id = 0,
  87. .endpoint_id = 1,
  88. .toward_ipa = true,
  89. .channel = {
  90. .tre_count = 512,
  91. .event_count = 512,
  92. .tlv_count = 8,
  93. },
  94. .endpoint = {
  95. .filter_support = true,
  96. .config = {
  97. .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
  98. .checksum = true,
  99. .qmap = true,
  100. .status_enable = true,
  101. .tx = {
  102. .seq_type = IPA_SEQ_1_PASS_SKIP_LAST_UC,
  103. .seq_rep_type = IPA_SEQ_REP_DMA_PARSER,
  104. .status_endpoint =
  105. IPA_ENDPOINT_MODEM_AP_RX,
  106. },
  107. },
  108. },
  109. },
  110. [IPA_ENDPOINT_AP_MODEM_RX] = {
  111. .ee_id = GSI_EE_AP,
  112. .channel_id = 3,
  113. .endpoint_id = 9,
  114. .toward_ipa = false,
  115. .channel = {
  116. .tre_count = 256,
  117. .event_count = 256,
  118. .tlv_count = 6,
  119. },
  120. .endpoint = {
  121. .config = {
  122. .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
  123. .checksum = true,
  124. .qmap = true,
  125. .aggregation = true,
  126. .rx = {
  127. .buffer_size = 8192,
  128. .aggr_time_limit = 500,
  129. .aggr_close_eof = true,
  130. },
  131. },
  132. },
  133. },
  134. [IPA_ENDPOINT_MODEM_COMMAND_TX] = {
  135. .ee_id = GSI_EE_MODEM,
  136. .channel_id = 1,
  137. .endpoint_id = 5,
  138. .toward_ipa = true,
  139. },
  140. [IPA_ENDPOINT_MODEM_LAN_RX] = {
  141. .ee_id = GSI_EE_MODEM,
  142. .channel_id = 3,
  143. .endpoint_id = 11,
  144. .toward_ipa = false,
  145. },
  146. [IPA_ENDPOINT_MODEM_AP_TX] = {
  147. .ee_id = GSI_EE_MODEM,
  148. .channel_id = 0,
  149. .endpoint_id = 4,
  150. .toward_ipa = true,
  151. .endpoint = {
  152. .filter_support = true,
  153. },
  154. },
  155. [IPA_ENDPOINT_MODEM_AP_RX] = {
  156. .ee_id = GSI_EE_MODEM,
  157. .channel_id = 2,
  158. .endpoint_id = 10,
  159. .toward_ipa = false,
  160. },
  161. };
  162. /* Source resource configuration data for an SoC having IPA v4.2 */
  163. static const struct ipa_resource ipa_resource_src[] = {
  164. [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
  165. .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
  166. .min = 3, .max = 63,
  167. },
  168. },
  169. [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
  170. .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
  171. .min = 3, .max = 3,
  172. },
  173. },
  174. [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
  175. .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
  176. .min = 10, .max = 10,
  177. },
  178. },
  179. [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
  180. .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
  181. .min = 1, .max = 1,
  182. },
  183. },
  184. [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
  185. .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
  186. .min = 5, .max = 5,
  187. },
  188. },
  189. };
  190. /* Destination resource configuration data for an SoC having IPA v4.2 */
  191. static const struct ipa_resource ipa_resource_dst[] = {
  192. [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
  193. .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
  194. .min = 3, .max = 3,
  195. },
  196. },
  197. [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
  198. .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
  199. .min = 1, .max = 63,
  200. },
  201. },
  202. };
  203. /* Resource configuration data for an SoC having IPA v4.2 */
  204. static const struct ipa_resource_data ipa_resource_data = {
  205. .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
  206. .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
  207. .resource_src_count = ARRAY_SIZE(ipa_resource_src),
  208. .resource_src = ipa_resource_src,
  209. .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
  210. .resource_dst = ipa_resource_dst,
  211. };
  212. /* IPA-resident memory region data for an SoC having IPA v4.2 */
  213. static const struct ipa_mem ipa_mem_local_data[] = {
  214. {
  215. .id = IPA_MEM_UC_SHARED,
  216. .offset = 0x0000,
  217. .size = 0x0080,
  218. .canary_count = 0,
  219. },
  220. {
  221. .id = IPA_MEM_UC_INFO,
  222. .offset = 0x0080,
  223. .size = 0x0200,
  224. .canary_count = 0,
  225. },
  226. {
  227. .id = IPA_MEM_V4_FILTER_HASHED,
  228. .offset = 0x0288,
  229. .size = 0,
  230. .canary_count = 2,
  231. },
  232. {
  233. .id = IPA_MEM_V4_FILTER,
  234. .offset = 0x0290,
  235. .size = 0x0078,
  236. .canary_count = 2,
  237. },
  238. {
  239. .id = IPA_MEM_V6_FILTER_HASHED,
  240. .offset = 0x0310,
  241. .size = 0,
  242. .canary_count = 2,
  243. },
  244. {
  245. .id = IPA_MEM_V6_FILTER,
  246. .offset = 0x0318,
  247. .size = 0x0078,
  248. .canary_count = 2,
  249. },
  250. {
  251. .id = IPA_MEM_V4_ROUTE_HASHED,
  252. .offset = 0x0398,
  253. .size = 0,
  254. .canary_count = 2,
  255. },
  256. {
  257. .id = IPA_MEM_V4_ROUTE,
  258. .offset = 0x03a0,
  259. .size = 0x0078,
  260. .canary_count = 2,
  261. },
  262. {
  263. .id = IPA_MEM_V6_ROUTE_HASHED,
  264. .offset = 0x0420,
  265. .size = 0,
  266. .canary_count = 2,
  267. },
  268. {
  269. .id = IPA_MEM_V6_ROUTE,
  270. .offset = 0x0428,
  271. .size = 0x0078,
  272. .canary_count = 2,
  273. },
  274. {
  275. .id = IPA_MEM_MODEM_HEADER,
  276. .offset = 0x04a8,
  277. .size = 0x0140,
  278. .canary_count = 2,
  279. },
  280. {
  281. .id = IPA_MEM_MODEM_PROC_CTX,
  282. .offset = 0x05f0,
  283. .size = 0x0200,
  284. .canary_count = 2,
  285. },
  286. {
  287. .id = IPA_MEM_AP_PROC_CTX,
  288. .offset = 0x07f0,
  289. .size = 0x0200,
  290. .canary_count = 0,
  291. },
  292. {
  293. .id = IPA_MEM_PDN_CONFIG,
  294. .offset = 0x09f8,
  295. .size = 0x0050,
  296. .canary_count = 2,
  297. },
  298. {
  299. .id = IPA_MEM_STATS_QUOTA_MODEM,
  300. .offset = 0x0a50,
  301. .size = 0x0060,
  302. .canary_count = 2,
  303. },
  304. {
  305. .id = IPA_MEM_STATS_TETHERING,
  306. .offset = 0x0ab0,
  307. .size = 0x0140,
  308. .canary_count = 0,
  309. },
  310. {
  311. .id = IPA_MEM_MODEM,
  312. .offset = 0x0bf0,
  313. .size = 0x140c,
  314. .canary_count = 0,
  315. },
  316. {
  317. .id = IPA_MEM_END_MARKER,
  318. .offset = 0x2000,
  319. .size = 0,
  320. .canary_count = 1,
  321. },
  322. };
  323. /* Memory configuration data for an SoC having IPA v4.2 */
  324. static const struct ipa_mem_data ipa_mem_data = {
  325. .local_count = ARRAY_SIZE(ipa_mem_local_data),
  326. .local = ipa_mem_local_data,
  327. .imem_addr = 0x146a8000,
  328. .imem_size = 0x00002000,
  329. .smem_size = 0x00002000,
  330. };
  331. /* Interconnect rates are in 1000 byte/second units */
  332. static const struct ipa_interconnect_data ipa_interconnect_data[] = {
  333. {
  334. .name = "memory",
  335. .peak_bandwidth = 465000, /* 465 MBps */
  336. .average_bandwidth = 80000, /* 80 MBps */
  337. },
  338. /* Average bandwidth is unused for the next two interconnects */
  339. {
  340. .name = "imem",
  341. .peak_bandwidth = 68570, /* 68.570 MBps */
  342. .average_bandwidth = 0, /* unused */
  343. },
  344. {
  345. .name = "config",
  346. .peak_bandwidth = 30000, /* 30 MBps */
  347. .average_bandwidth = 0, /* unused */
  348. },
  349. };
  350. /* Clock and interconnect configuration data for an SoC having IPA v4.2 */
  351. static const struct ipa_power_data ipa_power_data = {
  352. .core_clock_rate = 100 * 1000 * 1000, /* Hz */
  353. .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
  354. .interconnect_data = ipa_interconnect_data,
  355. };
  356. /* Configuration data for an SoC having IPA v4.2 */
  357. const struct ipa_data ipa_data_v4_2 = {
  358. .version = IPA_VERSION_4_2,
  359. /* backward_compat value is 0 */
  360. .qsb_count = ARRAY_SIZE(ipa_qsb_data),
  361. .qsb_data = ipa_qsb_data,
  362. .modem_route_count = 8,
  363. .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
  364. .endpoint_data = ipa_gsi_endpoint_data,
  365. .resource_data = &ipa_resource_data,
  366. .mem_data = &ipa_mem_data,
  367. .power_data = &ipa_power_data,
  368. };