1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
4 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
7 #include <linux/kernel.h>
9 #include "k3-psil-priv.h"
11 #define PSIL_PDMA_XY_TR(x) \
15 .ep_type = PSIL_EP_PDMA_XY, \
19 #define PSIL_PDMA_XY_PKT(x) \
23 .ep_type = PSIL_EP_PDMA_XY, \
28 #define PSIL_PDMA_MCASP(x) \
32 .ep_type = PSIL_EP_PDMA_XY, \
38 #define PSIL_ETHERNET(x) \
42 .ep_type = PSIL_EP_NATIVE, \
49 #define PSIL_SA2UL(x, tx) \
53 .ep_type = PSIL_EP_NATIVE, \
61 #define PSIL_CSI2RX(x) \
65 .ep_type = PSIL_EP_NATIVE, \
69 /* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */
70 static struct psil_ep j721e_src_ep_map
[] = {
72 PSIL_SA2UL(0x4000, 0),
73 PSIL_SA2UL(0x4001, 0),
74 PSIL_SA2UL(0x4002, 0),
75 PSIL_SA2UL(0x4003, 0),
77 PSIL_ETHERNET(0x4100),
78 PSIL_ETHERNET(0x4101),
79 PSIL_ETHERNET(0x4102),
80 PSIL_ETHERNET(0x4103),
82 PSIL_ETHERNET(0x4200),
83 PSIL_ETHERNET(0x4201),
84 PSIL_ETHERNET(0x4202),
85 PSIL_ETHERNET(0x4203),
86 /* PDMA6 (PSIL_PDMA_MCASP_G0) - McASP0-2 */
87 PSIL_PDMA_MCASP(0x4400),
88 PSIL_PDMA_MCASP(0x4401),
89 PSIL_PDMA_MCASP(0x4402),
90 /* PDMA7 (PSIL_PDMA_MCASP_G1) - McASP3-11 */
91 PSIL_PDMA_MCASP(0x4500),
92 PSIL_PDMA_MCASP(0x4501),
93 PSIL_PDMA_MCASP(0x4502),
94 PSIL_PDMA_MCASP(0x4503),
95 PSIL_PDMA_MCASP(0x4504),
96 PSIL_PDMA_MCASP(0x4505),
97 PSIL_PDMA_MCASP(0x4506),
98 PSIL_PDMA_MCASP(0x4507),
99 PSIL_PDMA_MCASP(0x4508),
100 /* PDMA8 (PDMA_MISC_G0) - SPI0-1 */
101 PSIL_PDMA_XY_PKT(0x4600),
102 PSIL_PDMA_XY_PKT(0x4601),
103 PSIL_PDMA_XY_PKT(0x4602),
104 PSIL_PDMA_XY_PKT(0x4603),
105 PSIL_PDMA_XY_PKT(0x4604),
106 PSIL_PDMA_XY_PKT(0x4605),
107 PSIL_PDMA_XY_PKT(0x4606),
108 PSIL_PDMA_XY_PKT(0x4607),
109 /* PDMA9 (PDMA_MISC_G1) - SPI2-3 */
110 PSIL_PDMA_XY_PKT(0x460c),
111 PSIL_PDMA_XY_PKT(0x460d),
112 PSIL_PDMA_XY_PKT(0x460e),
113 PSIL_PDMA_XY_PKT(0x460f),
114 PSIL_PDMA_XY_PKT(0x4610),
115 PSIL_PDMA_XY_PKT(0x4611),
116 PSIL_PDMA_XY_PKT(0x4612),
117 PSIL_PDMA_XY_PKT(0x4613),
118 /* PDMA10 (PDMA_MISC_G2) - SPI4-5 */
119 PSIL_PDMA_XY_PKT(0x4618),
120 PSIL_PDMA_XY_PKT(0x4619),
121 PSIL_PDMA_XY_PKT(0x461a),
122 PSIL_PDMA_XY_PKT(0x461b),
123 PSIL_PDMA_XY_PKT(0x461c),
124 PSIL_PDMA_XY_PKT(0x461d),
125 PSIL_PDMA_XY_PKT(0x461e),
126 PSIL_PDMA_XY_PKT(0x461f),
127 /* PDMA11 (PDMA_MISC_G3) */
128 PSIL_PDMA_XY_PKT(0x4624),
129 PSIL_PDMA_XY_PKT(0x4625),
130 PSIL_PDMA_XY_PKT(0x4626),
131 PSIL_PDMA_XY_PKT(0x4627),
132 PSIL_PDMA_XY_PKT(0x4628),
133 PSIL_PDMA_XY_PKT(0x4629),
134 PSIL_PDMA_XY_PKT(0x4630),
135 PSIL_PDMA_XY_PKT(0x463a),
136 /* PDMA13 (PDMA_USART_G0) - UART0-1 */
137 PSIL_PDMA_XY_PKT(0x4700),
138 PSIL_PDMA_XY_PKT(0x4701),
139 /* PDMA14 (PDMA_USART_G1) - UART2-3 */
140 PSIL_PDMA_XY_PKT(0x4702),
141 PSIL_PDMA_XY_PKT(0x4703),
142 /* PDMA15 (PDMA_USART_G2) - UART4-9 */
143 PSIL_PDMA_XY_PKT(0x4704),
144 PSIL_PDMA_XY_PKT(0x4705),
145 PSIL_PDMA_XY_PKT(0x4706),
146 PSIL_PDMA_XY_PKT(0x4707),
147 PSIL_PDMA_XY_PKT(0x4708),
148 PSIL_PDMA_XY_PKT(0x4709),
215 PSIL_ETHERNET(0x4a00),
217 PSIL_ETHERNET(0x7000),
218 /* MCU_PDMA0 (MCU_PDMA_MISC_G0) - SPI0 */
219 PSIL_PDMA_XY_PKT(0x7100),
220 PSIL_PDMA_XY_PKT(0x7101),
221 PSIL_PDMA_XY_PKT(0x7102),
222 PSIL_PDMA_XY_PKT(0x7103),
223 /* MCU_PDMA1 (MCU_PDMA_MISC_G1) - SPI1-2 */
224 PSIL_PDMA_XY_PKT(0x7200),
225 PSIL_PDMA_XY_PKT(0x7201),
226 PSIL_PDMA_XY_PKT(0x7202),
227 PSIL_PDMA_XY_PKT(0x7203),
228 PSIL_PDMA_XY_PKT(0x7204),
229 PSIL_PDMA_XY_PKT(0x7205),
230 PSIL_PDMA_XY_PKT(0x7206),
231 PSIL_PDMA_XY_PKT(0x7207),
232 /* MCU_PDMA2 (MCU_PDMA_MISC_G2) - UART0 */
233 PSIL_PDMA_XY_PKT(0x7300),
234 /* MCU_PDMA_ADC - ADC0-1 */
235 PSIL_PDMA_XY_TR(0x7400),
236 PSIL_PDMA_XY_TR(0x7401),
237 PSIL_PDMA_XY_TR(0x7402),
238 PSIL_PDMA_XY_TR(0x7403),
240 PSIL_SA2UL(0x7500, 0),
241 PSIL_SA2UL(0x7501, 0),
242 PSIL_SA2UL(0x7502, 0),
243 PSIL_SA2UL(0x7503, 0),
246 /* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */
247 static struct psil_ep j721e_dst_ep_map
[] = {
249 PSIL_SA2UL(0xc000, 1),
250 PSIL_SA2UL(0xc001, 1),
252 PSIL_ETHERNET(0xc100),
253 PSIL_ETHERNET(0xc101),
254 PSIL_ETHERNET(0xc102),
255 PSIL_ETHERNET(0xc103),
256 PSIL_ETHERNET(0xc104),
257 PSIL_ETHERNET(0xc105),
258 PSIL_ETHERNET(0xc106),
259 PSIL_ETHERNET(0xc107),
261 PSIL_ETHERNET(0xc200),
262 PSIL_ETHERNET(0xc201),
263 PSIL_ETHERNET(0xc202),
264 PSIL_ETHERNET(0xc203),
265 PSIL_ETHERNET(0xc204),
266 PSIL_ETHERNET(0xc205),
267 PSIL_ETHERNET(0xc206),
268 PSIL_ETHERNET(0xc207),
269 /* PDMA6 (PSIL_PDMA_MCASP_G0) - McASP0-2 */
270 PSIL_PDMA_MCASP(0xc400),
271 PSIL_PDMA_MCASP(0xc401),
272 PSIL_PDMA_MCASP(0xc402),
273 /* PDMA7 (PSIL_PDMA_MCASP_G1) - McASP3-11 */
274 PSIL_PDMA_MCASP(0xc500),
275 PSIL_PDMA_MCASP(0xc501),
276 PSIL_PDMA_MCASP(0xc502),
277 PSIL_PDMA_MCASP(0xc503),
278 PSIL_PDMA_MCASP(0xc504),
279 PSIL_PDMA_MCASP(0xc505),
280 PSIL_PDMA_MCASP(0xc506),
281 PSIL_PDMA_MCASP(0xc507),
282 PSIL_PDMA_MCASP(0xc508),
283 /* PDMA8 (PDMA_MISC_G0) - SPI0-1 */
284 PSIL_PDMA_XY_PKT(0xc600),
285 PSIL_PDMA_XY_PKT(0xc601),
286 PSIL_PDMA_XY_PKT(0xc602),
287 PSIL_PDMA_XY_PKT(0xc603),
288 PSIL_PDMA_XY_PKT(0xc604),
289 PSIL_PDMA_XY_PKT(0xc605),
290 PSIL_PDMA_XY_PKT(0xc606),
291 PSIL_PDMA_XY_PKT(0xc607),
292 /* PDMA9 (PDMA_MISC_G1) - SPI2-3 */
293 PSIL_PDMA_XY_PKT(0xc60c),
294 PSIL_PDMA_XY_PKT(0xc60d),
295 PSIL_PDMA_XY_PKT(0xc60e),
296 PSIL_PDMA_XY_PKT(0xc60f),
297 PSIL_PDMA_XY_PKT(0xc610),
298 PSIL_PDMA_XY_PKT(0xc611),
299 PSIL_PDMA_XY_PKT(0xc612),
300 PSIL_PDMA_XY_PKT(0xc613),
301 /* PDMA10 (PDMA_MISC_G2) - SPI4-5 */
302 PSIL_PDMA_XY_PKT(0xc618),
303 PSIL_PDMA_XY_PKT(0xc619),
304 PSIL_PDMA_XY_PKT(0xc61a),
305 PSIL_PDMA_XY_PKT(0xc61b),
306 PSIL_PDMA_XY_PKT(0xc61c),
307 PSIL_PDMA_XY_PKT(0xc61d),
308 PSIL_PDMA_XY_PKT(0xc61e),
309 PSIL_PDMA_XY_PKT(0xc61f),
310 /* PDMA11 (PDMA_MISC_G3) */
311 PSIL_PDMA_XY_PKT(0xc624),
312 PSIL_PDMA_XY_PKT(0xc625),
313 PSIL_PDMA_XY_PKT(0xc626),
314 PSIL_PDMA_XY_PKT(0xc627),
315 PSIL_PDMA_XY_PKT(0xc628),
316 PSIL_PDMA_XY_PKT(0xc629),
317 PSIL_PDMA_XY_PKT(0xc630),
318 PSIL_PDMA_XY_PKT(0xc63a),
319 /* PDMA13 (PDMA_USART_G0) - UART0-1 */
320 PSIL_PDMA_XY_PKT(0xc700),
321 PSIL_PDMA_XY_PKT(0xc701),
322 /* PDMA14 (PDMA_USART_G1) - UART2-3 */
323 PSIL_PDMA_XY_PKT(0xc702),
324 PSIL_PDMA_XY_PKT(0xc703),
325 /* PDMA15 (PDMA_USART_G2) - UART4-9 */
326 PSIL_PDMA_XY_PKT(0xc704),
327 PSIL_PDMA_XY_PKT(0xc705),
328 PSIL_PDMA_XY_PKT(0xc706),
329 PSIL_PDMA_XY_PKT(0xc707),
330 PSIL_PDMA_XY_PKT(0xc708),
331 PSIL_PDMA_XY_PKT(0xc709),
333 PSIL_ETHERNET(0xca00),
334 PSIL_ETHERNET(0xca01),
335 PSIL_ETHERNET(0xca02),
336 PSIL_ETHERNET(0xca03),
337 PSIL_ETHERNET(0xca04),
338 PSIL_ETHERNET(0xca05),
339 PSIL_ETHERNET(0xca06),
340 PSIL_ETHERNET(0xca07),
342 PSIL_ETHERNET(0xf000),
343 PSIL_ETHERNET(0xf001),
344 PSIL_ETHERNET(0xf002),
345 PSIL_ETHERNET(0xf003),
346 PSIL_ETHERNET(0xf004),
347 PSIL_ETHERNET(0xf005),
348 PSIL_ETHERNET(0xf006),
349 PSIL_ETHERNET(0xf007),
350 /* MCU_PDMA0 (MCU_PDMA_MISC_G0) - SPI0 */
351 PSIL_PDMA_XY_PKT(0xf100),
352 PSIL_PDMA_XY_PKT(0xf101),
353 PSIL_PDMA_XY_PKT(0xf102),
354 PSIL_PDMA_XY_PKT(0xf103),
355 /* MCU_PDMA1 (MCU_PDMA_MISC_G1) - SPI1-2 */
356 PSIL_PDMA_XY_PKT(0xf200),
357 PSIL_PDMA_XY_PKT(0xf201),
358 PSIL_PDMA_XY_PKT(0xf202),
359 PSIL_PDMA_XY_PKT(0xf203),
360 PSIL_PDMA_XY_PKT(0xf204),
361 PSIL_PDMA_XY_PKT(0xf205),
362 PSIL_PDMA_XY_PKT(0xf206),
363 PSIL_PDMA_XY_PKT(0xf207),
364 /* MCU_PDMA2 (MCU_PDMA_MISC_G2) - UART0 */
365 PSIL_PDMA_XY_PKT(0xf300),
367 PSIL_SA2UL(0xf500, 1),
368 PSIL_SA2UL(0xf501, 1),
371 struct psil_ep_map j721e_ep_map
= {
373 .src
= j721e_src_ep_map
,
374 .src_count
= ARRAY_SIZE(j721e_src_ep_map
),
375 .dst
= j721e_dst_ep_map
,
376 .dst_count
= ARRAY_SIZE(j721e_dst_ep_map
),