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.
6 --- a/drivers/net/wireless/b43/dma.c
7 +++ b/drivers/net/wireless/b43/dma.c
8 @@ -328,11 +328,11 @@ static inline
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);
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);
24 @@ -343,11 +343,11 @@ static inline
25 dma_addr_t addr, size_t len, int 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);
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);
40 @@ -356,8 +356,8 @@ static inline
41 dma_addr_t addr, size_t len)
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);
51 @@ -365,8 +365,8 @@ static inline
52 dma_addr_t addr, size_t len)
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);
62 @@ -381,6 +381,7 @@ static inline
64 static int alloc_ringmemory(struct b43_dmaring *ring)
66 + struct device *dma_dev = ring->dev->dev->dma_dev;
67 gfp_t flags = GFP_KERNEL;
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.
75 - * The flags here must match the flags in free_ringmemory below!
77 if (ring->type == B43_DMA_64BIT)
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");
87 @@ -410,13 +408,10 @@ static int alloc_ringmemory(struct b43_d
89 static void free_ringmemory(struct b43_dmaring *ring)
91 - gfp_t flags = GFP_KERNEL;
93 - if (ring->type == B43_DMA_64BIT)
95 + struct device *dma_dev = ring->dev->dev->dma_dev;
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);
103 /* Reset the RX DMA channel */
104 @@ -523,7 +518,7 @@ static bool b43_dma_mapping_error(struct
106 size_t buffersize, bool dma_to_device)
108 - if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr)))
109 + if (unlikely(dma_mapping_error(addr)))
112 switch (ring->type) {
113 @@ -849,10 +844,10 @@ struct b43_dmaring *b43_setup_dmaring(st
116 /* test for ability to dma to txhdr_cache */
117 - dma_test = ssb_dma_map_single(dev->dev,
119 - b43_txhdr_size(dev),
121 + dma_test = dma_map_single(dev->dev->dma_dev,
123 + b43_txhdr_size(dev),
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)
132 - dma_test = ssb_dma_map_single(dev->dev,
134 - b43_txhdr_size(dev),
136 + dma_test = dma_map_single(dev->dev->dma_dev,
138 + b43_txhdr_size(dev),
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
147 - ssb_dma_unmap_single(dev->dev,
148 - dma_test, b43_txhdr_size(dev),
150 + dma_unmap_single(dev->dev->dma_dev,
151 + dma_test, b43_txhdr_size(dev),
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
162 - dmaaddr = ssb_dma_map_single(ring->dev->dev,
165 + dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
169 - dmaaddr = ssb_dma_map_single(ring->dev->dev,
172 + dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
178 @@ -411,13 +411,13 @@ void unmap_descbuffer(struct b43legacy_d
182 - ssb_dma_unmap_single(ring->dev->dev,
185 + dma_unmap_single(ring->dev->dev->dma_dev,
189 - ssb_dma_unmap_single(ring->dev->dev,
192 + dma_unmap_single(ring->dev->dev->dma_dev,
198 @@ -427,8 +427,8 @@ void sync_descbuffer_for_cpu(struct b43l
200 B43legacy_WARN_ON(ring->tx);
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);
209 @@ -438,8 +438,8 @@ void sync_descbuffer_for_device(struct b
211 B43legacy_WARN_ON(ring->tx);
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);
220 @@ -458,11 +458,10 @@ void free_descriptor_buffer(struct b43le
222 static int alloc_ringmemory(struct b43legacy_dmaring *ring)
224 - /* GFP flags must match the flags in free_ringmemory()! */
225 - ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev,
226 - B43legacy_DMA_RINGMEMSIZE,
229 + struct device *dma_dev = ring->dev->dev->dma_dev;
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"
236 @@ -475,8 +474,10 @@ static int alloc_ringmemory(struct b43le
238 static void free_ringmemory(struct b43legacy_dmaring *ring)
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;
244 + dma_free_coherent(dma_dev, B43legacy_DMA_RINGMEMSIZE,
245 + ring->descbase, ring->dmabase);
248 /* Reset the RX DMA channel */
249 @@ -588,7 +589,7 @@ static bool b43legacy_dma_mapping_error(
253 - if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr)))
254 + if (unlikely(dma_mapping_error(addr)))
257 switch (ring->type) {
258 @@ -905,9 +906,9 @@ struct b43legacy_dmaring *b43legacy_setu
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),
265 + dma_test = dma_map_single(dev->dev->dma_dev, ring->txhdr_cache,
266 + sizeof(struct b43legacy_txhdr_fw3),
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)
275 - dma_test = ssb_dma_map_single(dev->dev,
276 + dma_test = dma_map_single(dev->dev->dma_dev,
278 sizeof(struct b43legacy_txhdr_fw3),
280 @@ -929,9 +930,9 @@ struct b43legacy_dmaring *b43legacy_setu
281 goto err_kfree_txhdr_cache;
284 - ssb_dma_unmap_single(dev->dev, dma_test,
285 - sizeof(struct b43legacy_txhdr_fw3),
287 + dma_unmap_single(dev->dev->dma_dev,
288 + dma_test, sizeof(struct b43legacy_txhdr_fw3),
292 ring->nr_slots = nr_slots;