[kernel] update to 2.6.25.19, and refresh patches
[openwrt.git] / package / b43 / patches / 002-ssb-backport.patch
1 Index: b43/dma.c
2 ===================================================================
3 --- b43.orig/dma.c 2008-07-27 13:56:25.000000000 +0200
4 +++ b43/dma.c 2008-07-27 14:02:26.000000000 +0200
5 @@ -328,11 +328,11 @@ static inline
6 dma_addr_t dmaaddr;
7
8 if (tx) {
9 - dmaaddr = ssb_dma_map_single(ring->dev->dev,
10 - buf, len, DMA_TO_DEVICE);
11 + dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
12 + buf, len, DMA_TO_DEVICE);
13 } else {
14 - dmaaddr = ssb_dma_map_single(ring->dev->dev,
15 - buf, len, DMA_FROM_DEVICE);
16 + dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
17 + buf, len, DMA_FROM_DEVICE);
18 }
19
20 return dmaaddr;
21 @@ -343,11 +343,11 @@ static inline
22 dma_addr_t addr, size_t len, int tx)
23 {
24 if (tx) {
25 - ssb_dma_unmap_single(ring->dev->dev,
26 - addr, len, DMA_TO_DEVICE);
27 + dma_unmap_single(ring->dev->dev->dma_dev,
28 + addr, len, DMA_TO_DEVICE);
29 } else {
30 - ssb_dma_unmap_single(ring->dev->dev,
31 - addr, len, DMA_FROM_DEVICE);
32 + dma_unmap_single(ring->dev->dev->dma_dev,
33 + addr, len, DMA_FROM_DEVICE);
34 }
35 }
36
37 @@ -356,8 +356,8 @@ static inline
38 dma_addr_t addr, size_t len)
39 {
40 B43_WARN_ON(ring->tx);
41 - ssb_dma_sync_single_for_cpu(ring->dev->dev,
42 - addr, len, DMA_FROM_DEVICE);
43 + dma_sync_single_for_cpu(ring->dev->dev->dma_dev,
44 + addr, len, DMA_FROM_DEVICE);
45 }
46
47 static inline
48 @@ -365,8 +365,8 @@ static inline
49 dma_addr_t addr, size_t len)
50 {
51 B43_WARN_ON(ring->tx);
52 - ssb_dma_sync_single_for_device(ring->dev->dev,
53 - addr, len, DMA_FROM_DEVICE);
54 + dma_sync_single_for_device(ring->dev->dev->dma_dev,
55 + addr, len, DMA_FROM_DEVICE);
56 }
57
58 static inline
59 @@ -381,6 +381,7 @@ static inline
60
61 static int alloc_ringmemory(struct b43_dmaring *ring)
62 {
63 + struct device *dma_dev = ring->dev->dev->dma_dev;
64 gfp_t flags = GFP_KERNEL;
65
66 /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
67 @@ -391,14 +392,11 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
68 * For unknown reasons - possibly a hardware error - the BCM4311 rev
69 * 02, which uses 64-bit DMA, needs the ring buffer in very low memory,
70 * which accounts for the GFP_DMA flag below.
71 - *
72 - * The flags here must match the flags in free_ringmemory below!
73 */
74 if (ring->type == B43_DMA_64BIT)
75 flags |= GFP_DMA;
76 - ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev,
77 - B43_DMA_RINGMEMSIZE,
78 - &(ring->dmabase), flags);
79 + ring->descbase = dma_alloc_coherent(dma_dev, B43_DMA_RINGMEMSIZE,
80 + &(ring->dmabase), flags);
81 if (!ring->descbase) {
82 b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
83 return -ENOMEM;
84 @@ -410,13 +408,10 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
85
86 static void free_ringmemory(struct b43_dmaring *ring)
87 {
88 - gfp_t flags = GFP_KERNEL;
89 -
90 - if (ring->type == B43_DMA_64BIT)
91 - flags |= GFP_DMA;
92 + struct device *dma_dev = ring->dev->dev->dma_dev;
93
94 - ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE,
95 - ring->descbase, ring->dmabase, flags);
96 + dma_free_coherent(dma_dev, B43_DMA_RINGMEMSIZE,
97 + ring->descbase, ring->dmabase);
98 }
99
100 /* Reset the RX DMA channel */
101 @@ -523,7 +518,7 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring,
102 dma_addr_t addr,
103 size_t buffersize, bool dma_to_device)
104 {
105 - if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr)))
106 + if (unlikely(dma_mapping_error(addr)))
107 return 1;
108
109 switch (ring->type) {
110 @@ -849,10 +844,10 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
111 goto err_kfree_meta;
112
113 /* test for ability to dma to txhdr_cache */
114 - dma_test = ssb_dma_map_single(dev->dev,
115 - ring->txhdr_cache,
116 - b43_txhdr_size(dev),
117 - DMA_TO_DEVICE);
118 + dma_test = dma_map_single(dev->dev->dma_dev,
119 + ring->txhdr_cache,
120 + b43_txhdr_size(dev),
121 + DMA_TO_DEVICE);
122
123 if (b43_dma_mapping_error(ring, dma_test,
124 b43_txhdr_size(dev), 1)) {
125 @@ -864,10 +859,10 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
126 if (!ring->txhdr_cache)
127 goto err_kfree_meta;
128
129 - dma_test = ssb_dma_map_single(dev->dev,
130 - ring->txhdr_cache,
131 - b43_txhdr_size(dev),
132 - DMA_TO_DEVICE);
133 + dma_test = dma_map_single(dev->dev->dma_dev,
134 + ring->txhdr_cache,
135 + b43_txhdr_size(dev),
136 + DMA_TO_DEVICE);
137
138 if (b43_dma_mapping_error(ring, dma_test,
139 b43_txhdr_size(dev), 1)) {
140 @@ -878,9 +873,9 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
141 }
142 }
143
144 - ssb_dma_unmap_single(dev->dev,
145 - dma_test, b43_txhdr_size(dev),
146 - DMA_TO_DEVICE);
147 + dma_unmap_single(dev->dev->dma_dev,
148 + dma_test, b43_txhdr_size(dev),
149 + DMA_TO_DEVICE);
150 }
151
152 err = alloc_ringmemory(ring);
This page took 0.048293 seconds and 5 git commands to generate.