ipa_data-v3.5.1.c 9.6 KB

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