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:57:08.000000000 +0100
3 +++ madwifi.dev/ath/if_ath_ahb.c 2006-12-16 01:29:38.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 -init_ath_wmac(u_int16_t devid, u_int16_t wlanNum)
36 +init_ath_wmac(u_int16_t devid, u_int16_t wlanNum, struct ar531x_config *config)
39 struct net_device *dev;
44 - struct ar531x_config config;
45 - config.board = ar5312_boardConfig;
46 - config.radio = radioConfig;
47 - config.unit = wlanNum;
49 - if (ath_attach(devid, dev, &config) != 0)
50 + if (ath_attach(devid, dev, config) != 0)
52 athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
53 printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
58 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
59 +static int ahb_wmac_probe(struct platform_device *pdev)
62 + struct ar531x_config *config;
64 + config = (struct ar531x_config *) pdev->dev.platform_data;
65 + devid = (u32) config->tag;
68 + return init_ath_wmac((u_int16_t) devid, pdev->id, config);
72 +static int ahb_wmac_remove(struct platform_device *pdev)
74 + exit_ath_wmac(pdev->id);
79 +struct platform_driver ahb_wmac_driver = {
80 + .driver.name = "ar531x-wmac",
81 + .probe = ahb_wmac_probe,
82 + .remove = ahb_wmac_remove
91 u_int16_t devid, radioMask;
93 + struct ar531x_config config;
95 sysType = get_system_type();
97 + /* Probe to find out the silicon revision and enable the
98 + correct number of macs */
99 + if (!ar5312SetupFlash())
102 + config.board = ar5312_boardConfig;
103 + config.radio = radioConfig;
104 + config.unit = wlanNum;
107 if (!strcmp(sysType,"Atheros AR5315")) {
108 devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
109 (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
111 return init_ath_wmac(devid, 0);
114 - /* Probe to find out the silicon revision and enable the
115 - correct number of macs */
116 - if (!ar5312SetupFlash())
118 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
119 (AR531X_REV_MAJ | AR531X_REV_MIN));
129 @@ -460,13 +500,19 @@
131 printk(KERN_INFO "%s: %s\n", dev_info, version);
133 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
134 + platform_driver_register(&ahb_wmac_driver);
136 if (init_ahb() != 0) {
137 printk("ath_ahb: No devices found, driver not installed.\n");
143 ath_sysctl_register();
148 module_init(init_ath_ahb);
151 ath_sysctl_unregister();
154 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
155 + platform_driver_register(&ahb_wmac_driver);
157 exit_ath_wmac(AR531X_WLAN0_NUM);
158 exit_ath_wmac(AR531X_WLAN1_NUM);
161 printk(KERN_INFO "%s: driver unloaded\n", dev_info);