[mac80211] Update to compat-wireless-2009-06-02
[openwrt.git] / package / mac80211 / patches-old / 002-ssb-backport.patch
1 This patch backports the interface of the b43 and b43legacy driver from
2 the new to the old ssb API. This patch is needed as long the old ssb
3 version is used in the kernel for broadcom devices. After upgrading to
4 ssb version out of kernel 2.6.27 or later this patch is not needed any more.
5
6 --- a/drivers/net/wireless/b43/dma.c
7 +++ b/drivers/net/wireless/b43/dma.c
8 @@ -328,11 +328,11 @@ static inline
9 dma_addr_t dmaaddr;
10
11 if (tx) {
12 - dmaaddr = ssb_dma_map_single(ring->dev->dev,
13 - buf, len, DMA_TO_DEVICE);
14 + dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
15 + buf, len, DMA_TO_DEVICE);
16 } else {
17 - dmaaddr = ssb_dma_map_single(ring->dev->dev,
18 - buf, len, DMA_FROM_DEVICE);
19 + dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
20 + buf, len, DMA_FROM_DEVICE);
21 }
22
23 return dmaaddr;
24 @@ -343,11 +343,11 @@ static inline
25 dma_addr_t addr, size_t len, int tx)
26 {
27 if (tx) {
28 - ssb_dma_unmap_single(ring->dev->dev,
29 - addr, len, DMA_TO_DEVICE);
30 + dma_unmap_single(ring->dev->dev->dma_dev,
31 + addr, len, DMA_TO_DEVICE);
32 } else {
33 - ssb_dma_unmap_single(ring->dev->dev,
34 - addr, len, DMA_FROM_DEVICE);
35 + dma_unmap_single(ring->dev->dev->dma_dev,
36 + addr, len, DMA_FROM_DEVICE);
37 }
38 }
39
40 @@ -356,8 +356,8 @@ static inline
41 dma_addr_t addr, size_t len)
42 {
43 B43_WARN_ON(ring->tx);
44 - ssb_dma_sync_single_for_cpu(ring->dev->dev,
45 - addr, len, DMA_FROM_DEVICE);
46 + dma_sync_single_for_cpu(ring->dev->dev->dma_dev,
47 + addr, len, DMA_FROM_DEVICE);
48 }
49
50 static inline
51 @@ -365,8 +365,8 @@ static inline
52 dma_addr_t addr, size_t len)
53 {
54 B43_WARN_ON(ring->tx);
55 - ssb_dma_sync_single_for_device(ring->dev->dev,
56 - addr, len, DMA_FROM_DEVICE);
57 + dma_sync_single_for_device(ring->dev->dev->dma_dev,
58 + addr, len, DMA_FROM_DEVICE);
59 }
60
61 static inline
62 @@ -381,6 +381,7 @@ static inline
63
64 static int alloc_ringmemory(struct b43_dmaring *ring)
65 {
66 + struct device *dma_dev = ring->dev->dev->dma_dev;
67 gfp_t flags = GFP_KERNEL;
68
69 /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
70 @@ -391,14 +392,11 @@ static int alloc_ringmemory(struct b43_d
71 * For unknown reasons - possibly a hardware error - the BCM4311 rev
72 * 02, which uses 64-bit DMA, needs the ring buffer in very low memory,
73 * which accounts for the GFP_DMA flag below.
74 - *
75 - * The flags here must match the flags in free_ringmemory below!
76 */
77 if (ring->type == B43_DMA_64BIT)
78 flags |= GFP_DMA;
79 - ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev,
80 - B43_DMA_RINGMEMSIZE,
81 - &(ring->dmabase), flags);
82 + ring->descbase = dma_alloc_coherent(dma_dev, B43_DMA_RINGMEMSIZE,
83 + &(ring->dmabase), flags);
84 if (!ring->descbase) {
85 b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
86 return -ENOMEM;
87 @@ -410,13 +408,10 @@ static int alloc_ringmemory(struct b43_d
88
89 static void free_ringmemory(struct b43_dmaring *ring)
90 {
91 - gfp_t flags = GFP_KERNEL;
92 -
93 - if (ring->type == B43_DMA_64BIT)
94 - flags |= GFP_DMA;
95 + struct device *dma_dev = ring->dev->dev->dma_dev;
96
97 - ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE,
98 - ring->descbase, ring->dmabase, flags);
99 + dma_free_coherent(dma_dev, B43_DMA_RINGMEMSIZE,
100 + ring->descbase, ring->dmabase);
101 }
102
103 /* Reset the RX DMA channel */
104 @@ -523,7 +518,7 @@ static bool b43_dma_mapping_error(struct
105 dma_addr_t addr,
106 size_t buffersize, bool dma_to_device)
107 {
108 - if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr)))
109 + if (unlikely(dma_mapping_error(addr)))
110 return 1;
111
112 switch (ring->type) {
113 @@ -849,10 +844,10 @@ struct b43_dmaring *b43_setup_dmaring(st
114 goto err_kfree_meta;
115
116 /* test for ability to dma to txhdr_cache */
117 - dma_test = ssb_dma_map_single(dev->dev,
118 - ring->txhdr_cache,
119 - b43_txhdr_size(dev),
120 - DMA_TO_DEVICE);
121 + dma_test = dma_map_single(dev->dev->dma_dev,
122 + ring->txhdr_cache,
123 + b43_txhdr_size(dev),
124 + DMA_TO_DEVICE);
125
126 if (b43_dma_mapping_error(ring, dma_test,
127 b43_txhdr_size(dev), 1)) {
128 @@ -864,10 +859,10 @@ struct b43_dmaring *b43_setup_dmaring(st
129 if (!ring->txhdr_cache)
130 goto err_kfree_meta;
131
132 - dma_test = ssb_dma_map_single(dev->dev,
133 - ring->txhdr_cache,
134 - b43_txhdr_size(dev),
135 - DMA_TO_DEVICE);
136 + dma_test = dma_map_single(dev->dev->dma_dev,
137 + ring->txhdr_cache,
138 + b43_txhdr_size(dev),
139 + DMA_TO_DEVICE);
140
141 if (b43_dma_mapping_error(ring, dma_test,
142 b43_txhdr_size(dev), 1)) {
143 @@ -878,9 +873,9 @@ struct b43_dmaring *b43_setup_dmaring(st
144 }
145 }
146
147 - ssb_dma_unmap_single(dev->dev,
148 - dma_test, b43_txhdr_size(dev),
149 - DMA_TO_DEVICE);
150 + dma_unmap_single(dev->dev->dma_dev,
151 + dma_test, b43_txhdr_size(dev),
152 + DMA_TO_DEVICE);
153 }
154
155 err = alloc_ringmemory(ring);
156 --- a/drivers/net/wireless/b43legacy/dma.c
157 +++ b/drivers/net/wireless/b43legacy/dma.c
158 @@ -393,13 +393,13 @@ dma_addr_t map_descbuffer(struct b43lega
159 dma_addr_t dmaaddr;
160
161 if (tx)
162 - dmaaddr = ssb_dma_map_single(ring->dev->dev,
163 - buf, len,
164 - DMA_TO_DEVICE);
165 + dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
166 + buf, len,
167 + DMA_TO_DEVICE);
168 else
169 - dmaaddr = ssb_dma_map_single(ring->dev->dev,
170 - buf, len,
171 - DMA_FROM_DEVICE);
172 + dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
173 + buf, len,
174 + DMA_FROM_DEVICE);
175
176 return dmaaddr;
177 }
178 @@ -411,13 +411,13 @@ void unmap_descbuffer(struct b43legacy_d
179 int tx)
180 {
181 if (tx)
182 - ssb_dma_unmap_single(ring->dev->dev,
183 - addr, len,
184 - DMA_TO_DEVICE);
185 + dma_unmap_single(ring->dev->dev->dma_dev,
186 + addr, len,
187 + DMA_TO_DEVICE);
188 else
189 - ssb_dma_unmap_single(ring->dev->dev,
190 - addr, len,
191 - DMA_FROM_DEVICE);
192 + dma_unmap_single(ring->dev->dev->dma_dev,
193 + addr, len,
194 + DMA_FROM_DEVICE);
195 }
196
197 static inline
198 @@ -427,8 +427,8 @@ void sync_descbuffer_for_cpu(struct b43l
199 {
200 B43legacy_WARN_ON(ring->tx);
201
202 - ssb_dma_sync_single_for_cpu(ring->dev->dev,
203 - addr, len, DMA_FROM_DEVICE);
204 + dma_sync_single_for_cpu(ring->dev->dev->dma_dev,
205 + addr, len, DMA_FROM_DEVICE);
206 }
207
208 static inline
209 @@ -438,8 +438,8 @@ void sync_descbuffer_for_device(struct b
210 {
211 B43legacy_WARN_ON(ring->tx);
212
213 - ssb_dma_sync_single_for_device(ring->dev->dev,
214 - addr, len, DMA_FROM_DEVICE);
215 + dma_sync_single_for_device(ring->dev->dev->dma_dev,
216 + addr, len, DMA_FROM_DEVICE);
217 }
218
219 static inline
220 @@ -458,11 +458,10 @@ void free_descriptor_buffer(struct b43le
221
222 static int alloc_ringmemory(struct b43legacy_dmaring *ring)
223 {
224 - /* GFP flags must match the flags in free_ringmemory()! */
225 - ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev,
226 - B43legacy_DMA_RINGMEMSIZE,
227 - &(ring->dmabase),
228 - GFP_KERNEL);
229 + struct device *dma_dev = ring->dev->dev->dma_dev;
230 +
231 + ring->descbase = dma_alloc_coherent(dma_dev, B43legacy_DMA_RINGMEMSIZE,
232 + &(ring->dmabase), GFP_KERNEL);
233 if (!ring->descbase) {
234 b43legacyerr(ring->dev->wl, "DMA ringmemory allocation"
235 " failed\n");
236 @@ -475,8 +474,10 @@ static int alloc_ringmemory(struct b43le
237
238 static void free_ringmemory(struct b43legacy_dmaring *ring)
239 {
240 - ssb_dma_free_consistent(ring->dev->dev, B43legacy_DMA_RINGMEMSIZE,
241 - ring->descbase, ring->dmabase, GFP_KERNEL);
242 + struct device *dma_dev = ring->dev->dev->dma_dev;
243 +
244 + dma_free_coherent(dma_dev, B43legacy_DMA_RINGMEMSIZE,
245 + ring->descbase, ring->dmabase);
246 }
247
248 /* Reset the RX DMA channel */
249 @@ -588,7 +589,7 @@ static bool b43legacy_dma_mapping_error(
250 size_t buffersize,
251 bool dma_to_device)
252 {
253 - if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr)))
254 + if (unlikely(dma_mapping_error(addr)))
255 return 1;
256
257 switch (ring->type) {
258 @@ -905,9 +906,9 @@ struct b43legacy_dmaring *b43legacy_setu
259 goto err_kfree_meta;
260
261 /* test for ability to dma to txhdr_cache */
262 - dma_test = ssb_dma_map_single(dev->dev, ring->txhdr_cache,
263 - sizeof(struct b43legacy_txhdr_fw3),
264 - DMA_TO_DEVICE);
265 + dma_test = dma_map_single(dev->dev->dma_dev, ring->txhdr_cache,
266 + sizeof(struct b43legacy_txhdr_fw3),
267 + DMA_TO_DEVICE);
268
269 if (b43legacy_dma_mapping_error(ring, dma_test,
270 sizeof(struct b43legacy_txhdr_fw3), 1)) {
271 @@ -919,7 +920,7 @@ struct b43legacy_dmaring *b43legacy_setu
272 if (!ring->txhdr_cache)
273 goto err_kfree_meta;
274
275 - dma_test = ssb_dma_map_single(dev->dev,
276 + dma_test = dma_map_single(dev->dev->dma_dev,
277 ring->txhdr_cache,
278 sizeof(struct b43legacy_txhdr_fw3),
279 DMA_TO_DEVICE);
280 @@ -929,9 +930,9 @@ struct b43legacy_dmaring *b43legacy_setu
281 goto err_kfree_txhdr_cache;
282 }
283
284 - ssb_dma_unmap_single(dev->dev, dma_test,
285 - sizeof(struct b43legacy_txhdr_fw3),
286 - DMA_TO_DEVICE);
287 + dma_unmap_single(dev->dev->dma_dev,
288 + dma_test, sizeof(struct b43legacy_txhdr_fw3),
289 + DMA_TO_DEVICE);
290 }
291
292 ring->nr_slots = nr_slots;
This page took 0.054134 seconds and 5 git commands to generate.