162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Texas Instruments ICSSG Ethernet driver 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/ 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef __NET_TI_ICSSG_CONFIG_H 962306a36Sopenharmony_ci#define __NET_TI_ICSSG_CONFIG_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cistruct icssg_buffer_pool_cfg { 1262306a36Sopenharmony_ci __le32 addr; 1362306a36Sopenharmony_ci __le32 len; 1462306a36Sopenharmony_ci} __packed; 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_cistruct icssg_flow_cfg { 1762306a36Sopenharmony_ci __le16 rx_base_flow; 1862306a36Sopenharmony_ci __le16 mgm_base_flow; 1962306a36Sopenharmony_ci} __packed; 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#define PRUETH_PKT_TYPE_CMD 0x10 2262306a36Sopenharmony_ci#define PRUETH_NAV_PS_DATA_SIZE 16 /* Protocol specific data size */ 2362306a36Sopenharmony_ci#define PRUETH_NAV_SW_DATA_SIZE 16 /* SW related data size */ 2462306a36Sopenharmony_ci#define PRUETH_MAX_TX_DESC 512 2562306a36Sopenharmony_ci#define PRUETH_MAX_RX_DESC 512 2662306a36Sopenharmony_ci#define PRUETH_MAX_RX_FLOWS 1 /* excluding default flow */ 2762306a36Sopenharmony_ci#define PRUETH_RX_FLOW_DATA 0 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#define PRUETH_EMAC_BUF_POOL_SIZE SZ_8K 3062306a36Sopenharmony_ci#define PRUETH_EMAC_POOLS_PER_SLICE 24 3162306a36Sopenharmony_ci#define PRUETH_EMAC_BUF_POOL_START 8 3262306a36Sopenharmony_ci#define PRUETH_NUM_BUF_POOLS 8 3362306a36Sopenharmony_ci#define PRUETH_EMAC_RX_CTX_BUF_SIZE SZ_16K /* per slice */ 3462306a36Sopenharmony_ci#define MSMC_RAM_SIZE \ 3562306a36Sopenharmony_ci (2 * (PRUETH_EMAC_BUF_POOL_SIZE * PRUETH_NUM_BUF_POOLS + \ 3662306a36Sopenharmony_ci PRUETH_EMAC_RX_CTX_BUF_SIZE * 2)) 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_cistruct icssg_rxq_ctx { 3962306a36Sopenharmony_ci __le32 start[3]; 4062306a36Sopenharmony_ci __le32 end; 4162306a36Sopenharmony_ci} __packed; 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* Load time Fiwmware Configuration */ 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define ICSSG_FW_MGMT_CMD_HEADER 0x81 4662306a36Sopenharmony_ci#define ICSSG_FW_MGMT_FDB_CMD_TYPE 0x03 4762306a36Sopenharmony_ci#define ICSSG_FW_MGMT_CMD_TYPE 0x04 4862306a36Sopenharmony_ci#define ICSSG_FW_MGMT_PKT 0x80000000 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_cistruct icssg_r30_cmd { 5162306a36Sopenharmony_ci u32 cmd[4]; 5262306a36Sopenharmony_ci} __packed; 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_cienum icssg_port_state_cmd { 5562306a36Sopenharmony_ci ICSSG_EMAC_PORT_DISABLE = 0, 5662306a36Sopenharmony_ci ICSSG_EMAC_PORT_BLOCK, 5762306a36Sopenharmony_ci ICSSG_EMAC_PORT_FORWARD, 5862306a36Sopenharmony_ci ICSSG_EMAC_PORT_FORWARD_WO_LEARNING, 5962306a36Sopenharmony_ci ICSSG_EMAC_PORT_ACCEPT_ALL, 6062306a36Sopenharmony_ci ICSSG_EMAC_PORT_ACCEPT_TAGGED, 6162306a36Sopenharmony_ci ICSSG_EMAC_PORT_ACCEPT_UNTAGGED_N_PRIO, 6262306a36Sopenharmony_ci ICSSG_EMAC_PORT_TAS_TRIGGER, 6362306a36Sopenharmony_ci ICSSG_EMAC_PORT_TAS_ENABLE, 6462306a36Sopenharmony_ci ICSSG_EMAC_PORT_TAS_RESET, 6562306a36Sopenharmony_ci ICSSG_EMAC_PORT_TAS_DISABLE, 6662306a36Sopenharmony_ci ICSSG_EMAC_PORT_UC_FLOODING_ENABLE, 6762306a36Sopenharmony_ci ICSSG_EMAC_PORT_UC_FLOODING_DISABLE, 6862306a36Sopenharmony_ci ICSSG_EMAC_PORT_MC_FLOODING_ENABLE, 6962306a36Sopenharmony_ci ICSSG_EMAC_PORT_MC_FLOODING_DISABLE, 7062306a36Sopenharmony_ci ICSSG_EMAC_PORT_PREMPT_TX_ENABLE, 7162306a36Sopenharmony_ci ICSSG_EMAC_PORT_PREMPT_TX_DISABLE, 7262306a36Sopenharmony_ci ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE, 7362306a36Sopenharmony_ci ICSSG_EMAC_PORT_VLAN_AWARE_DISABLE, 7462306a36Sopenharmony_ci ICSSG_EMAC_PORT_MAX_COMMANDS 7562306a36Sopenharmony_ci}; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci#define EMAC_NONE 0xffff0000 7862306a36Sopenharmony_ci#define EMAC_PRU0_P_DI 0xffff0004 7962306a36Sopenharmony_ci#define EMAC_PRU1_P_DI 0xffff0040 8062306a36Sopenharmony_ci#define EMAC_TX_P_DI 0xffff0100 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci#define EMAC_PRU0_P_EN 0xfffb0000 8362306a36Sopenharmony_ci#define EMAC_PRU1_P_EN 0xffbf0000 8462306a36Sopenharmony_ci#define EMAC_TX_P_EN 0xfeff0000 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define EMAC_P_BLOCK 0xffff0040 8762306a36Sopenharmony_ci#define EMAC_TX_P_BLOCK 0xffff0200 8862306a36Sopenharmony_ci#define EMAC_P_UNBLOCK 0xffbf0000 8962306a36Sopenharmony_ci#define EMAC_TX_P_UNBLOCK 0xfdff0000 9062306a36Sopenharmony_ci#define EMAC_LEAN_EN 0xfff70000 9162306a36Sopenharmony_ci#define EMAC_LEAN_DI 0xffff0008 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define EMAC_ACCEPT_ALL 0xffff0001 9462306a36Sopenharmony_ci#define EMAC_ACCEPT_TAG 0xfffe0002 9562306a36Sopenharmony_ci#define EMAC_ACCEPT_PRIOR 0xfffc0000 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci/* Config area lies in DRAM */ 9862306a36Sopenharmony_ci#define ICSSG_CONFIG_OFFSET 0x0 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci/* Config area lies in shared RAM */ 10162306a36Sopenharmony_ci#define ICSSG_CONFIG_OFFSET_SLICE0 0 10262306a36Sopenharmony_ci#define ICSSG_CONFIG_OFFSET_SLICE1 0x8000 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci#define ICSSG_NUM_NORMAL_PDS 64 10562306a36Sopenharmony_ci#define ICSSG_NUM_SPECIAL_PDS 16 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci#define ICSSG_NORMAL_PD_SIZE 8 10862306a36Sopenharmony_ci#define ICSSG_SPECIAL_PD_SIZE 20 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define ICSSG_FLAG_MASK 0xff00ffff 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_cistruct icssg_setclock_desc { 11362306a36Sopenharmony_ci u8 request; 11462306a36Sopenharmony_ci u8 restore; 11562306a36Sopenharmony_ci u8 acknowledgment; 11662306a36Sopenharmony_ci u8 cmp_status; 11762306a36Sopenharmony_ci u32 margin; 11862306a36Sopenharmony_ci u32 cyclecounter0_set; 11962306a36Sopenharmony_ci u32 cyclecounter1_set; 12062306a36Sopenharmony_ci u32 iepcount_set; 12162306a36Sopenharmony_ci u32 rsvd1; 12262306a36Sopenharmony_ci u32 rsvd2; 12362306a36Sopenharmony_ci u32 CMP0_current; 12462306a36Sopenharmony_ci u32 iepcount_current; 12562306a36Sopenharmony_ci u32 difference; 12662306a36Sopenharmony_ci u32 cyclecounter0_new; 12762306a36Sopenharmony_ci u32 cyclecounter1_new; 12862306a36Sopenharmony_ci u32 CMP0_new; 12962306a36Sopenharmony_ci} __packed; 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci#define ICSSG_CMD_POP_SLICE0 56 13262306a36Sopenharmony_ci#define ICSSG_CMD_POP_SLICE1 60 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci#define ICSSG_CMD_PUSH_SLICE0 57 13562306a36Sopenharmony_ci#define ICSSG_CMD_PUSH_SLICE1 61 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci#define ICSSG_RSP_POP_SLICE0 58 13862306a36Sopenharmony_ci#define ICSSG_RSP_POP_SLICE1 62 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define ICSSG_RSP_PUSH_SLICE0 56 14162306a36Sopenharmony_ci#define ICSSG_RSP_PUSH_SLICE1 60 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci#define ICSSG_TS_POP_SLICE0 59 14462306a36Sopenharmony_ci#define ICSSG_TS_POP_SLICE1 63 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define ICSSG_TS_PUSH_SLICE0 40 14762306a36Sopenharmony_ci#define ICSSG_TS_PUSH_SLICE1 41 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci/* FDB FID_C2 flag definitions */ 15062306a36Sopenharmony_ci/* Indicates host port membership.*/ 15162306a36Sopenharmony_ci#define ICSSG_FDB_ENTRY_P0_MEMBERSHIP BIT(0) 15262306a36Sopenharmony_ci/* Indicates that MAC ID is connected to physical port 1 */ 15362306a36Sopenharmony_ci#define ICSSG_FDB_ENTRY_P1_MEMBERSHIP BIT(1) 15462306a36Sopenharmony_ci/* Indicates that MAC ID is connected to physical port 2 */ 15562306a36Sopenharmony_ci#define ICSSG_FDB_ENTRY_P2_MEMBERSHIP BIT(2) 15662306a36Sopenharmony_ci/* Ageable bit is set for learned entries and cleared for static entries */ 15762306a36Sopenharmony_ci#define ICSSG_FDB_ENTRY_AGEABLE BIT(3) 15862306a36Sopenharmony_ci/* If set for DA then packet is determined to be a special packet */ 15962306a36Sopenharmony_ci#define ICSSG_FDB_ENTRY_BLOCK BIT(4) 16062306a36Sopenharmony_ci/* If set for DA then the SA from the packet is not learned */ 16162306a36Sopenharmony_ci#define ICSSG_FDB_ENTRY_SECURE BIT(5) 16262306a36Sopenharmony_ci/* If set, it means packet has been seen recently with source address + FID 16362306a36Sopenharmony_ci * matching MAC address/FID of entry 16462306a36Sopenharmony_ci */ 16562306a36Sopenharmony_ci#define ICSSG_FDB_ENTRY_TOUCHED BIT(6) 16662306a36Sopenharmony_ci/* Set if entry is valid */ 16762306a36Sopenharmony_ci#define ICSSG_FDB_ENTRY_VALID BIT(7) 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci/** 17062306a36Sopenharmony_ci * struct prueth_vlan_tbl - VLAN table entries struct in ICSSG SMEM 17162306a36Sopenharmony_ci * @fid_c1: membership and forwarding rules flag to this table. See 17262306a36Sopenharmony_ci * above to defines for bit definitions 17362306a36Sopenharmony_ci * @fid: FDB index for this VID (there is 1-1 mapping b/w VID and FID) 17462306a36Sopenharmony_ci */ 17562306a36Sopenharmony_cistruct prueth_vlan_tbl { 17662306a36Sopenharmony_ci u8 fid_c1; 17762306a36Sopenharmony_ci u8 fid; 17862306a36Sopenharmony_ci} __packed; 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci/** 18162306a36Sopenharmony_ci * struct prueth_fdb_slot - Result of FDB slot lookup 18262306a36Sopenharmony_ci * @mac: MAC address 18362306a36Sopenharmony_ci * @fid: fid to be associated with MAC 18462306a36Sopenharmony_ci * @fid_c2: FID_C2 entry for this MAC 18562306a36Sopenharmony_ci */ 18662306a36Sopenharmony_cistruct prueth_fdb_slot { 18762306a36Sopenharmony_ci u8 mac[ETH_ALEN]; 18862306a36Sopenharmony_ci u8 fid; 18962306a36Sopenharmony_ci u8 fid_c2; 19062306a36Sopenharmony_ci} __packed; 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_cienum icssg_ietfpe_verify_states { 19362306a36Sopenharmony_ci ICSSG_IETFPE_STATE_UNKNOWN = 0, 19462306a36Sopenharmony_ci ICSSG_IETFPE_STATE_INITIAL, 19562306a36Sopenharmony_ci ICSSG_IETFPE_STATE_VERIFYING, 19662306a36Sopenharmony_ci ICSSG_IETFPE_STATE_SUCCEEDED, 19762306a36Sopenharmony_ci ICSSG_IETFPE_STATE_FAILED, 19862306a36Sopenharmony_ci ICSSG_IETFPE_STATE_DISABLED 19962306a36Sopenharmony_ci}; 20062306a36Sopenharmony_ci#endif /* __NET_TI_ICSSG_CONFIG_H */ 201