xref: /freebsd/sys/contrib/dev/mediatek/mt76/mt7603/mcu.h (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1 /* SPDX-License-Identifier: ISC */
2 
3 #ifndef __MT7603_MCU_H
4 #define __MT7603_MCU_H
5 
6 struct mt7603_mcu_txd {
7 	__le16 len;
8 	__le16 pq_id;
9 
10 	u8 cid;
11 	u8 pkt_type;
12 	u8 set_query;
13 	u8 seq;
14 
15 	u8 uc_d2b0_rev;
16 	u8 ext_cid;
17 	u8 uc_d2b2_rev;
18 	u8 ext_cid_ack;
19 
20 	u32 au4_d3_to_d7_rev[5];
21 } __packed __aligned(4);
22 
23 struct mt7603_mcu_rxd {
24 	__le16 len;
25 	__le16 pkt_type_id;
26 
27 	u8 eid;
28 	u8 seq;
29 	__le16 __rsv;
30 
31 	u8 ext_eid;
32 	u8 __rsv1[3];
33 };
34 
35 #define MCU_PKT_ID		0xa0
36 #define MCU_PORT_QUEUE		0x8000
37 #define MCU_PORT_QUEUE_FW	0xc000
38 
39 #define MCU_FIRMWARE_ADDRESS	0x100000
40 
41 enum {
42 	MCU_Q_QUERY,
43 	MCU_Q_SET,
44 	MCU_Q_RESERVED,
45 	MCU_Q_NA
46 };
47 
48 enum {
49 	MCU_CMD_TARGET_ADDRESS_LEN_REQ = 0x01,
50 	MCU_CMD_FW_START_REQ = 0x02,
51 	MCU_CMD_INIT_ACCESS_REG = 0x3,
52 	MCU_CMD_PATCH_START_REQ = 0x05,
53 	MCU_CMD_PATCH_FINISH_REQ = 0x07,
54 	MCU_CMD_PATCH_SEM_CONTROL = 0x10,
55 	MCU_CMD_HIF_LOOPBACK = 0x20,
56 	MCU_CMD_CH_PRIVILEGE = 0x20,
57 	MCU_CMD_ACCESS_REG = 0xC2,
58 	MCU_CMD_EXT_CID = 0xED,
59 	MCU_CMD_FW_SCATTER = 0xEE,
60 	MCU_CMD_RESTART_DL_REQ = 0xEF,
61 };
62 
63 enum {
64 	MCU_EXT_CMD_RF_REG_ACCESS = 0x02,
65 	MCU_EXT_CMD_RF_TEST = 0x04,
66 	MCU_EXT_CMD_RADIO_ON_OFF_CTRL = 0x05,
67 	MCU_EXT_CMD_WIFI_RX_DISABLE = 0x06,
68 	MCU_EXT_CMD_PM_STATE_CTRL = 0x07,
69 	MCU_EXT_CMD_CHANNEL_SWITCH = 0x08,
70 	MCU_EXT_CMD_NIC_CAPABILITY = 0x09,
71 	MCU_EXT_CMD_PWR_SAVING = 0x0A,
72 	MCU_EXT_CMD_MULTIPLE_REG_ACCESS = 0x0E,
73 	MCU_EXT_CMD_AP_PWR_SAVING_CAPABILITY = 0xF,
74 	MCU_EXT_CMD_SEC_ADDREMOVE_KEY = 0x10,
75 	MCU_EXT_CMD_SET_TX_POWER_CTRL = 0x11,
76 	MCU_EXT_CMD_FW_LOG_2_HOST = 0x13,
77 	MCU_EXT_CMD_PS_RETRIEVE_START = 0x14,
78 	MCU_EXT_CMD_LED_CTRL = 0x17,
79 	MCU_EXT_CMD_PACKET_FILTER = 0x18,
80 	MCU_EXT_CMD_PWR_MGT_BIT_WIFI = 0x1B,
81 	MCU_EXT_CMD_EFUSE_BUFFER_MODE = 0x21,
82 	MCU_EXT_CMD_THERMAL_PROTECT = 0x23,
83 	MCU_EXT_CMD_EDCA_SET = 0x27,
84 	MCU_EXT_CMD_SLOT_TIME_SET = 0x28,
85 	MCU_EXT_CMD_CONFIG_INTERNAL_SETTING = 0x29,
86 	MCU_EXT_CMD_NOA_OFFLOAD_CTRL = 0x2B,
87 	MCU_EXT_CMD_GET_THEMAL_SENSOR = 0x2C,
88 	MCU_EXT_CMD_WAKEUP_OPTION = 0x2E,
89 	MCU_EXT_CMD_AC_QUEUE_CONTROL = 0x31,
90 	MCU_EXT_CMD_BCN_UPDATE = 0x33
91 };
92 
93 enum {
94 	MCU_EXT_EVENT_CMD_RESULT = 0x0,
95 	MCU_EXT_EVENT_RF_REG_ACCESS = 0x2,
96 	MCU_EXT_EVENT_MULTI_CR_ACCESS = 0x0E,
97 	MCU_EXT_EVENT_FW_LOG_2_HOST = 0x13,
98 	MCU_EXT_EVENT_BEACON_LOSS = 0x1A,
99 	MCU_EXT_EVENT_THERMAL_PROTECT = 0x22,
100 	MCU_EXT_EVENT_BCN_UPDATE = 0x31,
101 };
102 
103 #endif
104