18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com 48c2ecf20Sopenharmony_ci * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/kernel.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include "k3-psil-priv.h" 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define PSIL_PDMA_XY_TR(x) \ 128c2ecf20Sopenharmony_ci { \ 138c2ecf20Sopenharmony_ci .thread_id = x, \ 148c2ecf20Sopenharmony_ci .ep_config = { \ 158c2ecf20Sopenharmony_ci .ep_type = PSIL_EP_PDMA_XY, \ 168c2ecf20Sopenharmony_ci }, \ 178c2ecf20Sopenharmony_ci } 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define PSIL_PDMA_XY_PKT(x) \ 208c2ecf20Sopenharmony_ci { \ 218c2ecf20Sopenharmony_ci .thread_id = x, \ 228c2ecf20Sopenharmony_ci .ep_config = { \ 238c2ecf20Sopenharmony_ci .ep_type = PSIL_EP_PDMA_XY, \ 248c2ecf20Sopenharmony_ci .pkt_mode = 1, \ 258c2ecf20Sopenharmony_ci }, \ 268c2ecf20Sopenharmony_ci } 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define PSIL_ETHERNET(x) \ 298c2ecf20Sopenharmony_ci { \ 308c2ecf20Sopenharmony_ci .thread_id = x, \ 318c2ecf20Sopenharmony_ci .ep_config = { \ 328c2ecf20Sopenharmony_ci .ep_type = PSIL_EP_NATIVE, \ 338c2ecf20Sopenharmony_ci .pkt_mode = 1, \ 348c2ecf20Sopenharmony_ci .needs_epib = 1, \ 358c2ecf20Sopenharmony_ci .psd_size = 16, \ 368c2ecf20Sopenharmony_ci }, \ 378c2ecf20Sopenharmony_ci } 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define PSIL_SA2UL(x, tx) \ 408c2ecf20Sopenharmony_ci { \ 418c2ecf20Sopenharmony_ci .thread_id = x, \ 428c2ecf20Sopenharmony_ci .ep_config = { \ 438c2ecf20Sopenharmony_ci .ep_type = PSIL_EP_NATIVE, \ 448c2ecf20Sopenharmony_ci .pkt_mode = 1, \ 458c2ecf20Sopenharmony_ci .needs_epib = 1, \ 468c2ecf20Sopenharmony_ci .psd_size = 64, \ 478c2ecf20Sopenharmony_ci .notdpkt = tx, \ 488c2ecf20Sopenharmony_ci }, \ 498c2ecf20Sopenharmony_ci } 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */ 528c2ecf20Sopenharmony_cistatic struct psil_ep am654_src_ep_map[] = { 538c2ecf20Sopenharmony_ci /* SA2UL */ 548c2ecf20Sopenharmony_ci PSIL_SA2UL(0x4000, 0), 558c2ecf20Sopenharmony_ci PSIL_SA2UL(0x4001, 0), 568c2ecf20Sopenharmony_ci PSIL_SA2UL(0x4002, 0), 578c2ecf20Sopenharmony_ci PSIL_SA2UL(0x4003, 0), 588c2ecf20Sopenharmony_ci /* PRU_ICSSG0 */ 598c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4100), 608c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4101), 618c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4102), 628c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4103), 638c2ecf20Sopenharmony_ci /* PRU_ICSSG1 */ 648c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4200), 658c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4201), 668c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4202), 678c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4203), 688c2ecf20Sopenharmony_ci /* PRU_ICSSG2 */ 698c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4300), 708c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4301), 718c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4302), 728c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x4303), 738c2ecf20Sopenharmony_ci /* PDMA0 - McASPs */ 748c2ecf20Sopenharmony_ci PSIL_PDMA_XY_TR(0x4400), 758c2ecf20Sopenharmony_ci PSIL_PDMA_XY_TR(0x4401), 768c2ecf20Sopenharmony_ci PSIL_PDMA_XY_TR(0x4402), 778c2ecf20Sopenharmony_ci /* PDMA1 - SPI0-4 */ 788c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4500), 798c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4501), 808c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4502), 818c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4503), 828c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4504), 838c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4505), 848c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4506), 858c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4507), 868c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4508), 878c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4509), 888c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x450a), 898c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x450b), 908c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x450c), 918c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x450d), 928c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x450e), 938c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x450f), 948c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4510), 958c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4511), 968c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4512), 978c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4513), 988c2ecf20Sopenharmony_ci /* PDMA1 - USART0-2 */ 998c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4514), 1008c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4515), 1018c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4516), 1028c2ecf20Sopenharmony_ci /* CPSW0 */ 1038c2ecf20Sopenharmony_ci PSIL_ETHERNET(0x7000), 1048c2ecf20Sopenharmony_ci /* MCU_PDMA0 - ADCs */ 1058c2ecf20Sopenharmony_ci PSIL_PDMA_XY_TR(0x7100), 1068c2ecf20Sopenharmony_ci PSIL_PDMA_XY_TR(0x7101), 1078c2ecf20Sopenharmony_ci PSIL_PDMA_XY_TR(0x7102), 1088c2ecf20Sopenharmony_ci PSIL_PDMA_XY_TR(0x7103), 1098c2ecf20Sopenharmony_ci /* MCU_PDMA1 - MCU_SPI0-2 */ 1108c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7200), 1118c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7201), 1128c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7202), 1138c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7203), 1148c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7204), 1158c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7205), 1168c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7206), 1178c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7207), 1188c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7208), 1198c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7209), 1208c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x720a), 1218c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x720b), 1228c2ecf20Sopenharmony_ci /* MCU_PDMA1 - MCU_USART0 */ 1238c2ecf20Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7212), 1248c2ecf20Sopenharmony_ci}; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci/* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */ 1278c2ecf20Sopenharmony_cistatic struct psil_ep am654_dst_ep_map[] = { 1288c2ecf20Sopenharmony_ci /* SA2UL */ 1298c2ecf20Sopenharmony_ci PSIL_SA2UL(0xc000, 1), 1308c2ecf20Sopenharmony_ci PSIL_SA2UL(0xc001, 1), 1318c2ecf20Sopenharmony_ci /* PRU_ICSSG0 */ 1328c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc100), 1338c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc101), 1348c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc102), 1358c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc103), 1368c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc104), 1378c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc105), 1388c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc106), 1398c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc107), 1408c2ecf20Sopenharmony_ci /* PRU_ICSSG1 */ 1418c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc200), 1428c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc201), 1438c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc202), 1448c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc203), 1458c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc204), 1468c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc205), 1478c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc206), 1488c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc207), 1498c2ecf20Sopenharmony_ci /* PRU_ICSSG2 */ 1508c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc300), 1518c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc301), 1528c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc302), 1538c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc303), 1548c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc304), 1558c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc305), 1568c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc306), 1578c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xc307), 1588c2ecf20Sopenharmony_ci /* CPSW0 */ 1598c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xf000), 1608c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xf001), 1618c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xf002), 1628c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xf003), 1638c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xf004), 1648c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xf005), 1658c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xf006), 1668c2ecf20Sopenharmony_ci PSIL_ETHERNET(0xf007), 1678c2ecf20Sopenharmony_ci}; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_cistruct psil_ep_map am654_ep_map = { 1708c2ecf20Sopenharmony_ci .name = "am654", 1718c2ecf20Sopenharmony_ci .src = am654_src_ep_map, 1728c2ecf20Sopenharmony_ci .src_count = ARRAY_SIZE(am654_src_ep_map), 1738c2ecf20Sopenharmony_ci .dst = am654_dst_ep_map, 1748c2ecf20Sopenharmony_ci .dst_count = ARRAY_SIZE(am654_dst_ep_map), 1758c2ecf20Sopenharmony_ci}; 176