oops. some code accidentally slipped into the wrong patch file :)
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 120-soc_fix.patch
1 diff -urN madwifi-ng-refcount-r2313-20070505.old/ath/if_ath_ahb.c madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath_ahb.c
2 --- madwifi-ng-refcount-r2313-20070505.old/ath/if_ath_ahb.c 2007-03-08 20:59:06.000000000 +0100
3 +++ madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath_ahb.c 2007-05-13 18:17:56.367999800 +0200
4 @@ -274,12 +274,12 @@
5 }
6
7
8 +
9 static int
10 -exit_ath_wmac(u_int16_t wlanNum)
11 +exit_ath_wmac(u_int16_t wlanNum, struct ar531x_config *config)
12 {
13 struct ath_ahb_softc *sc = sclist[wlanNum];
14 struct net_device *dev;
15 - const char *sysType;
16 u_int16_t devid;
17
18 if (sc == NULL)
19 @@ -289,13 +289,17 @@
20 ath_detach(dev);
21 if (dev->irq)
22 free_irq(dev->irq, dev);
23 - sysType = get_system_type();
24 - if (!strcmp(sysType, "Atheros AR5315"))
25 +
26 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
27 + devid = (u32) config->tag;
28 +#else
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));
32 else
33 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >> 8) &
34 (AR531X_REV_MAJ | AR531X_REV_MIN));
35 +#endif
36
37 ahb_disable_wmac(devid, wlanNum);
38 free_netdev(dev);
39 @@ -401,7 +405,7 @@
40
41 static int ahb_wmac_remove(struct platform_device *pdev)
42 {
43 - exit_ath_wmac(pdev->id);
44 + exit_ath_wmac(pdev->id, (struct ar531x_config *) pdev->dev.platform_data);
45
46 return 0;
47 }
48 @@ -439,7 +443,7 @@
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);
54 }
55
56 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
57 @@ -452,11 +456,11 @@
58 ar5312BspEepromRead(2 * AR531X_RADIO_MASK_OFF, 2,
59 (char *) &radioMask);
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 )
63 return ret;
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)
68 return ret;
69 break;
70 default:
71 diff -urN madwifi-ng-refcount-r2313-20070505.old/ath/if_ath.c madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath.c
72 --- madwifi-ng-refcount-r2313-20070505.old/ath/if_ath.c 2007-05-13 18:17:56.362000712 +0200
73 +++ madwifi-ng-refcount-r2313-20070505.dev/ath/if_ath.c 2007-05-13 18:17:56.371999192 +0200
74 @@ -7670,9 +7672,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]);
81 +
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);
85 + }
86 + }
87 +
88 + if (npend) {
89 + HAL_STATUS status;
90 +
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);
95 }
96 +
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++)