162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com 462306a36Sopenharmony_ci * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#include <linux/kernel.h> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include "k3-psil-priv.h" 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#define PSIL_PDMA_XY_TR(x) \ 1262306a36Sopenharmony_ci { \ 1362306a36Sopenharmony_ci .thread_id = x, \ 1462306a36Sopenharmony_ci .ep_config = { \ 1562306a36Sopenharmony_ci .ep_type = PSIL_EP_PDMA_XY, \ 1662306a36Sopenharmony_ci }, \ 1762306a36Sopenharmony_ci } 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define PSIL_PDMA_XY_PKT(x) \ 2062306a36Sopenharmony_ci { \ 2162306a36Sopenharmony_ci .thread_id = x, \ 2262306a36Sopenharmony_ci .ep_config = { \ 2362306a36Sopenharmony_ci .ep_type = PSIL_EP_PDMA_XY, \ 2462306a36Sopenharmony_ci .pkt_mode = 1, \ 2562306a36Sopenharmony_ci }, \ 2662306a36Sopenharmony_ci } 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#define PSIL_PDMA_MCASP(x) \ 2962306a36Sopenharmony_ci { \ 3062306a36Sopenharmony_ci .thread_id = x, \ 3162306a36Sopenharmony_ci .ep_config = { \ 3262306a36Sopenharmony_ci .ep_type = PSIL_EP_PDMA_XY, \ 3362306a36Sopenharmony_ci .pdma_acc32 = 1, \ 3462306a36Sopenharmony_ci .pdma_burst = 1, \ 3562306a36Sopenharmony_ci }, \ 3662306a36Sopenharmony_ci } 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci#define PSIL_ETHERNET(x) \ 3962306a36Sopenharmony_ci { \ 4062306a36Sopenharmony_ci .thread_id = x, \ 4162306a36Sopenharmony_ci .ep_config = { \ 4262306a36Sopenharmony_ci .ep_type = PSIL_EP_NATIVE, \ 4362306a36Sopenharmony_ci .pkt_mode = 1, \ 4462306a36Sopenharmony_ci .needs_epib = 1, \ 4562306a36Sopenharmony_ci .psd_size = 16, \ 4662306a36Sopenharmony_ci }, \ 4762306a36Sopenharmony_ci } 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#define PSIL_SA2UL(x, tx) \ 5062306a36Sopenharmony_ci { \ 5162306a36Sopenharmony_ci .thread_id = x, \ 5262306a36Sopenharmony_ci .ep_config = { \ 5362306a36Sopenharmony_ci .ep_type = PSIL_EP_NATIVE, \ 5462306a36Sopenharmony_ci .pkt_mode = 1, \ 5562306a36Sopenharmony_ci .needs_epib = 1, \ 5662306a36Sopenharmony_ci .psd_size = 64, \ 5762306a36Sopenharmony_ci .notdpkt = tx, \ 5862306a36Sopenharmony_ci }, \ 5962306a36Sopenharmony_ci } 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */ 6262306a36Sopenharmony_cistatic struct psil_ep j7200_src_ep_map[] = { 6362306a36Sopenharmony_ci /* PDMA_MCASP - McASP0-2 */ 6462306a36Sopenharmony_ci PSIL_PDMA_MCASP(0x4400), 6562306a36Sopenharmony_ci PSIL_PDMA_MCASP(0x4401), 6662306a36Sopenharmony_ci PSIL_PDMA_MCASP(0x4402), 6762306a36Sopenharmony_ci /* PDMA_SPI_G0 - SPI0-3 */ 6862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4600), 6962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4601), 7062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4602), 7162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4603), 7262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4604), 7362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4605), 7462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4606), 7562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4607), 7662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4608), 7762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4609), 7862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x460a), 7962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x460b), 8062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x460c), 8162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x460d), 8262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x460e), 8362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x460f), 8462306a36Sopenharmony_ci /* PDMA_SPI_G1 - SPI4-7 */ 8562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4610), 8662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4611), 8762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4612), 8862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4613), 8962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4614), 9062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4615), 9162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4616), 9262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4617), 9362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4618), 9462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4619), 9562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x461a), 9662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x461b), 9762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x461c), 9862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x461d), 9962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x461e), 10062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x461f), 10162306a36Sopenharmony_ci /* PDMA_USART_G0 - UART0-1 */ 10262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4700), 10362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4701), 10462306a36Sopenharmony_ci /* PDMA_USART_G1 - UART2-3 */ 10562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4702), 10662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4703), 10762306a36Sopenharmony_ci /* PDMA_USART_G2 - UART4-9 */ 10862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4704), 10962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4705), 11062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4706), 11162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4707), 11262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4708), 11362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x4709), 11462306a36Sopenharmony_ci /* CPSW5 */ 11562306a36Sopenharmony_ci PSIL_ETHERNET(0x4a00), 11662306a36Sopenharmony_ci /* CPSW0 */ 11762306a36Sopenharmony_ci PSIL_ETHERNET(0x7000), 11862306a36Sopenharmony_ci /* MCU_PDMA_MISC_G0 - SPI0 */ 11962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7100), 12062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7101), 12162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7102), 12262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7103), 12362306a36Sopenharmony_ci /* MCU_PDMA_MISC_G1 - SPI1-2 */ 12462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7200), 12562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7201), 12662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7202), 12762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7203), 12862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7204), 12962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7205), 13062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7206), 13162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7207), 13262306a36Sopenharmony_ci /* MCU_PDMA_MISC_G2 - UART0 */ 13362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0x7300), 13462306a36Sopenharmony_ci /* MCU_PDMA_ADC - ADC0-1 */ 13562306a36Sopenharmony_ci PSIL_PDMA_XY_TR(0x7400), 13662306a36Sopenharmony_ci PSIL_PDMA_XY_TR(0x7401), 13762306a36Sopenharmony_ci /* SA2UL */ 13862306a36Sopenharmony_ci PSIL_SA2UL(0x7500, 0), 13962306a36Sopenharmony_ci PSIL_SA2UL(0x7501, 0), 14062306a36Sopenharmony_ci PSIL_SA2UL(0x7502, 0), 14162306a36Sopenharmony_ci PSIL_SA2UL(0x7503, 0), 14262306a36Sopenharmony_ci}; 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci/* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */ 14562306a36Sopenharmony_cistatic struct psil_ep j7200_dst_ep_map[] = { 14662306a36Sopenharmony_ci /* PDMA_MCASP - McASP0-2 */ 14762306a36Sopenharmony_ci PSIL_PDMA_MCASP(0xc400), 14862306a36Sopenharmony_ci PSIL_PDMA_MCASP(0xc401), 14962306a36Sopenharmony_ci PSIL_PDMA_MCASP(0xc402), 15062306a36Sopenharmony_ci /* PDMA_SPI_G0 - SPI0-3 */ 15162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc600), 15262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc601), 15362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc602), 15462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc603), 15562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc604), 15662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc605), 15762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc606), 15862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc607), 15962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc608), 16062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc609), 16162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc60a), 16262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc60b), 16362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc60c), 16462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc60d), 16562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc60e), 16662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc60f), 16762306a36Sopenharmony_ci /* PDMA_SPI_G1 - SPI4-7 */ 16862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc610), 16962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc611), 17062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc612), 17162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc613), 17262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc614), 17362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc615), 17462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc616), 17562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc617), 17662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc618), 17762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc619), 17862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc61a), 17962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc61b), 18062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc61c), 18162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc61d), 18262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc61e), 18362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc61f), 18462306a36Sopenharmony_ci /* PDMA_USART_G0 - UART0-1 */ 18562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc700), 18662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc701), 18762306a36Sopenharmony_ci /* PDMA_USART_G1 - UART2-3 */ 18862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc702), 18962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc703), 19062306a36Sopenharmony_ci /* PDMA_USART_G2 - UART4-9 */ 19162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc704), 19262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc705), 19362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc706), 19462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc707), 19562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc708), 19662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xc709), 19762306a36Sopenharmony_ci /* CPSW5 */ 19862306a36Sopenharmony_ci PSIL_ETHERNET(0xca00), 19962306a36Sopenharmony_ci PSIL_ETHERNET(0xca01), 20062306a36Sopenharmony_ci PSIL_ETHERNET(0xca02), 20162306a36Sopenharmony_ci PSIL_ETHERNET(0xca03), 20262306a36Sopenharmony_ci PSIL_ETHERNET(0xca04), 20362306a36Sopenharmony_ci PSIL_ETHERNET(0xca05), 20462306a36Sopenharmony_ci PSIL_ETHERNET(0xca06), 20562306a36Sopenharmony_ci PSIL_ETHERNET(0xca07), 20662306a36Sopenharmony_ci /* CPSW0 */ 20762306a36Sopenharmony_ci PSIL_ETHERNET(0xf000), 20862306a36Sopenharmony_ci PSIL_ETHERNET(0xf001), 20962306a36Sopenharmony_ci PSIL_ETHERNET(0xf002), 21062306a36Sopenharmony_ci PSIL_ETHERNET(0xf003), 21162306a36Sopenharmony_ci PSIL_ETHERNET(0xf004), 21262306a36Sopenharmony_ci PSIL_ETHERNET(0xf005), 21362306a36Sopenharmony_ci PSIL_ETHERNET(0xf006), 21462306a36Sopenharmony_ci PSIL_ETHERNET(0xf007), 21562306a36Sopenharmony_ci /* MCU_PDMA_MISC_G0 - SPI0 */ 21662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf100), 21762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf101), 21862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf102), 21962306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf103), 22062306a36Sopenharmony_ci /* MCU_PDMA_MISC_G1 - SPI1-2 */ 22162306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf200), 22262306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf201), 22362306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf202), 22462306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf203), 22562306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf204), 22662306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf205), 22762306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf206), 22862306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf207), 22962306a36Sopenharmony_ci /* MCU_PDMA_MISC_G2 - UART0 */ 23062306a36Sopenharmony_ci PSIL_PDMA_XY_PKT(0xf300), 23162306a36Sopenharmony_ci /* SA2UL */ 23262306a36Sopenharmony_ci PSIL_SA2UL(0xf500, 1), 23362306a36Sopenharmony_ci PSIL_SA2UL(0xf501, 1), 23462306a36Sopenharmony_ci}; 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_cistruct psil_ep_map j7200_ep_map = { 23762306a36Sopenharmony_ci .name = "j7200", 23862306a36Sopenharmony_ci .src = j7200_src_ep_map, 23962306a36Sopenharmony_ci .src_count = ARRAY_SIZE(j7200_src_ep_map), 24062306a36Sopenharmony_ci .dst = j7200_dst_ep_map, 24162306a36Sopenharmony_ci .dst_count = ARRAY_SIZE(j7200_dst_ep_map), 24262306a36Sopenharmony_ci}; 243