fix iptables extension issue with mac os x builds
[openwrt.git] / package / madwifi / patches / 108-soc_init_r1714.patch
1 diff -ur madwifi.old/ath/if_ath_ahb.c madwifi.dev/ath/if_ath_ahb.c
2 --- madwifi.old/ath/if_ath_ahb.c 2006-12-16 00:56:39.000000000 +0100
3 +++ madwifi.dev/ath/if_ath_ahb.c 2006-12-16 00:57:08.000000000 +0100
4 @@ -27,6 +27,7 @@
5 #include "if_athvar.h"
6 #include "ah_devid.h"
7 #include "if_ath_ahb.h"
8 +#include "ah_soc.h"
9
10 struct ath_ahb_softc {
11 struct ath_softc aps_sc;
12 @@ -176,6 +177,9 @@
13 int
14 ahb_enable_wmac(u_int16_t devid, u_int16_t wlanNum)
15 {
16 + u_int32_t reset;
17 + u_int32_t enable;
18 +
19 if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
20 u_int32_t reg;
21 u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
22 @@ -203,17 +207,32 @@
23 /* wait for the MAC to wakeup */
24 while (REG_READ(AR5315_PCI_MAC_PCICFG) & AR5315_PCI_MAC_PCICFG_SPWR_DN);
25 } else {
26 - u_int32_t *en = (u_int32_t *)AR531X_ENABLE;
27 switch (wlanNum) {
28 case AR531X_WLAN0_NUM:
29 - *en |= AR531X_ENABLE_WLAN0;
30 + reset = (AR531X_RESET_WLAN0 |
31 + AR531X_RESET_WARM_WLAN0_MAC |
32 + AR531X_RESET_WARM_WLAN0_BB);
33 + enable = AR531X_ENABLE_WLAN0;
34 break;
35 case AR531X_WLAN1_NUM:
36 - *en |= AR531X_ENABLE_WLAN1;
37 + reset = (AR531X_RESET_WLAN1 |
38 + AR531X_RESET_WARM_WLAN1_MAC |
39 + AR531X_RESET_WARM_WLAN1_BB);
40 + enable = AR531X_ENABLE_WLAN1;
41 break;
42 default:
43 return -ENODEV;
44 }
45 + /* reset the MAC or suffer lots of AHB PROC errors */
46 + REG_WRITE(AR531X_RESETCTL, REG_READ(AR531X_RESETCTL) | reset);
47 + mdelay(15);
48 +
49 + /* take it out of reset */
50 + REG_WRITE(AR531X_RESETCTL, REG_READ(AR531X_RESETCTL) & ~reset);
51 + udelay(25);
52 +
53 + /* enable it */
54 + REG_WRITE(AR531X_ENABLE, REG_READ(AR531X_ENABLE) | enable);
55 }
56 return 0;
57 }
58 @@ -221,6 +240,7 @@
59 int
60 ahb_disable_wmac(u_int16_t devid, u_int16_t wlanNum)
61 {
62 + u_int32_t enable;
63 if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
64 u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
65
66 @@ -229,17 +249,17 @@
67 /* Enable Arbitration for WLAN */
68 *en &= ~AR5315_ARB_WLAN;
69 } else {
70 - u_int32_t *en = (u_int32_t *)AR531X_ENABLE;
71 switch (wlanNum) {
72 case AR531X_WLAN0_NUM:
73 - *en &= ~AR531X_ENABLE_WLAN0;
74 + enable = AR531X_ENABLE_WLAN0;
75 break;
76 case AR531X_WLAN1_NUM:
77 - *en &= ~AR531X_ENABLE_WLAN1;
78 + enable = AR531X_ENABLE_WLAN1;
79 break;
80 default:
81 return -ENODEV;
82 }
83 + REG_WRITE(AR531X_ENABLE, REG_READ(AR531X_ENABLE) & ~enable);
84 }
85 return 0;
86 }
87 @@ -326,13 +346,18 @@
88 }
89 dev->mem_end = dev->mem_start + AR531X_WLANX_LEN;
90 sc->aps_sc.sc_bdev = NULL;
91 -
92 +
93 if (request_irq(dev->irq, ath_intr, SA_SHIRQ, dev->name, dev)) {
94 printk(KERN_WARNING "%s: request_irq failed\n", dev->name);
95 goto bad3;
96 }
97 -
98 - if (ath_attach(devid, dev) != 0)
99 +
100 + struct ar531x_config config;
101 + config.board = ar5312_boardConfig;
102 + config.radio = radioConfig;
103 + config.unit = wlanNum;
104 + config.tag = NULL;
105 + if (ath_attach(devid, dev, &config) != 0)
106 goto bad4;
107 athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
108 printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
109 diff -ur madwifi.old/ath/if_ath_ahb.h madwifi.dev/ath/if_ath_ahb.h
110 --- madwifi.old/ath/if_ath_ahb.h 2006-12-16 00:56:39.000000000 +0100
111 +++ madwifi.dev/ath/if_ath_ahb.h 2006-12-16 00:57:08.000000000 +0100
112 @@ -10,6 +10,7 @@
113
114 #include <asm/io.h>
115 #include <asm/uaccess.h>
116 +
117 #define AR531X_WLAN0_NUM 0
118 #define AR531X_WLAN1_NUM 1
119
120 @@ -70,9 +71,18 @@
121 #define AR531X_WLAN1 0xb8500000
122 #define AR531X_WLANX_LEN 0x000ffffc
123
124 +#define AR531X_RESETCTL 0xbc003020
125 +#define AR531X_RESET_WLAN0 0x00000004 /* mac & bb */
126 +#define AR531X_RESET_WLAN1 0x00000200 /* mac & bb */
127 +#define AR531X_RESET_WARM_WLAN0_MAC 0x00002000
128 +#define AR531X_RESET_WARM_WLAN0_BB 0x00004000
129 +#define AR531X_RESET_WARM_WLAN1_MAC 0x00020000
130 +#define AR531X_RESET_WARM_WLAN1_BB 0x00040000
131 +
132 #define AR531X_ENABLE 0xbc003080
133 -#define AR531X_ENABLE_WLAN1 0x8
134 -#define AR531X_ENABLE_WLAN0 0x1
135 +#define AR531X_ENABLE_WLAN0 0x0001
136 +#define AR531X_ENABLE_WLAN1 0x0018 /* both DMA and PIO */
137 +
138 #define AR531X_RADIO_MASK_OFF 0xc8
139 #define AR531X_RADIO0_MASK 0x0003
140 #define AR531X_RADIO1_MASK 0x000c
141 diff -ur madwifi.old/ath/if_ath.c madwifi.dev/ath/if_ath.c
142 --- madwifi.old/ath/if_ath.c 2006-12-16 00:56:39.000000000 +0100
143 +++ madwifi.dev/ath/if_ath.c 2006-12-16 00:57:08.000000000 +0100
144 @@ -380,7 +380,7 @@
145 } while(0)
146
147 int
148 -ath_attach(u_int16_t devid, struct net_device *dev)
149 +ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
150 {
151 struct ath_softc *sc = dev->priv;
152 struct ieee80211com *ic = &sc->sc_ic;
153 @@ -421,7 +421,7 @@
154 * built with an ah.h that does not correspond to the hal
155 * module loaded in the kernel.
156 */
157 - ah = _ath_hal_attach(devid, sc, NULL, (void *) dev->mem_start, &status);
158 + ah = _ath_hal_attach(devid, sc, tag, (void *) dev->mem_start, &status);
159 if (ah == NULL) {
160 printk(KERN_ERR "%s: unable to attach hardware: '%s' (HAL status %u)\n",
161 dev->name, ath_get_hal_status_desc(status), status);
162 diff -ur madwifi.old/ath/if_ath_pci.c madwifi.dev/ath/if_ath_pci.c
163 --- madwifi.old/ath/if_ath_pci.c 2006-12-16 00:56:39.000000000 +0100
164 +++ madwifi.dev/ath/if_ath_pci.c 2006-12-16 00:57:08.000000000 +0100
165 @@ -218,7 +218,7 @@
166 break;
167 }
168 }
169 - if (ath_attach(vdevice, dev) != 0)
170 + if (ath_attach(vdevice, dev, NULL) != 0)
171 goto bad4;
172
173 athname = ath_hal_probe(id->vendor, vdevice);
174 diff -ur madwifi.old/ath/if_athvar.h madwifi.dev/ath/if_athvar.h
175 --- madwifi.old/ath/if_athvar.h 2006-12-16 00:56:39.000000000 +0100
176 +++ madwifi.dev/ath/if_athvar.h 2006-12-16 00:57:08.000000000 +0100
177 @@ -681,7 +681,7 @@
178 #define ATH_LOCK(_sc) down(&(_sc)->sc_lock)
179 #define ATH_UNLOCK(_sc) up(&(_sc)->sc_lock)
180
181 -int ath_attach(u_int16_t, struct net_device *);
182 +int ath_attach(u_int16_t, struct net_device *, HAL_BUS_TAG);
183 int ath_detach(struct net_device *);
184 void ath_resume(struct net_device *);
185 void ath_suspend(struct net_device *);
186 diff -ur madwifi.old/THANKS madwifi.dev/THANKS
187 --- madwifi.old/THANKS 2006-12-16 00:56:39.000000000 +0100
188 +++ madwifi.dev/THANKS 2006-12-16 00:58:33.000000000 +0100
189 @@ -102,6 +102,7 @@
190 Joe Parks
191 Pavel Novak
192 Wade Mealing
193 +Mats Hojlund
194
195 Apologies to anyone whose name was unintentionally left off.
196 Please let us know if you think your name should be mentioned here!
This page took 0.057929 seconds and 5 git commands to generate.