ipa_data-v4.2.c 8.5 KB

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