1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2012-2014, 2018, 2020-2024 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
7 #ifndef __iwl_fw_api_phy_ctxt_h__
8 #define __iwl_fw_api_phy_ctxt_h__
11 #define PHY_BAND_5 (0)
12 #define PHY_BAND_24 (1)
13 #define PHY_BAND_6 (2)
15 /* Supported channel width, vary if there is VHT support */
16 #define IWL_PHY_CHANNEL_MODE20 0x0
17 #define IWL_PHY_CHANNEL_MODE40 0x1
18 #define IWL_PHY_CHANNEL_MODE80 0x2
19 #define IWL_PHY_CHANNEL_MODE160 0x3
20 /* and 320 MHz for EHT */
21 #define IWL_PHY_CHANNEL_MODE320 0x4
24 * Control channel position:
25 * For legacy set bit means upper channel, otherwise lower.
26 * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
27 * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
28 * For EHT - bit-3 is used for extended distance
32 * 80Mhz |____|____|____|____|
33 * 160Mhz |____|____|____|____|____|____|____|____|
34 * 320MHz |____|____|____|____|____|____|____|____|____|____|____|____|____|____|____|____|
35 * code 1011 1010 1001 1000 0011 0010 0001 0000 0100 0101 0110 0111 1100 1101 1110 1111
37 #define IWL_PHY_CTRL_POS_ABOVE 0x4
38 #define IWL_PHY_CTRL_POS_OFFS_EXT 0x8
39 #define IWL_PHY_CTRL_POS_OFFS_MSK 0x3
42 * struct iwl_fw_channel_info_v1 - channel information
45 * @channel: channel number
46 * @width: PHY_[VHT|LEGACY]_CHANNEL_*
47 * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
49 struct iwl_fw_channel_info_v1 {
54 } __packed; /* CHANNEL_CONFIG_API_S_VER_1 */
57 * struct iwl_fw_channel_info - channel information
59 * @channel: channel number
61 * @width: PHY_[VHT|LEGACY]_CHANNEL_*
62 * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
63 * @reserved: for future use and alignment
65 struct iwl_fw_channel_info {
71 } __packed; /*CHANNEL_CONFIG_API_S_VER_2 */
73 #define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
74 #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
75 (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
76 #define PHY_RX_CHAIN_VALID_POS (1)
77 #define PHY_RX_CHAIN_VALID_MSK \
78 (0x7 << PHY_RX_CHAIN_VALID_POS)
79 #define PHY_RX_CHAIN_FORCE_SEL_POS (4)
80 #define PHY_RX_CHAIN_FORCE_SEL_MSK \
81 (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
82 #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
83 #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
84 (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
85 #define PHY_RX_CHAIN_CNT_POS (10)
86 #define PHY_RX_CHAIN_CNT_MSK \
87 (0x3 << PHY_RX_CHAIN_CNT_POS)
88 #define PHY_RX_CHAIN_MIMO_CNT_POS (12)
89 #define PHY_RX_CHAIN_MIMO_CNT_MSK \
90 (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
91 #define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
92 #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
93 (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
95 /* TODO: fix the value, make it depend on firmware at runtime? */
98 /* TODO: complete missing documentation */
100 * struct iwl_phy_context_cmd_tail - tail of iwl_phy_ctx_cmd for alignment with
101 * various channel structures.
105 * @acquisition_data: ???
106 * @dsp_cfg_flags: set to 0
108 struct iwl_phy_context_cmd_tail {
111 __le32 acquisition_data;
112 __le32 dsp_cfg_flags;
116 * struct iwl_phy_context_cmd_v1 - config of the PHY context
117 * ( PHY_CONTEXT_CMD = 0x8 )
118 * @id_and_color: ID and color of the relevant Binding
119 * @action: action to perform, see &enum iwl_ctxt_action
120 * @apply_time: 0 means immediate apply and context switch.
121 * other value means apply new params after X usecs
122 * @tx_param_color: ???
124 * @tail: command tail
126 struct iwl_phy_context_cmd_v1 {
127 /* COMMON_INDEX_HDR_API_S_VER_1 */
130 /* PHY_CONTEXT_DATA_API_S_VER_3 */
132 __le32 tx_param_color;
133 struct iwl_fw_channel_info ci;
134 struct iwl_phy_context_cmd_tail tail;
135 } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
138 * struct iwl_phy_context_cmd - config of the PHY context
139 * ( PHY_CONTEXT_CMD = 0x8 )
140 * @id_and_color: ID and color of the relevant Binding
141 * @action: action to perform, see &enum iwl_ctxt_action
142 * @lmac_id: the lmac id the phy context belongs to
145 * @sbb_bandwidth: 0 disabled, 1 - 40Mhz ... 4 - 320MHz
146 * @sbb_ctrl_channel_loc: location of the control channel
147 * @puncture_mask: bitmap of punctured subchannels
148 * @dsp_cfg_flags: set to 0
149 * @reserved: reserved to align to 64 bit
151 struct iwl_phy_context_cmd {
152 /* COMMON_INDEX_HDR_API_S_VER_1 */
155 /* PHY_CONTEXT_DATA_API_S_VER_3, PHY_CONTEXT_DATA_API_S_VER_4 */
156 struct iwl_fw_channel_info ci;
159 __le32 rxchain_info; /* reserved in _VER_4 */
160 struct { /* used for _VER_5/_VER_6 */
162 u8 sbb_ctrl_channel_loc;
163 __le16 puncture_mask; /* added in VER_6 */
166 __le32 dsp_cfg_flags;
168 } __packed; /* PHY_CONTEXT_CMD_API_VER_3,
169 * PHY_CONTEXT_CMD_API_VER_4,
170 * PHY_CONTEXT_CMD_API_VER_5,
171 * PHY_CONTEXT_CMD_API_VER_6
174 #endif /* __iwl_fw_api_phy_ctxt_h__ */