162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include <linux/kernel.h> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include "k3-psil-priv.h" 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#define PSIL_PDMA_XY_TR(x) \ 1162306a36Sopenharmony_ci { \ 1262306a36Sopenharmony_ci .thread_id = x, \ 1362306a36Sopenharmony_ci .ep_config = { \ 1462306a36Sopenharmony_ci .ep_type = PSIL_EP_PDMA_XY, \ 1562306a36Sopenharmony_ci .mapped_channel_id = -1, \ 1662306a36Sopenharmony_ci .default_flow_id = -1, \ 1762306a36Sopenharmony_ci }, \ 1862306a36Sopenharmony_ci } 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define PSIL_PDMA_XY_PKT(x) \ 2162306a36Sopenharmony_ci { \ 2262306a36Sopenharmony_ci .thread_id = x, \ 2362306a36Sopenharmony_ci .ep_config = { \ 2462306a36Sopenharmony_ci .ep_type = PSIL_EP_PDMA_XY, \ 2562306a36Sopenharmony_ci .mapped_channel_id = -1, \ 2662306a36Sopenharmony_ci .default_flow_id = -1, \ 2762306a36Sopenharmony_ci .pkt_mode = 1, \ 2862306a36Sopenharmony_ci }, \ 2962306a36Sopenharmony_ci } 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#define PSIL_ETHERNET(x, ch, flow_base, flow_cnt) \ 3262306a36Sopenharmony_ci { \ 3362306a36Sopenharmony_ci .thread_id = x, \ 3462306a36Sopenharmony_ci .ep_config = { \ 3562306a36Sopenharmony_ci .ep_type = PSIL_EP_NATIVE, \ 3662306a36Sopenharmony_ci .pkt_mode = 1, \ 3762306a36Sopenharmony_ci .needs_epib = 1, \ 3862306a36Sopenharmony_ci .psd_size = 16, \ 3962306a36Sopenharmony_ci .mapped_channel_id = ch, \ 4062306a36Sopenharmony_ci .flow_start = flow_base, \ 4162306a36Sopenharmony_ci .flow_num = flow_cnt, \ 4262306a36Sopenharmony_ci .default_flow_id = flow_base, \ 4362306a36Sopenharmony_ci }, \ 4462306a36Sopenharmony_ci } 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#define PSIL_SAUL(x, ch, flow_base, flow_cnt, default_flow, tx) \ 4762306a36Sopenharmony_ci { \ 4862306a36Sopenharmony_ci .thread_id = x, \ 4962306a36Sopenharmony_ci .ep_config = { \ 5062306a36Sopenharmony_ci .ep_type = PSIL_EP_NATIVE, \ 5162306a36Sopenharmony_ci .pkt_mode = 1, \ 5262306a36Sopenharmony_ci .needs_epib = 1, \ 5362306a36Sopenharmony_ci .psd_size = 64, \ 5462306a36Sopenharmony_ci .mapped_channel_id = ch, \ 5562306a36Sopenharmony_ci .flow_start = flow_base, \ 5662306a36Sopenharmony_ci .flow_num = flow_cnt, \ 5762306a36Sopenharmony_ci .default_flow_id = default_flow, \ 5862306a36Sopenharmony_ci .notdpkt = tx, \ 5962306a36Sopenharmony_ci }, \ 6062306a36Sopenharmony_ci } 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci#define PSIL_PDMA_MCASP(x) \ 6362306a36Sopenharmony_ci { \ 6462306a36Sopenharmony_ci .thread_id = x, \ 6562306a36Sopenharmony_ci .ep_config = { \ 6662306a36Sopenharmony_ci .ep_type = PSIL_EP_PDMA_XY, \ 6762306a36Sopenharmony_ci .pdma_acc32 = 1, \ 6862306a36Sopenharmony_ci .pdma_burst = 1, \ 6962306a36Sopenharmony_ci }, \ 7062306a36Sopenharmony_ci } 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#define PSIL_CSI2RX(x) \ 7362306a36Sopenharmony_ci { \ 7462306a36Sopenharmony_ci .thread_id = x, \ 7562306a36Sopenharmony_ci .ep_config = { \ 7662306a36Sopenharmony_ci .ep_type = PSIL_EP_NATIVE, \ 7762306a36Sopenharmony_ci }, \ 7862306a36Sopenharmony_ci } 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci/* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */ 8162306a36Sopenharmony_cistatic struct psil_ep am62a_src_ep_map[] = { 8262306a36Sopenharmony_ci /* SAUL */ 8362306a36Sopenharmony_ci PSIL_SAUL(0x7504, 20, 35, 8, 35, 0), 8462306a36Sopenharmony_ci PSIL_SAUL(0x7505, 21, 35, 8, 36, 0), 8562306a36Sopenharmony_ci PSIL_SAUL(0x7506, 22, 43, 8, 43, 0), 8662306a36Sopenharmony_ci PSIL_SAUL(0x7507, 23, 43, 8, 44, 0), 8762306a36Sopenharmony_ci /* PDMA_MAIN0 - SPI0-2 */ 8862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4300), 8962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4301), 9062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4302), 9162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4303), 9262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4304), 9362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4305), 9462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4306), 9562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4307), 9662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4308), 9762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4309), 9862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x430a), 9962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x430b), 10062306a36Sopenharmony_ci /* PDMA_MAIN1 - UART0-6 */ 10162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4400), 10262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4401), 10362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4402), 10462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4403), 10562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4404), 10662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4405), 10762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4406), 10862306a36Sopenharmony_ci /* PDMA_MAIN2 - MCASP0-2 */ 10962306a36Sopenharmony_ci PSIL_PDMA_MCASP(0x4500), 11062306a36Sopenharmony_ci PSIL_PDMA_MCASP(0x4501), 11162306a36Sopenharmony_ci PSIL_PDMA_MCASP(0x4502), 11262306a36Sopenharmony_ci /* CPSW3G */ 11362306a36Sopenharmony_ci PSIL_ETHERNET(0x4600, 19, 19, 16), 11462306a36Sopenharmony_ci /* CSI2RX */ 11562306a36Sopenharmony_ci PSIL_CSI2RX(0x5000), 11662306a36Sopenharmony_ci PSIL_CSI2RX(0x5001), 11762306a36Sopenharmony_ci PSIL_CSI2RX(0x5002), 11862306a36Sopenharmony_ci PSIL_CSI2RX(0x5003), 11962306a36Sopenharmony_ci PSIL_CSI2RX(0x5004), 12062306a36Sopenharmony_ci PSIL_CSI2RX(0x5005), 12162306a36Sopenharmony_ci PSIL_CSI2RX(0x5006), 12262306a36Sopenharmony_ci PSIL_CSI2RX(0x5007), 12362306a36Sopenharmony_ci PSIL_CSI2RX(0x5008), 12462306a36Sopenharmony_ci PSIL_CSI2RX(0x5009), 12562306a36Sopenharmony_ci PSIL_CSI2RX(0x500a), 12662306a36Sopenharmony_ci PSIL_CSI2RX(0x500b), 12762306a36Sopenharmony_ci PSIL_CSI2RX(0x500c), 12862306a36Sopenharmony_ci PSIL_CSI2RX(0x500d), 12962306a36Sopenharmony_ci PSIL_CSI2RX(0x500e), 13062306a36Sopenharmony_ci PSIL_CSI2RX(0x500f), 13162306a36Sopenharmony_ci PSIL_CSI2RX(0x5010), 13262306a36Sopenharmony_ci PSIL_CSI2RX(0x5011), 13362306a36Sopenharmony_ci PSIL_CSI2RX(0x5012), 13462306a36Sopenharmony_ci PSIL_CSI2RX(0x5013), 13562306a36Sopenharmony_ci PSIL_CSI2RX(0x5014), 13662306a36Sopenharmony_ci PSIL_CSI2RX(0x5015), 13762306a36Sopenharmony_ci PSIL_CSI2RX(0x5016), 13862306a36Sopenharmony_ci PSIL_CSI2RX(0x5017), 13962306a36Sopenharmony_ci PSIL_CSI2RX(0x5018), 14062306a36Sopenharmony_ci PSIL_CSI2RX(0x5019), 14162306a36Sopenharmony_ci PSIL_CSI2RX(0x501a), 14262306a36Sopenharmony_ci PSIL_CSI2RX(0x501b), 14362306a36Sopenharmony_ci PSIL_CSI2RX(0x501c), 14462306a36Sopenharmony_ci PSIL_CSI2RX(0x501d), 14562306a36Sopenharmony_ci PSIL_CSI2RX(0x501e), 14662306a36Sopenharmony_ci PSIL_CSI2RX(0x501f), 14762306a36Sopenharmony_ci}; 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci/* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */ 15062306a36Sopenharmony_cistatic struct psil_ep am62a_dst_ep_map[] = { 15162306a36Sopenharmony_ci /* SAUL */ 15262306a36Sopenharmony_ci PSIL_SAUL(0xf500, 27, 83, 8, 83, 1), 15362306a36Sopenharmony_ci PSIL_SAUL(0xf501, 28, 91, 8, 91, 1), 15462306a36Sopenharmony_ci /* PDMA_MAIN0 - SPI0-2 */ 15562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc300), 15662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc301), 15762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc302), 15862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc303), 15962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc304), 16062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc305), 16162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc306), 16262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc307), 16362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc308), 16462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc309), 16562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc30a), 16662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc30b), 16762306a36Sopenharmony_ci /* PDMA_MAIN1 - UART0-6 */ 16862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc400), 16962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc401), 17062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc402), 17162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc403), 17262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc404), 17362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc405), 17462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc406), 17562306a36Sopenharmony_ci /* PDMA_MAIN2 - MCASP0-2 */ 17662306a36Sopenharmony_ci PSIL_PDMA_MCASP(0xc500), 17762306a36Sopenharmony_ci PSIL_PDMA_MCASP(0xc501), 17862306a36Sopenharmony_ci PSIL_PDMA_MCASP(0xc502), 17962306a36Sopenharmony_ci /* CPSW3G */ 18062306a36Sopenharmony_ci PSIL_ETHERNET(0xc600, 19, 19, 8), 18162306a36Sopenharmony_ci PSIL_ETHERNET(0xc601, 20, 27, 8), 18262306a36Sopenharmony_ci PSIL_ETHERNET(0xc602, 21, 35, 8), 18362306a36Sopenharmony_ci PSIL_ETHERNET(0xc603, 22, 43, 8), 18462306a36Sopenharmony_ci PSIL_ETHERNET(0xc604, 23, 51, 8), 18562306a36Sopenharmony_ci PSIL_ETHERNET(0xc605, 24, 59, 8), 18662306a36Sopenharmony_ci PSIL_ETHERNET(0xc606, 25, 67, 8), 18762306a36Sopenharmony_ci PSIL_ETHERNET(0xc607, 26, 75, 8), 18862306a36Sopenharmony_ci}; 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_cistruct psil_ep_map am62a_ep_map = { 19162306a36Sopenharmony_ci .name = "am62a", 19262306a36Sopenharmony_ci .src = am62a_src_ep_map, 19362306a36Sopenharmony_ci .src_count = ARRAY_SIZE(am62a_src_ep_map), 19462306a36Sopenharmony_ci .dst = am62a_dst_ep_map, 19562306a36Sopenharmony_ci .dst_count = ARRAY_SIZE(am62a_dst_ep_map), 19662306a36Sopenharmony_ci}; 197