18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This file is part of wl12xx
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Texas Instruments Inc.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __WL12XX_PRIV_H__
98c2ecf20Sopenharmony_ci#define __WL12XX_PRIV_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include "conf.h"
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* WiLink 6/7 chip IDs */
148c2ecf20Sopenharmony_ci#define CHIP_ID_127X_PG10              (0x04030101)
158c2ecf20Sopenharmony_ci#define CHIP_ID_127X_PG20              (0x04030111)
168c2ecf20Sopenharmony_ci#define CHIP_ID_128X_PG10              (0x05030101)
178c2ecf20Sopenharmony_ci#define CHIP_ID_128X_PG20              (0x05030111)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* FW chip version for wl127x */
208c2ecf20Sopenharmony_ci#define WL127X_CHIP_VER		6
218c2ecf20Sopenharmony_ci/* minimum single-role FW version for wl127x */
228c2ecf20Sopenharmony_ci#define WL127X_IFTYPE_SR_VER	3
238c2ecf20Sopenharmony_ci#define WL127X_MAJOR_SR_VER	10
248c2ecf20Sopenharmony_ci#define WL127X_SUBTYPE_SR_VER	WLCORE_FW_VER_IGNORE
258c2ecf20Sopenharmony_ci#define WL127X_MINOR_SR_VER	133
268c2ecf20Sopenharmony_ci/* minimum multi-role FW version for wl127x */
278c2ecf20Sopenharmony_ci#define WL127X_IFTYPE_MR_VER	5
288c2ecf20Sopenharmony_ci#define WL127X_MAJOR_MR_VER	7
298c2ecf20Sopenharmony_ci#define WL127X_SUBTYPE_MR_VER	WLCORE_FW_VER_IGNORE
308c2ecf20Sopenharmony_ci#define WL127X_MINOR_MR_VER	42
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* FW chip version for wl128x */
338c2ecf20Sopenharmony_ci#define WL128X_CHIP_VER		7
348c2ecf20Sopenharmony_ci/* minimum single-role FW version for wl128x */
358c2ecf20Sopenharmony_ci#define WL128X_IFTYPE_SR_VER	3
368c2ecf20Sopenharmony_ci#define WL128X_MAJOR_SR_VER	10
378c2ecf20Sopenharmony_ci#define WL128X_SUBTYPE_SR_VER	WLCORE_FW_VER_IGNORE
388c2ecf20Sopenharmony_ci#define WL128X_MINOR_SR_VER	133
398c2ecf20Sopenharmony_ci/* minimum multi-role FW version for wl128x */
408c2ecf20Sopenharmony_ci#define WL128X_IFTYPE_MR_VER	5
418c2ecf20Sopenharmony_ci#define WL128X_MAJOR_MR_VER	7
428c2ecf20Sopenharmony_ci#define WL128X_SUBTYPE_MR_VER	WLCORE_FW_VER_IGNORE
438c2ecf20Sopenharmony_ci#define WL128X_MINOR_MR_VER	42
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define WL12XX_AGGR_BUFFER_SIZE	(4 * PAGE_SIZE)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define WL12XX_NUM_TX_DESCRIPTORS 16
488c2ecf20Sopenharmony_ci#define WL12XX_NUM_RX_DESCRIPTORS 8
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define WL12XX_NUM_MAC_ADDRESSES 2
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define WL12XX_RX_BA_MAX_SESSIONS 3
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define WL12XX_MAX_AP_STATIONS 8
558c2ecf20Sopenharmony_ci#define WL12XX_MAX_LINKS 12
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cistruct wl127x_rx_mem_pool_addr {
588c2ecf20Sopenharmony_ci	u32 addr;
598c2ecf20Sopenharmony_ci	u32 addr_extra;
608c2ecf20Sopenharmony_ci};
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_cistruct wl12xx_priv {
638c2ecf20Sopenharmony_ci	struct wl12xx_priv_conf conf;
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	int ref_clock;
668c2ecf20Sopenharmony_ci	int tcxo_clock;
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci	struct wl127x_rx_mem_pool_addr *rx_mem_addr;
698c2ecf20Sopenharmony_ci};
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* Reference clock values */
728c2ecf20Sopenharmony_cienum {
738c2ecf20Sopenharmony_ci	WL12XX_REFCLOCK_19	= 0, /* 19.2 MHz */
748c2ecf20Sopenharmony_ci	WL12XX_REFCLOCK_26	= 1, /* 26 MHz */
758c2ecf20Sopenharmony_ci	WL12XX_REFCLOCK_38	= 2, /* 38.4 MHz */
768c2ecf20Sopenharmony_ci	WL12XX_REFCLOCK_52	= 3, /* 52 MHz */
778c2ecf20Sopenharmony_ci	WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
788c2ecf20Sopenharmony_ci	WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/* TCXO clock values */
828c2ecf20Sopenharmony_cienum {
838c2ecf20Sopenharmony_ci	WL12XX_TCXOCLOCK_19_2	= 0, /* 19.2MHz */
848c2ecf20Sopenharmony_ci	WL12XX_TCXOCLOCK_26	= 1, /* 26 MHz */
858c2ecf20Sopenharmony_ci	WL12XX_TCXOCLOCK_38_4	= 2, /* 38.4MHz */
868c2ecf20Sopenharmony_ci	WL12XX_TCXOCLOCK_52	= 3, /* 52 MHz */
878c2ecf20Sopenharmony_ci	WL12XX_TCXOCLOCK_16_368	= 4, /* 16.368 MHz */
888c2ecf20Sopenharmony_ci	WL12XX_TCXOCLOCK_32_736	= 5, /* 32.736 MHz */
898c2ecf20Sopenharmony_ci	WL12XX_TCXOCLOCK_16_8	= 6, /* 16.8 MHz */
908c2ecf20Sopenharmony_ci	WL12XX_TCXOCLOCK_33_6	= 7, /* 33.6 MHz */
918c2ecf20Sopenharmony_ci};
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_cistruct wl12xx_clock {
948c2ecf20Sopenharmony_ci	u32	freq;
958c2ecf20Sopenharmony_ci	bool	xtal;
968c2ecf20Sopenharmony_ci	u8	hw_idx;
978c2ecf20Sopenharmony_ci};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cistruct wl12xx_fw_packet_counters {
1008c2ecf20Sopenharmony_ci	/* Cumulative counter of released packets per AC */
1018c2ecf20Sopenharmony_ci	u8 tx_released_pkts[NUM_TX_QUEUES];
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci	/* Cumulative counter of freed packets per HLID */
1048c2ecf20Sopenharmony_ci	u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS];
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci	/* Cumulative counter of released Voice memory blocks */
1078c2ecf20Sopenharmony_ci	u8 tx_voice_released_blks;
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci	/* Tx rate of the last transmitted packet */
1108c2ecf20Sopenharmony_ci	u8 tx_last_rate;
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci	u8 padding[2];
1138c2ecf20Sopenharmony_ci} __packed;
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* FW status registers */
1168c2ecf20Sopenharmony_cistruct wl12xx_fw_status {
1178c2ecf20Sopenharmony_ci	__le32 intr;
1188c2ecf20Sopenharmony_ci	u8  fw_rx_counter;
1198c2ecf20Sopenharmony_ci	u8  drv_rx_counter;
1208c2ecf20Sopenharmony_ci	u8  reserved;
1218c2ecf20Sopenharmony_ci	u8  tx_results_counter;
1228c2ecf20Sopenharmony_ci	__le32 rx_pkt_descs[WL12XX_NUM_RX_DESCRIPTORS];
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci	__le32 fw_localtime;
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	/*
1278c2ecf20Sopenharmony_ci	 * A bitmap (where each bit represents a single HLID)
1288c2ecf20Sopenharmony_ci	 * to indicate if the station is in PS mode.
1298c2ecf20Sopenharmony_ci	 */
1308c2ecf20Sopenharmony_ci	__le32 link_ps_bitmap;
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci	/*
1338c2ecf20Sopenharmony_ci	 * A bitmap (where each bit represents a single HLID) to indicate
1348c2ecf20Sopenharmony_ci	 * if the station is in Fast mode
1358c2ecf20Sopenharmony_ci	 */
1368c2ecf20Sopenharmony_ci	__le32 link_fast_bitmap;
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci	/* Cumulative counter of total released mem blocks since FW-reset */
1398c2ecf20Sopenharmony_ci	__le32 total_released_blks;
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	/* Size (in Memory Blocks) of TX pool */
1428c2ecf20Sopenharmony_ci	__le32 tx_total;
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci	struct wl12xx_fw_packet_counters counters;
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci	__le32 log_start_addr;
1478c2ecf20Sopenharmony_ci} __packed;
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci#endif /* __WL12XX_PRIV_H__ */
150