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:56:39.000000000 +0100
3 +++ madwifi.dev/ath/if_ath_ahb.c 2006-12-16 00:57:08.000000000 +0100
7 #include "if_ath_ahb.h"
10 struct ath_ahb_softc {
11 struct ath_softc aps_sc;
14 ahb_enable_wmac(u_int16_t devid, u_int16_t wlanNum)
19 if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
21 u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
23 /* wait for the MAC to wakeup */
24 while (REG_READ(AR5315_PCI_MAC_PCICFG) & AR5315_PCI_MAC_PCICFG_SPWR_DN);
26 - u_int32_t *en = (u_int32_t *)AR531X_ENABLE;
28 case AR531X_WLAN0_NUM:
29 - *en |= AR531X_ENABLE_WLAN0;
30 + reset = (AR531X_RESET_WLAN0 |
31 + AR531X_RESET_WARM_WLAN0_MAC |
32 + AR531X_RESET_WARM_WLAN0_BB);
33 + enable = AR531X_ENABLE_WLAN0;
35 case AR531X_WLAN1_NUM:
36 - *en |= AR531X_ENABLE_WLAN1;
37 + reset = (AR531X_RESET_WLAN1 |
38 + AR531X_RESET_WARM_WLAN1_MAC |
39 + AR531X_RESET_WARM_WLAN1_BB);
40 + enable = AR531X_ENABLE_WLAN1;
45 + /* reset the MAC or suffer lots of AHB PROC errors */
46 + REG_WRITE(AR531X_RESETCTL, REG_READ(AR531X_RESETCTL) | reset);
49 + /* take it out of reset */
50 + REG_WRITE(AR531X_RESETCTL, REG_READ(AR531X_RESETCTL) & ~reset);
54 + REG_WRITE(AR531X_ENABLE, REG_READ(AR531X_ENABLE) | enable);
60 ahb_disable_wmac(u_int16_t devid, u_int16_t wlanNum)
63 if ((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) {
64 u_int32_t *en = (u_int32_t *) AR5315_AHB_ARB_CTL;
67 /* Enable Arbitration for WLAN */
68 *en &= ~AR5315_ARB_WLAN;
70 - u_int32_t *en = (u_int32_t *)AR531X_ENABLE;
72 case AR531X_WLAN0_NUM:
73 - *en &= ~AR531X_ENABLE_WLAN0;
74 + enable = AR531X_ENABLE_WLAN0;
76 case AR531X_WLAN1_NUM:
77 - *en &= ~AR531X_ENABLE_WLAN1;
78 + enable = AR531X_ENABLE_WLAN1;
83 + REG_WRITE(AR531X_ENABLE, REG_READ(AR531X_ENABLE) & ~enable);
89 dev->mem_end = dev->mem_start + AR531X_WLANX_LEN;
90 sc->aps_sc.sc_bdev = NULL;
93 if (request_irq(dev->irq, ath_intr, SA_SHIRQ, dev->name, dev)) {
94 printk(KERN_WARNING "%s: request_irq failed\n", dev->name);
98 - if (ath_attach(devid, dev) != 0)
100 + struct ar531x_config config;
101 + config.board = ar5312_boardConfig;
102 + config.radio = radioConfig;
103 + config.unit = wlanNum;
105 + if (ath_attach(devid, dev, &config) != 0)
107 athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
108 printk(KERN_INFO "%s: %s: mem=0x%lx, irq=%d\n",
109 diff -ur madwifi.old/ath/if_ath_ahb.h madwifi.dev/ath/if_ath_ahb.h
110 --- madwifi.old/ath/if_ath_ahb.h 2006-12-16 00:56:39.000000000 +0100
111 +++ madwifi.dev/ath/if_ath_ahb.h 2006-12-16 00:57:08.000000000 +0100
115 #include <asm/uaccess.h>
117 #define AR531X_WLAN0_NUM 0
118 #define AR531X_WLAN1_NUM 1
121 #define AR531X_WLAN1 0xb8500000
122 #define AR531X_WLANX_LEN 0x000ffffc
124 +#define AR531X_RESETCTL 0xbc003020
125 +#define AR531X_RESET_WLAN0 0x00000004 /* mac & bb */
126 +#define AR531X_RESET_WLAN1 0x00000200 /* mac & bb */
127 +#define AR531X_RESET_WARM_WLAN0_MAC 0x00002000
128 +#define AR531X_RESET_WARM_WLAN0_BB 0x00004000
129 +#define AR531X_RESET_WARM_WLAN1_MAC 0x00020000
130 +#define AR531X_RESET_WARM_WLAN1_BB 0x00040000
132 #define AR531X_ENABLE 0xbc003080
133 -#define AR531X_ENABLE_WLAN1 0x8
134 -#define AR531X_ENABLE_WLAN0 0x1
135 +#define AR531X_ENABLE_WLAN0 0x0001
136 +#define AR531X_ENABLE_WLAN1 0x0018 /* both DMA and PIO */
138 #define AR531X_RADIO_MASK_OFF 0xc8
139 #define AR531X_RADIO0_MASK 0x0003
140 #define AR531X_RADIO1_MASK 0x000c
141 diff -ur madwifi.old/ath/if_ath.c madwifi.dev/ath/if_ath.c
142 --- madwifi.old/ath/if_ath.c 2006-12-16 00:56:39.000000000 +0100
143 +++ madwifi.dev/ath/if_ath.c 2006-12-16 00:57:08.000000000 +0100
148 -ath_attach(u_int16_t devid, struct net_device *dev)
149 +ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
151 struct ath_softc *sc = dev->priv;
152 struct ieee80211com *ic = &sc->sc_ic;
154 * built with an ah.h that does not correspond to the hal
155 * module loaded in the kernel.
157 - ah = _ath_hal_attach(devid, sc, NULL, (void *) dev->mem_start, &status);
158 + ah = _ath_hal_attach(devid, sc, tag, (void *) dev->mem_start, &status);
160 printk(KERN_ERR "%s: unable to attach hardware: '%s' (HAL status %u)\n",
161 dev->name, ath_get_hal_status_desc(status), status);
162 diff -ur madwifi.old/ath/if_ath_pci.c madwifi.dev/ath/if_ath_pci.c
163 --- madwifi.old/ath/if_ath_pci.c 2006-12-16 00:56:39.000000000 +0100
164 +++ madwifi.dev/ath/if_ath_pci.c 2006-12-16 00:57:08.000000000 +0100
169 - if (ath_attach(vdevice, dev) != 0)
170 + if (ath_attach(vdevice, dev, NULL) != 0)
173 athname = ath_hal_probe(id->vendor, vdevice);
174 diff -ur madwifi.old/ath/if_athvar.h madwifi.dev/ath/if_athvar.h
175 --- madwifi.old/ath/if_athvar.h 2006-12-16 00:56:39.000000000 +0100
176 +++ madwifi.dev/ath/if_athvar.h 2006-12-16 00:57:08.000000000 +0100
178 #define ATH_LOCK(_sc) down(&(_sc)->sc_lock)
179 #define ATH_UNLOCK(_sc) up(&(_sc)->sc_lock)
181 -int ath_attach(u_int16_t, struct net_device *);
182 +int ath_attach(u_int16_t, struct net_device *, HAL_BUS_TAG);
183 int ath_detach(struct net_device *);
184 void ath_resume(struct net_device *);
185 void ath_suspend(struct net_device *);
186 diff -ur madwifi.old/THANKS madwifi.dev/THANKS
187 --- madwifi.old/THANKS 2006-12-16 00:56:39.000000000 +0100
188 +++ madwifi.dev/THANKS 2006-12-16 00:58:33.000000000 +0100
195 Apologies to anyone whose name was unintentionally left off.
196 Please let us know if you think your name should be mentioned here!