xref: /openbmc/linux/drivers/net/wireless/ti/wl12xx/wl12xx.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*2b27bdccSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2166b2136SLuciano Coelho /*
3166b2136SLuciano Coelho  * This file is part of wl12xx
4166b2136SLuciano Coelho  *
5166b2136SLuciano Coelho  * Copyright (C) 2011 Texas Instruments Inc.
6166b2136SLuciano Coelho  */
7166b2136SLuciano Coelho 
8166b2136SLuciano Coelho #ifndef __WL12XX_PRIV_H__
9166b2136SLuciano Coelho #define __WL12XX_PRIV_H__
10166b2136SLuciano Coelho 
11166b2136SLuciano Coelho #include "conf.h"
12166b2136SLuciano Coelho 
13986f3aa1SLuciano Coelho /* WiLink 6/7 chip IDs */
14986f3aa1SLuciano Coelho #define CHIP_ID_127X_PG10              (0x04030101)
15986f3aa1SLuciano Coelho #define CHIP_ID_127X_PG20              (0x04030111)
16986f3aa1SLuciano Coelho #define CHIP_ID_128X_PG10              (0x05030101)
17986f3aa1SLuciano Coelho #define CHIP_ID_128X_PG20              (0x05030111)
18986f3aa1SLuciano Coelho 
198675f9abSLuciano Coelho /* FW chip version for wl127x */
204a1ccce8SArik Nemtsov #define WL127X_CHIP_VER		6
218675f9abSLuciano Coelho /* minimum single-role FW version for wl127x */
228675f9abSLuciano Coelho #define WL127X_IFTYPE_SR_VER	3
238675f9abSLuciano Coelho #define WL127X_MAJOR_SR_VER	10
248675f9abSLuciano Coelho #define WL127X_SUBTYPE_SR_VER	WLCORE_FW_VER_IGNORE
250e284c07SLuciano Coelho #define WL127X_MINOR_SR_VER	133
268675f9abSLuciano Coelho /* minimum multi-role FW version for wl127x */
278675f9abSLuciano Coelho #define WL127X_IFTYPE_MR_VER	5
288675f9abSLuciano Coelho #define WL127X_MAJOR_MR_VER	7
298675f9abSLuciano Coelho #define WL127X_SUBTYPE_MR_VER	WLCORE_FW_VER_IGNORE
3060c28cf1SLuciano Coelho #define WL127X_MINOR_MR_VER	42
314a1ccce8SArik Nemtsov 
328675f9abSLuciano Coelho /* FW chip version for wl128x */
334a1ccce8SArik Nemtsov #define WL128X_CHIP_VER		7
348675f9abSLuciano Coelho /* minimum single-role FW version for wl128x */
358675f9abSLuciano Coelho #define WL128X_IFTYPE_SR_VER	3
368675f9abSLuciano Coelho #define WL128X_MAJOR_SR_VER	10
378675f9abSLuciano Coelho #define WL128X_SUBTYPE_SR_VER	WLCORE_FW_VER_IGNORE
380e284c07SLuciano Coelho #define WL128X_MINOR_SR_VER	133
398675f9abSLuciano Coelho /* minimum multi-role FW version for wl128x */
408675f9abSLuciano Coelho #define WL128X_IFTYPE_MR_VER	5
418675f9abSLuciano Coelho #define WL128X_MAJOR_MR_VER	7
428675f9abSLuciano Coelho #define WL128X_SUBTYPE_MR_VER	WLCORE_FW_VER_IGNORE
438675f9abSLuciano Coelho #define WL128X_MINOR_MR_VER	42
444a1ccce8SArik Nemtsov 
4526a309c7SIgal Chernobelsky #define WL12XX_AGGR_BUFFER_SIZE	(4 * PAGE_SIZE)
4626a309c7SIgal Chernobelsky 
47f1c434dfSIgal Chernobelsky #define WL12XX_NUM_TX_DESCRIPTORS 16
48f1c434dfSIgal Chernobelsky #define WL12XX_NUM_RX_DESCRIPTORS 8
49f1c434dfSIgal Chernobelsky 
50f4afbed9SArik Nemtsov #define WL12XX_NUM_MAC_ADDRESSES 2
51f4afbed9SArik Nemtsov 
52d21553f8SIgal Chernobelsky #define WL12XX_RX_BA_MAX_SESSIONS 3
53d21553f8SIgal Chernobelsky 
5432f0fd5bSEliad Peller #define WL12XX_MAX_AP_STATIONS 8
55da08fdfaSEliad Peller #define WL12XX_MAX_LINKS 12
56da08fdfaSEliad Peller 
574b4887e9SLuciano Coelho struct wl127x_rx_mem_pool_addr {
584b4887e9SLuciano Coelho 	u32 addr;
594b4887e9SLuciano Coelho 	u32 addr_extra;
604b4887e9SLuciano Coelho };
614b4887e9SLuciano Coelho 
62166b2136SLuciano Coelho struct wl12xx_priv {
63166b2136SLuciano Coelho 	struct wl12xx_priv_conf conf;
64a5d751bbSLuciano Coelho 
65a5d751bbSLuciano Coelho 	int ref_clock;
66a5d751bbSLuciano Coelho 	int tcxo_clock;
672e07d028SIdo Yariv 
682e07d028SIdo Yariv 	struct wl127x_rx_mem_pool_addr *rx_mem_addr;
69166b2136SLuciano Coelho };
70166b2136SLuciano Coelho 
7144486b48SLuciano Coelho /* Reference clock values */
7244486b48SLuciano Coelho enum {
7344486b48SLuciano Coelho 	WL12XX_REFCLOCK_19	= 0, /* 19.2 MHz */
7444486b48SLuciano Coelho 	WL12XX_REFCLOCK_26	= 1, /* 26 MHz */
7544486b48SLuciano Coelho 	WL12XX_REFCLOCK_38	= 2, /* 38.4 MHz */
7644486b48SLuciano Coelho 	WL12XX_REFCLOCK_52	= 3, /* 52 MHz */
7744486b48SLuciano Coelho 	WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
7844486b48SLuciano Coelho 	WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
7944486b48SLuciano Coelho };
8044486b48SLuciano Coelho 
8144486b48SLuciano Coelho /* TCXO clock values */
8244486b48SLuciano Coelho enum {
8344486b48SLuciano Coelho 	WL12XX_TCXOCLOCK_19_2	= 0, /* 19.2MHz */
8444486b48SLuciano Coelho 	WL12XX_TCXOCLOCK_26	= 1, /* 26 MHz */
8544486b48SLuciano Coelho 	WL12XX_TCXOCLOCK_38_4	= 2, /* 38.4MHz */
8644486b48SLuciano Coelho 	WL12XX_TCXOCLOCK_52	= 3, /* 52 MHz */
8744486b48SLuciano Coelho 	WL12XX_TCXOCLOCK_16_368	= 4, /* 16.368 MHz */
8844486b48SLuciano Coelho 	WL12XX_TCXOCLOCK_32_736	= 5, /* 32.736 MHz */
8944486b48SLuciano Coelho 	WL12XX_TCXOCLOCK_16_8	= 6, /* 16.8 MHz */
9044486b48SLuciano Coelho 	WL12XX_TCXOCLOCK_33_6	= 7, /* 33.6 MHz */
9144486b48SLuciano Coelho };
9244486b48SLuciano Coelho 
9344486b48SLuciano Coelho struct wl12xx_clock {
9444486b48SLuciano Coelho 	u32	freq;
9544486b48SLuciano Coelho 	bool	xtal;
9644486b48SLuciano Coelho 	u8	hw_idx;
9744486b48SLuciano Coelho };
9844486b48SLuciano Coelho 
9975fb4df7SEliad Peller struct wl12xx_fw_packet_counters {
10075fb4df7SEliad Peller 	/* Cumulative counter of released packets per AC */
10175fb4df7SEliad Peller 	u8 tx_released_pkts[NUM_TX_QUEUES];
10275fb4df7SEliad Peller 
10375fb4df7SEliad Peller 	/* Cumulative counter of freed packets per HLID */
10475fb4df7SEliad Peller 	u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS];
10575fb4df7SEliad Peller 
10675fb4df7SEliad Peller 	/* Cumulative counter of released Voice memory blocks */
10775fb4df7SEliad Peller 	u8 tx_voice_released_blks;
10875fb4df7SEliad Peller 
10975fb4df7SEliad Peller 	/* Tx rate of the last transmitted packet */
11075fb4df7SEliad Peller 	u8 tx_last_rate;
11175fb4df7SEliad Peller 
11275fb4df7SEliad Peller 	u8 padding[2];
11375fb4df7SEliad Peller } __packed;
11475fb4df7SEliad Peller 
11575fb4df7SEliad Peller /* FW status registers */
11675fb4df7SEliad Peller struct wl12xx_fw_status {
11775fb4df7SEliad Peller 	__le32 intr;
11875fb4df7SEliad Peller 	u8  fw_rx_counter;
11975fb4df7SEliad Peller 	u8  drv_rx_counter;
12075fb4df7SEliad Peller 	u8  reserved;
12175fb4df7SEliad Peller 	u8  tx_results_counter;
12275fb4df7SEliad Peller 	__le32 rx_pkt_descs[WL12XX_NUM_RX_DESCRIPTORS];
12375fb4df7SEliad Peller 
12475fb4df7SEliad Peller 	__le32 fw_localtime;
12575fb4df7SEliad Peller 
12675fb4df7SEliad Peller 	/*
12775fb4df7SEliad Peller 	 * A bitmap (where each bit represents a single HLID)
12875fb4df7SEliad Peller 	 * to indicate if the station is in PS mode.
12975fb4df7SEliad Peller 	 */
13075fb4df7SEliad Peller 	__le32 link_ps_bitmap;
13175fb4df7SEliad Peller 
13275fb4df7SEliad Peller 	/*
13375fb4df7SEliad Peller 	 * A bitmap (where each bit represents a single HLID) to indicate
13475fb4df7SEliad Peller 	 * if the station is in Fast mode
13575fb4df7SEliad Peller 	 */
13675fb4df7SEliad Peller 	__le32 link_fast_bitmap;
13775fb4df7SEliad Peller 
13875fb4df7SEliad Peller 	/* Cumulative counter of total released mem blocks since FW-reset */
13975fb4df7SEliad Peller 	__le32 total_released_blks;
14075fb4df7SEliad Peller 
14175fb4df7SEliad Peller 	/* Size (in Memory Blocks) of TX pool */
14275fb4df7SEliad Peller 	__le32 tx_total;
14375fb4df7SEliad Peller 
14475fb4df7SEliad Peller 	struct wl12xx_fw_packet_counters counters;
14575fb4df7SEliad Peller 
14675fb4df7SEliad Peller 	__le32 log_start_addr;
14775fb4df7SEliad Peller } __packed;
14875fb4df7SEliad Peller 
149166b2136SLuciano Coelho #endif /* __WL12XX_PRIV_H__ */
150