update madwifi to latest trunk, include a few more fixes/improvements
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 326-soc_dma.patch
1 Index: madwifi-trunk-r3280/ath/if_ath_ahb.c
2 ===================================================================
3 --- madwifi-trunk-r3280.orig/ath/if_ath_ahb.c 2008-01-28 19:12:37.022826852 +0100
4 +++ madwifi-trunk-r3280/ath/if_ath_ahb.c 2008-01-28 19:31:09.184472483 +0100
5 @@ -69,27 +69,13 @@
6 void *
7 bus_alloc_consistent(void *hwdev, size_t size, dma_addr_t *dma_handle)
8 {
9 - void *ret;
10 -
11 - ret = (void *) __get_free_pages(GFP_ATOMIC, get_order(size));
12 -
13 - if (ret != NULL) {
14 - memset(ret, 0, size);
15 - *dma_handle = __pa(ret);
16 - dma_cache_wback_inv((unsigned long) ret, size);
17 - ret = UNCAC_ADDR(ret);
18 - }
19 -
20 - return ret;
21 + return dma_alloc_coherent(hwdev, size, dma_handle, GFP_ATOMIC);
22 }
23
24 void
25 bus_free_consistent(void *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
26 {
27 - unsigned long addr = (unsigned long) vaddr;
28 -
29 - addr = CAC_ADDR(addr);
30 - free_pages(addr, get_order(size));
31 + dma_free_coherent(hwdev, size, vaddr, dma_handle);
32 }
33
34 static int
35 Index: madwifi-trunk-r3280/ath/if_ath_ahb.h
36 ===================================================================
37 --- madwifi-trunk-r3280.orig/ath/if_ath_ahb.h 2008-01-28 19:20:06.016413537 +0100
38 +++ madwifi-trunk-r3280/ath/if_ath_ahb.h 2008-01-28 19:30:40.978865135 +0100
39 @@ -89,8 +89,8 @@
40 #define AR531X_RADIO1_MASK 0x000c
41 #define AR531X_RADIO1_S 2
42
43 -#define BUS_DMA_FROMDEVICE 0
44 -#define BUS_DMA_TODEVICE 1
45 +#define BUS_DMA_FROMDEVICE DMA_FROM_DEVICE
46 +#define BUS_DMA_TODEVICE DMA_TO_DEVICE
47
48 #define AR531X_APBBASE 0xbc000000
49 #define AR531X_RESETTMR (AR531X_APBBASE + 0x3000)
50 @@ -115,29 +115,19 @@
51 static __inline void bus_dma_sync_single(void *hwdev, dma_addr_t dma_handle,
52 size_t size, int direction)
53 {
54 - unsigned long addr;
55 -
56 - addr = (unsigned long) __va(dma_handle);
57 - dma_cache_wback_inv(addr, size);
58 + dma_sync_single(hwdev, dma_handle, size, direction);
59 }
60
61 static __inline dma_addr_t bus_map_single(void *hwdev, void *ptr,
62 size_t size, int direction)
63 {
64 - dma_cache_wback_inv((unsigned long) ptr, size);
65 -
66 - return __pa(ptr);
67 + return dma_map_single(hwdev, ptr, size, direction);
68 }
69
70 static __inline void bus_unmap_single(void *hwdev, dma_addr_t dma_addr,
71 size_t size, int direction)
72 {
73 - if (direction != BUS_DMA_TODEVICE) {
74 - unsigned long addr;
75 -
76 - addr = (unsigned long)__va(dma_addr);
77 - dma_cache_wback_inv(addr, size);
78 - }
79 + dma_unmap_single(hwdev, dma_addr, size, direction);
80 }
81 void *bus_alloc_consistent(void *, size_t, dma_addr_t *);
82 void bus_free_consistent(void *, size_t, void *, dma_addr_t);