diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-08-31 07:24:32 -0400 |
---|---|---|
committer | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-11-15 08:20:13 -0500 |
commit | f44cfaf330b911b43f0763d1932ba0b4e0e353a1 (patch) | |
tree | 8117d465e674ac2e14f9de99bbbd644871eead48 /drivers | |
parent | e94a4099adb2ec148776975bcd953a01c6bec992 (diff) |
iwlegacy: remove iwl-helpers.h
This file was already merged into common.h
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-helpers.h | 187 |
1 files changed, 0 insertions, 187 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-helpers.h b/drivers/net/wireless/iwlegacy/iwl-helpers.h deleted file mode 100644 index 2db83fc32103..000000000000 --- a/drivers/net/wireless/iwlegacy/iwl-helpers.h +++ /dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. | ||
4 | * | ||
5 | * Portions of this file are derived from the ipw3945 project, as well | ||
6 | * as portions of the ieee80211 subsystem header files. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of version 2 of the GNU General Public License as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along with | ||
18 | * this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | ||
20 | * | ||
21 | * The full GNU General Public License is included in this distribution in the | ||
22 | * file called LICENSE. | ||
23 | * | ||
24 | * Contact Information: | ||
25 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
27 | * | ||
28 | *****************************************************************************/ | ||
29 | |||
30 | #ifndef __il_helpers_h__ | ||
31 | #define __il_helpers_h__ | ||
32 | |||
33 | #include <linux/ctype.h> | ||
34 | #include <net/mac80211.h> | ||
35 | |||
36 | #include "iwl-io.h" | ||
37 | |||
38 | /** | ||
39 | * il_queue_inc_wrap - increment queue idx, wrap back to beginning | ||
40 | * @idx -- current idx | ||
41 | * @n_bd -- total number of entries in queue (must be power of 2) | ||
42 | */ | ||
43 | static inline int il_queue_inc_wrap(int idx, int n_bd) | ||
44 | { | ||
45 | return ++idx & (n_bd - 1); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * il_queue_dec_wrap - decrement queue idx, wrap back to end | ||
50 | * @idx -- current idx | ||
51 | * @n_bd -- total number of entries in queue (must be power of 2) | ||
52 | */ | ||
53 | static inline int il_queue_dec_wrap(int idx, int n_bd) | ||
54 | { | ||
55 | return --idx & (n_bd - 1); | ||
56 | } | ||
57 | |||
58 | /* TODO: Move fw_desc functions to iwl-pci.ko */ | ||
59 | static inline void il_free_fw_desc(struct pci_dev *pci_dev, | ||
60 | struct fw_desc *desc) | ||
61 | { | ||
62 | if (desc->v_addr) | ||
63 | dma_free_coherent(&pci_dev->dev, desc->len, | ||
64 | desc->v_addr, desc->p_addr); | ||
65 | desc->v_addr = NULL; | ||
66 | desc->len = 0; | ||
67 | } | ||
68 | |||
69 | static inline int il_alloc_fw_desc(struct pci_dev *pci_dev, | ||
70 | struct fw_desc *desc) | ||
71 | { | ||
72 | if (!desc->len) { | ||
73 | desc->v_addr = NULL; | ||
74 | return -EINVAL; | ||
75 | } | ||
76 | |||
77 | desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len, | ||
78 | &desc->p_addr, GFP_KERNEL); | ||
79 | return (desc->v_addr != NULL) ? 0 : -ENOMEM; | ||
80 | } | ||
81 | |||
82 | /* | ||
83 | * we have 8 bits used like this: | ||
84 | * | ||
85 | * 7 6 5 4 3 2 1 0 | ||
86 | * | | | | | | | | | ||
87 | * | | | | | | +-+-------- AC queue (0-3) | ||
88 | * | | | | | | | ||
89 | * | +-+-+-+-+------------ HW queue ID | ||
90 | * | | ||
91 | * +---------------------- unused | ||
92 | */ | ||
93 | static inline void | ||
94 | il_set_swq_id(struct il_tx_queue *txq, u8 ac, u8 hwq) | ||
95 | { | ||
96 | BUG_ON(ac > 3); /* only have 2 bits */ | ||
97 | BUG_ON(hwq > 31); /* only use 5 bits */ | ||
98 | |||
99 | txq->swq_id = (hwq << 2) | ac; | ||
100 | } | ||
101 | |||
102 | static inline void il_wake_queue(struct il_priv *il, | ||
103 | struct il_tx_queue *txq) | ||
104 | { | ||
105 | u8 queue = txq->swq_id; | ||
106 | u8 ac = queue & 3; | ||
107 | u8 hwq = (queue >> 2) & 0x1f; | ||
108 | |||
109 | if (test_and_clear_bit(hwq, il->queue_stopped)) | ||
110 | if (atomic_dec_return(&il->queue_stop_count[ac]) <= 0) | ||
111 | ieee80211_wake_queue(il->hw, ac); | ||
112 | } | ||
113 | |||
114 | static inline void il_stop_queue(struct il_priv *il, | ||
115 | struct il_tx_queue *txq) | ||
116 | { | ||
117 | u8 queue = txq->swq_id; | ||
118 | u8 ac = queue & 3; | ||
119 | u8 hwq = (queue >> 2) & 0x1f; | ||
120 | |||
121 | if (!test_and_set_bit(hwq, il->queue_stopped)) | ||
122 | if (atomic_inc_return(&il->queue_stop_count[ac]) > 0) | ||
123 | ieee80211_stop_queue(il->hw, ac); | ||
124 | } | ||
125 | |||
126 | #ifdef ieee80211_stop_queue | ||
127 | #undef ieee80211_stop_queue | ||
128 | #endif | ||
129 | |||
130 | #define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue | ||
131 | |||
132 | #ifdef ieee80211_wake_queue | ||
133 | #undef ieee80211_wake_queue | ||
134 | #endif | ||
135 | |||
136 | #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue | ||
137 | |||
138 | static inline void il_disable_interrupts(struct il_priv *il) | ||
139 | { | ||
140 | clear_bit(S_INT_ENABLED, &il->status); | ||
141 | |||
142 | /* disable interrupts from uCode/NIC to host */ | ||
143 | _il_wr(il, CSR_INT_MASK, 0x00000000); | ||
144 | |||
145 | /* acknowledge/clear/reset any interrupts still pending | ||
146 | * from uCode or flow handler (Rx/Tx DMA) */ | ||
147 | _il_wr(il, CSR_INT, 0xffffffff); | ||
148 | _il_wr(il, CSR_FH_INT_STATUS, 0xffffffff); | ||
149 | D_ISR("Disabled interrupts\n"); | ||
150 | } | ||
151 | |||
152 | static inline void il_enable_rfkill_int(struct il_priv *il) | ||
153 | { | ||
154 | D_ISR("Enabling rfkill interrupt\n"); | ||
155 | _il_wr(il, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); | ||
156 | } | ||
157 | |||
158 | static inline void il_enable_interrupts(struct il_priv *il) | ||
159 | { | ||
160 | D_ISR("Enabling interrupts\n"); | ||
161 | set_bit(S_INT_ENABLED, &il->status); | ||
162 | _il_wr(il, CSR_INT_MASK, il->inta_mask); | ||
163 | } | ||
164 | |||
165 | /** | ||
166 | * il_beacon_time_mask_low - mask of lower 32 bit of beacon time | ||
167 | * @il -- pointer to il_priv data structure | ||
168 | * @tsf_bits -- number of bits need to shift for masking) | ||
169 | */ | ||
170 | static inline u32 il_beacon_time_mask_low(struct il_priv *il, | ||
171 | u16 tsf_bits) | ||
172 | { | ||
173 | return (1 << tsf_bits) - 1; | ||
174 | } | ||
175 | |||
176 | /** | ||
177 | * il_beacon_time_mask_high - mask of higher 32 bit of beacon time | ||
178 | * @il -- pointer to il_priv data structure | ||
179 | * @tsf_bits -- number of bits need to shift for masking) | ||
180 | */ | ||
181 | static inline u32 il_beacon_time_mask_high(struct il_priv *il, | ||
182 | u16 tsf_bits) | ||
183 | { | ||
184 | return ((1 << (32 - tsf_bits)) - 1) << tsf_bits; | ||
185 | } | ||
186 | |||
187 | #endif /* __il_helpers_h__ */ | ||