update madwifi SoC support patch, add device ids for 2317 (will be functional after...
[openwrt.git] / package / madwifi / patches / 109-soc_platform.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-22 03:57:28.000000000 +0100
3 +++ madwifi.dev/ath/if_ath_ahb.c 2006-12-22 04:09:48.000000000 +0100
4 @@ -17,6 +17,9 @@
5 #include <linux/if.h>
6 #include <linux/netdevice.h>
7 #include <linux/cache.h>
8 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
9 +#include <linux/platform_device.h>
10 +#endif
11
12 #include <asm/io.h>
13 #include <asm/uaccess.h>
14 @@ -39,6 +42,7 @@
15 static struct ath_ahb_softc *sclist[2] = {NULL, NULL};
16 static u_int8_t num_activesc = 0;
17
18 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
19 static struct ar531x_boarddata *ar5312_boardConfig = NULL;
20 static char *radioConfig = NULL;
21
22 @@ -136,6 +140,8 @@
23 data[i] = eepromAddr[off];
24 }
25
26 +#endif
27 +
28 /* set bus cachesize in 4B word units */
29 void
30 bus_read_cachesize(struct ath_softc *sc, u_int8_t *csz)
31 @@ -180,7 +186,8 @@
32 u_int32_t reset;
33 u_int32_t enable;
34
35 - if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
36 + if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
37 + ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ)) {
38 u_int32_t reg;
39 u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
40
41 @@ -241,7 +248,8 @@
42 ahb_disable_wmac(u_int16_t devid, u_int16_t wlanNum)
43 {
44 u_int32_t enable;
45 - if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
46 + if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
47 + ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ)) {
48 u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
49
50 KASSERT(wlanNum == 0, ("invalid wlan # %d", wlanNum) );
51 @@ -295,7 +303,7 @@
52 }
53
54 int
55 -init_ath_wmac(u_int16_t devid, u_int16_t wlanNum)
56 +init_ath_wmac(u_int16_t devid, u_int16_t wlanNum, struct ar531x_config *config)
57 {
58 const char *athname;
59 struct net_device *dev;
60 @@ -329,7 +337,8 @@
61
62 switch (wlanNum) {
63 case AR531X_WLAN0_NUM:
64 - if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
65 + if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
66 + ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ)) {
67 dev->irq = AR5315_IRQ_WLAN0_INTRS;
68 dev->mem_start = AR5315_WLAN0;
69 } else {
70 @@ -352,12 +361,7 @@
71 goto bad3;
72 }
73
74 - struct ar531x_config config;
75 - config.board = ar5312_boardConfig;
76 - config.radio = radioConfig;
77 - config.unit = wlanNum;
78 - config.tag = NULL;
79 - if (ath_attach(devid, dev, &config) != 0)
80 + if (ath_attach(devid, dev, config) != 0)
81 goto bad4;
82 athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
83 printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
84 @@ -379,24 +383,63 @@
85 return -ENODEV;
86 }
87
88 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
89 +static int ahb_wmac_probe(struct platform_device *pdev)
90 +{
91 + u32 devid;
92 + struct ar531x_config *config;
93 +
94 + config = (struct ar531x_config *) pdev->dev.platform_data;
95 + devid = (u32) config->tag;
96 + config->tag = NULL;
97 +
98 + return init_ath_wmac((u_int16_t) devid, pdev->id, config);
99 +}
100 +
101 +
102 +static int ahb_wmac_remove(struct platform_device *pdev)
103 +{
104 + exit_ath_wmac(pdev->id);
105 +
106 + return 0;
107 +}
108 +
109 +struct platform_driver ahb_wmac_driver = {
110 + .driver.name = "ar531x-wmac",
111 + .probe = ahb_wmac_probe,
112 + .remove = ahb_wmac_remove
113 +};
114 +
115 +#else
116 +
117 int
118 init_ahb(void)
119 {
120 int ret;
121 u_int16_t devid, radioMask;
122 const char *sysType;
123 + struct ar531x_config config;
124 +
125 sysType = get_system_type();
126 +
127 + /* Probe to find out the silicon revision and enable the
128 + correct number of macs */
129 + if (!ar5312SetupFlash())
130 + return -ENODEV;
131 +
132 + config.board = ar5312_boardConfig;
133 + config.radio = radioConfig;
134 + config.unit = wlanNum;
135 + config.tag = NULL;
136 +
137 if (!strcmp(sysType,"Atheros AR5315")) {
138 devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
139 (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
140 - if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ)
141 + if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
142 + ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ))
143 return init_ath_wmac(devid, 0);
144 }
145
146 - /* Probe to find out the silicon revision and enable the
147 - correct number of macs */
148 - if (!ar5312SetupFlash())
149 - return -ENODEV;
150 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
151 (AR531X_REV_MAJ | AR531X_REV_MIN));
152 switch (devid) {
153 @@ -420,6 +463,7 @@
154 return 0;
155 }
156
157 +#endif
158
159 /*
160 * Module glue.
161 @@ -460,13 +504,19 @@
162 {
163 printk(KERN_INFO "%s: %s\n", dev_info, version);
164
165 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
166 + platform_driver_register(&ahb_wmac_driver);
167 +#else
168 if (init_ahb() != 0) {
169 printk("ath_ahb: No devices found, driver not installed.\n");
170 return (-ENODEV);
171 }
172 +#endif
173 +
174 #ifdef CONFIG_SYSCTL
175 ath_sysctl_register();
176 #endif
177 +
178 return 0;
179 }
180 module_init(init_ath_ahb);
181 @@ -477,8 +527,13 @@
182 #ifdef CONFIG_SYSCTL
183 ath_sysctl_unregister();
184 #endif
185 +
186 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
187 + platform_driver_register(&ahb_wmac_driver);
188 +#else
189 exit_ath_wmac(AR531X_WLAN0_NUM);
190 exit_ath_wmac(AR531X_WLAN1_NUM);
191 +#endif
192
193 printk(KERN_INFO "%s: driver unloaded\n", dev_info);
194 }
195 diff -ur madwifi.old/ath/if_ath_ahb.h madwifi.dev/ath/if_ath_ahb.h
196 --- madwifi.old/ath/if_ath_ahb.h 2006-12-22 03:57:28.000000000 +0100
197 +++ madwifi.dev/ath/if_ath_ahb.h 2006-12-22 04:07:47.000000000 +0100
198 @@ -59,6 +59,7 @@
199 #define AR5315_SREV 0xb1000014
200
201 #define AR5315_REV_MAJ 0x0080
202 +#define AR5317_REV_MAJ 0x0090
203 #define AR5315_REV_MAJ_M 0x00f0
204 #define AR5315_REV_MAJ_S 4
205 #define AR5315_REV_MIN_M 0x000f
206 diff -urN madwifi-0.9.2.old/ath/if_ath.c madwifi-0.9.2.dev/ath/if_ath.c
207 --- madwifi-0.9.2.old/ath/if_ath.c 2006-08-29 20:38:48.000000000 +0200
208 +++ madwifi-0.9.2.dev/ath/if_ath.c 2006-08-29 20:38:48.000000000 +0200
209 @@ -658,7 +658,10 @@
210 * 5211 minipci cards. Users can also manually enable/disable
211 * support with a sysctl.
212 */
213 - sc->sc_softled = (devid == AR5212_DEVID_IBM || devid == AR5211_DEVID);
214 + sc->sc_softled = ((devid == AR5212_DEVID_IBM) || (devid == AR5211_DEVID) ||
215 + (devid == AR5212_AR2315_REV6) || (devid == AR5212_AR2315_REV7) ||
216 + (devid == AR5212_AR2317_REV1) || (devid == AR5212_AR2317_REV2));
217 +
218 if (sc->sc_softled) {
219 ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
220 ath_hal_gpioset(ah, sc->sc_ledpin, !sc->sc_ledon);
221 diff -urN madwifi-0.9.2.old/hal/ah_devid.h madwifi-0.9.2.dev/hal/ah_devid.h
222 --- madwifi-0.9.2.old/hal/ah_devid.h 2006-02-11 13:04:39.000000000 +0100
223 +++ madwifi-0.9.2.dev/hal/ah_devid.h 2006-08-29 20:38:48.000000000 +0200
224 @@ -68,9 +68,10 @@
225 #define AR5212_AR5312_REV2 0x0052 /* AR5312 WMAC (AP31) */
226 #define AR5212_AR5312_REV7 0x0057 /* AR5312 WMAC (AP30-040) */
227 #define AR5212_AR2313_REV8 0x0058 /* AR2313 WMAC (AP43-030) */
228 -#define AR5212_AR2315_REV6 0x0086 /* AR2315 WMAC (AP51-Light) */
229 +#define AR5212_AR2315_REV6 0x0086 /* AR2315 WMAC (AP51-Lite) */
230 #define AR5212_AR2315_REV7 0x0087 /* AR2315 WMAC (AP51-Full) */
231 -#define AR5212_AR2317_REV1 0x0091 /* AR2317 WMAC (AP61) */
232 +#define AR5212_AR2317_REV1 0x0090 /* AR2317 WMAC (AP61-Lite) */
233 +#define AR5212_AR2317_REV2 0x0091 /* AR2317 WMAC (AP61-Full) */
234
235 /* AR5212 compatible devid's also attach to 5212 */
236 #define AR5212_DEVID_0014 0x0014
This page took 0.046854 seconds and 5 git commands to generate.