ipa_data-v5.5.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* Copyright (C) 2023-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 v5.5 */
  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. IPA_RESOURCE_TYPE_DST_ULSO_SEGMENTS,
  21. };
  22. /* Resource groups used for an SoC having IPA v5.5 */
  23. enum ipa_rsrc_group_id {
  24. /* Source resource group identifiers */
  25. IPA_RSRC_GROUP_SRC_UL = 0,
  26. IPA_RSRC_GROUP_SRC_DL,
  27. IPA_RSRC_GROUP_SRC_UNUSED_2,
  28. IPA_RSRC_GROUP_SRC_UNUSED_3,
  29. IPA_RSRC_GROUP_SRC_URLLC,
  30. IPA_RSRC_GROUP_SRC_U_RX_QC,
  31. IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
  32. /* Destination resource group identifiers */
  33. IPA_RSRC_GROUP_DST_UL = 0,
  34. IPA_RSRC_GROUP_DST_DL,
  35. IPA_RSRC_GROUP_DST_UNUSED_2,
  36. IPA_RSRC_GROUP_DST_UNUSED_3,
  37. IPA_RSRC_GROUP_DST_UNUSED_4,
  38. IPA_RSRC_GROUP_DST_UC,
  39. IPA_RSRC_GROUP_DST_DRB_IP,
  40. IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
  41. };
  42. /* QSB configuration data for an SoC having IPA v5.5 */
  43. static const struct ipa_qsb_data ipa_qsb_data[] = {
  44. [IPA_QSB_MASTER_DDR] = {
  45. .max_writes = 0, /* Unlimited */
  46. .max_reads = 12,
  47. .max_reads_beats = 0,
  48. },
  49. [IPA_QSB_MASTER_PCIE] = {
  50. .max_writes = 0, /* Unlimited */
  51. .max_reads = 8,
  52. .max_reads_beats = 0,
  53. },
  54. };
  55. /* Endpoint configuration data for an SoC having IPA v5.5 */
  56. static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
  57. [IPA_ENDPOINT_AP_COMMAND_TX] = {
  58. .ee_id = GSI_EE_AP,
  59. .channel_id = 12,
  60. .endpoint_id = 14,
  61. .toward_ipa = true,
  62. .channel = {
  63. .tre_count = 256,
  64. .event_count = 256,
  65. .tlv_count = 20,
  66. },
  67. .endpoint = {
  68. .config = {
  69. .resource_group = IPA_RSRC_GROUP_SRC_UL,
  70. .dma_mode = true,
  71. .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
  72. .tx = {
  73. .seq_type = IPA_SEQ_DMA,
  74. },
  75. },
  76. },
  77. },
  78. [IPA_ENDPOINT_AP_LAN_RX] = {
  79. .ee_id = GSI_EE_AP,
  80. .channel_id = 13,
  81. .endpoint_id = 16,
  82. .toward_ipa = false,
  83. .channel = {
  84. .tre_count = 256,
  85. .event_count = 256,
  86. .tlv_count = 9,
  87. },
  88. .endpoint = {
  89. .config = {
  90. .resource_group = IPA_RSRC_GROUP_DST_UL,
  91. .aggregation = true,
  92. .status_enable = true,
  93. .rx = {
  94. .buffer_size = 8192,
  95. .pad_align = ilog2(sizeof(u32)),
  96. .aggr_time_limit = 500,
  97. },
  98. },
  99. },
  100. },
  101. [IPA_ENDPOINT_AP_MODEM_TX] = {
  102. .ee_id = GSI_EE_AP,
  103. .channel_id = 11,
  104. .endpoint_id = 2,
  105. .toward_ipa = true,
  106. .channel = {
  107. .tre_count = 512,
  108. .event_count = 512,
  109. .tlv_count = 25,
  110. },
  111. .endpoint = {
  112. .filter_support = true,
  113. .config = {
  114. .resource_group = IPA_RSRC_GROUP_SRC_UL,
  115. .checksum = true,
  116. .qmap = true,
  117. .status_enable = true,
  118. .tx = {
  119. .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
  120. .status_endpoint =
  121. IPA_ENDPOINT_MODEM_AP_RX,
  122. },
  123. },
  124. },
  125. },
  126. [IPA_ENDPOINT_AP_MODEM_RX] = {
  127. .ee_id = GSI_EE_AP,
  128. .channel_id = 1,
  129. .endpoint_id = 23,
  130. .toward_ipa = false,
  131. .channel = {
  132. .tre_count = 256,
  133. .event_count = 256,
  134. .tlv_count = 9,
  135. },
  136. .endpoint = {
  137. .config = {
  138. .resource_group = IPA_RSRC_GROUP_DST_DL,
  139. .checksum = true,
  140. .qmap = true,
  141. .aggregation = true,
  142. .rx = {
  143. .buffer_size = 8192,
  144. .aggr_time_limit = 500,
  145. .aggr_close_eof = true,
  146. },
  147. },
  148. },
  149. },
  150. [IPA_ENDPOINT_MODEM_AP_TX] = {
  151. .ee_id = GSI_EE_MODEM,
  152. .channel_id = 0,
  153. .endpoint_id = 12,
  154. .toward_ipa = true,
  155. .endpoint = {
  156. .filter_support = true,
  157. },
  158. },
  159. [IPA_ENDPOINT_MODEM_AP_RX] = {
  160. .ee_id = GSI_EE_MODEM,
  161. .channel_id = 7,
  162. .endpoint_id = 21,
  163. .toward_ipa = false,
  164. },
  165. [IPA_ENDPOINT_MODEM_DL_NLO_TX] = {
  166. .ee_id = GSI_EE_MODEM,
  167. .channel_id = 2,
  168. .endpoint_id = 15,
  169. .toward_ipa = true,
  170. .endpoint = {
  171. .filter_support = true,
  172. },
  173. },
  174. };
  175. /* Source resource configuration data for an SoC having IPA v5.5 */
  176. static const struct ipa_resource ipa_resource_src[] = {
  177. [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
  178. .limits[IPA_RSRC_GROUP_SRC_UL] = {
  179. .min = 3, .max = 9,
  180. },
  181. .limits[IPA_RSRC_GROUP_SRC_DL] = {
  182. .min = 4, .max = 10,
  183. },
  184. .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
  185. .min = 1, .max = 63,
  186. },
  187. .limits[IPA_RSRC_GROUP_SRC_U_RX_QC] = {
  188. .min = 0, .max = 63,
  189. },
  190. },
  191. [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
  192. .limits[IPA_RSRC_GROUP_SRC_UL] = {
  193. .min = 9, .max = 9,
  194. },
  195. .limits[IPA_RSRC_GROUP_SRC_DL] = {
  196. .min = 12, .max = 12,
  197. },
  198. .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
  199. .min = 10, .max = 10,
  200. },
  201. },
  202. [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
  203. .limits[IPA_RSRC_GROUP_SRC_UL] = {
  204. .min = 9, .max = 9,
  205. },
  206. .limits[IPA_RSRC_GROUP_SRC_DL] = {
  207. .min = 24, .max = 24,
  208. },
  209. .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
  210. .min = 20, .max = 20,
  211. },
  212. },
  213. [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
  214. .limits[IPA_RSRC_GROUP_SRC_UL] = {
  215. .min = 0, .max = 63,
  216. },
  217. .limits[IPA_RSRC_GROUP_SRC_DL] = {
  218. .min = 0, .max = 63,
  219. },
  220. .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
  221. .min = 1, .max = 63,
  222. },
  223. .limits[IPA_RSRC_GROUP_SRC_U_RX_QC] = {
  224. .min = 0, .max = 63,
  225. },
  226. },
  227. [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
  228. .limits[IPA_RSRC_GROUP_SRC_UL] = {
  229. .min = 22, .max = 22,
  230. },
  231. .limits[IPA_RSRC_GROUP_SRC_DL] = {
  232. .min = 16, .max = 16,
  233. },
  234. .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
  235. .min = 16, .max = 16,
  236. },
  237. },
  238. };
  239. /* Destination resource configuration data for an SoC having IPA v5.5 */
  240. static const struct ipa_resource ipa_resource_dst[] = {
  241. [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
  242. .limits[IPA_RSRC_GROUP_DST_UL] = {
  243. .min = 6, .max = 6,
  244. },
  245. .limits[IPA_RSRC_GROUP_DST_DL] = {
  246. .min = 5, .max = 5,
  247. },
  248. .limits[IPA_RSRC_GROUP_DST_DRB_IP] = {
  249. .min = 39, .max = 39,
  250. },
  251. },
  252. [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
  253. .limits[IPA_RSRC_GROUP_DST_UL] = {
  254. .min = 0, .max = 3,
  255. },
  256. .limits[IPA_RSRC_GROUP_DST_DL] = {
  257. .min = 0, .max = 3,
  258. },
  259. },
  260. [IPA_RESOURCE_TYPE_DST_ULSO_SEGMENTS] = {
  261. .limits[IPA_RSRC_GROUP_DST_UL] = {
  262. .min = 0, .max = 63,
  263. },
  264. .limits[IPA_RSRC_GROUP_DST_DL] = {
  265. .min = 0, .max = 63,
  266. },
  267. },
  268. };
  269. /* Resource configuration data for an SoC having IPA v5.5 */
  270. static const struct ipa_resource_data ipa_resource_data = {
  271. .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
  272. .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
  273. .resource_src_count = ARRAY_SIZE(ipa_resource_src),
  274. .resource_src = ipa_resource_src,
  275. .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
  276. .resource_dst = ipa_resource_dst,
  277. };
  278. /* IPA-resident memory region data for an SoC having IPA v5.5 */
  279. static const struct ipa_mem ipa_mem_local_data[] = {
  280. {
  281. .id = IPA_MEM_UC_EVENT_RING,
  282. .offset = 0x0000,
  283. .size = 0x1000,
  284. .canary_count = 0,
  285. },
  286. {
  287. .id = IPA_MEM_UC_SHARED,
  288. .offset = 0x1000,
  289. .size = 0x0080,
  290. .canary_count = 0,
  291. },
  292. {
  293. .id = IPA_MEM_UC_INFO,
  294. .offset = 0x1080,
  295. .size = 0x0200,
  296. .canary_count = 0,
  297. },
  298. {
  299. .id = IPA_MEM_V4_FILTER_HASHED,
  300. .offset = 0x1288,
  301. .size = 0x0078,
  302. .canary_count = 2,
  303. },
  304. {
  305. .id = IPA_MEM_V4_FILTER,
  306. .offset = 0x1308,
  307. .size = 0x0078,
  308. .canary_count = 2,
  309. },
  310. {
  311. .id = IPA_MEM_V6_FILTER_HASHED,
  312. .offset = 0x1388,
  313. .size = 0x0078,
  314. .canary_count = 2,
  315. },
  316. {
  317. .id = IPA_MEM_V6_FILTER,
  318. .offset = 0x1408,
  319. .size = 0x0078,
  320. .canary_count = 2,
  321. },
  322. {
  323. .id = IPA_MEM_V4_ROUTE_HASHED,
  324. .offset = 0x1488,
  325. .size = 0x0098,
  326. .canary_count = 2,
  327. },
  328. {
  329. .id = IPA_MEM_V4_ROUTE,
  330. .offset = 0x1528,
  331. .size = 0x0098,
  332. .canary_count = 2,
  333. },
  334. {
  335. .id = IPA_MEM_V6_ROUTE_HASHED,
  336. .offset = 0x15c8,
  337. .size = 0x0098,
  338. .canary_count = 2,
  339. },
  340. {
  341. .id = IPA_MEM_V6_ROUTE,
  342. .offset = 0x1668,
  343. .size = 0x0098,
  344. .canary_count = 2,
  345. },
  346. {
  347. .id = IPA_MEM_MODEM_HEADER,
  348. .offset = 0x1708,
  349. .size = 0x0240,
  350. .canary_count = 2,
  351. },
  352. {
  353. .id = IPA_MEM_AP_HEADER,
  354. .offset = 0x1948,
  355. .size = 0x01e0,
  356. .canary_count = 0,
  357. },
  358. {
  359. .id = IPA_MEM_MODEM_PROC_CTX,
  360. .offset = 0x1b40,
  361. .size = 0x0b20,
  362. .canary_count = 2,
  363. },
  364. {
  365. .id = IPA_MEM_AP_PROC_CTX,
  366. .offset = 0x2660,
  367. .size = 0x0200,
  368. .canary_count = 0,
  369. },
  370. {
  371. .id = IPA_MEM_STATS_QUOTA_MODEM,
  372. .offset = 0x2868,
  373. .size = 0x0060,
  374. .canary_count = 2,
  375. },
  376. {
  377. .id = IPA_MEM_STATS_QUOTA_AP,
  378. .offset = 0x28c8,
  379. .size = 0x0048,
  380. .canary_count = 0,
  381. },
  382. {
  383. .id = IPA_MEM_STATS_TETHERING,
  384. .offset = 0x2910,
  385. .size = 0x03c0,
  386. .canary_count = 0,
  387. },
  388. {
  389. .id = IPA_MEM_AP_V4_FILTER,
  390. .offset = 0x29b8,
  391. .size = 0x0188,
  392. .canary_count = 2,
  393. },
  394. {
  395. .id = IPA_MEM_AP_V6_FILTER,
  396. .offset = 0x2b40,
  397. .size = 0x0228,
  398. .canary_count = 0,
  399. },
  400. {
  401. .id = IPA_MEM_STATS_FILTER_ROUTE,
  402. .offset = 0x2cd0,
  403. .size = 0x0ba0,
  404. .canary_count = 2,
  405. },
  406. {
  407. .id = IPA_MEM_STATS_DROP,
  408. .offset = 0x3870,
  409. .size = 0x0020,
  410. .canary_count = 0,
  411. },
  412. {
  413. .id = IPA_MEM_MODEM,
  414. .offset = 0x3898,
  415. .size = 0x0d48,
  416. .canary_count = 2,
  417. },
  418. {
  419. .id = IPA_MEM_NAT_TABLE,
  420. .offset = 0x45e0,
  421. .size = 0x0900,
  422. .canary_count = 0,
  423. },
  424. {
  425. .id = IPA_MEM_PDN_CONFIG,
  426. .offset = 0x4ee8,
  427. .size = 0x0100,
  428. .canary_count = 2,
  429. },
  430. };
  431. /* Memory configuration data for an SoC having IPA v5.5 */
  432. static const struct ipa_mem_data ipa_mem_data = {
  433. .local_count = ARRAY_SIZE(ipa_mem_local_data),
  434. .local = ipa_mem_local_data,
  435. .imem_addr = 0x14688000,
  436. .imem_size = 0x00002000,
  437. .smem_size = 0x0000b000,
  438. };
  439. /* Interconnect rates are in 1000 byte/second units */
  440. static const struct ipa_interconnect_data ipa_interconnect_data[] = {
  441. {
  442. .name = "memory",
  443. .peak_bandwidth = 1900000, /* 1.9 GBps */
  444. .average_bandwidth = 600000, /* 600 MBps */
  445. },
  446. /* Average rate is unused for the next interconnect */
  447. {
  448. .name = "config",
  449. .peak_bandwidth = 76800, /* 76.8 MBps */
  450. .average_bandwidth = 0, /* unused */
  451. },
  452. };
  453. /* Clock and interconnect configuration data for an SoC having IPA v5.5 */
  454. static const struct ipa_power_data ipa_power_data = {
  455. .core_clock_rate = 120 * 1000 * 1000, /* Hz */
  456. .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
  457. .interconnect_data = ipa_interconnect_data,
  458. };
  459. /* Configuration data for an SoC having IPA v5.5. */
  460. const struct ipa_data ipa_data_v5_5 = {
  461. .version = IPA_VERSION_5_5,
  462. .qsb_count = ARRAY_SIZE(ipa_qsb_data),
  463. .qsb_data = ipa_qsb_data,
  464. .modem_route_count = 11,
  465. .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
  466. .endpoint_data = ipa_gsi_endpoint_data,
  467. .resource_data = &ipa_resource_data,
  468. .mem_data = &ipa_mem_data,
  469. .power_data = &ipa_power_data,
  470. };