1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com
6 #include <linux/kernel.h>
8 #include "k3-psil-priv.h"
10 #define PSIL_PDMA_XY_PKT(x) \
14 .ep_type = PSIL_EP_PDMA_XY, \
15 .mapped_channel_id = -1, \
16 .default_flow_id = -1, \
21 #define PSIL_ETHERNET(x, ch, flow_base, flow_cnt) \
25 .ep_type = PSIL_EP_NATIVE, \
29 .mapped_channel_id = ch, \
30 .flow_start = flow_base, \
31 .flow_num = flow_cnt, \
32 .default_flow_id = flow_base, \
36 #define PSIL_SAUL(x, ch, flow_base, flow_cnt, default_flow, tx) \
40 .ep_type = PSIL_EP_NATIVE, \
44 .mapped_channel_id = ch, \
45 .flow_start = flow_base, \
46 .flow_num = flow_cnt, \
47 .default_flow_id = default_flow, \
52 #define PSIL_PDMA_MCASP(x) \
56 .ep_type = PSIL_EP_PDMA_XY, \
62 #define PSIL_CSI2RX(x) \
66 .ep_type = PSIL_EP_NATIVE, \
70 /* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */
71 static struct psil_ep am62_src_ep_map
[] = {
73 PSIL_SAUL(0x7504, 20, 35, 8, 35, 0),
74 PSIL_SAUL(0x7505, 21, 35, 8, 36, 0),
75 PSIL_SAUL(0x7506, 22, 43, 8, 43, 0),
76 PSIL_SAUL(0x7507, 23, 43, 8, 44, 0),
77 /* PDMA_MAIN0 - SPI0-2 */
78 PSIL_PDMA_XY_PKT(0x4300),
79 PSIL_PDMA_XY_PKT(0x4301),
80 PSIL_PDMA_XY_PKT(0x4302),
81 PSIL_PDMA_XY_PKT(0x4303),
82 PSIL_PDMA_XY_PKT(0x4304),
83 PSIL_PDMA_XY_PKT(0x4305),
84 PSIL_PDMA_XY_PKT(0x4306),
85 PSIL_PDMA_XY_PKT(0x4307),
86 PSIL_PDMA_XY_PKT(0x4308),
87 PSIL_PDMA_XY_PKT(0x4309),
88 PSIL_PDMA_XY_PKT(0x430a),
89 PSIL_PDMA_XY_PKT(0x430b),
90 /* PDMA_MAIN1 - UART0-6 */
91 PSIL_PDMA_XY_PKT(0x4400),
92 PSIL_PDMA_XY_PKT(0x4401),
93 PSIL_PDMA_XY_PKT(0x4402),
94 PSIL_PDMA_XY_PKT(0x4403),
95 PSIL_PDMA_XY_PKT(0x4404),
96 PSIL_PDMA_XY_PKT(0x4405),
97 PSIL_PDMA_XY_PKT(0x4406),
98 /* PDMA_MAIN2 - MCASP0-2 */
99 PSIL_PDMA_MCASP(0x4500),
100 PSIL_PDMA_MCASP(0x4501),
101 PSIL_PDMA_MCASP(0x4502),
103 PSIL_ETHERNET(0x4600, 19, 19, 16),
139 /* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */
140 static struct psil_ep am62_dst_ep_map
[] = {
142 PSIL_SAUL(0xf500, 27, 83, 8, 83, 1),
143 PSIL_SAUL(0xf501, 28, 91, 8, 91, 1),
144 /* PDMA_MAIN0 - SPI0-2 */
145 PSIL_PDMA_XY_PKT(0xc300),
146 PSIL_PDMA_XY_PKT(0xc301),
147 PSIL_PDMA_XY_PKT(0xc302),
148 PSIL_PDMA_XY_PKT(0xc303),
149 PSIL_PDMA_XY_PKT(0xc304),
150 PSIL_PDMA_XY_PKT(0xc305),
151 PSIL_PDMA_XY_PKT(0xc306),
152 PSIL_PDMA_XY_PKT(0xc307),
153 PSIL_PDMA_XY_PKT(0xc308),
154 PSIL_PDMA_XY_PKT(0xc309),
155 PSIL_PDMA_XY_PKT(0xc30a),
156 PSIL_PDMA_XY_PKT(0xc30b),
157 /* PDMA_MAIN1 - UART0-6 */
158 PSIL_PDMA_XY_PKT(0xc400),
159 PSIL_PDMA_XY_PKT(0xc401),
160 PSIL_PDMA_XY_PKT(0xc402),
161 PSIL_PDMA_XY_PKT(0xc403),
162 PSIL_PDMA_XY_PKT(0xc404),
163 PSIL_PDMA_XY_PKT(0xc405),
164 PSIL_PDMA_XY_PKT(0xc406),
165 /* PDMA_MAIN2 - MCASP0-2 */
166 PSIL_PDMA_MCASP(0xc500),
167 PSIL_PDMA_MCASP(0xc501),
168 PSIL_PDMA_MCASP(0xc502),
170 PSIL_ETHERNET(0xc600, 19, 19, 8),
171 PSIL_ETHERNET(0xc601, 20, 27, 8),
172 PSIL_ETHERNET(0xc602, 21, 35, 8),
173 PSIL_ETHERNET(0xc603, 22, 43, 8),
174 PSIL_ETHERNET(0xc604, 23, 51, 8),
175 PSIL_ETHERNET(0xc605, 24, 59, 8),
176 PSIL_ETHERNET(0xc606, 25, 67, 8),
177 PSIL_ETHERNET(0xc607, 26, 75, 8),
180 struct psil_ep_map am62_ep_map
= {
182 .src
= am62_src_ep_map
,
183 .src_count
= ARRAY_SIZE(am62_src_ep_map
),
184 .dst
= am62_dst_ep_map
,
185 .dst_count
= ARRAY_SIZE(am62_dst_ep_map
),