Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / ti / wl18xx / wl18xx.h
1 /*
2  * This file is part of wl18xx
3  *
4  * Copyright (C) 2011 Texas Instruments Inc.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * version 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18  * 02110-1301 USA
19  *
20  */
21
22 #ifndef __WL18XX_PRIV_H__
23 #define __WL18XX_PRIV_H__
24
25 #include "conf.h"
26
27 /* minimum FW required for driver */
28 #define WL18XX_CHIP_VER         8
29 #define WL18XX_IFTYPE_VER       5
30 #define WL18XX_MAJOR_VER        WLCORE_FW_VER_IGNORE
31 #define WL18XX_SUBTYPE_VER      WLCORE_FW_VER_IGNORE
32 #define WL18XX_MINOR_VER        28
33
34 #define WL18XX_CMD_MAX_SIZE          740
35
36 #define WL18XX_AGGR_BUFFER_SIZE         (13 * PAGE_SIZE)
37
38 #define WL18XX_NUM_TX_DESCRIPTORS 32
39 #define WL18XX_NUM_RX_DESCRIPTORS 32
40
41 #define WL18XX_NUM_MAC_ADDRESSES 3
42
43 struct wl18xx_priv {
44         /* buffer for sending commands to FW */
45         u8 cmd_buf[WL18XX_CMD_MAX_SIZE];
46
47         struct wl18xx_priv_conf conf;
48
49         /* Index of last released Tx desc in FW */
50         u8 last_fw_rls_idx;
51
52         /* number of keys requiring extra spare mem-blocks */
53         int extra_spare_key_count;
54 };
55
56 #define WL18XX_FW_MAX_TX_STATUS_DESC 33
57
58 struct wl18xx_fw_status_priv {
59         /*
60          * Index in released_tx_desc for first byte that holds
61          * released tx host desc
62          */
63         u8 fw_release_idx;
64
65         /*
66          * Array of host Tx descriptors, where fw_release_idx
67          * indicated the first released idx.
68          */
69         u8 released_tx_desc[WL18XX_FW_MAX_TX_STATUS_DESC];
70
71         /* A bitmap representing the currently suspended links. The suspend
72          * is short lived, for multi-channel Tx requirements.
73          */
74         __le32 link_suspend_bitmap;
75
76         /* packet threshold for an "almost empty" AC,
77          * for Tx schedulng purposes
78          */
79         u8 tx_ac_threshold;
80
81         /* number of packets to queue up for a link in PS */
82         u8 tx_ps_threshold;
83
84         /* number of packet to queue up for a suspended link */
85         u8 tx_suspend_threshold;
86
87         /* Should have less than this number of packets in queue of a slow
88          * link to qualify as high priority link
89          */
90         u8 tx_slow_link_prio_threshold;
91
92         /* Should have less than this number of packets in queue of a fast
93          * link to qualify as high priority link
94          */
95         u8 tx_fast_link_prio_threshold;
96
97         /* Should have less than this number of packets in queue of a slow
98          * link before we stop queuing up packets for it.
99          */
100         u8 tx_slow_stop_threshold;
101
102         /* Should have less than this number of packets in queue of a fast
103          * link before we stop queuing up packets for it.
104          */
105         u8 tx_fast_stop_threshold;
106
107         u8 padding[3];
108 };
109
110 #define WL18XX_PHY_VERSION_MAX_LEN 20
111
112 struct wl18xx_static_data_priv {
113         char phy_version[WL18XX_PHY_VERSION_MAX_LEN];
114 };
115
116 struct wl18xx_clk_cfg {
117         u32 n;
118         u32 m;
119         u32 p;
120         u32 q;
121         bool swallow;
122 };
123
124 enum {
125         CLOCK_CONFIG_16_2_M     = 1,
126         CLOCK_CONFIG_16_368_M,
127         CLOCK_CONFIG_16_8_M,
128         CLOCK_CONFIG_19_2_M,
129         CLOCK_CONFIG_26_M,
130         CLOCK_CONFIG_32_736_M,
131         CLOCK_CONFIG_33_6_M,
132         CLOCK_CONFIG_38_468_M,
133         CLOCK_CONFIG_52_M,
134
135         NUM_CLOCK_CONFIGS,
136 };
137
138 #endif /* __WL18XX_PRIV_H__ */