ath5k: disable the unusable 2 GHz mode on the first radio of a dual-band AR5312 device
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 475-ath5k_fix_ar5312_5ghz_cap.patch
1 --- a/drivers/net/wireless/ath/ath5k/base.h
2 +++ b/drivers/net/wireless/ath/ath5k/base.h
3 @@ -193,12 +193,13 @@ struct ath5k_softc {
4 dma_addr_t desc_daddr; /* DMA (physical) address */
5 size_t desc_len; /* size of TX/RX descriptors */
6
7 - DECLARE_BITMAP(status, 5);
8 + DECLARE_BITMAP(status, 6);
9 #define ATH_STAT_INVALID 0 /* disable hardware accesses */
10 #define ATH_STAT_MRRETRY 1 /* multi-rate retry support */
11 #define ATH_STAT_PROMISC 2
12 #define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */
13 #define ATH_STAT_STARTED 4 /* opened & irqs enabled */
14 +#define ATH_STAT_2G_DISABLED 5 /* multiband radio without 2G */
15
16 unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
17 struct ieee80211_channel *curchan; /* current h/w channel */
18 --- a/drivers/net/wireless/ath/ath5k/ahb.c
19 +++ b/drivers/net/wireless/ath/ath5k/ahb.c
20 @@ -160,6 +160,16 @@ static int ath_ahb_probe(struct platform
21 else
22 reg |= AR5K_AR5312_ENABLE_WLAN1;
23 __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE);
24 +
25 + /*
26 + * On a dual-band AR5312, the multiband radio is only
27 + * used as pass-through. Disable 2 GHz support in the
28 + * driver for it
29 + */
30 + if (to_platform_device(sc->dev)->id == 0 &&
31 + (bcfg->config->flags & (BD_WLAN0|BD_WLAN1)) ==
32 + (BD_WLAN1|BD_WLAN0))
33 + __set_bit(ATH_STAT_2G_DISABLED, sc->status);
34 }
35
36 ret = ath5k_init_softc(sc, &ath_ahb_bus_ops);
37 --- a/drivers/net/wireless/ath/ath5k/attach.c
38 +++ b/drivers/net/wireless/ath/ath5k/attach.c
39 @@ -313,6 +313,11 @@ int ath5k_hw_init(struct ath5k_softc *sc
40 goto err;
41 }
42
43 + if (test_bit(ATH_STAT_2G_DISABLED, sc->status)) {
44 + __clear_bit(AR5K_MODE_11B, ah->ah_capabilities.cap_mode);
45 + __clear_bit(AR5K_MODE_11G, ah->ah_capabilities.cap_mode);
46 + }
47 +
48 /* Crypto settings */
49 common->keymax = (sc->ah->ah_version == AR5K_AR5210 ?
50 AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211);