diff -ur madwifi.old/ath/if_ath_ahb.c madwifi.dev/ath/if_ath_ahb.c
---- madwifi.old/ath/if_ath_ahb.c 2006-12-16 00:57:08.000000000 +0100
-+++ madwifi.dev/ath/if_ath_ahb.c 2006-12-16 01:29:38.000000000 +0100
+--- madwifi.old/ath/if_ath_ahb.c 2007-02-04 04:07:15.810701232 +0100
++++ madwifi.dev/ath/if_ath_ahb.c 2007-02-04 04:14:02.699844680 +0100
@@ -17,6 +17,9 @@
#include <linux/if.h>
#include <linux/netdevice.h>
/* set bus cachesize in 4B word units */
void
bus_read_cachesize(struct ath_softc *sc, u_int8_t *csz)
-@@ -295,7 +301,7 @@
+@@ -180,7 +186,8 @@
+ u_int32_t reset;
+ u_int32_t enable;
+
+- if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
++ if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
++ ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ)) {
+ u_int32_t reg;
+ u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
+
+@@ -241,7 +248,8 @@
+ ahb_disable_wmac(u_int16_t devid, u_int16_t wlanNum)
+ {
+ u_int32_t enable;
+- if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
++ if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
++ ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ)) {
+ u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
+
+ KASSERT(wlanNum == 0, ("invalid wlan # %d", wlanNum) );
+@@ -265,12 +273,12 @@
+ }
+
+
++
+ int
+-exit_ath_wmac(u_int16_t wlanNum)
++exit_ath_wmac(u_int16_t wlanNum, struct ar531x_config *config)
+ {
+ struct ath_ahb_softc *sc = sclist[wlanNum];
+ struct net_device *dev;
+- const char *sysType;
+ u_int16_t devid;
+
+ if (sc == NULL)
+@@ -280,13 +288,17 @@
+ ath_detach(dev);
+ if (dev->irq)
+ free_irq(dev->irq, dev);
+- sysType = get_system_type();
+- if (!strcmp(sysType, "Atheros AR5315"))
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
++ devid = (u32) config->tag;
++#else
++ if (!strcmp(get_system_type(), "Atheros AR5315"))
+ devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
+ (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
+ else
+ devid = (u_int16_t) ((sysRegRead(AR531X_REV) >> 8) &
+ (AR531X_REV_MAJ | AR531X_REV_MIN));
++#endif
+
+ ahb_disable_wmac(devid, wlanNum);
+ free_netdev(dev);
+@@ -295,7 +307,7 @@
}
int
{
const char *athname;
struct net_device *dev;
-@@ -352,12 +358,7 @@
+@@ -329,7 +341,8 @@
+
+ switch (wlanNum) {
+ case AR531X_WLAN0_NUM:
+- if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
++ if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
++ ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ)) {
+ dev->irq = AR5315_IRQ_WLAN0_INTRS;
+ dev->mem_start = AR5315_WLAN0;
+ } else {
+@@ -352,12 +365,7 @@
goto bad3;
}
goto bad4;
athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
-@@ -379,13 +380,55 @@
+@@ -379,24 +387,63 @@
return -ENODEV;
}
+
+static int ahb_wmac_remove(struct platform_device *pdev)
+{
-+ exit_ath_wmac(pdev->id);
++ exit_ath_wmac(pdev->id, (struct ar531x_config *) pdev->dev.platform_data);
+
+ return 0;
+}
if (!strcmp(sysType,"Atheros AR5315")) {
devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
(AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
-@@ -393,10 +436,6 @@
+- if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ)
++ if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
++ ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ))
return init_ath_wmac(devid, 0);
}
devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
(AR531X_REV_MAJ | AR531X_REV_MIN));
switch (devid) {
-@@ -420,6 +459,7 @@
+@@ -420,6 +467,7 @@
return 0;
}
/*
* Module glue.
-@@ -460,13 +500,19 @@
+@@ -460,13 +508,19 @@
{
printk(KERN_INFO "%s: %s\n", dev_info, version);
return 0;
}
module_init(init_ath_ahb);
-@@ -477,8 +523,13 @@
+@@ -477,8 +531,13 @@
#ifdef CONFIG_SYSCTL
ath_sysctl_unregister();
#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
-+ platform_driver_register(&ahb_wmac_driver);
++ platform_driver_unregister(&ahb_wmac_driver);
+#else
exit_ath_wmac(AR531X_WLAN0_NUM);
exit_ath_wmac(AR531X_WLAN1_NUM);
printk(KERN_INFO "%s: driver unloaded\n", dev_info);
}
+diff -ur madwifi.old/ath/if_ath_ahb.h madwifi.dev/ath/if_ath_ahb.h
+--- madwifi.old/ath/if_ath_ahb.h 2007-02-04 04:07:15.810701232 +0100
++++ madwifi.dev/ath/if_ath_ahb.h 2007-02-04 04:06:49.070766320 +0100
+@@ -59,6 +59,7 @@
+ #define AR5315_SREV 0xb1000014
+
+ #define AR5315_REV_MAJ 0x0080
++#define AR5317_REV_MAJ 0x0090
+ #define AR5315_REV_MAJ_M 0x00f0
+ #define AR5315_REV_MAJ_S 4
+ #define AR5315_REV_MIN_M 0x000f