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