blob: d388484c0358a13ca45d032ae320b24958e9317d [file] [log] [blame]
MD Danish Anwar89d709b2024-04-04 12:38:00 +05301/* SPDX-License-Identifier: GPL-2.0 */
2/* Texas Instruments ICSSG Ethernet driver
3 *
4 * Copyright (C) 2018-2024 Texas Instruments Incorporated - https://www.ti.com/
5 *
6 */
7
8#ifndef __NET_TI_ICSSG_CONFIG_H
9#define __NET_TI_ICSSG_CONFIG_H
10
11struct icssg_buffer_pool_cfg {
12 __le32 addr;
13 __le32 len;
14} __packed;
15
16struct icssg_flow_cfg {
17 __le16 rx_base_flow;
18 __le16 mgm_base_flow;
19} __packed;
20
21/* Config area lies in shared RAM */
22#define ICSSG_CONFIG_OFFSET_SLICE0 0
23#define ICSSG_CONFIG_OFFSET_SLICE1 0x8000
24
25/* pstate speed/duplex command to set speed and duplex settings
26 * in firmware.
27 * Command format : 0x8102ssPN. ss - sequence number: currently not
28 * used by driver, P - port number: For switch, N - Speed/Duplex state
29 * - Possible values of N:
30 * 0x0 - 10Mbps/Half duplex ;
31 * 0x8 - 10Mbps/Full duplex ;
32 * 0x2 - 100Mbps/Half duplex;
33 * 0xa - 100Mbps/Full duplex;
34 * 0xc - 1Gbps/Full duplex;
35 * NOTE: The above are same as bits [3..1](slice 0) or bits [8..6](slice 1) of
36 * RGMII CFG register. So suggested to read the register to populate the command
37 * bits.
38 */
39#define ICSSG_PSTATE_SPEED_DUPLEX_CMD 0x81020000
40#define ICSSG_PSTATE_FULL_DUPLEX BIT(3)
41#define ICSSG_PSTATE_SPEED_100 BIT(1)
42#define ICSSG_PSTATE_SPEED_1000 BIT(2)
43
44/* Flow IDs used in config structure to firmware. Should match with
45 * flow_id in struct dma for rx channels.
46 */
47#define ICSSG_RX_CHAN_FLOW_ID 0 /* flow id for host port */
48#define ICSSG_RX_MGM_CHAN_FLOW_ID 1 /* flow id for command response */
49
50/* Used to notify the FW of the current link speed */
51#define PORT_LINK_SPEED_OFFSET 0x00A8
52
53#define FW_LINK_SPEED_1G (0x00)
54#define FW_LINK_SPEED_100M (0x01)
55#define FW_LINK_SPEED_10M (0x02)
56#define FW_LINK_SPEED_HD (0x80)
57
58#define PRUETH_PKT_TYPE_CMD 0x10
59#define PRUETH_NAV_PS_DATA_SIZE 16 /* Protocol specific data size */
60#define PRUETH_NAV_SW_DATA_SIZE 16 /* SW related data size */
61#define PRUETH_MAX_RX_FLOWS 1 /* excluding default flow */
62#define PRUETH_RX_FLOW_DATA 0 /* FIXME: f/w bug to change to highest priority flow */
63
64#define PRUETH_EMAC_BUF_POOL_SIZE SZ_8K
65#define PRUETH_EMAC_POOLS_PER_SLICE 24
66#define PRUETH_EMAC_BUF_POOL_START 8
67#define PRUETH_NUM_BUF_POOLS 8
68#define PRUETH_EMAC_RX_CTX_BUF_SIZE SZ_16K /* per slice */
69#define MSMC_RAM_SIZE (2 * (PRUETH_EMAC_BUF_POOL_SIZE * PRUETH_NUM_BUF_POOLS + \
70 PRUETH_EMAC_RX_CTX_BUF_SIZE))
71
72struct icssg_rxq_ctx {
73 __le32 start[3];
74 __le32 end;
75} __packed;
76
77/* Load time Fiwmware Configuration */
78
79#define ICSSG_FW_MGMT_CMD_HEADER 0x81
80#define ICSSG_FW_MGMT_FDB_CMD_TYPE 0x03
81#define ICSSG_FW_MGMT_CMD_TYPE 0x04
82#define ICSSG_FW_MGMT_PKT 0x80000000
MD Danish Anwar6b8c29e2024-04-04 12:38:03 +053083#define ICSSG_FW_MGMT_FDB_CMD_TYPE_RX_FLOW 0x05
MD Danish Anwar89d709b2024-04-04 12:38:00 +053084
85struct icssg_r30_cmd {
86 u32 cmd[4];
87} __packed;
88
89enum icssg_port_state_cmd {
90 ICSSG_EMAC_PORT_DISABLE = 0,
91 ICSSG_EMAC_PORT_BLOCK,
92 ICSSG_EMAC_PORT_FORWARD,
93 ICSSG_EMAC_PORT_FORWARD_WO_LEARNING,
94 ICSSG_EMAC_PORT_ACCEPT_ALL,
95 ICSSG_EMAC_PORT_ACCEPT_TAGGED,
96 ICSSG_EMAC_PORT_ACCEPT_UNTAGGED_N_PRIO,
97 ICSSG_EMAC_PORT_TAS_TRIGGER,
98 ICSSG_EMAC_PORT_TAS_ENABLE,
99 ICSSG_EMAC_PORT_TAS_RESET,
100 ICSSG_EMAC_PORT_TAS_DISABLE,
101 ICSSG_EMAC_PORT_UC_FLOODING_ENABLE,
102 ICSSG_EMAC_PORT_UC_FLOODING_DISABLE,
103 ICSSG_EMAC_PORT_MC_FLOODING_ENABLE,
104 ICSSG_EMAC_PORT_MC_FLOODING_DISABLE,
105 ICSSG_EMAC_PORT_PREMPT_TX_ENABLE,
106 ICSSG_EMAC_PORT_PREMPT_TX_DISABLE,
107 ICSSG_EMAC_PORT_MAX_COMMANDS
108};
109
110#define EMAC_NONE 0xffff0000
111#define EMAC_PRU0_P_DI 0xffff0004
112#define EMAC_PRU1_P_DI 0xffff0040
113#define EMAC_TX_P_DI 0xffff0100
114
115#define EMAC_PRU0_P_EN 0xfffb0000
116#define EMAC_PRU1_P_EN 0xffbf0000
117#define EMAC_TX_P_EN 0xfeff0000
118
119#define EMAC_P_BLOCK 0xffff0040
120#define EMAC_TX_P_BLOCK 0xffff0200
121#define EMAC_P_UNBLOCK 0xffbf0000
122#define EMAC_TX_P_UNBLOCK 0xfdff0000
123#define EMAC_LEAN_EN 0xfff70000
124#define EMAC_LEAN_DI 0xffff0008
125
126#define EMAC_ACCEPT_ALL 0xffff0001
127#define EMAC_ACCEPT_TAG 0xfffe0002
128#define EMAC_ACCEPT_PRIOR 0xfffc0000
129
130/* Config area lies in DRAM */
131#define ICSSG_CONFIG_OFFSET 0x0
132
133#define ICSSG_NUM_NORMAL_PDS 64
134#define ICSSG_NUM_SPECIAL_PDS 16
135
136#define ICSSG_NORMAL_PD_SIZE 8
137#define ICSSG_SPECIAL_PD_SIZE 20
138
139#define ICSSG_FLAG_MASK 0xff00ffff
140
141struct icssg_setclock_desc {
142 u8 request;
143 u8 restore;
144 u8 acknowledgment;
145 u8 cmp_status;
146 u32 margin;
147 u32 cyclecounter0_set;
148 u32 cyclecounter1_set;
149 u32 iepcount_set;
150 u32 rsvd1;
151 u32 rsvd2;
152 u32 CMP0_current;
153 u32 iepcount_current;
154 u32 difference;
155 u32 cyclecounter0_new;
156 u32 cyclecounter1_new;
157 u32 CMP0_new;
158} __packed;
159
MD Danish Anwar6b8c29e2024-04-04 12:38:03 +0530160struct mgmt_cmd {
161 u8 param;
162 u8 seqnum;
163 u8 type;
164 u8 header;
165 u32 cmd_args[3];
166} __packed;
167
168struct mgmt_cmd_rsp {
169 u32 reserved;
170 u8 status;
171 u8 seqnum;
172 u8 type;
173 u8 header;
174 u32 cmd_args[3];
175} __packed;
176
MD Danish Anwar89d709b2024-04-04 12:38:00 +0530177#define ICSSG_CMD_POP_SLICE0 56
178#define ICSSG_CMD_POP_SLICE1 60
179
180#define ICSSG_CMD_PUSH_SLICE0 57
181#define ICSSG_CMD_PUSH_SLICE1 61
182
183#define ICSSG_RSP_POP_SLICE0 58
184#define ICSSG_RSP_POP_SLICE1 62
185
186#define ICSSG_RSP_PUSH_SLICE0 56
187#define ICSSG_RSP_PUSH_SLICE1 60
188
189#define ICSSG_TS_POP_SLICE0 59
190#define ICSSG_TS_POP_SLICE1 63
191
192#define ICSSG_TS_PUSH_SLICE0 40
193#define ICSSG_TS_PUSH_SLICE1 41
194
195#endif /* __NET_TI_ICSSG_CONFIG_H */