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
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>
13 #include <asm/uaccess.h>
15 static struct ath_ahb_softc *sclist[2] = {NULL, NULL};
16 static u_int8_t num_activesc = 0;
18 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
19 static struct ar531x_boarddata *ar5312_boardConfig = NULL;
20 static char *radioConfig = NULL;
23 data[i] = eepromAddr[off];
28 /* set bus cachesize in 4B word units */
30 bus_read_cachesize(struct ath_softc *sc, u_int8_t *csz)
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)) {
39 u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
42 ahb_disable_wmac(u_int16_t devid, u_int16_t wlanNum)
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;
50 KASSERT(wlanNum == 0, ("invalid wlan # %d", wlanNum) );
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)
59 struct net_device *dev;
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;
74 - struct ar531x_config config;
75 - config.board = ar5312_boardConfig;
76 - config.radio = radioConfig;
77 - config.unit = wlanNum;
79 - if (ath_attach(devid, dev, &config) != 0)
80 + if (ath_attach(devid, dev, config) != 0)
82 athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
83 printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
88 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
89 +static int ahb_wmac_probe(struct platform_device *pdev)
92 + struct ar531x_config *config;
94 + config = (struct ar531x_config *) pdev->dev.platform_data;
95 + devid = (u32) config->tag;
98 + return init_ath_wmac((u_int16_t) devid, pdev->id, config);
102 +static int ahb_wmac_remove(struct platform_device *pdev)
104 + exit_ath_wmac(pdev->id);
109 +struct platform_driver ahb_wmac_driver = {
110 + .driver.name = "ar531x-wmac",
111 + .probe = ahb_wmac_probe,
112 + .remove = ahb_wmac_remove
121 u_int16_t devid, radioMask;
123 + struct ar531x_config config;
125 sysType = get_system_type();
127 + /* Probe to find out the silicon revision and enable the
128 + correct number of macs */
129 + if (!ar5312SetupFlash())
132 + config.board = ar5312_boardConfig;
133 + config.radio = radioConfig;
134 + config.unit = wlanNum;
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);
146 - /* Probe to find out the silicon revision and enable the
147 - correct number of macs */
148 - if (!ar5312SetupFlash())
150 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
151 (AR531X_REV_MAJ | AR531X_REV_MIN));
161 @@ -460,13 +504,19 @@
163 printk(KERN_INFO "%s: %s\n", dev_info, version);
165 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
166 + platform_driver_register(&ahb_wmac_driver);
168 if (init_ahb() != 0) {
169 printk("ath_ahb: No devices found, driver not installed.\n");
175 ath_sysctl_register();
180 module_init(init_ath_ahb);
183 ath_sysctl_unregister();
186 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
187 + platform_driver_register(&ahb_wmac_driver);
189 exit_ath_wmac(AR531X_WLAN0_NUM);
190 exit_ath_wmac(AR531X_WLAN1_NUM);
193 printk(KERN_INFO "%s: driver unloaded\n", dev_info);
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
199 #define AR5315_SREV 0xb1000014
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