From: Viktor Barna <viktor.barna@xxxxxxxxxx> (Part of the split. Please, take a look at the cover letter for more details). Signed-off-by: Viktor Barna <viktor.barna@xxxxxxxxxx> --- drivers/net/wireless/celeno/cl8k/def.h | 235 +++++++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 drivers/net/wireless/celeno/cl8k/def.h diff --git a/drivers/net/wireless/celeno/cl8k/def.h b/drivers/net/wireless/celeno/cl8k/def.h new file mode 100644 index 000000000000..24613836d263 --- /dev/null +++ b/drivers/net/wireless/celeno/cl8k/def.h @@ -0,0 +1,235 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +/* Copyright(c) 2019-2022, Celeno Communications Ltd. */ + +#ifndef CL_DEF_H +#define CL_DEF_H + +#include <linux/stddef.h> +#include <linux/types.h> + +#ifndef CONFIG_CL8K_VERSION +#define CONFIG_CL8K_VERSION "8.0.0.0.0.0" +#endif /* CONFIG_CL8K_VERSION */ + +#define ASSERT_ERR(condition) \ + do { \ + if (unlikely(!(condition))) \ + cl_dbg_err(cl_hw, ":ASSERT_ERR(" #condition ")\n"); \ + } while (0) + +#define ASSERT_ERR_CHIP(condition) \ + do { \ + if (unlikely(!(condition))) \ + cl_dbg_chip_err(chip, ":ASSERT_ERR(" #condition ")\n"); \ + } while (0) + +#define msecs_round(ms) jiffies_to_msecs(msecs_to_jiffies(ms)) + +/* Each chip supports two TCVs */ +#define TCV0 0 +#define TCV1 1 +#define TCV_MAX 2 + +#define CHIP0 0 +#define CHIP1 1 +#define CHIP_MAX 2 + +#define TCV_TOTAL (CHIP_MAX * TCV_MAX) + +enum cl_fw_band { + FW_BAND_2GHZ, + FW_BAND_5GHZ, + FW_BAND_6GHZ, + + FW_BAND_MAX, +}; + +#define BAND_6G 6 +#define BAND_5G 5 +#define BAND_24G 24 + +#define CL_VENDOR_ID 0x1d69 + +#define CPU_MAX_NUM 8 + +/* We support 128 stations and last station is assigned for high priority */ +#define CL_MAX_NUM_STA 128 +#define FW_MAX_NUM_STA (CL_MAX_NUM_STA + 1) + +#define MAX_SINGLE_QUEUES (AC_MAX * FW_MAX_NUM_STA) +#define HIGH_PRIORITY_QUEUE (MAX_SINGLE_QUEUES - 1) + +/* Must be aligned to NX_VIRT_DEV_MAX definition in rwnx_config.h */ +#define MAX_BSS_NUM 8 +#define BSS_INVALID_IDX 0xFF + +#define MAX_TX_SW_AMSDU_PACKET 15 + +#define RX_MAX_MSDU_IN_AMSDU 128 + +#define CL_PATH_MAX 200 +#define CL_FILENAME_MAX 100 + +/* MAX/MIN number of antennas supported */ +#define MIN_ANTENNAS 1 +#define MAX_ANTENNAS 6 +#define MAX_ANTENNAS_OFDM_HT_VHT 4 +#define MAX_ANTENNAS_CCK 4 +#define MAX_ANTENNAS_CHIP 8 + +#define MAX_ANTENNAS_CL808X 8 +#define MAX_ANTENNAS_CL806X 6 +#define MAX_ANTENNAS_CL804X 4 +#define MAX_ANTENNAS_WIRING_ID_27_31 3 + +#define ANT_MASK(ant) (BIT(ant) - 1) + +/* 6GHz defines */ +#define HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP_OFFSET 3 +#define HE_6GHZ_CAP_MAX_MPDU_LEN_OFFSET 6 +#define HE_6GHZ_CAP_MAX_AMPDU_LEN_FACTOR 13 +#define HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP_MASK 0x38 + +#define MHZ_TO_BW(mhz) ilog2((mhz) / 20) +#define BW_TO_MHZ(bw) ((1 << (bw)) * 20) +#define BW_TO_KHZ(bw) ((1 << (bw)) * 20000) + +#define CL_HWQ_BK 0 +#define CL_HWQ_BE 1 +#define CL_HWQ_VI 2 +#define CL_HWQ_VO 3 +#define CL_HWQ_BCN 4 + +/* Traffic ID enumeration */ +enum { + TID_0, + TID_1, + TID_2, + TID_3, + TID_4, + TID_5, + TID_6, + TID_7, + TID_MAX +}; + +/* Access Category enumeration */ +enum { + AC_BK = 0, + AC_BE, + AC_VI, + AC_VO, + AC_MAX +}; + +enum cl_dev_flag { + CL_DEV_HW_RESTART, + CL_DEV_SW_RESTART, + CL_DEV_STOP_HW, + CL_DEV_STARTED, + CL_DEV_AP_STARTED, + CL_DEV_INIT, + CL_DEV_FW_SYNC, + CL_DEV_FW_ERROR, + CL_DEV_REPEATER, + CL_DEV_MESH_AP, + CL_DEV_RADAR_LISTEN +}; + +enum cl_hw_mode { + HW_MODE_A, + HW_MODE_B, + HW_MODE_G, + HW_MODE_BG, + + HW_MODE_MAX, +}; + +enum cl_channel_bw { + CHNL_BW_20, + CHNL_BW_40, + CHNL_BW_80, + CHNL_BW_160, + + CHNL_BW_MAX, +}; + +#define MU_UL_MAX 4 + +#define CHNL_BW_MAX_HE CHNL_BW_MAX +#define CHNL_BW_MAX_VHT CHNL_BW_MAX +#define CHNL_BW_MAX_HT CHNL_BW_80 + +#define CHNL_BW_2_5 4 +#define CHNL_BW_5 5 +#define CHNL_BW_10 6 + +#define MESH_BASIC_RATE_MAX 12 + +enum cl_wireless_mode { + WIRELESS_MODE_LEGACY, + WIRELESS_MODE_HT, + WIRELESS_MODE_HT_VHT, + WIRELESS_MODE_HT_VHT_HE, + WIRELESS_MODE_HE +}; + +enum cl_ndp_tx_chains { + NDP_TX_PHY0 = 0x1, + NDP_TX_PHY1 = 0x2, + NDP_TX_PHY01 = 0x3, +}; + +#define Q2_TO_FREQ(x) ((x) >> 2) +#define FREQ_TO_Q2(freq) ((freq) << 2) + +/* Values of the firmware FORMATMOD fields */ +enum format_mode { + FORMATMOD_NON_HT = 0, + FORMATMOD_NON_HT_DUP_OFDM = 1, + FORMATMOD_HT_MF = 2, + FORMATMOD_HT_GF = 3, + FORMATMOD_VHT = 4, + FORMATMOD_HE_SU = 5, + FORMATMOD_HE_MU = 6, + FORMATMOD_HE_EXT = 7, + FORMATMOD_HE_TRIG = 8, + FORMATMOD_MAX = 9 +}; + +/* PHY device options */ +enum { + PHY_DEV_OLYMPUS, /* Olympus - 5g/24g */ + PHY_DEV_ATHOS, /* Athos - 6g , AthosB - 6g/5g */ + PHY_DEV_DUMMY, /* Dummy */ + PHY_DEV_FRU, /* Fake RF Unit */ + PHY_DEV_LOOPBACK, /* RICU loopback mode */ + PHY_DEV_MAX, +}; + +#define IS_REAL_PHY(chip) ((chip)->conf->ci_phy_dev <= PHY_DEV_ATHOS) + +#define riu_chain_for_each(_chain) \ + for (_chain = cl_hw->first_riu_chain; _chain <= cl_hw->last_riu_chain; _chain++) + +#define CL_MU_OFDMA_MAX_STA_PER_GRP 8 +#define CL_MU_MIMO_MAX_STA_PER_GRP 4 + +#if CL_MU_MIMO_MAX_STA_PER_GRP > CL_MU_OFDMA_MAX_STA_PER_GRP +#define CL_MU_MAX_STA_PER_GROUP CL_MU_MIMO_MAX_STA_PER_GRP +#else +#define CL_MU_MAX_STA_PER_GROUP CL_MU_OFDMA_MAX_STA_PER_GRP +#endif + +/* Max flags for driver status description is defined as 32 * MAX_CFM_FLAGS */ +#define MAX_CFM_FLAGS 2 +#define DELAY_HIST_SIZE 32 + +#define STR_LEN_32B 32 +#define STR_LEN_64B 64 +#define STR_LEN_256B 256 + +#define STA_HASH_SIZE 256 +#define STA_IDX_INVALID U8_MAX + +#endif /* CL_DEF_H */ -- 2.36.1