upgrade the ixp4xx ethernet driver to v0.3.1, split the Gateway 7001 support to two...
[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 2007-02-04 04:07:15.810701232 +0100
3 +++ madwifi.dev/ath/if_ath_ahb.c 2007-02-04 04:14:02.699844680 +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 @@ -265,12 +273,12 @@
52 }
53
54
55 +
56 int
57 -exit_ath_wmac(u_int16_t wlanNum)
58 +exit_ath_wmac(u_int16_t wlanNum, struct ar531x_config *config)
59 {
60 struct ath_ahb_softc *sc = sclist[wlanNum];
61 struct net_device *dev;
62 - const char *sysType;
63 u_int16_t devid;
64
65 if (sc == NULL)
66 @@ -280,13 +288,17 @@
67 ath_detach(dev);
68 if (dev->irq)
69 free_irq(dev->irq, dev);
70 - sysType = get_system_type();
71 - if (!strcmp(sysType, "Atheros AR5315"))
72 +
73 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
74 + devid = (u32) config->tag;
75 +#else
76 + if (!strcmp(get_system_type(), "Atheros AR5315"))
77 devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
78 (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
79 else
80 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >> 8) &
81 (AR531X_REV_MAJ | AR531X_REV_MIN));
82 +#endif
83
84 ahb_disable_wmac(devid, wlanNum);
85 free_netdev(dev);
86 @@ -295,7 +307,7 @@
87 }
88
89 int
90 -init_ath_wmac(u_int16_t devid, u_int16_t wlanNum)
91 +init_ath_wmac(u_int16_t devid, u_int16_t wlanNum, struct ar531x_config *config)
92 {
93 const char *athname;
94 struct net_device *dev;
95 @@ -329,7 +341,8 @@
96
97 switch (wlanNum) {
98 case AR531X_WLAN0_NUM:
99 - if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
100 + if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
101 + ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ)) {
102 dev->irq = AR5315_IRQ_WLAN0_INTRS;
103 dev->mem_start = AR5315_WLAN0;
104 } else {
105 @@ -352,12 +365,7 @@
106 goto bad3;
107 }
108
109 - struct ar531x_config config;
110 - config.board = ar5312_boardConfig;
111 - config.radio = radioConfig;
112 - config.unit = wlanNum;
113 - config.tag = NULL;
114 - if (ath_attach(devid, dev, &config) != 0)
115 + if (ath_attach(devid, dev, config) != 0)
116 goto bad4;
117 athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
118 printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
119 @@ -379,24 +387,63 @@
120 return -ENODEV;
121 }
122
123 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
124 +static int ahb_wmac_probe(struct platform_device *pdev)
125 +{
126 + u32 devid;
127 + struct ar531x_config *config;
128 +
129 + config = (struct ar531x_config *) pdev->dev.platform_data;
130 + devid = (u32) config->tag;
131 + config->tag = NULL;
132 +
133 + return init_ath_wmac((u_int16_t) devid, pdev->id, config);
134 +}
135 +
136 +
137 +static int ahb_wmac_remove(struct platform_device *pdev)
138 +{
139 + exit_ath_wmac(pdev->id, (struct ar531x_config *) pdev->dev.platform_data);
140 +
141 + return 0;
142 +}
143 +
144 +struct platform_driver ahb_wmac_driver = {
145 + .driver.name = "ar531x-wmac",
146 + .probe = ahb_wmac_probe,
147 + .remove = ahb_wmac_remove
148 +};
149 +
150 +#else
151 +
152 int
153 init_ahb(void)
154 {
155 int ret;
156 u_int16_t devid, radioMask;
157 const char *sysType;
158 + struct ar531x_config config;
159 +
160 sysType = get_system_type();
161 +
162 + /* Probe to find out the silicon revision and enable the
163 + correct number of macs */
164 + if (!ar5312SetupFlash())
165 + return -ENODEV;
166 +
167 + config.board = ar5312_boardConfig;
168 + config.radio = radioConfig;
169 + config.unit = wlanNum;
170 + config.tag = NULL;
171 +
172 if (!strcmp(sysType,"Atheros AR5315")) {
173 devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
174 (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
175 - if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ)
176 + if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
177 + ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ))
178 return init_ath_wmac(devid, 0);
179 }
180
181 - /* Probe to find out the silicon revision and enable the
182 - correct number of macs */
183 - if (!ar5312SetupFlash())
184 - return -ENODEV;
185 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
186 (AR531X_REV_MAJ | AR531X_REV_MIN));
187 switch (devid) {
188 @@ -420,6 +467,7 @@
189 return 0;
190 }
191
192 +#endif
193
194 /*
195 * Module glue.
196 @@ -460,13 +508,19 @@
197 {
198 printk(KERN_INFO "%s: %s\n", dev_info, version);
199
200 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
201 + platform_driver_register(&ahb_wmac_driver);
202 +#else
203 if (init_ahb() != 0) {
204 printk("ath_ahb: No devices found, driver not installed.\n");
205 return (-ENODEV);
206 }
207 +#endif
208 +
209 #ifdef CONFIG_SYSCTL
210 ath_sysctl_register();
211 #endif
212 +
213 return 0;
214 }
215 module_init(init_ath_ahb);
216 @@ -477,8 +531,13 @@
217 #ifdef CONFIG_SYSCTL
218 ath_sysctl_unregister();
219 #endif
220 +
221 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
222 + platform_driver_unregister(&ahb_wmac_driver);
223 +#else
224 exit_ath_wmac(AR531X_WLAN0_NUM);
225 exit_ath_wmac(AR531X_WLAN1_NUM);
226 +#endif
227
228 printk(KERN_INFO "%s: driver unloaded\n", dev_info);
229 }
230 diff -ur madwifi.old/ath/if_ath_ahb.h madwifi.dev/ath/if_ath_ahb.h
231 --- madwifi.old/ath/if_ath_ahb.h 2007-02-04 04:07:15.810701232 +0100
232 +++ madwifi.dev/ath/if_ath_ahb.h 2007-02-04 04:06:49.070766320 +0100
233 @@ -59,6 +59,7 @@
234 #define AR5315_SREV 0xb1000014
235
236 #define AR5315_REV_MAJ 0x0080
237 +#define AR5317_REV_MAJ 0x0090
238 #define AR5315_REV_MAJ_M 0x00f0
239 #define AR5315_REV_MAJ_S 4
240 #define AR5315_REV_MIN_M 0x000f
This page took 0.058007 seconds and 5 git commands to generate.