1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com
6 #include <linux/kernel.h>
8 #include "k3-psil-priv.h"
10 #define PSIL_PDMA_XY_TR(x) \
14 .ep_type = PSIL_EP_PDMA_XY, \
18 #define PSIL_PDMA_XY_PKT(x) \
22 .ep_type = PSIL_EP_PDMA_XY, \
27 #define PSIL_PDMA_MCASP(x) \
31 .ep_type = PSIL_EP_PDMA_XY, \
37 #define PSIL_ETHERNET(x) \
41 .ep_type = PSIL_EP_NATIVE, \
48 #define PSIL_SA2UL(x, tx) \
52 .ep_type = PSIL_EP_NATIVE, \
60 #define PSIL_CSI2RX(x) \
64 .ep_type = PSIL_EP_NATIVE, \
68 /* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */
69 static struct psil_ep j784s4_src_ep_map
[] = {
70 /* PDMA_MCASP - McASP0-4 */
71 PSIL_PDMA_MCASP(0x4400),
72 PSIL_PDMA_MCASP(0x4401),
73 PSIL_PDMA_MCASP(0x4402),
74 PSIL_PDMA_MCASP(0x4403),
75 PSIL_PDMA_MCASP(0x4404),
76 /* PDMA_SPI_G0 - SPI0-3 */
77 PSIL_PDMA_XY_PKT(0x4600),
78 PSIL_PDMA_XY_PKT(0x4601),
79 PSIL_PDMA_XY_PKT(0x4602),
80 PSIL_PDMA_XY_PKT(0x4603),
81 PSIL_PDMA_XY_PKT(0x4604),
82 PSIL_PDMA_XY_PKT(0x4605),
83 PSIL_PDMA_XY_PKT(0x4606),
84 PSIL_PDMA_XY_PKT(0x4607),
85 PSIL_PDMA_XY_PKT(0x4608),
86 PSIL_PDMA_XY_PKT(0x4609),
87 PSIL_PDMA_XY_PKT(0x460a),
88 PSIL_PDMA_XY_PKT(0x460b),
89 PSIL_PDMA_XY_PKT(0x460c),
90 PSIL_PDMA_XY_PKT(0x460d),
91 PSIL_PDMA_XY_PKT(0x460e),
92 PSIL_PDMA_XY_PKT(0x460f),
93 /* PDMA_SPI_G1 - SPI4-7 */
94 PSIL_PDMA_XY_PKT(0x4620),
95 PSIL_PDMA_XY_PKT(0x4621),
96 PSIL_PDMA_XY_PKT(0x4622),
97 PSIL_PDMA_XY_PKT(0x4623),
98 PSIL_PDMA_XY_PKT(0x4624),
99 PSIL_PDMA_XY_PKT(0x4625),
100 PSIL_PDMA_XY_PKT(0x4626),
101 PSIL_PDMA_XY_PKT(0x4627),
102 PSIL_PDMA_XY_PKT(0x4628),
103 PSIL_PDMA_XY_PKT(0x4629),
104 PSIL_PDMA_XY_PKT(0x462a),
105 PSIL_PDMA_XY_PKT(0x462b),
106 PSIL_PDMA_XY_PKT(0x462c),
107 PSIL_PDMA_XY_PKT(0x462d),
108 PSIL_PDMA_XY_PKT(0x462e),
109 PSIL_PDMA_XY_PKT(0x462f),
111 PSIL_ETHERNET(0x4640),
112 /* PDMA_USART_G0 - UART0-1 */
113 PSIL_PDMA_XY_PKT(0x4700),
114 PSIL_PDMA_XY_PKT(0x4701),
115 /* PDMA_USART_G1 - UART2-3 */
116 PSIL_PDMA_XY_PKT(0x4702),
117 PSIL_PDMA_XY_PKT(0x4703),
118 /* PDMA_USART_G2 - UART4-9 */
119 PSIL_PDMA_XY_PKT(0x4704),
120 PSIL_PDMA_XY_PKT(0x4705),
121 PSIL_PDMA_XY_PKT(0x4706),
122 PSIL_PDMA_XY_PKT(0x4707),
123 PSIL_PDMA_XY_PKT(0x4708),
124 PSIL_PDMA_XY_PKT(0x4709),
227 PSIL_ETHERNET(0x4a00),
229 PSIL_SA2UL(0x4a40, 0),
230 PSIL_SA2UL(0x4a41, 0),
231 PSIL_SA2UL(0x4a42, 0),
232 PSIL_SA2UL(0x4a43, 0),
234 PSIL_ETHERNET(0x7000),
235 /* MCU_PDMA0 (MCU_PDMA_MISC_G0) - SPI0 */
236 PSIL_PDMA_XY_PKT(0x7100),
237 PSIL_PDMA_XY_PKT(0x7101),
238 PSIL_PDMA_XY_PKT(0x7102),
239 PSIL_PDMA_XY_PKT(0x7103),
240 /* MCU_PDMA1 (MCU_PDMA_MISC_G1) - SPI1-2 */
241 PSIL_PDMA_XY_PKT(0x7200),
242 PSIL_PDMA_XY_PKT(0x7201),
243 PSIL_PDMA_XY_PKT(0x7202),
244 PSIL_PDMA_XY_PKT(0x7203),
245 PSIL_PDMA_XY_PKT(0x7204),
246 PSIL_PDMA_XY_PKT(0x7205),
247 PSIL_PDMA_XY_PKT(0x7206),
248 PSIL_PDMA_XY_PKT(0x7207),
249 /* MCU_PDMA2 (MCU_PDMA_MISC_G2) - UART0 */
250 PSIL_PDMA_XY_PKT(0x7300),
251 /* MCU_PDMA_ADC - ADC0-1 */
252 PSIL_PDMA_XY_TR(0x7400),
253 PSIL_PDMA_XY_TR(0x7401),
254 PSIL_PDMA_XY_TR(0x7402),
255 PSIL_PDMA_XY_TR(0x7403),
257 PSIL_SA2UL(0x7500, 0),
258 PSIL_SA2UL(0x7501, 0),
259 PSIL_SA2UL(0x7502, 0),
260 PSIL_SA2UL(0x7503, 0),
263 /* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */
264 static struct psil_ep j784s4_dst_ep_map
[] = {
266 PSIL_ETHERNET(0xc640),
267 PSIL_ETHERNET(0xc641),
268 PSIL_ETHERNET(0xc642),
269 PSIL_ETHERNET(0xc643),
270 PSIL_ETHERNET(0xc644),
271 PSIL_ETHERNET(0xc645),
272 PSIL_ETHERNET(0xc646),
273 PSIL_ETHERNET(0xc647),
275 PSIL_ETHERNET(0xca00),
276 PSIL_ETHERNET(0xca01),
277 PSIL_ETHERNET(0xca02),
278 PSIL_ETHERNET(0xca03),
279 PSIL_ETHERNET(0xca04),
280 PSIL_ETHERNET(0xca05),
281 PSIL_ETHERNET(0xca06),
282 PSIL_ETHERNET(0xca07),
284 PSIL_SA2UL(0xca40, 1),
285 PSIL_SA2UL(0xca41, 1),
286 /* PDMA_SPI_G0 - SPI0-3 */
287 PSIL_PDMA_XY_PKT(0xc600),
288 PSIL_PDMA_XY_PKT(0xc601),
289 PSIL_PDMA_XY_PKT(0xc602),
290 PSIL_PDMA_XY_PKT(0xc603),
291 PSIL_PDMA_XY_PKT(0xc604),
292 PSIL_PDMA_XY_PKT(0xc605),
293 PSIL_PDMA_XY_PKT(0xc606),
294 PSIL_PDMA_XY_PKT(0xc607),
295 PSIL_PDMA_XY_PKT(0xc608),
296 PSIL_PDMA_XY_PKT(0xc609),
297 PSIL_PDMA_XY_PKT(0xc60a),
298 PSIL_PDMA_XY_PKT(0xc60b),
299 PSIL_PDMA_XY_PKT(0xc60c),
300 PSIL_PDMA_XY_PKT(0xc60d),
301 PSIL_PDMA_XY_PKT(0xc60e),
302 PSIL_PDMA_XY_PKT(0xc60f),
303 /* PDMA_SPI_G1 - SPI4-7 */
304 PSIL_PDMA_XY_PKT(0xc620),
305 PSIL_PDMA_XY_PKT(0xc621),
306 PSIL_PDMA_XY_PKT(0xc622),
307 PSIL_PDMA_XY_PKT(0xc623),
308 PSIL_PDMA_XY_PKT(0xc624),
309 PSIL_PDMA_XY_PKT(0xc625),
310 PSIL_PDMA_XY_PKT(0xc626),
311 PSIL_PDMA_XY_PKT(0xc627),
312 PSIL_PDMA_XY_PKT(0xc628),
313 PSIL_PDMA_XY_PKT(0xc629),
314 PSIL_PDMA_XY_PKT(0xc62a),
315 PSIL_PDMA_XY_PKT(0xc62b),
316 PSIL_PDMA_XY_PKT(0xc62c),
317 PSIL_PDMA_XY_PKT(0xc62d),
318 PSIL_PDMA_XY_PKT(0xc62e),
319 PSIL_PDMA_XY_PKT(0xc62f),
321 PSIL_ETHERNET(0xf000),
322 PSIL_ETHERNET(0xf001),
323 PSIL_ETHERNET(0xf002),
324 PSIL_ETHERNET(0xf003),
325 PSIL_ETHERNET(0xf004),
326 PSIL_ETHERNET(0xf005),
327 PSIL_ETHERNET(0xf006),
328 PSIL_ETHERNET(0xf007),
329 /* MCU_PDMA_MISC_G0 - SPI0 */
330 PSIL_PDMA_XY_PKT(0xf100),
331 PSIL_PDMA_XY_PKT(0xf101),
332 PSIL_PDMA_XY_PKT(0xf102),
333 PSIL_PDMA_XY_PKT(0xf103),
334 /* MCU_PDMA_MISC_G1 - SPI1-2 */
335 PSIL_PDMA_XY_PKT(0xf200),
336 PSIL_PDMA_XY_PKT(0xf201),
337 PSIL_PDMA_XY_PKT(0xf202),
338 PSIL_PDMA_XY_PKT(0xf203),
339 PSIL_PDMA_XY_PKT(0xf204),
340 PSIL_PDMA_XY_PKT(0xf205),
341 PSIL_PDMA_XY_PKT(0xf206),
342 PSIL_PDMA_XY_PKT(0xf207),
344 PSIL_SA2UL(0xf500, 1),
345 PSIL_SA2UL(0xf501, 1),
348 struct psil_ep_map j784s4_ep_map
= {
350 .src
= j784s4_src_ep_map
,
351 .src_count
= ARRAY_SIZE(j784s4_src_ep_map
),
352 .dst
= j784s4_dst_ep_map
,
353 .dst_count
= ARRAY_SIZE(j784s4_dst_ep_map
),