ipa_data-v4.9.c 9.9 KB

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