ipa_data-v3.5.1.c 9.6 KB

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