1 diff -urN madwifi-ng-r2377-20070526.old/ath/if_ath_ahb.c madwifi-ng-r2377-20070526.dev/ath/if_ath_ahb.c
2 --- madwifi-ng-r2377-20070526.old/ath/if_ath_ahb.c 2007-02-24 02:33:54.000000000 +0100
3 +++ madwifi-ng-r2377-20070526.dev/ath/if_ath_ahb.c 2007-05-26 18:51:09.112702200 +0200
10 -exit_ath_wmac(u_int16_t wlanNum)
11 +exit_ath_wmac(u_int16_t wlanNum, struct ar531x_config *config)
13 struct ath_ahb_softc *sc = sclist[wlanNum];
14 struct net_device *dev;
15 - const char *sysType;
22 free_irq(dev->irq, dev);
23 - sysType = get_system_type();
24 - if (!strcmp(sysType, "Atheros AR5315"))
26 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
27 + devid = (u32) config->tag;
29 + if (!strcmp(get_system_type(), "Atheros AR5315"))
30 devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
31 (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
33 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >> 8) &
34 (AR531X_REV_MAJ | AR531X_REV_MIN));
37 ahb_disable_wmac(devid, wlanNum);
41 static int ahb_wmac_remove(struct platform_device *pdev)
43 - exit_ath_wmac(pdev->id);
44 + exit_ath_wmac(pdev->id, (struct ar531x_config *) pdev->dev.platform_data);
49 (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
50 if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
51 ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ))
52 - return init_ath_wmac(devid, 0, &config);
53 + return init_ath_wmac(devid, 0);
56 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
58 ar5312BspEepromRead(2 * AR531X_RADIO_MASK_OFF, 2,
60 if ((radioMask & AR531X_RADIO0_MASK) != 0)
61 - if ((ret = init_ath_wmac(devid, 0, &config)) !=0 )
62 + if ((ret = init_ath_wmac(devid, 0)) !=0 )
64 /* XXX: Fall through?! */
65 case AR5212_AR2313_REV8:
66 - if ((ret = init_ath_wmac(devid, 1, &config)) != 0)
67 + if ((ret = init_ath_wmac(devid, 1)) != 0)
71 diff -urN madwifi-ng-r2377-20070526.old/ath/if_ath.c madwifi-ng-r2377-20070526.dev/ath/if_ath.c
72 --- madwifi-ng-r2377-20070526.old/ath/if_ath.c 2007-05-26 18:51:09.019716336 +0200
73 +++ madwifi-ng-r2377-20070526.dev/ath/if_ath.c 2007-05-26 18:51:09.116701592 +0200
74 @@ -7636,9 +7636,24 @@
75 DPRINTF(sc, ATH_DEBUG_RESET, "%s: beacon queue 0x%x\n",
76 __func__, ath_hal_gettxbuf(ah, sc->sc_bhalq));
77 for (i = 0; i < HAL_NUM_TX_QUEUES; i++)
78 - if (ATH_TXQ_SETUP(sc, i))
79 + if (ATH_TXQ_SETUP(sc, i)) {
80 ath_tx_stopdma(sc, &sc->sc_txq[i]);
82 + /* The TxDMA may not really be stopped.
83 + * Double check the hal tx pending count */
84 + npend += ath_hal_numtxpending(ah, sc->sc_txq[i].axq_qnum);
91 + /* TxDMA not stopped, reset the hal */
92 + DPRINTF(sc, ATH_DEBUG_RESET, "%s: Unable to stop TxDMA. Reset HAL!\n", __func__);
93 + if (!ath_hal_reset(ah, sc->sc_ic.ic_opmode, &sc->sc_curchan, AH_TRUE, &status))
94 + printk("%s: unable to reset hardware; hal status %u\n", __func__, status);
97 sc->sc_dev->trans_start = jiffies;
98 netif_start_queue(sc->sc_dev); /* XXX move to callers */
99 for (i = 0; i < HAL_NUM_TX_QUEUES; i++)