1// SPDX-License-Identifier: GPL-2.0
2/*
3 *  Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com
4 */
5
6#include <linux/kernel.h>
7
8#include "k3-psil-priv.h"
9
10#define PSIL_ETHERNET(x, ch, flow_base, flow_cnt)		\
11	{							\
12		.thread_id = x,					\
13		.ep_config = {					\
14			.ep_type = PSIL_EP_NATIVE,		\
15			.pkt_mode = 1,				\
16			.needs_epib = 1,			\
17			.psd_size = 16,				\
18			.mapped_channel_id = ch,		\
19			.flow_start = flow_base,		\
20			.flow_num = flow_cnt,			\
21			.default_flow_id = flow_base,		\
22		},						\
23	}
24
25/* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */
26static struct psil_ep am62_src_ep_map[] = {
27	/* CPSW3G */
28	PSIL_ETHERNET(0x4600, 19, 19, 16),
29};
30
31/* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */
32static struct psil_ep am62_dst_ep_map[] = {
33	/* CPSW3G */
34	PSIL_ETHERNET(0xc600, 19, 19, 8),
35	PSIL_ETHERNET(0xc601, 20, 27, 8),
36	PSIL_ETHERNET(0xc602, 21, 35, 8),
37	PSIL_ETHERNET(0xc603, 22, 43, 8),
38	PSIL_ETHERNET(0xc604, 23, 51, 8),
39	PSIL_ETHERNET(0xc605, 24, 59, 8),
40	PSIL_ETHERNET(0xc606, 25, 67, 8),
41	PSIL_ETHERNET(0xc607, 26, 75, 8),
42};
43
44struct psil_ep_map am62_ep_map = {
45	.name = "am62",
46	.src = am62_src_ep_map,
47	.src_count = ARRAY_SIZE(am62_src_ep_map),
48	.dst = am62_dst_ep_map,
49	.dst_count = ARRAY_SIZE(am62_dst_ep_map),
50};
51