diff options
122 files changed, 2074 insertions, 2557 deletions
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index 12a75ab3dd23..4228736de0e8 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
@@ -13,8 +13,8 @@ | |||
13 | struct bcma_bus; | 13 | struct bcma_bus; |
14 | 14 | ||
15 | /* main.c */ | 15 | /* main.c */ |
16 | extern int bcma_bus_register(struct bcma_bus *bus); | 16 | int bcma_bus_register(struct bcma_bus *bus); |
17 | extern void bcma_bus_unregister(struct bcma_bus *bus); | 17 | void bcma_bus_unregister(struct bcma_bus *bus); |
18 | 18 | ||
19 | /* scan.c */ | 19 | /* scan.c */ |
20 | int bcma_bus_scan(struct bcma_bus *bus); | 20 | int bcma_bus_scan(struct bcma_bus *bus); |
diff --git a/drivers/bcma/core.c b/drivers/bcma/core.c index ced379f7b371..1ec7d4528dd0 100644 --- a/drivers/bcma/core.c +++ b/drivers/bcma/core.c | |||
@@ -19,7 +19,7 @@ bool bcma_core_is_enabled(struct bcma_device *core) | |||
19 | } | 19 | } |
20 | EXPORT_SYMBOL_GPL(bcma_core_is_enabled); | 20 | EXPORT_SYMBOL_GPL(bcma_core_is_enabled); |
21 | 21 | ||
22 | static void bcma_core_disable(struct bcma_device *core, u32 flags) | 22 | void bcma_core_disable(struct bcma_device *core, u32 flags) |
23 | { | 23 | { |
24 | if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET) | 24 | if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET) |
25 | return; | 25 | return; |
@@ -31,6 +31,7 @@ static void bcma_core_disable(struct bcma_device *core, u32 flags) | |||
31 | bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET); | 31 | bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET); |
32 | udelay(1); | 32 | udelay(1); |
33 | } | 33 | } |
34 | EXPORT_SYMBOL_GPL(bcma_core_disable); | ||
34 | 35 | ||
35 | int bcma_core_enable(struct bcma_device *core, u32 flags) | 36 | int bcma_core_enable(struct bcma_device *core, u32 flags) |
36 | { | 37 | { |
diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c index f44177a644c7..dd5846bef029 100644 --- a/drivers/bcma/driver_chipcommon_pmu.c +++ b/drivers/bcma/driver_chipcommon_pmu.c | |||
@@ -53,6 +53,7 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc) | |||
53 | max_msk = 0xFFFF; | 53 | max_msk = 0xFFFF; |
54 | break; | 54 | break; |
55 | case 43224: | 55 | case 43224: |
56 | case 43225: | ||
56 | break; | 57 | break; |
57 | default: | 58 | default: |
58 | pr_err("PMU resource config unknown for device 0x%04X\n", | 59 | pr_err("PMU resource config unknown for device 0x%04X\n", |
@@ -74,6 +75,7 @@ void bcma_pmu_swreg_init(struct bcma_drv_cc *cc) | |||
74 | case 0x4313: | 75 | case 0x4313: |
75 | case 0x4331: | 76 | case 0x4331: |
76 | case 43224: | 77 | case 43224: |
78 | case 43225: | ||
77 | break; | 79 | break; |
78 | default: | 80 | default: |
79 | pr_err("PMU switch/regulators init unknown for device " | 81 | pr_err("PMU switch/regulators init unknown for device " |
@@ -96,11 +98,13 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc) | |||
96 | if (bus->chipinfo.rev == 0) { | 98 | if (bus->chipinfo.rev == 0) { |
97 | pr_err("Workarounds for 43224 rev 0 not fully " | 99 | pr_err("Workarounds for 43224 rev 0 not fully " |
98 | "implemented\n"); | 100 | "implemented\n"); |
99 | bcma_chipco_chipctl_maskset(cc, 0, ~0, 0xF0); | 101 | bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x00F000F0); |
100 | } else { | 102 | } else { |
101 | bcma_chipco_chipctl_maskset(cc, 0, ~0, 0xF0); | 103 | bcma_chipco_chipctl_maskset(cc, 0, ~0, 0xF0); |
102 | } | 104 | } |
103 | break; | 105 | break; |
106 | case 43225: | ||
107 | break; | ||
104 | default: | 108 | default: |
105 | pr_err("Workarounds unknown for device 0x%04X\n", | 109 | pr_err("Workarounds unknown for device 0x%04X\n", |
106 | bus->chipinfo.id); | 110 | bus->chipinfo.id); |
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c index 789d68b4858b..b0c19ede0d2e 100644 --- a/drivers/bcma/driver_pci.c +++ b/drivers/bcma/driver_pci.c | |||
@@ -184,3 +184,4 @@ int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, | |||
184 | out: | 184 | out: |
185 | return err; | 185 | return err; |
186 | } | 186 | } |
187 | EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl); | ||
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c index 279bf50f6d8e..c4b313afb9cc 100644 --- a/drivers/bcma/host_pci.c +++ b/drivers/bcma/host_pci.c | |||
@@ -226,6 +226,7 @@ static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = { | |||
226 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, | 226 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, |
227 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) }, | 227 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) }, |
228 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, | 228 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, |
229 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, | ||
229 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, | 230 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, |
230 | { 0, }, | 231 | { 0, }, |
231 | }; | 232 | }; |
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 11e96dc6011a..ba15105cc23a 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
@@ -160,13 +160,11 @@ int bcma_bus_register(struct bcma_bus *bus) | |||
160 | 160 | ||
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | EXPORT_SYMBOL_GPL(bcma_bus_register); | ||
164 | 163 | ||
165 | void bcma_bus_unregister(struct bcma_bus *bus) | 164 | void bcma_bus_unregister(struct bcma_bus *bus) |
166 | { | 165 | { |
167 | bcma_unregister_cores(bus); | 166 | bcma_unregister_cores(bus); |
168 | } | 167 | } |
169 | EXPORT_SYMBOL_GPL(bcma_bus_unregister); | ||
170 | 168 | ||
171 | int __bcma_driver_register(struct bcma_driver *drv, struct module *owner) | 169 | int __bcma_driver_register(struct bcma_driver *drv, struct module *owner) |
172 | { | 170 | { |
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index ea9982781559..c38e9e848995 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c | |||
@@ -219,6 +219,7 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
219 | 219 | ||
220 | ath5k_deinit_softc(sc); | 220 | ath5k_deinit_softc(sc); |
221 | platform_set_drvdata(pdev, NULL); | 221 | platform_set_drvdata(pdev, NULL); |
222 | ieee80211_free_hw(hw); | ||
222 | 223 | ||
223 | return 0; | 224 | return 0; |
224 | } | 225 | } |
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index bb50700436fe..c4c02d5145c2 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -767,6 +767,7 @@ struct ath5k_athchan_2ghz { | |||
767 | */ | 767 | */ |
768 | 768 | ||
769 | #define AR5K_KEYCACHE_SIZE 8 | 769 | #define AR5K_KEYCACHE_SIZE 8 |
770 | extern int ath5k_modparam_nohwcrypt; | ||
770 | 771 | ||
771 | /***********************\ | 772 | /***********************\ |
772 | HW RELATED DEFINITIONS | 773 | HW RELATED DEFINITIONS |
@@ -1180,8 +1181,8 @@ void ath5k_sysfs_unregister(struct ath5k_softc *sc); | |||
1180 | struct ath5k_buf; | 1181 | struct ath5k_buf; |
1181 | struct ath5k_txq; | 1182 | struct ath5k_txq; |
1182 | 1183 | ||
1183 | void set_beacon_filter(struct ieee80211_hw *hw, bool enable); | 1184 | void ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable); |
1184 | bool ath_any_vif_assoc(struct ath5k_softc *sc); | 1185 | bool ath5k_any_vif_assoc(struct ath5k_softc *sc); |
1185 | void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, | 1186 | void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, |
1186 | struct ath5k_txq *txq); | 1187 | struct ath5k_txq *txq); |
1187 | int ath5k_init_hw(struct ath5k_softc *sc); | 1188 | int ath5k_init_hw(struct ath5k_softc *sc); |
@@ -1253,7 +1254,7 @@ int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, | |||
1253 | int len, struct ieee80211_rate *rate, bool shortpre); | 1254 | int len, struct ieee80211_rate *rate, bool shortpre); |
1254 | unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah); | 1255 | unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah); |
1255 | unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah); | 1256 | unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah); |
1256 | extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode); | 1257 | int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode); |
1257 | void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class); | 1258 | void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class); |
1258 | /* RX filter control*/ | 1259 | /* RX filter control*/ |
1259 | int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac); | 1260 | int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac); |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index b6c5d3715b96..a6623ddfdefe 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -87,8 +87,6 @@ MODULE_LICENSE("Dual BSD/GPL"); | |||
87 | static int ath5k_init(struct ieee80211_hw *hw); | 87 | static int ath5k_init(struct ieee80211_hw *hw); |
88 | static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, | 88 | static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, |
89 | bool skip_pcu); | 89 | bool skip_pcu); |
90 | int ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | ||
91 | void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf); | ||
92 | 90 | ||
93 | /* Known SREVs */ | 91 | /* Known SREVs */ |
94 | static const struct ath5k_srev_name srev_names[] = { | 92 | static const struct ath5k_srev_name srev_names[] = { |
@@ -2161,7 +2159,7 @@ ath5k_schedule_tx(struct ath5k_softc *sc) | |||
2161 | tasklet_schedule(&sc->txtq); | 2159 | tasklet_schedule(&sc->txtq); |
2162 | } | 2160 | } |
2163 | 2161 | ||
2164 | irqreturn_t | 2162 | static irqreturn_t |
2165 | ath5k_intr(int irq, void *dev_id) | 2163 | ath5k_intr(int irq, void *dev_id) |
2166 | { | 2164 | { |
2167 | struct ath5k_softc *sc = dev_id; | 2165 | struct ath5k_softc *sc = dev_id; |
@@ -2615,7 +2613,7 @@ done: | |||
2615 | return ret; | 2613 | return ret; |
2616 | } | 2614 | } |
2617 | 2615 | ||
2618 | static void stop_tasklets(struct ath5k_softc *sc) | 2616 | static void ath5k_stop_tasklets(struct ath5k_softc *sc) |
2619 | { | 2617 | { |
2620 | sc->rx_pending = false; | 2618 | sc->rx_pending = false; |
2621 | sc->tx_pending = false; | 2619 | sc->tx_pending = false; |
@@ -2669,7 +2667,7 @@ ath5k_stop_hw(struct ath5k_softc *sc) | |||
2669 | mmiowb(); | 2667 | mmiowb(); |
2670 | mutex_unlock(&sc->lock); | 2668 | mutex_unlock(&sc->lock); |
2671 | 2669 | ||
2672 | stop_tasklets(sc); | 2670 | ath5k_stop_tasklets(sc); |
2673 | 2671 | ||
2674 | cancel_delayed_work_sync(&sc->tx_complete_work); | 2672 | cancel_delayed_work_sync(&sc->tx_complete_work); |
2675 | 2673 | ||
@@ -2697,7 +2695,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, | |||
2697 | 2695 | ||
2698 | ath5k_hw_set_imr(ah, 0); | 2696 | ath5k_hw_set_imr(ah, 0); |
2699 | synchronize_irq(sc->irq); | 2697 | synchronize_irq(sc->irq); |
2700 | stop_tasklets(sc); | 2698 | ath5k_stop_tasklets(sc); |
2701 | 2699 | ||
2702 | /* Save ani mode and disable ANI during | 2700 | /* Save ani mode and disable ANI during |
2703 | * reset. If we don't we might get false | 2701 | * reset. If we don't we might get false |
@@ -2962,11 +2960,12 @@ ath5k_deinit_softc(struct ath5k_softc *sc) | |||
2962 | * state and potentially want to use them. | 2960 | * state and potentially want to use them. |
2963 | */ | 2961 | */ |
2964 | ath5k_hw_deinit(sc->ah); | 2962 | ath5k_hw_deinit(sc->ah); |
2963 | kfree(sc->ah); | ||
2965 | free_irq(sc->irq, sc); | 2964 | free_irq(sc->irq, sc); |
2966 | } | 2965 | } |
2967 | 2966 | ||
2968 | bool | 2967 | bool |
2969 | ath_any_vif_assoc(struct ath5k_softc *sc) | 2968 | ath5k_any_vif_assoc(struct ath5k_softc *sc) |
2970 | { | 2969 | { |
2971 | struct ath5k_vif_iter_data iter_data; | 2970 | struct ath5k_vif_iter_data iter_data; |
2972 | iter_data.hw_macaddr = NULL; | 2971 | iter_data.hw_macaddr = NULL; |
@@ -2980,7 +2979,7 @@ ath_any_vif_assoc(struct ath5k_softc *sc) | |||
2980 | } | 2979 | } |
2981 | 2980 | ||
2982 | void | 2981 | void |
2983 | set_beacon_filter(struct ieee80211_hw *hw, bool enable) | 2982 | ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable) |
2984 | { | 2983 | { |
2985 | struct ath5k_softc *sc = hw->priv; | 2984 | struct ath5k_softc *sc = hw->priv; |
2986 | struct ath5k_hw *ah = sc->ah; | 2985 | struct ath5k_hw *ah = sc->ah; |
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index 807bd6440169..493908299bb4 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | |||
@@ -46,8 +46,6 @@ | |||
46 | #include "base.h" | 46 | #include "base.h" |
47 | #include "reg.h" | 47 | #include "reg.h" |
48 | 48 | ||
49 | extern int ath5k_modparam_nohwcrypt; | ||
50 | |||
51 | /********************\ | 49 | /********************\ |
52 | * Mac80211 functions * | 50 | * Mac80211 functions * |
53 | \********************/ | 51 | \********************/ |
@@ -296,10 +294,10 @@ ath5k_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
296 | if (bss_conf->assoc) | 294 | if (bss_conf->assoc) |
297 | sc->assoc = bss_conf->assoc; | 295 | sc->assoc = bss_conf->assoc; |
298 | else | 296 | else |
299 | sc->assoc = ath_any_vif_assoc(sc); | 297 | sc->assoc = ath5k_any_vif_assoc(sc); |
300 | 298 | ||
301 | if (sc->opmode == NL80211_IFTYPE_STATION) | 299 | if (sc->opmode == NL80211_IFTYPE_STATION) |
302 | set_beacon_filter(hw, sc->assoc); | 300 | ath5k_set_beacon_filter(hw, sc->assoc); |
303 | ath5k_hw_set_ledstate(sc->ah, sc->assoc ? | 301 | ath5k_hw_set_ledstate(sc->ah, sc->assoc ? |
304 | AR5K_LED_ASSOC : AR5K_LED_INIT); | 302 | AR5K_LED_ASSOC : AR5K_LED_INIT); |
305 | if (bss_conf->assoc) { | 303 | if (bss_conf->assoc) { |
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c index 126a4eab35f3..1676a3e3dc3d 100644 --- a/drivers/net/wireless/ath/ath5k/reset.c +++ b/drivers/net/wireless/ath/ath5k/reset.c | |||
@@ -375,19 +375,19 @@ static int ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val) | |||
375 | static int ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) | 375 | static int ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) |
376 | { | 376 | { |
377 | u32 mask = flags ? flags : ~0U; | 377 | u32 mask = flags ? flags : ~0U; |
378 | volatile u32 *reg; | 378 | volatile __iomem u32 *reg; |
379 | u32 regval; | 379 | u32 regval; |
380 | u32 val = 0; | 380 | u32 val = 0; |
381 | 381 | ||
382 | /* ah->ah_mac_srev is not available at this point yet */ | 382 | /* ah->ah_mac_srev is not available at this point yet */ |
383 | if (ah->ah_sc->devid >= AR5K_SREV_AR2315_R6) { | 383 | if (ah->ah_sc->devid >= AR5K_SREV_AR2315_R6) { |
384 | reg = (u32 *) AR5K_AR2315_RESET; | 384 | reg = (u32 __iomem *) AR5K_AR2315_RESET; |
385 | if (mask & AR5K_RESET_CTL_PCU) | 385 | if (mask & AR5K_RESET_CTL_PCU) |
386 | val |= AR5K_AR2315_RESET_WMAC; | 386 | val |= AR5K_AR2315_RESET_WMAC; |
387 | if (mask & AR5K_RESET_CTL_BASEBAND) | 387 | if (mask & AR5K_RESET_CTL_BASEBAND) |
388 | val |= AR5K_AR2315_RESET_BB_WARM; | 388 | val |= AR5K_AR2315_RESET_BB_WARM; |
389 | } else { | 389 | } else { |
390 | reg = (u32 *) AR5K_AR5312_RESET; | 390 | reg = (u32 __iomem *) AR5K_AR5312_RESET; |
391 | if (to_platform_device(ah->ah_sc->dev)->id == 0) { | 391 | if (to_platform_device(ah->ah_sc->dev)->id == 0) { |
392 | if (mask & AR5K_RESET_CTL_PCU) | 392 | if (mask & AR5K_RESET_CTL_PCU) |
393 | val |= AR5K_AR5312_RESET_WMAC0; | 393 | val |= AR5K_AR5312_RESET_WMAC0; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index ff8150e46f0e..2e370c668d4e 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -1461,7 +1461,7 @@ static const struct ar9300_eeprom ar9300_h112 = { | |||
1461 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, | 1461 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
1462 | { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, | 1462 | { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, |
1463 | 1463 | ||
1464 | { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, | 1464 | { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } }, |
1465 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, | 1465 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
1466 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, | 1466 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
1467 | 1467 | ||
@@ -2616,7 +2616,7 @@ static const struct ar9300_eeprom ar9300_h116 = { | |||
2616 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, | 2616 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
2617 | { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, | 2617 | { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, |
2618 | 2618 | ||
2619 | { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, | 2619 | { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } }, |
2620 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, | 2620 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
2621 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, | 2621 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
2622 | 2622 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c index 2e7f0f2567eb..fc9c08f513cf 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c | |||
@@ -785,7 +785,26 @@ EXPORT_SYMBOL(ar9003_paprd_init_table); | |||
785 | 785 | ||
786 | bool ar9003_paprd_is_done(struct ath_hw *ah) | 786 | bool ar9003_paprd_is_done(struct ath_hw *ah) |
787 | { | 787 | { |
788 | return !!REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1, | 788 | int paprd_done, agc2_pwr; |
789 | paprd_done = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1, | ||
789 | AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); | 790 | AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); |
791 | |||
792 | if (paprd_done == 0x1) { | ||
793 | agc2_pwr = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1, | ||
794 | AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR); | ||
795 | |||
796 | ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, | ||
797 | "AGC2_PWR = 0x%x training done = 0x%x\n", | ||
798 | agc2_pwr, paprd_done); | ||
799 | /* | ||
800 | * agc2_pwr range should not be less than 'IDEAL_AGC2_PWR_CHANGE' | ||
801 | * when the training is completely done, otherwise retraining is | ||
802 | * done to make sure the value is in ideal range | ||
803 | */ | ||
804 | if (agc2_pwr <= PAPRD_IDEAL_AGC2_PWR_RANGE) | ||
805 | paprd_done = 0; | ||
806 | } | ||
807 | |||
808 | return !!paprd_done; | ||
790 | } | 809 | } |
791 | EXPORT_SYMBOL(ar9003_paprd_is_done); | 810 | EXPORT_SYMBOL(ar9003_paprd_is_done); |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 3bf1d83ab41f..56a0ac4ddc62 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -54,8 +54,6 @@ struct ath_node; | |||
54 | (_l) &= ((_sz) - 1); \ | 54 | (_l) &= ((_sz) - 1); \ |
55 | } while (0) | 55 | } while (0) |
56 | 56 | ||
57 | #define A_MAX(a, b) ((a) > (b) ? (a) : (b)) | ||
58 | |||
59 | #define TSF_TO_TU(_h,_l) \ | 57 | #define TSF_TO_TU(_h,_l) \ |
60 | ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) | 58 | ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) |
61 | 59 | ||
@@ -579,7 +577,7 @@ struct ath9k_vif_iter_data { | |||
579 | int naps; /* number of AP vifs */ | 577 | int naps; /* number of AP vifs */ |
580 | int nmeshes; /* number of mesh vifs */ | 578 | int nmeshes; /* number of mesh vifs */ |
581 | int nstations; /* number of station vifs */ | 579 | int nstations; /* number of station vifs */ |
582 | int nwds; /* number of nwd vifs */ | 580 | int nwds; /* number of WDS vifs */ |
583 | int nadhocs; /* number of adhoc vifs */ | 581 | int nadhocs; /* number of adhoc vifs */ |
584 | int nothers; /* number of vifs not specified above. */ | 582 | int nothers; /* number of vifs not specified above. */ |
585 | }; | 583 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 6a6fb5439831..66d2225b95f3 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -157,8 +157,9 @@ | |||
157 | #define ATH9K_HW_RX_HP_QDEPTH 16 | 157 | #define ATH9K_HW_RX_HP_QDEPTH 16 |
158 | #define ATH9K_HW_RX_LP_QDEPTH 128 | 158 | #define ATH9K_HW_RX_LP_QDEPTH 128 |
159 | 159 | ||
160 | #define PAPRD_GAIN_TABLE_ENTRIES 32 | 160 | #define PAPRD_GAIN_TABLE_ENTRIES 32 |
161 | #define PAPRD_TABLE_SZ 24 | 161 | #define PAPRD_TABLE_SZ 24 |
162 | #define PAPRD_IDEAL_AGC2_PWR_RANGE 0xe0 | ||
162 | 163 | ||
163 | enum ath_hw_txq_subtype { | 164 | enum ath_hw_txq_subtype { |
164 | ATH_TXQ_AC_BE = 0, | 165 | ATH_TXQ_AC_BE = 0, |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 7f945333e2d8..5ae303b11e68 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -360,7 +360,7 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int | |||
360 | txctl.paprd = BIT(chain); | 360 | txctl.paprd = BIT(chain); |
361 | 361 | ||
362 | if (ath_tx_start(hw, skb, &txctl) != 0) { | 362 | if (ath_tx_start(hw, skb, &txctl) != 0) { |
363 | ath_dbg(common, ATH_DBG_XMIT, "PAPRD TX failed\n"); | 363 | ath_dbg(common, ATH_DBG_CALIBRATE, "PAPRD TX failed\n"); |
364 | dev_kfree_skb_any(skb); | 364 | dev_kfree_skb_any(skb); |
365 | return false; | 365 | return false; |
366 | } | 366 | } |
@@ -369,7 +369,7 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int | |||
369 | msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); | 369 | msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); |
370 | 370 | ||
371 | if (!time_left) | 371 | if (!time_left) |
372 | ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CALIBRATE, | 372 | ath_dbg(common, ATH_DBG_CALIBRATE, |
373 | "Timeout waiting for paprd training on TX chain %d\n", | 373 | "Timeout waiting for paprd training on TX chain %d\n", |
374 | chain); | 374 | chain); |
375 | 375 | ||
@@ -431,11 +431,18 @@ void ath_paprd_calibrate(struct work_struct *work) | |||
431 | if (!ath_paprd_send_frame(sc, skb, chain)) | 431 | if (!ath_paprd_send_frame(sc, skb, chain)) |
432 | goto fail_paprd; | 432 | goto fail_paprd; |
433 | 433 | ||
434 | if (!ar9003_paprd_is_done(ah)) | 434 | if (!ar9003_paprd_is_done(ah)) { |
435 | ath_dbg(common, ATH_DBG_CALIBRATE, | ||
436 | "PAPRD not yet done on chain %d\n", chain); | ||
435 | break; | 437 | break; |
438 | } | ||
436 | 439 | ||
437 | if (ar9003_paprd_create_curve(ah, caldata, chain) != 0) | 440 | if (ar9003_paprd_create_curve(ah, caldata, chain)) { |
441 | ath_dbg(common, ATH_DBG_CALIBRATE, | ||
442 | "PAPRD create curve failed on chain %d\n", | ||
443 | chain); | ||
438 | break; | 444 | break; |
445 | } | ||
439 | 446 | ||
440 | chain_ok = 1; | 447 | chain_ok = 1; |
441 | } | 448 | } |
@@ -1259,7 +1266,6 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
1259 | 1266 | ||
1260 | /* disable HAL and put h/w to sleep */ | 1267 | /* disable HAL and put h/w to sleep */ |
1261 | ath9k_hw_disable(ah); | 1268 | ath9k_hw_disable(ah); |
1262 | ath9k_hw_configpcipowersave(ah, 1, 1); | ||
1263 | 1269 | ||
1264 | spin_unlock_bh(&sc->sc_pcu_lock); | 1270 | spin_unlock_bh(&sc->sc_pcu_lock); |
1265 | 1271 | ||
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index ba7f36ab0a74..e7fe4d9aee79 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -533,7 +533,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, | |||
533 | [valid_rate_count] = j; | 533 | [valid_rate_count] = j; |
534 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; | 534 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; |
535 | ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1); | 535 | ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1); |
536 | hi = A_MAX(hi, j); | 536 | hi = max(hi, j); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | } | 539 | } |
@@ -569,7 +569,7 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv, | |||
569 | [ath_rc_priv->valid_phy_ratecnt[phy]] = j; | 569 | [ath_rc_priv->valid_phy_ratecnt[phy]] = j; |
570 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; | 570 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; |
571 | ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1); | 571 | ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1); |
572 | hi = A_MAX(hi, j); | 572 | hi = max(hi, j); |
573 | } | 573 | } |
574 | } | 574 | } |
575 | 575 | ||
@@ -1228,7 +1228,7 @@ static void ath_rc_init(struct ath_softc *sc, | |||
1228 | ht_mcs, | 1228 | ht_mcs, |
1229 | ath_rc_priv->ht_cap); | 1229 | ath_rc_priv->ht_cap); |
1230 | } | 1230 | } |
1231 | hi = A_MAX(hi, hthi); | 1231 | hi = max(hi, hthi); |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | ath_rc_priv->rate_table_size = hi + 1; | 1234 | ath_rc_priv->rate_table_size = hi + 1; |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index fe26bf448fdb..d5add69aac8f 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -31,6 +31,11 @@ config B43_BCMA | |||
31 | depends on B43 && BCMA && BROKEN | 31 | depends on B43 && BCMA && BROKEN |
32 | default y | 32 | default y |
33 | 33 | ||
34 | config B43_SSB | ||
35 | bool | ||
36 | depends on B43 && SSB | ||
37 | default y | ||
38 | |||
34 | # Auto-select SSB PCI-HOST support, if possible | 39 | # Auto-select SSB PCI-HOST support, if possible |
35 | config B43_PCI_AUTOSELECT | 40 | config B43_PCI_AUTOSELECT |
36 | bool | 41 | bool |
@@ -112,6 +117,14 @@ config B43_PHY_LP | |||
112 | and embedded devices. It supports 802.11a/g | 117 | and embedded devices. It supports 802.11a/g |
113 | (802.11a support is optional, and currently disabled). | 118 | (802.11a support is optional, and currently disabled). |
114 | 119 | ||
120 | config B43_PHY_HT | ||
121 | bool "Support for HT-PHY devices (BROKEN)" | ||
122 | depends on B43 && BROKEN | ||
123 | ---help--- | ||
124 | Support for the HT-PHY. | ||
125 | |||
126 | Say N, this is BROKEN and crashes driver. | ||
127 | |||
115 | # This config option automatically enables b43 LEDS support, | 128 | # This config option automatically enables b43 LEDS support, |
116 | # if it's possible. | 129 | # if it's possible. |
117 | config B43_LEDS | 130 | config B43_LEDS |
diff --git a/drivers/net/wireless/b43/Makefile b/drivers/net/wireless/b43/Makefile index 95f7c001fda1..58d614a889b9 100644 --- a/drivers/net/wireless/b43/Makefile +++ b/drivers/net/wireless/b43/Makefile | |||
@@ -10,6 +10,7 @@ b43-y += phy_a.o | |||
10 | b43-$(CONFIG_B43_PHY_N) += phy_n.o | 10 | b43-$(CONFIG_B43_PHY_N) += phy_n.o |
11 | b43-$(CONFIG_B43_PHY_LP) += phy_lp.o | 11 | b43-$(CONFIG_B43_PHY_LP) += phy_lp.o |
12 | b43-$(CONFIG_B43_PHY_LP) += tables_lpphy.o | 12 | b43-$(CONFIG_B43_PHY_LP) += tables_lpphy.o |
13 | b43-$(CONFIG_B43_PHY_HT) += phy_ht.o | ||
13 | b43-y += sysfs.o | 14 | b43-y += sysfs.o |
14 | b43-y += xmit.o | 15 | b43-y += xmit.o |
15 | b43-y += lo.o | 16 | b43-y += lo.o |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 1cb2ddee9dcf..666515e348b5 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -92,6 +92,8 @@ | |||
92 | #define B43_MMIO_PIO11_BASE4 0x300 | 92 | #define B43_MMIO_PIO11_BASE4 0x300 |
93 | #define B43_MMIO_PIO11_BASE5 0x340 | 93 | #define B43_MMIO_PIO11_BASE5 0x340 |
94 | 94 | ||
95 | #define B43_MMIO_RADIO24_CONTROL 0x3D8 /* core rev >= 24 only */ | ||
96 | #define B43_MMIO_RADIO24_DATA 0x3DA /* core rev >= 24 only */ | ||
95 | #define B43_MMIO_PHY_VER 0x3E0 | 97 | #define B43_MMIO_PHY_VER 0x3E0 |
96 | #define B43_MMIO_PHY_RADIO 0x3E2 | 98 | #define B43_MMIO_PHY_RADIO 0x3E2 |
97 | #define B43_MMIO_PHY0 0x3E6 | 99 | #define B43_MMIO_PHY0 0x3E6 |
@@ -363,6 +365,10 @@ enum { | |||
363 | #define B43_PHYTYPE_G 0x02 | 365 | #define B43_PHYTYPE_G 0x02 |
364 | #define B43_PHYTYPE_N 0x04 | 366 | #define B43_PHYTYPE_N 0x04 |
365 | #define B43_PHYTYPE_LP 0x05 | 367 | #define B43_PHYTYPE_LP 0x05 |
368 | #define B43_PHYTYPE_SSLPN 0x06 | ||
369 | #define B43_PHYTYPE_HT 0x07 | ||
370 | #define B43_PHYTYPE_LCN 0x08 | ||
371 | #define B43_PHYTYPE_LCNXN 0x09 | ||
366 | 372 | ||
367 | /* PHYRegisters */ | 373 | /* PHYRegisters */ |
368 | #define B43_PHY_ILT_A_CTRL 0x0072 | 374 | #define B43_PHY_ILT_A_CTRL 0x0072 |
diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c index 6c63aecd6ab4..4200713eb597 100644 --- a/drivers/net/wireless/b43/bus.c +++ b/drivers/net/wireless/b43/bus.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | 26 | ||
27 | /* SSB */ | 27 | /* SSB */ |
28 | 28 | #ifdef CONFIG_B43_SSB | |
29 | static inline int b43_bus_ssb_bus_may_powerdown(struct b43_bus_dev *dev) | 29 | static inline int b43_bus_ssb_bus_may_powerdown(struct b43_bus_dev *dev) |
30 | { | 30 | { |
31 | return ssb_bus_may_powerdown(dev->sdev->bus); | 31 | return ssb_bus_may_powerdown(dev->sdev->bus); |
@@ -83,7 +83,11 @@ void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer, | |||
83 | 83 | ||
84 | struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) | 84 | struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) |
85 | { | 85 | { |
86 | struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 86 | struct b43_bus_dev *dev; |
87 | |||
88 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
89 | if (!dev) | ||
90 | return NULL; | ||
87 | 91 | ||
88 | dev->bus_type = B43_BUS_SSB; | 92 | dev->bus_type = B43_BUS_SSB; |
89 | dev->sdev = sdev; | 93 | dev->sdev = sdev; |
@@ -120,3 +124,4 @@ struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) | |||
120 | 124 | ||
121 | return dev; | 125 | return dev; |
122 | } | 126 | } |
127 | #endif /* CONFIG_B43_SSB */ | ||
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 1d8d98324d15..834df5a3fb6a 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -123,6 +123,7 @@ static const struct bcma_device_id b43_bcma_tbl[] = { | |||
123 | MODULE_DEVICE_TABLE(bcma, b43_bcma_tbl); | 123 | MODULE_DEVICE_TABLE(bcma, b43_bcma_tbl); |
124 | #endif | 124 | #endif |
125 | 125 | ||
126 | #ifdef CONFIG_B43_SSB | ||
126 | static const struct ssb_device_id b43_ssb_tbl[] = { | 127 | static const struct ssb_device_id b43_ssb_tbl[] = { |
127 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5), | 128 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5), |
128 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 6), | 129 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 6), |
@@ -136,8 +137,8 @@ static const struct ssb_device_id b43_ssb_tbl[] = { | |||
136 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 16), | 137 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 16), |
137 | SSB_DEVTABLE_END | 138 | SSB_DEVTABLE_END |
138 | }; | 139 | }; |
139 | |||
140 | MODULE_DEVICE_TABLE(ssb, b43_ssb_tbl); | 140 | MODULE_DEVICE_TABLE(ssb, b43_ssb_tbl); |
141 | #endif | ||
141 | 142 | ||
142 | /* Channel and ratetables are shared for all devices. | 143 | /* Channel and ratetables are shared for all devices. |
143 | * They can't be const, because ieee80211 puts some precalculated | 144 | * They can't be const, because ieee80211 puts some precalculated |
@@ -4097,6 +4098,12 @@ static int b43_phy_versioning(struct b43_wldev *dev) | |||
4097 | unsupported = 1; | 4098 | unsupported = 1; |
4098 | break; | 4099 | break; |
4099 | #endif | 4100 | #endif |
4101 | #ifdef CONFIG_B43_PHY_HT | ||
4102 | case B43_PHYTYPE_HT: | ||
4103 | if (phy_rev > 1) | ||
4104 | unsupported = 1; | ||
4105 | break; | ||
4106 | #endif | ||
4100 | default: | 4107 | default: |
4101 | unsupported = 1; | 4108 | unsupported = 1; |
4102 | }; | 4109 | }; |
@@ -4153,6 +4160,10 @@ static int b43_phy_versioning(struct b43_wldev *dev) | |||
4153 | if (radio_ver != 0x2062 && radio_ver != 0x2063) | 4160 | if (radio_ver != 0x2062 && radio_ver != 0x2063) |
4154 | unsupported = 1; | 4161 | unsupported = 1; |
4155 | break; | 4162 | break; |
4163 | case B43_PHYTYPE_HT: | ||
4164 | if (radio_ver != 0x2059) | ||
4165 | unsupported = 1; | ||
4166 | break; | ||
4156 | default: | 4167 | default: |
4157 | B43_WARN_ON(1); | 4168 | B43_WARN_ON(1); |
4158 | } | 4169 | } |
@@ -5016,6 +5027,7 @@ static struct bcma_driver b43_bcma_driver = { | |||
5016 | }; | 5027 | }; |
5017 | #endif | 5028 | #endif |
5018 | 5029 | ||
5030 | #ifdef CONFIG_B43_SSB | ||
5019 | static | 5031 | static |
5020 | int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) | 5032 | int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) |
5021 | { | 5033 | { |
@@ -5025,6 +5037,8 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) | |||
5025 | int first = 0; | 5037 | int first = 0; |
5026 | 5038 | ||
5027 | dev = b43_bus_dev_ssb_init(sdev); | 5039 | dev = b43_bus_dev_ssb_init(sdev); |
5040 | if (!dev) | ||
5041 | return -ENOMEM; | ||
5028 | 5042 | ||
5029 | wl = ssb_get_devtypedata(sdev); | 5043 | wl = ssb_get_devtypedata(sdev); |
5030 | if (!wl) { | 5044 | if (!wl) { |
@@ -5091,6 +5105,14 @@ static void b43_ssb_remove(struct ssb_device *sdev) | |||
5091 | } | 5105 | } |
5092 | } | 5106 | } |
5093 | 5107 | ||
5108 | static struct ssb_driver b43_ssb_driver = { | ||
5109 | .name = KBUILD_MODNAME, | ||
5110 | .id_table = b43_ssb_tbl, | ||
5111 | .probe = b43_ssb_probe, | ||
5112 | .remove = b43_ssb_remove, | ||
5113 | }; | ||
5114 | #endif /* CONFIG_B43_SSB */ | ||
5115 | |||
5094 | /* Perform a hardware reset. This can be called from any context. */ | 5116 | /* Perform a hardware reset. This can be called from any context. */ |
5095 | void b43_controller_restart(struct b43_wldev *dev, const char *reason) | 5117 | void b43_controller_restart(struct b43_wldev *dev, const char *reason) |
5096 | { | 5118 | { |
@@ -5101,13 +5123,6 @@ void b43_controller_restart(struct b43_wldev *dev, const char *reason) | |||
5101 | ieee80211_queue_work(dev->wl->hw, &dev->restart_work); | 5123 | ieee80211_queue_work(dev->wl->hw, &dev->restart_work); |
5102 | } | 5124 | } |
5103 | 5125 | ||
5104 | static struct ssb_driver b43_ssb_driver = { | ||
5105 | .name = KBUILD_MODNAME, | ||
5106 | .id_table = b43_ssb_tbl, | ||
5107 | .probe = b43_ssb_probe, | ||
5108 | .remove = b43_ssb_remove, | ||
5109 | }; | ||
5110 | |||
5111 | static void b43_print_driverinfo(void) | 5126 | static void b43_print_driverinfo(void) |
5112 | { | 5127 | { |
5113 | const char *feat_pci = "", *feat_pcmcia = "", *feat_nphy = "", | 5128 | const char *feat_pci = "", *feat_pcmcia = "", *feat_nphy = "", |
@@ -5151,14 +5166,18 @@ static int __init b43_init(void) | |||
5151 | if (err) | 5166 | if (err) |
5152 | goto err_sdio_exit; | 5167 | goto err_sdio_exit; |
5153 | #endif | 5168 | #endif |
5169 | #ifdef CONFIG_B43_SSB | ||
5154 | err = ssb_driver_register(&b43_ssb_driver); | 5170 | err = ssb_driver_register(&b43_ssb_driver); |
5155 | if (err) | 5171 | if (err) |
5156 | goto err_bcma_driver_exit; | 5172 | goto err_bcma_driver_exit; |
5173 | #endif | ||
5157 | b43_print_driverinfo(); | 5174 | b43_print_driverinfo(); |
5158 | 5175 | ||
5159 | return err; | 5176 | return err; |
5160 | 5177 | ||
5178 | #ifdef CONFIG_B43_SSB | ||
5161 | err_bcma_driver_exit: | 5179 | err_bcma_driver_exit: |
5180 | #endif | ||
5162 | #ifdef CONFIG_B43_BCMA | 5181 | #ifdef CONFIG_B43_BCMA |
5163 | bcma_driver_unregister(&b43_bcma_driver); | 5182 | bcma_driver_unregister(&b43_bcma_driver); |
5164 | err_sdio_exit: | 5183 | err_sdio_exit: |
@@ -5173,7 +5192,9 @@ err_dfs_exit: | |||
5173 | 5192 | ||
5174 | static void __exit b43_exit(void) | 5193 | static void __exit b43_exit(void) |
5175 | { | 5194 | { |
5195 | #ifdef CONFIG_B43_SSB | ||
5176 | ssb_driver_unregister(&b43_ssb_driver); | 5196 | ssb_driver_unregister(&b43_ssb_driver); |
5197 | #endif | ||
5177 | #ifdef CONFIG_B43_BCMA | 5198 | #ifdef CONFIG_B43_BCMA |
5178 | bcma_driver_unregister(&b43_bcma_driver); | 5199 | bcma_driver_unregister(&b43_bcma_driver); |
5179 | #endif | 5200 | #endif |
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index 425af28ea4e5..9705950f059a 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "phy_a.h" | 31 | #include "phy_a.h" |
32 | #include "phy_n.h" | 32 | #include "phy_n.h" |
33 | #include "phy_lp.h" | 33 | #include "phy_lp.h" |
34 | #include "phy_ht.h" | ||
34 | #include "b43.h" | 35 | #include "b43.h" |
35 | #include "main.h" | 36 | #include "main.h" |
36 | 37 | ||
@@ -59,6 +60,11 @@ int b43_phy_allocate(struct b43_wldev *dev) | |||
59 | phy->ops = &b43_phyops_lp; | 60 | phy->ops = &b43_phyops_lp; |
60 | #endif | 61 | #endif |
61 | break; | 62 | break; |
63 | case B43_PHYTYPE_HT: | ||
64 | #ifdef CONFIG_B43_PHY_HT | ||
65 | phy->ops = &b43_phyops_ht; | ||
66 | #endif | ||
67 | break; | ||
62 | } | 68 | } |
63 | if (B43_WARN_ON(!phy->ops)) | 69 | if (B43_WARN_ON(!phy->ops)) |
64 | return -ENODEV; | 70 | return -ENODEV; |
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h index 2401bee8b081..47dcb800a3c3 100644 --- a/drivers/net/wireless/b43/phy_common.h +++ b/drivers/net/wireless/b43/phy_common.h | |||
@@ -194,6 +194,7 @@ struct b43_phy_a; | |||
194 | struct b43_phy_g; | 194 | struct b43_phy_g; |
195 | struct b43_phy_n; | 195 | struct b43_phy_n; |
196 | struct b43_phy_lp; | 196 | struct b43_phy_lp; |
197 | struct b43_phy_ht; | ||
197 | 198 | ||
198 | struct b43_phy { | 199 | struct b43_phy { |
199 | /* Hardware operation callbacks. */ | 200 | /* Hardware operation callbacks. */ |
@@ -216,6 +217,8 @@ struct b43_phy { | |||
216 | struct b43_phy_n *n; | 217 | struct b43_phy_n *n; |
217 | /* LP-PHY specific information */ | 218 | /* LP-PHY specific information */ |
218 | struct b43_phy_lp *lp; | 219 | struct b43_phy_lp *lp; |
220 | /* HT-PHY specific information */ | ||
221 | struct b43_phy_ht *ht; | ||
219 | }; | 222 | }; |
220 | 223 | ||
221 | /* Band support flags. */ | 224 | /* Band support flags. */ |
diff --git a/drivers/net/wireless/b43/phy_ht.c b/drivers/net/wireless/b43/phy_ht.c new file mode 100644 index 000000000000..5777cdbc047b --- /dev/null +++ b/drivers/net/wireless/b43/phy_ht.c | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | |||
3 | Broadcom B43 wireless driver | ||
4 | IEEE 802.11n HT-PHY support | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; see the file COPYING. If not, write to | ||
18 | the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | |||
21 | */ | ||
22 | |||
23 | #include <linux/slab.h> | ||
24 | |||
25 | #include "b43.h" | ||
26 | #include "phy_ht.h" | ||
27 | #include "main.h" | ||
28 | |||
29 | /************************************************** | ||
30 | * Basic PHY ops. | ||
31 | **************************************************/ | ||
32 | |||
33 | static int b43_phy_ht_op_allocate(struct b43_wldev *dev) | ||
34 | { | ||
35 | struct b43_phy_ht *phy_ht; | ||
36 | |||
37 | phy_ht = kzalloc(sizeof(*phy_ht), GFP_KERNEL); | ||
38 | if (!phy_ht) | ||
39 | return -ENOMEM; | ||
40 | dev->phy.ht = phy_ht; | ||
41 | |||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static void b43_phy_ht_op_prepare_structs(struct b43_wldev *dev) | ||
46 | { | ||
47 | struct b43_phy *phy = &dev->phy; | ||
48 | struct b43_phy_ht *phy_ht = phy->ht; | ||
49 | |||
50 | memset(phy_ht, 0, sizeof(*phy_ht)); | ||
51 | } | ||
52 | |||
53 | static void b43_phy_ht_op_free(struct b43_wldev *dev) | ||
54 | { | ||
55 | struct b43_phy *phy = &dev->phy; | ||
56 | struct b43_phy_ht *phy_ht = phy->ht; | ||
57 | |||
58 | kfree(phy_ht); | ||
59 | phy->ht = NULL; | ||
60 | } | ||
61 | |||
62 | static void b43_phy_ht_op_switch_analog(struct b43_wldev *dev, bool on) | ||
63 | { | ||
64 | if (on) { | ||
65 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL2, 0x00cd); | ||
66 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL1, 0x0000); | ||
67 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL4, 0x00cd); | ||
68 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL3, 0x0000); | ||
69 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL6, 0x00cd); | ||
70 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL5, 0x0000); | ||
71 | } else { | ||
72 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL1, 0x07ff); | ||
73 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL2, 0x00fd); | ||
74 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL3, 0x07ff); | ||
75 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL4, 0x00fd); | ||
76 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL5, 0x07ff); | ||
77 | b43_phy_write(dev, B43_PHY_HT_AFE_CTL6, 0x00fd); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | static unsigned int b43_phy_ht_op_get_default_chan(struct b43_wldev *dev) | ||
82 | { | ||
83 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) | ||
84 | return 1; | ||
85 | return 36; | ||
86 | } | ||
87 | |||
88 | /************************************************** | ||
89 | * R/W ops. | ||
90 | **************************************************/ | ||
91 | |||
92 | static u16 b43_phy_ht_op_read(struct b43_wldev *dev, u16 reg) | ||
93 | { | ||
94 | b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); | ||
95 | return b43_read16(dev, B43_MMIO_PHY_DATA); | ||
96 | } | ||
97 | |||
98 | static void b43_phy_ht_op_write(struct b43_wldev *dev, u16 reg, u16 value) | ||
99 | { | ||
100 | b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); | ||
101 | b43_write16(dev, B43_MMIO_PHY_DATA, value); | ||
102 | } | ||
103 | |||
104 | static void b43_phy_ht_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask, | ||
105 | u16 set) | ||
106 | { | ||
107 | b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); | ||
108 | b43_write16(dev, B43_MMIO_PHY_DATA, | ||
109 | (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set); | ||
110 | } | ||
111 | |||
112 | static u16 b43_phy_ht_op_radio_read(struct b43_wldev *dev, u16 reg) | ||
113 | { | ||
114 | /* HT-PHY needs 0x200 for read access */ | ||
115 | reg |= 0x200; | ||
116 | |||
117 | b43_write16(dev, B43_MMIO_RADIO24_CONTROL, reg); | ||
118 | return b43_read16(dev, B43_MMIO_RADIO24_DATA); | ||
119 | } | ||
120 | |||
121 | static void b43_phy_ht_op_radio_write(struct b43_wldev *dev, u16 reg, | ||
122 | u16 value) | ||
123 | { | ||
124 | b43_write16(dev, B43_MMIO_RADIO24_CONTROL, reg); | ||
125 | b43_write16(dev, B43_MMIO_RADIO24_DATA, value); | ||
126 | } | ||
127 | |||
128 | /************************************************** | ||
129 | * PHY ops struct. | ||
130 | **************************************************/ | ||
131 | |||
132 | const struct b43_phy_operations b43_phyops_ht = { | ||
133 | .allocate = b43_phy_ht_op_allocate, | ||
134 | .free = b43_phy_ht_op_free, | ||
135 | .prepare_structs = b43_phy_ht_op_prepare_structs, | ||
136 | /* | ||
137 | .init = b43_phy_ht_op_init, | ||
138 | */ | ||
139 | .phy_read = b43_phy_ht_op_read, | ||
140 | .phy_write = b43_phy_ht_op_write, | ||
141 | .phy_maskset = b43_phy_ht_op_maskset, | ||
142 | .radio_read = b43_phy_ht_op_radio_read, | ||
143 | .radio_write = b43_phy_ht_op_radio_write, | ||
144 | /* | ||
145 | .software_rfkill = b43_phy_ht_op_software_rfkill, | ||
146 | */ | ||
147 | .switch_analog = b43_phy_ht_op_switch_analog, | ||
148 | /* | ||
149 | .switch_channel = b43_phy_ht_op_switch_channel, | ||
150 | */ | ||
151 | .get_default_chan = b43_phy_ht_op_get_default_chan, | ||
152 | /* | ||
153 | .recalc_txpower = b43_phy_ht_op_recalc_txpower, | ||
154 | .adjust_txpower = b43_phy_ht_op_adjust_txpower, | ||
155 | */ | ||
156 | }; | ||
diff --git a/drivers/net/wireless/b43/phy_ht.h b/drivers/net/wireless/b43/phy_ht.h new file mode 100644 index 000000000000..84ac47cbfaad --- /dev/null +++ b/drivers/net/wireless/b43/phy_ht.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef B43_PHY_HT_H_ | ||
2 | #define B43_PHY_HT_H_ | ||
3 | |||
4 | #include "phy_common.h" | ||
5 | |||
6 | |||
7 | #define B43_PHY_HT_TABLE_ADDR 0x072 /* Table address */ | ||
8 | #define B43_PHY_HT_TABLE_DATALO 0x073 /* Table data low */ | ||
9 | #define B43_PHY_HT_TABLE_DATAHI 0x074 /* Table data high */ | ||
10 | |||
11 | #define B43_PHY_HT_AFE_CTL1 B43_PHY_EXTG(0x110) | ||
12 | #define B43_PHY_HT_AFE_CTL2 B43_PHY_EXTG(0x111) | ||
13 | #define B43_PHY_HT_AFE_CTL3 B43_PHY_EXTG(0x114) | ||
14 | #define B43_PHY_HT_AFE_CTL4 B43_PHY_EXTG(0x115) | ||
15 | #define B43_PHY_HT_AFE_CTL5 B43_PHY_EXTG(0x118) | ||
16 | #define B43_PHY_HT_AFE_CTL6 B43_PHY_EXTG(0x119) | ||
17 | |||
18 | |||
19 | struct b43_phy_ht { | ||
20 | }; | ||
21 | |||
22 | |||
23 | struct b43_phy_operations; | ||
24 | extern const struct b43_phy_operations b43_phyops_ht; | ||
25 | |||
26 | #endif /* B43_PHY_HT_H_ */ | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c index d096dc28204d..dab67a12d73b 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945.c | |||
@@ -408,7 +408,6 @@ void iwl3945_hw_rx_statistics(struct iwl_priv *priv, | |||
408 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 408 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
409 | iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); | 409 | iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); |
410 | #endif | 410 | #endif |
411 | iwl_legacy_recover_from_statistics(priv, pkt); | ||
412 | 411 | ||
413 | memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); | 412 | memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); |
414 | } | 413 | } |
@@ -2640,7 +2639,6 @@ static struct iwl_lib_ops iwl3945_lib = { | |||
2640 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, | 2639 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, |
2641 | .txq_init = iwl3945_hw_tx_queue_init, | 2640 | .txq_init = iwl3945_hw_tx_queue_init, |
2642 | .load_ucode = iwl3945_load_bsm, | 2641 | .load_ucode = iwl3945_load_bsm, |
2643 | .dump_nic_event_log = iwl3945_dump_nic_event_log, | ||
2644 | .dump_nic_error_log = iwl3945_dump_nic_error_log, | 2642 | .dump_nic_error_log = iwl3945_dump_nic_error_log, |
2645 | .apm_ops = { | 2643 | .apm_ops = { |
2646 | .init = iwl3945_apm_init, | 2644 | .init = iwl3945_apm_init, |
@@ -2698,9 +2696,7 @@ static struct iwl_base_params iwl3945_base_params = { | |||
2698 | .set_l0s = false, | 2696 | .set_l0s = false, |
2699 | .use_bsm = true, | 2697 | .use_bsm = true, |
2700 | .led_compensation = 64, | 2698 | .led_compensation = 64, |
2701 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | ||
2702 | .wd_timeout = IWL_DEF_WD_TIMEOUT, | 2699 | .wd_timeout = IWL_DEF_WD_TIMEOUT, |
2703 | .max_event_log_size = 512, | ||
2704 | }; | 2700 | }; |
2705 | 2701 | ||
2706 | static struct iwl_cfg iwl3945_bg_cfg = { | 2702 | static struct iwl_cfg iwl3945_bg_cfg = { |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c index a7a4739880dc..2be6d9e3b019 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c | |||
@@ -694,47 +694,6 @@ void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv, | |||
694 | sizeof(struct iwl_rx_phy_res)); | 694 | sizeof(struct iwl_rx_phy_res)); |
695 | } | 695 | } |
696 | 696 | ||
697 | static int iwl4965_get_single_channel_for_scan(struct iwl_priv *priv, | ||
698 | struct ieee80211_vif *vif, | ||
699 | enum ieee80211_band band, | ||
700 | struct iwl_scan_channel *scan_ch) | ||
701 | { | ||
702 | const struct ieee80211_supported_band *sband; | ||
703 | u16 passive_dwell = 0; | ||
704 | u16 active_dwell = 0; | ||
705 | int added = 0; | ||
706 | u16 channel = 0; | ||
707 | |||
708 | sband = iwl_get_hw_mode(priv, band); | ||
709 | if (!sband) { | ||
710 | IWL_ERR(priv, "invalid band\n"); | ||
711 | return added; | ||
712 | } | ||
713 | |||
714 | active_dwell = iwl_legacy_get_active_dwell_time(priv, band, 0); | ||
715 | passive_dwell = iwl_legacy_get_passive_dwell_time(priv, band, vif); | ||
716 | |||
717 | if (passive_dwell <= active_dwell) | ||
718 | passive_dwell = active_dwell + 1; | ||
719 | |||
720 | channel = iwl_legacy_get_single_channel_number(priv, band); | ||
721 | if (channel) { | ||
722 | scan_ch->channel = cpu_to_le16(channel); | ||
723 | scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; | ||
724 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | ||
725 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | ||
726 | /* Set txpower levels to defaults */ | ||
727 | scan_ch->dsp_atten = 110; | ||
728 | if (band == IEEE80211_BAND_5GHZ) | ||
729 | scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; | ||
730 | else | ||
731 | scan_ch->tx_gain = ((1 << 5) | (5 << 3)); | ||
732 | added++; | ||
733 | } else | ||
734 | IWL_ERR(priv, "no valid channel found\n"); | ||
735 | return added; | ||
736 | } | ||
737 | |||
738 | static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, | 697 | static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, |
739 | struct ieee80211_vif *vif, | 698 | struct ieee80211_vif *vif, |
740 | enum ieee80211_band band, | 699 | enum ieee80211_band band, |
@@ -858,16 +817,13 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
858 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; | 817 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; |
859 | 818 | ||
860 | if (iwl_legacy_is_any_associated(priv)) { | 819 | if (iwl_legacy_is_any_associated(priv)) { |
861 | u16 interval = 0; | 820 | u16 interval; |
862 | u32 extra; | 821 | u32 extra; |
863 | u32 suspend_time = 100; | 822 | u32 suspend_time = 100; |
864 | u32 scan_suspend_time = 100; | 823 | u32 scan_suspend_time = 100; |
865 | 824 | ||
866 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 825 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); |
867 | if (priv->is_internal_short_scan) | 826 | interval = vif->bss_conf.beacon_int; |
868 | interval = 0; | ||
869 | else | ||
870 | interval = vif->bss_conf.beacon_int; | ||
871 | 827 | ||
872 | scan->suspend_time = 0; | 828 | scan->suspend_time = 0; |
873 | scan->max_out_time = cpu_to_le32(200 * 1024); | 829 | scan->max_out_time = cpu_to_le32(200 * 1024); |
@@ -882,9 +838,7 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
882 | scan_suspend_time, interval); | 838 | scan_suspend_time, interval); |
883 | } | 839 | } |
884 | 840 | ||
885 | if (priv->is_internal_short_scan) { | 841 | if (priv->scan_request->n_ssids) { |
886 | IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); | ||
887 | } else if (priv->scan_request->n_ssids) { | ||
888 | int i, p = 0; | 842 | int i, p = 0; |
889 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); | 843 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); |
890 | for (i = 0; i < priv->scan_request->n_ssids; i++) { | 844 | for (i = 0; i < priv->scan_request->n_ssids; i++) { |
@@ -981,38 +935,21 @@ int iwl4965_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
981 | rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; | 935 | rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; |
982 | rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; | 936 | rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; |
983 | scan->rx_chain = cpu_to_le16(rx_chain); | 937 | scan->rx_chain = cpu_to_le16(rx_chain); |
984 | if (!priv->is_internal_short_scan) { | 938 | |
985 | cmd_len = iwl_legacy_fill_probe_req(priv, | 939 | cmd_len = iwl_legacy_fill_probe_req(priv, |
986 | (struct ieee80211_mgmt *)scan->data, | 940 | (struct ieee80211_mgmt *)scan->data, |
987 | vif->addr, | 941 | vif->addr, |
988 | priv->scan_request->ie, | 942 | priv->scan_request->ie, |
989 | priv->scan_request->ie_len, | 943 | priv->scan_request->ie_len, |
990 | IWL_MAX_SCAN_SIZE - sizeof(*scan)); | 944 | IWL_MAX_SCAN_SIZE - sizeof(*scan)); |
991 | } else { | ||
992 | /* use bcast addr, will not be transmitted but must be valid */ | ||
993 | cmd_len = iwl_legacy_fill_probe_req(priv, | ||
994 | (struct ieee80211_mgmt *)scan->data, | ||
995 | iwlegacy_bcast_addr, NULL, 0, | ||
996 | IWL_MAX_SCAN_SIZE - sizeof(*scan)); | ||
997 | |||
998 | } | ||
999 | scan->tx_cmd.len = cpu_to_le16(cmd_len); | 945 | scan->tx_cmd.len = cpu_to_le16(cmd_len); |
1000 | 946 | ||
1001 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | | 947 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | |
1002 | RXON_FILTER_BCON_AWARE_MSK); | 948 | RXON_FILTER_BCON_AWARE_MSK); |
1003 | 949 | ||
1004 | if (priv->is_internal_short_scan) { | 950 | scan->channel_count = iwl4965_get_channels_for_scan(priv, vif, band, |
1005 | scan->channel_count = | 951 | is_active, n_probes, |
1006 | iwl4965_get_single_channel_for_scan(priv, vif, band, | 952 | (void *)&scan->data[cmd_len]); |
1007 | (void *)&scan->data[le16_to_cpu( | ||
1008 | scan->tx_cmd.len)]); | ||
1009 | } else { | ||
1010 | scan->channel_count = | ||
1011 | iwl4965_get_channels_for_scan(priv, vif, band, | ||
1012 | is_active, n_probes, | ||
1013 | (void *)&scan->data[le16_to_cpu( | ||
1014 | scan->tx_cmd.len)]); | ||
1015 | } | ||
1016 | if (scan->channel_count == 0) { | 953 | if (scan->channel_count == 0) { |
1017 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 954 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); |
1018 | return -EIO; | 955 | return -EIO; |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c index b9fa2f6411a7..2b144bbfc3c5 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c | |||
@@ -151,81 +151,6 @@ static void iwl4965_accumulative_statistics(struct iwl_priv *priv, | |||
151 | 151 | ||
152 | #define REG_RECALIB_PERIOD (60) | 152 | #define REG_RECALIB_PERIOD (60) |
153 | 153 | ||
154 | /** | ||
155 | * iwl4965_good_plcp_health - checks for plcp error. | ||
156 | * | ||
157 | * When the plcp error is exceeding the thresholds, reset the radio | ||
158 | * to improve the throughput. | ||
159 | */ | ||
160 | bool iwl4965_good_plcp_health(struct iwl_priv *priv, | ||
161 | struct iwl_rx_packet *pkt) | ||
162 | { | ||
163 | bool rc = true; | ||
164 | int combined_plcp_delta; | ||
165 | unsigned int plcp_msec; | ||
166 | unsigned long plcp_received_jiffies; | ||
167 | |||
168 | if (priv->cfg->base_params->plcp_delta_threshold == | ||
169 | IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE) { | ||
170 | IWL_DEBUG_RADIO(priv, "plcp_err check disabled\n"); | ||
171 | return rc; | ||
172 | } | ||
173 | |||
174 | /* | ||
175 | * check for plcp_err and trigger radio reset if it exceeds | ||
176 | * the plcp error threshold plcp_delta. | ||
177 | */ | ||
178 | plcp_received_jiffies = jiffies; | ||
179 | plcp_msec = jiffies_to_msecs((long) plcp_received_jiffies - | ||
180 | (long) priv->plcp_jiffies); | ||
181 | priv->plcp_jiffies = plcp_received_jiffies; | ||
182 | /* | ||
183 | * check to make sure plcp_msec is not 0 to prevent division | ||
184 | * by zero. | ||
185 | */ | ||
186 | if (plcp_msec) { | ||
187 | struct statistics_rx_phy *ofdm; | ||
188 | struct statistics_rx_ht_phy *ofdm_ht; | ||
189 | |||
190 | ofdm = &pkt->u.stats.rx.ofdm; | ||
191 | ofdm_ht = &pkt->u.stats.rx.ofdm_ht; | ||
192 | combined_plcp_delta = | ||
193 | (le32_to_cpu(ofdm->plcp_err) - | ||
194 | le32_to_cpu(priv->_4965.statistics. | ||
195 | rx.ofdm.plcp_err)) + | ||
196 | (le32_to_cpu(ofdm_ht->plcp_err) - | ||
197 | le32_to_cpu(priv->_4965.statistics. | ||
198 | rx.ofdm_ht.plcp_err)); | ||
199 | |||
200 | if ((combined_plcp_delta > 0) && | ||
201 | ((combined_plcp_delta * 100) / plcp_msec) > | ||
202 | priv->cfg->base_params->plcp_delta_threshold) { | ||
203 | /* | ||
204 | * if plcp_err exceed the threshold, | ||
205 | * the following data is printed in csv format: | ||
206 | * Text: plcp_err exceeded %d, | ||
207 | * Received ofdm.plcp_err, | ||
208 | * Current ofdm.plcp_err, | ||
209 | * Received ofdm_ht.plcp_err, | ||
210 | * Current ofdm_ht.plcp_err, | ||
211 | * combined_plcp_delta, | ||
212 | * plcp_msec | ||
213 | */ | ||
214 | IWL_DEBUG_RADIO(priv, "plcp_err exceeded %u, " | ||
215 | "%u, %u, %u, %u, %d, %u mSecs\n", | ||
216 | priv->cfg->base_params->plcp_delta_threshold, | ||
217 | le32_to_cpu(ofdm->plcp_err), | ||
218 | le32_to_cpu(ofdm->plcp_err), | ||
219 | le32_to_cpu(ofdm_ht->plcp_err), | ||
220 | le32_to_cpu(ofdm_ht->plcp_err), | ||
221 | combined_plcp_delta, plcp_msec); | ||
222 | |||
223 | rc = false; | ||
224 | } | ||
225 | } | ||
226 | return rc; | ||
227 | } | ||
228 | |||
229 | void iwl4965_rx_statistics(struct iwl_priv *priv, | 154 | void iwl4965_rx_statistics(struct iwl_priv *priv, |
230 | struct iwl_rx_mem_buffer *rxb) | 155 | struct iwl_rx_mem_buffer *rxb) |
231 | { | 156 | { |
@@ -248,8 +173,7 @@ void iwl4965_rx_statistics(struct iwl_priv *priv, | |||
248 | iwl4965_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); | 173 | iwl4965_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); |
249 | #endif | 174 | #endif |
250 | 175 | ||
251 | iwl_legacy_recover_from_statistics(priv, pkt); | 176 | /* TODO: reading some of statistics is unneeded */ |
252 | |||
253 | memcpy(&priv->_4965.statistics, &pkt->u.stats, | 177 | memcpy(&priv->_4965.statistics, &pkt->u.stats, |
254 | sizeof(priv->_4965.statistics)); | 178 | sizeof(priv->_4965.statistics)); |
255 | 179 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c index 3a022bcf615c..bd4b000733f7 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965.c | |||
@@ -1216,10 +1216,10 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c | |||
1216 | * receive commit_rxon request | 1216 | * receive commit_rxon request |
1217 | * abort any previous channel switch if still in process | 1217 | * abort any previous channel switch if still in process |
1218 | */ | 1218 | */ |
1219 | if (priv->switch_rxon.switch_in_progress && | 1219 | if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && |
1220 | (priv->switch_rxon.channel != ctx->staging.channel)) { | 1220 | (priv->switch_channel != ctx->staging.channel)) { |
1221 | IWL_DEBUG_11H(priv, "abort channel switch on %d\n", | 1221 | IWL_DEBUG_11H(priv, "abort channel switch on %d\n", |
1222 | le16_to_cpu(priv->switch_rxon.channel)); | 1222 | le16_to_cpu(priv->switch_channel)); |
1223 | iwl_legacy_chswitch_done(priv, false); | 1223 | iwl_legacy_chswitch_done(priv, false); |
1224 | } | 1224 | } |
1225 | 1225 | ||
@@ -1402,9 +1402,6 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, | |||
1402 | return rc; | 1402 | return rc; |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | priv->switch_rxon.channel = cmd.channel; | ||
1406 | priv->switch_rxon.switch_in_progress = true; | ||
1407 | |||
1408 | return iwl_legacy_send_cmd_pdu(priv, | 1405 | return iwl_legacy_send_cmd_pdu(priv, |
1409 | REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); | 1406 | REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); |
1410 | } | 1407 | } |
@@ -2072,7 +2069,6 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2072 | .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, | 2069 | .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, |
2073 | .init_alive_start = iwl4965_init_alive_start, | 2070 | .init_alive_start = iwl4965_init_alive_start, |
2074 | .load_ucode = iwl4965_load_bsm, | 2071 | .load_ucode = iwl4965_load_bsm, |
2075 | .dump_nic_event_log = iwl4965_dump_nic_event_log, | ||
2076 | .dump_nic_error_log = iwl4965_dump_nic_error_log, | 2072 | .dump_nic_error_log = iwl4965_dump_nic_error_log, |
2077 | .dump_fh = iwl4965_dump_fh, | 2073 | .dump_fh = iwl4965_dump_fh, |
2078 | .set_channel_switch = iwl4965_hw_channel_switch, | 2074 | .set_channel_switch = iwl4965_hw_channel_switch, |
@@ -2103,7 +2099,6 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2103 | .tx_stats_read = iwl4965_ucode_tx_stats_read, | 2099 | .tx_stats_read = iwl4965_ucode_tx_stats_read, |
2104 | .general_stats_read = iwl4965_ucode_general_stats_read, | 2100 | .general_stats_read = iwl4965_ucode_general_stats_read, |
2105 | }, | 2101 | }, |
2106 | .check_plcp_health = iwl4965_good_plcp_health, | ||
2107 | }; | 2102 | }; |
2108 | 2103 | ||
2109 | static const struct iwl_legacy_ops iwl4965_legacy_ops = { | 2104 | static const struct iwl_legacy_ops iwl4965_legacy_ops = { |
@@ -2153,10 +2148,8 @@ static struct iwl_base_params iwl4965_base_params = { | |||
2153 | .use_bsm = true, | 2148 | .use_bsm = true, |
2154 | .led_compensation = 61, | 2149 | .led_compensation = 61, |
2155 | .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, | 2150 | .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, |
2156 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | ||
2157 | .wd_timeout = IWL_DEF_WD_TIMEOUT, | 2151 | .wd_timeout = IWL_DEF_WD_TIMEOUT, |
2158 | .temperature_kelvin = true, | 2152 | .temperature_kelvin = true, |
2159 | .max_event_log_size = 512, | ||
2160 | .ucode_tracing = true, | 2153 | .ucode_tracing = true, |
2161 | .sensitivity_calib_by_driver = true, | 2154 | .sensitivity_calib_by_driver = true, |
2162 | .chain_noise_calib_by_driver = true, | 2155 | .chain_noise_calib_by_driver = true, |
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h index 17a1d504348e..ee21210bea9c 100644 --- a/drivers/net/wireless/iwlegacy/iwl-commands.h +++ b/drivers/net/wireless/iwlegacy/iwl-commands.h | |||
@@ -2297,14 +2297,7 @@ struct iwl_spectrum_notification { | |||
2297 | #define IWL_POWER_VEC_SIZE 5 | 2297 | #define IWL_POWER_VEC_SIZE 5 |
2298 | 2298 | ||
2299 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) | 2299 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) |
2300 | #define IWL_POWER_POWER_SAVE_ENA_MSK cpu_to_le16(BIT(0)) | ||
2301 | #define IWL_POWER_POWER_MANAGEMENT_ENA_MSK cpu_to_le16(BIT(1)) | ||
2302 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2)) | ||
2303 | #define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) | 2300 | #define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) |
2304 | #define IWL_POWER_FAST_PD cpu_to_le16(BIT(4)) | ||
2305 | #define IWL_POWER_BEACON_FILTERING cpu_to_le16(BIT(5)) | ||
2306 | #define IWL_POWER_SHADOW_REG_ENA cpu_to_le16(BIT(6)) | ||
2307 | #define IWL_POWER_CT_KILL_SET cpu_to_le16(BIT(7)) | ||
2308 | 2301 | ||
2309 | struct iwl3945_powertable_cmd { | 2302 | struct iwl3945_powertable_cmd { |
2310 | __le16 flags; | 2303 | __le16 flags; |
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c index 42df8321dae8..35cd2537e7fd 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.c +++ b/drivers/net/wireless/iwlegacy/iwl-core.c | |||
@@ -859,12 +859,8 @@ void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success) | |||
859 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 859 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
860 | return; | 860 | return; |
861 | 861 | ||
862 | if (priv->switch_rxon.switch_in_progress) { | 862 | if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) |
863 | ieee80211_chswitch_done(ctx->vif, is_success); | 863 | ieee80211_chswitch_done(ctx->vif, is_success); |
864 | mutex_lock(&priv->mutex); | ||
865 | priv->switch_rxon.switch_in_progress = false; | ||
866 | mutex_unlock(&priv->mutex); | ||
867 | } | ||
868 | } | 864 | } |
869 | EXPORT_SYMBOL(iwl_legacy_chswitch_done); | 865 | EXPORT_SYMBOL(iwl_legacy_chswitch_done); |
870 | 866 | ||
@@ -876,19 +872,19 @@ void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
876 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | 872 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; |
877 | struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active; | 873 | struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active; |
878 | 874 | ||
879 | if (priv->switch_rxon.switch_in_progress) { | 875 | if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) |
880 | if (!le32_to_cpu(csa->status) && | 876 | return; |
881 | (csa->channel == priv->switch_rxon.channel)) { | 877 | |
882 | rxon->channel = csa->channel; | 878 | if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { |
883 | ctx->staging.channel = csa->channel; | 879 | rxon->channel = csa->channel; |
884 | IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", | 880 | ctx->staging.channel = csa->channel; |
885 | le16_to_cpu(csa->channel)); | 881 | IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", |
886 | iwl_legacy_chswitch_done(priv, true); | ||
887 | } else { | ||
888 | IWL_ERR(priv, "CSA notif (fail) : channel %d\n", | ||
889 | le16_to_cpu(csa->channel)); | 882 | le16_to_cpu(csa->channel)); |
890 | iwl_legacy_chswitch_done(priv, false); | 883 | iwl_legacy_chswitch_done(priv, true); |
891 | } | 884 | } else { |
885 | IWL_ERR(priv, "CSA notif (fail) : channel %d\n", | ||
886 | le16_to_cpu(csa->channel)); | ||
887 | iwl_legacy_chswitch_done(priv, false); | ||
892 | } | 888 | } |
893 | } | 889 | } |
894 | EXPORT_SYMBOL(iwl_legacy_rx_csa); | 890 | EXPORT_SYMBOL(iwl_legacy_rx_csa); |
@@ -935,7 +931,6 @@ void iwl_legacy_irq_handle_error(struct iwl_priv *priv) | |||
935 | priv->cfg->ops->lib->dump_nic_error_log(priv); | 931 | priv->cfg->ops->lib->dump_nic_error_log(priv); |
936 | if (priv->cfg->ops->lib->dump_fh) | 932 | if (priv->cfg->ops->lib->dump_fh) |
937 | priv->cfg->ops->lib->dump_fh(priv, NULL, false); | 933 | priv->cfg->ops->lib->dump_fh(priv, NULL, false); |
938 | priv->cfg->ops->lib->dump_nic_event_log(priv, false, NULL, false); | ||
939 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 934 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
940 | if (iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) | 935 | if (iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) |
941 | iwl_legacy_print_rx_config_cmd(priv, | 936 | iwl_legacy_print_rx_config_cmd(priv, |
@@ -1711,41 +1706,14 @@ iwl_legacy_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len) | |||
1711 | EXPORT_SYMBOL(iwl_legacy_update_stats); | 1706 | EXPORT_SYMBOL(iwl_legacy_update_stats); |
1712 | #endif | 1707 | #endif |
1713 | 1708 | ||
1714 | static void _iwl_legacy_force_rf_reset(struct iwl_priv *priv) | 1709 | int iwl_legacy_force_reset(struct iwl_priv *priv, bool external) |
1715 | { | ||
1716 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
1717 | return; | ||
1718 | |||
1719 | if (!iwl_legacy_is_any_associated(priv)) { | ||
1720 | IWL_DEBUG_SCAN(priv, "force reset rejected: not associated\n"); | ||
1721 | return; | ||
1722 | } | ||
1723 | /* | ||
1724 | * There is no easy and better way to force reset the radio, | ||
1725 | * the only known method is switching channel which will force to | ||
1726 | * reset and tune the radio. | ||
1727 | * Use internal short scan (single channel) operation to should | ||
1728 | * achieve this objective. | ||
1729 | * Driver should reset the radio when number of consecutive missed | ||
1730 | * beacon, or any other uCode error condition detected. | ||
1731 | */ | ||
1732 | IWL_DEBUG_INFO(priv, "perform radio reset.\n"); | ||
1733 | iwl_legacy_internal_short_hw_scan(priv); | ||
1734 | } | ||
1735 | |||
1736 | |||
1737 | int iwl_legacy_force_reset(struct iwl_priv *priv, int mode, bool external) | ||
1738 | { | 1710 | { |
1739 | struct iwl_force_reset *force_reset; | 1711 | struct iwl_force_reset *force_reset; |
1740 | 1712 | ||
1741 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 1713 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
1742 | return -EINVAL; | 1714 | return -EINVAL; |
1743 | 1715 | ||
1744 | if (mode >= IWL_MAX_FORCE_RESET) { | 1716 | force_reset = &priv->force_reset; |
1745 | IWL_DEBUG_INFO(priv, "invalid reset request.\n"); | ||
1746 | return -EINVAL; | ||
1747 | } | ||
1748 | force_reset = &priv->force_reset[mode]; | ||
1749 | force_reset->reset_request_count++; | 1717 | force_reset->reset_request_count++; |
1750 | if (!external) { | 1718 | if (!external) { |
1751 | if (force_reset->last_force_reset_jiffies && | 1719 | if (force_reset->last_force_reset_jiffies && |
@@ -1758,37 +1726,34 @@ int iwl_legacy_force_reset(struct iwl_priv *priv, int mode, bool external) | |||
1758 | } | 1726 | } |
1759 | force_reset->reset_success_count++; | 1727 | force_reset->reset_success_count++; |
1760 | force_reset->last_force_reset_jiffies = jiffies; | 1728 | force_reset->last_force_reset_jiffies = jiffies; |
1761 | IWL_DEBUG_INFO(priv, "perform force reset (%d)\n", mode); | 1729 | |
1762 | switch (mode) { | 1730 | /* |
1763 | case IWL_RF_RESET: | 1731 | * if the request is from external(ex: debugfs), |
1764 | _iwl_legacy_force_rf_reset(priv); | 1732 | * then always perform the request in regardless the module |
1765 | break; | 1733 | * parameter setting |
1766 | case IWL_FW_RESET: | 1734 | * if the request is from internal (uCode error or driver |
1767 | /* | 1735 | * detect failure), then fw_restart module parameter |
1768 | * if the request is from external(ex: debugfs), | 1736 | * need to be check before performing firmware reload |
1769 | * then always perform the request in regardless the module | 1737 | */ |
1770 | * parameter setting | 1738 | |
1771 | * if the request is from internal (uCode error or driver | 1739 | if (!external && !priv->cfg->mod_params->restart_fw) { |
1772 | * detect failure), then fw_restart module parameter | 1740 | IWL_DEBUG_INFO(priv, "Cancel firmware reload based on " |
1773 | * need to be check before performing firmware reload | 1741 | "module parameter setting\n"); |
1774 | */ | 1742 | return 0; |
1775 | if (!external && !priv->cfg->mod_params->restart_fw) { | ||
1776 | IWL_DEBUG_INFO(priv, "Cancel firmware reload based on " | ||
1777 | "module parameter setting\n"); | ||
1778 | break; | ||
1779 | } | ||
1780 | IWL_ERR(priv, "On demand firmware reload\n"); | ||
1781 | /* Set the FW error flag -- cleared on iwl_down */ | ||
1782 | set_bit(STATUS_FW_ERROR, &priv->status); | ||
1783 | wake_up_interruptible(&priv->wait_command_queue); | ||
1784 | /* | ||
1785 | * Keep the restart process from trying to send host | ||
1786 | * commands by clearing the INIT status bit | ||
1787 | */ | ||
1788 | clear_bit(STATUS_READY, &priv->status); | ||
1789 | queue_work(priv->workqueue, &priv->restart); | ||
1790 | break; | ||
1791 | } | 1743 | } |
1744 | |||
1745 | IWL_ERR(priv, "On demand firmware reload\n"); | ||
1746 | |||
1747 | /* Set the FW error flag -- cleared on iwl_down */ | ||
1748 | set_bit(STATUS_FW_ERROR, &priv->status); | ||
1749 | wake_up_interruptible(&priv->wait_command_queue); | ||
1750 | /* | ||
1751 | * Keep the restart process from trying to send host | ||
1752 | * commands by clearing the INIT status bit | ||
1753 | */ | ||
1754 | clear_bit(STATUS_READY, &priv->status); | ||
1755 | queue_work(priv->workqueue, &priv->restart); | ||
1756 | |||
1792 | return 0; | 1757 | return 0; |
1793 | } | 1758 | } |
1794 | 1759 | ||
@@ -1883,7 +1848,7 @@ static int iwl_legacy_check_stuck_queue(struct iwl_priv *priv, int cnt) | |||
1883 | if (time_after(jiffies, timeout)) { | 1848 | if (time_after(jiffies, timeout)) { |
1884 | IWL_ERR(priv, "Queue %d stuck for %u ms.\n", | 1849 | IWL_ERR(priv, "Queue %d stuck for %u ms.\n", |
1885 | q->id, priv->cfg->base_params->wd_timeout); | 1850 | q->id, priv->cfg->base_params->wd_timeout); |
1886 | ret = iwl_legacy_force_reset(priv, IWL_FW_RESET, false); | 1851 | ret = iwl_legacy_force_reset(priv, false); |
1887 | return (ret == -EAGAIN) ? 0 : 1; | 1852 | return (ret == -EAGAIN) ? 0 : 1; |
1888 | } | 1853 | } |
1889 | 1854 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h index bc66c604106c..a2de7e991706 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.h +++ b/drivers/net/wireless/iwlegacy/iwl-core.h | |||
@@ -143,8 +143,7 @@ struct iwl_lib_ops { | |||
143 | int (*is_valid_rtc_data_addr)(u32 addr); | 143 | int (*is_valid_rtc_data_addr)(u32 addr); |
144 | /* 1st ucode load */ | 144 | /* 1st ucode load */ |
145 | int (*load_ucode)(struct iwl_priv *priv); | 145 | int (*load_ucode)(struct iwl_priv *priv); |
146 | int (*dump_nic_event_log)(struct iwl_priv *priv, | 146 | |
147 | bool full_log, char **buf, bool display); | ||
148 | void (*dump_nic_error_log)(struct iwl_priv *priv); | 147 | void (*dump_nic_error_log)(struct iwl_priv *priv); |
149 | int (*dump_fh)(struct iwl_priv *priv, char **buf, bool display); | 148 | int (*dump_fh)(struct iwl_priv *priv, char **buf, bool display); |
150 | int (*set_channel_switch)(struct iwl_priv *priv, | 149 | int (*set_channel_switch)(struct iwl_priv *priv, |
@@ -161,9 +160,6 @@ struct iwl_lib_ops { | |||
161 | 160 | ||
162 | /* temperature */ | 161 | /* temperature */ |
163 | struct iwl_temp_ops temp_ops; | 162 | struct iwl_temp_ops temp_ops; |
164 | /* check for plcp health */ | ||
165 | bool (*check_plcp_health)(struct iwl_priv *priv, | ||
166 | struct iwl_rx_packet *pkt); | ||
167 | 163 | ||
168 | struct iwl_debugfs_ops debugfs_ops; | 164 | struct iwl_debugfs_ops debugfs_ops; |
169 | 165 | ||
@@ -207,11 +203,8 @@ struct iwl_mod_params { | |||
207 | * to the deviation to achieve the desired led frequency. | 203 | * to the deviation to achieve the desired led frequency. |
208 | * The detail algorithm is described in iwl-led.c | 204 | * The detail algorithm is described in iwl-led.c |
209 | * @chain_noise_num_beacons: number of beacons used to compute chain noise | 205 | * @chain_noise_num_beacons: number of beacons used to compute chain noise |
210 | * @plcp_delta_threshold: plcp error rate threshold used to trigger | ||
211 | * radio tuning when there is a high receiving plcp error rate | ||
212 | * @wd_timeout: TX queues watchdog timeout | 206 | * @wd_timeout: TX queues watchdog timeout |
213 | * @temperature_kelvin: temperature report by uCode in kelvin | 207 | * @temperature_kelvin: temperature report by uCode in kelvin |
214 | * @max_event_log_size: size of event log buffer size for ucode event logging | ||
215 | * @ucode_tracing: support ucode continuous tracing | 208 | * @ucode_tracing: support ucode continuous tracing |
216 | * @sensitivity_calib_by_driver: driver has the capability to perform | 209 | * @sensitivity_calib_by_driver: driver has the capability to perform |
217 | * sensitivity calibration operation | 210 | * sensitivity calibration operation |
@@ -229,10 +222,8 @@ struct iwl_base_params { | |||
229 | 222 | ||
230 | u16 led_compensation; | 223 | u16 led_compensation; |
231 | int chain_noise_num_beacons; | 224 | int chain_noise_num_beacons; |
232 | u8 plcp_delta_threshold; | ||
233 | unsigned int wd_timeout; | 225 | unsigned int wd_timeout; |
234 | bool temperature_kelvin; | 226 | bool temperature_kelvin; |
235 | u32 max_event_log_size; | ||
236 | const bool ucode_tracing; | 227 | const bool ucode_tracing; |
237 | const bool sensitivity_calib_by_driver; | 228 | const bool sensitivity_calib_by_driver; |
238 | const bool chain_noise_calib_by_driver; | 229 | const bool chain_noise_calib_by_driver; |
@@ -441,7 +432,7 @@ int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, | |||
441 | struct ieee80211_vif *vif, | 432 | struct ieee80211_vif *vif, |
442 | struct cfg80211_scan_request *req); | 433 | struct cfg80211_scan_request *req); |
443 | void iwl_legacy_internal_short_hw_scan(struct iwl_priv *priv); | 434 | void iwl_legacy_internal_short_hw_scan(struct iwl_priv *priv); |
444 | int iwl_legacy_force_reset(struct iwl_priv *priv, int mode, bool external); | 435 | int iwl_legacy_force_reset(struct iwl_priv *priv, bool external); |
445 | u16 iwl_legacy_fill_probe_req(struct iwl_priv *priv, | 436 | u16 iwl_legacy_fill_probe_req(struct iwl_priv *priv, |
446 | struct ieee80211_mgmt *frame, | 437 | struct ieee80211_mgmt *frame, |
447 | const u8 *ta, const u8 *ie, int ie_len, int left); | 438 | const u8 *ta, const u8 *ie, int ie_len, int left); |
@@ -521,8 +512,6 @@ extern const struct dev_pm_ops iwl_legacy_pm_ops; | |||
521 | * Error Handling Debugging | 512 | * Error Handling Debugging |
522 | ******************************************************/ | 513 | ******************************************************/ |
523 | void iwl4965_dump_nic_error_log(struct iwl_priv *priv); | 514 | void iwl4965_dump_nic_error_log(struct iwl_priv *priv); |
524 | int iwl4965_dump_nic_event_log(struct iwl_priv *priv, | ||
525 | bool full_log, char **buf, bool display); | ||
526 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 515 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
527 | void iwl_legacy_print_rx_config_cmd(struct iwl_priv *priv, | 516 | void iwl_legacy_print_rx_config_cmd(struct iwl_priv *priv, |
528 | struct iwl_rxon_context *ctx); | 517 | struct iwl_rxon_context *ctx); |
@@ -560,7 +549,7 @@ void iwl_legacy_free_geos(struct iwl_priv *priv); | |||
560 | #define STATUS_SCAN_HW 15 | 549 | #define STATUS_SCAN_HW 15 |
561 | #define STATUS_POWER_PMI 16 | 550 | #define STATUS_POWER_PMI 16 |
562 | #define STATUS_FW_ERROR 17 | 551 | #define STATUS_FW_ERROR 17 |
563 | 552 | #define STATUS_CHANNEL_SWITCH_PENDING 18 | |
564 | 553 | ||
565 | static inline int iwl_legacy_is_ready(struct iwl_priv *priv) | 554 | static inline int iwl_legacy_is_ready(struct iwl_priv *priv) |
566 | { | 555 | { |
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c index 2d32438b4cb8..996996a71657 100644 --- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c +++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c | |||
@@ -391,48 +391,6 @@ static ssize_t iwl_legacy_dbgfs_nvm_read(struct file *file, | |||
391 | return ret; | 391 | return ret; |
392 | } | 392 | } |
393 | 393 | ||
394 | static ssize_t iwl_legacy_dbgfs_log_event_read(struct file *file, | ||
395 | char __user *user_buf, | ||
396 | size_t count, loff_t *ppos) | ||
397 | { | ||
398 | struct iwl_priv *priv = file->private_data; | ||
399 | char *buf; | ||
400 | int pos = 0; | ||
401 | ssize_t ret = -ENOMEM; | ||
402 | |||
403 | ret = pos = priv->cfg->ops->lib->dump_nic_event_log( | ||
404 | priv, true, &buf, true); | ||
405 | if (buf) { | ||
406 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
407 | kfree(buf); | ||
408 | } | ||
409 | return ret; | ||
410 | } | ||
411 | |||
412 | static ssize_t iwl_legacy_dbgfs_log_event_write(struct file *file, | ||
413 | const char __user *user_buf, | ||
414 | size_t count, loff_t *ppos) | ||
415 | { | ||
416 | struct iwl_priv *priv = file->private_data; | ||
417 | u32 event_log_flag; | ||
418 | char buf[8]; | ||
419 | int buf_size; | ||
420 | |||
421 | memset(buf, 0, sizeof(buf)); | ||
422 | buf_size = min(count, sizeof(buf) - 1); | ||
423 | if (copy_from_user(buf, user_buf, buf_size)) | ||
424 | return -EFAULT; | ||
425 | if (sscanf(buf, "%d", &event_log_flag) != 1) | ||
426 | return -EFAULT; | ||
427 | if (event_log_flag == 1) | ||
428 | priv->cfg->ops->lib->dump_nic_event_log(priv, true, | ||
429 | NULL, false); | ||
430 | |||
431 | return count; | ||
432 | } | ||
433 | |||
434 | |||
435 | |||
436 | static ssize_t | 394 | static ssize_t |
437 | iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf, | 395 | iwl_legacy_dbgfs_channels_read(struct file *file, char __user *user_buf, |
438 | size_t count, loff_t *ppos) | 396 | size_t count, loff_t *ppos) |
@@ -706,7 +664,6 @@ static ssize_t iwl_legacy_dbgfs_disable_ht40_read(struct file *file, | |||
706 | } | 664 | } |
707 | 665 | ||
708 | DEBUGFS_READ_WRITE_FILE_OPS(sram); | 666 | DEBUGFS_READ_WRITE_FILE_OPS(sram); |
709 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); | ||
710 | DEBUGFS_READ_FILE_OPS(nvm); | 667 | DEBUGFS_READ_FILE_OPS(nvm); |
711 | DEBUGFS_READ_FILE_OPS(stations); | 668 | DEBUGFS_READ_FILE_OPS(stations); |
712 | DEBUGFS_READ_FILE_OPS(channels); | 669 | DEBUGFS_READ_FILE_OPS(channels); |
@@ -1098,56 +1055,6 @@ static ssize_t iwl_legacy_dbgfs_clear_ucode_statistics_write(struct file *file, | |||
1098 | return count; | 1055 | return count; |
1099 | } | 1056 | } |
1100 | 1057 | ||
1101 | static ssize_t iwl_legacy_dbgfs_ucode_tracing_read(struct file *file, | ||
1102 | char __user *user_buf, | ||
1103 | size_t count, loff_t *ppos) { | ||
1104 | |||
1105 | struct iwl_priv *priv = file->private_data; | ||
1106 | int pos = 0; | ||
1107 | char buf[128]; | ||
1108 | const size_t bufsz = sizeof(buf); | ||
1109 | |||
1110 | pos += scnprintf(buf + pos, bufsz - pos, "ucode trace timer is %s\n", | ||
1111 | priv->event_log.ucode_trace ? "On" : "Off"); | ||
1112 | pos += scnprintf(buf + pos, bufsz - pos, "non_wraps_count:\t\t %u\n", | ||
1113 | priv->event_log.non_wraps_count); | ||
1114 | pos += scnprintf(buf + pos, bufsz - pos, "wraps_once_count:\t\t %u\n", | ||
1115 | priv->event_log.wraps_once_count); | ||
1116 | pos += scnprintf(buf + pos, bufsz - pos, "wraps_more_count:\t\t %u\n", | ||
1117 | priv->event_log.wraps_more_count); | ||
1118 | |||
1119 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1120 | } | ||
1121 | |||
1122 | static ssize_t iwl_legacy_dbgfs_ucode_tracing_write(struct file *file, | ||
1123 | const char __user *user_buf, | ||
1124 | size_t count, loff_t *ppos) | ||
1125 | { | ||
1126 | struct iwl_priv *priv = file->private_data; | ||
1127 | char buf[8]; | ||
1128 | int buf_size; | ||
1129 | int trace; | ||
1130 | |||
1131 | memset(buf, 0, sizeof(buf)); | ||
1132 | buf_size = min(count, sizeof(buf) - 1); | ||
1133 | if (copy_from_user(buf, user_buf, buf_size)) | ||
1134 | return -EFAULT; | ||
1135 | if (sscanf(buf, "%d", &trace) != 1) | ||
1136 | return -EFAULT; | ||
1137 | |||
1138 | if (trace) { | ||
1139 | priv->event_log.ucode_trace = true; | ||
1140 | /* schedule the ucode timer to occur in UCODE_TRACE_PERIOD */ | ||
1141 | mod_timer(&priv->ucode_trace, | ||
1142 | jiffies + msecs_to_jiffies(UCODE_TRACE_PERIOD)); | ||
1143 | } else { | ||
1144 | priv->event_log.ucode_trace = false; | ||
1145 | del_timer_sync(&priv->ucode_trace); | ||
1146 | } | ||
1147 | |||
1148 | return count; | ||
1149 | } | ||
1150 | |||
1151 | static ssize_t iwl_legacy_dbgfs_rxon_flags_read(struct file *file, | 1058 | static ssize_t iwl_legacy_dbgfs_rxon_flags_read(struct file *file, |
1152 | char __user *user_buf, | 1059 | char __user *user_buf, |
1153 | size_t count, loff_t *ppos) { | 1060 | size_t count, loff_t *ppos) { |
@@ -1236,72 +1143,31 @@ static ssize_t iwl_legacy_dbgfs_missed_beacon_write(struct file *file, | |||
1236 | return count; | 1143 | return count; |
1237 | } | 1144 | } |
1238 | 1145 | ||
1239 | static ssize_t iwl_legacy_dbgfs_plcp_delta_read(struct file *file, | ||
1240 | char __user *user_buf, | ||
1241 | size_t count, loff_t *ppos) { | ||
1242 | |||
1243 | struct iwl_priv *priv = file->private_data; | ||
1244 | int pos = 0; | ||
1245 | char buf[12]; | ||
1246 | const size_t bufsz = sizeof(buf); | ||
1247 | |||
1248 | pos += scnprintf(buf + pos, bufsz - pos, "%u\n", | ||
1249 | priv->cfg->base_params->plcp_delta_threshold); | ||
1250 | |||
1251 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1252 | } | ||
1253 | |||
1254 | static ssize_t iwl_legacy_dbgfs_plcp_delta_write(struct file *file, | ||
1255 | const char __user *user_buf, | ||
1256 | size_t count, loff_t *ppos) { | ||
1257 | |||
1258 | struct iwl_priv *priv = file->private_data; | ||
1259 | char buf[8]; | ||
1260 | int buf_size; | ||
1261 | int plcp; | ||
1262 | |||
1263 | memset(buf, 0, sizeof(buf)); | ||
1264 | buf_size = min(count, sizeof(buf) - 1); | ||
1265 | if (copy_from_user(buf, user_buf, buf_size)) | ||
1266 | return -EFAULT; | ||
1267 | if (sscanf(buf, "%d", &plcp) != 1) | ||
1268 | return -EINVAL; | ||
1269 | if ((plcp < IWL_MAX_PLCP_ERR_THRESHOLD_MIN) || | ||
1270 | (plcp > IWL_MAX_PLCP_ERR_THRESHOLD_MAX)) | ||
1271 | priv->cfg->base_params->plcp_delta_threshold = | ||
1272 | IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE; | ||
1273 | else | ||
1274 | priv->cfg->base_params->plcp_delta_threshold = plcp; | ||
1275 | return count; | ||
1276 | } | ||
1277 | |||
1278 | static ssize_t iwl_legacy_dbgfs_force_reset_read(struct file *file, | 1146 | static ssize_t iwl_legacy_dbgfs_force_reset_read(struct file *file, |
1279 | char __user *user_buf, | 1147 | char __user *user_buf, |
1280 | size_t count, loff_t *ppos) { | 1148 | size_t count, loff_t *ppos) { |
1281 | 1149 | ||
1282 | struct iwl_priv *priv = file->private_data; | 1150 | struct iwl_priv *priv = file->private_data; |
1283 | int i, pos = 0; | 1151 | int pos = 0; |
1284 | char buf[300]; | 1152 | char buf[300]; |
1285 | const size_t bufsz = sizeof(buf); | 1153 | const size_t bufsz = sizeof(buf); |
1286 | struct iwl_force_reset *force_reset; | 1154 | struct iwl_force_reset *force_reset; |
1287 | 1155 | ||
1288 | for (i = 0; i < IWL_MAX_FORCE_RESET; i++) { | 1156 | force_reset = &priv->force_reset; |
1289 | force_reset = &priv->force_reset[i]; | 1157 | |
1290 | pos += scnprintf(buf + pos, bufsz - pos, | 1158 | pos += scnprintf(buf + pos, bufsz - pos, |
1291 | "Force reset method %d\n", i); | 1159 | "\tnumber of reset request: %d\n", |
1292 | pos += scnprintf(buf + pos, bufsz - pos, | 1160 | force_reset->reset_request_count); |
1293 | "\tnumber of reset request: %d\n", | 1161 | pos += scnprintf(buf + pos, bufsz - pos, |
1294 | force_reset->reset_request_count); | 1162 | "\tnumber of reset request success: %d\n", |
1295 | pos += scnprintf(buf + pos, bufsz - pos, | 1163 | force_reset->reset_success_count); |
1296 | "\tnumber of reset request success: %d\n", | 1164 | pos += scnprintf(buf + pos, bufsz - pos, |
1297 | force_reset->reset_success_count); | 1165 | "\tnumber of reset request reject: %d\n", |
1298 | pos += scnprintf(buf + pos, bufsz - pos, | 1166 | force_reset->reset_reject_count); |
1299 | "\tnumber of reset request reject: %d\n", | 1167 | pos += scnprintf(buf + pos, bufsz - pos, |
1300 | force_reset->reset_reject_count); | 1168 | "\treset duration: %lu\n", |
1301 | pos += scnprintf(buf + pos, bufsz - pos, | 1169 | force_reset->reset_duration); |
1302 | "\treset duration: %lu\n", | 1170 | |
1303 | force_reset->reset_duration); | ||
1304 | } | ||
1305 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 1171 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
1306 | } | 1172 | } |
1307 | 1173 | ||
@@ -1309,25 +1175,11 @@ static ssize_t iwl_legacy_dbgfs_force_reset_write(struct file *file, | |||
1309 | const char __user *user_buf, | 1175 | const char __user *user_buf, |
1310 | size_t count, loff_t *ppos) { | 1176 | size_t count, loff_t *ppos) { |
1311 | 1177 | ||
1178 | int ret; | ||
1312 | struct iwl_priv *priv = file->private_data; | 1179 | struct iwl_priv *priv = file->private_data; |
1313 | char buf[8]; | ||
1314 | int buf_size; | ||
1315 | int reset, ret; | ||
1316 | 1180 | ||
1317 | memset(buf, 0, sizeof(buf)); | 1181 | ret = iwl_legacy_force_reset(priv, true); |
1318 | buf_size = min(count, sizeof(buf) - 1); | 1182 | |
1319 | if (copy_from_user(buf, user_buf, buf_size)) | ||
1320 | return -EFAULT; | ||
1321 | if (sscanf(buf, "%d", &reset) != 1) | ||
1322 | return -EINVAL; | ||
1323 | switch (reset) { | ||
1324 | case IWL_RF_RESET: | ||
1325 | case IWL_FW_RESET: | ||
1326 | ret = iwl_legacy_force_reset(priv, reset, true); | ||
1327 | break; | ||
1328 | default: | ||
1329 | return -EINVAL; | ||
1330 | } | ||
1331 | return ret ? ret : count; | 1183 | return ret ? ret : count; |
1332 | } | 1184 | } |
1333 | 1185 | ||
@@ -1367,10 +1219,8 @@ DEBUGFS_READ_FILE_OPS(chain_noise); | |||
1367 | DEBUGFS_READ_FILE_OPS(power_save_status); | 1219 | DEBUGFS_READ_FILE_OPS(power_save_status); |
1368 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); | 1220 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); |
1369 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); | 1221 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); |
1370 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); | ||
1371 | DEBUGFS_READ_FILE_OPS(fh_reg); | 1222 | DEBUGFS_READ_FILE_OPS(fh_reg); |
1372 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); | 1223 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); |
1373 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); | ||
1374 | DEBUGFS_READ_WRITE_FILE_OPS(force_reset); | 1224 | DEBUGFS_READ_WRITE_FILE_OPS(force_reset); |
1375 | DEBUGFS_READ_FILE_OPS(rxon_flags); | 1225 | DEBUGFS_READ_FILE_OPS(rxon_flags); |
1376 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); | 1226 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); |
@@ -1403,7 +1253,6 @@ int iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1403 | 1253 | ||
1404 | DEBUGFS_ADD_FILE(nvm, dir_data, S_IRUSR); | 1254 | DEBUGFS_ADD_FILE(nvm, dir_data, S_IRUSR); |
1405 | DEBUGFS_ADD_FILE(sram, dir_data, S_IWUSR | S_IRUSR); | 1255 | DEBUGFS_ADD_FILE(sram, dir_data, S_IWUSR | S_IRUSR); |
1406 | DEBUGFS_ADD_FILE(log_event, dir_data, S_IWUSR | S_IRUSR); | ||
1407 | DEBUGFS_ADD_FILE(stations, dir_data, S_IRUSR); | 1256 | DEBUGFS_ADD_FILE(stations, dir_data, S_IRUSR); |
1408 | DEBUGFS_ADD_FILE(channels, dir_data, S_IRUSR); | 1257 | DEBUGFS_ADD_FILE(channels, dir_data, S_IRUSR); |
1409 | DEBUGFS_ADD_FILE(status, dir_data, S_IRUSR); | 1258 | DEBUGFS_ADD_FILE(status, dir_data, S_IRUSR); |
@@ -1420,7 +1269,6 @@ int iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1420 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); | 1269 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); |
1421 | DEBUGFS_ADD_FILE(fh_reg, dir_debug, S_IRUSR); | 1270 | DEBUGFS_ADD_FILE(fh_reg, dir_debug, S_IRUSR); |
1422 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); | 1271 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); |
1423 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); | ||
1424 | DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); | 1272 | DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); |
1425 | DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); | 1273 | DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); |
1426 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); | 1274 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); |
@@ -1430,8 +1278,6 @@ int iwl_legacy_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1430 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); | 1278 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); |
1431 | if (priv->cfg->base_params->chain_noise_calib_by_driver) | 1279 | if (priv->cfg->base_params->chain_noise_calib_by_driver) |
1432 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); | 1280 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); |
1433 | if (priv->cfg->base_params->ucode_tracing) | ||
1434 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); | ||
1435 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 1281 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
1436 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 1282 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
1437 | DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR); | 1283 | DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h index be0106c6a2da..62e8cc07f046 100644 --- a/drivers/net/wireless/iwlegacy/iwl-dev.h +++ b/drivers/net/wireless/iwlegacy/iwl-dev.h | |||
@@ -855,43 +855,6 @@ struct traffic_stats { | |||
855 | }; | 855 | }; |
856 | 856 | ||
857 | /* | 857 | /* |
858 | * iwl_switch_rxon: "channel switch" structure | ||
859 | * | ||
860 | * @ switch_in_progress: channel switch in progress | ||
861 | * @ channel: new channel | ||
862 | */ | ||
863 | struct iwl_switch_rxon { | ||
864 | bool switch_in_progress; | ||
865 | __le16 channel; | ||
866 | }; | ||
867 | |||
868 | /* | ||
869 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds | ||
870 | * to perform continuous uCode event logging operation if enabled | ||
871 | */ | ||
872 | #define UCODE_TRACE_PERIOD (100) | ||
873 | |||
874 | /* | ||
875 | * iwl_event_log: current uCode event log position | ||
876 | * | ||
877 | * @ucode_trace: enable/disable ucode continuous trace timer | ||
878 | * @num_wraps: how many times the event buffer wraps | ||
879 | * @next_entry: the entry just before the next one that uCode would fill | ||
880 | * @non_wraps_count: counter for no wrap detected when dump ucode events | ||
881 | * @wraps_once_count: counter for wrap once detected when dump ucode events | ||
882 | * @wraps_more_count: counter for wrap more than once detected | ||
883 | * when dump ucode events | ||
884 | */ | ||
885 | struct iwl_event_log { | ||
886 | bool ucode_trace; | ||
887 | u32 num_wraps; | ||
888 | u32 next_entry; | ||
889 | int non_wraps_count; | ||
890 | int wraps_once_count; | ||
891 | int wraps_more_count; | ||
892 | }; | ||
893 | |||
894 | /* | ||
895 | * host interrupt timeout value | 858 | * host interrupt timeout value |
896 | * used with setting interrupt coalescing timer | 859 | * used with setting interrupt coalescing timer |
897 | * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit | 860 | * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit |
@@ -906,18 +869,6 @@ struct iwl_event_log { | |||
906 | #define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) | 869 | #define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) |
907 | #define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) | 870 | #define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) |
908 | 871 | ||
909 | /* | ||
910 | * This is the threshold value of plcp error rate per 100mSecs. It is | ||
911 | * used to set and check for the validity of plcp_delta. | ||
912 | */ | ||
913 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN (1) | ||
914 | #define IWL_MAX_PLCP_ERR_THRESHOLD_DEF (50) | ||
915 | #define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF (100) | ||
916 | #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200) | ||
917 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255) | ||
918 | #define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE (0) | ||
919 | |||
920 | #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) | ||
921 | #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) | 872 | #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) |
922 | 873 | ||
923 | /* TX queue watchdog timeouts in mSecs */ | 874 | /* TX queue watchdog timeouts in mSecs */ |
@@ -925,12 +876,6 @@ struct iwl_event_log { | |||
925 | #define IWL_LONG_WD_TIMEOUT (10000) | 876 | #define IWL_LONG_WD_TIMEOUT (10000) |
926 | #define IWL_MAX_WD_TIMEOUT (120000) | 877 | #define IWL_MAX_WD_TIMEOUT (120000) |
927 | 878 | ||
928 | enum iwl_reset { | ||
929 | IWL_RF_RESET = 0, | ||
930 | IWL_FW_RESET, | ||
931 | IWL_MAX_FORCE_RESET, | ||
932 | }; | ||
933 | |||
934 | struct iwl_force_reset { | 879 | struct iwl_force_reset { |
935 | int reset_request_count; | 880 | int reset_request_count; |
936 | int reset_success_count; | 881 | int reset_success_count; |
@@ -1043,11 +988,8 @@ struct iwl_priv { | |||
1043 | /* track IBSS manager (last beacon) status */ | 988 | /* track IBSS manager (last beacon) status */ |
1044 | u32 ibss_manager; | 989 | u32 ibss_manager; |
1045 | 990 | ||
1046 | /* storing the jiffies when the plcp error rate is received */ | ||
1047 | unsigned long plcp_jiffies; | ||
1048 | |||
1049 | /* force reset */ | 991 | /* force reset */ |
1050 | struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET]; | 992 | struct iwl_force_reset force_reset; |
1051 | 993 | ||
1052 | /* we allocate array of iwl_channel_info for NIC's valid channels. | 994 | /* we allocate array of iwl_channel_info for NIC's valid channels. |
1053 | * Access via channel # using indirect index array */ | 995 | * Access via channel # using indirect index array */ |
@@ -1068,7 +1010,6 @@ struct iwl_priv { | |||
1068 | enum ieee80211_band scan_band; | 1010 | enum ieee80211_band scan_band; |
1069 | struct cfg80211_scan_request *scan_request; | 1011 | struct cfg80211_scan_request *scan_request; |
1070 | struct ieee80211_vif *scan_vif; | 1012 | struct ieee80211_vif *scan_vif; |
1071 | bool is_internal_short_scan; | ||
1072 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; | 1013 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; |
1073 | u8 mgmt_tx_ant; | 1014 | u8 mgmt_tx_ant; |
1074 | 1015 | ||
@@ -1115,7 +1056,7 @@ struct iwl_priv { | |||
1115 | 1056 | ||
1116 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; | 1057 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; |
1117 | 1058 | ||
1118 | struct iwl_switch_rxon switch_rxon; | 1059 | __le16 switch_channel; |
1119 | 1060 | ||
1120 | /* 1st responses from initialize and runtime uCode images. | 1061 | /* 1st responses from initialize and runtime uCode images. |
1121 | * _4965's initialize alive response contains some calibration data. */ | 1062 | * _4965's initialize alive response contains some calibration data. */ |
@@ -1223,12 +1164,6 @@ struct iwl_priv { | |||
1223 | #endif | 1164 | #endif |
1224 | #if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE) | 1165 | #if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE) |
1225 | struct { | 1166 | struct { |
1226 | /* | ||
1227 | * reporting the number of tids has AGG on. 0 means | ||
1228 | * no AGGREGATION | ||
1229 | */ | ||
1230 | u8 agg_tids_count; | ||
1231 | |||
1232 | struct iwl_rx_phy_res last_phy_res; | 1167 | struct iwl_rx_phy_res last_phy_res; |
1233 | bool last_phy_res_valid; | 1168 | bool last_phy_res_valid; |
1234 | 1169 | ||
@@ -1267,7 +1202,6 @@ struct iwl_priv { | |||
1267 | struct iwl_rxon_context *beacon_ctx; | 1202 | struct iwl_rxon_context *beacon_ctx; |
1268 | struct sk_buff *beacon_skb; | 1203 | struct sk_buff *beacon_skb; |
1269 | 1204 | ||
1270 | struct work_struct start_internal_scan; | ||
1271 | struct work_struct tx_flush; | 1205 | struct work_struct tx_flush; |
1272 | 1206 | ||
1273 | struct tasklet_struct irq_tasklet; | 1207 | struct tasklet_struct irq_tasklet; |
@@ -1304,12 +1238,9 @@ struct iwl_priv { | |||
1304 | u32 disable_tx_power_cal; | 1238 | u32 disable_tx_power_cal; |
1305 | struct work_struct run_time_calib_work; | 1239 | struct work_struct run_time_calib_work; |
1306 | struct timer_list statistics_periodic; | 1240 | struct timer_list statistics_periodic; |
1307 | struct timer_list ucode_trace; | ||
1308 | struct timer_list watchdog; | 1241 | struct timer_list watchdog; |
1309 | bool hw_ready; | 1242 | bool hw_ready; |
1310 | 1243 | ||
1311 | struct iwl_event_log event_log; | ||
1312 | |||
1313 | struct led_classdev led; | 1244 | struct led_classdev led; |
1314 | unsigned long blink_on, blink_off; | 1245 | unsigned long blink_on, blink_off; |
1315 | bool led_registered; | 1246 | bool led_registered; |
diff --git a/drivers/net/wireless/iwlegacy/iwl-devtrace.c b/drivers/net/wireless/iwlegacy/iwl-devtrace.c index 080b852b33bd..acec99197ce0 100644 --- a/drivers/net/wireless/iwlegacy/iwl-devtrace.c +++ b/drivers/net/wireless/iwlegacy/iwl-devtrace.c | |||
@@ -38,8 +38,5 @@ EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_ioread32); | |||
38 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_iowrite32); | 38 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_iowrite32); |
39 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_rx); | 39 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_rx); |
40 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_tx); | 40 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_tx); |
41 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_ucode_event); | ||
42 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_ucode_error); | 41 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_ucode_error); |
43 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_ucode_cont_event); | ||
44 | EXPORT_TRACEPOINT_SYMBOL(iwlwifi_legacy_dev_ucode_wrap_event); | ||
45 | #endif | 42 | #endif |
diff --git a/drivers/net/wireless/iwlegacy/iwl-devtrace.h b/drivers/net/wireless/iwlegacy/iwl-devtrace.h index 9612aa0f6ec4..a443725ba6be 100644 --- a/drivers/net/wireless/iwlegacy/iwl-devtrace.h +++ b/drivers/net/wireless/iwlegacy/iwl-devtrace.h | |||
@@ -96,47 +96,6 @@ TRACE_EVENT(iwlwifi_legacy_dev_iowrite32, | |||
96 | #undef TRACE_SYSTEM | 96 | #undef TRACE_SYSTEM |
97 | #define TRACE_SYSTEM iwlwifi_legacy_ucode | 97 | #define TRACE_SYSTEM iwlwifi_legacy_ucode |
98 | 98 | ||
99 | TRACE_EVENT(iwlwifi_legacy_dev_ucode_cont_event, | ||
100 | TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev), | ||
101 | TP_ARGS(priv, time, data, ev), | ||
102 | TP_STRUCT__entry( | ||
103 | PRIV_ENTRY | ||
104 | |||
105 | __field(u32, time) | ||
106 | __field(u32, data) | ||
107 | __field(u32, ev) | ||
108 | ), | ||
109 | TP_fast_assign( | ||
110 | PRIV_ASSIGN; | ||
111 | __entry->time = time; | ||
112 | __entry->data = data; | ||
113 | __entry->ev = ev; | ||
114 | ), | ||
115 | TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u", | ||
116 | __entry->priv, __entry->time, __entry->data, __entry->ev) | ||
117 | ); | ||
118 | |||
119 | TRACE_EVENT(iwlwifi_legacy_dev_ucode_wrap_event, | ||
120 | TP_PROTO(struct iwl_priv *priv, u32 wraps, u32 n_entry, u32 p_entry), | ||
121 | TP_ARGS(priv, wraps, n_entry, p_entry), | ||
122 | TP_STRUCT__entry( | ||
123 | PRIV_ENTRY | ||
124 | |||
125 | __field(u32, wraps) | ||
126 | __field(u32, n_entry) | ||
127 | __field(u32, p_entry) | ||
128 | ), | ||
129 | TP_fast_assign( | ||
130 | PRIV_ASSIGN; | ||
131 | __entry->wraps = wraps; | ||
132 | __entry->n_entry = n_entry; | ||
133 | __entry->p_entry = p_entry; | ||
134 | ), | ||
135 | TP_printk("[%p] wraps=#%02d n=0x%X p=0x%X", | ||
136 | __entry->priv, __entry->wraps, __entry->n_entry, | ||
137 | __entry->p_entry) | ||
138 | ); | ||
139 | |||
140 | #undef TRACE_SYSTEM | 99 | #undef TRACE_SYSTEM |
141 | #define TRACE_SYSTEM iwlwifi | 100 | #define TRACE_SYSTEM iwlwifi |
142 | 101 | ||
@@ -242,25 +201,6 @@ TRACE_EVENT(iwlwifi_legacy_dev_ucode_error, | |||
242 | __entry->blink2, __entry->ilink1, __entry->ilink2) | 201 | __entry->blink2, __entry->ilink1, __entry->ilink2) |
243 | ); | 202 | ); |
244 | 203 | ||
245 | TRACE_EVENT(iwlwifi_legacy_dev_ucode_event, | ||
246 | TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev), | ||
247 | TP_ARGS(priv, time, data, ev), | ||
248 | TP_STRUCT__entry( | ||
249 | PRIV_ENTRY | ||
250 | |||
251 | __field(u32, time) | ||
252 | __field(u32, data) | ||
253 | __field(u32, ev) | ||
254 | ), | ||
255 | TP_fast_assign( | ||
256 | PRIV_ASSIGN; | ||
257 | __entry->time = time; | ||
258 | __entry->data = data; | ||
259 | __entry->ev = ev; | ||
260 | ), | ||
261 | TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u", | ||
262 | __entry->priv, __entry->time, __entry->data, __entry->ev) | ||
263 | ); | ||
264 | #endif /* __IWLWIFI_DEVICE_TRACE */ | 204 | #endif /* __IWLWIFI_DEVICE_TRACE */ |
265 | 205 | ||
266 | #undef TRACE_INCLUDE_PATH | 206 | #undef TRACE_INCLUDE_PATH |
diff --git a/drivers/net/wireless/iwlegacy/iwl-helpers.h b/drivers/net/wireless/iwlegacy/iwl-helpers.h index a6effdae63f9..5cf23eaecbbb 100644 --- a/drivers/net/wireless/iwlegacy/iwl-helpers.h +++ b/drivers/net/wireless/iwlegacy/iwl-helpers.h | |||
@@ -132,7 +132,16 @@ static inline void iwl_legacy_stop_queue(struct iwl_priv *priv, | |||
132 | ieee80211_stop_queue(priv->hw, ac); | 132 | ieee80211_stop_queue(priv->hw, ac); |
133 | } | 133 | } |
134 | 134 | ||
135 | #ifdef ieee80211_stop_queue | ||
136 | #undef ieee80211_stop_queue | ||
137 | #endif | ||
138 | |||
135 | #define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue | 139 | #define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue |
140 | |||
141 | #ifdef ieee80211_wake_queue | ||
142 | #undef ieee80211_wake_queue | ||
143 | #endif | ||
144 | |||
136 | #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue | 145 | #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue |
137 | 146 | ||
138 | static inline void iwl_legacy_disable_interrupts(struct iwl_priv *priv) | 147 | static inline void iwl_legacy_disable_interrupts(struct iwl_priv *priv) |
diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 654cf233a384..9b5d0abe8be9 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c | |||
@@ -227,27 +227,6 @@ void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv, | |||
227 | } | 227 | } |
228 | EXPORT_SYMBOL(iwl_legacy_rx_spectrum_measure_notif); | 228 | EXPORT_SYMBOL(iwl_legacy_rx_spectrum_measure_notif); |
229 | 229 | ||
230 | void iwl_legacy_recover_from_statistics(struct iwl_priv *priv, | ||
231 | struct iwl_rx_packet *pkt) | ||
232 | { | ||
233 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
234 | return; | ||
235 | if (iwl_legacy_is_any_associated(priv)) { | ||
236 | if (priv->cfg->ops->lib->check_plcp_health) { | ||
237 | if (!priv->cfg->ops->lib->check_plcp_health( | ||
238 | priv, pkt)) { | ||
239 | /* | ||
240 | * high plcp error detected | ||
241 | * reset Radio | ||
242 | */ | ||
243 | iwl_legacy_force_reset(priv, | ||
244 | IWL_RF_RESET, false); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | EXPORT_SYMBOL(iwl_legacy_recover_from_statistics); | ||
250 | |||
251 | /* | 230 | /* |
252 | * returns non-zero if packet should be dropped | 231 | * returns non-zero if packet should be dropped |
253 | */ | 232 | */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c index 353234a02c6d..a6b5222fc59e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-scan.c +++ b/drivers/net/wireless/iwlegacy/iwl-scan.c | |||
@@ -101,7 +101,6 @@ static void iwl_legacy_complete_scan(struct iwl_priv *priv, bool aborted) | |||
101 | ieee80211_scan_completed(priv->hw, aborted); | 101 | ieee80211_scan_completed(priv->hw, aborted); |
102 | } | 102 | } |
103 | 103 | ||
104 | priv->is_internal_short_scan = false; | ||
105 | priv->scan_vif = NULL; | 104 | priv->scan_vif = NULL; |
106 | priv->scan_request = NULL; | 105 | priv->scan_request = NULL; |
107 | } | 106 | } |
@@ -329,10 +328,8 @@ void iwl_legacy_init_scan_params(struct iwl_priv *priv) | |||
329 | } | 328 | } |
330 | EXPORT_SYMBOL(iwl_legacy_init_scan_params); | 329 | EXPORT_SYMBOL(iwl_legacy_init_scan_params); |
331 | 330 | ||
332 | static int __must_check iwl_legacy_scan_initiate(struct iwl_priv *priv, | 331 | static int iwl_legacy_scan_initiate(struct iwl_priv *priv, |
333 | struct ieee80211_vif *vif, | 332 | struct ieee80211_vif *vif) |
334 | bool internal, | ||
335 | enum ieee80211_band band) | ||
336 | { | 333 | { |
337 | int ret; | 334 | int ret; |
338 | 335 | ||
@@ -359,18 +356,14 @@ static int __must_check iwl_legacy_scan_initiate(struct iwl_priv *priv, | |||
359 | return -EBUSY; | 356 | return -EBUSY; |
360 | } | 357 | } |
361 | 358 | ||
362 | IWL_DEBUG_SCAN(priv, "Starting %sscan...\n", | 359 | IWL_DEBUG_SCAN(priv, "Starting scan...\n"); |
363 | internal ? "internal short " : ""); | ||
364 | 360 | ||
365 | set_bit(STATUS_SCANNING, &priv->status); | 361 | set_bit(STATUS_SCANNING, &priv->status); |
366 | priv->is_internal_short_scan = internal; | ||
367 | priv->scan_start = jiffies; | 362 | priv->scan_start = jiffies; |
368 | priv->scan_band = band; | ||
369 | 363 | ||
370 | ret = priv->cfg->ops->utils->request_scan(priv, vif); | 364 | ret = priv->cfg->ops->utils->request_scan(priv, vif); |
371 | if (ret) { | 365 | if (ret) { |
372 | clear_bit(STATUS_SCANNING, &priv->status); | 366 | clear_bit(STATUS_SCANNING, &priv->status); |
373 | priv->is_internal_short_scan = false; | ||
374 | return ret; | 367 | return ret; |
375 | } | 368 | } |
376 | 369 | ||
@@ -394,8 +387,7 @@ int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, | |||
394 | 387 | ||
395 | mutex_lock(&priv->mutex); | 388 | mutex_lock(&priv->mutex); |
396 | 389 | ||
397 | if (test_bit(STATUS_SCANNING, &priv->status) && | 390 | if (test_bit(STATUS_SCANNING, &priv->status)) { |
398 | !priv->is_internal_short_scan) { | ||
399 | IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); | 391 | IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); |
400 | ret = -EAGAIN; | 392 | ret = -EAGAIN; |
401 | goto out_unlock; | 393 | goto out_unlock; |
@@ -404,17 +396,9 @@ int iwl_legacy_mac_hw_scan(struct ieee80211_hw *hw, | |||
404 | /* mac80211 will only ask for one band at a time */ | 396 | /* mac80211 will only ask for one band at a time */ |
405 | priv->scan_request = req; | 397 | priv->scan_request = req; |
406 | priv->scan_vif = vif; | 398 | priv->scan_vif = vif; |
399 | priv->scan_band = req->channels[0]->band; | ||
407 | 400 | ||
408 | /* | 401 | ret = iwl_legacy_scan_initiate(priv, vif); |
409 | * If an internal scan is in progress, just set | ||
410 | * up the scan_request as per above. | ||
411 | */ | ||
412 | if (priv->is_internal_short_scan) { | ||
413 | IWL_DEBUG_SCAN(priv, "SCAN request during internal scan\n"); | ||
414 | ret = 0; | ||
415 | } else | ||
416 | ret = iwl_legacy_scan_initiate(priv, vif, false, | ||
417 | req->channels[0]->band); | ||
418 | 402 | ||
419 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 403 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
420 | 404 | ||
@@ -425,40 +409,6 @@ out_unlock: | |||
425 | } | 409 | } |
426 | EXPORT_SYMBOL(iwl_legacy_mac_hw_scan); | 410 | EXPORT_SYMBOL(iwl_legacy_mac_hw_scan); |
427 | 411 | ||
428 | /* | ||
429 | * internal short scan, this function should only been called while associated. | ||
430 | * It will reset and tune the radio to prevent possible RF related problem | ||
431 | */ | ||
432 | void iwl_legacy_internal_short_hw_scan(struct iwl_priv *priv) | ||
433 | { | ||
434 | queue_work(priv->workqueue, &priv->start_internal_scan); | ||
435 | } | ||
436 | |||
437 | static void iwl_legacy_bg_start_internal_scan(struct work_struct *work) | ||
438 | { | ||
439 | struct iwl_priv *priv = | ||
440 | container_of(work, struct iwl_priv, start_internal_scan); | ||
441 | |||
442 | IWL_DEBUG_SCAN(priv, "Start internal scan\n"); | ||
443 | |||
444 | mutex_lock(&priv->mutex); | ||
445 | |||
446 | if (priv->is_internal_short_scan == true) { | ||
447 | IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n"); | ||
448 | goto unlock; | ||
449 | } | ||
450 | |||
451 | if (test_bit(STATUS_SCANNING, &priv->status)) { | ||
452 | IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); | ||
453 | goto unlock; | ||
454 | } | ||
455 | |||
456 | if (iwl_legacy_scan_initiate(priv, NULL, true, priv->band)) | ||
457 | IWL_DEBUG_SCAN(priv, "failed to start internal short scan\n"); | ||
458 | unlock: | ||
459 | mutex_unlock(&priv->mutex); | ||
460 | } | ||
461 | |||
462 | static void iwl_legacy_bg_scan_check(struct work_struct *data) | 412 | static void iwl_legacy_bg_scan_check(struct work_struct *data) |
463 | { | 413 | { |
464 | struct iwl_priv *priv = | 414 | struct iwl_priv *priv = |
@@ -542,8 +492,7 @@ static void iwl_legacy_bg_scan_completed(struct work_struct *work) | |||
542 | container_of(work, struct iwl_priv, scan_completed); | 492 | container_of(work, struct iwl_priv, scan_completed); |
543 | bool aborted; | 493 | bool aborted; |
544 | 494 | ||
545 | IWL_DEBUG_SCAN(priv, "Completed %sscan.\n", | 495 | IWL_DEBUG_SCAN(priv, "Completed scan.\n"); |
546 | priv->is_internal_short_scan ? "internal short " : ""); | ||
547 | 496 | ||
548 | cancel_delayed_work(&priv->scan_check); | 497 | cancel_delayed_work(&priv->scan_check); |
549 | 498 | ||
@@ -558,27 +507,6 @@ static void iwl_legacy_bg_scan_completed(struct work_struct *work) | |||
558 | goto out_settings; | 507 | goto out_settings; |
559 | } | 508 | } |
560 | 509 | ||
561 | if (priv->is_internal_short_scan && !aborted) { | ||
562 | int err; | ||
563 | |||
564 | /* Check if mac80211 requested scan during our internal scan */ | ||
565 | if (priv->scan_request == NULL) | ||
566 | goto out_complete; | ||
567 | |||
568 | /* If so request a new scan */ | ||
569 | err = iwl_legacy_scan_initiate(priv, priv->scan_vif, false, | ||
570 | priv->scan_request->channels[0]->band); | ||
571 | if (err) { | ||
572 | IWL_DEBUG_SCAN(priv, | ||
573 | "failed to initiate pending scan: %d\n", err); | ||
574 | aborted = true; | ||
575 | goto out_complete; | ||
576 | } | ||
577 | |||
578 | goto out; | ||
579 | } | ||
580 | |||
581 | out_complete: | ||
582 | iwl_legacy_complete_scan(priv, aborted); | 510 | iwl_legacy_complete_scan(priv, aborted); |
583 | 511 | ||
584 | out_settings: | 512 | out_settings: |
@@ -590,8 +518,7 @@ out_settings: | |||
590 | * We do not commit power settings while scan is pending, | 518 | * We do not commit power settings while scan is pending, |
591 | * do it now if the settings changed. | 519 | * do it now if the settings changed. |
592 | */ | 520 | */ |
593 | iwl_legacy_power_set_mode(priv, &priv->power_data.sleep_cmd_next, | 521 | iwl_legacy_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false); |
594 | false); | ||
595 | iwl_legacy_set_tx_power(priv, priv->tx_power_next, false); | 522 | iwl_legacy_set_tx_power(priv, priv->tx_power_next, false); |
596 | 523 | ||
597 | priv->cfg->ops->utils->post_scan(priv); | 524 | priv->cfg->ops->utils->post_scan(priv); |
@@ -604,15 +531,12 @@ void iwl_legacy_setup_scan_deferred_work(struct iwl_priv *priv) | |||
604 | { | 531 | { |
605 | INIT_WORK(&priv->scan_completed, iwl_legacy_bg_scan_completed); | 532 | INIT_WORK(&priv->scan_completed, iwl_legacy_bg_scan_completed); |
606 | INIT_WORK(&priv->abort_scan, iwl_legacy_bg_abort_scan); | 533 | INIT_WORK(&priv->abort_scan, iwl_legacy_bg_abort_scan); |
607 | INIT_WORK(&priv->start_internal_scan, | ||
608 | iwl_legacy_bg_start_internal_scan); | ||
609 | INIT_DELAYED_WORK(&priv->scan_check, iwl_legacy_bg_scan_check); | 534 | INIT_DELAYED_WORK(&priv->scan_check, iwl_legacy_bg_scan_check); |
610 | } | 535 | } |
611 | EXPORT_SYMBOL(iwl_legacy_setup_scan_deferred_work); | 536 | EXPORT_SYMBOL(iwl_legacy_setup_scan_deferred_work); |
612 | 537 | ||
613 | void iwl_legacy_cancel_scan_deferred_work(struct iwl_priv *priv) | 538 | void iwl_legacy_cancel_scan_deferred_work(struct iwl_priv *priv) |
614 | { | 539 | { |
615 | cancel_work_sync(&priv->start_internal_scan); | ||
616 | cancel_work_sync(&priv->abort_scan); | 540 | cancel_work_sync(&priv->abort_scan); |
617 | cancel_work_sync(&priv->scan_completed); | 541 | cancel_work_sync(&priv->scan_completed); |
618 | 542 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c index 0ee6be6a9c5d..795826a014ed 100644 --- a/drivers/net/wireless/iwlegacy/iwl3945-base.c +++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c | |||
@@ -1409,212 +1409,6 @@ void iwl3945_dump_nic_error_log(struct iwl_priv *priv) | |||
1409 | } | 1409 | } |
1410 | } | 1410 | } |
1411 | 1411 | ||
1412 | #define EVENT_START_OFFSET (6 * sizeof(u32)) | ||
1413 | |||
1414 | /** | ||
1415 | * iwl3945_print_event_log - Dump error event log to syslog | ||
1416 | * | ||
1417 | */ | ||
1418 | static int iwl3945_print_event_log(struct iwl_priv *priv, u32 start_idx, | ||
1419 | u32 num_events, u32 mode, | ||
1420 | int pos, char **buf, size_t bufsz) | ||
1421 | { | ||
1422 | u32 i; | ||
1423 | u32 base; /* SRAM byte address of event log header */ | ||
1424 | u32 event_size; /* 2 u32s, or 3 u32s if timestamp recorded */ | ||
1425 | u32 ptr; /* SRAM byte address of log data */ | ||
1426 | u32 ev, time, data; /* event log data */ | ||
1427 | unsigned long reg_flags; | ||
1428 | |||
1429 | if (num_events == 0) | ||
1430 | return pos; | ||
1431 | |||
1432 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | ||
1433 | |||
1434 | if (mode == 0) | ||
1435 | event_size = 2 * sizeof(u32); | ||
1436 | else | ||
1437 | event_size = 3 * sizeof(u32); | ||
1438 | |||
1439 | ptr = base + EVENT_START_OFFSET + (start_idx * event_size); | ||
1440 | |||
1441 | /* Make sure device is powered up for SRAM reads */ | ||
1442 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | ||
1443 | iwl_grab_nic_access(priv); | ||
1444 | |||
1445 | /* Set starting address; reads will auto-increment */ | ||
1446 | _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, ptr); | ||
1447 | rmb(); | ||
1448 | |||
1449 | /* "time" is actually "data" for mode 0 (no timestamp). | ||
1450 | * place event id # at far right for easier visual parsing. */ | ||
1451 | for (i = 0; i < num_events; i++) { | ||
1452 | ev = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); | ||
1453 | time = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); | ||
1454 | if (mode == 0) { | ||
1455 | /* data, ev */ | ||
1456 | if (bufsz) { | ||
1457 | pos += scnprintf(*buf + pos, bufsz - pos, | ||
1458 | "0x%08x:%04u\n", | ||
1459 | time, ev); | ||
1460 | } else { | ||
1461 | IWL_ERR(priv, "0x%08x\t%04u\n", time, ev); | ||
1462 | trace_iwlwifi_legacy_dev_ucode_event(priv, 0, | ||
1463 | time, ev); | ||
1464 | } | ||
1465 | } else { | ||
1466 | data = _iwl_legacy_read_direct32(priv, | ||
1467 | HBUS_TARG_MEM_RDAT); | ||
1468 | if (bufsz) { | ||
1469 | pos += scnprintf(*buf + pos, bufsz - pos, | ||
1470 | "%010u:0x%08x:%04u\n", | ||
1471 | time, data, ev); | ||
1472 | } else { | ||
1473 | IWL_ERR(priv, "%010u\t0x%08x\t%04u\n", | ||
1474 | time, data, ev); | ||
1475 | trace_iwlwifi_legacy_dev_ucode_event(priv, time, | ||
1476 | data, ev); | ||
1477 | } | ||
1478 | } | ||
1479 | } | ||
1480 | |||
1481 | /* Allow device to power down */ | ||
1482 | iwl_release_nic_access(priv); | ||
1483 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | ||
1484 | return pos; | ||
1485 | } | ||
1486 | |||
1487 | /** | ||
1488 | * iwl3945_print_last_event_logs - Dump the newest # of event log to syslog | ||
1489 | */ | ||
1490 | static int iwl3945_print_last_event_logs(struct iwl_priv *priv, u32 capacity, | ||
1491 | u32 num_wraps, u32 next_entry, | ||
1492 | u32 size, u32 mode, | ||
1493 | int pos, char **buf, size_t bufsz) | ||
1494 | { | ||
1495 | /* | ||
1496 | * display the newest DEFAULT_LOG_ENTRIES entries | ||
1497 | * i.e the entries just before the next ont that uCode would fill. | ||
1498 | */ | ||
1499 | if (num_wraps) { | ||
1500 | if (next_entry < size) { | ||
1501 | pos = iwl3945_print_event_log(priv, | ||
1502 | capacity - (size - next_entry), | ||
1503 | size - next_entry, mode, | ||
1504 | pos, buf, bufsz); | ||
1505 | pos = iwl3945_print_event_log(priv, 0, | ||
1506 | next_entry, mode, | ||
1507 | pos, buf, bufsz); | ||
1508 | } else | ||
1509 | pos = iwl3945_print_event_log(priv, next_entry - size, | ||
1510 | size, mode, | ||
1511 | pos, buf, bufsz); | ||
1512 | } else { | ||
1513 | if (next_entry < size) | ||
1514 | pos = iwl3945_print_event_log(priv, 0, | ||
1515 | next_entry, mode, | ||
1516 | pos, buf, bufsz); | ||
1517 | else | ||
1518 | pos = iwl3945_print_event_log(priv, next_entry - size, | ||
1519 | size, mode, | ||
1520 | pos, buf, bufsz); | ||
1521 | } | ||
1522 | return pos; | ||
1523 | } | ||
1524 | |||
1525 | #define DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES (20) | ||
1526 | |||
1527 | int iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | ||
1528 | char **buf, bool display) | ||
1529 | { | ||
1530 | u32 base; /* SRAM byte address of event log header */ | ||
1531 | u32 capacity; /* event log capacity in # entries */ | ||
1532 | u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */ | ||
1533 | u32 num_wraps; /* # times uCode wrapped to top of log */ | ||
1534 | u32 next_entry; /* index of next entry to be written by uCode */ | ||
1535 | u32 size; /* # entries that we'll print */ | ||
1536 | int pos = 0; | ||
1537 | size_t bufsz = 0; | ||
1538 | |||
1539 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | ||
1540 | if (!iwl3945_hw_valid_rtc_data_addr(base)) { | ||
1541 | IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base); | ||
1542 | return -EINVAL; | ||
1543 | } | ||
1544 | |||
1545 | /* event log header */ | ||
1546 | capacity = iwl_legacy_read_targ_mem(priv, base); | ||
1547 | mode = iwl_legacy_read_targ_mem(priv, base + (1 * sizeof(u32))); | ||
1548 | num_wraps = iwl_legacy_read_targ_mem(priv, base + (2 * sizeof(u32))); | ||
1549 | next_entry = iwl_legacy_read_targ_mem(priv, base + (3 * sizeof(u32))); | ||
1550 | |||
1551 | if (capacity > priv->cfg->base_params->max_event_log_size) { | ||
1552 | IWL_ERR(priv, "Log capacity %d is bogus, limit to %d entries\n", | ||
1553 | capacity, priv->cfg->base_params->max_event_log_size); | ||
1554 | capacity = priv->cfg->base_params->max_event_log_size; | ||
1555 | } | ||
1556 | |||
1557 | if (next_entry > priv->cfg->base_params->max_event_log_size) { | ||
1558 | IWL_ERR(priv, "Log write index %d is bogus, limit to %d\n", | ||
1559 | next_entry, priv->cfg->base_params->max_event_log_size); | ||
1560 | next_entry = priv->cfg->base_params->max_event_log_size; | ||
1561 | } | ||
1562 | |||
1563 | size = num_wraps ? capacity : next_entry; | ||
1564 | |||
1565 | /* bail out if nothing in log */ | ||
1566 | if (size == 0) { | ||
1567 | IWL_ERR(priv, "Start IWL Event Log Dump: nothing in log\n"); | ||
1568 | return pos; | ||
1569 | } | ||
1570 | |||
1571 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | ||
1572 | if (!(iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) | ||
1573 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) | ||
1574 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; | ||
1575 | #else | ||
1576 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) | ||
1577 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; | ||
1578 | #endif | ||
1579 | |||
1580 | IWL_ERR(priv, "Start IWL Event Log Dump: display last %d count\n", | ||
1581 | size); | ||
1582 | |||
1583 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | ||
1584 | if (display) { | ||
1585 | if (full_log) | ||
1586 | bufsz = capacity * 48; | ||
1587 | else | ||
1588 | bufsz = size * 48; | ||
1589 | *buf = kmalloc(bufsz, GFP_KERNEL); | ||
1590 | if (!*buf) | ||
1591 | return -ENOMEM; | ||
1592 | } | ||
1593 | if ((iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) { | ||
1594 | /* if uCode has wrapped back to top of log, | ||
1595 | * start at the oldest entry, | ||
1596 | * i.e the next one that uCode would fill. | ||
1597 | */ | ||
1598 | if (num_wraps) | ||
1599 | pos = iwl3945_print_event_log(priv, next_entry, | ||
1600 | capacity - next_entry, mode, | ||
1601 | pos, buf, bufsz); | ||
1602 | |||
1603 | /* (then/else) start at top of log */ | ||
1604 | pos = iwl3945_print_event_log(priv, 0, next_entry, mode, | ||
1605 | pos, buf, bufsz); | ||
1606 | } else | ||
1607 | pos = iwl3945_print_last_event_logs(priv, capacity, num_wraps, | ||
1608 | next_entry, size, mode, | ||
1609 | pos, buf, bufsz); | ||
1610 | #else | ||
1611 | pos = iwl3945_print_last_event_logs(priv, capacity, num_wraps, | ||
1612 | next_entry, size, mode, | ||
1613 | pos, buf, bufsz); | ||
1614 | #endif | ||
1615 | return pos; | ||
1616 | } | ||
1617 | |||
1618 | static void iwl3945_irq_tasklet(struct iwl_priv *priv) | 1412 | static void iwl3945_irq_tasklet(struct iwl_priv *priv) |
1619 | { | 1413 | { |
1620 | u32 inta, handled = 0; | 1414 | u32 inta, handled = 0; |
@@ -1762,49 +1556,6 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
1762 | #endif | 1556 | #endif |
1763 | } | 1557 | } |
1764 | 1558 | ||
1765 | static int iwl3945_get_single_channel_for_scan(struct iwl_priv *priv, | ||
1766 | struct ieee80211_vif *vif, | ||
1767 | enum ieee80211_band band, | ||
1768 | struct iwl3945_scan_channel *scan_ch) | ||
1769 | { | ||
1770 | const struct ieee80211_supported_band *sband; | ||
1771 | u16 passive_dwell = 0; | ||
1772 | u16 active_dwell = 0; | ||
1773 | int added = 0; | ||
1774 | u8 channel = 0; | ||
1775 | |||
1776 | sband = iwl_get_hw_mode(priv, band); | ||
1777 | if (!sband) { | ||
1778 | IWL_ERR(priv, "invalid band\n"); | ||
1779 | return added; | ||
1780 | } | ||
1781 | |||
1782 | active_dwell = iwl_legacy_get_active_dwell_time(priv, band, 0); | ||
1783 | passive_dwell = iwl_legacy_get_passive_dwell_time(priv, band, vif); | ||
1784 | |||
1785 | if (passive_dwell <= active_dwell) | ||
1786 | passive_dwell = active_dwell + 1; | ||
1787 | |||
1788 | |||
1789 | channel = iwl_legacy_get_single_channel_number(priv, band); | ||
1790 | |||
1791 | if (channel) { | ||
1792 | scan_ch->channel = channel; | ||
1793 | scan_ch->type = 0; /* passive */ | ||
1794 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | ||
1795 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | ||
1796 | /* Set txpower levels to defaults */ | ||
1797 | scan_ch->tpc.dsp_atten = 110; | ||
1798 | if (band == IEEE80211_BAND_5GHZ) | ||
1799 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; | ||
1800 | else | ||
1801 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | ||
1802 | added++; | ||
1803 | } else | ||
1804 | IWL_ERR(priv, "no valid channel found\n"); | ||
1805 | return added; | ||
1806 | } | ||
1807 | |||
1808 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | 1559 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, |
1809 | enum ieee80211_band band, | 1560 | enum ieee80211_band band, |
1810 | u8 is_active, u8 n_probes, | 1561 | u8 is_active, u8 n_probes, |
@@ -2816,6 +2567,7 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2816 | enum ieee80211_band band; | 2567 | enum ieee80211_band band; |
2817 | bool is_active = false; | 2568 | bool is_active = false; |
2818 | int ret; | 2569 | int ret; |
2570 | u16 len; | ||
2819 | 2571 | ||
2820 | lockdep_assert_held(&priv->mutex); | 2572 | lockdep_assert_held(&priv->mutex); |
2821 | 2573 | ||
@@ -2834,17 +2586,14 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2834 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; | 2586 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; |
2835 | 2587 | ||
2836 | if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { | 2588 | if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { |
2837 | u16 interval = 0; | 2589 | u16 interval; |
2838 | u32 extra; | 2590 | u32 extra; |
2839 | u32 suspend_time = 100; | 2591 | u32 suspend_time = 100; |
2840 | u32 scan_suspend_time = 100; | 2592 | u32 scan_suspend_time = 100; |
2841 | 2593 | ||
2842 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 2594 | IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); |
2843 | 2595 | ||
2844 | if (priv->is_internal_short_scan) | 2596 | interval = vif->bss_conf.beacon_int; |
2845 | interval = 0; | ||
2846 | else | ||
2847 | interval = vif->bss_conf.beacon_int; | ||
2848 | 2597 | ||
2849 | scan->suspend_time = 0; | 2598 | scan->suspend_time = 0; |
2850 | scan->max_out_time = cpu_to_le32(200 * 1024); | 2599 | scan->max_out_time = cpu_to_le32(200 * 1024); |
@@ -2866,9 +2615,7 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2866 | scan_suspend_time, interval); | 2615 | scan_suspend_time, interval); |
2867 | } | 2616 | } |
2868 | 2617 | ||
2869 | if (priv->is_internal_short_scan) { | 2618 | if (priv->scan_request->n_ssids) { |
2870 | IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); | ||
2871 | } else if (priv->scan_request->n_ssids) { | ||
2872 | int i, p = 0; | 2619 | int i, p = 0; |
2873 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); | 2620 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); |
2874 | for (i = 0; i < priv->scan_request->n_ssids; i++) { | 2621 | for (i = 0; i < priv->scan_request->n_ssids; i++) { |
@@ -2919,36 +2666,17 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2919 | scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : | 2666 | scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : |
2920 | IWL_GOOD_CRC_TH_DISABLED; | 2667 | IWL_GOOD_CRC_TH_DISABLED; |
2921 | 2668 | ||
2922 | if (!priv->is_internal_short_scan) { | 2669 | len = iwl_legacy_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, |
2923 | scan->tx_cmd.len = cpu_to_le16( | 2670 | vif->addr, priv->scan_request->ie, |
2924 | iwl_legacy_fill_probe_req(priv, | 2671 | priv->scan_request->ie_len, |
2925 | (struct ieee80211_mgmt *)scan->data, | 2672 | IWL_MAX_SCAN_SIZE - sizeof(*scan)); |
2926 | vif->addr, | 2673 | scan->tx_cmd.len = cpu_to_le16(len); |
2927 | priv->scan_request->ie, | 2674 | |
2928 | priv->scan_request->ie_len, | ||
2929 | IWL_MAX_SCAN_SIZE - sizeof(*scan))); | ||
2930 | } else { | ||
2931 | /* use bcast addr, will not be transmitted but must be valid */ | ||
2932 | scan->tx_cmd.len = cpu_to_le16( | ||
2933 | iwl_legacy_fill_probe_req(priv, | ||
2934 | (struct ieee80211_mgmt *)scan->data, | ||
2935 | iwlegacy_bcast_addr, NULL, 0, | ||
2936 | IWL_MAX_SCAN_SIZE - sizeof(*scan))); | ||
2937 | } | ||
2938 | /* select Rx antennas */ | 2675 | /* select Rx antennas */ |
2939 | scan->flags |= iwl3945_get_antenna_flags(priv); | 2676 | scan->flags |= iwl3945_get_antenna_flags(priv); |
2940 | 2677 | ||
2941 | if (priv->is_internal_short_scan) { | 2678 | scan->channel_count = iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, |
2942 | scan->channel_count = | 2679 | (void *)&scan->data[len], vif); |
2943 | iwl3945_get_single_channel_for_scan(priv, vif, band, | ||
2944 | (void *)&scan->data[le16_to_cpu( | ||
2945 | scan->tx_cmd.len)]); | ||
2946 | } else { | ||
2947 | scan->channel_count = | ||
2948 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | ||
2949 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); | ||
2950 | } | ||
2951 | |||
2952 | if (scan->channel_count == 0) { | 2680 | if (scan->channel_count == 0) { |
2953 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 2681 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); |
2954 | return -EIO; | 2682 | return -EIO; |
@@ -3824,10 +3552,7 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
3824 | priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; | 3552 | priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; |
3825 | 3553 | ||
3826 | /* initialize force reset */ | 3554 | /* initialize force reset */ |
3827 | priv->force_reset[IWL_RF_RESET].reset_duration = | 3555 | priv->force_reset.reset_duration = IWL_DELAY_NEXT_FORCE_FW_RELOAD; |
3828 | IWL_DELAY_NEXT_FORCE_RF_RESET; | ||
3829 | priv->force_reset[IWL_FW_RESET].reset_duration = | ||
3830 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; | ||
3831 | 3556 | ||
3832 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { | 3557 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { |
3833 | IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", | 3558 | IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", |
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c index af2ae22fcfd3..46242d2aa5ad 100644 --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c | |||
@@ -488,134 +488,6 @@ static void iwl4965_bg_statistics_periodic(unsigned long data) | |||
488 | iwl_legacy_send_statistics_request(priv, CMD_ASYNC, false); | 488 | iwl_legacy_send_statistics_request(priv, CMD_ASYNC, false); |
489 | } | 489 | } |
490 | 490 | ||
491 | |||
492 | static void iwl4965_print_cont_event_trace(struct iwl_priv *priv, u32 base, | ||
493 | u32 start_idx, u32 num_events, | ||
494 | u32 mode) | ||
495 | { | ||
496 | u32 i; | ||
497 | u32 ptr; /* SRAM byte address of log data */ | ||
498 | u32 ev, time, data; /* event log data */ | ||
499 | unsigned long reg_flags; | ||
500 | |||
501 | if (mode == 0) | ||
502 | ptr = base + (4 * sizeof(u32)) + (start_idx * 2 * sizeof(u32)); | ||
503 | else | ||
504 | ptr = base + (4 * sizeof(u32)) + (start_idx * 3 * sizeof(u32)); | ||
505 | |||
506 | /* Make sure device is powered up for SRAM reads */ | ||
507 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | ||
508 | if (iwl_grab_nic_access(priv)) { | ||
509 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | ||
510 | return; | ||
511 | } | ||
512 | |||
513 | /* Set starting address; reads will auto-increment */ | ||
514 | _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, ptr); | ||
515 | rmb(); | ||
516 | |||
517 | /* | ||
518 | * "time" is actually "data" for mode 0 (no timestamp). | ||
519 | * place event id # at far right for easier visual parsing. | ||
520 | */ | ||
521 | for (i = 0; i < num_events; i++) { | ||
522 | ev = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); | ||
523 | time = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); | ||
524 | if (mode == 0) { | ||
525 | trace_iwlwifi_legacy_dev_ucode_cont_event(priv, | ||
526 | 0, time, ev); | ||
527 | } else { | ||
528 | data = _iwl_legacy_read_direct32(priv, | ||
529 | HBUS_TARG_MEM_RDAT); | ||
530 | trace_iwlwifi_legacy_dev_ucode_cont_event(priv, | ||
531 | time, data, ev); | ||
532 | } | ||
533 | } | ||
534 | /* Allow device to power down */ | ||
535 | iwl_release_nic_access(priv); | ||
536 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | ||
537 | } | ||
538 | |||
539 | static void iwl4965_continuous_event_trace(struct iwl_priv *priv) | ||
540 | { | ||
541 | u32 capacity; /* event log capacity in # entries */ | ||
542 | u32 base; /* SRAM byte address of event log header */ | ||
543 | u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */ | ||
544 | u32 num_wraps; /* # times uCode wrapped to top of log */ | ||
545 | u32 next_entry; /* index of next entry to be written by uCode */ | ||
546 | |||
547 | if (priv->ucode_type == UCODE_INIT) | ||
548 | base = le32_to_cpu(priv->card_alive_init.error_event_table_ptr); | ||
549 | else | ||
550 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | ||
551 | if (priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { | ||
552 | capacity = iwl_legacy_read_targ_mem(priv, base); | ||
553 | num_wraps = iwl_legacy_read_targ_mem(priv, | ||
554 | base + (2 * sizeof(u32))); | ||
555 | mode = iwl_legacy_read_targ_mem(priv, base + (1 * sizeof(u32))); | ||
556 | next_entry = iwl_legacy_read_targ_mem(priv, | ||
557 | base + (3 * sizeof(u32))); | ||
558 | } else | ||
559 | return; | ||
560 | |||
561 | if (num_wraps == priv->event_log.num_wraps) { | ||
562 | iwl4965_print_cont_event_trace(priv, | ||
563 | base, priv->event_log.next_entry, | ||
564 | next_entry - priv->event_log.next_entry, | ||
565 | mode); | ||
566 | priv->event_log.non_wraps_count++; | ||
567 | } else { | ||
568 | if ((num_wraps - priv->event_log.num_wraps) > 1) | ||
569 | priv->event_log.wraps_more_count++; | ||
570 | else | ||
571 | priv->event_log.wraps_once_count++; | ||
572 | trace_iwlwifi_legacy_dev_ucode_wrap_event(priv, | ||
573 | num_wraps - priv->event_log.num_wraps, | ||
574 | next_entry, priv->event_log.next_entry); | ||
575 | if (next_entry < priv->event_log.next_entry) { | ||
576 | iwl4965_print_cont_event_trace(priv, base, | ||
577 | priv->event_log.next_entry, | ||
578 | capacity - priv->event_log.next_entry, | ||
579 | mode); | ||
580 | |||
581 | iwl4965_print_cont_event_trace(priv, base, 0, | ||
582 | next_entry, mode); | ||
583 | } else { | ||
584 | iwl4965_print_cont_event_trace(priv, base, | ||
585 | next_entry, capacity - next_entry, | ||
586 | mode); | ||
587 | |||
588 | iwl4965_print_cont_event_trace(priv, base, 0, | ||
589 | next_entry, mode); | ||
590 | } | ||
591 | } | ||
592 | priv->event_log.num_wraps = num_wraps; | ||
593 | priv->event_log.next_entry = next_entry; | ||
594 | } | ||
595 | |||
596 | /** | ||
597 | * iwl4965_bg_ucode_trace - Timer callback to log ucode event | ||
598 | * | ||
599 | * The timer is continually set to execute every | ||
600 | * UCODE_TRACE_PERIOD milliseconds after the last timer expired | ||
601 | * this function is to perform continuous uCode event logging operation | ||
602 | * if enabled | ||
603 | */ | ||
604 | static void iwl4965_bg_ucode_trace(unsigned long data) | ||
605 | { | ||
606 | struct iwl_priv *priv = (struct iwl_priv *)data; | ||
607 | |||
608 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
609 | return; | ||
610 | |||
611 | if (priv->event_log.ucode_trace) { | ||
612 | iwl4965_continuous_event_trace(priv); | ||
613 | /* Reschedule the timer to occur in UCODE_TRACE_PERIOD */ | ||
614 | mod_timer(&priv->ucode_trace, | ||
615 | jiffies + msecs_to_jiffies(UCODE_TRACE_PERIOD)); | ||
616 | } | ||
617 | } | ||
618 | |||
619 | static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, | 491 | static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, |
620 | struct iwl_rx_mem_buffer *rxb) | 492 | struct iwl_rx_mem_buffer *rxb) |
621 | { | 493 | { |
@@ -1711,209 +1583,6 @@ void iwl4965_dump_nic_error_log(struct iwl_priv *priv) | |||
1711 | pc, blink1, blink2, ilink1, ilink2, hcmd); | 1583 | pc, blink1, blink2, ilink1, ilink2, hcmd); |
1712 | } | 1584 | } |
1713 | 1585 | ||
1714 | #define EVENT_START_OFFSET (4 * sizeof(u32)) | ||
1715 | |||
1716 | /** | ||
1717 | * iwl4965_print_event_log - Dump error event log to syslog | ||
1718 | * | ||
1719 | */ | ||
1720 | static int iwl4965_print_event_log(struct iwl_priv *priv, u32 start_idx, | ||
1721 | u32 num_events, u32 mode, | ||
1722 | int pos, char **buf, size_t bufsz) | ||
1723 | { | ||
1724 | u32 i; | ||
1725 | u32 base; /* SRAM byte address of event log header */ | ||
1726 | u32 event_size; /* 2 u32s, or 3 u32s if timestamp recorded */ | ||
1727 | u32 ptr; /* SRAM byte address of log data */ | ||
1728 | u32 ev, time, data; /* event log data */ | ||
1729 | unsigned long reg_flags; | ||
1730 | |||
1731 | if (num_events == 0) | ||
1732 | return pos; | ||
1733 | |||
1734 | if (priv->ucode_type == UCODE_INIT) { | ||
1735 | base = le32_to_cpu(priv->card_alive_init.log_event_table_ptr); | ||
1736 | } else { | ||
1737 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | ||
1738 | } | ||
1739 | |||
1740 | if (mode == 0) | ||
1741 | event_size = 2 * sizeof(u32); | ||
1742 | else | ||
1743 | event_size = 3 * sizeof(u32); | ||
1744 | |||
1745 | ptr = base + EVENT_START_OFFSET + (start_idx * event_size); | ||
1746 | |||
1747 | /* Make sure device is powered up for SRAM reads */ | ||
1748 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | ||
1749 | iwl_grab_nic_access(priv); | ||
1750 | |||
1751 | /* Set starting address; reads will auto-increment */ | ||
1752 | _iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, ptr); | ||
1753 | rmb(); | ||
1754 | |||
1755 | /* "time" is actually "data" for mode 0 (no timestamp). | ||
1756 | * place event id # at far right for easier visual parsing. */ | ||
1757 | for (i = 0; i < num_events; i++) { | ||
1758 | ev = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); | ||
1759 | time = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); | ||
1760 | if (mode == 0) { | ||
1761 | /* data, ev */ | ||
1762 | if (bufsz) { | ||
1763 | pos += scnprintf(*buf + pos, bufsz - pos, | ||
1764 | "EVT_LOG:0x%08x:%04u\n", | ||
1765 | time, ev); | ||
1766 | } else { | ||
1767 | trace_iwlwifi_legacy_dev_ucode_event(priv, 0, | ||
1768 | time, ev); | ||
1769 | IWL_ERR(priv, "EVT_LOG:0x%08x:%04u\n", | ||
1770 | time, ev); | ||
1771 | } | ||
1772 | } else { | ||
1773 | data = _iwl_legacy_read_direct32(priv, | ||
1774 | HBUS_TARG_MEM_RDAT); | ||
1775 | if (bufsz) { | ||
1776 | pos += scnprintf(*buf + pos, bufsz - pos, | ||
1777 | "EVT_LOGT:%010u:0x%08x:%04u\n", | ||
1778 | time, data, ev); | ||
1779 | } else { | ||
1780 | IWL_ERR(priv, "EVT_LOGT:%010u:0x%08x:%04u\n", | ||
1781 | time, data, ev); | ||
1782 | trace_iwlwifi_legacy_dev_ucode_event(priv, time, | ||
1783 | data, ev); | ||
1784 | } | ||
1785 | } | ||
1786 | } | ||
1787 | |||
1788 | /* Allow device to power down */ | ||
1789 | iwl_release_nic_access(priv); | ||
1790 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | ||
1791 | return pos; | ||
1792 | } | ||
1793 | |||
1794 | /** | ||
1795 | * iwl4965_print_last_event_logs - Dump the newest # of event log to syslog | ||
1796 | */ | ||
1797 | static int iwl4965_print_last_event_logs(struct iwl_priv *priv, u32 capacity, | ||
1798 | u32 num_wraps, u32 next_entry, | ||
1799 | u32 size, u32 mode, | ||
1800 | int pos, char **buf, size_t bufsz) | ||
1801 | { | ||
1802 | /* | ||
1803 | * display the newest DEFAULT_LOG_ENTRIES entries | ||
1804 | * i.e the entries just before the next ont that uCode would fill. | ||
1805 | */ | ||
1806 | if (num_wraps) { | ||
1807 | if (next_entry < size) { | ||
1808 | pos = iwl4965_print_event_log(priv, | ||
1809 | capacity - (size - next_entry), | ||
1810 | size - next_entry, mode, | ||
1811 | pos, buf, bufsz); | ||
1812 | pos = iwl4965_print_event_log(priv, 0, | ||
1813 | next_entry, mode, | ||
1814 | pos, buf, bufsz); | ||
1815 | } else | ||
1816 | pos = iwl4965_print_event_log(priv, next_entry - size, | ||
1817 | size, mode, pos, buf, bufsz); | ||
1818 | } else { | ||
1819 | if (next_entry < size) { | ||
1820 | pos = iwl4965_print_event_log(priv, 0, next_entry, | ||
1821 | mode, pos, buf, bufsz); | ||
1822 | } else { | ||
1823 | pos = iwl4965_print_event_log(priv, next_entry - size, | ||
1824 | size, mode, pos, buf, bufsz); | ||
1825 | } | ||
1826 | } | ||
1827 | return pos; | ||
1828 | } | ||
1829 | |||
1830 | #define DEFAULT_DUMP_EVENT_LOG_ENTRIES (20) | ||
1831 | |||
1832 | int iwl4965_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | ||
1833 | char **buf, bool display) | ||
1834 | { | ||
1835 | u32 base; /* SRAM byte address of event log header */ | ||
1836 | u32 capacity; /* event log capacity in # entries */ | ||
1837 | u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */ | ||
1838 | u32 num_wraps; /* # times uCode wrapped to top of log */ | ||
1839 | u32 next_entry; /* index of next entry to be written by uCode */ | ||
1840 | u32 size; /* # entries that we'll print */ | ||
1841 | int pos = 0; | ||
1842 | size_t bufsz = 0; | ||
1843 | |||
1844 | if (priv->ucode_type == UCODE_INIT) { | ||
1845 | base = le32_to_cpu(priv->card_alive_init.log_event_table_ptr); | ||
1846 | } else { | ||
1847 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | ||
1848 | } | ||
1849 | |||
1850 | if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { | ||
1851 | IWL_ERR(priv, | ||
1852 | "Invalid event log pointer 0x%08X for %s uCode\n", | ||
1853 | base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT"); | ||
1854 | return -EINVAL; | ||
1855 | } | ||
1856 | |||
1857 | /* event log header */ | ||
1858 | capacity = iwl_legacy_read_targ_mem(priv, base); | ||
1859 | mode = iwl_legacy_read_targ_mem(priv, base + (1 * sizeof(u32))); | ||
1860 | num_wraps = iwl_legacy_read_targ_mem(priv, base + (2 * sizeof(u32))); | ||
1861 | next_entry = iwl_legacy_read_targ_mem(priv, base + (3 * sizeof(u32))); | ||
1862 | |||
1863 | size = num_wraps ? capacity : next_entry; | ||
1864 | |||
1865 | /* bail out if nothing in log */ | ||
1866 | if (size == 0) { | ||
1867 | IWL_ERR(priv, "Start IWL Event Log Dump: nothing in log\n"); | ||
1868 | return pos; | ||
1869 | } | ||
1870 | |||
1871 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | ||
1872 | if (!(iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) | ||
1873 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) | ||
1874 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; | ||
1875 | #else | ||
1876 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) | ||
1877 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; | ||
1878 | #endif | ||
1879 | IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n", | ||
1880 | size); | ||
1881 | |||
1882 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | ||
1883 | if (display) { | ||
1884 | if (full_log) | ||
1885 | bufsz = capacity * 48; | ||
1886 | else | ||
1887 | bufsz = size * 48; | ||
1888 | *buf = kmalloc(bufsz, GFP_KERNEL); | ||
1889 | if (!*buf) | ||
1890 | return -ENOMEM; | ||
1891 | } | ||
1892 | if ((iwl_legacy_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) { | ||
1893 | /* | ||
1894 | * if uCode has wrapped back to top of log, | ||
1895 | * start at the oldest entry, | ||
1896 | * i.e the next one that uCode would fill. | ||
1897 | */ | ||
1898 | if (num_wraps) | ||
1899 | pos = iwl4965_print_event_log(priv, next_entry, | ||
1900 | capacity - next_entry, mode, | ||
1901 | pos, buf, bufsz); | ||
1902 | /* (then/else) start at top of log */ | ||
1903 | pos = iwl4965_print_event_log(priv, 0, | ||
1904 | next_entry, mode, pos, buf, bufsz); | ||
1905 | } else | ||
1906 | pos = iwl4965_print_last_event_logs(priv, capacity, num_wraps, | ||
1907 | next_entry, size, mode, | ||
1908 | pos, buf, bufsz); | ||
1909 | #else | ||
1910 | pos = iwl4965_print_last_event_logs(priv, capacity, num_wraps, | ||
1911 | next_entry, size, mode, | ||
1912 | pos, buf, bufsz); | ||
1913 | #endif | ||
1914 | return pos; | ||
1915 | } | ||
1916 | |||
1917 | static void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) | 1586 | static void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) |
1918 | { | 1587 | { |
1919 | struct iwl_ct_kill_config cmd; | 1588 | struct iwl_ct_kill_config cmd; |
@@ -2773,20 +2442,10 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
2773 | case IEEE80211_AMPDU_TX_START: | 2442 | case IEEE80211_AMPDU_TX_START: |
2774 | IWL_DEBUG_HT(priv, "start Tx\n"); | 2443 | IWL_DEBUG_HT(priv, "start Tx\n"); |
2775 | ret = iwl4965_tx_agg_start(priv, vif, sta, tid, ssn); | 2444 | ret = iwl4965_tx_agg_start(priv, vif, sta, tid, ssn); |
2776 | if (ret == 0) { | ||
2777 | priv->_4965.agg_tids_count++; | ||
2778 | IWL_DEBUG_HT(priv, "priv->_4965.agg_tids_count = %u\n", | ||
2779 | priv->_4965.agg_tids_count); | ||
2780 | } | ||
2781 | break; | 2445 | break; |
2782 | case IEEE80211_AMPDU_TX_STOP: | 2446 | case IEEE80211_AMPDU_TX_STOP: |
2783 | IWL_DEBUG_HT(priv, "stop Tx\n"); | 2447 | IWL_DEBUG_HT(priv, "stop Tx\n"); |
2784 | ret = iwl4965_tx_agg_stop(priv, vif, sta, tid); | 2448 | ret = iwl4965_tx_agg_stop(priv, vif, sta, tid); |
2785 | if ((ret == 0) && (priv->_4965.agg_tids_count > 0)) { | ||
2786 | priv->_4965.agg_tids_count--; | ||
2787 | IWL_DEBUG_HT(priv, "priv->_4965.agg_tids_count = %u\n", | ||
2788 | priv->_4965.agg_tids_count); | ||
2789 | } | ||
2790 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2449 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2791 | ret = 0; | 2450 | ret = 0; |
2792 | break; | 2451 | break; |
@@ -2851,7 +2510,6 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, | |||
2851 | 2510 | ||
2852 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | 2511 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; |
2853 | u16 ch; | 2512 | u16 ch; |
2854 | unsigned long flags = 0; | ||
2855 | 2513 | ||
2856 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 2514 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
2857 | 2515 | ||
@@ -2861,73 +2519,73 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, | |||
2861 | goto out; | 2519 | goto out; |
2862 | 2520 | ||
2863 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || | 2521 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || |
2864 | test_bit(STATUS_SCANNING, &priv->status)) | 2522 | test_bit(STATUS_SCANNING, &priv->status) || |
2523 | test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) | ||
2865 | goto out; | 2524 | goto out; |
2866 | 2525 | ||
2867 | if (!iwl_legacy_is_associated_ctx(ctx)) | 2526 | if (!iwl_legacy_is_associated_ctx(ctx)) |
2868 | goto out; | 2527 | goto out; |
2869 | 2528 | ||
2870 | /* channel switch in progress */ | 2529 | if (!priv->cfg->ops->lib->set_channel_switch) |
2871 | if (priv->switch_rxon.switch_in_progress == true) | ||
2872 | goto out; | 2530 | goto out; |
2873 | 2531 | ||
2874 | if (priv->cfg->ops->lib->set_channel_switch) { | 2532 | ch = channel->hw_value; |
2533 | if (le16_to_cpu(ctx->active.channel) == ch) | ||
2534 | goto out; | ||
2875 | 2535 | ||
2876 | ch = channel->hw_value; | 2536 | ch_info = iwl_legacy_get_channel_info(priv, channel->band, ch); |
2877 | if (le16_to_cpu(ctx->active.channel) != ch) { | 2537 | if (!iwl_legacy_is_channel_valid(ch_info)) { |
2878 | ch_info = iwl_legacy_get_channel_info(priv, | 2538 | IWL_DEBUG_MAC80211(priv, "invalid channel\n"); |
2879 | channel->band, | 2539 | goto out; |
2880 | ch); | 2540 | } |
2881 | if (!iwl_legacy_is_channel_valid(ch_info)) { | 2541 | |
2882 | IWL_DEBUG_MAC80211(priv, "invalid channel\n"); | 2542 | spin_lock_irq(&priv->lock); |
2883 | goto out; | 2543 | |
2884 | } | 2544 | priv->current_ht_config.smps = conf->smps_mode; |
2885 | spin_lock_irqsave(&priv->lock, flags); | 2545 | |
2886 | 2546 | /* Configure HT40 channels */ | |
2887 | priv->current_ht_config.smps = conf->smps_mode; | 2547 | ctx->ht.enabled = conf_is_ht(conf); |
2888 | 2548 | if (ctx->ht.enabled) { | |
2889 | /* Configure HT40 channels */ | 2549 | if (conf_is_ht40_minus(conf)) { |
2890 | ctx->ht.enabled = conf_is_ht(conf); | 2550 | ctx->ht.extension_chan_offset = |
2891 | if (ctx->ht.enabled) { | 2551 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; |
2892 | if (conf_is_ht40_minus(conf)) { | 2552 | ctx->ht.is_40mhz = true; |
2893 | ctx->ht.extension_chan_offset = | 2553 | } else if (conf_is_ht40_plus(conf)) { |
2894 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | 2554 | ctx->ht.extension_chan_offset = |
2895 | ctx->ht.is_40mhz = true; | 2555 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; |
2896 | } else if (conf_is_ht40_plus(conf)) { | 2556 | ctx->ht.is_40mhz = true; |
2897 | ctx->ht.extension_chan_offset = | 2557 | } else { |
2898 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | 2558 | ctx->ht.extension_chan_offset = |
2899 | ctx->ht.is_40mhz = true; | 2559 | IEEE80211_HT_PARAM_CHA_SEC_NONE; |
2900 | } else { | 2560 | ctx->ht.is_40mhz = false; |
2901 | ctx->ht.extension_chan_offset = | ||
2902 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
2903 | ctx->ht.is_40mhz = false; | ||
2904 | } | ||
2905 | } else | ||
2906 | ctx->ht.is_40mhz = false; | ||
2907 | |||
2908 | if ((le16_to_cpu(ctx->staging.channel) != ch)) | ||
2909 | ctx->staging.flags = 0; | ||
2910 | |||
2911 | iwl_legacy_set_rxon_channel(priv, channel, ctx); | ||
2912 | iwl_legacy_set_rxon_ht(priv, ht_conf); | ||
2913 | iwl_legacy_set_flags_for_band(priv, ctx, channel->band, | ||
2914 | ctx->vif); | ||
2915 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2916 | |||
2917 | iwl_legacy_set_rate(priv); | ||
2918 | /* | ||
2919 | * at this point, staging_rxon has the | ||
2920 | * configuration for channel switch | ||
2921 | */ | ||
2922 | if (priv->cfg->ops->lib->set_channel_switch(priv, | ||
2923 | ch_switch)) | ||
2924 | priv->switch_rxon.switch_in_progress = false; | ||
2925 | } | 2561 | } |
2562 | } else | ||
2563 | ctx->ht.is_40mhz = false; | ||
2564 | |||
2565 | if ((le16_to_cpu(ctx->staging.channel) != ch)) | ||
2566 | ctx->staging.flags = 0; | ||
2567 | |||
2568 | iwl_legacy_set_rxon_channel(priv, channel, ctx); | ||
2569 | iwl_legacy_set_rxon_ht(priv, ht_conf); | ||
2570 | iwl_legacy_set_flags_for_band(priv, ctx, channel->band, ctx->vif); | ||
2571 | |||
2572 | spin_unlock_irq(&priv->lock); | ||
2573 | |||
2574 | iwl_legacy_set_rate(priv); | ||
2575 | /* | ||
2576 | * at this point, staging_rxon has the | ||
2577 | * configuration for channel switch | ||
2578 | */ | ||
2579 | set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); | ||
2580 | priv->switch_channel = cpu_to_le16(ch); | ||
2581 | if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) { | ||
2582 | clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); | ||
2583 | priv->switch_channel = 0; | ||
2584 | ieee80211_chswitch_done(ctx->vif, false); | ||
2926 | } | 2585 | } |
2586 | |||
2927 | out: | 2587 | out: |
2928 | mutex_unlock(&priv->mutex); | 2588 | mutex_unlock(&priv->mutex); |
2929 | if (!priv->switch_rxon.switch_in_progress) | ||
2930 | ieee80211_chswitch_done(ctx->vif, false); | ||
2931 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 2589 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
2932 | } | 2590 | } |
2933 | 2591 | ||
@@ -3034,10 +2692,6 @@ static void iwl4965_setup_deferred_work(struct iwl_priv *priv) | |||
3034 | priv->statistics_periodic.data = (unsigned long)priv; | 2692 | priv->statistics_periodic.data = (unsigned long)priv; |
3035 | priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; | 2693 | priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; |
3036 | 2694 | ||
3037 | init_timer(&priv->ucode_trace); | ||
3038 | priv->ucode_trace.data = (unsigned long)priv; | ||
3039 | priv->ucode_trace.function = iwl4965_bg_ucode_trace; | ||
3040 | |||
3041 | init_timer(&priv->watchdog); | 2695 | init_timer(&priv->watchdog); |
3042 | priv->watchdog.data = (unsigned long)priv; | 2696 | priv->watchdog.data = (unsigned long)priv; |
3043 | priv->watchdog.function = iwl_legacy_bg_watchdog; | 2697 | priv->watchdog.function = iwl_legacy_bg_watchdog; |
@@ -3056,7 +2710,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) | |||
3056 | iwl_legacy_cancel_scan_deferred_work(priv); | 2710 | iwl_legacy_cancel_scan_deferred_work(priv); |
3057 | 2711 | ||
3058 | del_timer_sync(&priv->statistics_periodic); | 2712 | del_timer_sync(&priv->statistics_periodic); |
3059 | del_timer_sync(&priv->ucode_trace); | ||
3060 | } | 2713 | } |
3061 | 2714 | ||
3062 | static void iwl4965_init_hw_rates(struct iwl_priv *priv, | 2715 | static void iwl4965_init_hw_rates(struct iwl_priv *priv, |
@@ -3132,13 +2785,9 @@ static int iwl4965_init_drv(struct iwl_priv *priv) | |||
3132 | priv->iw_mode = NL80211_IFTYPE_STATION; | 2785 | priv->iw_mode = NL80211_IFTYPE_STATION; |
3133 | priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; | 2786 | priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; |
3134 | priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; | 2787 | priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; |
3135 | priv->_4965.agg_tids_count = 0; | ||
3136 | 2788 | ||
3137 | /* initialize force reset */ | 2789 | /* initialize force reset */ |
3138 | priv->force_reset[IWL_RF_RESET].reset_duration = | 2790 | priv->force_reset.reset_duration = IWL_DELAY_NEXT_FORCE_FW_RELOAD; |
3139 | IWL_DELAY_NEXT_FORCE_RF_RESET; | ||
3140 | priv->force_reset[IWL_FW_RESET].reset_duration = | ||
3141 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; | ||
3142 | 2791 | ||
3143 | /* Choose which receivers/antennas to use */ | 2792 | /* Choose which receivers/antennas to use */ |
3144 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2793 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile index 822660483f9f..9a56ce546715 100644 --- a/drivers/net/wireless/iwlwifi/Makefile +++ b/drivers/net/wireless/iwlwifi/Makefile | |||
@@ -13,6 +13,7 @@ iwlagn-objs += iwl-5000.o | |||
13 | iwlagn-objs += iwl-6000.o | 13 | iwlagn-objs += iwl-6000.o |
14 | iwlagn-objs += iwl-1000.o | 14 | iwlagn-objs += iwl-1000.o |
15 | iwlagn-objs += iwl-2000.o | 15 | iwlagn-objs += iwl-2000.o |
16 | iwlagn-objs += iwl-pci.o | ||
16 | 17 | ||
17 | iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o | 18 | iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o |
18 | iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o | 19 | iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 7aa240e6ba1c..2daca80f086f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/pci.h> | ||
31 | #include <linux/dma-mapping.h> | ||
32 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
33 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
34 | #include <linux/netdevice.h> | 32 | #include <linux/netdevice.h> |
@@ -194,8 +192,6 @@ static struct iwl_lib_ops iwl1000_lib = { | |||
194 | .temp_ops = { | 192 | .temp_ops = { |
195 | .temperature = iwlagn_temperature, | 193 | .temperature = iwlagn_temperature, |
196 | }, | 194 | }, |
197 | .txfifo_flush = iwlagn_txfifo_flush, | ||
198 | .dev_txfifo_flush = iwlagn_dev_txfifo_flush, | ||
199 | }; | 195 | }; |
200 | 196 | ||
201 | static const struct iwl_ops iwl1000_ops = { | 197 | static const struct iwl_ops iwl1000_ops = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 5484ab712da8..1c1330035ca9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/pci.h> | ||
31 | #include <linux/dma-mapping.h> | ||
32 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
33 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
34 | #include <linux/netdevice.h> | 32 | #include <linux/netdevice.h> |
@@ -76,21 +74,7 @@ static void iwl2000_set_ct_threshold(struct iwl_priv *priv) | |||
76 | /* NIC configuration for 2000 series */ | 74 | /* NIC configuration for 2000 series */ |
77 | static void iwl2000_nic_config(struct iwl_priv *priv) | 75 | static void iwl2000_nic_config(struct iwl_priv *priv) |
78 | { | 76 | { |
79 | u16 radio_cfg; | 77 | iwl_rf_config(priv); |
80 | |||
81 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); | ||
82 | |||
83 | /* write radio config values to register */ | ||
84 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) | ||
85 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
86 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | | ||
87 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | | ||
88 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); | ||
89 | |||
90 | /* set CSR_HW_CONFIG_REG for uCode use */ | ||
91 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
92 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | ||
93 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | ||
94 | 78 | ||
95 | if (priv->cfg->iq_invert) | 79 | if (priv->cfg->iq_invert) |
96 | iwl_set_bit(priv, CSR_GP_DRIVER_REG, | 80 | iwl_set_bit(priv, CSR_GP_DRIVER_REG, |
@@ -204,8 +188,6 @@ static struct iwl_lib_ops iwl2000_lib = { | |||
204 | .temp_ops = { | 188 | .temp_ops = { |
205 | .temperature = iwlagn_temperature, | 189 | .temperature = iwlagn_temperature, |
206 | }, | 190 | }, |
207 | .txfifo_flush = iwlagn_txfifo_flush, | ||
208 | .dev_txfifo_flush = iwlagn_dev_txfifo_flush, | ||
209 | }; | 191 | }; |
210 | 192 | ||
211 | static const struct iwl_ops iwl2000_ops = { | 193 | static const struct iwl_ops iwl2000_ops = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 05ad47628b63..f9630a3c79fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h | |||
@@ -75,7 +75,7 @@ static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) | |||
75 | { | 75 | { |
76 | u16 temperature, voltage; | 76 | u16 temperature, voltage; |
77 | __le16 *temp_calib = | 77 | __le16 *temp_calib = |
78 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE); | 78 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_TEMPERATURE); |
79 | 79 | ||
80 | temperature = le16_to_cpu(temp_calib[0]); | 80 | temperature = le16_to_cpu(temp_calib[0]); |
81 | voltage = le16_to_cpu(temp_calib[1]); | 81 | voltage = le16_to_cpu(temp_calib[1]); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 4353a658de25..937a8f12afa7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/pci.h> | ||
31 | #include <linux/dma-mapping.h> | ||
32 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
33 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
34 | #include <linux/skbuff.h> | 32 | #include <linux/skbuff.h> |
@@ -66,23 +64,10 @@ | |||
66 | static void iwl5000_nic_config(struct iwl_priv *priv) | 64 | static void iwl5000_nic_config(struct iwl_priv *priv) |
67 | { | 65 | { |
68 | unsigned long flags; | 66 | unsigned long flags; |
69 | u16 radio_cfg; | ||
70 | 67 | ||
71 | spin_lock_irqsave(&priv->lock, flags); | 68 | iwl_rf_config(priv); |
72 | |||
73 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); | ||
74 | 69 | ||
75 | /* write radio config values to register */ | 70 | spin_lock_irqsave(&priv->lock, flags); |
76 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_RF_CONFIG_TYPE_MAX) | ||
77 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
78 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | | ||
79 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | | ||
80 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); | ||
81 | |||
82 | /* set CSR_HW_CONFIG_REG for uCode use */ | ||
83 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
84 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | ||
85 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | ||
86 | 71 | ||
87 | /* W/A : NIC is stuck in a reset state after Early PCIe power off | 72 | /* W/A : NIC is stuck in a reset state after Early PCIe power off |
88 | * (PCIe power is lost before PERST# is asserted), | 73 | * (PCIe power is lost before PERST# is asserted), |
@@ -361,8 +346,6 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
361 | .temp_ops = { | 346 | .temp_ops = { |
362 | .temperature = iwlagn_temperature, | 347 | .temperature = iwlagn_temperature, |
363 | }, | 348 | }, |
364 | .txfifo_flush = iwlagn_txfifo_flush, | ||
365 | .dev_txfifo_flush = iwlagn_dev_txfifo_flush, | ||
366 | }; | 349 | }; |
367 | 350 | ||
368 | static struct iwl_lib_ops iwl5150_lib = { | 351 | static struct iwl_lib_ops iwl5150_lib = { |
@@ -391,8 +374,6 @@ static struct iwl_lib_ops iwl5150_lib = { | |||
391 | .temp_ops = { | 374 | .temp_ops = { |
392 | .temperature = iwl5150_temperature, | 375 | .temperature = iwl5150_temperature, |
393 | }, | 376 | }, |
394 | .txfifo_flush = iwlagn_txfifo_flush, | ||
395 | .dev_txfifo_flush = iwlagn_dev_txfifo_flush, | ||
396 | }; | 377 | }; |
397 | 378 | ||
398 | static const struct iwl_ops iwl5000_ops = { | 379 | static const struct iwl_ops iwl5000_ops = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 6e5ce4478490..3fcc0925d542 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/pci.h> | ||
31 | #include <linux/dma-mapping.h> | ||
32 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
33 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
34 | #include <linux/netdevice.h> | 32 | #include <linux/netdevice.h> |
@@ -97,21 +95,7 @@ static void iwl6150_additional_nic_config(struct iwl_priv *priv) | |||
97 | /* NIC configuration for 6000 series */ | 95 | /* NIC configuration for 6000 series */ |
98 | static void iwl6000_nic_config(struct iwl_priv *priv) | 96 | static void iwl6000_nic_config(struct iwl_priv *priv) |
99 | { | 97 | { |
100 | u16 radio_cfg; | 98 | iwl_rf_config(priv); |
101 | |||
102 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); | ||
103 | |||
104 | /* write radio config values to register */ | ||
105 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) | ||
106 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
107 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | | ||
108 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | | ||
109 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); | ||
110 | |||
111 | /* set CSR_HW_CONFIG_REG for uCode use */ | ||
112 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
113 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | ||
114 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | ||
115 | 99 | ||
116 | /* no locking required for register write */ | 100 | /* no locking required for register write */ |
117 | if (priv->cfg->pa_type == IWL_PA_INTERNAL) { | 101 | if (priv->cfg->pa_type == IWL_PA_INTERNAL) { |
@@ -301,8 +285,6 @@ static struct iwl_lib_ops iwl6000_lib = { | |||
301 | .temp_ops = { | 285 | .temp_ops = { |
302 | .temperature = iwlagn_temperature, | 286 | .temperature = iwlagn_temperature, |
303 | }, | 287 | }, |
304 | .txfifo_flush = iwlagn_txfifo_flush, | ||
305 | .dev_txfifo_flush = iwlagn_dev_txfifo_flush, | ||
306 | }; | 288 | }; |
307 | 289 | ||
308 | static struct iwl_lib_ops iwl6030_lib = { | 290 | static struct iwl_lib_ops iwl6030_lib = { |
@@ -333,8 +315,6 @@ static struct iwl_lib_ops iwl6030_lib = { | |||
333 | .temp_ops = { | 315 | .temp_ops = { |
334 | .temperature = iwlagn_temperature, | 316 | .temperature = iwlagn_temperature, |
335 | }, | 317 | }, |
336 | .txfifo_flush = iwlagn_txfifo_flush, | ||
337 | .dev_txfifo_flush = iwlagn_dev_txfifo_flush, | ||
338 | }; | 318 | }; |
339 | 319 | ||
340 | static struct iwl_nic_ops iwl6050_nic_ops = { | 320 | static struct iwl_nic_ops iwl6050_nic_ops = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c index 2ef9448b1c20..7745816eaff4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c | |||
@@ -108,18 +108,16 @@ err: | |||
108 | 108 | ||
109 | int iwl_eeprom_check_sku(struct iwl_priv *priv) | 109 | int iwl_eeprom_check_sku(struct iwl_priv *priv) |
110 | { | 110 | { |
111 | u16 eeprom_sku; | ||
112 | u16 radio_cfg; | 111 | u16 radio_cfg; |
113 | 112 | ||
114 | eeprom_sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); | ||
115 | |||
116 | if (!priv->cfg->sku) { | 113 | if (!priv->cfg->sku) { |
117 | /* not using sku overwrite */ | 114 | /* not using sku overwrite */ |
118 | priv->cfg->sku = | 115 | priv->cfg->sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); |
119 | ((eeprom_sku & EEPROM_SKU_CAP_BAND_SELECTION) >> | 116 | if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE && |
120 | EEPROM_SKU_CAP_BAND_POS); | 117 | !priv->cfg->ht_params) { |
121 | if (eeprom_sku & EEPROM_SKU_CAP_11N_ENABLE) | 118 | IWL_ERR(priv, "Invalid 11n configuration\n"); |
122 | priv->cfg->sku |= IWL_SKU_N; | 119 | return -EINVAL; |
120 | } | ||
123 | } | 121 | } |
124 | if (!priv->cfg->sku) { | 122 | if (!priv->cfg->sku) { |
125 | IWL_ERR(priv, "Invalid device sku\n"); | 123 | IWL_ERR(priv, "Invalid device sku\n"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c index 23eee0ca5b35..ba7ed9157c92 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c | |||
@@ -111,10 +111,8 @@ static void iwlagn_gain_computation(struct iwl_priv *priv, | |||
111 | 111 | ||
112 | memset(&cmd, 0, sizeof(cmd)); | 112 | memset(&cmd, 0, sizeof(cmd)); |
113 | 113 | ||
114 | cmd.hdr.op_code = priv->_agn.phy_calib_chain_noise_gain_cmd; | 114 | iwl_set_calib_hdr(&cmd.hdr, |
115 | cmd.hdr.first_group = 0; | 115 | priv->_agn.phy_calib_chain_noise_gain_cmd); |
116 | cmd.hdr.groups_num = 1; | ||
117 | cmd.hdr.data_valid = 1; | ||
118 | cmd.delta_gain_1 = data->delta_gain_code[1]; | 116 | cmd.delta_gain_1 = data->delta_gain_code[1]; |
119 | cmd.delta_gain_2 = data->delta_gain_code[2]; | 117 | cmd.delta_gain_2 = data->delta_gain_code[2]; |
120 | iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, | 118 | iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, |
@@ -144,10 +142,8 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv) | |||
144 | data->beacon_count = 0; | 142 | data->beacon_count = 0; |
145 | 143 | ||
146 | memset(&cmd, 0, sizeof(cmd)); | 144 | memset(&cmd, 0, sizeof(cmd)); |
147 | cmd.hdr.op_code = priv->_agn.phy_calib_chain_noise_reset_cmd; | 145 | iwl_set_calib_hdr(&cmd.hdr, |
148 | cmd.hdr.first_group = 0; | 146 | priv->_agn.phy_calib_chain_noise_reset_cmd); |
149 | cmd.hdr.groups_num = 1; | ||
150 | cmd.hdr.data_valid = 1; | ||
151 | ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | 147 | ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, |
152 | sizeof(cmd), &cmd); | 148 | sizeof(cmd), &cmd); |
153 | if (ret) | 149 | if (ret) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h index 7bd19f4e66de..0e5b842529c4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h | |||
@@ -81,13 +81,6 @@ | |||
81 | /* RSSI to dBm */ | 81 | /* RSSI to dBm */ |
82 | #define IWLAGN_RSSI_OFFSET 44 | 82 | #define IWLAGN_RSSI_OFFSET 44 |
83 | 83 | ||
84 | /* PCI registers */ | ||
85 | #define PCI_CFG_RETRY_TIMEOUT 0x041 | ||
86 | |||
87 | /* PCI register values */ | ||
88 | #define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01 | ||
89 | #define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02 | ||
90 | |||
91 | #define IWLAGN_DEFAULT_TX_RETRY 15 | 84 | #define IWLAGN_DEFAULT_TX_RETRY 15 |
92 | 85 | ||
93 | /* Limit range of txpower output target to be between these values */ | 86 | /* Limit range of txpower output target to be between these values */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ict.c b/drivers/net/wireless/iwlwifi/iwl-agn-ict.c index 0d5fda44c3a3..f1b40ec1c873 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ict.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ict.c | |||
@@ -44,7 +44,7 @@ | |||
44 | void iwl_free_isr_ict(struct iwl_priv *priv) | 44 | void iwl_free_isr_ict(struct iwl_priv *priv) |
45 | { | 45 | { |
46 | if (priv->_agn.ict_tbl_vir) { | 46 | if (priv->_agn.ict_tbl_vir) { |
47 | dma_free_coherent(&priv->pci_dev->dev, | 47 | dma_free_coherent(priv->bus.dev, |
48 | (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, | 48 | (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, |
49 | priv->_agn.ict_tbl_vir, | 49 | priv->_agn.ict_tbl_vir, |
50 | priv->_agn.ict_tbl_dma); | 50 | priv->_agn.ict_tbl_dma); |
@@ -61,7 +61,7 @@ int iwl_alloc_isr_ict(struct iwl_priv *priv) | |||
61 | 61 | ||
62 | /* allocate shrared data table */ | 62 | /* allocate shrared data table */ |
63 | priv->_agn.ict_tbl_vir = | 63 | priv->_agn.ict_tbl_vir = |
64 | dma_alloc_coherent(&priv->pci_dev->dev, | 64 | dma_alloc_coherent(priv->bus.dev, |
65 | (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, | 65 | (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, |
66 | &priv->_agn.ict_tbl_dma, GFP_KERNEL); | 66 | &priv->_agn.ict_tbl_dma, GFP_KERNEL); |
67 | if (!priv->_agn.ict_tbl_vir) | 67 | if (!priv->_agn.ict_tbl_vir) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 677f73c4c1e3..efdab6506ae7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -438,7 +438,7 @@ static void iwlagn_rx_reply_tx(struct iwl_priv *priv, | |||
438 | if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 && | 438 | if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 && |
439 | priv->cfg->bt_params && | 439 | priv->cfg->bt_params && |
440 | priv->cfg->bt_params->advanced_bt_coexist) { | 440 | priv->cfg->bt_params->advanced_bt_coexist) { |
441 | IWL_WARN(priv, "receive reply tx with bt_kill\n"); | 441 | IWL_DEBUG_COEX(priv, "receive reply tx with bt_kill\n"); |
442 | } | 442 | } |
443 | iwlagn_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); | 443 | iwlagn_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); |
444 | 444 | ||
@@ -622,6 +622,9 @@ struct iwl_mod_params iwlagn_mod_params = { | |||
622 | .amsdu_size_8K = 1, | 622 | .amsdu_size_8K = 1, |
623 | .restart_fw = 1, | 623 | .restart_fw = 1, |
624 | .plcp_check = true, | 624 | .plcp_check = true, |
625 | .bt_coex_active = true, | ||
626 | .no_sleep_autoadjust = true, | ||
627 | .power_level = IWL_POWER_INDEX_1, | ||
625 | /* the rest are 0 by default */ | 628 | /* the rest are 0 by default */ |
626 | }; | 629 | }; |
627 | 630 | ||
@@ -637,9 +640,9 @@ void iwlagn_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
637 | /* In the reset function, these buffers may have been allocated | 640 | /* In the reset function, these buffers may have been allocated |
638 | * to an SKB, so we need to unmap and free potential storage */ | 641 | * to an SKB, so we need to unmap and free potential storage */ |
639 | if (rxq->pool[i].page != NULL) { | 642 | if (rxq->pool[i].page != NULL) { |
640 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 643 | dma_unmap_page(priv->bus.dev, rxq->pool[i].page_dma, |
641 | PAGE_SIZE << priv->hw_params.rx_page_order, | 644 | PAGE_SIZE << priv->hw_params.rx_page_order, |
642 | PCI_DMA_FROMDEVICE); | 645 | DMA_FROM_DEVICE); |
643 | __iwl_free_pages(priv, rxq->pool[i].page); | 646 | __iwl_free_pages(priv, rxq->pool[i].page); |
644 | rxq->pool[i].page = NULL; | 647 | rxq->pool[i].page = NULL; |
645 | } | 648 | } |
@@ -911,9 +914,9 @@ void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority) | |||
911 | BUG_ON(rxb->page); | 914 | BUG_ON(rxb->page); |
912 | rxb->page = page; | 915 | rxb->page = page; |
913 | /* Get physical address of the RB */ | 916 | /* Get physical address of the RB */ |
914 | rxb->page_dma = pci_map_page(priv->pci_dev, page, 0, | 917 | rxb->page_dma = dma_map_page(priv->bus.dev, page, 0, |
915 | PAGE_SIZE << priv->hw_params.rx_page_order, | 918 | PAGE_SIZE << priv->hw_params.rx_page_order, |
916 | PCI_DMA_FROMDEVICE); | 919 | DMA_FROM_DEVICE); |
917 | /* dma address must be no more than 36 bits */ | 920 | /* dma address must be no more than 36 bits */ |
918 | BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); | 921 | BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); |
919 | /* and also 256 byte aligned! */ | 922 | /* and also 256 byte aligned! */ |
@@ -956,17 +959,18 @@ void iwlagn_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
956 | int i; | 959 | int i; |
957 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | 960 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { |
958 | if (rxq->pool[i].page != NULL) { | 961 | if (rxq->pool[i].page != NULL) { |
959 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 962 | dma_unmap_page(priv->bus.dev, rxq->pool[i].page_dma, |
960 | PAGE_SIZE << priv->hw_params.rx_page_order, | 963 | PAGE_SIZE << priv->hw_params.rx_page_order, |
961 | PCI_DMA_FROMDEVICE); | 964 | DMA_FROM_DEVICE); |
962 | __iwl_free_pages(priv, rxq->pool[i].page); | 965 | __iwl_free_pages(priv, rxq->pool[i].page); |
963 | rxq->pool[i].page = NULL; | 966 | rxq->pool[i].page = NULL; |
964 | } | 967 | } |
965 | } | 968 | } |
966 | 969 | ||
967 | dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, | 970 | dma_free_coherent(priv->bus.dev, 4 * RX_QUEUE_SIZE, |
968 | rxq->bd_dma); | 971 | rxq->bd, rxq->bd_dma); |
969 | dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), | 972 | dma_free_coherent(priv->bus.dev, |
973 | sizeof(struct iwl_rb_status), | ||
970 | rxq->rb_stts, rxq->rb_stts_dma); | 974 | rxq->rb_stts, rxq->rb_stts_dma); |
971 | rxq->bd = NULL; | 975 | rxq->bd = NULL; |
972 | rxq->rb_stts = NULL; | 976 | rxq->rb_stts = NULL; |
@@ -1528,9 +1532,18 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) | |||
1528 | might_sleep(); | 1532 | might_sleep(); |
1529 | 1533 | ||
1530 | memset(&flush_cmd, 0, sizeof(flush_cmd)); | 1534 | memset(&flush_cmd, 0, sizeof(flush_cmd)); |
1531 | flush_cmd.fifo_control = IWL_TX_FIFO_VO_MSK | IWL_TX_FIFO_VI_MSK | | 1535 | if (flush_control & BIT(IWL_RXON_CTX_BSS)) |
1532 | IWL_TX_FIFO_BE_MSK | IWL_TX_FIFO_BK_MSK; | 1536 | flush_cmd.fifo_control = IWL_SCD_VO_MSK | IWL_SCD_VI_MSK | |
1533 | if (priv->cfg->sku & IWL_SKU_N) | 1537 | IWL_SCD_BE_MSK | IWL_SCD_BK_MSK | |
1538 | IWL_SCD_MGMT_MSK; | ||
1539 | if ((flush_control & BIT(IWL_RXON_CTX_PAN)) && | ||
1540 | (priv->valid_contexts != BIT(IWL_RXON_CTX_BSS))) | ||
1541 | flush_cmd.fifo_control |= IWL_PAN_SCD_VO_MSK | | ||
1542 | IWL_PAN_SCD_VI_MSK | IWL_PAN_SCD_BE_MSK | | ||
1543 | IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK | | ||
1544 | IWL_PAN_SCD_MULTICAST_MSK; | ||
1545 | |||
1546 | if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE) | ||
1534 | flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK; | 1547 | flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK; |
1535 | 1548 | ||
1536 | IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n", | 1549 | IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n", |
@@ -1544,7 +1557,7 @@ void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control) | |||
1544 | { | 1557 | { |
1545 | mutex_lock(&priv->mutex); | 1558 | mutex_lock(&priv->mutex); |
1546 | ieee80211_stop_queues(priv->hw); | 1559 | ieee80211_stop_queues(priv->hw); |
1547 | if (priv->cfg->ops->lib->txfifo_flush(priv, IWL_DROP_ALL)) { | 1560 | if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) { |
1548 | IWL_ERR(priv, "flush request fail\n"); | 1561 | IWL_ERR(priv, "flush request fail\n"); |
1549 | goto done; | 1562 | goto done; |
1550 | } | 1563 | } |
@@ -1699,7 +1712,8 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv) | |||
1699 | * (might be in monitor mode), or the interface is in | 1712 | * (might be in monitor mode), or the interface is in |
1700 | * IBSS mode (no proper uCode support for coex then). | 1713 | * IBSS mode (no proper uCode support for coex then). |
1701 | */ | 1714 | */ |
1702 | if (!bt_coex_active || priv->iw_mode == NL80211_IFTYPE_ADHOC) { | 1715 | if (!iwlagn_mod_params.bt_coex_active || |
1716 | priv->iw_mode == NL80211_IFTYPE_ADHOC) { | ||
1703 | basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED; | 1717 | basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED; |
1704 | } else { | 1718 | } else { |
1705 | basic.flags = IWLAGN_BT_FLAG_COEX_MODE_3W << | 1719 | basic.flags = IWLAGN_BT_FLAG_COEX_MODE_3W << |
@@ -1710,7 +1724,7 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv) | |||
1710 | 1724 | ||
1711 | if (priv->bt_ch_announce) | 1725 | if (priv->bt_ch_announce) |
1712 | basic.flags |= IWLAGN_BT_FLAG_CHANNEL_INHIBITION; | 1726 | basic.flags |= IWLAGN_BT_FLAG_CHANNEL_INHIBITION; |
1713 | IWL_DEBUG_INFO(priv, "BT coex flag: 0X%x\n", basic.flags); | 1727 | IWL_DEBUG_COEX(priv, "BT coex flag: 0X%x\n", basic.flags); |
1714 | } | 1728 | } |
1715 | priv->bt_enable_flag = basic.flags; | 1729 | priv->bt_enable_flag = basic.flags; |
1716 | if (priv->bt_full_concurrent) | 1730 | if (priv->bt_full_concurrent) |
@@ -1720,7 +1734,7 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv) | |||
1720 | memcpy(basic.bt3_lookup_table, iwlagn_def_3w_lookup, | 1734 | memcpy(basic.bt3_lookup_table, iwlagn_def_3w_lookup, |
1721 | sizeof(iwlagn_def_3w_lookup)); | 1735 | sizeof(iwlagn_def_3w_lookup)); |
1722 | 1736 | ||
1723 | IWL_DEBUG_INFO(priv, "BT coex %s in %s mode\n", | 1737 | IWL_DEBUG_COEX(priv, "BT coex %s in %s mode\n", |
1724 | basic.flags ? "active" : "disabled", | 1738 | basic.flags ? "active" : "disabled", |
1725 | priv->bt_full_concurrent ? | 1739 | priv->bt_full_concurrent ? |
1726 | "full concurrency" : "3-wire"); | 1740 | "full concurrency" : "3-wire"); |
@@ -1758,7 +1772,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work) | |||
1758 | * coex profile notifications. Ignore that since only bad consequence | 1772 | * coex profile notifications. Ignore that since only bad consequence |
1759 | * can be not matching debug print with actual state. | 1773 | * can be not matching debug print with actual state. |
1760 | */ | 1774 | */ |
1761 | IWL_DEBUG_INFO(priv, "BT traffic load changes: %d\n", | 1775 | IWL_DEBUG_COEX(priv, "BT traffic load changes: %d\n", |
1762 | priv->bt_traffic_load); | 1776 | priv->bt_traffic_load); |
1763 | 1777 | ||
1764 | switch (priv->bt_traffic_load) { | 1778 | switch (priv->bt_traffic_load) { |
@@ -1810,7 +1824,7 @@ out: | |||
1810 | static void iwlagn_print_uartmsg(struct iwl_priv *priv, | 1824 | static void iwlagn_print_uartmsg(struct iwl_priv *priv, |
1811 | struct iwl_bt_uart_msg *uart_msg) | 1825 | struct iwl_bt_uart_msg *uart_msg) |
1812 | { | 1826 | { |
1813 | IWL_DEBUG_NOTIF(priv, "Message Type = 0x%X, SSN = 0x%X, " | 1827 | IWL_DEBUG_COEX(priv, "Message Type = 0x%X, SSN = 0x%X, " |
1814 | "Update Req = 0x%X", | 1828 | "Update Req = 0x%X", |
1815 | (BT_UART_MSG_FRAME1MSGTYPE_MSK & uart_msg->frame1) >> | 1829 | (BT_UART_MSG_FRAME1MSGTYPE_MSK & uart_msg->frame1) >> |
1816 | BT_UART_MSG_FRAME1MSGTYPE_POS, | 1830 | BT_UART_MSG_FRAME1MSGTYPE_POS, |
@@ -1819,7 +1833,7 @@ static void iwlagn_print_uartmsg(struct iwl_priv *priv, | |||
1819 | (BT_UART_MSG_FRAME1UPDATEREQ_MSK & uart_msg->frame1) >> | 1833 | (BT_UART_MSG_FRAME1UPDATEREQ_MSK & uart_msg->frame1) >> |
1820 | BT_UART_MSG_FRAME1UPDATEREQ_POS); | 1834 | BT_UART_MSG_FRAME1UPDATEREQ_POS); |
1821 | 1835 | ||
1822 | IWL_DEBUG_NOTIF(priv, "Open connections = 0x%X, Traffic load = 0x%X, " | 1836 | IWL_DEBUG_COEX(priv, "Open connections = 0x%X, Traffic load = 0x%X, " |
1823 | "Chl_SeqN = 0x%X, In band = 0x%X", | 1837 | "Chl_SeqN = 0x%X, In band = 0x%X", |
1824 | (BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK & uart_msg->frame2) >> | 1838 | (BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK & uart_msg->frame2) >> |
1825 | BT_UART_MSG_FRAME2OPENCONNECTIONS_POS, | 1839 | BT_UART_MSG_FRAME2OPENCONNECTIONS_POS, |
@@ -1830,7 +1844,7 @@ static void iwlagn_print_uartmsg(struct iwl_priv *priv, | |||
1830 | (BT_UART_MSG_FRAME2INBAND_MSK & uart_msg->frame2) >> | 1844 | (BT_UART_MSG_FRAME2INBAND_MSK & uart_msg->frame2) >> |
1831 | BT_UART_MSG_FRAME2INBAND_POS); | 1845 | BT_UART_MSG_FRAME2INBAND_POS); |
1832 | 1846 | ||
1833 | IWL_DEBUG_NOTIF(priv, "SCO/eSCO = 0x%X, Sniff = 0x%X, A2DP = 0x%X, " | 1847 | IWL_DEBUG_COEX(priv, "SCO/eSCO = 0x%X, Sniff = 0x%X, A2DP = 0x%X, " |
1834 | "ACL = 0x%X, Master = 0x%X, OBEX = 0x%X", | 1848 | "ACL = 0x%X, Master = 0x%X, OBEX = 0x%X", |
1835 | (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >> | 1849 | (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >> |
1836 | BT_UART_MSG_FRAME3SCOESCO_POS, | 1850 | BT_UART_MSG_FRAME3SCOESCO_POS, |
@@ -1845,11 +1859,11 @@ static void iwlagn_print_uartmsg(struct iwl_priv *priv, | |||
1845 | (BT_UART_MSG_FRAME3OBEX_MSK & uart_msg->frame3) >> | 1859 | (BT_UART_MSG_FRAME3OBEX_MSK & uart_msg->frame3) >> |
1846 | BT_UART_MSG_FRAME3OBEX_POS); | 1860 | BT_UART_MSG_FRAME3OBEX_POS); |
1847 | 1861 | ||
1848 | IWL_DEBUG_NOTIF(priv, "Idle duration = 0x%X", | 1862 | IWL_DEBUG_COEX(priv, "Idle duration = 0x%X", |
1849 | (BT_UART_MSG_FRAME4IDLEDURATION_MSK & uart_msg->frame4) >> | 1863 | (BT_UART_MSG_FRAME4IDLEDURATION_MSK & uart_msg->frame4) >> |
1850 | BT_UART_MSG_FRAME4IDLEDURATION_POS); | 1864 | BT_UART_MSG_FRAME4IDLEDURATION_POS); |
1851 | 1865 | ||
1852 | IWL_DEBUG_NOTIF(priv, "Tx Activity = 0x%X, Rx Activity = 0x%X, " | 1866 | IWL_DEBUG_COEX(priv, "Tx Activity = 0x%X, Rx Activity = 0x%X, " |
1853 | "eSCO Retransmissions = 0x%X", | 1867 | "eSCO Retransmissions = 0x%X", |
1854 | (BT_UART_MSG_FRAME5TXACTIVITY_MSK & uart_msg->frame5) >> | 1868 | (BT_UART_MSG_FRAME5TXACTIVITY_MSK & uart_msg->frame5) >> |
1855 | BT_UART_MSG_FRAME5TXACTIVITY_POS, | 1869 | BT_UART_MSG_FRAME5TXACTIVITY_POS, |
@@ -1858,13 +1872,13 @@ static void iwlagn_print_uartmsg(struct iwl_priv *priv, | |||
1858 | (BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK & uart_msg->frame5) >> | 1872 | (BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK & uart_msg->frame5) >> |
1859 | BT_UART_MSG_FRAME5ESCORETRANSMIT_POS); | 1873 | BT_UART_MSG_FRAME5ESCORETRANSMIT_POS); |
1860 | 1874 | ||
1861 | IWL_DEBUG_NOTIF(priv, "Sniff Interval = 0x%X, Discoverable = 0x%X", | 1875 | IWL_DEBUG_COEX(priv, "Sniff Interval = 0x%X, Discoverable = 0x%X", |
1862 | (BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK & uart_msg->frame6) >> | 1876 | (BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK & uart_msg->frame6) >> |
1863 | BT_UART_MSG_FRAME6SNIFFINTERVAL_POS, | 1877 | BT_UART_MSG_FRAME6SNIFFINTERVAL_POS, |
1864 | (BT_UART_MSG_FRAME6DISCOVERABLE_MSK & uart_msg->frame6) >> | 1878 | (BT_UART_MSG_FRAME6DISCOVERABLE_MSK & uart_msg->frame6) >> |
1865 | BT_UART_MSG_FRAME6DISCOVERABLE_POS); | 1879 | BT_UART_MSG_FRAME6DISCOVERABLE_POS); |
1866 | 1880 | ||
1867 | IWL_DEBUG_NOTIF(priv, "Sniff Activity = 0x%X, Page = " | 1881 | IWL_DEBUG_COEX(priv, "Sniff Activity = 0x%X, Page = " |
1868 | "0x%X, Inquiry = 0x%X, Connectable = 0x%X", | 1882 | "0x%X, Inquiry = 0x%X, Connectable = 0x%X", |
1869 | (BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK & uart_msg->frame7) >> | 1883 | (BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK & uart_msg->frame7) >> |
1870 | BT_UART_MSG_FRAME7SNIFFACTIVITY_POS, | 1884 | BT_UART_MSG_FRAME7SNIFFACTIVITY_POS, |
@@ -1914,10 +1928,10 @@ void iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, | |||
1914 | return; | 1928 | return; |
1915 | } | 1929 | } |
1916 | 1930 | ||
1917 | IWL_DEBUG_NOTIF(priv, "BT Coex notification:\n"); | 1931 | IWL_DEBUG_COEX(priv, "BT Coex notification:\n"); |
1918 | IWL_DEBUG_NOTIF(priv, " status: %d\n", coex->bt_status); | 1932 | IWL_DEBUG_COEX(priv, " status: %d\n", coex->bt_status); |
1919 | IWL_DEBUG_NOTIF(priv, " traffic load: %d\n", coex->bt_traffic_load); | 1933 | IWL_DEBUG_COEX(priv, " traffic load: %d\n", coex->bt_traffic_load); |
1920 | IWL_DEBUG_NOTIF(priv, " CI compliance: %d\n", | 1934 | IWL_DEBUG_COEX(priv, " CI compliance: %d\n", |
1921 | coex->bt_ci_compliance); | 1935 | coex->bt_ci_compliance); |
1922 | iwlagn_print_uartmsg(priv, uart_msg); | 1936 | iwlagn_print_uartmsg(priv, uart_msg); |
1923 | 1937 | ||
@@ -2315,7 +2329,8 @@ int iwlagn_start_device(struct iwl_priv *priv) | |||
2315 | { | 2329 | { |
2316 | int ret; | 2330 | int ret; |
2317 | 2331 | ||
2318 | if (iwl_prepare_card_hw(priv)) { | 2332 | if ((priv->cfg->sku & EEPROM_SKU_CAP_AMT_ENABLE) && |
2333 | iwl_prepare_card_hw(priv)) { | ||
2319 | IWL_WARN(priv, "Exit HW not ready\n"); | 2334 | IWL_WARN(priv, "Exit HW not ready\n"); |
2320 | return -EIO; | 2335 | return -EIO; |
2321 | } | 2336 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c index 348f74f1c8e8..f501d742984c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c | |||
@@ -198,7 +198,7 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data) | |||
198 | /* Reschedule the ct_kill timer to occur in | 198 | /* Reschedule the ct_kill timer to occur in |
199 | * CT_KILL_EXIT_DURATION seconds to ensure we get a | 199 | * CT_KILL_EXIT_DURATION seconds to ensure we get a |
200 | * thermal update */ | 200 | * thermal update */ |
201 | IWL_DEBUG_POWER(priv, "schedule ct_kill exit timer\n"); | 201 | IWL_DEBUG_TEMP(priv, "schedule ct_kill exit timer\n"); |
202 | mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, | 202 | mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, |
203 | jiffies + CT_KILL_EXIT_DURATION * HZ); | 203 | jiffies + CT_KILL_EXIT_DURATION * HZ); |
204 | } | 204 | } |
@@ -208,15 +208,15 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv, | |||
208 | bool stop) | 208 | bool stop) |
209 | { | 209 | { |
210 | if (stop) { | 210 | if (stop) { |
211 | IWL_DEBUG_POWER(priv, "Stop all queues\n"); | 211 | IWL_DEBUG_TEMP(priv, "Stop all queues\n"); |
212 | if (priv->mac80211_registered) | 212 | if (priv->mac80211_registered) |
213 | ieee80211_stop_queues(priv->hw); | 213 | ieee80211_stop_queues(priv->hw); |
214 | IWL_DEBUG_POWER(priv, | 214 | IWL_DEBUG_TEMP(priv, |
215 | "Schedule 5 seconds CT_KILL Timer\n"); | 215 | "Schedule 5 seconds CT_KILL Timer\n"); |
216 | mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, | 216 | mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, |
217 | jiffies + CT_KILL_EXIT_DURATION * HZ); | 217 | jiffies + CT_KILL_EXIT_DURATION * HZ); |
218 | } else { | 218 | } else { |
219 | IWL_DEBUG_POWER(priv, "Wake all queues\n"); | 219 | IWL_DEBUG_TEMP(priv, "Wake all queues\n"); |
220 | if (priv->mac80211_registered) | 220 | if (priv->mac80211_registered) |
221 | ieee80211_wake_queues(priv->hw); | 221 | ieee80211_wake_queues(priv->hw); |
222 | } | 222 | } |
@@ -232,7 +232,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data) | |||
232 | 232 | ||
233 | /* temperature timer expired, ready to go into CT_KILL state */ | 233 | /* temperature timer expired, ready to go into CT_KILL state */ |
234 | if (tt->state != IWL_TI_CT_KILL) { | 234 | if (tt->state != IWL_TI_CT_KILL) { |
235 | IWL_DEBUG_POWER(priv, "entering CT_KILL state when " | 235 | IWL_DEBUG_TEMP(priv, "entering CT_KILL state when " |
236 | "temperature timer expired\n"); | 236 | "temperature timer expired\n"); |
237 | tt->state = IWL_TI_CT_KILL; | 237 | tt->state = IWL_TI_CT_KILL; |
238 | set_bit(STATUS_CT_KILL, &priv->status); | 238 | set_bit(STATUS_CT_KILL, &priv->status); |
@@ -242,7 +242,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data) | |||
242 | 242 | ||
243 | static void iwl_prepare_ct_kill_task(struct iwl_priv *priv) | 243 | static void iwl_prepare_ct_kill_task(struct iwl_priv *priv) |
244 | { | 244 | { |
245 | IWL_DEBUG_POWER(priv, "Prepare to enter IWL_TI_CT_KILL\n"); | 245 | IWL_DEBUG_TEMP(priv, "Prepare to enter IWL_TI_CT_KILL\n"); |
246 | /* make request to retrieve statistics information */ | 246 | /* make request to retrieve statistics information */ |
247 | iwl_send_statistics_request(priv, CMD_SYNC, false); | 247 | iwl_send_statistics_request(priv, CMD_SYNC, false); |
248 | /* Reschedule the ct_kill wait timer */ | 248 | /* Reschedule the ct_kill wait timer */ |
@@ -273,7 +273,7 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force) | |||
273 | (temp > tt->tt_previous_temp) && | 273 | (temp > tt->tt_previous_temp) && |
274 | ((temp - tt->tt_previous_temp) > | 274 | ((temp - tt->tt_previous_temp) > |
275 | IWL_TT_INCREASE_MARGIN)) { | 275 | IWL_TT_INCREASE_MARGIN)) { |
276 | IWL_DEBUG_POWER(priv, | 276 | IWL_DEBUG_TEMP(priv, |
277 | "Temperature increase %d degree Celsius\n", | 277 | "Temperature increase %d degree Celsius\n", |
278 | (temp - tt->tt_previous_temp)); | 278 | (temp - tt->tt_previous_temp)); |
279 | } | 279 | } |
@@ -338,9 +338,9 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force) | |||
338 | } else if (old_state == IWL_TI_CT_KILL && | 338 | } else if (old_state == IWL_TI_CT_KILL && |
339 | tt->state != IWL_TI_CT_KILL) | 339 | tt->state != IWL_TI_CT_KILL) |
340 | iwl_perform_ct_kill_task(priv, false); | 340 | iwl_perform_ct_kill_task(priv, false); |
341 | IWL_DEBUG_POWER(priv, "Temperature state changed %u\n", | 341 | IWL_DEBUG_TEMP(priv, "Temperature state changed %u\n", |
342 | tt->state); | 342 | tt->state); |
343 | IWL_DEBUG_POWER(priv, "Power Index change to %u\n", | 343 | IWL_DEBUG_TEMP(priv, "Power Index change to %u\n", |
344 | tt->tt_power_mode); | 344 | tt->tt_power_mode); |
345 | } | 345 | } |
346 | mutex_unlock(&priv->mutex); | 346 | mutex_unlock(&priv->mutex); |
@@ -397,7 +397,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) | |||
397 | (temp > tt->tt_previous_temp) && | 397 | (temp > tt->tt_previous_temp) && |
398 | ((temp - tt->tt_previous_temp) > | 398 | ((temp - tt->tt_previous_temp) > |
399 | IWL_TT_INCREASE_MARGIN)) { | 399 | IWL_TT_INCREASE_MARGIN)) { |
400 | IWL_DEBUG_POWER(priv, | 400 | IWL_DEBUG_TEMP(priv, |
401 | "Temperature increase %d " | 401 | "Temperature increase %d " |
402 | "degree Celsius\n", | 402 | "degree Celsius\n", |
403 | (temp - tt->tt_previous_temp)); | 403 | (temp - tt->tt_previous_temp)); |
@@ -467,13 +467,13 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) | |||
467 | set_bit(STATUS_CT_KILL, &priv->status); | 467 | set_bit(STATUS_CT_KILL, &priv->status); |
468 | tt->state = old_state; | 468 | tt->state = old_state; |
469 | } else { | 469 | } else { |
470 | IWL_DEBUG_POWER(priv, | 470 | IWL_DEBUG_TEMP(priv, |
471 | "Thermal Throttling to new state: %u\n", | 471 | "Thermal Throttling to new state: %u\n", |
472 | tt->state); | 472 | tt->state); |
473 | if (old_state != IWL_TI_CT_KILL && | 473 | if (old_state != IWL_TI_CT_KILL && |
474 | tt->state == IWL_TI_CT_KILL) { | 474 | tt->state == IWL_TI_CT_KILL) { |
475 | if (force) { | 475 | if (force) { |
476 | IWL_DEBUG_POWER(priv, | 476 | IWL_DEBUG_TEMP(priv, |
477 | "Enter IWL_TI_CT_KILL\n"); | 477 | "Enter IWL_TI_CT_KILL\n"); |
478 | set_bit(STATUS_CT_KILL, &priv->status); | 478 | set_bit(STATUS_CT_KILL, &priv->status); |
479 | iwl_perform_ct_kill_task(priv, true); | 479 | iwl_perform_ct_kill_task(priv, true); |
@@ -483,7 +483,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) | |||
483 | } | 483 | } |
484 | } else if (old_state == IWL_TI_CT_KILL && | 484 | } else if (old_state == IWL_TI_CT_KILL && |
485 | tt->state != IWL_TI_CT_KILL) { | 485 | tt->state != IWL_TI_CT_KILL) { |
486 | IWL_DEBUG_POWER(priv, "Exit IWL_TI_CT_KILL\n"); | 486 | IWL_DEBUG_TEMP(priv, "Exit IWL_TI_CT_KILL\n"); |
487 | iwl_perform_ct_kill_task(priv, false); | 487 | iwl_perform_ct_kill_task(priv, false); |
488 | } | 488 | } |
489 | } | 489 | } |
@@ -568,7 +568,7 @@ void iwl_tt_enter_ct_kill(struct iwl_priv *priv) | |||
568 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 568 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
569 | return; | 569 | return; |
570 | 570 | ||
571 | IWL_DEBUG_POWER(priv, "Queueing critical temperature enter.\n"); | 571 | IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n"); |
572 | queue_work(priv->workqueue, &priv->ct_enter); | 572 | queue_work(priv->workqueue, &priv->ct_enter); |
573 | } | 573 | } |
574 | 574 | ||
@@ -577,7 +577,7 @@ void iwl_tt_exit_ct_kill(struct iwl_priv *priv) | |||
577 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 577 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
578 | return; | 578 | return; |
579 | 579 | ||
580 | IWL_DEBUG_POWER(priv, "Queueing critical temperature exit.\n"); | 580 | IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n"); |
581 | queue_work(priv->workqueue, &priv->ct_exit); | 581 | queue_work(priv->workqueue, &priv->ct_exit); |
582 | } | 582 | } |
583 | 583 | ||
@@ -603,7 +603,7 @@ void iwl_tt_handler(struct iwl_priv *priv) | |||
603 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 603 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
604 | return; | 604 | return; |
605 | 605 | ||
606 | IWL_DEBUG_POWER(priv, "Queueing thermal throttling work.\n"); | 606 | IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n"); |
607 | queue_work(priv->workqueue, &priv->tt_work); | 607 | queue_work(priv->workqueue, &priv->tt_work); |
608 | } | 608 | } |
609 | 609 | ||
@@ -618,7 +618,7 @@ void iwl_tt_initialize(struct iwl_priv *priv) | |||
618 | int size = sizeof(struct iwl_tt_trans) * (IWL_TI_STATE_MAX - 1); | 618 | int size = sizeof(struct iwl_tt_trans) * (IWL_TI_STATE_MAX - 1); |
619 | struct iwl_tt_trans *transaction; | 619 | struct iwl_tt_trans *transaction; |
620 | 620 | ||
621 | IWL_DEBUG_POWER(priv, "Initialize Thermal Throttling\n"); | 621 | IWL_DEBUG_TEMP(priv, "Initialize Thermal Throttling\n"); |
622 | 622 | ||
623 | memset(tt, 0, sizeof(struct iwl_tt_mgmt)); | 623 | memset(tt, 0, sizeof(struct iwl_tt_mgmt)); |
624 | 624 | ||
@@ -638,7 +638,7 @@ void iwl_tt_initialize(struct iwl_priv *priv) | |||
638 | INIT_WORK(&priv->ct_exit, iwl_bg_ct_exit); | 638 | INIT_WORK(&priv->ct_exit, iwl_bg_ct_exit); |
639 | 639 | ||
640 | if (priv->cfg->base_params->adv_thermal_throttle) { | 640 | if (priv->cfg->base_params->adv_thermal_throttle) { |
641 | IWL_DEBUG_POWER(priv, "Advanced Thermal Throttling\n"); | 641 | IWL_DEBUG_TEMP(priv, "Advanced Thermal Throttling\n"); |
642 | tt->restriction = kzalloc(sizeof(struct iwl_tt_restriction) * | 642 | tt->restriction = kzalloc(sizeof(struct iwl_tt_restriction) * |
643 | IWL_TI_STATE_MAX, GFP_KERNEL); | 643 | IWL_TI_STATE_MAX, GFP_KERNEL); |
644 | tt->transaction = kzalloc(sizeof(struct iwl_tt_trans) * | 644 | tt->transaction = kzalloc(sizeof(struct iwl_tt_trans) * |
@@ -671,7 +671,7 @@ void iwl_tt_initialize(struct iwl_priv *priv) | |||
671 | priv->thermal_throttle.advanced_tt = true; | 671 | priv->thermal_throttle.advanced_tt = true; |
672 | } | 672 | } |
673 | } else { | 673 | } else { |
674 | IWL_DEBUG_POWER(priv, "Legacy Thermal Throttling\n"); | 674 | IWL_DEBUG_TEMP(priv, "Legacy Thermal Throttling\n"); |
675 | priv->thermal_throttle.advanced_tt = false; | 675 | priv->thermal_throttle.advanced_tt = false; |
676 | } | 676 | } |
677 | } | 677 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index 8bd48f61a9f5..d0ac090399e9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -716,10 +716,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
716 | 716 | ||
717 | /* Physical address of this Tx command's header (not MAC header!), | 717 | /* Physical address of this Tx command's header (not MAC header!), |
718 | * within command buffer array. */ | 718 | * within command buffer array. */ |
719 | txcmd_phys = pci_map_single(priv->pci_dev, | 719 | txcmd_phys = dma_map_single(priv->bus.dev, |
720 | &out_cmd->hdr, firstlen, | 720 | &out_cmd->hdr, firstlen, |
721 | PCI_DMA_BIDIRECTIONAL); | 721 | DMA_BIDIRECTIONAL); |
722 | if (unlikely(pci_dma_mapping_error(priv->pci_dev, txcmd_phys))) | 722 | if (unlikely(dma_mapping_error(priv->bus.dev, txcmd_phys))) |
723 | goto drop_unlock_sta; | 723 | goto drop_unlock_sta; |
724 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); | 724 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); |
725 | dma_unmap_len_set(out_meta, len, firstlen); | 725 | dma_unmap_len_set(out_meta, len, firstlen); |
@@ -735,13 +735,13 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
735 | * if any (802.11 null frames have no payload). */ | 735 | * if any (802.11 null frames have no payload). */ |
736 | secondlen = skb->len - hdr_len; | 736 | secondlen = skb->len - hdr_len; |
737 | if (secondlen > 0) { | 737 | if (secondlen > 0) { |
738 | phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, | 738 | phys_addr = dma_map_single(priv->bus.dev, skb->data + hdr_len, |
739 | secondlen, PCI_DMA_TODEVICE); | 739 | secondlen, DMA_TO_DEVICE); |
740 | if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) { | 740 | if (unlikely(dma_mapping_error(priv->bus.dev, phys_addr))) { |
741 | pci_unmap_single(priv->pci_dev, | 741 | dma_unmap_single(priv->bus.dev, |
742 | dma_unmap_addr(out_meta, mapping), | 742 | dma_unmap_addr(out_meta, mapping), |
743 | dma_unmap_len(out_meta, len), | 743 | dma_unmap_len(out_meta, len), |
744 | PCI_DMA_BIDIRECTIONAL); | 744 | DMA_BIDIRECTIONAL); |
745 | goto drop_unlock_sta; | 745 | goto drop_unlock_sta; |
746 | } | 746 | } |
747 | } | 747 | } |
@@ -764,8 +764,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
764 | offsetof(struct iwl_tx_cmd, scratch); | 764 | offsetof(struct iwl_tx_cmd, scratch); |
765 | 765 | ||
766 | /* take back ownership of DMA buffer to enable update */ | 766 | /* take back ownership of DMA buffer to enable update */ |
767 | pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys, | 767 | dma_sync_single_for_cpu(priv->bus.dev, txcmd_phys, firstlen, |
768 | firstlen, PCI_DMA_BIDIRECTIONAL); | 768 | DMA_BIDIRECTIONAL); |
769 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); | 769 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); |
770 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); | 770 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); |
771 | 771 | ||
@@ -780,8 +780,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
780 | iwlagn_txq_update_byte_cnt_tbl(priv, txq, | 780 | iwlagn_txq_update_byte_cnt_tbl(priv, txq, |
781 | le16_to_cpu(tx_cmd->len)); | 781 | le16_to_cpu(tx_cmd->len)); |
782 | 782 | ||
783 | pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys, | 783 | dma_sync_single_for_device(priv->bus.dev, txcmd_phys, firstlen, |
784 | firstlen, PCI_DMA_BIDIRECTIONAL); | 784 | DMA_BIDIRECTIONAL); |
785 | 785 | ||
786 | trace_iwlwifi_dev_tx(priv, | 786 | trace_iwlwifi_dev_tx(priv, |
787 | &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr], | 787 | &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr], |
@@ -834,8 +834,8 @@ drop_unlock_priv: | |||
834 | static inline int iwlagn_alloc_dma_ptr(struct iwl_priv *priv, | 834 | static inline int iwlagn_alloc_dma_ptr(struct iwl_priv *priv, |
835 | struct iwl_dma_ptr *ptr, size_t size) | 835 | struct iwl_dma_ptr *ptr, size_t size) |
836 | { | 836 | { |
837 | ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, | 837 | ptr->addr = dma_alloc_coherent(priv->bus.dev, size, |
838 | GFP_KERNEL); | 838 | &ptr->dma, GFP_KERNEL); |
839 | if (!ptr->addr) | 839 | if (!ptr->addr) |
840 | return -ENOMEM; | 840 | return -ENOMEM; |
841 | ptr->size = size; | 841 | ptr->size = size; |
@@ -848,7 +848,7 @@ static inline void iwlagn_free_dma_ptr(struct iwl_priv *priv, | |||
848 | if (unlikely(!ptr->addr)) | 848 | if (unlikely(!ptr->addr)) |
849 | return; | 849 | return; |
850 | 850 | ||
851 | dma_free_coherent(&priv->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); | 851 | dma_free_coherent(priv->bus.dev, ptr->size, ptr->addr, ptr->dma); |
852 | memset(ptr, 0, sizeof(*ptr)); | 852 | memset(ptr, 0, sizeof(*ptr)); |
853 | } | 853 | } |
854 | 854 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c index 97de5d9de67b..de8277e32253 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | |||
@@ -143,7 +143,7 @@ static int iwlagn_load_section(struct iwl_priv *priv, const char *name, | |||
143 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | | 143 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | |
144 | FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); | 144 | FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); |
145 | 145 | ||
146 | IWL_DEBUG_INFO(priv, "%s uCode section being loaded...\n", name); | 146 | IWL_DEBUG_FW(priv, "%s uCode section being loaded...\n", name); |
147 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, | 147 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, |
148 | priv->ucode_write_complete, 5 * HZ); | 148 | priv->ucode_write_complete, 5 * HZ); |
149 | if (ret == -ERESTARTSYS) { | 149 | if (ret == -ERESTARTSYS) { |
@@ -183,10 +183,7 @@ static int iwlagn_set_Xtal_calib(struct iwl_priv *priv) | |||
183 | __le16 *xtal_calib = | 183 | __le16 *xtal_calib = |
184 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_XTAL); | 184 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_XTAL); |
185 | 185 | ||
186 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; | 186 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD); |
187 | cmd.hdr.first_group = 0; | ||
188 | cmd.hdr.groups_num = 1; | ||
189 | cmd.hdr.data_valid = 1; | ||
190 | cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); | 187 | cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); |
191 | cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); | 188 | cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); |
192 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], | 189 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], |
@@ -197,15 +194,14 @@ static int iwlagn_set_temperature_offset_calib(struct iwl_priv *priv) | |||
197 | { | 194 | { |
198 | struct iwl_calib_temperature_offset_cmd cmd; | 195 | struct iwl_calib_temperature_offset_cmd cmd; |
199 | __le16 *offset_calib = | 196 | __le16 *offset_calib = |
200 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE); | 197 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_TEMPERATURE); |
201 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD; | 198 | |
202 | cmd.hdr.first_group = 0; | 199 | memset(&cmd, 0, sizeof(cmd)); |
203 | cmd.hdr.groups_num = 1; | 200 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); |
204 | cmd.hdr.data_valid = 1; | ||
205 | cmd.radio_sensor_offset = le16_to_cpu(offset_calib[1]); | 201 | cmd.radio_sensor_offset = le16_to_cpu(offset_calib[1]); |
206 | if (!(cmd.radio_sensor_offset)) | 202 | if (!(cmd.radio_sensor_offset)) |
207 | cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; | 203 | cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; |
208 | cmd.reserved = 0; | 204 | |
209 | IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n", | 205 | IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n", |
210 | cmd.radio_sensor_offset); | 206 | cmd.radio_sensor_offset); |
211 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_TEMP_OFFSET], | 207 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_TEMP_OFFSET], |
@@ -508,7 +504,7 @@ static int iwlcore_verify_inst_sparse(struct iwl_priv *priv, | |||
508 | u32 val; | 504 | u32 val; |
509 | u32 i; | 505 | u32 i; |
510 | 506 | ||
511 | IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); | 507 | IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len); |
512 | 508 | ||
513 | for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { | 509 | for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { |
514 | /* read data comes through single port, auto-incr addr */ | 510 | /* read data comes through single port, auto-incr addr */ |
@@ -533,7 +529,7 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv, | |||
533 | u32 offs; | 529 | u32 offs; |
534 | int errors = 0; | 530 | int errors = 0; |
535 | 531 | ||
536 | IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); | 532 | IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len); |
537 | 533 | ||
538 | iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, | 534 | iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, |
539 | IWLAGN_RTC_INST_LOWER_BOUND); | 535 | IWLAGN_RTC_INST_LOWER_BOUND); |
@@ -559,7 +555,7 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv, | |||
559 | static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_img *img) | 555 | static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_img *img) |
560 | { | 556 | { |
561 | if (!iwlcore_verify_inst_sparse(priv, &img->code)) { | 557 | if (!iwlcore_verify_inst_sparse(priv, &img->code)) { |
562 | IWL_DEBUG_INFO(priv, "uCode is good in inst SRAM\n"); | 558 | IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n"); |
563 | return 0; | 559 | return 0; |
564 | } | 560 | } |
565 | 561 | ||
@@ -583,7 +579,7 @@ static void iwlagn_alive_fn(struct iwl_priv *priv, | |||
583 | 579 | ||
584 | palive = &pkt->u.alive_frame; | 580 | palive = &pkt->u.alive_frame; |
585 | 581 | ||
586 | IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " | 582 | IWL_DEBUG_FW(priv, "Alive ucode status 0x%08X revision " |
587 | "0x%01X 0x%01X\n", | 583 | "0x%01X 0x%01X\n", |
588 | palive->is_valid, palive->ver_type, | 584 | palive->is_valid, palive->ver_type, |
589 | palive->ver_subtype); | 585 | palive->ver_subtype); |
@@ -602,12 +598,12 @@ static void iwlagn_alive_fn(struct iwl_priv *priv, | |||
602 | 598 | ||
603 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | 599 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, |
604 | struct fw_img *image, | 600 | struct fw_img *image, |
605 | int subtype, int alternate_subtype) | 601 | enum iwlagn_ucode_type ucode_type) |
606 | { | 602 | { |
607 | struct iwl_notification_wait alive_wait; | 603 | struct iwl_notification_wait alive_wait; |
608 | struct iwlagn_alive_data alive_data; | 604 | struct iwlagn_alive_data alive_data; |
609 | int ret; | 605 | int ret; |
610 | enum iwlagn_ucode_subtype old_type; | 606 | enum iwlagn_ucode_type old_type; |
611 | 607 | ||
612 | ret = iwlagn_start_device(priv); | 608 | ret = iwlagn_start_device(priv); |
613 | if (ret) | 609 | if (ret) |
@@ -617,7 +613,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | |||
617 | iwlagn_alive_fn, &alive_data); | 613 | iwlagn_alive_fn, &alive_data); |
618 | 614 | ||
619 | old_type = priv->ucode_type; | 615 | old_type = priv->ucode_type; |
620 | priv->ucode_type = subtype; | 616 | priv->ucode_type = ucode_type; |
621 | 617 | ||
622 | ret = iwlagn_load_given_ucode(priv, image); | 618 | ret = iwlagn_load_given_ucode(priv, image); |
623 | if (ret) { | 619 | if (ret) { |
@@ -645,15 +641,6 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | |||
645 | return -EIO; | 641 | return -EIO; |
646 | } | 642 | } |
647 | 643 | ||
648 | if (alive_data.subtype != subtype && | ||
649 | alive_data.subtype != alternate_subtype) { | ||
650 | IWL_ERR(priv, | ||
651 | "Loaded ucode is not expected type (got %d, expected %d)!\n", | ||
652 | alive_data.subtype, subtype); | ||
653 | priv->ucode_type = old_type; | ||
654 | return -EIO; | ||
655 | } | ||
656 | |||
657 | ret = iwl_verify_ucode(priv, image); | 644 | ret = iwl_verify_ucode(priv, image); |
658 | if (ret) { | 645 | if (ret) { |
659 | priv->ucode_type = old_type; | 646 | priv->ucode_type = old_type; |
@@ -685,7 +672,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) | |||
685 | if (!priv->ucode_init.code.len) | 672 | if (!priv->ucode_init.code.len) |
686 | return 0; | 673 | return 0; |
687 | 674 | ||
688 | if (priv->ucode_type != UCODE_SUBTYPE_NONE_LOADED) | 675 | if (priv->ucode_type != IWL_UCODE_NONE) |
689 | return 0; | 676 | return 0; |
690 | 677 | ||
691 | iwlagn_init_notification_wait(priv, &calib_wait, | 678 | iwlagn_init_notification_wait(priv, &calib_wait, |
@@ -694,7 +681,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) | |||
694 | 681 | ||
695 | /* Will also start the device */ | 682 | /* Will also start the device */ |
696 | ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, | 683 | ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, |
697 | UCODE_SUBTYPE_INIT, -1); | 684 | IWL_UCODE_INIT); |
698 | if (ret) | 685 | if (ret) |
699 | goto error; | 686 | goto error; |
700 | 687 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 099c2795ec0b..77ceb8deff75 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -32,8 +32,6 @@ | |||
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/pci.h> | ||
36 | #include <linux/pci-aspm.h> | ||
37 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
38 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
39 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
@@ -49,8 +47,6 @@ | |||
49 | 47 | ||
50 | #include <asm/div64.h> | 48 | #include <asm/div64.h> |
51 | 49 | ||
52 | #define DRV_NAME "iwlagn" | ||
53 | |||
54 | #include "iwl-eeprom.h" | 50 | #include "iwl-eeprom.h" |
55 | #include "iwl-dev.h" | 51 | #include "iwl-dev.h" |
56 | #include "iwl-core.h" | 52 | #include "iwl-core.h" |
@@ -59,6 +55,7 @@ | |||
59 | #include "iwl-sta.h" | 55 | #include "iwl-sta.h" |
60 | #include "iwl-agn-calib.h" | 56 | #include "iwl-agn-calib.h" |
61 | #include "iwl-agn.h" | 57 | #include "iwl-agn.h" |
58 | #include "iwl-pci.h" | ||
62 | 59 | ||
63 | 60 | ||
64 | /****************************************************************************** | 61 | /****************************************************************************** |
@@ -440,10 +437,8 @@ static void iwl_bg_tx_flush(struct work_struct *work) | |||
440 | if (!iwl_is_ready_rf(priv)) | 437 | if (!iwl_is_ready_rf(priv)) |
441 | return; | 438 | return; |
442 | 439 | ||
443 | if (priv->cfg->ops->lib->txfifo_flush) { | 440 | IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n"); |
444 | IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n"); | 441 | iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); |
445 | iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); | ||
446 | } | ||
447 | } | 442 | } |
448 | 443 | ||
449 | /** | 444 | /** |
@@ -497,9 +492,9 @@ static void iwl_rx_handle(struct iwl_priv *priv) | |||
497 | 492 | ||
498 | rxq->queue[i] = NULL; | 493 | rxq->queue[i] = NULL; |
499 | 494 | ||
500 | pci_unmap_page(priv->pci_dev, rxb->page_dma, | 495 | dma_unmap_page(priv->bus.dev, rxb->page_dma, |
501 | PAGE_SIZE << priv->hw_params.rx_page_order, | 496 | PAGE_SIZE << priv->hw_params.rx_page_order, |
502 | PCI_DMA_FROMDEVICE); | 497 | DMA_FROM_DEVICE); |
503 | pkt = rxb_addr(rxb); | 498 | pkt = rxb_addr(rxb); |
504 | 499 | ||
505 | len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; | 500 | len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; |
@@ -581,9 +576,9 @@ static void iwl_rx_handle(struct iwl_priv *priv) | |||
581 | * rx_free list for reuse later. */ | 576 | * rx_free list for reuse later. */ |
582 | spin_lock_irqsave(&rxq->lock, flags); | 577 | spin_lock_irqsave(&rxq->lock, flags); |
583 | if (rxb->page != NULL) { | 578 | if (rxb->page != NULL) { |
584 | rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page, | 579 | rxb->page_dma = dma_map_page(priv->bus.dev, rxb->page, |
585 | 0, PAGE_SIZE << priv->hw_params.rx_page_order, | 580 | 0, PAGE_SIZE << priv->hw_params.rx_page_order, |
586 | PCI_DMA_FROMDEVICE); | 581 | DMA_FROM_DEVICE); |
587 | list_add_tail(&rxb->list, &rxq->rx_free); | 582 | list_add_tail(&rxb->list, &rxq->rx_free); |
588 | rxq->free_count++; | 583 | rxq->free_count++; |
589 | } else | 584 | } else |
@@ -939,22 +934,28 @@ static struct attribute_group iwl_attribute_group = { | |||
939 | * | 934 | * |
940 | ******************************************************************************/ | 935 | ******************************************************************************/ |
941 | 936 | ||
942 | static void iwl_free_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) | 937 | static void iwl_free_fw_desc(struct iwl_priv *priv, struct fw_desc *desc) |
943 | { | 938 | { |
944 | if (desc->v_addr) | 939 | if (desc->v_addr) |
945 | dma_free_coherent(&pci_dev->dev, desc->len, | 940 | dma_free_coherent(priv->bus.dev, desc->len, |
946 | desc->v_addr, desc->p_addr); | 941 | desc->v_addr, desc->p_addr); |
947 | desc->v_addr = NULL; | 942 | desc->v_addr = NULL; |
948 | desc->len = 0; | 943 | desc->len = 0; |
949 | } | 944 | } |
950 | 945 | ||
951 | static void iwl_free_fw_img(struct pci_dev *pci_dev, struct fw_img *img) | 946 | static void iwl_free_fw_img(struct iwl_priv *priv, struct fw_img *img) |
952 | { | 947 | { |
953 | iwl_free_fw_desc(pci_dev, &img->code); | 948 | iwl_free_fw_desc(priv, &img->code); |
954 | iwl_free_fw_desc(pci_dev, &img->data); | 949 | iwl_free_fw_desc(priv, &img->data); |
955 | } | 950 | } |
956 | 951 | ||
957 | static int iwl_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc, | 952 | static void iwl_dealloc_ucode(struct iwl_priv *priv) |
953 | { | ||
954 | iwl_free_fw_img(priv, &priv->ucode_rt); | ||
955 | iwl_free_fw_img(priv, &priv->ucode_init); | ||
956 | } | ||
957 | |||
958 | static int iwl_alloc_fw_desc(struct iwl_priv *priv, struct fw_desc *desc, | ||
958 | const void *data, size_t len) | 959 | const void *data, size_t len) |
959 | { | 960 | { |
960 | if (!len) { | 961 | if (!len) { |
@@ -962,21 +963,16 @@ static int iwl_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc, | |||
962 | return -EINVAL; | 963 | return -EINVAL; |
963 | } | 964 | } |
964 | 965 | ||
965 | desc->v_addr = dma_alloc_coherent(&pci_dev->dev, len, | 966 | desc->v_addr = dma_alloc_coherent(priv->bus.dev, len, |
966 | &desc->p_addr, GFP_KERNEL); | 967 | &desc->p_addr, GFP_KERNEL); |
967 | if (!desc->v_addr) | 968 | if (!desc->v_addr) |
968 | return -ENOMEM; | 969 | return -ENOMEM; |
970 | |||
969 | desc->len = len; | 971 | desc->len = len; |
970 | memcpy(desc->v_addr, data, len); | 972 | memcpy(desc->v_addr, data, len); |
971 | return 0; | 973 | return 0; |
972 | } | 974 | } |
973 | 975 | ||
974 | static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) | ||
975 | { | ||
976 | iwl_free_fw_img(priv->pci_dev, &priv->ucode_rt); | ||
977 | iwl_free_fw_img(priv->pci_dev, &priv->ucode_init); | ||
978 | } | ||
979 | |||
980 | struct iwlagn_ucode_capabilities { | 976 | struct iwlagn_ucode_capabilities { |
981 | u32 max_probe_length; | 977 | u32 max_probe_length; |
982 | u32 standard_phy_calibration_size; | 978 | u32 standard_phy_calibration_size; |
@@ -1021,8 +1017,8 @@ static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) | |||
1021 | priv->firmware_name); | 1017 | priv->firmware_name); |
1022 | 1018 | ||
1023 | return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, | 1019 | return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, |
1024 | &priv->pci_dev->dev, GFP_KERNEL, priv, | 1020 | priv->bus.dev, |
1025 | iwl_ucode_callback); | 1021 | GFP_KERNEL, priv, iwl_ucode_callback); |
1026 | } | 1022 | } |
1027 | 1023 | ||
1028 | struct iwlagn_firmware_pieces { | 1024 | struct iwlagn_firmware_pieces { |
@@ -1443,19 +1439,19 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1443 | /* Runtime instructions and 2 copies of data: | 1439 | /* Runtime instructions and 2 copies of data: |
1444 | * 1) unmodified from disk | 1440 | * 1) unmodified from disk |
1445 | * 2) backup cache for save/restore during power-downs */ | 1441 | * 2) backup cache for save/restore during power-downs */ |
1446 | if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_rt.code, | 1442 | if (iwl_alloc_fw_desc(priv, &priv->ucode_rt.code, |
1447 | pieces.inst, pieces.inst_size)) | 1443 | pieces.inst, pieces.inst_size)) |
1448 | goto err_pci_alloc; | 1444 | goto err_pci_alloc; |
1449 | if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_rt.data, | 1445 | if (iwl_alloc_fw_desc(priv, &priv->ucode_rt.data, |
1450 | pieces.data, pieces.data_size)) | 1446 | pieces.data, pieces.data_size)) |
1451 | goto err_pci_alloc; | 1447 | goto err_pci_alloc; |
1452 | 1448 | ||
1453 | /* Initialization instructions and data */ | 1449 | /* Initialization instructions and data */ |
1454 | if (pieces.init_size && pieces.init_data_size) { | 1450 | if (pieces.init_size && pieces.init_data_size) { |
1455 | if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init.code, | 1451 | if (iwl_alloc_fw_desc(priv, &priv->ucode_init.code, |
1456 | pieces.init, pieces.init_size)) | 1452 | pieces.init, pieces.init_size)) |
1457 | goto err_pci_alloc; | 1453 | goto err_pci_alloc; |
1458 | if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init.data, | 1454 | if (iwl_alloc_fw_desc(priv, &priv->ucode_init.data, |
1459 | pieces.init_data, pieces.init_data_size)) | 1455 | pieces.init_data, pieces.init_data_size)) |
1460 | goto err_pci_alloc; | 1456 | goto err_pci_alloc; |
1461 | } | 1457 | } |
@@ -1485,7 +1481,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1485 | priv->new_scan_threshold_behaviour = | 1481 | priv->new_scan_threshold_behaviour = |
1486 | !!(ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWSCAN); | 1482 | !!(ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWSCAN); |
1487 | 1483 | ||
1488 | if (ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN) { | 1484 | if ((priv->cfg->sku & EEPROM_SKU_CAP_IPAN_ENABLE) && |
1485 | (ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN)) { | ||
1489 | priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN); | 1486 | priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN); |
1490 | priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN; | 1487 | priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN; |
1491 | } else | 1488 | } else |
@@ -1523,7 +1520,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1523 | if (err) | 1520 | if (err) |
1524 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | 1521 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); |
1525 | 1522 | ||
1526 | err = sysfs_create_group(&priv->pci_dev->dev.kobj, | 1523 | err = sysfs_create_group(&(priv->bus.dev->kobj), |
1527 | &iwl_attribute_group); | 1524 | &iwl_attribute_group); |
1528 | if (err) { | 1525 | if (err) { |
1529 | IWL_ERR(priv, "failed to create sysfs device attributes\n"); | 1526 | IWL_ERR(priv, "failed to create sysfs device attributes\n"); |
@@ -1544,10 +1541,10 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1544 | 1541 | ||
1545 | err_pci_alloc: | 1542 | err_pci_alloc: |
1546 | IWL_ERR(priv, "failed to allocate pci memory\n"); | 1543 | IWL_ERR(priv, "failed to allocate pci memory\n"); |
1547 | iwl_dealloc_ucode_pci(priv); | 1544 | iwl_dealloc_ucode(priv); |
1548 | out_unbind: | 1545 | out_unbind: |
1549 | complete(&priv->_agn.firmware_loading_complete); | 1546 | complete(&priv->_agn.firmware_loading_complete); |
1550 | device_release_driver(&priv->pci_dev->dev); | 1547 | device_release_driver(priv->bus.dev); |
1551 | release_firmware(ucode_raw); | 1548 | release_firmware(ucode_raw); |
1552 | } | 1549 | } |
1553 | 1550 | ||
@@ -1626,7 +1623,7 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv) | |||
1626 | struct iwl_error_event_table table; | 1623 | struct iwl_error_event_table table; |
1627 | 1624 | ||
1628 | base = priv->device_pointers.error_event_table; | 1625 | base = priv->device_pointers.error_event_table; |
1629 | if (priv->ucode_type == UCODE_SUBTYPE_INIT) { | 1626 | if (priv->ucode_type == IWL_UCODE_INIT) { |
1630 | if (!base) | 1627 | if (!base) |
1631 | base = priv->_agn.init_errlog_ptr; | 1628 | base = priv->_agn.init_errlog_ptr; |
1632 | } else { | 1629 | } else { |
@@ -1638,7 +1635,7 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv) | |||
1638 | IWL_ERR(priv, | 1635 | IWL_ERR(priv, |
1639 | "Not valid error log pointer 0x%08X for %s uCode\n", | 1636 | "Not valid error log pointer 0x%08X for %s uCode\n", |
1640 | base, | 1637 | base, |
1641 | (priv->ucode_type == UCODE_SUBTYPE_INIT) | 1638 | (priv->ucode_type == IWL_UCODE_INIT) |
1642 | ? "Init" : "RT"); | 1639 | ? "Init" : "RT"); |
1643 | return; | 1640 | return; |
1644 | } | 1641 | } |
@@ -1702,7 +1699,7 @@ static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, | |||
1702 | return pos; | 1699 | return pos; |
1703 | 1700 | ||
1704 | base = priv->device_pointers.log_event_table; | 1701 | base = priv->device_pointers.log_event_table; |
1705 | if (priv->ucode_type == UCODE_SUBTYPE_INIT) { | 1702 | if (priv->ucode_type == IWL_UCODE_INIT) { |
1706 | if (!base) | 1703 | if (!base) |
1707 | base = priv->_agn.init_evtlog_ptr; | 1704 | base = priv->_agn.init_evtlog_ptr; |
1708 | } else { | 1705 | } else { |
@@ -1815,7 +1812,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | |||
1815 | size_t bufsz = 0; | 1812 | size_t bufsz = 0; |
1816 | 1813 | ||
1817 | base = priv->device_pointers.log_event_table; | 1814 | base = priv->device_pointers.log_event_table; |
1818 | if (priv->ucode_type == UCODE_SUBTYPE_INIT) { | 1815 | if (priv->ucode_type == IWL_UCODE_INIT) { |
1819 | logsize = priv->_agn.init_evtlog_size; | 1816 | logsize = priv->_agn.init_evtlog_size; |
1820 | if (!base) | 1817 | if (!base) |
1821 | base = priv->_agn.init_evtlog_ptr; | 1818 | base = priv->_agn.init_evtlog_ptr; |
@@ -1829,7 +1826,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | |||
1829 | IWL_ERR(priv, | 1826 | IWL_ERR(priv, |
1830 | "Invalid event log pointer 0x%08X for %s uCode\n", | 1827 | "Invalid event log pointer 0x%08X for %s uCode\n", |
1831 | base, | 1828 | base, |
1832 | (priv->ucode_type == UCODE_SUBTYPE_INIT) | 1829 | (priv->ucode_type == IWL_UCODE_INIT) |
1833 | ? "Init" : "RT"); | 1830 | ? "Init" : "RT"); |
1834 | return -EINVAL; | 1831 | return -EINVAL; |
1835 | } | 1832 | } |
@@ -2210,8 +2207,7 @@ static int __iwl_up(struct iwl_priv *priv) | |||
2210 | 2207 | ||
2211 | ret = iwlagn_load_ucode_wait_alive(priv, | 2208 | ret = iwlagn_load_ucode_wait_alive(priv, |
2212 | &priv->ucode_rt, | 2209 | &priv->ucode_rt, |
2213 | UCODE_SUBTYPE_REGULAR, | 2210 | IWL_UCODE_REGULAR); |
2214 | UCODE_SUBTYPE_REGULAR_NEW); | ||
2215 | if (ret) { | 2211 | if (ret) { |
2216 | IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret); | 2212 | IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret); |
2217 | goto error; | 2213 | goto error; |
@@ -2516,7 +2512,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv, | |||
2516 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | | 2512 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | |
2517 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | 2513 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; |
2518 | 2514 | ||
2519 | if (priv->cfg->sku & IWL_SKU_N) | 2515 | if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE) |
2520 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | | 2516 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | |
2521 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; | 2517 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; |
2522 | 2518 | ||
@@ -2549,11 +2545,10 @@ static int iwl_mac_setup_register(struct iwl_priv *priv, | |||
2549 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 2545 | WIPHY_FLAG_DISABLE_BEACON_HINTS | |
2550 | WIPHY_FLAG_IBSS_RSN; | 2546 | WIPHY_FLAG_IBSS_RSN; |
2551 | 2547 | ||
2552 | /* | 2548 | if (iwlagn_mod_params.power_save) |
2553 | * For now, disable PS by default because it affects | 2549 | hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; |
2554 | * RX performance significantly. | 2550 | else |
2555 | */ | 2551 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
2556 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
2557 | 2552 | ||
2558 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; | 2553 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; |
2559 | /* we create the 802.11 header and a zero-length SSID element */ | 2554 | /* we create the 802.11 header and a zero-length SSID element */ |
@@ -2757,7 +2752,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, | |||
2757 | IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", | 2752 | IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", |
2758 | sta->addr, tid); | 2753 | sta->addr, tid); |
2759 | 2754 | ||
2760 | if (!(priv->cfg->sku & IWL_SKU_N)) | 2755 | if (!(priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)) |
2761 | return -EACCES; | 2756 | return -EACCES; |
2762 | 2757 | ||
2763 | mutex_lock(&priv->mutex); | 2758 | mutex_lock(&priv->mutex); |
@@ -3052,10 +3047,6 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) | |||
3052 | mutex_lock(&priv->mutex); | 3047 | mutex_lock(&priv->mutex); |
3053 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 3048 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
3054 | 3049 | ||
3055 | /* do not support "flush" */ | ||
3056 | if (!priv->cfg->ops->lib->txfifo_flush) | ||
3057 | goto done; | ||
3058 | |||
3059 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 3050 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { |
3060 | IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n"); | 3051 | IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n"); |
3061 | goto done; | 3052 | goto done; |
@@ -3071,7 +3062,7 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) | |||
3071 | */ | 3062 | */ |
3072 | if (drop) { | 3063 | if (drop) { |
3073 | IWL_DEBUG_MAC80211(priv, "send flush command\n"); | 3064 | IWL_DEBUG_MAC80211(priv, "send flush command\n"); |
3074 | if (priv->cfg->ops->lib->txfifo_flush(priv, IWL_DROP_ALL)) { | 3065 | if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) { |
3075 | IWL_ERR(priv, "flush request fail\n"); | 3066 | IWL_ERR(priv, "flush request fail\n"); |
3076 | goto done; | 3067 | goto done; |
3077 | } | 3068 | } |
@@ -3352,14 +3343,11 @@ struct ieee80211_ops iwlagn_hw_ops = { | |||
3352 | .offchannel_tx = iwl_mac_offchannel_tx, | 3343 | .offchannel_tx = iwl_mac_offchannel_tx, |
3353 | .offchannel_tx_cancel_wait = iwl_mac_offchannel_tx_cancel_wait, | 3344 | .offchannel_tx_cancel_wait = iwl_mac_offchannel_tx_cancel_wait, |
3354 | CFG80211_TESTMODE_CMD(iwl_testmode_cmd) | 3345 | CFG80211_TESTMODE_CMD(iwl_testmode_cmd) |
3346 | CFG80211_TESTMODE_DUMP(iwl_testmode_dump) | ||
3355 | }; | 3347 | }; |
3356 | 3348 | ||
3357 | static u32 iwl_hw_detect(struct iwl_priv *priv) | 3349 | static u32 iwl_hw_detect(struct iwl_priv *priv) |
3358 | { | 3350 | { |
3359 | u8 rev_id; | ||
3360 | |||
3361 | pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id); | ||
3362 | IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id); | ||
3363 | return iwl_read32(priv, CSR_HW_REV); | 3351 | return iwl_read32(priv, CSR_HW_REV); |
3364 | } | 3352 | } |
3365 | 3353 | ||
@@ -3375,7 +3363,7 @@ static int iwl_set_hw_params(struct iwl_priv *priv) | |||
3375 | priv->hw_params.max_beacon_itrvl = IWL_MAX_UCODE_BEACON_INTERVAL; | 3363 | priv->hw_params.max_beacon_itrvl = IWL_MAX_UCODE_BEACON_INTERVAL; |
3376 | 3364 | ||
3377 | if (iwlagn_mod_params.disable_11n) | 3365 | if (iwlagn_mod_params.disable_11n) |
3378 | priv->cfg->sku &= ~IWL_SKU_N; | 3366 | priv->cfg->sku &= ~EEPROM_SKU_CAP_11N_ENABLE; |
3379 | 3367 | ||
3380 | /* Device-specific setup */ | 3368 | /* Device-specific setup */ |
3381 | return priv->cfg->ops->lib->set_hw_params(priv); | 3369 | return priv->cfg->ops->lib->set_hw_params(priv); |
@@ -3425,29 +3413,9 @@ out: | |||
3425 | return hw; | 3413 | return hw; |
3426 | } | 3414 | } |
3427 | 3415 | ||
3428 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 3416 | static void iwl_init_context(struct iwl_priv *priv) |
3429 | { | 3417 | { |
3430 | int err = 0, i; | 3418 | int i; |
3431 | struct iwl_priv *priv; | ||
3432 | struct ieee80211_hw *hw; | ||
3433 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | ||
3434 | unsigned long flags; | ||
3435 | u16 pci_cmd, num_mac; | ||
3436 | u32 hw_rev; | ||
3437 | |||
3438 | /************************ | ||
3439 | * 1. Allocating HW data | ||
3440 | ************************/ | ||
3441 | |||
3442 | hw = iwl_alloc_all(cfg); | ||
3443 | if (!hw) { | ||
3444 | err = -ENOMEM; | ||
3445 | goto out; | ||
3446 | } | ||
3447 | priv = hw->priv; | ||
3448 | /* At this point both hw and priv are allocated. */ | ||
3449 | |||
3450 | priv->ucode_type = UCODE_SUBTYPE_NONE_LOADED; | ||
3451 | 3419 | ||
3452 | /* | 3420 | /* |
3453 | * The default context is always valid, | 3421 | * The default context is always valid, |
@@ -3479,8 +3447,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3479 | priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; | 3447 | priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; |
3480 | 3448 | ||
3481 | priv->contexts[IWL_RXON_CTX_PAN].rxon_cmd = REPLY_WIPAN_RXON; | 3449 | priv->contexts[IWL_RXON_CTX_PAN].rxon_cmd = REPLY_WIPAN_RXON; |
3482 | priv->contexts[IWL_RXON_CTX_PAN].rxon_timing_cmd = REPLY_WIPAN_RXON_TIMING; | 3450 | priv->contexts[IWL_RXON_CTX_PAN].rxon_timing_cmd = |
3483 | priv->contexts[IWL_RXON_CTX_PAN].rxon_assoc_cmd = REPLY_WIPAN_RXON_ASSOC; | 3451 | REPLY_WIPAN_RXON_TIMING; |
3452 | priv->contexts[IWL_RXON_CTX_PAN].rxon_assoc_cmd = | ||
3453 | REPLY_WIPAN_RXON_ASSOC; | ||
3484 | priv->contexts[IWL_RXON_CTX_PAN].qos_cmd = REPLY_WIPAN_QOS_PARAM; | 3454 | priv->contexts[IWL_RXON_CTX_PAN].qos_cmd = REPLY_WIPAN_QOS_PARAM; |
3485 | priv->contexts[IWL_RXON_CTX_PAN].ap_sta_id = IWL_AP_ID_PAN; | 3455 | priv->contexts[IWL_RXON_CTX_PAN].ap_sta_id = IWL_AP_ID_PAN; |
3486 | priv->contexts[IWL_RXON_CTX_PAN].wep_key_cmd = REPLY_WIPAN_WEPKEY; | 3456 | priv->contexts[IWL_RXON_CTX_PAN].wep_key_cmd = REPLY_WIPAN_WEPKEY; |
@@ -3500,12 +3470,41 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3500 | priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P; | 3470 | priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P; |
3501 | 3471 | ||
3502 | BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); | 3472 | BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); |
3473 | } | ||
3474 | |||
3475 | int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, | ||
3476 | struct iwl_cfg *cfg) | ||
3477 | { | ||
3478 | int err = 0; | ||
3479 | struct iwl_priv *priv; | ||
3480 | struct ieee80211_hw *hw; | ||
3481 | u16 num_mac; | ||
3482 | u32 hw_rev; | ||
3503 | 3483 | ||
3504 | SET_IEEE80211_DEV(hw, &pdev->dev); | 3484 | /************************ |
3485 | * 1. Allocating HW data | ||
3486 | ************************/ | ||
3487 | hw = iwl_alloc_all(cfg); | ||
3488 | if (!hw) { | ||
3489 | err = -ENOMEM; | ||
3490 | goto out; | ||
3491 | } | ||
3492 | |||
3493 | priv = hw->priv; | ||
3494 | |||
3495 | priv->bus.priv = priv; | ||
3496 | priv->bus.bus_specific = bus_specific; | ||
3497 | priv->bus.ops = bus_ops; | ||
3498 | priv->bus.irq = priv->bus.ops->get_irq(&priv->bus); | ||
3499 | priv->bus.ops->set_drv_data(&priv->bus, priv); | ||
3500 | priv->bus.dev = priv->bus.ops->get_dev(&priv->bus); | ||
3501 | |||
3502 | /* At this point both hw and priv are allocated. */ | ||
3503 | |||
3504 | SET_IEEE80211_DEV(hw, priv->bus.dev); | ||
3505 | 3505 | ||
3506 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); | 3506 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); |
3507 | priv->cfg = cfg; | 3507 | priv->cfg = cfg; |
3508 | priv->pci_dev = pdev; | ||
3509 | priv->inta_mask = CSR_INI_SET_MASK; | 3508 | priv->inta_mask = CSR_INI_SET_MASK; |
3510 | 3509 | ||
3511 | /* is antenna coupling more than 35dB ? */ | 3510 | /* is antenna coupling more than 35dB ? */ |
@@ -3521,52 +3520,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3521 | if (iwl_alloc_traffic_mem(priv)) | 3520 | if (iwl_alloc_traffic_mem(priv)) |
3522 | IWL_ERR(priv, "Not enough memory to generate traffic log\n"); | 3521 | IWL_ERR(priv, "Not enough memory to generate traffic log\n"); |
3523 | 3522 | ||
3524 | /************************** | ||
3525 | * 2. Initializing PCI bus | ||
3526 | **************************/ | ||
3527 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | | ||
3528 | PCIE_LINK_STATE_CLKPM); | ||
3529 | |||
3530 | if (pci_enable_device(pdev)) { | ||
3531 | err = -ENODEV; | ||
3532 | goto out_ieee80211_free_hw; | ||
3533 | } | ||
3534 | |||
3535 | pci_set_master(pdev); | ||
3536 | |||
3537 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36)); | ||
3538 | if (!err) | ||
3539 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36)); | ||
3540 | if (err) { | ||
3541 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | ||
3542 | if (!err) | ||
3543 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | ||
3544 | /* both attempts failed: */ | ||
3545 | if (err) { | ||
3546 | IWL_WARN(priv, "No suitable DMA available.\n"); | ||
3547 | goto out_pci_disable_device; | ||
3548 | } | ||
3549 | } | ||
3550 | |||
3551 | err = pci_request_regions(pdev, DRV_NAME); | ||
3552 | if (err) | ||
3553 | goto out_pci_disable_device; | ||
3554 | |||
3555 | pci_set_drvdata(pdev, priv); | ||
3556 | |||
3557 | |||
3558 | /*********************** | ||
3559 | * 3. Read REV register | ||
3560 | ***********************/ | ||
3561 | priv->hw_base = pci_iomap(pdev, 0, 0); | ||
3562 | if (!priv->hw_base) { | ||
3563 | err = -ENODEV; | ||
3564 | goto out_pci_release_regions; | ||
3565 | } | ||
3566 | |||
3567 | IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", | ||
3568 | (unsigned long long) pci_resource_len(pdev, 0)); | ||
3569 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); | ||
3570 | 3523 | ||
3571 | /* these spin locks will be used in apm_ops.init and EEPROM access | 3524 | /* these spin locks will be used in apm_ops.init and EEPROM access |
3572 | * we should init now | 3525 | * we should init now |
@@ -3581,17 +3534,17 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3581 | */ | 3534 | */ |
3582 | iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); | 3535 | iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); |
3583 | 3536 | ||
3537 | /*********************** | ||
3538 | * 3. Read REV register | ||
3539 | ***********************/ | ||
3584 | hw_rev = iwl_hw_detect(priv); | 3540 | hw_rev = iwl_hw_detect(priv); |
3585 | IWL_INFO(priv, "Detected %s, REV=0x%X\n", | 3541 | IWL_INFO(priv, "Detected %s, REV=0x%X\n", |
3586 | priv->cfg->name, hw_rev); | 3542 | priv->cfg->name, hw_rev); |
3587 | 3543 | ||
3588 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | ||
3589 | * PCI Tx retries from interfering with C3 CPU state */ | ||
3590 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | ||
3591 | |||
3592 | if (iwl_prepare_card_hw(priv)) { | 3544 | if (iwl_prepare_card_hw(priv)) { |
3545 | err = -EIO; | ||
3593 | IWL_WARN(priv, "Failed, HW not ready\n"); | 3546 | IWL_WARN(priv, "Failed, HW not ready\n"); |
3594 | goto out_iounmap; | 3547 | goto out_free_traffic_mem; |
3595 | } | 3548 | } |
3596 | 3549 | ||
3597 | /***************** | 3550 | /***************** |
@@ -3601,7 +3554,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3601 | err = iwl_eeprom_init(priv, hw_rev); | 3554 | err = iwl_eeprom_init(priv, hw_rev); |
3602 | if (err) { | 3555 | if (err) { |
3603 | IWL_ERR(priv, "Unable to init EEPROM\n"); | 3556 | IWL_ERR(priv, "Unable to init EEPROM\n"); |
3604 | goto out_iounmap; | 3557 | goto out_free_traffic_mem; |
3605 | } | 3558 | } |
3606 | err = iwl_eeprom_check_version(priv); | 3559 | err = iwl_eeprom_check_version(priv); |
3607 | if (err) | 3560 | if (err) |
@@ -3624,10 +3577,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3624 | priv->hw->wiphy->n_addresses++; | 3577 | priv->hw->wiphy->n_addresses++; |
3625 | } | 3578 | } |
3626 | 3579 | ||
3580 | /* initialize all valid contexts */ | ||
3581 | iwl_init_context(priv); | ||
3582 | |||
3627 | /************************ | 3583 | /************************ |
3628 | * 5. Setup HW constants | 3584 | * 5. Setup HW constants |
3629 | ************************/ | 3585 | ************************/ |
3630 | if (iwl_set_hw_params(priv)) { | 3586 | if (iwl_set_hw_params(priv)) { |
3587 | err = -ENOENT; | ||
3631 | IWL_ERR(priv, "failed to set hw parameters\n"); | 3588 | IWL_ERR(priv, "failed to set hw parameters\n"); |
3632 | goto out_free_eeprom; | 3589 | goto out_free_eeprom; |
3633 | } | 3590 | } |
@@ -3644,19 +3601,13 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3644 | /******************** | 3601 | /******************** |
3645 | * 7. Setup services | 3602 | * 7. Setup services |
3646 | ********************/ | 3603 | ********************/ |
3647 | spin_lock_irqsave(&priv->lock, flags); | ||
3648 | iwl_disable_interrupts(priv); | ||
3649 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3650 | |||
3651 | pci_enable_msi(priv->pci_dev); | ||
3652 | |||
3653 | iwl_alloc_isr_ict(priv); | 3604 | iwl_alloc_isr_ict(priv); |
3654 | 3605 | ||
3655 | err = request_irq(priv->pci_dev->irq, iwl_isr_ict, | 3606 | err = request_irq(priv->bus.irq, iwl_isr_ict, IRQF_SHARED, |
3656 | IRQF_SHARED, DRV_NAME, priv); | 3607 | DRV_NAME, priv); |
3657 | if (err) { | 3608 | if (err) { |
3658 | IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); | 3609 | IWL_ERR(priv, "Error allocating IRQ %d\n", priv->bus.irq); |
3659 | goto out_disable_msi; | 3610 | goto out_uninit_drv; |
3660 | } | 3611 | } |
3661 | 3612 | ||
3662 | iwl_setup_deferred_work(priv); | 3613 | iwl_setup_deferred_work(priv); |
@@ -3664,16 +3615,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3664 | iwl_testmode_init(priv); | 3615 | iwl_testmode_init(priv); |
3665 | 3616 | ||
3666 | /********************************************* | 3617 | /********************************************* |
3667 | * 8. Enable interrupts and read RFKILL state | 3618 | * 8. Enable interrupts |
3668 | *********************************************/ | 3619 | *********************************************/ |
3669 | 3620 | ||
3670 | /* enable rfkill interrupt: hw bug w/a */ | ||
3671 | pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); | ||
3672 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { | ||
3673 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; | ||
3674 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); | ||
3675 | } | ||
3676 | |||
3677 | iwl_enable_rfkill_int(priv); | 3621 | iwl_enable_rfkill_int(priv); |
3678 | 3622 | ||
3679 | /* If platform's RF_KILL switch is NOT set to KILL */ | 3623 | /* If platform's RF_KILL switch is NOT set to KILL */ |
@@ -3699,41 +3643,30 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3699 | out_destroy_workqueue: | 3643 | out_destroy_workqueue: |
3700 | destroy_workqueue(priv->workqueue); | 3644 | destroy_workqueue(priv->workqueue); |
3701 | priv->workqueue = NULL; | 3645 | priv->workqueue = NULL; |
3702 | free_irq(priv->pci_dev->irq, priv); | 3646 | free_irq(priv->bus.irq, priv); |
3703 | out_disable_msi: | ||
3704 | iwl_free_isr_ict(priv); | 3647 | iwl_free_isr_ict(priv); |
3705 | pci_disable_msi(priv->pci_dev); | 3648 | out_uninit_drv: |
3706 | iwl_uninit_drv(priv); | 3649 | iwl_uninit_drv(priv); |
3707 | out_free_eeprom: | 3650 | out_free_eeprom: |
3708 | iwl_eeprom_free(priv); | 3651 | iwl_eeprom_free(priv); |
3709 | out_iounmap: | 3652 | out_free_traffic_mem: |
3710 | pci_iounmap(pdev, priv->hw_base); | ||
3711 | out_pci_release_regions: | ||
3712 | pci_set_drvdata(pdev, NULL); | ||
3713 | pci_release_regions(pdev); | ||
3714 | out_pci_disable_device: | ||
3715 | pci_disable_device(pdev); | ||
3716 | out_ieee80211_free_hw: | ||
3717 | iwl_free_traffic_mem(priv); | 3653 | iwl_free_traffic_mem(priv); |
3718 | ieee80211_free_hw(priv->hw); | 3654 | ieee80211_free_hw(priv->hw); |
3719 | out: | 3655 | out: |
3720 | return err; | 3656 | return err; |
3721 | } | 3657 | } |
3722 | 3658 | ||
3723 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) | 3659 | void __devexit iwl_remove(struct iwl_priv * priv) |
3724 | { | 3660 | { |
3725 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
3726 | unsigned long flags; | 3661 | unsigned long flags; |
3727 | 3662 | ||
3728 | if (!priv) | ||
3729 | return; | ||
3730 | |||
3731 | wait_for_completion(&priv->_agn.firmware_loading_complete); | 3663 | wait_for_completion(&priv->_agn.firmware_loading_complete); |
3732 | 3664 | ||
3733 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 3665 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); |
3734 | 3666 | ||
3735 | iwl_dbgfs_unregister(priv); | 3667 | iwl_dbgfs_unregister(priv); |
3736 | sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); | 3668 | sysfs_remove_group(&priv->bus.dev->kobj, |
3669 | &iwl_attribute_group); | ||
3737 | 3670 | ||
3738 | /* ieee80211_unregister_hw call wil cause iwl_mac_stop to | 3671 | /* ieee80211_unregister_hw call wil cause iwl_mac_stop to |
3739 | * to be called and iwl_down since we are removing the device | 3672 | * to be called and iwl_down since we are removing the device |
@@ -3763,7 +3696,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3763 | 3696 | ||
3764 | iwl_synchronize_irq(priv); | 3697 | iwl_synchronize_irq(priv); |
3765 | 3698 | ||
3766 | iwl_dealloc_ucode_pci(priv); | 3699 | iwl_dealloc_ucode(priv); |
3767 | 3700 | ||
3768 | if (priv->rxq.bd) | 3701 | if (priv->rxq.bd) |
3769 | iwlagn_rx_queue_free(priv, &priv->rxq); | 3702 | iwlagn_rx_queue_free(priv, &priv->rxq); |
@@ -3782,12 +3715,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3782 | priv->workqueue = NULL; | 3715 | priv->workqueue = NULL; |
3783 | iwl_free_traffic_mem(priv); | 3716 | iwl_free_traffic_mem(priv); |
3784 | 3717 | ||
3785 | free_irq(priv->pci_dev->irq, priv); | 3718 | free_irq(priv->bus.irq, priv); |
3786 | pci_disable_msi(priv->pci_dev); | 3719 | priv->bus.ops->set_drv_data(&priv->bus, NULL); |
3787 | pci_iounmap(pdev, priv->hw_base); | ||
3788 | pci_release_regions(pdev); | ||
3789 | pci_disable_device(pdev); | ||
3790 | pci_set_drvdata(pdev, NULL); | ||
3791 | 3720 | ||
3792 | iwl_uninit_drv(priv); | 3721 | iwl_uninit_drv(priv); |
3793 | 3722 | ||
@@ -3804,206 +3733,6 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3804 | * driver and module entry point | 3733 | * driver and module entry point |
3805 | * | 3734 | * |
3806 | *****************************************************************************/ | 3735 | *****************************************************************************/ |
3807 | |||
3808 | /* Hardware specific file defines the PCI IDs table for that hardware module */ | ||
3809 | static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | ||
3810 | {IWL_PCI_DEVICE(0x4232, 0x1201, iwl5100_agn_cfg)}, /* Mini Card */ | ||
3811 | {IWL_PCI_DEVICE(0x4232, 0x1301, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
3812 | {IWL_PCI_DEVICE(0x4232, 0x1204, iwl5100_agn_cfg)}, /* Mini Card */ | ||
3813 | {IWL_PCI_DEVICE(0x4232, 0x1304, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
3814 | {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bgn_cfg)}, /* Mini Card */ | ||
3815 | {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bgn_cfg)}, /* Half Mini Card */ | ||
3816 | {IWL_PCI_DEVICE(0x4232, 0x1206, iwl5100_abg_cfg)}, /* Mini Card */ | ||
3817 | {IWL_PCI_DEVICE(0x4232, 0x1306, iwl5100_abg_cfg)}, /* Half Mini Card */ | ||
3818 | {IWL_PCI_DEVICE(0x4232, 0x1221, iwl5100_agn_cfg)}, /* Mini Card */ | ||
3819 | {IWL_PCI_DEVICE(0x4232, 0x1321, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
3820 | {IWL_PCI_DEVICE(0x4232, 0x1224, iwl5100_agn_cfg)}, /* Mini Card */ | ||
3821 | {IWL_PCI_DEVICE(0x4232, 0x1324, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
3822 | {IWL_PCI_DEVICE(0x4232, 0x1225, iwl5100_bgn_cfg)}, /* Mini Card */ | ||
3823 | {IWL_PCI_DEVICE(0x4232, 0x1325, iwl5100_bgn_cfg)}, /* Half Mini Card */ | ||
3824 | {IWL_PCI_DEVICE(0x4232, 0x1226, iwl5100_abg_cfg)}, /* Mini Card */ | ||
3825 | {IWL_PCI_DEVICE(0x4232, 0x1326, iwl5100_abg_cfg)}, /* Half Mini Card */ | ||
3826 | {IWL_PCI_DEVICE(0x4237, 0x1211, iwl5100_agn_cfg)}, /* Mini Card */ | ||
3827 | {IWL_PCI_DEVICE(0x4237, 0x1311, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
3828 | {IWL_PCI_DEVICE(0x4237, 0x1214, iwl5100_agn_cfg)}, /* Mini Card */ | ||
3829 | {IWL_PCI_DEVICE(0x4237, 0x1314, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
3830 | {IWL_PCI_DEVICE(0x4237, 0x1215, iwl5100_bgn_cfg)}, /* Mini Card */ | ||
3831 | {IWL_PCI_DEVICE(0x4237, 0x1315, iwl5100_bgn_cfg)}, /* Half Mini Card */ | ||
3832 | {IWL_PCI_DEVICE(0x4237, 0x1216, iwl5100_abg_cfg)}, /* Mini Card */ | ||
3833 | {IWL_PCI_DEVICE(0x4237, 0x1316, iwl5100_abg_cfg)}, /* Half Mini Card */ | ||
3834 | |||
3835 | /* 5300 Series WiFi */ | ||
3836 | {IWL_PCI_DEVICE(0x4235, 0x1021, iwl5300_agn_cfg)}, /* Mini Card */ | ||
3837 | {IWL_PCI_DEVICE(0x4235, 0x1121, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
3838 | {IWL_PCI_DEVICE(0x4235, 0x1024, iwl5300_agn_cfg)}, /* Mini Card */ | ||
3839 | {IWL_PCI_DEVICE(0x4235, 0x1124, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
3840 | {IWL_PCI_DEVICE(0x4235, 0x1001, iwl5300_agn_cfg)}, /* Mini Card */ | ||
3841 | {IWL_PCI_DEVICE(0x4235, 0x1101, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
3842 | {IWL_PCI_DEVICE(0x4235, 0x1004, iwl5300_agn_cfg)}, /* Mini Card */ | ||
3843 | {IWL_PCI_DEVICE(0x4235, 0x1104, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
3844 | {IWL_PCI_DEVICE(0x4236, 0x1011, iwl5300_agn_cfg)}, /* Mini Card */ | ||
3845 | {IWL_PCI_DEVICE(0x4236, 0x1111, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
3846 | {IWL_PCI_DEVICE(0x4236, 0x1014, iwl5300_agn_cfg)}, /* Mini Card */ | ||
3847 | {IWL_PCI_DEVICE(0x4236, 0x1114, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
3848 | |||
3849 | /* 5350 Series WiFi/WiMax */ | ||
3850 | {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, /* Mini Card */ | ||
3851 | {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, /* Mini Card */ | ||
3852 | {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, /* Mini Card */ | ||
3853 | |||
3854 | /* 5150 Series Wifi/WiMax */ | ||
3855 | {IWL_PCI_DEVICE(0x423C, 0x1201, iwl5150_agn_cfg)}, /* Mini Card */ | ||
3856 | {IWL_PCI_DEVICE(0x423C, 0x1301, iwl5150_agn_cfg)}, /* Half Mini Card */ | ||
3857 | {IWL_PCI_DEVICE(0x423C, 0x1206, iwl5150_abg_cfg)}, /* Mini Card */ | ||
3858 | {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ | ||
3859 | {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ | ||
3860 | {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ | ||
3861 | |||
3862 | {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ | ||
3863 | {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ | ||
3864 | {IWL_PCI_DEVICE(0x423D, 0x1216, iwl5150_abg_cfg)}, /* Mini Card */ | ||
3865 | {IWL_PCI_DEVICE(0x423D, 0x1316, iwl5150_abg_cfg)}, /* Half Mini Card */ | ||
3866 | |||
3867 | /* 6x00 Series */ | ||
3868 | {IWL_PCI_DEVICE(0x422B, 0x1101, iwl6000_3agn_cfg)}, | ||
3869 | {IWL_PCI_DEVICE(0x422B, 0x1121, iwl6000_3agn_cfg)}, | ||
3870 | {IWL_PCI_DEVICE(0x422C, 0x1301, iwl6000i_2agn_cfg)}, | ||
3871 | {IWL_PCI_DEVICE(0x422C, 0x1306, iwl6000i_2abg_cfg)}, | ||
3872 | {IWL_PCI_DEVICE(0x422C, 0x1307, iwl6000i_2bg_cfg)}, | ||
3873 | {IWL_PCI_DEVICE(0x422C, 0x1321, iwl6000i_2agn_cfg)}, | ||
3874 | {IWL_PCI_DEVICE(0x422C, 0x1326, iwl6000i_2abg_cfg)}, | ||
3875 | {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)}, | ||
3876 | {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, | ||
3877 | {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, | ||
3878 | |||
3879 | /* 6x05 Series */ | ||
3880 | {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6005_2agn_cfg)}, | ||
3881 | {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6005_2abg_cfg)}, | ||
3882 | {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6005_2bg_cfg)}, | ||
3883 | {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6005_2agn_cfg)}, | ||
3884 | {IWL_PCI_DEVICE(0x0082, 0x1326, iwl6005_2abg_cfg)}, | ||
3885 | {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)}, | ||
3886 | {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)}, | ||
3887 | |||
3888 | /* 6x30 Series */ | ||
3889 | {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)}, | ||
3890 | {IWL_PCI_DEVICE(0x008A, 0x5307, iwl1030_bg_cfg)}, | ||
3891 | {IWL_PCI_DEVICE(0x008A, 0x5325, iwl1030_bgn_cfg)}, | ||
3892 | {IWL_PCI_DEVICE(0x008A, 0x5327, iwl1030_bg_cfg)}, | ||
3893 | {IWL_PCI_DEVICE(0x008B, 0x5315, iwl1030_bgn_cfg)}, | ||
3894 | {IWL_PCI_DEVICE(0x008B, 0x5317, iwl1030_bg_cfg)}, | ||
3895 | {IWL_PCI_DEVICE(0x0090, 0x5211, iwl6030_2agn_cfg)}, | ||
3896 | {IWL_PCI_DEVICE(0x0090, 0x5215, iwl6030_2bgn_cfg)}, | ||
3897 | {IWL_PCI_DEVICE(0x0090, 0x5216, iwl6030_2abg_cfg)}, | ||
3898 | {IWL_PCI_DEVICE(0x0091, 0x5201, iwl6030_2agn_cfg)}, | ||
3899 | {IWL_PCI_DEVICE(0x0091, 0x5205, iwl6030_2bgn_cfg)}, | ||
3900 | {IWL_PCI_DEVICE(0x0091, 0x5206, iwl6030_2abg_cfg)}, | ||
3901 | {IWL_PCI_DEVICE(0x0091, 0x5207, iwl6030_2bg_cfg)}, | ||
3902 | {IWL_PCI_DEVICE(0x0091, 0x5221, iwl6030_2agn_cfg)}, | ||
3903 | {IWL_PCI_DEVICE(0x0091, 0x5225, iwl6030_2bgn_cfg)}, | ||
3904 | {IWL_PCI_DEVICE(0x0091, 0x5226, iwl6030_2abg_cfg)}, | ||
3905 | |||
3906 | /* 6x50 WiFi/WiMax Series */ | ||
3907 | {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, | ||
3908 | {IWL_PCI_DEVICE(0x0087, 0x1306, iwl6050_2abg_cfg)}, | ||
3909 | {IWL_PCI_DEVICE(0x0087, 0x1321, iwl6050_2agn_cfg)}, | ||
3910 | {IWL_PCI_DEVICE(0x0087, 0x1326, iwl6050_2abg_cfg)}, | ||
3911 | {IWL_PCI_DEVICE(0x0089, 0x1311, iwl6050_2agn_cfg)}, | ||
3912 | {IWL_PCI_DEVICE(0x0089, 0x1316, iwl6050_2abg_cfg)}, | ||
3913 | |||
3914 | /* 6150 WiFi/WiMax Series */ | ||
3915 | {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, | ||
3916 | {IWL_PCI_DEVICE(0x0885, 0x1307, iwl6150_bg_cfg)}, | ||
3917 | {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, | ||
3918 | {IWL_PCI_DEVICE(0x0885, 0x1327, iwl6150_bg_cfg)}, | ||
3919 | {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, | ||
3920 | {IWL_PCI_DEVICE(0x0886, 0x1317, iwl6150_bg_cfg)}, | ||
3921 | |||
3922 | /* 1000 Series WiFi */ | ||
3923 | {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, | ||
3924 | {IWL_PCI_DEVICE(0x0083, 0x1305, iwl1000_bgn_cfg)}, | ||
3925 | {IWL_PCI_DEVICE(0x0083, 0x1225, iwl1000_bgn_cfg)}, | ||
3926 | {IWL_PCI_DEVICE(0x0083, 0x1325, iwl1000_bgn_cfg)}, | ||
3927 | {IWL_PCI_DEVICE(0x0084, 0x1215, iwl1000_bgn_cfg)}, | ||
3928 | {IWL_PCI_DEVICE(0x0084, 0x1315, iwl1000_bgn_cfg)}, | ||
3929 | {IWL_PCI_DEVICE(0x0083, 0x1206, iwl1000_bg_cfg)}, | ||
3930 | {IWL_PCI_DEVICE(0x0083, 0x1306, iwl1000_bg_cfg)}, | ||
3931 | {IWL_PCI_DEVICE(0x0083, 0x1226, iwl1000_bg_cfg)}, | ||
3932 | {IWL_PCI_DEVICE(0x0083, 0x1326, iwl1000_bg_cfg)}, | ||
3933 | {IWL_PCI_DEVICE(0x0084, 0x1216, iwl1000_bg_cfg)}, | ||
3934 | {IWL_PCI_DEVICE(0x0084, 0x1316, iwl1000_bg_cfg)}, | ||
3935 | |||
3936 | /* 100 Series WiFi */ | ||
3937 | {IWL_PCI_DEVICE(0x08AE, 0x1005, iwl100_bgn_cfg)}, | ||
3938 | {IWL_PCI_DEVICE(0x08AE, 0x1007, iwl100_bg_cfg)}, | ||
3939 | {IWL_PCI_DEVICE(0x08AF, 0x1015, iwl100_bgn_cfg)}, | ||
3940 | {IWL_PCI_DEVICE(0x08AF, 0x1017, iwl100_bg_cfg)}, | ||
3941 | {IWL_PCI_DEVICE(0x08AE, 0x1025, iwl100_bgn_cfg)}, | ||
3942 | {IWL_PCI_DEVICE(0x08AE, 0x1027, iwl100_bg_cfg)}, | ||
3943 | |||
3944 | /* 130 Series WiFi */ | ||
3945 | {IWL_PCI_DEVICE(0x0896, 0x5005, iwl130_bgn_cfg)}, | ||
3946 | {IWL_PCI_DEVICE(0x0896, 0x5007, iwl130_bg_cfg)}, | ||
3947 | {IWL_PCI_DEVICE(0x0897, 0x5015, iwl130_bgn_cfg)}, | ||
3948 | {IWL_PCI_DEVICE(0x0897, 0x5017, iwl130_bg_cfg)}, | ||
3949 | {IWL_PCI_DEVICE(0x0896, 0x5025, iwl130_bgn_cfg)}, | ||
3950 | {IWL_PCI_DEVICE(0x0896, 0x5027, iwl130_bg_cfg)}, | ||
3951 | |||
3952 | /* 2x00 Series */ | ||
3953 | {IWL_PCI_DEVICE(0x0890, 0x4022, iwl2000_2bgn_cfg)}, | ||
3954 | {IWL_PCI_DEVICE(0x0891, 0x4222, iwl2000_2bgn_cfg)}, | ||
3955 | {IWL_PCI_DEVICE(0x0890, 0x4422, iwl2000_2bgn_cfg)}, | ||
3956 | {IWL_PCI_DEVICE(0x0890, 0x4026, iwl2000_2bg_cfg)}, | ||
3957 | {IWL_PCI_DEVICE(0x0891, 0x4226, iwl2000_2bg_cfg)}, | ||
3958 | {IWL_PCI_DEVICE(0x0890, 0x4426, iwl2000_2bg_cfg)}, | ||
3959 | |||
3960 | /* 2x30 Series */ | ||
3961 | {IWL_PCI_DEVICE(0x0887, 0x4062, iwl2030_2bgn_cfg)}, | ||
3962 | {IWL_PCI_DEVICE(0x0888, 0x4262, iwl2030_2bgn_cfg)}, | ||
3963 | {IWL_PCI_DEVICE(0x0887, 0x4462, iwl2030_2bgn_cfg)}, | ||
3964 | {IWL_PCI_DEVICE(0x0887, 0x4066, iwl2030_2bg_cfg)}, | ||
3965 | {IWL_PCI_DEVICE(0x0888, 0x4266, iwl2030_2bg_cfg)}, | ||
3966 | {IWL_PCI_DEVICE(0x0887, 0x4466, iwl2030_2bg_cfg)}, | ||
3967 | |||
3968 | /* 6x35 Series */ | ||
3969 | {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)}, | ||
3970 | {IWL_PCI_DEVICE(0x088F, 0x4260, iwl6035_2agn_cfg)}, | ||
3971 | {IWL_PCI_DEVICE(0x088E, 0x4460, iwl6035_2agn_cfg)}, | ||
3972 | {IWL_PCI_DEVICE(0x088E, 0x4064, iwl6035_2abg_cfg)}, | ||
3973 | {IWL_PCI_DEVICE(0x088F, 0x4264, iwl6035_2abg_cfg)}, | ||
3974 | {IWL_PCI_DEVICE(0x088E, 0x4464, iwl6035_2abg_cfg)}, | ||
3975 | {IWL_PCI_DEVICE(0x088E, 0x4066, iwl6035_2bg_cfg)}, | ||
3976 | {IWL_PCI_DEVICE(0x088F, 0x4266, iwl6035_2bg_cfg)}, | ||
3977 | {IWL_PCI_DEVICE(0x088E, 0x4466, iwl6035_2bg_cfg)}, | ||
3978 | |||
3979 | /* 105 Series */ | ||
3980 | {IWL_PCI_DEVICE(0x0894, 0x0022, iwl105_bgn_cfg)}, | ||
3981 | {IWL_PCI_DEVICE(0x0895, 0x0222, iwl105_bgn_cfg)}, | ||
3982 | {IWL_PCI_DEVICE(0x0894, 0x0422, iwl105_bgn_cfg)}, | ||
3983 | {IWL_PCI_DEVICE(0x0894, 0x0026, iwl105_bg_cfg)}, | ||
3984 | {IWL_PCI_DEVICE(0x0895, 0x0226, iwl105_bg_cfg)}, | ||
3985 | {IWL_PCI_DEVICE(0x0894, 0x0426, iwl105_bg_cfg)}, | ||
3986 | |||
3987 | /* 135 Series */ | ||
3988 | {IWL_PCI_DEVICE(0x0892, 0x0062, iwl135_bgn_cfg)}, | ||
3989 | {IWL_PCI_DEVICE(0x0893, 0x0262, iwl135_bgn_cfg)}, | ||
3990 | {IWL_PCI_DEVICE(0x0892, 0x0462, iwl135_bgn_cfg)}, | ||
3991 | {IWL_PCI_DEVICE(0x0892, 0x0066, iwl135_bg_cfg)}, | ||
3992 | {IWL_PCI_DEVICE(0x0893, 0x0266, iwl135_bg_cfg)}, | ||
3993 | {IWL_PCI_DEVICE(0x0892, 0x0466, iwl135_bg_cfg)}, | ||
3994 | |||
3995 | {0} | ||
3996 | }; | ||
3997 | MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); | ||
3998 | |||
3999 | static struct pci_driver iwl_driver = { | ||
4000 | .name = DRV_NAME, | ||
4001 | .id_table = iwl_hw_card_ids, | ||
4002 | .probe = iwl_pci_probe, | ||
4003 | .remove = __devexit_p(iwl_pci_remove), | ||
4004 | .driver.pm = IWL_PM_OPS, | ||
4005 | }; | ||
4006 | |||
4007 | static int __init iwl_init(void) | 3736 | static int __init iwl_init(void) |
4008 | { | 3737 | { |
4009 | 3738 | ||
@@ -4017,12 +3746,10 @@ static int __init iwl_init(void) | |||
4017 | return ret; | 3746 | return ret; |
4018 | } | 3747 | } |
4019 | 3748 | ||
4020 | ret = pci_register_driver(&iwl_driver); | 3749 | ret = iwl_pci_register_driver(); |
4021 | if (ret) { | ||
4022 | pr_err("Unable to initialize PCI module\n"); | ||
4023 | goto error_register; | ||
4024 | } | ||
4025 | 3750 | ||
3751 | if (ret) | ||
3752 | goto error_register; | ||
4026 | return ret; | 3753 | return ret; |
4027 | 3754 | ||
4028 | error_register: | 3755 | error_register: |
@@ -4032,7 +3759,7 @@ error_register: | |||
4032 | 3759 | ||
4033 | static void __exit iwl_exit(void) | 3760 | static void __exit iwl_exit(void) |
4034 | { | 3761 | { |
4035 | pci_unregister_driver(&iwl_driver); | 3762 | iwl_pci_unregister_driver(); |
4036 | iwlagn_rate_control_unregister(); | 3763 | iwlagn_rate_control_unregister(); |
4037 | } | 3764 | } |
4038 | 3765 | ||
@@ -4074,3 +3801,47 @@ MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])"); | |||
4074 | 3801 | ||
4075 | module_param_named(ack_check, iwlagn_mod_params.ack_check, bool, S_IRUGO); | 3802 | module_param_named(ack_check, iwlagn_mod_params.ack_check, bool, S_IRUGO); |
4076 | MODULE_PARM_DESC(ack_check, "Check ack health (default: 0 [disabled])"); | 3803 | MODULE_PARM_DESC(ack_check, "Check ack health (default: 0 [disabled])"); |
3804 | |||
3805 | /* | ||
3806 | * set bt_coex_active to true, uCode will do kill/defer | ||
3807 | * every time the priority line is asserted (BT is sending signals on the | ||
3808 | * priority line in the PCIx). | ||
3809 | * set bt_coex_active to false, uCode will ignore the BT activity and | ||
3810 | * perform the normal operation | ||
3811 | * | ||
3812 | * User might experience transmit issue on some platform due to WiFi/BT | ||
3813 | * co-exist problem. The possible behaviors are: | ||
3814 | * Able to scan and finding all the available AP | ||
3815 | * Not able to associate with any AP | ||
3816 | * On those platforms, WiFi communication can be restored by set | ||
3817 | * "bt_coex_active" module parameter to "false" | ||
3818 | * | ||
3819 | * default: bt_coex_active = true (BT_COEX_ENABLE) | ||
3820 | */ | ||
3821 | module_param_named(bt_coex_active, iwlagn_mod_params.bt_coex_active, | ||
3822 | bool, S_IRUGO); | ||
3823 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bt co-exist (default: enable)"); | ||
3824 | |||
3825 | module_param_named(led_mode, iwlagn_mod_params.led_mode, int, S_IRUGO); | ||
3826 | MODULE_PARM_DESC(led_mode, "0=system default, " | ||
3827 | "1=On(RF On)/Off(RF Off), 2=blinking (default: 0)"); | ||
3828 | |||
3829 | module_param_named(power_save, iwlagn_mod_params.power_save, | ||
3830 | bool, S_IRUGO); | ||
3831 | MODULE_PARM_DESC(power_save, | ||
3832 | "enable WiFi power management (default: disable)"); | ||
3833 | |||
3834 | module_param_named(power_level, iwlagn_mod_params.power_level, | ||
3835 | int, S_IRUGO); | ||
3836 | MODULE_PARM_DESC(power_level, | ||
3837 | "default power save level (range from 1 - 5, default: 1)"); | ||
3838 | |||
3839 | /* | ||
3840 | * For now, keep using power level 1 instead of automatically | ||
3841 | * adjusting ... | ||
3842 | */ | ||
3843 | module_param_named(no_sleep_autoadjust, iwlagn_mod_params.no_sleep_autoadjust, | ||
3844 | bool, S_IRUGO); | ||
3845 | MODULE_PARM_DESC(no_sleep_autoadjust, | ||
3846 | "don't automatically adjust sleep level " | ||
3847 | "according to maximum network latency (default: true)"); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index d1716844002e..6d5584ae5ebf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -125,10 +125,18 @@ irqreturn_t iwl_isr_ict(int irq, void *data); | |||
125 | static inline void iwl_synchronize_irq(struct iwl_priv *priv) | 125 | static inline void iwl_synchronize_irq(struct iwl_priv *priv) |
126 | { | 126 | { |
127 | /* wait to make sure we flush pending tasklet*/ | 127 | /* wait to make sure we flush pending tasklet*/ |
128 | synchronize_irq(priv->pci_dev->irq); | 128 | synchronize_irq(priv->bus.irq); |
129 | tasklet_kill(&priv->irq_tasklet); | 129 | tasklet_kill(&priv->irq_tasklet); |
130 | } | 130 | } |
131 | 131 | ||
132 | static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd) | ||
133 | { | ||
134 | hdr->op_code = cmd; | ||
135 | hdr->first_group = 0; | ||
136 | hdr->groups_num = 1; | ||
137 | hdr->data_valid = 1; | ||
138 | } | ||
139 | |||
132 | int iwl_prepare_card_hw(struct iwl_priv *priv); | 140 | int iwl_prepare_card_hw(struct iwl_priv *priv); |
133 | 141 | ||
134 | int iwlagn_start_device(struct iwl_priv *priv); | 142 | int iwlagn_start_device(struct iwl_priv *priv); |
@@ -161,7 +169,7 @@ void iwlagn_send_prio_tbl(struct iwl_priv *priv); | |||
161 | int iwlagn_run_init_ucode(struct iwl_priv *priv); | 169 | int iwlagn_run_init_ucode(struct iwl_priv *priv); |
162 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | 170 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, |
163 | struct fw_img *image, | 171 | struct fw_img *image, |
164 | int subtype, int alternate_subtype); | 172 | enum iwlagn_ucode_type ucode_type); |
165 | 173 | ||
166 | /* lib */ | 174 | /* lib */ |
167 | void iwl_check_abort_status(struct iwl_priv *priv, | 175 | void iwl_check_abort_status(struct iwl_priv *priv, |
@@ -343,6 +351,9 @@ extern int iwl_alive_start(struct iwl_priv *priv); | |||
343 | /* svtool */ | 351 | /* svtool */ |
344 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL | 352 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL |
345 | extern int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len); | 353 | extern int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len); |
354 | extern int iwl_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
355 | struct netlink_callback *cb, | ||
356 | void *data, int len); | ||
346 | extern void iwl_testmode_init(struct iwl_priv *priv); | 357 | extern void iwl_testmode_init(struct iwl_priv *priv); |
347 | extern void iwl_testmode_cleanup(struct iwl_priv *priv); | 358 | extern void iwl_testmode_cleanup(struct iwl_priv *priv); |
348 | #else | 359 | #else |
@@ -352,6 +363,13 @@ int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) | |||
352 | return -ENOSYS; | 363 | return -ENOSYS; |
353 | } | 364 | } |
354 | static inline | 365 | static inline |
366 | int iwl_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
367 | struct netlink_callback *cb, | ||
368 | void *data, int len) | ||
369 | { | ||
370 | return -ENOSYS; | ||
371 | } | ||
372 | static inline | ||
355 | void iwl_testmode_init(struct iwl_priv *priv) | 373 | void iwl_testmode_init(struct iwl_priv *priv) |
356 | { | 374 | { |
357 | } | 375 | } |
@@ -361,4 +379,8 @@ void iwl_testmode_cleanup(struct iwl_priv *priv) | |||
361 | } | 379 | } |
362 | #endif | 380 | #endif |
363 | 381 | ||
382 | int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, | ||
383 | struct iwl_cfg *cfg); | ||
384 | void __devexit iwl_remove(struct iwl_priv * priv); | ||
385 | |||
364 | #endif /* __iwl_agn_h__ */ | 386 | #endif /* __iwl_agn_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 6ee5f1aa555c..8a2edf8dce32 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -384,18 +384,6 @@ struct iwl_tx_ant_config_cmd { | |||
384 | 384 | ||
385 | #define UCODE_VALID_OK cpu_to_le32(0x1) | 385 | #define UCODE_VALID_OK cpu_to_le32(0x1) |
386 | 386 | ||
387 | enum iwlagn_ucode_subtype { | ||
388 | UCODE_SUBTYPE_REGULAR = 0, | ||
389 | UCODE_SUBTYPE_REGULAR_NEW = 1, | ||
390 | UCODE_SUBTYPE_INIT = 9, | ||
391 | |||
392 | /* | ||
393 | * Not a valid subtype, the ucode has just a u8, so | ||
394 | * we can use something > 0xff for this value. | ||
395 | */ | ||
396 | UCODE_SUBTYPE_NONE_LOADED = 0x100, | ||
397 | }; | ||
398 | |||
399 | /** | 387 | /** |
400 | * REPLY_ALIVE = 0x1 (response only, not a command) | 388 | * REPLY_ALIVE = 0x1 (response only, not a command) |
401 | * | 389 | * |
@@ -984,15 +972,26 @@ struct iwl_rem_sta_cmd { | |||
984 | u8 reserved2[2]; | 972 | u8 reserved2[2]; |
985 | } __packed; | 973 | } __packed; |
986 | 974 | ||
987 | #define IWL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0)) | 975 | |
988 | #define IWL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1)) | 976 | /* WiFi queues mask */ |
989 | #define IWL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2)) | 977 | #define IWL_SCD_BK_MSK cpu_to_le32(BIT(0)) |
990 | #define IWL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3)) | 978 | #define IWL_SCD_BE_MSK cpu_to_le32(BIT(1)) |
979 | #define IWL_SCD_VI_MSK cpu_to_le32(BIT(2)) | ||
980 | #define IWL_SCD_VO_MSK cpu_to_le32(BIT(3)) | ||
981 | #define IWL_SCD_MGMT_MSK cpu_to_le32(BIT(3)) | ||
982 | |||
983 | /* PAN queues mask */ | ||
984 | #define IWL_PAN_SCD_BK_MSK cpu_to_le32(BIT(4)) | ||
985 | #define IWL_PAN_SCD_BE_MSK cpu_to_le32(BIT(5)) | ||
986 | #define IWL_PAN_SCD_VI_MSK cpu_to_le32(BIT(6)) | ||
987 | #define IWL_PAN_SCD_VO_MSK cpu_to_le32(BIT(7)) | ||
988 | #define IWL_PAN_SCD_MGMT_MSK cpu_to_le32(BIT(7)) | ||
989 | #define IWL_PAN_SCD_MULTICAST_MSK cpu_to_le32(BIT(8)) | ||
990 | |||
991 | #define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) | 991 | #define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) |
992 | 992 | ||
993 | #define IWL_DROP_SINGLE 0 | 993 | #define IWL_DROP_SINGLE 0 |
994 | #define IWL_DROP_SELECTED 1 | 994 | #define IWL_DROP_ALL (BIT(IWL_RXON_CTX_BSS) | BIT(IWL_RXON_CTX_PAN)) |
995 | #define IWL_DROP_ALL 2 | ||
996 | 995 | ||
997 | /* | 996 | /* |
998 | * REPLY_TXFIFO_FLUSH = 0x1e(command and response) | 997 | * REPLY_TXFIFO_FLUSH = 0x1e(command and response) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 5416b12cd931..cde725326c32 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -43,27 +43,6 @@ | |||
43 | #include "iwl-helpers.h" | 43 | #include "iwl-helpers.h" |
44 | #include "iwl-agn.h" | 44 | #include "iwl-agn.h" |
45 | 45 | ||
46 | |||
47 | /* | ||
48 | * set bt_coex_active to true, uCode will do kill/defer | ||
49 | * every time the priority line is asserted (BT is sending signals on the | ||
50 | * priority line in the PCIx). | ||
51 | * set bt_coex_active to false, uCode will ignore the BT activity and | ||
52 | * perform the normal operation | ||
53 | * | ||
54 | * User might experience transmit issue on some platform due to WiFi/BT | ||
55 | * co-exist problem. The possible behaviors are: | ||
56 | * Able to scan and finding all the available AP | ||
57 | * Not able to associate with any AP | ||
58 | * On those platforms, WiFi communication can be restored by set | ||
59 | * "bt_coex_active" module parameter to "false" | ||
60 | * | ||
61 | * default: bt_coex_active = true (BT_COEX_ENABLE) | ||
62 | */ | ||
63 | bool bt_coex_active = true; | ||
64 | module_param(bt_coex_active, bool, S_IRUGO); | ||
65 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bluetooth co-exist"); | ||
66 | |||
67 | u32 iwl_debug_level; | 46 | u32 iwl_debug_level; |
68 | 47 | ||
69 | const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | 48 | const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
@@ -164,7 +143,7 @@ int iwlcore_init_geos(struct iwl_priv *priv) | |||
164 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; | 143 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; |
165 | sband->n_bitrates = IWL_RATE_COUNT_LEGACY - IWL_FIRST_OFDM_RATE; | 144 | sband->n_bitrates = IWL_RATE_COUNT_LEGACY - IWL_FIRST_OFDM_RATE; |
166 | 145 | ||
167 | if (priv->cfg->sku & IWL_SKU_N) | 146 | if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE) |
168 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, | 147 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, |
169 | IEEE80211_BAND_5GHZ); | 148 | IEEE80211_BAND_5GHZ); |
170 | 149 | ||
@@ -174,7 +153,7 @@ int iwlcore_init_geos(struct iwl_priv *priv) | |||
174 | sband->bitrates = rates; | 153 | sband->bitrates = rates; |
175 | sband->n_bitrates = IWL_RATE_COUNT_LEGACY; | 154 | sband->n_bitrates = IWL_RATE_COUNT_LEGACY; |
176 | 155 | ||
177 | if (priv->cfg->sku & IWL_SKU_N) | 156 | if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE) |
178 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, | 157 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, |
179 | IEEE80211_BAND_2GHZ); | 158 | IEEE80211_BAND_2GHZ); |
180 | 159 | ||
@@ -229,12 +208,12 @@ int iwlcore_init_geos(struct iwl_priv *priv) | |||
229 | priv->tx_power_next = max_tx_power; | 208 | priv->tx_power_next = max_tx_power; |
230 | 209 | ||
231 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && | 210 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && |
232 | priv->cfg->sku & IWL_SKU_A) { | 211 | priv->cfg->sku & EEPROM_SKU_CAP_BAND_52GHZ) { |
212 | char buf[32]; | ||
213 | priv->bus.ops->get_hw_id(&priv->bus, buf, sizeof(buf)); | ||
233 | IWL_INFO(priv, "Incorrectly detected BG card as ABG. " | 214 | IWL_INFO(priv, "Incorrectly detected BG card as ABG. " |
234 | "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n", | 215 | "Please send your %s to maintainer.\n", buf); |
235 | priv->pci_dev->device, | 216 | priv->cfg->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ; |
236 | priv->pci_dev->subsystem_device); | ||
237 | priv->cfg->sku &= ~IWL_SKU_A; | ||
238 | } | 217 | } |
239 | 218 | ||
240 | IWL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", | 219 | IWL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", |
@@ -1018,8 +997,6 @@ void iwl_apm_stop(struct iwl_priv *priv) | |||
1018 | int iwl_apm_init(struct iwl_priv *priv) | 997 | int iwl_apm_init(struct iwl_priv *priv) |
1019 | { | 998 | { |
1020 | int ret = 0; | 999 | int ret = 0; |
1021 | u16 lctl; | ||
1022 | |||
1023 | IWL_DEBUG_INFO(priv, "Init card's basic functions\n"); | 1000 | IWL_DEBUG_INFO(priv, "Init card's basic functions\n"); |
1024 | 1001 | ||
1025 | /* | 1002 | /* |
@@ -1048,27 +1025,7 @@ int iwl_apm_init(struct iwl_priv *priv) | |||
1048 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 1025 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, |
1049 | CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); | 1026 | CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); |
1050 | 1027 | ||
1051 | /* | 1028 | priv->bus.ops->apm_config(&priv->bus); |
1052 | * HW bug W/A for instability in PCIe bus L0->L0S->L1 transition. | ||
1053 | * Check if BIOS (or OS) enabled L1-ASPM on this device. | ||
1054 | * If so (likely), disable L0S, so device moves directly L0->L1; | ||
1055 | * costs negligible amount of power savings. | ||
1056 | * If not (unlikely), enable L0S, so there is at least some | ||
1057 | * power savings, even without L1. | ||
1058 | */ | ||
1059 | lctl = iwl_pcie_link_ctl(priv); | ||
1060 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == | ||
1061 | PCI_CFG_LINK_CTRL_VAL_L1_EN) { | ||
1062 | /* L1-ASPM enabled; disable(!) L0S */ | ||
1063 | iwl_set_bit(priv, CSR_GIO_REG, | ||
1064 | CSR_GIO_REG_VAL_L0S_ENABLED); | ||
1065 | IWL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n"); | ||
1066 | } else { | ||
1067 | /* L1-ASPM disabled; enable(!) L0S */ | ||
1068 | iwl_clear_bit(priv, CSR_GIO_REG, | ||
1069 | CSR_GIO_REG_VAL_L0S_ENABLED); | ||
1070 | IWL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n"); | ||
1071 | } | ||
1072 | 1029 | ||
1073 | /* Configure analog phase-lock-loop before activating to D0A */ | 1030 | /* Configure analog phase-lock-loop before activating to D0A */ |
1074 | if (priv->cfg->base_params->pll_cfg_val) | 1031 | if (priv->cfg->base_params->pll_cfg_val) |
@@ -1179,7 +1136,7 @@ void iwl_send_bt_config(struct iwl_priv *priv) | |||
1179 | .kill_cts_mask = 0, | 1136 | .kill_cts_mask = 0, |
1180 | }; | 1137 | }; |
1181 | 1138 | ||
1182 | if (!bt_coex_active) | 1139 | if (!iwlagn_mod_params.bt_coex_active) |
1183 | bt_cmd.flags = BT_COEX_DISABLE; | 1140 | bt_cmd.flags = BT_COEX_DISABLE; |
1184 | else | 1141 | else |
1185 | bt_cmd.flags = BT_COEX_ENABLE; | 1142 | bt_cmd.flags = BT_COEX_ENABLE; |
@@ -1969,11 +1926,8 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, | |||
1969 | 1926 | ||
1970 | #ifdef CONFIG_PM | 1927 | #ifdef CONFIG_PM |
1971 | 1928 | ||
1972 | int iwl_pci_suspend(struct device *device) | 1929 | int iwl_suspend(struct iwl_priv *priv) |
1973 | { | 1930 | { |
1974 | struct pci_dev *pdev = to_pci_dev(device); | ||
1975 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
1976 | |||
1977 | /* | 1931 | /* |
1978 | * This function is called when system goes into suspend state | 1932 | * This function is called when system goes into suspend state |
1979 | * mac80211 will call iwl_mac_stop() from the mac80211 suspend function | 1933 | * mac80211 will call iwl_mac_stop() from the mac80211 suspend function |
@@ -1986,18 +1940,10 @@ int iwl_pci_suspend(struct device *device) | |||
1986 | return 0; | 1940 | return 0; |
1987 | } | 1941 | } |
1988 | 1942 | ||
1989 | int iwl_pci_resume(struct device *device) | 1943 | int iwl_resume(struct iwl_priv *priv) |
1990 | { | 1944 | { |
1991 | struct pci_dev *pdev = to_pci_dev(device); | ||
1992 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
1993 | bool hw_rfkill = false; | 1945 | bool hw_rfkill = false; |
1994 | 1946 | ||
1995 | /* | ||
1996 | * We disable the RETRY_TIMEOUT register (0x41) to keep | ||
1997 | * PCI Tx retries from interfering with C3 CPU state. | ||
1998 | */ | ||
1999 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | ||
2000 | |||
2001 | iwl_enable_interrupts(priv); | 1947 | iwl_enable_interrupts(priv); |
2002 | 1948 | ||
2003 | if (!(iwl_read32(priv, CSR_GP_CNTRL) & | 1949 | if (!(iwl_read32(priv, CSR_GP_CNTRL) & |
@@ -2014,13 +1960,4 @@ int iwl_pci_resume(struct device *device) | |||
2014 | return 0; | 1960 | return 0; |
2015 | } | 1961 | } |
2016 | 1962 | ||
2017 | const struct dev_pm_ops iwl_pm_ops = { | ||
2018 | .suspend = iwl_pci_suspend, | ||
2019 | .resume = iwl_pci_resume, | ||
2020 | .freeze = iwl_pci_suspend, | ||
2021 | .thaw = iwl_pci_resume, | ||
2022 | .poweroff = iwl_pci_suspend, | ||
2023 | .restore = iwl_pci_resume, | ||
2024 | }; | ||
2025 | |||
2026 | #endif /* CONFIG_PM */ | 1963 | #endif /* CONFIG_PM */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 05ea88aa76e3..adf9f9b2efb5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -76,17 +76,8 @@ struct iwl_cmd; | |||
76 | #define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" | 76 | #define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" |
77 | #define DRV_AUTHOR "<ilw@linux.intel.com>" | 77 | #define DRV_AUTHOR "<ilw@linux.intel.com>" |
78 | 78 | ||
79 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ | ||
80 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ | ||
81 | .subvendor = PCI_ANY_ID, .subdevice = (subdev), \ | ||
82 | .driver_data = (kernel_ulong_t)&(cfg) | ||
83 | |||
84 | #define TIME_UNIT 1024 | 79 | #define TIME_UNIT 1024 |
85 | 80 | ||
86 | #define IWL_SKU_G 0x1 | ||
87 | #define IWL_SKU_A 0x2 | ||
88 | #define IWL_SKU_N 0x8 | ||
89 | |||
90 | #define IWL_CMD(x) case x: return #x | 81 | #define IWL_CMD(x) case x: return #x |
91 | 82 | ||
92 | struct iwl_hcmd_ops { | 83 | struct iwl_hcmd_ops { |
@@ -146,10 +137,6 @@ struct iwl_lib_ops { | |||
146 | 137 | ||
147 | /* temperature */ | 138 | /* temperature */ |
148 | struct iwl_temp_ops temp_ops; | 139 | struct iwl_temp_ops temp_ops; |
149 | |||
150 | int (*txfifo_flush)(struct iwl_priv *priv, u16 flush_control); | ||
151 | void (*dev_txfifo_flush)(struct iwl_priv *priv, u16 flush_control); | ||
152 | |||
153 | }; | 140 | }; |
154 | 141 | ||
155 | /* NIC specific ops */ | 142 | /* NIC specific ops */ |
@@ -173,6 +160,11 @@ struct iwl_mod_params { | |||
173 | int restart_fw; /* def: 1 = restart firmware */ | 160 | int restart_fw; /* def: 1 = restart firmware */ |
174 | bool plcp_check; /* def: true = enable plcp health check */ | 161 | bool plcp_check; /* def: true = enable plcp health check */ |
175 | bool ack_check; /* def: false = disable ack health check */ | 162 | bool ack_check; /* def: false = disable ack health check */ |
163 | bool bt_coex_active; /* def: true = enable bt coex */ | ||
164 | int led_mode; /* def: 0 = system default */ | ||
165 | bool no_sleep_autoadjust; /* def: true = disable autoadjust */ | ||
166 | bool power_save; /* def: false = disable power save */ | ||
167 | int power_level; /* def: 1 = power level */ | ||
176 | }; | 168 | }; |
177 | 169 | ||
178 | /* | 170 | /* |
@@ -289,7 +281,7 @@ struct iwl_cfg { | |||
289 | const unsigned int ucode_api_min; | 281 | const unsigned int ucode_api_min; |
290 | u8 valid_tx_ant; | 282 | u8 valid_tx_ant; |
291 | u8 valid_rx_ant; | 283 | u8 valid_rx_ant; |
292 | unsigned int sku; | 284 | u16 sku; |
293 | u16 eeprom_ver; | 285 | u16 eeprom_ver; |
294 | u16 eeprom_calib_ver; | 286 | u16 eeprom_calib_ver; |
295 | const struct iwl_ops *ops; | 287 | const struct iwl_ops *ops; |
@@ -480,36 +472,14 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, | |||
480 | 472 | ||
481 | int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | 473 | int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); |
482 | 474 | ||
483 | |||
484 | /***************************************************** | ||
485 | * PCI * | ||
486 | *****************************************************/ | ||
487 | |||
488 | static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv) | ||
489 | { | ||
490 | int pos; | ||
491 | u16 pci_lnk_ctl; | ||
492 | pos = pci_find_capability(priv->pci_dev, PCI_CAP_ID_EXP); | ||
493 | pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); | ||
494 | return pci_lnk_ctl; | ||
495 | } | ||
496 | |||
497 | void iwl_bg_watchdog(unsigned long data); | 475 | void iwl_bg_watchdog(unsigned long data); |
498 | u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval); | 476 | u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval); |
499 | __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, | 477 | __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, |
500 | u32 addon, u32 beacon_interval); | 478 | u32 addon, u32 beacon_interval); |
501 | 479 | ||
502 | #ifdef CONFIG_PM | 480 | #ifdef CONFIG_PM |
503 | int iwl_pci_suspend(struct device *device); | 481 | int iwl_suspend(struct iwl_priv *priv); |
504 | int iwl_pci_resume(struct device *device); | 482 | int iwl_resume(struct iwl_priv *priv); |
505 | extern const struct dev_pm_ops iwl_pm_ops; | ||
506 | |||
507 | #define IWL_PM_OPS (&iwl_pm_ops) | ||
508 | |||
509 | #else /* !CONFIG_PM */ | ||
510 | |||
511 | #define IWL_PM_OPS NULL | ||
512 | |||
513 | #endif /* !CONFIG_PM */ | 483 | #endif /* !CONFIG_PM */ |
514 | 484 | ||
515 | /***************************************************** | 485 | /***************************************************** |
@@ -624,7 +594,6 @@ static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv) | |||
624 | priv->cfg->bt_params->advanced_bt_coexist; | 594 | priv->cfg->bt_params->advanced_bt_coexist; |
625 | } | 595 | } |
626 | 596 | ||
627 | extern bool bt_coex_active; | ||
628 | extern bool bt_siso_mode; | 597 | extern bool bt_siso_mode; |
629 | 598 | ||
630 | 599 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index 2824ccbcc1fc..eb95d1a37487 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -32,10 +32,10 @@ | |||
32 | struct iwl_priv; | 32 | struct iwl_priv; |
33 | extern u32 iwl_debug_level; | 33 | extern u32 iwl_debug_level; |
34 | 34 | ||
35 | #define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a) | 35 | #define IWL_ERR(p, f, a...) dev_err(p->bus.ops->get_dev(&p->bus), f, ## a) |
36 | #define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a) | 36 | #define IWL_WARN(p, f, a...) dev_warn(p->bus.ops->get_dev(&p->bus), f, ## a) |
37 | #define IWL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a) | 37 | #define IWL_INFO(p, f, a...) dev_info(p->bus.ops->get_dev(&p->bus), f, ## a) |
38 | #define IWL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a) | 38 | #define IWL_CRIT(p, f, a...) dev_crit(p->bus.ops->get_dev(&p->bus), f, ## a) |
39 | 39 | ||
40 | #define iwl_print_hex_error(priv, p, len) \ | 40 | #define iwl_print_hex_error(priv, p, len) \ |
41 | do { \ | 41 | do { \ |
@@ -125,13 +125,13 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
125 | /* 0x00000F00 - 0x00000100 */ | 125 | /* 0x00000F00 - 0x00000100 */ |
126 | #define IWL_DL_POWER (1 << 8) | 126 | #define IWL_DL_POWER (1 << 8) |
127 | #define IWL_DL_TEMP (1 << 9) | 127 | #define IWL_DL_TEMP (1 << 9) |
128 | #define IWL_DL_NOTIF (1 << 10) | 128 | /* reserved (1 << 10) */ |
129 | #define IWL_DL_SCAN (1 << 11) | 129 | #define IWL_DL_SCAN (1 << 11) |
130 | /* 0x0000F000 - 0x00001000 */ | 130 | /* 0x0000F000 - 0x00001000 */ |
131 | #define IWL_DL_ASSOC (1 << 12) | 131 | #define IWL_DL_ASSOC (1 << 12) |
132 | #define IWL_DL_DROP (1 << 13) | 132 | #define IWL_DL_DROP (1 << 13) |
133 | #define IWL_DL_TXPOWER (1 << 14) | 133 | /* reserved (1 << 14) */ |
134 | #define IWL_DL_AP (1 << 15) | 134 | #define IWL_DL_COEX (1 << 15) |
135 | /* 0x000F0000 - 0x00010000 */ | 135 | /* 0x000F0000 - 0x00010000 */ |
136 | #define IWL_DL_FW (1 << 16) | 136 | #define IWL_DL_FW (1 << 16) |
137 | #define IWL_DL_RF_KILL (1 << 17) | 137 | #define IWL_DL_RF_KILL (1 << 17) |
@@ -171,12 +171,10 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
171 | #define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a) | 171 | #define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a) |
172 | #define IWL_DEBUG_DROP_LIMIT(p, f, a...) \ | 172 | #define IWL_DEBUG_DROP_LIMIT(p, f, a...) \ |
173 | IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a) | 173 | IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a) |
174 | #define IWL_DEBUG_AP(p, f, a...) IWL_DEBUG(p, IWL_DL_AP, f, ## a) | 174 | #define IWL_DEBUG_COEX(p, f, a...) IWL_DEBUG(p, IWL_DL_COEX, f, ## a) |
175 | #define IWL_DEBUG_TXPOWER(p, f, a...) IWL_DEBUG(p, IWL_DL_TXPOWER, f, ## a) | ||
176 | #define IWL_DEBUG_RATE(p, f, a...) IWL_DEBUG(p, IWL_DL_RATE, f, ## a) | 175 | #define IWL_DEBUG_RATE(p, f, a...) IWL_DEBUG(p, IWL_DL_RATE, f, ## a) |
177 | #define IWL_DEBUG_RATE_LIMIT(p, f, a...) \ | 176 | #define IWL_DEBUG_RATE_LIMIT(p, f, a...) \ |
178 | IWL_DEBUG_LIMIT(p, IWL_DL_RATE, f, ## a) | 177 | IWL_DEBUG_LIMIT(p, IWL_DL_RATE, f, ## a) |
179 | #define IWL_DEBUG_NOTIF(p, f, a...) IWL_DEBUG(p, IWL_DL_NOTIF, f, ## a) | ||
180 | #define IWL_DEBUG_ASSOC(p, f, a...) \ | 178 | #define IWL_DEBUG_ASSOC(p, f, a...) \ |
181 | IWL_DEBUG(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) | 179 | IWL_DEBUG(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) |
182 | #define IWL_DEBUG_ASSOC_LIMIT(p, f, a...) \ | 180 | #define IWL_DEBUG_ASSOC_LIMIT(p, f, a...) \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 0e6a04b739ad..6f9ebae8ca06 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -227,7 +227,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
227 | /* default is to dump the entire data segment */ | 227 | /* default is to dump the entire data segment */ |
228 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { | 228 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { |
229 | priv->dbgfs_sram_offset = 0x800000; | 229 | priv->dbgfs_sram_offset = 0x800000; |
230 | if (priv->ucode_type == UCODE_SUBTYPE_INIT) | 230 | if (priv->ucode_type == IWL_UCODE_INIT) |
231 | priv->dbgfs_sram_len = priv->ucode_init.data.len; | 231 | priv->dbgfs_sram_len = priv->ucode_init.data.len; |
232 | else | 232 | else |
233 | priv->dbgfs_sram_len = priv->ucode_rt.data.len; | 233 | priv->dbgfs_sram_len = priv->ucode_rt.data.len; |
@@ -2493,7 +2493,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file, | |||
2493 | if (iwl_is_rfkill(priv)) | 2493 | if (iwl_is_rfkill(priv)) |
2494 | return -EFAULT; | 2494 | return -EFAULT; |
2495 | 2495 | ||
2496 | priv->cfg->ops->lib->dev_txfifo_flush(priv, IWL_DROP_ALL); | 2496 | iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); |
2497 | 2497 | ||
2498 | return count; | 2498 | return count; |
2499 | } | 2499 | } |
@@ -2693,8 +2693,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2693 | DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); | 2693 | DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); |
2694 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); | 2694 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); |
2695 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); | 2695 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); |
2696 | if (priv->cfg->ops->lib->dev_txfifo_flush) | 2696 | DEBUGFS_ADD_FILE(txfifo_flush, dir_debug, S_IWUSR); |
2697 | DEBUGFS_ADD_FILE(txfifo_flush, dir_debug, S_IWUSR); | ||
2698 | DEBUGFS_ADD_FILE(protection_mode, dir_debug, S_IWUSR | S_IRUSR); | 2697 | DEBUGFS_ADD_FILE(protection_mode, dir_debug, S_IWUSR | S_IRUSR); |
2699 | 2698 | ||
2700 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); | 2699 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index c8de236c141b..8ec04f20c96a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -48,6 +48,8 @@ | |||
48 | #include "iwl-agn-rs.h" | 48 | #include "iwl-agn-rs.h" |
49 | #include "iwl-agn-tt.h" | 49 | #include "iwl-agn-tt.h" |
50 | 50 | ||
51 | #define DRV_NAME "iwlagn" | ||
52 | |||
51 | struct iwl_tx_queue; | 53 | struct iwl_tx_queue; |
52 | 54 | ||
53 | /* CT-KILL constants */ | 55 | /* CT-KILL constants */ |
@@ -1168,14 +1170,63 @@ enum iwl_scan_type { | |||
1168 | IWL_SCAN_OFFCH_TX, | 1170 | IWL_SCAN_OFFCH_TX, |
1169 | }; | 1171 | }; |
1170 | 1172 | ||
1173 | enum iwlagn_ucode_type { | ||
1174 | IWL_UCODE_NONE, | ||
1175 | IWL_UCODE_REGULAR, | ||
1176 | IWL_UCODE_INIT, | ||
1177 | IWL_UCODE_WOWLAN, | ||
1178 | }; | ||
1179 | |||
1171 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL | 1180 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL |
1172 | struct iwl_testmode_trace { | 1181 | struct iwl_testmode_trace { |
1182 | u32 buff_size; | ||
1183 | u32 total_size; | ||
1184 | u32 num_chunks; | ||
1173 | u8 *cpu_addr; | 1185 | u8 *cpu_addr; |
1174 | u8 *trace_addr; | 1186 | u8 *trace_addr; |
1175 | dma_addr_t dma_addr; | 1187 | dma_addr_t dma_addr; |
1176 | bool trace_enabled; | 1188 | bool trace_enabled; |
1177 | }; | 1189 | }; |
1178 | #endif | 1190 | #endif |
1191 | |||
1192 | struct iwl_bus; | ||
1193 | |||
1194 | /** | ||
1195 | * struct iwl_bus_ops - bus specific operations | ||
1196 | |||
1197 | * @get_pm_support: must returns true if the bus can go to sleep | ||
1198 | * @apm_config: will be called during the config of the APM configuration | ||
1199 | * @set_drv_data: set the priv pointer to the bus layer | ||
1200 | * @get_dev: returns the device struct | ||
1201 | * @get_irq: returns the irq number | ||
1202 | * @get_hw_id: prints the hw_id in the provided buffer | ||
1203 | * @write8: write a byte to register at offset ofs | ||
1204 | * @write32: write a dword to register at offset ofs | ||
1205 | * @wread32: read a dword at register at offset ofs | ||
1206 | */ | ||
1207 | struct iwl_bus_ops { | ||
1208 | bool (*get_pm_support)(struct iwl_bus *bus); | ||
1209 | void (*apm_config)(struct iwl_bus *bus); | ||
1210 | void (*set_drv_data)(struct iwl_bus *bus, void *priv); | ||
1211 | struct device *(*get_dev)(const struct iwl_bus *bus); | ||
1212 | unsigned int (*get_irq)(const struct iwl_bus *bus); | ||
1213 | void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len); | ||
1214 | void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val); | ||
1215 | void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val); | ||
1216 | u32 (*read32)(struct iwl_bus *bus, u32 ofs); | ||
1217 | }; | ||
1218 | |||
1219 | struct iwl_bus { | ||
1220 | /* pointer to bus specific struct */ | ||
1221 | void *bus_specific; | ||
1222 | |||
1223 | /* Common data to all buses */ | ||
1224 | struct iwl_priv *priv; /* driver's context */ | ||
1225 | struct device *dev; | ||
1226 | struct iwl_bus_ops *ops; | ||
1227 | unsigned int irq; | ||
1228 | }; | ||
1229 | |||
1179 | struct iwl_priv { | 1230 | struct iwl_priv { |
1180 | 1231 | ||
1181 | /* ieee device used by generic ieee processing code */ | 1232 | /* ieee device used by generic ieee processing code */ |
@@ -1243,17 +1294,14 @@ struct iwl_priv { | |||
1243 | spinlock_t reg_lock; /* protect hw register access */ | 1294 | spinlock_t reg_lock; /* protect hw register access */ |
1244 | struct mutex mutex; | 1295 | struct mutex mutex; |
1245 | 1296 | ||
1246 | /* basic pci-network driver stuff */ | 1297 | struct iwl_bus bus; /* bus specific data */ |
1247 | struct pci_dev *pci_dev; | ||
1248 | |||
1249 | /* pci hardware address support */ | ||
1250 | void __iomem *hw_base; | ||
1251 | 1298 | ||
1252 | /* microcode/device supports multiple contexts */ | 1299 | /* microcode/device supports multiple contexts */ |
1253 | u8 valid_contexts; | 1300 | u8 valid_contexts; |
1254 | 1301 | ||
1255 | /* command queue number */ | 1302 | /* command queue number */ |
1256 | u8 cmd_queue; | 1303 | u8 cmd_queue; |
1304 | u8 last_sync_cmd_id; | ||
1257 | 1305 | ||
1258 | /* max number of station keys */ | 1306 | /* max number of station keys */ |
1259 | u8 sta_key_max_num; | 1307 | u8 sta_key_max_num; |
@@ -1270,7 +1318,7 @@ struct iwl_priv { | |||
1270 | struct fw_img ucode_rt; | 1318 | struct fw_img ucode_rt; |
1271 | struct fw_img ucode_init; | 1319 | struct fw_img ucode_init; |
1272 | 1320 | ||
1273 | enum iwlagn_ucode_subtype ucode_type; | 1321 | enum iwlagn_ucode_type ucode_type; |
1274 | u8 ucode_write_complete; /* the image write is complete */ | 1322 | u8 ucode_write_complete; /* the image write is complete */ |
1275 | char firmware_name[25]; | 1323 | char firmware_name[25]; |
1276 | 1324 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 47a56bc1cd12..768d0ee276f7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -834,3 +834,28 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, | |||
834 | 834 | ||
835 | return NULL; | 835 | return NULL; |
836 | } | 836 | } |
837 | |||
838 | void iwl_rf_config(struct iwl_priv *priv) | ||
839 | { | ||
840 | u16 radio_cfg; | ||
841 | |||
842 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); | ||
843 | |||
844 | /* write radio config values to register */ | ||
845 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) { | ||
846 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
847 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | | ||
848 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | | ||
849 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); | ||
850 | IWL_INFO(priv, "Radio type=0x%x-0x%x-0x%x\n", | ||
851 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg), | ||
852 | EEPROM_RF_CFG_STEP_MSK(radio_cfg), | ||
853 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); | ||
854 | } else | ||
855 | WARN_ON(1); | ||
856 | |||
857 | /* set CSR_HW_CONFIG_REG for uCode use */ | ||
858 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | ||
859 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | ||
860 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | ||
861 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index c960c6fa009b..804f910c651e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -110,12 +110,10 @@ enum { | |||
110 | }; | 110 | }; |
111 | 111 | ||
112 | /* SKU Capabilities */ | 112 | /* SKU Capabilities */ |
113 | /* 5000 and up */ | 113 | #define EEPROM_SKU_CAP_BAND_24GHZ (1 << 4) |
114 | #define EEPROM_SKU_CAP_BAND_POS (4) | 114 | #define EEPROM_SKU_CAP_BAND_52GHZ (1 << 5) |
115 | #define EEPROM_SKU_CAP_BAND_SELECTION \ | ||
116 | (3 << EEPROM_SKU_CAP_BAND_POS) | ||
117 | #define EEPROM_SKU_CAP_11N_ENABLE (1 << 6) | 115 | #define EEPROM_SKU_CAP_11N_ENABLE (1 << 6) |
118 | #define EEPROM_SKU_CAP_AMT_ENABLE (1 << 7) | 116 | #define EEPROM_SKU_CAP_AMT_ENABLE (1 << 7) |
119 | #define EEPROM_SKU_CAP_IPAN_ENABLE (1 << 8) | 117 | #define EEPROM_SKU_CAP_IPAN_ENABLE (1 << 8) |
120 | 118 | ||
121 | /* *regulatory* channel data format in eeprom, one for each channel. | 119 | /* *regulatory* channel data format in eeprom, one for each channel. |
@@ -164,16 +162,12 @@ struct iwl_eeprom_enhanced_txpwr { | |||
164 | s8 mimo3_max; | 162 | s8 mimo3_max; |
165 | } __packed; | 163 | } __packed; |
166 | 164 | ||
167 | /* 5000 Specific */ | 165 | /* calibration */ |
168 | #define EEPROM_5000_TX_POWER_VERSION (4) | ||
169 | #define EEPROM_5000_EEPROM_VERSION (0x11A) | ||
170 | |||
171 | /* 5000 and up calibration */ | ||
172 | #define EEPROM_CALIB_ALL (INDIRECT_ADDRESS | INDIRECT_CALIBRATION) | 166 | #define EEPROM_CALIB_ALL (INDIRECT_ADDRESS | INDIRECT_CALIBRATION) |
173 | #define EEPROM_XTAL ((2*0x128) | EEPROM_CALIB_ALL) | 167 | #define EEPROM_XTAL ((2*0x128) | EEPROM_CALIB_ALL) |
174 | 168 | ||
175 | /* 5000 temperature */ | 169 | /* temperature */ |
176 | #define EEPROM_5000_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL) | 170 | #define EEPROM_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL) |
177 | 171 | ||
178 | /* agn links */ | 172 | /* agn links */ |
179 | #define EEPROM_LINK_HOST (2*0x64) | 173 | #define EEPROM_LINK_HOST (2*0x64) |
@@ -205,6 +199,10 @@ struct iwl_eeprom_enhanced_txpwr { | |||
205 | #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS ((0x80)\ | 199 | #define EEPROM_6000_REG_BAND_24_HT40_CHANNELS ((0x80)\ |
206 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 14 bytes */ | 200 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 14 bytes */ |
207 | 201 | ||
202 | /* 5000 Specific */ | ||
203 | #define EEPROM_5000_TX_POWER_VERSION (4) | ||
204 | #define EEPROM_5000_EEPROM_VERSION (0x11A) | ||
205 | |||
208 | /* 5050 Specific */ | 206 | /* 5050 Specific */ |
209 | #define EEPROM_5050_TX_POWER_VERSION (4) | 207 | #define EEPROM_5050_TX_POWER_VERSION (4) |
210 | #define EEPROM_5050_EEPROM_VERSION (0x21E) | 208 | #define EEPROM_5050_EEPROM_VERSION (0x21E) |
@@ -270,13 +268,13 @@ extern const u8 iwl_eeprom_band_1[14]; | |||
270 | 268 | ||
271 | /* General */ | 269 | /* General */ |
272 | #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ | 270 | #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ |
271 | #define EEPROM_SUBSYSTEM_ID (2*0x0A) /* 2 bytes */ | ||
273 | #define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ | 272 | #define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ |
274 | #define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ | 273 | #define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ |
275 | #define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ | 274 | #define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ |
276 | #define EEPROM_VERSION (2*0x44) /* 2 bytes */ | 275 | #define EEPROM_VERSION (2*0x44) /* 2 bytes */ |
277 | #define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */ | 276 | #define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */ |
278 | #define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ | 277 | #define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ |
279 | #define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ | ||
280 | #define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ | 278 | #define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ |
281 | #define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ | 279 | #define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ |
282 | 280 | ||
@@ -311,5 +309,6 @@ void iwl_free_channel_map(struct iwl_priv *priv); | |||
311 | const struct iwl_channel_info *iwl_get_channel_info( | 309 | const struct iwl_channel_info *iwl_get_channel_info( |
312 | const struct iwl_priv *priv, | 310 | const struct iwl_priv *priv, |
313 | enum ieee80211_band band, u16 channel); | 311 | enum ieee80211_band band, u16 channel); |
312 | void iwl_rf_config(struct iwl_priv *priv); | ||
314 | 313 | ||
315 | #endif /* __iwl_eeprom_h__ */ | 314 | #endif /* __iwl_eeprom_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 76f996623140..7cdb1ec73b54 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -181,7 +181,16 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
181 | IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", | 181 | IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", |
182 | get_cmd_string(cmd->id)); | 182 | get_cmd_string(cmd->id)); |
183 | 183 | ||
184 | set_bit(STATUS_HCMD_ACTIVE, &priv->status); | 184 | if (test_and_set_bit(STATUS_HCMD_ACTIVE, &priv->status)) { |
185 | IWL_ERR(priv, "STATUS_HCMD_ACTIVE already set while sending %s" | ||
186 | ". Previous SYNC cmdn is %s\n", | ||
187 | get_cmd_string(cmd->id), | ||
188 | get_cmd_string(priv->last_sync_cmd_id)); | ||
189 | WARN_ON(1); | ||
190 | } else { | ||
191 | priv->last_sync_cmd_id = cmd->id; | ||
192 | } | ||
193 | |||
185 | IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n", | 194 | IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n", |
186 | get_cmd_string(cmd->id)); | 195 | get_cmd_string(cmd->id)); |
187 | 196 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index 41207a3645b8..9d91552d13c1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h | |||
@@ -120,7 +120,16 @@ static inline void iwl_wake_any_queue(struct iwl_priv *priv, | |||
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | #ifdef ieee80211_stop_queue | ||
124 | #undef ieee80211_stop_queue | ||
125 | #endif | ||
126 | |||
123 | #define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue | 127 | #define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue |
128 | |||
129 | #ifdef ieee80211_wake_queue | ||
130 | #undef ieee80211_wake_queue | ||
131 | #endif | ||
132 | |||
124 | #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue | 133 | #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue |
125 | 134 | ||
126 | static inline void iwl_disable_interrupts(struct iwl_priv *priv) | 135 | static inline void iwl_disable_interrupts(struct iwl_priv *priv) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index 869edc580ec6..c56eae74c3cd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h | |||
@@ -38,18 +38,18 @@ | |||
38 | static inline void iwl_write8(struct iwl_priv *priv, u32 ofs, u8 val) | 38 | static inline void iwl_write8(struct iwl_priv *priv, u32 ofs, u8 val) |
39 | { | 39 | { |
40 | trace_iwlwifi_dev_iowrite8(priv, ofs, val); | 40 | trace_iwlwifi_dev_iowrite8(priv, ofs, val); |
41 | iowrite8(val, priv->hw_base + ofs); | 41 | priv->bus.ops->write8(&priv->bus, ofs, val); |
42 | } | 42 | } |
43 | 43 | ||
44 | static inline void iwl_write32(struct iwl_priv *priv, u32 ofs, u32 val) | 44 | static inline void iwl_write32(struct iwl_priv *priv, u32 ofs, u32 val) |
45 | { | 45 | { |
46 | trace_iwlwifi_dev_iowrite32(priv, ofs, val); | 46 | trace_iwlwifi_dev_iowrite32(priv, ofs, val); |
47 | iowrite32(val, priv->hw_base + ofs); | 47 | priv->bus.ops->write32(&priv->bus, ofs, val); |
48 | } | 48 | } |
49 | 49 | ||
50 | static inline u32 iwl_read32(struct iwl_priv *priv, u32 ofs) | 50 | static inline u32 iwl_read32(struct iwl_priv *priv, u32 ofs) |
51 | { | 51 | { |
52 | u32 val = ioread32(priv->hw_base + ofs); | 52 | u32 val = priv->bus.ops->read32(&priv->bus, ofs); |
53 | trace_iwlwifi_dev_ioread32(priv, ofs, val); | 53 | trace_iwlwifi_dev_ioread32(priv, ofs, val); |
54 | return val; | 54 | return val; |
55 | } | 55 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c index 7c23beb49d7c..ff08da099754 100644 --- a/drivers/net/wireless/iwlwifi/iwl-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-led.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/pci.h> | ||
32 | #include <linux/dma-mapping.h> | ||
33 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
34 | #include <linux/skbuff.h> | 32 | #include <linux/skbuff.h> |
35 | #include <linux/netdevice.h> | 33 | #include <linux/netdevice.h> |
@@ -40,14 +38,9 @@ | |||
40 | 38 | ||
41 | #include "iwl-dev.h" | 39 | #include "iwl-dev.h" |
42 | #include "iwl-core.h" | 40 | #include "iwl-core.h" |
41 | #include "iwl-agn.h" | ||
43 | #include "iwl-io.h" | 42 | #include "iwl-io.h" |
44 | 43 | ||
45 | /* default: IWL_LED_BLINK(0) using blinking index table */ | ||
46 | static int led_mode; | ||
47 | module_param(led_mode, int, S_IRUGO); | ||
48 | MODULE_PARM_DESC(led_mode, "0=system default, " | ||
49 | "1=On(RF On)/Off(RF Off), 2=blinking"); | ||
50 | |||
51 | /* Throughput OFF time(ms) ON time (ms) | 44 | /* Throughput OFF time(ms) ON time (ms) |
52 | * >300 25 25 | 45 | * >300 25 25 |
53 | * >200 to 300 40 40 | 46 | * >200 to 300 40 40 |
@@ -181,7 +174,7 @@ static int iwl_led_blink_set(struct led_classdev *led_cdev, | |||
181 | 174 | ||
182 | void iwl_leds_init(struct iwl_priv *priv) | 175 | void iwl_leds_init(struct iwl_priv *priv) |
183 | { | 176 | { |
184 | int mode = led_mode; | 177 | int mode = iwlagn_mod_params.led_mode; |
185 | int ret; | 178 | int ret; |
186 | 179 | ||
187 | if (mode == IWL_LED_DEFAULT) | 180 | if (mode == IWL_LED_DEFAULT) |
@@ -209,7 +202,8 @@ void iwl_leds_init(struct iwl_priv *priv) | |||
209 | break; | 202 | break; |
210 | } | 203 | } |
211 | 204 | ||
212 | ret = led_classdev_register(&priv->pci_dev->dev, &priv->led); | 205 | ret = led_classdev_register(priv->bus.dev, |
206 | &priv->led); | ||
213 | if (ret) { | 207 | if (ret) { |
214 | kfree(priv->led.name); | 208 | kfree(priv->led.name); |
215 | return; | 209 | return; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c new file mode 100644 index 000000000000..7328fbff7f7b --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c | |||
@@ -0,0 +1,571 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
4 | * redistributing this file, you may do so under either license. | ||
5 | * | ||
6 | * GPL LICENSE SUMMARY | ||
7 | * | ||
8 | * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of version 2 of the GNU General Public License as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
22 | * USA | ||
23 | * | ||
24 | * The full GNU General Public License is included in this distribution | ||
25 | * in the file called LICENSE.GPL. | ||
26 | * | ||
27 | * Contact Information: | ||
28 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
30 | * | ||
31 | * BSD LICENSE | ||
32 | * | ||
33 | * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. | ||
34 | * All rights reserved. | ||
35 | * | ||
36 | * Redistribution and use in source and binary forms, with or without | ||
37 | * modification, are permitted provided that the following conditions | ||
38 | * are met: | ||
39 | * | ||
40 | * * Redistributions of source code must retain the above copyright | ||
41 | * notice, this list of conditions and the following disclaimer. | ||
42 | * * Redistributions in binary form must reproduce the above copyright | ||
43 | * notice, this list of conditions and the following disclaimer in | ||
44 | * the documentation and/or other materials provided with the | ||
45 | * distribution. | ||
46 | * * Neither the name Intel Corporation nor the names of its | ||
47 | * contributors may be used to endorse or promote products derived | ||
48 | * from this software without specific prior written permission. | ||
49 | * | ||
50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
61 | * | ||
62 | *****************************************************************************/ | ||
63 | #include <linux/pci.h> | ||
64 | #include <linux/pci-aspm.h> | ||
65 | |||
66 | #include "iwl-pci.h" | ||
67 | #include "iwl-agn.h" | ||
68 | #include "iwl-core.h" | ||
69 | #include "iwl-io.h" | ||
70 | |||
71 | /* PCI registers */ | ||
72 | #define PCI_CFG_RETRY_TIMEOUT 0x041 | ||
73 | #define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01 | ||
74 | #define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02 | ||
75 | |||
76 | struct iwl_pci_bus { | ||
77 | /* basic pci-network driver stuff */ | ||
78 | struct pci_dev *pci_dev; | ||
79 | |||
80 | /* pci hardware address support */ | ||
81 | void __iomem *hw_base; | ||
82 | }; | ||
83 | |||
84 | #define IWL_BUS_GET_PCI_BUS(_iwl_bus) \ | ||
85 | ((struct iwl_pci_bus *) ((_iwl_bus)->bus_specific)) | ||
86 | |||
87 | #define IWL_BUS_GET_PCI_DEV(_iwl_bus) \ | ||
88 | ((IWL_BUS_GET_PCI_BUS(_iwl_bus))->pci_dev) | ||
89 | |||
90 | static u16 iwl_pciexp_link_ctrl(struct iwl_bus *bus) | ||
91 | { | ||
92 | int pos; | ||
93 | u16 pci_lnk_ctl; | ||
94 | struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus); | ||
95 | |||
96 | pos = pci_find_capability(pci_dev, PCI_CAP_ID_EXP); | ||
97 | pci_read_config_word(pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); | ||
98 | return pci_lnk_ctl; | ||
99 | } | ||
100 | |||
101 | static bool iwl_pci_is_pm_supported(struct iwl_bus *bus) | ||
102 | { | ||
103 | u16 lctl = iwl_pciexp_link_ctrl(bus); | ||
104 | |||
105 | return !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); | ||
106 | } | ||
107 | |||
108 | static void iwl_pci_apm_config(struct iwl_bus *bus) | ||
109 | { | ||
110 | /* | ||
111 | * HW bug W/A for instability in PCIe bus L0S->L1 transition. | ||
112 | * Check if BIOS (or OS) enabled L1-ASPM on this device. | ||
113 | * If so (likely), disable L0S, so device moves directly L0->L1; | ||
114 | * costs negligible amount of power savings. | ||
115 | * If not (unlikely), enable L0S, so there is at least some | ||
116 | * power savings, even without L1. | ||
117 | */ | ||
118 | u16 lctl = iwl_pciexp_link_ctrl(bus); | ||
119 | |||
120 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == | ||
121 | PCI_CFG_LINK_CTRL_VAL_L1_EN) { | ||
122 | /* L1-ASPM enabled; disable(!) L0S */ | ||
123 | iwl_set_bit(bus->priv, CSR_GIO_REG, | ||
124 | CSR_GIO_REG_VAL_L0S_ENABLED); | ||
125 | IWL_DEBUG_POWER(bus->priv, "L1 Enabled; Disabling L0S\n"); | ||
126 | } else { | ||
127 | /* L1-ASPM disabled; enable(!) L0S */ | ||
128 | iwl_clear_bit(bus->priv, CSR_GIO_REG, | ||
129 | CSR_GIO_REG_VAL_L0S_ENABLED); | ||
130 | IWL_DEBUG_POWER(bus->priv, "L1 Disabled; Enabling L0S\n"); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_priv) | ||
135 | { | ||
136 | pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), drv_priv); | ||
137 | } | ||
138 | |||
139 | static struct device *iwl_pci_get_dev(const struct iwl_bus *bus) | ||
140 | { | ||
141 | return &(IWL_BUS_GET_PCI_DEV(bus)->dev); | ||
142 | } | ||
143 | |||
144 | static unsigned int iwl_pci_get_irq(const struct iwl_bus *bus) | ||
145 | { | ||
146 | return IWL_BUS_GET_PCI_DEV(bus)->irq; | ||
147 | } | ||
148 | |||
149 | static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], | ||
150 | int buf_len) | ||
151 | { | ||
152 | struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus); | ||
153 | |||
154 | snprintf(buf, buf_len, "PCI ID: 0x%04X:0x%04X", pci_dev->device, | ||
155 | pci_dev->subsystem_device); | ||
156 | } | ||
157 | |||
158 | static void iwl_pci_write8(struct iwl_bus *bus, u32 ofs, u8 val) | ||
159 | { | ||
160 | iowrite8(val, IWL_BUS_GET_PCI_BUS(bus)->hw_base + ofs); | ||
161 | } | ||
162 | |||
163 | static void iwl_pci_write32(struct iwl_bus *bus, u32 ofs, u32 val) | ||
164 | { | ||
165 | iowrite32(val, IWL_BUS_GET_PCI_BUS(bus)->hw_base + ofs); | ||
166 | } | ||
167 | |||
168 | static u32 iwl_pci_read32(struct iwl_bus *bus, u32 ofs) | ||
169 | { | ||
170 | u32 val = ioread32(IWL_BUS_GET_PCI_BUS(bus)->hw_base + ofs); | ||
171 | return val; | ||
172 | } | ||
173 | |||
174 | static struct iwl_bus_ops pci_ops = { | ||
175 | .get_pm_support = iwl_pci_is_pm_supported, | ||
176 | .apm_config = iwl_pci_apm_config, | ||
177 | .set_drv_data = iwl_pci_set_drv_data, | ||
178 | .get_dev = iwl_pci_get_dev, | ||
179 | .get_irq = iwl_pci_get_irq, | ||
180 | .get_hw_id = iwl_pci_get_hw_id, | ||
181 | .write8 = iwl_pci_write8, | ||
182 | .write32 = iwl_pci_write32, | ||
183 | .read32 = iwl_pci_read32, | ||
184 | }; | ||
185 | |||
186 | #define IWL_PCI_DEVICE(dev, subdev, cfg) \ | ||
187 | .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ | ||
188 | .subvendor = PCI_ANY_ID, .subdevice = (subdev), \ | ||
189 | .driver_data = (kernel_ulong_t)&(cfg) | ||
190 | |||
191 | /* Hardware specific file defines the PCI IDs table for that hardware module */ | ||
192 | static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | ||
193 | {IWL_PCI_DEVICE(0x4232, 0x1201, iwl5100_agn_cfg)}, /* Mini Card */ | ||
194 | {IWL_PCI_DEVICE(0x4232, 0x1301, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
195 | {IWL_PCI_DEVICE(0x4232, 0x1204, iwl5100_agn_cfg)}, /* Mini Card */ | ||
196 | {IWL_PCI_DEVICE(0x4232, 0x1304, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
197 | {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bgn_cfg)}, /* Mini Card */ | ||
198 | {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bgn_cfg)}, /* Half Mini Card */ | ||
199 | {IWL_PCI_DEVICE(0x4232, 0x1206, iwl5100_abg_cfg)}, /* Mini Card */ | ||
200 | {IWL_PCI_DEVICE(0x4232, 0x1306, iwl5100_abg_cfg)}, /* Half Mini Card */ | ||
201 | {IWL_PCI_DEVICE(0x4232, 0x1221, iwl5100_agn_cfg)}, /* Mini Card */ | ||
202 | {IWL_PCI_DEVICE(0x4232, 0x1321, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
203 | {IWL_PCI_DEVICE(0x4232, 0x1224, iwl5100_agn_cfg)}, /* Mini Card */ | ||
204 | {IWL_PCI_DEVICE(0x4232, 0x1324, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
205 | {IWL_PCI_DEVICE(0x4232, 0x1225, iwl5100_bgn_cfg)}, /* Mini Card */ | ||
206 | {IWL_PCI_DEVICE(0x4232, 0x1325, iwl5100_bgn_cfg)}, /* Half Mini Card */ | ||
207 | {IWL_PCI_DEVICE(0x4232, 0x1226, iwl5100_abg_cfg)}, /* Mini Card */ | ||
208 | {IWL_PCI_DEVICE(0x4232, 0x1326, iwl5100_abg_cfg)}, /* Half Mini Card */ | ||
209 | {IWL_PCI_DEVICE(0x4237, 0x1211, iwl5100_agn_cfg)}, /* Mini Card */ | ||
210 | {IWL_PCI_DEVICE(0x4237, 0x1311, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
211 | {IWL_PCI_DEVICE(0x4237, 0x1214, iwl5100_agn_cfg)}, /* Mini Card */ | ||
212 | {IWL_PCI_DEVICE(0x4237, 0x1314, iwl5100_agn_cfg)}, /* Half Mini Card */ | ||
213 | {IWL_PCI_DEVICE(0x4237, 0x1215, iwl5100_bgn_cfg)}, /* Mini Card */ | ||
214 | {IWL_PCI_DEVICE(0x4237, 0x1315, iwl5100_bgn_cfg)}, /* Half Mini Card */ | ||
215 | {IWL_PCI_DEVICE(0x4237, 0x1216, iwl5100_abg_cfg)}, /* Mini Card */ | ||
216 | {IWL_PCI_DEVICE(0x4237, 0x1316, iwl5100_abg_cfg)}, /* Half Mini Card */ | ||
217 | |||
218 | /* 5300 Series WiFi */ | ||
219 | {IWL_PCI_DEVICE(0x4235, 0x1021, iwl5300_agn_cfg)}, /* Mini Card */ | ||
220 | {IWL_PCI_DEVICE(0x4235, 0x1121, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
221 | {IWL_PCI_DEVICE(0x4235, 0x1024, iwl5300_agn_cfg)}, /* Mini Card */ | ||
222 | {IWL_PCI_DEVICE(0x4235, 0x1124, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
223 | {IWL_PCI_DEVICE(0x4235, 0x1001, iwl5300_agn_cfg)}, /* Mini Card */ | ||
224 | {IWL_PCI_DEVICE(0x4235, 0x1101, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
225 | {IWL_PCI_DEVICE(0x4235, 0x1004, iwl5300_agn_cfg)}, /* Mini Card */ | ||
226 | {IWL_PCI_DEVICE(0x4235, 0x1104, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
227 | {IWL_PCI_DEVICE(0x4236, 0x1011, iwl5300_agn_cfg)}, /* Mini Card */ | ||
228 | {IWL_PCI_DEVICE(0x4236, 0x1111, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
229 | {IWL_PCI_DEVICE(0x4236, 0x1014, iwl5300_agn_cfg)}, /* Mini Card */ | ||
230 | {IWL_PCI_DEVICE(0x4236, 0x1114, iwl5300_agn_cfg)}, /* Half Mini Card */ | ||
231 | |||
232 | /* 5350 Series WiFi/WiMax */ | ||
233 | {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, /* Mini Card */ | ||
234 | {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, /* Mini Card */ | ||
235 | {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, /* Mini Card */ | ||
236 | |||
237 | /* 5150 Series Wifi/WiMax */ | ||
238 | {IWL_PCI_DEVICE(0x423C, 0x1201, iwl5150_agn_cfg)}, /* Mini Card */ | ||
239 | {IWL_PCI_DEVICE(0x423C, 0x1301, iwl5150_agn_cfg)}, /* Half Mini Card */ | ||
240 | {IWL_PCI_DEVICE(0x423C, 0x1206, iwl5150_abg_cfg)}, /* Mini Card */ | ||
241 | {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ | ||
242 | {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ | ||
243 | {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ | ||
244 | |||
245 | {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ | ||
246 | {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ | ||
247 | {IWL_PCI_DEVICE(0x423D, 0x1216, iwl5150_abg_cfg)}, /* Mini Card */ | ||
248 | {IWL_PCI_DEVICE(0x423D, 0x1316, iwl5150_abg_cfg)}, /* Half Mini Card */ | ||
249 | |||
250 | /* 6x00 Series */ | ||
251 | {IWL_PCI_DEVICE(0x422B, 0x1101, iwl6000_3agn_cfg)}, | ||
252 | {IWL_PCI_DEVICE(0x422B, 0x1121, iwl6000_3agn_cfg)}, | ||
253 | {IWL_PCI_DEVICE(0x422C, 0x1301, iwl6000i_2agn_cfg)}, | ||
254 | {IWL_PCI_DEVICE(0x422C, 0x1306, iwl6000i_2abg_cfg)}, | ||
255 | {IWL_PCI_DEVICE(0x422C, 0x1307, iwl6000i_2bg_cfg)}, | ||
256 | {IWL_PCI_DEVICE(0x422C, 0x1321, iwl6000i_2agn_cfg)}, | ||
257 | {IWL_PCI_DEVICE(0x422C, 0x1326, iwl6000i_2abg_cfg)}, | ||
258 | {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)}, | ||
259 | {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, | ||
260 | {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, | ||
261 | |||
262 | /* 6x05 Series */ | ||
263 | {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6005_2agn_cfg)}, | ||
264 | {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6005_2abg_cfg)}, | ||
265 | {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6005_2bg_cfg)}, | ||
266 | {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6005_2agn_cfg)}, | ||
267 | {IWL_PCI_DEVICE(0x0082, 0x1326, iwl6005_2abg_cfg)}, | ||
268 | {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)}, | ||
269 | {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)}, | ||
270 | |||
271 | /* 6x30 Series */ | ||
272 | {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)}, | ||
273 | {IWL_PCI_DEVICE(0x008A, 0x5307, iwl1030_bg_cfg)}, | ||
274 | {IWL_PCI_DEVICE(0x008A, 0x5325, iwl1030_bgn_cfg)}, | ||
275 | {IWL_PCI_DEVICE(0x008A, 0x5327, iwl1030_bg_cfg)}, | ||
276 | {IWL_PCI_DEVICE(0x008B, 0x5315, iwl1030_bgn_cfg)}, | ||
277 | {IWL_PCI_DEVICE(0x008B, 0x5317, iwl1030_bg_cfg)}, | ||
278 | {IWL_PCI_DEVICE(0x0090, 0x5211, iwl6030_2agn_cfg)}, | ||
279 | {IWL_PCI_DEVICE(0x0090, 0x5215, iwl6030_2bgn_cfg)}, | ||
280 | {IWL_PCI_DEVICE(0x0090, 0x5216, iwl6030_2abg_cfg)}, | ||
281 | {IWL_PCI_DEVICE(0x0091, 0x5201, iwl6030_2agn_cfg)}, | ||
282 | {IWL_PCI_DEVICE(0x0091, 0x5205, iwl6030_2bgn_cfg)}, | ||
283 | {IWL_PCI_DEVICE(0x0091, 0x5206, iwl6030_2abg_cfg)}, | ||
284 | {IWL_PCI_DEVICE(0x0091, 0x5207, iwl6030_2bg_cfg)}, | ||
285 | {IWL_PCI_DEVICE(0x0091, 0x5221, iwl6030_2agn_cfg)}, | ||
286 | {IWL_PCI_DEVICE(0x0091, 0x5225, iwl6030_2bgn_cfg)}, | ||
287 | {IWL_PCI_DEVICE(0x0091, 0x5226, iwl6030_2abg_cfg)}, | ||
288 | |||
289 | /* 6x50 WiFi/WiMax Series */ | ||
290 | {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, | ||
291 | {IWL_PCI_DEVICE(0x0087, 0x1306, iwl6050_2abg_cfg)}, | ||
292 | {IWL_PCI_DEVICE(0x0087, 0x1321, iwl6050_2agn_cfg)}, | ||
293 | {IWL_PCI_DEVICE(0x0087, 0x1326, iwl6050_2abg_cfg)}, | ||
294 | {IWL_PCI_DEVICE(0x0089, 0x1311, iwl6050_2agn_cfg)}, | ||
295 | {IWL_PCI_DEVICE(0x0089, 0x1316, iwl6050_2abg_cfg)}, | ||
296 | |||
297 | /* 6150 WiFi/WiMax Series */ | ||
298 | {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, | ||
299 | {IWL_PCI_DEVICE(0x0885, 0x1307, iwl6150_bg_cfg)}, | ||
300 | {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, | ||
301 | {IWL_PCI_DEVICE(0x0885, 0x1327, iwl6150_bg_cfg)}, | ||
302 | {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, | ||
303 | {IWL_PCI_DEVICE(0x0886, 0x1317, iwl6150_bg_cfg)}, | ||
304 | |||
305 | /* 1000 Series WiFi */ | ||
306 | {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, | ||
307 | {IWL_PCI_DEVICE(0x0083, 0x1305, iwl1000_bgn_cfg)}, | ||
308 | {IWL_PCI_DEVICE(0x0083, 0x1225, iwl1000_bgn_cfg)}, | ||
309 | {IWL_PCI_DEVICE(0x0083, 0x1325, iwl1000_bgn_cfg)}, | ||
310 | {IWL_PCI_DEVICE(0x0084, 0x1215, iwl1000_bgn_cfg)}, | ||
311 | {IWL_PCI_DEVICE(0x0084, 0x1315, iwl1000_bgn_cfg)}, | ||
312 | {IWL_PCI_DEVICE(0x0083, 0x1206, iwl1000_bg_cfg)}, | ||
313 | {IWL_PCI_DEVICE(0x0083, 0x1306, iwl1000_bg_cfg)}, | ||
314 | {IWL_PCI_DEVICE(0x0083, 0x1226, iwl1000_bg_cfg)}, | ||
315 | {IWL_PCI_DEVICE(0x0083, 0x1326, iwl1000_bg_cfg)}, | ||
316 | {IWL_PCI_DEVICE(0x0084, 0x1216, iwl1000_bg_cfg)}, | ||
317 | {IWL_PCI_DEVICE(0x0084, 0x1316, iwl1000_bg_cfg)}, | ||
318 | |||
319 | /* 100 Series WiFi */ | ||
320 | {IWL_PCI_DEVICE(0x08AE, 0x1005, iwl100_bgn_cfg)}, | ||
321 | {IWL_PCI_DEVICE(0x08AE, 0x1007, iwl100_bg_cfg)}, | ||
322 | {IWL_PCI_DEVICE(0x08AF, 0x1015, iwl100_bgn_cfg)}, | ||
323 | {IWL_PCI_DEVICE(0x08AF, 0x1017, iwl100_bg_cfg)}, | ||
324 | {IWL_PCI_DEVICE(0x08AE, 0x1025, iwl100_bgn_cfg)}, | ||
325 | {IWL_PCI_DEVICE(0x08AE, 0x1027, iwl100_bg_cfg)}, | ||
326 | |||
327 | /* 130 Series WiFi */ | ||
328 | {IWL_PCI_DEVICE(0x0896, 0x5005, iwl130_bgn_cfg)}, | ||
329 | {IWL_PCI_DEVICE(0x0896, 0x5007, iwl130_bg_cfg)}, | ||
330 | {IWL_PCI_DEVICE(0x0897, 0x5015, iwl130_bgn_cfg)}, | ||
331 | {IWL_PCI_DEVICE(0x0897, 0x5017, iwl130_bg_cfg)}, | ||
332 | {IWL_PCI_DEVICE(0x0896, 0x5025, iwl130_bgn_cfg)}, | ||
333 | {IWL_PCI_DEVICE(0x0896, 0x5027, iwl130_bg_cfg)}, | ||
334 | |||
335 | /* 2x00 Series */ | ||
336 | {IWL_PCI_DEVICE(0x0890, 0x4022, iwl2000_2bgn_cfg)}, | ||
337 | {IWL_PCI_DEVICE(0x0891, 0x4222, iwl2000_2bgn_cfg)}, | ||
338 | {IWL_PCI_DEVICE(0x0890, 0x4422, iwl2000_2bgn_cfg)}, | ||
339 | {IWL_PCI_DEVICE(0x0890, 0x4026, iwl2000_2bg_cfg)}, | ||
340 | {IWL_PCI_DEVICE(0x0891, 0x4226, iwl2000_2bg_cfg)}, | ||
341 | {IWL_PCI_DEVICE(0x0890, 0x4426, iwl2000_2bg_cfg)}, | ||
342 | |||
343 | /* 2x30 Series */ | ||
344 | {IWL_PCI_DEVICE(0x0887, 0x4062, iwl2030_2bgn_cfg)}, | ||
345 | {IWL_PCI_DEVICE(0x0888, 0x4262, iwl2030_2bgn_cfg)}, | ||
346 | {IWL_PCI_DEVICE(0x0887, 0x4462, iwl2030_2bgn_cfg)}, | ||
347 | {IWL_PCI_DEVICE(0x0887, 0x4066, iwl2030_2bg_cfg)}, | ||
348 | {IWL_PCI_DEVICE(0x0888, 0x4266, iwl2030_2bg_cfg)}, | ||
349 | {IWL_PCI_DEVICE(0x0887, 0x4466, iwl2030_2bg_cfg)}, | ||
350 | |||
351 | /* 6x35 Series */ | ||
352 | {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)}, | ||
353 | {IWL_PCI_DEVICE(0x088F, 0x4260, iwl6035_2agn_cfg)}, | ||
354 | {IWL_PCI_DEVICE(0x088E, 0x4460, iwl6035_2agn_cfg)}, | ||
355 | {IWL_PCI_DEVICE(0x088E, 0x4064, iwl6035_2abg_cfg)}, | ||
356 | {IWL_PCI_DEVICE(0x088F, 0x4264, iwl6035_2abg_cfg)}, | ||
357 | {IWL_PCI_DEVICE(0x088E, 0x4464, iwl6035_2abg_cfg)}, | ||
358 | {IWL_PCI_DEVICE(0x088E, 0x4066, iwl6035_2bg_cfg)}, | ||
359 | {IWL_PCI_DEVICE(0x088F, 0x4266, iwl6035_2bg_cfg)}, | ||
360 | {IWL_PCI_DEVICE(0x088E, 0x4466, iwl6035_2bg_cfg)}, | ||
361 | |||
362 | /* 105 Series */ | ||
363 | {IWL_PCI_DEVICE(0x0894, 0x0022, iwl105_bgn_cfg)}, | ||
364 | {IWL_PCI_DEVICE(0x0895, 0x0222, iwl105_bgn_cfg)}, | ||
365 | {IWL_PCI_DEVICE(0x0894, 0x0422, iwl105_bgn_cfg)}, | ||
366 | {IWL_PCI_DEVICE(0x0894, 0x0026, iwl105_bg_cfg)}, | ||
367 | {IWL_PCI_DEVICE(0x0895, 0x0226, iwl105_bg_cfg)}, | ||
368 | {IWL_PCI_DEVICE(0x0894, 0x0426, iwl105_bg_cfg)}, | ||
369 | |||
370 | /* 135 Series */ | ||
371 | {IWL_PCI_DEVICE(0x0892, 0x0062, iwl135_bgn_cfg)}, | ||
372 | {IWL_PCI_DEVICE(0x0893, 0x0262, iwl135_bgn_cfg)}, | ||
373 | {IWL_PCI_DEVICE(0x0892, 0x0462, iwl135_bgn_cfg)}, | ||
374 | {IWL_PCI_DEVICE(0x0892, 0x0066, iwl135_bg_cfg)}, | ||
375 | {IWL_PCI_DEVICE(0x0893, 0x0266, iwl135_bg_cfg)}, | ||
376 | {IWL_PCI_DEVICE(0x0892, 0x0466, iwl135_bg_cfg)}, | ||
377 | |||
378 | {0} | ||
379 | }; | ||
380 | MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); | ||
381 | |||
382 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
383 | { | ||
384 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | ||
385 | struct iwl_pci_bus *bus; | ||
386 | u8 rev_id; | ||
387 | u16 pci_cmd; | ||
388 | int err; | ||
389 | |||
390 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); | ||
391 | if (!bus) { | ||
392 | pr_err("Couldn't allocate iwl_pci_bus"); | ||
393 | err = -ENOMEM; | ||
394 | goto out_no_pci; | ||
395 | } | ||
396 | |||
397 | bus->pci_dev = pdev; | ||
398 | |||
399 | /* W/A - seems to solve weird behavior. We need to remove this if we | ||
400 | * don't want to stay in L1 all the time. This wastes a lot of power */ | ||
401 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | | ||
402 | PCIE_LINK_STATE_CLKPM); | ||
403 | |||
404 | if (pci_enable_device(pdev)) { | ||
405 | err = -ENODEV; | ||
406 | goto out_no_pci; | ||
407 | } | ||
408 | |||
409 | pci_set_master(pdev); | ||
410 | |||
411 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36)); | ||
412 | if (!err) | ||
413 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36)); | ||
414 | if (err) { | ||
415 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | ||
416 | if (!err) | ||
417 | err = pci_set_consistent_dma_mask(pdev, | ||
418 | DMA_BIT_MASK(32)); | ||
419 | /* both attempts failed: */ | ||
420 | if (err) { | ||
421 | pr_err("No suitable DMA available.\n"); | ||
422 | goto out_pci_disable_device; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | err = pci_request_regions(pdev, DRV_NAME); | ||
427 | if (err) { | ||
428 | pr_err("pci_request_regions failed"); | ||
429 | goto out_pci_disable_device; | ||
430 | } | ||
431 | |||
432 | bus->hw_base = pci_iomap(pdev, 0, 0); | ||
433 | if (!bus->hw_base) { | ||
434 | pr_err("pci_iomap failed"); | ||
435 | err = -ENODEV; | ||
436 | goto out_pci_release_regions; | ||
437 | } | ||
438 | |||
439 | pr_info("pci_resource_len = 0x%08llx\n", | ||
440 | (unsigned long long) pci_resource_len(pdev, 0)); | ||
441 | pr_info("pci_resource_base = %p\n", bus->hw_base); | ||
442 | |||
443 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); | ||
444 | pr_info("HW Revision ID = 0x%X\n", rev_id); | ||
445 | |||
446 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | ||
447 | * PCI Tx retries from interfering with C3 CPU state */ | ||
448 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | ||
449 | |||
450 | err = pci_enable_msi(pdev); | ||
451 | if (err) { | ||
452 | pr_err("pci_enable_msi failed"); | ||
453 | goto out_iounmap; | ||
454 | } | ||
455 | |||
456 | /* TODO: Move this away, not needed if not MSI */ | ||
457 | /* enable rfkill interrupt: hw bug w/a */ | ||
458 | pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); | ||
459 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { | ||
460 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; | ||
461 | pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); | ||
462 | } | ||
463 | |||
464 | err = iwl_probe((void *) bus, &pci_ops, cfg); | ||
465 | if (err) | ||
466 | goto out_disable_msi; | ||
467 | return 0; | ||
468 | |||
469 | out_disable_msi: | ||
470 | pci_disable_msi(pdev); | ||
471 | out_iounmap: | ||
472 | pci_iounmap(pdev, bus->hw_base); | ||
473 | out_pci_release_regions: | ||
474 | pci_set_drvdata(pdev, NULL); | ||
475 | pci_release_regions(pdev); | ||
476 | out_pci_disable_device: | ||
477 | pci_disable_device(pdev); | ||
478 | out_no_pci: | ||
479 | kfree(bus); | ||
480 | return err; | ||
481 | } | ||
482 | |||
483 | static void iwl_pci_down(void *bus) | ||
484 | { | ||
485 | struct iwl_pci_bus *pci_bus = (struct iwl_pci_bus *) bus; | ||
486 | |||
487 | pci_disable_msi(pci_bus->pci_dev); | ||
488 | pci_iounmap(pci_bus->pci_dev, pci_bus->hw_base); | ||
489 | pci_release_regions(pci_bus->pci_dev); | ||
490 | pci_disable_device(pci_bus->pci_dev); | ||
491 | pci_set_drvdata(pci_bus->pci_dev, NULL); | ||
492 | |||
493 | kfree(pci_bus); | ||
494 | } | ||
495 | |||
496 | static void __devexit iwl_pci_remove(struct pci_dev *pdev) | ||
497 | { | ||
498 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
499 | |||
500 | /* This can happen if probe failed */ | ||
501 | if (unlikely(!priv)) | ||
502 | return; | ||
503 | |||
504 | iwl_remove(priv); | ||
505 | |||
506 | iwl_pci_down(IWL_BUS_GET_PCI_BUS(&priv->bus)); | ||
507 | } | ||
508 | |||
509 | #ifdef CONFIG_PM | ||
510 | |||
511 | static int iwl_pci_suspend(struct device *device) | ||
512 | { | ||
513 | struct pci_dev *pdev = to_pci_dev(device); | ||
514 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
515 | |||
516 | return iwl_suspend(priv); | ||
517 | } | ||
518 | |||
519 | static int iwl_pci_resume(struct device *device) | ||
520 | { | ||
521 | struct pci_dev *pdev = to_pci_dev(device); | ||
522 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
523 | |||
524 | /* | ||
525 | * We disable the RETRY_TIMEOUT register (0x41) to keep | ||
526 | * PCI Tx retries from interfering with C3 CPU state. | ||
527 | */ | ||
528 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | ||
529 | |||
530 | return iwl_resume(priv); | ||
531 | } | ||
532 | |||
533 | static const struct dev_pm_ops iwl_dev_pm_ops = { | ||
534 | .suspend = iwl_pci_suspend, | ||
535 | .resume = iwl_pci_resume, | ||
536 | .freeze = iwl_pci_suspend, | ||
537 | .thaw = iwl_pci_resume, | ||
538 | .poweroff = iwl_pci_suspend, | ||
539 | .restore = iwl_pci_resume, | ||
540 | }; | ||
541 | |||
542 | #define IWL_PM_OPS (&iwl_dev_pm_ops) | ||
543 | |||
544 | #else | ||
545 | |||
546 | #define IWL_PM_OPS NULL | ||
547 | |||
548 | #endif | ||
549 | |||
550 | static struct pci_driver iwl_pci_driver = { | ||
551 | .name = DRV_NAME, | ||
552 | .id_table = iwl_hw_card_ids, | ||
553 | .probe = iwl_pci_probe, | ||
554 | .remove = __devexit_p(iwl_pci_remove), | ||
555 | .driver.pm = IWL_PM_OPS, | ||
556 | }; | ||
557 | |||
558 | int __must_check iwl_pci_register_driver(void) | ||
559 | { | ||
560 | int ret; | ||
561 | ret = pci_register_driver(&iwl_pci_driver); | ||
562 | if (ret) | ||
563 | pr_err("Unable to initialize PCI module\n"); | ||
564 | |||
565 | return ret; | ||
566 | } | ||
567 | |||
568 | void iwl_pci_unregister_driver(void) | ||
569 | { | ||
570 | pci_unregister_driver(&iwl_pci_driver); | ||
571 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.h b/drivers/net/wireless/iwlwifi/iwl-pci.h new file mode 100644 index 000000000000..9396c7c8d6a4 --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-pci.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
4 | * redistributing this file, you may do so under either license. | ||
5 | * | ||
6 | * GPL LICENSE SUMMARY | ||
7 | * | ||
8 | * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of version 2 of the GNU General Public License as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
22 | * USA | ||
23 | * | ||
24 | * The full GNU General Public License is included in this distribution | ||
25 | * in the file called LICENSE.GPL. | ||
26 | * | ||
27 | * Contact Information: | ||
28 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
30 | * | ||
31 | * BSD LICENSE | ||
32 | * | ||
33 | * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. | ||
34 | * All rights reserved. | ||
35 | * | ||
36 | * Redistribution and use in source and binary forms, with or without | ||
37 | * modification, are permitted provided that the following conditions | ||
38 | * are met: | ||
39 | * | ||
40 | * * Redistributions of source code must retain the above copyright | ||
41 | * notice, this list of conditions and the following disclaimer. | ||
42 | * * Redistributions in binary form must reproduce the above copyright | ||
43 | * notice, this list of conditions and the following disclaimer in | ||
44 | * the documentation and/or other materials provided with the | ||
45 | * distribution. | ||
46 | * * Neither the name Intel Corporation nor the names of its | ||
47 | * contributors may be used to endorse or promote products derived | ||
48 | * from this software without specific prior written permission. | ||
49 | * | ||
50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
61 | * | ||
62 | *****************************************************************************/ | ||
63 | #ifndef __iwl_pci_h__ | ||
64 | #define __iwl_pci_h__ | ||
65 | |||
66 | int __must_check iwl_pci_register_driver(void); | ||
67 | void iwl_pci_unregister_driver(void); | ||
68 | |||
69 | #endif | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 595c930b28ae..565e57e48be8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include "iwl-eeprom.h" | 37 | #include "iwl-eeprom.h" |
38 | #include "iwl-dev.h" | 38 | #include "iwl-dev.h" |
39 | #include "iwl-agn.h" | ||
39 | #include "iwl-core.h" | 40 | #include "iwl-core.h" |
40 | #include "iwl-io.h" | 41 | #include "iwl-io.h" |
41 | #include "iwl-commands.h" | 42 | #include "iwl-commands.h" |
@@ -51,16 +52,6 @@ | |||
51 | */ | 52 | */ |
52 | 53 | ||
53 | /* | 54 | /* |
54 | * For now, keep using power level 1 instead of automatically | ||
55 | * adjusting ... | ||
56 | */ | ||
57 | bool no_sleep_autoadjust = true; | ||
58 | module_param(no_sleep_autoadjust, bool, S_IRUGO); | ||
59 | MODULE_PARM_DESC(no_sleep_autoadjust, | ||
60 | "don't automatically adjust sleep level " | ||
61 | "according to maximum network latency"); | ||
62 | |||
63 | /* | ||
64 | * This defines the old power levels. They are still used by default | 55 | * This defines the old power levels. They are still used by default |
65 | * (level 1) and for thermal throttle (levels 3 through 5) | 56 | * (level 1) and for thermal throttle (levels 3 through 5) |
66 | */ | 57 | */ |
@@ -254,7 +245,7 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv, | |||
254 | } | 245 | } |
255 | } | 246 | } |
256 | 247 | ||
257 | if (priv->power_data.pci_pm) | 248 | if (priv->power_data.bus_pm) |
258 | cmd->flags |= IWL_POWER_PCI_PM_MSK; | 249 | cmd->flags |= IWL_POWER_PCI_PM_MSK; |
259 | else | 250 | else |
260 | cmd->flags &= ~IWL_POWER_PCI_PM_MSK; | 251 | cmd->flags &= ~IWL_POWER_PCI_PM_MSK; |
@@ -269,7 +260,7 @@ static void iwl_power_sleep_cam_cmd(struct iwl_priv *priv, | |||
269 | { | 260 | { |
270 | memset(cmd, 0, sizeof(*cmd)); | 261 | memset(cmd, 0, sizeof(*cmd)); |
271 | 262 | ||
272 | if (priv->power_data.pci_pm) | 263 | if (priv->power_data.bus_pm) |
273 | cmd->flags |= IWL_POWER_PCI_PM_MSK; | 264 | cmd->flags |= IWL_POWER_PCI_PM_MSK; |
274 | 265 | ||
275 | IWL_DEBUG_POWER(priv, "Sleep command for CAM\n"); | 266 | IWL_DEBUG_POWER(priv, "Sleep command for CAM\n"); |
@@ -305,7 +296,7 @@ static void iwl_power_fill_sleep_cmd(struct iwl_priv *priv, | |||
305 | cmd->flags = IWL_POWER_DRIVER_ALLOW_SLEEP_MSK | | 296 | cmd->flags = IWL_POWER_DRIVER_ALLOW_SLEEP_MSK | |
306 | IWL_POWER_FAST_PD; /* no use seeing frames for others */ | 297 | IWL_POWER_FAST_PD; /* no use seeing frames for others */ |
307 | 298 | ||
308 | if (priv->power_data.pci_pm) | 299 | if (priv->power_data.bus_pm) |
309 | cmd->flags |= IWL_POWER_PCI_PM_MSK; | 300 | cmd->flags |= IWL_POWER_PCI_PM_MSK; |
310 | 301 | ||
311 | if (priv->cfg->base_params->shadow_reg_enable) | 302 | if (priv->cfg->base_params->shadow_reg_enable) |
@@ -367,9 +358,15 @@ static void iwl_power_build_cmd(struct iwl_priv *priv, | |||
367 | iwl_static_sleep_cmd(priv, cmd, | 358 | iwl_static_sleep_cmd(priv, cmd, |
368 | priv->power_data.debug_sleep_level_override, | 359 | priv->power_data.debug_sleep_level_override, |
369 | dtimper); | 360 | dtimper); |
370 | else if (no_sleep_autoadjust) | 361 | else if (iwlagn_mod_params.no_sleep_autoadjust) { |
371 | iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_1, dtimper); | 362 | if (iwlagn_mod_params.power_level > IWL_POWER_INDEX_1 && |
372 | else | 363 | iwlagn_mod_params.power_level <= IWL_POWER_INDEX_5) |
364 | iwl_static_sleep_cmd(priv, cmd, | ||
365 | iwlagn_mod_params.power_level, dtimper); | ||
366 | else | ||
367 | iwl_static_sleep_cmd(priv, cmd, | ||
368 | IWL_POWER_INDEX_1, dtimper); | ||
369 | } else | ||
373 | iwl_power_fill_sleep_cmd(priv, cmd, | 370 | iwl_power_fill_sleep_cmd(priv, cmd, |
374 | priv->hw->conf.dynamic_ps_timeout, | 371 | priv->hw->conf.dynamic_ps_timeout, |
375 | priv->hw->conf.max_sleep_period); | 372 | priv->hw->conf.max_sleep_period); |
@@ -434,9 +431,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) | |||
434 | /* initialize to default */ | 431 | /* initialize to default */ |
435 | void iwl_power_initialize(struct iwl_priv *priv) | 432 | void iwl_power_initialize(struct iwl_priv *priv) |
436 | { | 433 | { |
437 | u16 lctl = iwl_pcie_link_ctl(priv); | 434 | priv->power_data.bus_pm = priv->bus.ops->get_pm_support(&priv->bus); |
438 | |||
439 | priv->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); | ||
440 | 435 | ||
441 | priv->power_data.debug_sleep_level_override = -1; | 436 | priv->power_data.debug_sleep_level_override = -1; |
442 | 437 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h index 59635d784e27..5f7b720cf1a4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.h +++ b/drivers/net/wireless/iwlwifi/iwl-power.h | |||
@@ -43,7 +43,7 @@ struct iwl_power_mgr { | |||
43 | struct iwl_powertable_cmd sleep_cmd; | 43 | struct iwl_powertable_cmd sleep_cmd; |
44 | struct iwl_powertable_cmd sleep_cmd_next; | 44 | struct iwl_powertable_cmd sleep_cmd_next; |
45 | int debug_sleep_level_override; | 45 | int debug_sleep_level_override; |
46 | bool pci_pm; | 46 | bool bus_pm; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, | 49 | int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index b774517aa9fa..3efa7066e987 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -182,7 +182,7 @@ void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q | |||
182 | int iwl_rx_queue_alloc(struct iwl_priv *priv) | 182 | int iwl_rx_queue_alloc(struct iwl_priv *priv) |
183 | { | 183 | { |
184 | struct iwl_rx_queue *rxq = &priv->rxq; | 184 | struct iwl_rx_queue *rxq = &priv->rxq; |
185 | struct device *dev = &priv->pci_dev->dev; | 185 | struct device *dev = priv->bus.dev; |
186 | int i; | 186 | int i; |
187 | 187 | ||
188 | spin_lock_init(&rxq->lock); | 188 | spin_lock_init(&rxq->lock); |
@@ -213,7 +213,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) | |||
213 | return 0; | 213 | return 0; |
214 | 214 | ||
215 | err_rb: | 215 | err_rb: |
216 | dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, | 216 | dma_free_coherent(dev, 4 * RX_QUEUE_SIZE, rxq->bd, |
217 | rxq->bd_dma); | 217 | rxq->bd_dma); |
218 | err_bd: | 218 | err_bd: |
219 | return -ENOMEM; | 219 | return -ENOMEM; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sv-open.c b/drivers/net/wireless/iwlwifi/iwl-sv-open.c index 69b7e6bf2d6f..c00aa5a1b8b8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sv-open.c +++ b/drivers/net/wireless/iwlwifi/iwl-sv-open.c | |||
@@ -69,7 +69,6 @@ | |||
69 | #include <net/mac80211.h> | 69 | #include <net/mac80211.h> |
70 | #include <net/netlink.h> | 70 | #include <net/netlink.h> |
71 | 71 | ||
72 | |||
73 | #include "iwl-dev.h" | 72 | #include "iwl-dev.h" |
74 | #include "iwl-core.h" | 73 | #include "iwl-core.h" |
75 | #include "iwl-debug.h" | 74 | #include "iwl-debug.h" |
@@ -101,9 +100,11 @@ struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = { | |||
101 | [IWL_TM_ATTR_EEPROM] = { .type = NLA_UNSPEC, }, | 100 | [IWL_TM_ATTR_EEPROM] = { .type = NLA_UNSPEC, }, |
102 | 101 | ||
103 | [IWL_TM_ATTR_TRACE_ADDR] = { .type = NLA_UNSPEC, }, | 102 | [IWL_TM_ATTR_TRACE_ADDR] = { .type = NLA_UNSPEC, }, |
104 | [IWL_TM_ATTR_TRACE_DATA] = { .type = NLA_UNSPEC, }, | 103 | [IWL_TM_ATTR_TRACE_DUMP] = { .type = NLA_UNSPEC, }, |
104 | [IWL_TM_ATTR_TRACE_SIZE] = { .type = NLA_U32, }, | ||
105 | 105 | ||
106 | [IWL_TM_ATTR_FIXRATE] = { .type = NLA_U32, }, | 106 | [IWL_TM_ATTR_FIXRATE] = { .type = NLA_U32, }, |
107 | |||
107 | }; | 108 | }; |
108 | 109 | ||
109 | /* | 110 | /* |
@@ -179,19 +180,21 @@ void iwl_testmode_init(struct iwl_priv *priv) | |||
179 | 180 | ||
180 | static void iwl_trace_cleanup(struct iwl_priv *priv) | 181 | static void iwl_trace_cleanup(struct iwl_priv *priv) |
181 | { | 182 | { |
182 | struct device *dev = &priv->pci_dev->dev; | 183 | struct device *dev = priv->bus.dev; |
183 | 184 | ||
184 | if (priv->testmode_trace.trace_enabled) { | 185 | if (priv->testmode_trace.trace_enabled) { |
185 | if (priv->testmode_trace.cpu_addr && | 186 | if (priv->testmode_trace.cpu_addr && |
186 | priv->testmode_trace.dma_addr) | 187 | priv->testmode_trace.dma_addr) |
187 | dma_free_coherent(dev, | 188 | dma_free_coherent(dev, |
188 | TRACE_TOTAL_SIZE, | 189 | priv->testmode_trace.total_size, |
189 | priv->testmode_trace.cpu_addr, | 190 | priv->testmode_trace.cpu_addr, |
190 | priv->testmode_trace.dma_addr); | 191 | priv->testmode_trace.dma_addr); |
191 | priv->testmode_trace.trace_enabled = false; | 192 | priv->testmode_trace.trace_enabled = false; |
192 | priv->testmode_trace.cpu_addr = NULL; | 193 | priv->testmode_trace.cpu_addr = NULL; |
193 | priv->testmode_trace.trace_addr = NULL; | 194 | priv->testmode_trace.trace_addr = NULL; |
194 | priv->testmode_trace.dma_addr = 0; | 195 | priv->testmode_trace.dma_addr = 0; |
196 | priv->testmode_trace.buff_size = 0; | ||
197 | priv->testmode_trace.total_size = 0; | ||
195 | } | 198 | } |
196 | } | 199 | } |
197 | 200 | ||
@@ -394,7 +397,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
394 | 397 | ||
395 | case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: | 398 | case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: |
396 | status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, | 399 | status = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, |
397 | UCODE_SUBTYPE_INIT, -1); | 400 | IWL_UCODE_INIT); |
398 | if (status) | 401 | if (status) |
399 | IWL_DEBUG_INFO(priv, | 402 | IWL_DEBUG_INFO(priv, |
400 | "Error loading init ucode: %d\n", status); | 403 | "Error loading init ucode: %d\n", status); |
@@ -408,8 +411,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
408 | case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: | 411 | case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: |
409 | status = iwlagn_load_ucode_wait_alive(priv, | 412 | status = iwlagn_load_ucode_wait_alive(priv, |
410 | &priv->ucode_rt, | 413 | &priv->ucode_rt, |
411 | UCODE_SUBTYPE_REGULAR, | 414 | IWL_UCODE_REGULAR); |
412 | UCODE_SUBTYPE_REGULAR_NEW); | ||
413 | if (status) { | 415 | if (status) { |
414 | IWL_DEBUG_INFO(priv, | 416 | IWL_DEBUG_INFO(priv, |
415 | "Error loading runtime ucode: %d\n", status); | 417 | "Error loading runtime ucode: %d\n", status); |
@@ -482,16 +484,29 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb) | |||
482 | struct iwl_priv *priv = hw->priv; | 484 | struct iwl_priv *priv = hw->priv; |
483 | struct sk_buff *skb; | 485 | struct sk_buff *skb; |
484 | int status = 0; | 486 | int status = 0; |
485 | struct device *dev = &priv->pci_dev->dev; | 487 | struct device *dev = priv->bus.dev; |
486 | 488 | ||
487 | switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { | 489 | switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { |
488 | case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: | 490 | case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: |
489 | if (priv->testmode_trace.trace_enabled) | 491 | if (priv->testmode_trace.trace_enabled) |
490 | return -EBUSY; | 492 | return -EBUSY; |
491 | 493 | ||
494 | if (!tb[IWL_TM_ATTR_TRACE_SIZE]) | ||
495 | priv->testmode_trace.buff_size = TRACE_BUFF_SIZE_DEF; | ||
496 | else | ||
497 | priv->testmode_trace.buff_size = | ||
498 | nla_get_u32(tb[IWL_TM_ATTR_TRACE_SIZE]); | ||
499 | if (!priv->testmode_trace.buff_size) | ||
500 | return -EINVAL; | ||
501 | if (priv->testmode_trace.buff_size < TRACE_BUFF_SIZE_MIN || | ||
502 | priv->testmode_trace.buff_size > TRACE_BUFF_SIZE_MAX) | ||
503 | return -EINVAL; | ||
504 | |||
505 | priv->testmode_trace.total_size = | ||
506 | priv->testmode_trace.buff_size + TRACE_BUFF_PADD; | ||
492 | priv->testmode_trace.cpu_addr = | 507 | priv->testmode_trace.cpu_addr = |
493 | dma_alloc_coherent(dev, | 508 | dma_alloc_coherent(dev, |
494 | TRACE_TOTAL_SIZE, | 509 | priv->testmode_trace.total_size, |
495 | &priv->testmode_trace.dma_addr, | 510 | &priv->testmode_trace.dma_addr, |
496 | GFP_KERNEL); | 511 | GFP_KERNEL); |
497 | if (!priv->testmode_trace.cpu_addr) | 512 | if (!priv->testmode_trace.cpu_addr) |
@@ -500,7 +515,7 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb) | |||
500 | priv->testmode_trace.trace_addr = (u8 *)PTR_ALIGN( | 515 | priv->testmode_trace.trace_addr = (u8 *)PTR_ALIGN( |
501 | priv->testmode_trace.cpu_addr, 0x100); | 516 | priv->testmode_trace.cpu_addr, 0x100); |
502 | memset(priv->testmode_trace.trace_addr, 0x03B, | 517 | memset(priv->testmode_trace.trace_addr, 0x03B, |
503 | TRACE_BUFF_SIZE); | 518 | priv->testmode_trace.buff_size); |
504 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, | 519 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, |
505 | sizeof(priv->testmode_trace.dma_addr) + 20); | 520 | sizeof(priv->testmode_trace.dma_addr) + 20); |
506 | if (!skb) { | 521 | if (!skb) { |
@@ -518,34 +533,14 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb) | |||
518 | "Error sending msg : %d\n", | 533 | "Error sending msg : %d\n", |
519 | status); | 534 | status); |
520 | } | 535 | } |
536 | priv->testmode_trace.num_chunks = | ||
537 | DIV_ROUND_UP(priv->testmode_trace.buff_size, | ||
538 | TRACE_CHUNK_SIZE); | ||
521 | break; | 539 | break; |
522 | 540 | ||
523 | case IWL_TM_CMD_APP2DEV_END_TRACE: | 541 | case IWL_TM_CMD_APP2DEV_END_TRACE: |
524 | iwl_trace_cleanup(priv); | 542 | iwl_trace_cleanup(priv); |
525 | break; | 543 | break; |
526 | |||
527 | case IWL_TM_CMD_APP2DEV_READ_TRACE: | ||
528 | if (priv->testmode_trace.trace_enabled && | ||
529 | priv->testmode_trace.trace_addr) { | ||
530 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, | ||
531 | 20 + TRACE_BUFF_SIZE); | ||
532 | if (skb == NULL) { | ||
533 | IWL_DEBUG_INFO(priv, | ||
534 | "Error allocating memory\n"); | ||
535 | return -ENOMEM; | ||
536 | } | ||
537 | NLA_PUT(skb, IWL_TM_ATTR_TRACE_DATA, | ||
538 | TRACE_BUFF_SIZE, | ||
539 | priv->testmode_trace.trace_addr); | ||
540 | status = cfg80211_testmode_reply(skb); | ||
541 | if (status < 0) { | ||
542 | IWL_DEBUG_INFO(priv, | ||
543 | "Error sending msg : %d\n", status); | ||
544 | } | ||
545 | } else | ||
546 | return -EFAULT; | ||
547 | break; | ||
548 | |||
549 | default: | 544 | default: |
550 | IWL_DEBUG_INFO(priv, "Unknown testmode mem command ID\n"); | 545 | IWL_DEBUG_INFO(priv, "Unknown testmode mem command ID\n"); |
551 | return -ENOSYS; | 546 | return -ENOSYS; |
@@ -560,6 +555,37 @@ nla_put_failure: | |||
560 | return -EMSGSIZE; | 555 | return -EMSGSIZE; |
561 | } | 556 | } |
562 | 557 | ||
558 | static int iwl_testmode_trace_dump(struct ieee80211_hw *hw, struct nlattr **tb, | ||
559 | struct sk_buff *skb, | ||
560 | struct netlink_callback *cb) | ||
561 | { | ||
562 | struct iwl_priv *priv = hw->priv; | ||
563 | int idx, length; | ||
564 | |||
565 | if (priv->testmode_trace.trace_enabled && | ||
566 | priv->testmode_trace.trace_addr) { | ||
567 | idx = cb->args[4]; | ||
568 | if (idx >= priv->testmode_trace.num_chunks) | ||
569 | return -ENOENT; | ||
570 | length = TRACE_CHUNK_SIZE; | ||
571 | if (((idx + 1) == priv->testmode_trace.num_chunks) && | ||
572 | (priv->testmode_trace.buff_size % TRACE_CHUNK_SIZE)) | ||
573 | length = priv->testmode_trace.buff_size % | ||
574 | TRACE_CHUNK_SIZE; | ||
575 | |||
576 | NLA_PUT(skb, IWL_TM_ATTR_TRACE_DUMP, length, | ||
577 | priv->testmode_trace.trace_addr + | ||
578 | (TRACE_CHUNK_SIZE * idx)); | ||
579 | idx++; | ||
580 | cb->args[4] = idx; | ||
581 | return 0; | ||
582 | } else | ||
583 | return -EFAULT; | ||
584 | |||
585 | nla_put_failure: | ||
586 | return -ENOBUFS; | ||
587 | } | ||
588 | |||
563 | /* The testmode gnl message handler that takes the gnl message from the | 589 | /* The testmode gnl message handler that takes the gnl message from the |
564 | * user space and parses it per the policy iwl_testmode_gnl_msg_policy, then | 590 | * user space and parses it per the policy iwl_testmode_gnl_msg_policy, then |
565 | * invoke the corresponding handlers. | 591 | * invoke the corresponding handlers. |
@@ -638,3 +664,50 @@ int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) | |||
638 | mutex_unlock(&priv->mutex); | 664 | mutex_unlock(&priv->mutex); |
639 | return result; | 665 | return result; |
640 | } | 666 | } |
667 | |||
668 | int iwl_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
669 | struct netlink_callback *cb, | ||
670 | void *data, int len) | ||
671 | { | ||
672 | struct nlattr *tb[IWL_TM_ATTR_MAX]; | ||
673 | struct iwl_priv *priv = hw->priv; | ||
674 | int result; | ||
675 | u32 cmd; | ||
676 | |||
677 | if (cb->args[3]) { | ||
678 | /* offset by 1 since commands start at 0 */ | ||
679 | cmd = cb->args[3] - 1; | ||
680 | } else { | ||
681 | result = nla_parse(tb, IWL_TM_ATTR_MAX - 1, data, len, | ||
682 | iwl_testmode_gnl_msg_policy); | ||
683 | if (result) { | ||
684 | IWL_DEBUG_INFO(priv, | ||
685 | "Error parsing the gnl message : %d\n", result); | ||
686 | return result; | ||
687 | } | ||
688 | |||
689 | /* IWL_TM_ATTR_COMMAND is absolutely mandatory */ | ||
690 | if (!tb[IWL_TM_ATTR_COMMAND]) { | ||
691 | IWL_DEBUG_INFO(priv, | ||
692 | "Error finding testmode command type\n"); | ||
693 | return -ENOMSG; | ||
694 | } | ||
695 | cmd = nla_get_u32(tb[IWL_TM_ATTR_COMMAND]); | ||
696 | cb->args[3] = cmd + 1; | ||
697 | } | ||
698 | |||
699 | /* in case multiple accesses to the device happens */ | ||
700 | mutex_lock(&priv->mutex); | ||
701 | switch (cmd) { | ||
702 | case IWL_TM_CMD_APP2DEV_READ_TRACE: | ||
703 | IWL_DEBUG_INFO(priv, "uCode trace cmd to driver\n"); | ||
704 | result = iwl_testmode_trace_dump(hw, tb, skb, cb); | ||
705 | break; | ||
706 | default: | ||
707 | result = -EINVAL; | ||
708 | break; | ||
709 | } | ||
710 | |||
711 | mutex_unlock(&priv->mutex); | ||
712 | return result; | ||
713 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.h b/drivers/net/wireless/iwlwifi/iwl-testmode.h index a88085e9b361..160911a3716a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-testmode.h +++ b/drivers/net/wireless/iwlwifi/iwl-testmode.h | |||
@@ -166,7 +166,8 @@ enum iwl_tm_attr_t { | |||
166 | * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address | 166 | * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address |
167 | */ | 167 | */ |
168 | IWL_TM_ATTR_TRACE_ADDR, | 168 | IWL_TM_ATTR_TRACE_ADDR, |
169 | IWL_TM_ATTR_TRACE_DATA, | 169 | IWL_TM_ATTR_TRACE_SIZE, |
170 | IWL_TM_ATTR_TRACE_DUMP, | ||
170 | 171 | ||
171 | /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_FIXRATE_REQ, | 172 | /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_FIXRATE_REQ, |
172 | * The mandatory fields are: | 173 | * The mandatory fields are: |
@@ -178,8 +179,10 @@ enum iwl_tm_attr_t { | |||
178 | }; | 179 | }; |
179 | 180 | ||
180 | /* uCode trace buffer */ | 181 | /* uCode trace buffer */ |
181 | #define TRACE_BUFF_SIZE 0x20000 | 182 | #define TRACE_BUFF_SIZE_MAX 0x200000 |
183 | #define TRACE_BUFF_SIZE_MIN 0x20000 | ||
184 | #define TRACE_BUFF_SIZE_DEF TRACE_BUFF_SIZE_MIN | ||
182 | #define TRACE_BUFF_PADD 0x2000 | 185 | #define TRACE_BUFF_PADD 0x2000 |
183 | #define TRACE_TOTAL_SIZE (TRACE_BUFF_SIZE + TRACE_BUFF_PADD) | 186 | #define TRACE_CHUNK_SIZE (PAGE_SIZE - 1024) |
184 | 187 | ||
185 | #endif | 188 | #endif |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 1084fe0e8a86..fd8aee9972c1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -128,7 +128,6 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd) | |||
128 | static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, | 128 | static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, |
129 | struct iwl_tfd *tfd) | 129 | struct iwl_tfd *tfd) |
130 | { | 130 | { |
131 | struct pci_dev *dev = priv->pci_dev; | ||
132 | int i; | 131 | int i; |
133 | int num_tbs; | 132 | int num_tbs; |
134 | 133 | ||
@@ -143,15 +142,15 @@ static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, | |||
143 | 142 | ||
144 | /* Unmap tx_cmd */ | 143 | /* Unmap tx_cmd */ |
145 | if (num_tbs) | 144 | if (num_tbs) |
146 | pci_unmap_single(dev, | 145 | dma_unmap_single(priv->bus.dev, |
147 | dma_unmap_addr(meta, mapping), | 146 | dma_unmap_addr(meta, mapping), |
148 | dma_unmap_len(meta, len), | 147 | dma_unmap_len(meta, len), |
149 | PCI_DMA_BIDIRECTIONAL); | 148 | DMA_BIDIRECTIONAL); |
150 | 149 | ||
151 | /* Unmap chunks, if any. */ | 150 | /* Unmap chunks, if any. */ |
152 | for (i = 1; i < num_tbs; i++) | 151 | for (i = 1; i < num_tbs; i++) |
153 | pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i), | 152 | dma_unmap_single(priv->bus.dev, iwl_tfd_tb_get_addr(tfd, i), |
154 | iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); | 153 | iwl_tfd_tb_get_len(tfd, i), DMA_TO_DEVICE); |
155 | } | 154 | } |
156 | 155 | ||
157 | /** | 156 | /** |
@@ -266,7 +265,7 @@ void iwl_tx_queue_unmap(struct iwl_priv *priv, int txq_id) | |||
266 | void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) | 265 | void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) |
267 | { | 266 | { |
268 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; | 267 | struct iwl_tx_queue *txq = &priv->txq[txq_id]; |
269 | struct device *dev = &priv->pci_dev->dev; | 268 | struct device *dev = priv->bus.dev; |
270 | int i; | 269 | int i; |
271 | 270 | ||
272 | iwl_tx_queue_unmap(priv, txq_id); | 271 | iwl_tx_queue_unmap(priv, txq_id); |
@@ -310,10 +309,10 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv) | |||
310 | i = get_cmd_index(q, q->read_ptr); | 309 | i = get_cmd_index(q, q->read_ptr); |
311 | 310 | ||
312 | if (txq->meta[i].flags & CMD_MAPPED) { | 311 | if (txq->meta[i].flags & CMD_MAPPED) { |
313 | pci_unmap_single(priv->pci_dev, | 312 | dma_unmap_single(priv->bus.dev, |
314 | dma_unmap_addr(&txq->meta[i], mapping), | 313 | dma_unmap_addr(&txq->meta[i], mapping), |
315 | dma_unmap_len(&txq->meta[i], len), | 314 | dma_unmap_len(&txq->meta[i], len), |
316 | PCI_DMA_BIDIRECTIONAL); | 315 | DMA_BIDIRECTIONAL); |
317 | txq->meta[i].flags = 0; | 316 | txq->meta[i].flags = 0; |
318 | } | 317 | } |
319 | 318 | ||
@@ -332,7 +331,7 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv) | |||
332 | void iwl_cmd_queue_free(struct iwl_priv *priv) | 331 | void iwl_cmd_queue_free(struct iwl_priv *priv) |
333 | { | 332 | { |
334 | struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; | 333 | struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; |
335 | struct device *dev = &priv->pci_dev->dev; | 334 | struct device *dev = priv->bus.dev; |
336 | int i; | 335 | int i; |
337 | 336 | ||
338 | iwl_cmd_queue_unmap(priv); | 337 | iwl_cmd_queue_unmap(priv); |
@@ -434,7 +433,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, | |||
434 | static int iwl_tx_queue_alloc(struct iwl_priv *priv, | 433 | static int iwl_tx_queue_alloc(struct iwl_priv *priv, |
435 | struct iwl_tx_queue *txq, u32 id) | 434 | struct iwl_tx_queue *txq, u32 id) |
436 | { | 435 | { |
437 | struct device *dev = &priv->pci_dev->dev; | 436 | struct device *dev = priv->bus.dev; |
438 | size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; | 437 | size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; |
439 | 438 | ||
440 | /* Driver private data, only for Tx (not command) queues, | 439 | /* Driver private data, only for Tx (not command) queues, |
@@ -456,7 +455,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, | |||
456 | txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, | 455 | txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, |
457 | GFP_KERNEL); | 456 | GFP_KERNEL); |
458 | if (!txq->tfds) { | 457 | if (!txq->tfds) { |
459 | IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); | 458 | IWL_ERR(priv, "dma_alloc_coherent(%zd) failed\n", tfd_sz); |
460 | goto error; | 459 | goto error; |
461 | } | 460 | } |
462 | txq->q.id = id; | 461 | txq->q.id = id; |
@@ -677,9 +676,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
677 | le16_to_cpu(out_cmd->hdr.sequence), cmd_size, | 676 | le16_to_cpu(out_cmd->hdr.sequence), cmd_size, |
678 | q->write_ptr, idx, priv->cmd_queue); | 677 | q->write_ptr, idx, priv->cmd_queue); |
679 | 678 | ||
680 | phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr, | 679 | phys_addr = dma_map_single(priv->bus.dev, &out_cmd->hdr, copy_size, |
681 | copy_size, PCI_DMA_BIDIRECTIONAL); | 680 | DMA_BIDIRECTIONAL); |
682 | if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) { | 681 | if (unlikely(dma_mapping_error(priv->bus.dev, phys_addr))) { |
683 | idx = -ENOMEM; | 682 | idx = -ENOMEM; |
684 | goto out; | 683 | goto out; |
685 | } | 684 | } |
@@ -699,9 +698,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
699 | continue; | 698 | continue; |
700 | if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) | 699 | if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) |
701 | continue; | 700 | continue; |
702 | phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i], | 701 | phys_addr = dma_map_single(priv->bus.dev, (void *)cmd->data[i], |
703 | cmd->len[i], PCI_DMA_TODEVICE); | 702 | cmd->len[i], DMA_TO_DEVICE); |
704 | if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) { | 703 | if (dma_mapping_error(priv->bus.dev, phys_addr)) { |
705 | iwlagn_unmap_tfd(priv, out_meta, | 704 | iwlagn_unmap_tfd(priv, out_meta, |
706 | &txq->tfds[q->write_ptr]); | 705 | &txq->tfds[q->write_ptr]); |
707 | idx = -ENOMEM; | 706 | idx = -ENOMEM; |
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 224e9853c480..387786e1b394 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -892,6 +892,37 @@ static int if_sdio_reset_deep_sleep_wakeup(struct lbs_private *priv) | |||
892 | 892 | ||
893 | } | 893 | } |
894 | 894 | ||
895 | static struct mmc_host *reset_host; | ||
896 | |||
897 | static void if_sdio_reset_card_worker(struct work_struct *work) | ||
898 | { | ||
899 | /* | ||
900 | * The actual reset operation must be run outside of lbs_thread. This | ||
901 | * is because mmc_remove_host() will cause the device to be instantly | ||
902 | * destroyed, and the libertas driver then needs to end lbs_thread, | ||
903 | * leading to a deadlock. | ||
904 | * | ||
905 | * We run it in a workqueue totally independent from the if_sdio_card | ||
906 | * instance for that reason. | ||
907 | */ | ||
908 | |||
909 | pr_info("Resetting card..."); | ||
910 | mmc_remove_host(reset_host); | ||
911 | mmc_add_host(reset_host); | ||
912 | } | ||
913 | static DECLARE_WORK(card_reset_work, if_sdio_reset_card_worker); | ||
914 | |||
915 | static void if_sdio_reset_card(struct lbs_private *priv) | ||
916 | { | ||
917 | struct if_sdio_card *card = priv->card; | ||
918 | |||
919 | if (work_pending(&card_reset_work)) | ||
920 | return; | ||
921 | |||
922 | reset_host = card->func->card->host; | ||
923 | schedule_work(&card_reset_work); | ||
924 | } | ||
925 | |||
895 | /*******************************************************************/ | 926 | /*******************************************************************/ |
896 | /* SDIO callbacks */ | 927 | /* SDIO callbacks */ |
897 | /*******************************************************************/ | 928 | /*******************************************************************/ |
@@ -1065,6 +1096,7 @@ static int if_sdio_probe(struct sdio_func *func, | |||
1065 | priv->enter_deep_sleep = if_sdio_enter_deep_sleep; | 1096 | priv->enter_deep_sleep = if_sdio_enter_deep_sleep; |
1066 | priv->exit_deep_sleep = if_sdio_exit_deep_sleep; | 1097 | priv->exit_deep_sleep = if_sdio_exit_deep_sleep; |
1067 | priv->reset_deep_sleep_wakeup = if_sdio_reset_deep_sleep_wakeup; | 1098 | priv->reset_deep_sleep_wakeup = if_sdio_reset_deep_sleep_wakeup; |
1099 | priv->reset_card = if_sdio_reset_card; | ||
1068 | 1100 | ||
1069 | sdio_claim_host(func); | 1101 | sdio_claim_host(func); |
1070 | 1102 | ||
@@ -1301,6 +1333,8 @@ static void __exit if_sdio_exit_module(void) | |||
1301 | /* Set the flag as user is removing this module. */ | 1333 | /* Set the flag as user is removing this module. */ |
1302 | user_rmmod = 1; | 1334 | user_rmmod = 1; |
1303 | 1335 | ||
1336 | cancel_work_sync(&card_reset_work); | ||
1337 | |||
1304 | sdio_unregister_driver(&if_sdio_driver); | 1338 | sdio_unregister_driver(&if_sdio_driver); |
1305 | 1339 | ||
1306 | lbs_deb_leave(LBS_DEB_SDIO); | 1340 | lbs_deb_leave(LBS_DEB_SDIO); |
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c index 463352c890d7..d041bb2b5777 100644 --- a/drivers/net/wireless/libertas/if_spi.c +++ b/drivers/net/wireless/libertas/if_spi.c | |||
@@ -1032,7 +1032,6 @@ static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id) | |||
1032 | static int if_spi_init_card(struct if_spi_card *card) | 1032 | static int if_spi_init_card(struct if_spi_card *card) |
1033 | { | 1033 | { |
1034 | struct lbs_private *priv = card->priv; | 1034 | struct lbs_private *priv = card->priv; |
1035 | struct spi_device *spi = card->spi; | ||
1036 | int err, i; | 1035 | int err, i; |
1037 | u32 scratch; | 1036 | u32 scratch; |
1038 | const struct firmware *helper = NULL; | 1037 | const struct firmware *helper = NULL; |
@@ -1080,8 +1079,9 @@ static int if_spi_init_card(struct if_spi_card *card) | |||
1080 | "attached to SPI bus_num %d, chip_select %d. " | 1079 | "attached to SPI bus_num %d, chip_select %d. " |
1081 | "spi->max_speed_hz=%d\n", | 1080 | "spi->max_speed_hz=%d\n", |
1082 | card->card_id, card->card_rev, | 1081 | card->card_id, card->card_rev, |
1083 | spi->master->bus_num, spi->chip_select, | 1082 | card->spi->master->bus_num, |
1084 | spi->max_speed_hz); | 1083 | card->spi->chip_select, |
1084 | card->spi->max_speed_hz); | ||
1085 | err = if_spi_prog_helper_firmware(card, helper); | 1085 | err = if_spi_prog_helper_firmware(card, helper); |
1086 | if (err) | 1086 | if (err) |
1087 | goto out; | 1087 | goto out; |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 4f43443036f4..054a5c348a24 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -26,9 +26,6 @@ | |||
26 | 26 | ||
27 | const char driver_version[] = "mwifiex " VERSION " (%s) "; | 27 | const char driver_version[] = "mwifiex " VERSION " (%s) "; |
28 | 28 | ||
29 | struct mwifiex_adapter *g_adapter; | ||
30 | EXPORT_SYMBOL_GPL(g_adapter); | ||
31 | |||
32 | static struct mwifiex_bss_attr mwifiex_bss_sta[] = { | 29 | static struct mwifiex_bss_attr mwifiex_bss_sta[] = { |
33 | {MWIFIEX_BSS_TYPE_STA, MWIFIEX_DATA_FRAME_TYPE_ETH_II, true, 0, 0}, | 30 | {MWIFIEX_BSS_TYPE_STA, MWIFIEX_DATA_FRAME_TYPE_ETH_II, true, 0, 0}, |
34 | }; | 31 | }; |
@@ -60,7 +57,8 @@ static struct mwifiex_drv_mode mwifiex_drv_mode_tbl[] = { | |||
60 | * proper cleanup before exiting. | 57 | * proper cleanup before exiting. |
61 | */ | 58 | */ |
62 | static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, | 59 | static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, |
63 | struct mwifiex_drv_mode *drv_mode_ptr) | 60 | struct mwifiex_drv_mode *drv_mode_ptr, |
61 | void **padapter) | ||
64 | { | 62 | { |
65 | struct mwifiex_adapter *adapter; | 63 | struct mwifiex_adapter *adapter; |
66 | int i; | 64 | int i; |
@@ -69,7 +67,7 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, | |||
69 | if (!adapter) | 67 | if (!adapter) |
70 | return -ENOMEM; | 68 | return -ENOMEM; |
71 | 69 | ||
72 | g_adapter = adapter; | 70 | *padapter = adapter; |
73 | adapter->card = card; | 71 | adapter->card = card; |
74 | 72 | ||
75 | /* Save interface specific operations in adapter */ | 73 | /* Save interface specific operations in adapter */ |
@@ -324,7 +322,7 @@ exit_main_proc: | |||
324 | * and initializing the private structures. | 322 | * and initializing the private structures. |
325 | */ | 323 | */ |
326 | static int | 324 | static int |
327 | mwifiex_init_sw(void *card, struct mwifiex_if_ops *if_ops) | 325 | mwifiex_init_sw(void *card, struct mwifiex_if_ops *if_ops, void **padapter) |
328 | { | 326 | { |
329 | int i; | 327 | int i; |
330 | struct mwifiex_drv_mode *drv_mode_ptr; | 328 | struct mwifiex_drv_mode *drv_mode_ptr; |
@@ -343,7 +341,7 @@ mwifiex_init_sw(void *card, struct mwifiex_if_ops *if_ops) | |||
343 | return -1; | 341 | return -1; |
344 | } | 342 | } |
345 | 343 | ||
346 | if (mwifiex_register(card, if_ops, drv_mode_ptr)) | 344 | if (mwifiex_register(card, if_ops, drv_mode_ptr, padapter)) |
347 | return -1; | 345 | return -1; |
348 | 346 | ||
349 | return 0; | 347 | return 0; |
@@ -855,13 +853,11 @@ mwifiex_add_card(void *card, struct semaphore *sem, | |||
855 | if (down_interruptible(sem)) | 853 | if (down_interruptible(sem)) |
856 | goto exit_sem_err; | 854 | goto exit_sem_err; |
857 | 855 | ||
858 | if (mwifiex_init_sw(card, if_ops)) { | 856 | if (mwifiex_init_sw(card, if_ops, (void **)&adapter)) { |
859 | pr_err("%s: software init failed\n", __func__); | 857 | pr_err("%s: software init failed\n", __func__); |
860 | goto err_init_sw; | 858 | goto err_init_sw; |
861 | } | 859 | } |
862 | 860 | ||
863 | adapter = g_adapter; | ||
864 | |||
865 | adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; | 861 | adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; |
866 | adapter->surprise_removed = false; | 862 | adapter->surprise_removed = false; |
867 | init_waitqueue_head(&adapter->init_wait_q); | 863 | init_waitqueue_head(&adapter->init_wait_q); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 57b183af72d7..db201cc1473b 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -39,7 +39,6 @@ | |||
39 | #include "fw.h" | 39 | #include "fw.h" |
40 | 40 | ||
41 | extern const char driver_version[]; | 41 | extern const char driver_version[]; |
42 | extern struct mwifiex_adapter *g_adapter; | ||
43 | 42 | ||
44 | enum { | 43 | enum { |
45 | MWIFIEX_ASYNC_CMD, | 44 | MWIFIEX_ASYNC_CMD, |
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index 4327b6d099c8..711fa689a95c 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c | |||
@@ -31,10 +31,27 @@ | |||
31 | 31 | ||
32 | #define SDIO_VERSION "1.0" | 32 | #define SDIO_VERSION "1.0" |
33 | 33 | ||
34 | /* The mwifiex_sdio_remove() callback function is called when | ||
35 | * user removes this module from kernel space or ejects | ||
36 | * the card from the slot. The driver handles these 2 cases | ||
37 | * differently. | ||
38 | * If the user is removing the module, the few commands (FUNC_SHUTDOWN, | ||
39 | * HS_CANCEL etc.) are sent to the firmware. | ||
40 | * If the card is removed, there is no need to send these command. | ||
41 | * | ||
42 | * The variable 'user_rmmod' is used to distinguish these two | ||
43 | * scenarios. This flag is initialized as FALSE in case the card | ||
44 | * is removed, and will be set to TRUE for module removal when | ||
45 | * module_exit function is called. | ||
46 | */ | ||
47 | static u8 user_rmmod; | ||
48 | |||
34 | static struct mwifiex_if_ops sdio_ops; | 49 | static struct mwifiex_if_ops sdio_ops; |
35 | 50 | ||
36 | static struct semaphore add_remove_card_sem; | 51 | static struct semaphore add_remove_card_sem; |
37 | 52 | ||
53 | static int mwifiex_sdio_resume(struct device *dev); | ||
54 | |||
38 | /* | 55 | /* |
39 | * SDIO probe. | 56 | * SDIO probe. |
40 | * | 57 | * |
@@ -93,17 +110,36 @@ static void | |||
93 | mwifiex_sdio_remove(struct sdio_func *func) | 110 | mwifiex_sdio_remove(struct sdio_func *func) |
94 | { | 111 | { |
95 | struct sdio_mmc_card *card; | 112 | struct sdio_mmc_card *card; |
113 | struct mwifiex_adapter *adapter; | ||
114 | int i; | ||
96 | 115 | ||
97 | pr_debug("info: SDIO func num=%d\n", func->num); | 116 | pr_debug("info: SDIO func num=%d\n", func->num); |
98 | 117 | ||
99 | if (func) { | 118 | card = sdio_get_drvdata(func); |
100 | card = sdio_get_drvdata(func); | 119 | if (!card) |
101 | if (card) { | 120 | return; |
102 | mwifiex_remove_card(card->adapter, | 121 | |
103 | &add_remove_card_sem); | 122 | adapter = card->adapter; |
104 | kfree(card); | 123 | if (!adapter || !adapter->priv_num) |
105 | } | 124 | return; |
125 | |||
126 | if (user_rmmod) { | ||
127 | if (adapter->is_suspended) | ||
128 | mwifiex_sdio_resume(adapter->dev); | ||
129 | |||
130 | for (i = 0; i < adapter->priv_num; i++) | ||
131 | if ((GET_BSS_ROLE(adapter->priv[i]) == | ||
132 | MWIFIEX_BSS_ROLE_STA) && | ||
133 | adapter->priv[i]->media_connected) | ||
134 | mwifiex_deauthenticate(adapter->priv[i], NULL); | ||
135 | |||
136 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, | ||
137 | MWIFIEX_BSS_ROLE_ANY), | ||
138 | MWIFIEX_FUNC_SHUTDOWN); | ||
106 | } | 139 | } |
140 | |||
141 | mwifiex_remove_card(card->adapter, &add_remove_card_sem); | ||
142 | kfree(card); | ||
107 | } | 143 | } |
108 | 144 | ||
109 | /* | 145 | /* |
@@ -1696,6 +1732,9 @@ mwifiex_sdio_init_module(void) | |||
1696 | { | 1732 | { |
1697 | sema_init(&add_remove_card_sem, 1); | 1733 | sema_init(&add_remove_card_sem, 1); |
1698 | 1734 | ||
1735 | /* Clear the flag in case user removes the card. */ | ||
1736 | user_rmmod = 0; | ||
1737 | |||
1699 | return sdio_register_driver(&mwifiex_sdio); | 1738 | return sdio_register_driver(&mwifiex_sdio); |
1700 | } | 1739 | } |
1701 | 1740 | ||
@@ -1711,32 +1750,12 @@ mwifiex_sdio_init_module(void) | |||
1711 | static void | 1750 | static void |
1712 | mwifiex_sdio_cleanup_module(void) | 1751 | mwifiex_sdio_cleanup_module(void) |
1713 | { | 1752 | { |
1714 | struct mwifiex_adapter *adapter = g_adapter; | 1753 | if (!down_interruptible(&add_remove_card_sem)) |
1715 | int i; | 1754 | up(&add_remove_card_sem); |
1716 | |||
1717 | if (down_interruptible(&add_remove_card_sem)) | ||
1718 | goto exit_sem_err; | ||
1719 | |||
1720 | if (!adapter || !adapter->priv_num) | ||
1721 | goto exit; | ||
1722 | |||
1723 | if (adapter->is_suspended) | ||
1724 | mwifiex_sdio_resume(adapter->dev); | ||
1725 | |||
1726 | for (i = 0; i < adapter->priv_num; i++) | ||
1727 | if ((GET_BSS_ROLE(adapter->priv[i]) == MWIFIEX_BSS_ROLE_STA) && | ||
1728 | adapter->priv[i]->media_connected) | ||
1729 | mwifiex_deauthenticate(adapter->priv[i], NULL); | ||
1730 | |||
1731 | if (!adapter->surprise_removed) | ||
1732 | mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, | ||
1733 | MWIFIEX_BSS_ROLE_ANY), | ||
1734 | MWIFIEX_FUNC_SHUTDOWN); | ||
1735 | 1755 | ||
1736 | exit: | 1756 | /* Set the flag as user is removing this module. */ |
1737 | up(&add_remove_card_sem); | 1757 | user_rmmod = 1; |
1738 | 1758 | ||
1739 | exit_sem_err: | ||
1740 | sdio_unregister_driver(&mwifiex_sdio); | 1759 | sdio_unregister_driver(&mwifiex_sdio); |
1741 | } | 1760 | } |
1742 | 1761 | ||
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index fb5e43bd7c3c..bc13533a5418 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -523,7 +523,7 @@ static void _rtl_query_shortgi(struct ieee80211_hw *hw, | |||
523 | mac->opmode == NL80211_IFTYPE_ADHOC) | 523 | mac->opmode == NL80211_IFTYPE_ADHOC) |
524 | bw_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40; | 524 | bw_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
525 | 525 | ||
526 | if ((bw_40 == true) && sgi_40) | 526 | if (bw_40 && sgi_40) |
527 | tcb_desc->use_shortgi = true; | 527 | tcb_desc->use_shortgi = true; |
528 | else if ((bw_40 == false) && sgi_20) | 528 | else if ((bw_40 == false) && sgi_20) |
529 | tcb_desc->use_shortgi = true; | 529 | tcb_desc->use_shortgi = true; |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index d2ec2535aa3c..03ce69660b26 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
@@ -335,8 +335,8 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed) | |||
335 | * before going offchannel, or dis-association or delete BA will | 335 | * before going offchannel, or dis-association or delete BA will |
336 | * happen by AP | 336 | * happen by AP |
337 | */ | 337 | */ |
338 | if (rtlpriv->mac80211.offchan_deley) { | 338 | if (rtlpriv->mac80211.offchan_delay) { |
339 | rtlpriv->mac80211.offchan_deley = false; | 339 | rtlpriv->mac80211.offchan_delay = false; |
340 | mdelay(50); | 340 | mdelay(50); |
341 | } | 341 | } |
342 | rtlphy->current_channel = wide_chan; | 342 | rtlphy->current_channel = wide_chan; |
@@ -443,11 +443,11 @@ static int rtl_op_sta_add(struct ieee80211_hw *hw, | |||
443 | sta_entry->wireless_mode = WIRELESS_MODE_G; | 443 | sta_entry->wireless_mode = WIRELESS_MODE_G; |
444 | if (sta->supp_rates[0] <= 0xf) | 444 | if (sta->supp_rates[0] <= 0xf) |
445 | sta_entry->wireless_mode = WIRELESS_MODE_B; | 445 | sta_entry->wireless_mode = WIRELESS_MODE_B; |
446 | if (sta->ht_cap.ht_supported == true) | 446 | if (sta->ht_cap.ht_supported) |
447 | sta_entry->wireless_mode = WIRELESS_MODE_N_24G; | 447 | sta_entry->wireless_mode = WIRELESS_MODE_N_24G; |
448 | } else if (rtlhal->current_bandtype == BAND_ON_5G) { | 448 | } else if (rtlhal->current_bandtype == BAND_ON_5G) { |
449 | sta_entry->wireless_mode = WIRELESS_MODE_A; | 449 | sta_entry->wireless_mode = WIRELESS_MODE_A; |
450 | if (sta->ht_cap.ht_supported == true) | 450 | if (sta->ht_cap.ht_supported) |
451 | sta_entry->wireless_mode = WIRELESS_MODE_N_24G; | 451 | sta_entry->wireless_mode = WIRELESS_MODE_N_24G; |
452 | } | 452 | } |
453 | 453 | ||
@@ -650,7 +650,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw, | |||
650 | RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, | 650 | RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, |
651 | ("BSS_CHANGED_HT\n")); | 651 | ("BSS_CHANGED_HT\n")); |
652 | rcu_read_lock(); | 652 | rcu_read_lock(); |
653 | sta = get_sta(hw, vif, (u8 *)bss_conf->bssid); | 653 | sta = get_sta(hw, vif, bss_conf->bssid); |
654 | if (sta) { | 654 | if (sta) { |
655 | if (sta->ht_cap.ampdu_density > | 655 | if (sta->ht_cap.ampdu_density > |
656 | mac->current_ampdu_density) | 656 | mac->current_ampdu_density) |
@@ -685,7 +685,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw, | |||
685 | rtlpriv->cfg->ops->set_network_type(hw, vif->type); | 685 | rtlpriv->cfg->ops->set_network_type(hw, vif->type); |
686 | 686 | ||
687 | rcu_read_lock(); | 687 | rcu_read_lock(); |
688 | sta = get_sta(hw, vif, (u8 *)bss_conf->bssid); | 688 | sta = get_sta(hw, vif, bss_conf->bssid); |
689 | if (!sta) { | 689 | if (!sta) { |
690 | rcu_read_unlock(); | 690 | rcu_read_unlock(); |
691 | goto out; | 691 | goto out; |
diff --git a/drivers/net/wireless/rtlwifi/core.h b/drivers/net/wireless/rtlwifi/core.h index 4b247db2861d..f02824a3b747 100644 --- a/drivers/net/wireless/rtlwifi/core.h +++ b/drivers/net/wireless/rtlwifi/core.h | |||
@@ -30,6 +30,8 @@ | |||
30 | #ifndef __RTL_CORE_H__ | 30 | #ifndef __RTL_CORE_H__ |
31 | #define __RTL_CORE_H__ | 31 | #define __RTL_CORE_H__ |
32 | 32 | ||
33 | #include <net/mac80211.h> | ||
34 | |||
33 | #define RTL_SUPPORTED_FILTERS \ | 35 | #define RTL_SUPPORTED_FILTERS \ |
34 | (FIF_PROMISC_IN_BSS | \ | 36 | (FIF_PROMISC_IN_BSS | \ |
35 | FIF_ALLMULTI | FIF_CONTROL | \ | 37 | FIF_ALLMULTI | FIF_CONTROL | \ |
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c index 0b562322f138..3fc21f60bb04 100644 --- a/drivers/net/wireless/rtlwifi/efuse.c +++ b/drivers/net/wireless/rtlwifi/efuse.c | |||
@@ -382,7 +382,7 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw) | |||
382 | } | 382 | } |
383 | } | 383 | } |
384 | 384 | ||
385 | if (wordchanged == true) | 385 | if (wordchanged) |
386 | hdr_num++; | 386 | hdr_num++; |
387 | } | 387 | } |
388 | 388 | ||
@@ -453,7 +453,7 @@ bool efuse_shadow_update(struct ieee80211_hw *hw) | |||
453 | base = offset * 8; | 453 | base = offset * 8; |
454 | 454 | ||
455 | for (i = 0; i < 8; i++) { | 455 | for (i = 0; i < 8; i++) { |
456 | if (first_pg == true) { | 456 | if (first_pg) { |
457 | 457 | ||
458 | word_en &= ~(BIT(i / 2)); | 458 | word_en &= ~(BIT(i / 2)); |
459 | 459 | ||
@@ -505,7 +505,7 @@ void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw) | |||
505 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 505 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
506 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 506 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
507 | 507 | ||
508 | if (rtlefuse->autoload_failflag == true) | 508 | if (rtlefuse->autoload_failflag) |
509 | memset(&rtlefuse->efuse_map[EFUSE_INIT_MAP][0], 0xFF, | 509 | memset(&rtlefuse->efuse_map[EFUSE_INIT_MAP][0], 0xFF, |
510 | rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); | 510 | rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); |
511 | else | 511 | else |
@@ -690,7 +690,7 @@ static void efuse_read_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr, | |||
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | if (dataempty == true) { | 693 | if (dataempty) { |
694 | *readstate = PG_STATE_DATA; | 694 | *readstate = PG_STATE_DATA; |
695 | } else { | 695 | } else { |
696 | *efuse_addr = *efuse_addr + (word_cnts * 2) + 1; | 696 | *efuse_addr = *efuse_addr + (word_cnts * 2) + 1; |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index fc44005b0d53..ad39af462f87 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -581,7 +581,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio) | |||
581 | fc = rtl_get_fc(skb); | 581 | fc = rtl_get_fc(skb); |
582 | if (ieee80211_is_nullfunc(fc)) { | 582 | if (ieee80211_is_nullfunc(fc)) { |
583 | if (ieee80211_has_pm(fc)) { | 583 | if (ieee80211_has_pm(fc)) { |
584 | rtlpriv->mac80211.offchan_deley = true; | 584 | rtlpriv->mac80211.offchan_delay = true; |
585 | rtlpriv->psc.state_inap = 1; | 585 | rtlpriv->psc.state_inap = 1; |
586 | } else { | 586 | } else { |
587 | rtlpriv->psc.state_inap = 0; | 587 | rtlpriv->psc.state_inap = 0; |
@@ -626,6 +626,56 @@ tx_status_ok: | |||
626 | } | 626 | } |
627 | } | 627 | } |
628 | 628 | ||
629 | static void _rtl_receive_one(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
630 | struct ieee80211_rx_status rx_status) | ||
631 | { | ||
632 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
633 | struct ieee80211_hdr *hdr = rtl_get_hdr(skb); | ||
634 | __le16 fc = rtl_get_fc(skb); | ||
635 | bool unicast = false; | ||
636 | struct sk_buff *uskb = NULL; | ||
637 | u8 *pdata; | ||
638 | |||
639 | |||
640 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); | ||
641 | |||
642 | if (is_broadcast_ether_addr(hdr->addr1)) { | ||
643 | ;/*TODO*/ | ||
644 | } else if (is_multicast_ether_addr(hdr->addr1)) { | ||
645 | ;/*TODO*/ | ||
646 | } else { | ||
647 | unicast = true; | ||
648 | rtlpriv->stats.rxbytesunicast += skb->len; | ||
649 | } | ||
650 | |||
651 | rtl_is_special_data(hw, skb, false); | ||
652 | |||
653 | if (ieee80211_is_data(fc)) { | ||
654 | rtlpriv->cfg->ops->led_control(hw, LED_CTL_RX); | ||
655 | |||
656 | if (unicast) | ||
657 | rtlpriv->link_info.num_rx_inperiod++; | ||
658 | } | ||
659 | |||
660 | /* for sw lps */ | ||
661 | rtl_swlps_beacon(hw, (void *)skb->data, skb->len); | ||
662 | rtl_recognize_peer(hw, (void *)skb->data, skb->len); | ||
663 | if ((rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP) && | ||
664 | (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) && | ||
665 | (ieee80211_is_beacon(fc) || ieee80211_is_probe_resp(fc))) | ||
666 | return; | ||
667 | |||
668 | if (unlikely(!rtl_action_proc(hw, skb, false))) | ||
669 | return; | ||
670 | |||
671 | uskb = dev_alloc_skb(skb->len + 128); | ||
672 | memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status)); | ||
673 | pdata = (u8 *)skb_put(uskb, skb->len); | ||
674 | memcpy(pdata, skb->data, skb->len); | ||
675 | |||
676 | ieee80211_rx_irqsafe(hw, uskb); | ||
677 | } | ||
678 | |||
629 | static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | 679 | static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) |
630 | { | 680 | { |
631 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 681 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
@@ -637,7 +687,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
637 | u8 own; | 687 | u8 own; |
638 | u8 tmp_one; | 688 | u8 tmp_one; |
639 | u32 bufferaddress; | 689 | u32 bufferaddress; |
640 | bool unicast = false; | ||
641 | 690 | ||
642 | struct rtl_stats stats = { | 691 | struct rtl_stats stats = { |
643 | .signal = 0, | 692 | .signal = 0, |
@@ -654,130 +703,63 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
654 | /*rx pkt */ | 703 | /*rx pkt */ |
655 | struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[ | 704 | struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[ |
656 | index]; | 705 | index]; |
706 | struct sk_buff *new_skb = NULL; | ||
657 | 707 | ||
658 | own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, | 708 | own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, |
659 | false, HW_DESC_OWN); | 709 | false, HW_DESC_OWN); |
660 | 710 | ||
661 | if (own) { | 711 | /*wait data to be filled by hardware */ |
662 | /*wait data to be filled by hardware */ | 712 | if (own) |
663 | break; | 713 | break; |
664 | } else { | ||
665 | struct ieee80211_hdr *hdr; | ||
666 | __le16 fc; | ||
667 | struct sk_buff *new_skb = NULL; | ||
668 | 714 | ||
669 | rtlpriv->cfg->ops->query_rx_desc(hw, &stats, | 715 | rtlpriv->cfg->ops->query_rx_desc(hw, &stats, |
670 | &rx_status, | 716 | &rx_status, |
671 | (u8 *) pdesc, skb); | 717 | (u8 *) pdesc, skb); |
672 | 718 | ||
673 | skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, | 719 | if (stats.crc || stats.hwerror) |
674 | false, | 720 | goto done; |
675 | HW_DESC_RXPKT_LEN)); | ||
676 | skb_reserve(skb, | ||
677 | stats.rx_drvinfo_size + stats.rx_bufshift); | ||
678 | 721 | ||
679 | /* | 722 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); |
680 | *NOTICE This can not be use for mac80211, | 723 | if (unlikely(!new_skb)) { |
681 | *this is done in mac80211 code, | 724 | RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), |
682 | *if you done here sec DHCP will fail | 725 | DBG_DMESG, |
683 | *skb_trim(skb, skb->len - 4); | 726 | ("can't alloc skb for rx\n")); |
684 | */ | 727 | goto done; |
728 | } | ||
685 | 729 | ||
686 | hdr = rtl_get_hdr(skb); | 730 | pci_unmap_single(rtlpci->pdev, |
687 | fc = rtl_get_fc(skb); | 731 | *((dma_addr_t *) skb->cb), |
732 | rtlpci->rxbuffersize, | ||
733 | PCI_DMA_FROMDEVICE); | ||
688 | 734 | ||
689 | /* try for new buffer - if allocation fails, drop | 735 | skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, false, |
690 | * frame and reuse old buffer | 736 | HW_DESC_RXPKT_LEN)); |
691 | */ | 737 | skb_reserve(skb, stats.rx_drvinfo_size + stats.rx_bufshift); |
692 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); | ||
693 | if (unlikely(!new_skb)) { | ||
694 | RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), | ||
695 | DBG_DMESG, | ||
696 | ("can't alloc skb for rx\n")); | ||
697 | goto done; | ||
698 | } | ||
699 | pci_unmap_single(rtlpci->pdev, | ||
700 | *((dma_addr_t *) skb->cb), | ||
701 | rtlpci->rxbuffersize, | ||
702 | PCI_DMA_FROMDEVICE); | ||
703 | 738 | ||
704 | if (!stats.crc && !stats.hwerror) { | 739 | /* |
705 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, | 740 | * NOTICE This can not be use for mac80211, |
706 | sizeof(rx_status)); | 741 | * this is done in mac80211 code, |
707 | 742 | * if you done here sec DHCP will fail | |
708 | if (is_broadcast_ether_addr(hdr->addr1)) { | 743 | * skb_trim(skb, skb->len - 4); |
709 | ;/*TODO*/ | 744 | */ |
710 | } else if (is_multicast_ether_addr(hdr->addr1)) { | ||
711 | ;/*TODO*/ | ||
712 | } else { | ||
713 | unicast = true; | ||
714 | rtlpriv->stats.rxbytesunicast += | ||
715 | skb->len; | ||
716 | } | ||
717 | |||
718 | rtl_is_special_data(hw, skb, false); | ||
719 | |||
720 | if (ieee80211_is_data(fc)) { | ||
721 | rtlpriv->cfg->ops->led_control(hw, | ||
722 | LED_CTL_RX); | ||
723 | |||
724 | if (unicast) | ||
725 | rtlpriv->link_info. | ||
726 | num_rx_inperiod++; | ||
727 | } | ||
728 | |||
729 | /* for sw lps */ | ||
730 | rtl_swlps_beacon(hw, (void *)skb->data, | ||
731 | skb->len); | ||
732 | rtl_recognize_peer(hw, (void *)skb->data, | ||
733 | skb->len); | ||
734 | if ((rtlpriv->mac80211.opmode == | ||
735 | NL80211_IFTYPE_AP) && | ||
736 | (rtlpriv->rtlhal.current_bandtype == | ||
737 | BAND_ON_2_4G) && | ||
738 | (ieee80211_is_beacon(fc) || | ||
739 | ieee80211_is_probe_resp(fc))) { | ||
740 | dev_kfree_skb_any(skb); | ||
741 | } else { | ||
742 | if (unlikely(!rtl_action_proc(hw, skb, | ||
743 | false))) { | ||
744 | dev_kfree_skb_any(skb); | ||
745 | } else { | ||
746 | struct sk_buff *uskb = NULL; | ||
747 | u8 *pdata; | ||
748 | uskb = dev_alloc_skb(skb->len | ||
749 | + 128); | ||
750 | memcpy(IEEE80211_SKB_RXCB(uskb), | ||
751 | &rx_status, | ||
752 | sizeof(rx_status)); | ||
753 | pdata = (u8 *)skb_put(uskb, | ||
754 | skb->len); | ||
755 | memcpy(pdata, skb->data, | ||
756 | skb->len); | ||
757 | dev_kfree_skb_any(skb); | ||
758 | |||
759 | ieee80211_rx_irqsafe(hw, uskb); | ||
760 | } | ||
761 | } | ||
762 | } else { | ||
763 | dev_kfree_skb_any(skb); | ||
764 | } | ||
765 | 745 | ||
766 | if (((rtlpriv->link_info.num_rx_inperiod + | 746 | _rtl_receive_one(hw, skb, rx_status); |
767 | rtlpriv->link_info.num_tx_inperiod) > 8) || | ||
768 | (rtlpriv->link_info.num_rx_inperiod > 2)) { | ||
769 | tasklet_schedule(&rtlpriv->works.ips_leave_tasklet); | ||
770 | } | ||
771 | 747 | ||
772 | skb = new_skb; | 748 | if (((rtlpriv->link_info.num_rx_inperiod + |
749 | rtlpriv->link_info.num_tx_inperiod) > 8) || | ||
750 | (rtlpriv->link_info.num_rx_inperiod > 2)) { | ||
751 | tasklet_schedule(&rtlpriv->works.ips_leave_tasklet); | ||
752 | } | ||
773 | 753 | ||
774 | rtlpci->rx_ring[rx_queue_idx].rx_buf[index] = skb; | 754 | dev_kfree_skb_any(skb); |
775 | *((dma_addr_t *) skb->cb) = | 755 | skb = new_skb; |
756 | |||
757 | rtlpci->rx_ring[rx_queue_idx].rx_buf[index] = skb; | ||
758 | *((dma_addr_t *) skb->cb) = | ||
776 | pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), | 759 | pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), |
777 | rtlpci->rxbuffersize, | 760 | rtlpci->rxbuffersize, |
778 | PCI_DMA_FROMDEVICE); | 761 | PCI_DMA_FROMDEVICE); |
779 | 762 | ||
780 | } | ||
781 | done: | 763 | done: |
782 | bufferaddress = (*((dma_addr_t *)skb->cb)); | 764 | bufferaddress = (*((dma_addr_t *)skb->cb)); |
783 | tmp_one = 1; | 765 | tmp_one = 1; |
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index d14c13d02177..a693feffbe72 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c | |||
@@ -79,59 +79,18 @@ EXPORT_SYMBOL(rtl_ps_disable_nic); | |||
79 | 79 | ||
80 | bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, | 80 | bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, |
81 | enum rf_pwrstate state_toset, | 81 | enum rf_pwrstate state_toset, |
82 | u32 changesource, bool protect_or_not) | 82 | u32 changesource) |
83 | { | 83 | { |
84 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 84 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
85 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 85 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
86 | bool actionallowed = false; | 86 | bool actionallowed = false; |
87 | u16 rfwait_cnt = 0; | ||
88 | 87 | ||
89 | /*protect_or_not = true; */ | ||
90 | |||
91 | if (protect_or_not) | ||
92 | goto no_protect; | ||
93 | |||
94 | /* | ||
95 | *Only one thread can change | ||
96 | *the RF state at one time, and others | ||
97 | *should wait to be executed. | ||
98 | */ | ||
99 | while (true) { | ||
100 | spin_lock(&rtlpriv->locks.rf_ps_lock); | ||
101 | if (ppsc->rfchange_inprogress) { | ||
102 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
103 | |||
104 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
105 | ("RF Change in progress!" | ||
106 | "Wait to set..state_toset(%d).\n", | ||
107 | state_toset)); | ||
108 | |||
109 | /* Set RF after the previous action is done. */ | ||
110 | while (ppsc->rfchange_inprogress) { | ||
111 | rfwait_cnt++; | ||
112 | mdelay(1); | ||
113 | |||
114 | /* | ||
115 | *Wait too long, return false to avoid | ||
116 | *to be stuck here. | ||
117 | */ | ||
118 | if (rfwait_cnt > 100) | ||
119 | return false; | ||
120 | } | ||
121 | } else { | ||
122 | ppsc->rfchange_inprogress = true; | ||
123 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
124 | break; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | no_protect: | ||
129 | switch (state_toset) { | 88 | switch (state_toset) { |
130 | case ERFON: | 89 | case ERFON: |
131 | ppsc->rfoff_reason &= (~changesource); | 90 | ppsc->rfoff_reason &= (~changesource); |
132 | 91 | ||
133 | if ((changesource == RF_CHANGE_BY_HW) && | 92 | if ((changesource == RF_CHANGE_BY_HW) && |
134 | (ppsc->hwradiooff == true)) { | 93 | (ppsc->hwradiooff)) { |
135 | ppsc->hwradiooff = false; | 94 | ppsc->hwradiooff = false; |
136 | } | 95 | } |
137 | 96 | ||
@@ -167,12 +126,6 @@ no_protect: | |||
167 | if (actionallowed) | 126 | if (actionallowed) |
168 | rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); | 127 | rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); |
169 | 128 | ||
170 | if (!protect_or_not) { | ||
171 | spin_lock(&rtlpriv->locks.rf_ps_lock); | ||
172 | ppsc->rfchange_inprogress = false; | ||
173 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
174 | } | ||
175 | |||
176 | return actionallowed; | 129 | return actionallowed; |
177 | } | 130 | } |
178 | EXPORT_SYMBOL(rtl_ps_set_rf_state); | 131 | EXPORT_SYMBOL(rtl_ps_set_rf_state); |
@@ -195,8 +148,7 @@ static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw) | |||
195 | } | 148 | } |
196 | } | 149 | } |
197 | 150 | ||
198 | rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate, | 151 | rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate, RF_CHANGE_BY_IPS); |
199 | RF_CHANGE_BY_IPS, false); | ||
200 | 152 | ||
201 | if (ppsc->inactive_pwrstate == ERFOFF && | 153 | if (ppsc->inactive_pwrstate == ERFOFF && |
202 | rtlhal->interface == INTF_PCI) { | 154 | rtlhal->interface == INTF_PCI) { |
@@ -587,7 +539,7 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw) | |||
587 | } | 539 | } |
588 | 540 | ||
589 | spin_lock(&rtlpriv->locks.lps_lock); | 541 | spin_lock(&rtlpriv->locks.lps_lock); |
590 | rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS, false); | 542 | rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); |
591 | spin_unlock(&rtlpriv->locks.lps_lock); | 543 | spin_unlock(&rtlpriv->locks.lps_lock); |
592 | } | 544 | } |
593 | 545 | ||
@@ -621,15 +573,8 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) | |||
621 | if (rtlpriv->link_info.busytraffic) | 573 | if (rtlpriv->link_info.busytraffic) |
622 | return; | 574 | return; |
623 | 575 | ||
624 | spin_lock(&rtlpriv->locks.rf_ps_lock); | ||
625 | if (rtlpriv->psc.rfchange_inprogress) { | ||
626 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
627 | return; | ||
628 | } | ||
629 | spin_unlock(&rtlpriv->locks.rf_ps_lock); | ||
630 | |||
631 | spin_lock(&rtlpriv->locks.lps_lock); | 576 | spin_lock(&rtlpriv->locks.lps_lock); |
632 | rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS, false); | 577 | rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); |
633 | spin_unlock(&rtlpriv->locks.lps_lock); | 578 | spin_unlock(&rtlpriv->locks.lps_lock); |
634 | 579 | ||
635 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && | 580 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && |
diff --git a/drivers/net/wireless/rtlwifi/ps.h b/drivers/net/wireless/rtlwifi/ps.h index e3bf89840370..84628e6041c7 100644 --- a/drivers/net/wireless/rtlwifi/ps.h +++ b/drivers/net/wireless/rtlwifi/ps.h | |||
@@ -33,8 +33,7 @@ | |||
33 | #define MAX_SW_LPS_SLEEP_INTV 5 | 33 | #define MAX_SW_LPS_SLEEP_INTV 5 |
34 | 34 | ||
35 | bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, | 35 | bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, |
36 | enum rf_pwrstate state_toset, u32 changesource, | 36 | enum rf_pwrstate state_toset, u32 changesource); |
37 | bool protect_or_not); | ||
38 | bool rtl_ps_enable_nic(struct ieee80211_hw *hw); | 37 | bool rtl_ps_enable_nic(struct ieee80211_hw *hw); |
39 | bool rtl_ps_disable_nic(struct ieee80211_hw *hw); | 38 | bool rtl_ps_disable_nic(struct ieee80211_hw *hw); |
40 | void rtl_ips_nic_off(struct ieee80211_hw *hw); | 39 | void rtl_ips_nic_off(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rc.c b/drivers/net/wireless/rtlwifi/rc.c index 30da68a77786..539df66dce0a 100644 --- a/drivers/net/wireless/rtlwifi/rc.c +++ b/drivers/net/wireless/rtlwifi/rc.c | |||
@@ -200,7 +200,7 @@ static void rtl_tx_status(void *ppriv, | |||
200 | if (sta) { | 200 | if (sta) { |
201 | /* Check if aggregation has to be enabled for this tid */ | 201 | /* Check if aggregation has to be enabled for this tid */ |
202 | sta_entry = (struct rtl_sta_info *) sta->drv_priv; | 202 | sta_entry = (struct rtl_sta_info *) sta->drv_priv; |
203 | if ((sta->ht_cap.ht_supported == true) && | 203 | if ((sta->ht_cap.ht_supported) && |
204 | !(skb->protocol == cpu_to_be16(ETH_P_PAE))) { | 204 | !(skb->protocol == cpu_to_be16(ETH_P_PAE))) { |
205 | if (ieee80211_is_data_qos(fc)) { | 205 | if (ieee80211_is_data_qos(fc)) { |
206 | u8 tid = rtl_get_tid(skb); | 206 | u8 tid = rtl_get_tid(skb); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c index 97183829b9be..a00774e7090d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | |||
@@ -474,7 +474,7 @@ static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) | |||
474 | { | 474 | { |
475 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 475 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
476 | 476 | ||
477 | if (mac->act_scanning == true) | 477 | if (mac->act_scanning) |
478 | return; | 478 | return; |
479 | 479 | ||
480 | if (mac->link_state >= MAC80211_LINKED) | 480 | if (mac->link_state >= MAC80211_LINKED) |
@@ -670,7 +670,7 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw | |||
670 | u8 ofdm_index[2], cck_index = 0, ofdm_index_old[2], cck_index_old = 0; | 670 | u8 ofdm_index[2], cck_index = 0, ofdm_index_old[2], cck_index_old = 0; |
671 | int i; | 671 | int i; |
672 | bool is2t = IS_92C_SERIAL(rtlhal->version); | 672 | bool is2t = IS_92C_SERIAL(rtlhal->version); |
673 | u8 txpwr_level[2] = {0, 0}; | 673 | s8 txpwr_level[2] = {0, 0}; |
674 | u8 ofdm_min_index = 6, rf; | 674 | u8 ofdm_min_index = 6, rf; |
675 | 675 | ||
676 | rtlpriv->dm.txpower_trackinginit = true; | 676 | rtlpriv->dm.txpower_trackinginit = true; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index 944f55e9d316..bc6ae9dcf940 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | |||
@@ -488,7 +488,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
488 | case HW_VAR_CORRECT_TSF:{ | 488 | case HW_VAR_CORRECT_TSF:{ |
489 | u8 btype_ibss = ((u8 *) (val))[0]; | 489 | u8 btype_ibss = ((u8 *) (val))[0]; |
490 | 490 | ||
491 | if (btype_ibss == true) | 491 | if (btype_ibss) |
492 | _rtl92ce_stop_tx_beacon(hw); | 492 | _rtl92ce_stop_tx_beacon(hw); |
493 | 493 | ||
494 | _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(3)); | 494 | _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(3)); |
@@ -500,7 +500,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
500 | 500 | ||
501 | _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); | 501 | _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); |
502 | 502 | ||
503 | if (btype_ibss == true) | 503 | if (btype_ibss) |
504 | _rtl92ce_resume_tx_beacon(hw); | 504 | _rtl92ce_resume_tx_beacon(hw); |
505 | 505 | ||
506 | break; | 506 | break; |
@@ -1121,7 +1121,7 @@ void rtl92ce_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) | |||
1121 | if (rtlpriv->psc.rfpwr_state != ERFON) | 1121 | if (rtlpriv->psc.rfpwr_state != ERFON) |
1122 | return; | 1122 | return; |
1123 | 1123 | ||
1124 | if (check_bssid == true) { | 1124 | if (check_bssid) { |
1125 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); | 1125 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
1126 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1126 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
1127 | (u8 *) (®_rcr)); | 1127 | (u8 *) (®_rcr)); |
@@ -1585,7 +1585,7 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) | |||
1585 | rtlefuse->autoload_failflag = false; | 1585 | rtlefuse->autoload_failflag = false; |
1586 | } | 1586 | } |
1587 | 1587 | ||
1588 | if (rtlefuse->autoload_failflag == true) | 1588 | if (rtlefuse->autoload_failflag) |
1589 | return; | 1589 | return; |
1590 | 1590 | ||
1591 | for (i = 0; i < 6; i += 2) { | 1591 | for (i = 0; i < 6; i += 2) { |
@@ -1994,7 +1994,7 @@ bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid) | |||
1994 | u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL); | 1994 | u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL); |
1995 | e_rfpowerstate_toset = (u1tmp & BIT(3)) ? ERFON : ERFOFF; | 1995 | e_rfpowerstate_toset = (u1tmp & BIT(3)) ? ERFON : ERFOFF; |
1996 | 1996 | ||
1997 | if ((ppsc->hwradiooff == true) && (e_rfpowerstate_toset == ERFON)) { | 1997 | if ((ppsc->hwradiooff) && (e_rfpowerstate_toset == ERFON)) { |
1998 | RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, | 1998 | RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, |
1999 | ("GPIOChangeRF - HW Radio ON, RF ON\n")); | 1999 | ("GPIOChangeRF - HW Radio ON, RF ON\n")); |
2000 | 2000 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/led.c b/drivers/net/wireless/rtlwifi/rtl8192ce/led.c index 9dd1ed7b6422..28a1a707d09c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/led.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/led.c | |||
@@ -84,7 +84,7 @@ void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) | |||
84 | break; | 84 | break; |
85 | case LED_PIN_LED0: | 85 | case LED_PIN_LED0: |
86 | ledcfg &= 0xf0; | 86 | ledcfg &= 0xf0; |
87 | if (pcipriv->ledctl.led_opendrain == true) | 87 | if (pcipriv->ledctl.led_opendrain) |
88 | rtl_write_byte(rtlpriv, REG_LEDCFG2, | 88 | rtl_write_byte(rtlpriv, REG_LEDCFG2, |
89 | (ledcfg | BIT(1) | BIT(5) | BIT(6))); | 89 | (ledcfg | BIT(1) | BIT(5) | BIT(6))); |
90 | else | 90 | else |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c index 90d0f2cf3b27..d3b01e6023ba 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c | |||
@@ -76,7 +76,7 @@ void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | |||
76 | if (rtlefuse->eeprom_regulatory != 0) | 76 | if (rtlefuse->eeprom_regulatory != 0) |
77 | turbo_scanoff = true; | 77 | turbo_scanoff = true; |
78 | 78 | ||
79 | if (mac->act_scanning == true) { | 79 | if (mac->act_scanning) { |
80 | tx_agc[RF90_PATH_A] = 0x3f3f3f3f; | 80 | tx_agc[RF90_PATH_A] = 0x3f3f3f3f; |
81 | tx_agc[RF90_PATH_B] = 0x3f3f3f3f; | 81 | tx_agc[RF90_PATH_B] = 0x3f3f3f3f; |
82 | 82 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c index 2492cc234c03..230bbe900d8d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | |||
@@ -225,7 +225,7 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, | |||
225 | { | 225 | { |
226 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 226 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
227 | struct phy_sts_cck_8192s_t *cck_buf; | 227 | struct phy_sts_cck_8192s_t *cck_buf; |
228 | s8 rx_pwr_all, rx_pwr[4]; | 228 | s8 rx_pwr_all = 0, rx_pwr[4]; |
229 | u8 evm, pwdb_all, rf_rx_num = 0; | 229 | u8 evm, pwdb_all, rf_rx_num = 0; |
230 | u8 i, max_spatial_stream; | 230 | u8 i, max_spatial_stream; |
231 | u32 rssi, total_rssi = 0; | 231 | u32 rssi, total_rssi = 0; |
@@ -678,7 +678,7 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, | |||
678 | GET_RX_DESC_PAGGR(pdesc)); | 678 | GET_RX_DESC_PAGGR(pdesc)); |
679 | 679 | ||
680 | rx_status->mactime = GET_RX_DESC_TSFL(pdesc); | 680 | rx_status->mactime = GET_RX_DESC_TSFL(pdesc); |
681 | if (phystatus == true) { | 681 | if (phystatus) { |
682 | p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + | 682 | p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + |
683 | stats->rx_bufshift); | 683 | stats->rx_bufshift); |
684 | 684 | ||
@@ -927,7 +927,7 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
927 | 927 | ||
928 | void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) | 928 | void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) |
929 | { | 929 | { |
930 | if (istx == true) { | 930 | if (istx) { |
931 | switch (desc_name) { | 931 | switch (desc_name) { |
932 | case HW_DESC_OWN: | 932 | case HW_DESC_OWN: |
933 | wmb(); | 933 | wmb(); |
@@ -968,7 +968,7 @@ u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name) | |||
968 | { | 968 | { |
969 | u32 ret = 0; | 969 | u32 ret = 0; |
970 | 970 | ||
971 | if (istx == true) { | 971 | if (istx) { |
972 | switch (desc_name) { | 972 | switch (desc_name) { |
973 | case HW_DESC_OWN: | 973 | case HW_DESC_OWN: |
974 | ret = GET_TX_DESC_OWN(p_desc); | 974 | ret = GET_TX_DESC_OWN(p_desc); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 52e2af58c1ed..2b34764fbf73 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -520,7 +520,7 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) | |||
520 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); | 520 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); |
521 | rtlefuse->autoload_failflag = false; | 521 | rtlefuse->autoload_failflag = false; |
522 | } | 522 | } |
523 | if (rtlefuse->autoload_failflag == true) | 523 | if (rtlefuse->autoload_failflag) |
524 | return; | 524 | return; |
525 | for (i = 0; i < 6; i += 2) { | 525 | for (i = 0; i < 6; i += 2) { |
526 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; | 526 | usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; |
@@ -1594,7 +1594,7 @@ static void _rtl92cu_set_check_bssid(struct ieee80211_hw *hw, | |||
1594 | default: | 1594 | default: |
1595 | break; | 1595 | break; |
1596 | } | 1596 | } |
1597 | if (filterout_non_associated_bssid == true) { | 1597 | if (filterout_non_associated_bssid) { |
1598 | if (IS_NORMAL_CHIP(rtlhal->version)) { | 1598 | if (IS_NORMAL_CHIP(rtlhal->version)) { |
1599 | switch (rtlphy->current_io_type) { | 1599 | switch (rtlphy->current_io_type) { |
1600 | case IO_CMD_RESUME_DM_BY_SCAN: | 1600 | case IO_CMD_RESUME_DM_BY_SCAN: |
@@ -2155,7 +2155,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
2155 | case HW_VAR_CORRECT_TSF:{ | 2155 | case HW_VAR_CORRECT_TSF:{ |
2156 | u8 btype_ibss = ((u8 *) (val))[0]; | 2156 | u8 btype_ibss = ((u8 *) (val))[0]; |
2157 | 2157 | ||
2158 | if (btype_ibss == true) | 2158 | if (btype_ibss) |
2159 | _rtl92cu_stop_tx_beacon(hw); | 2159 | _rtl92cu_stop_tx_beacon(hw); |
2160 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(3)); | 2160 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(3)); |
2161 | rtl_write_dword(rtlpriv, REG_TSFTR, (u32)(mac->tsf & | 2161 | rtl_write_dword(rtlpriv, REG_TSFTR, (u32)(mac->tsf & |
@@ -2163,7 +2163,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
2163 | rtl_write_dword(rtlpriv, REG_TSFTR + 4, | 2163 | rtl_write_dword(rtlpriv, REG_TSFTR + 4, |
2164 | (u32)((mac->tsf >> 32) & 0xffffffff)); | 2164 | (u32)((mac->tsf >> 32) & 0xffffffff)); |
2165 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); | 2165 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); |
2166 | if (btype_ibss == true) | 2166 | if (btype_ibss) |
2167 | _rtl92cu_resume_tx_beacon(hw); | 2167 | _rtl92cu_resume_tx_beacon(hw); |
2168 | break; | 2168 | break; |
2169 | } | 2169 | } |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c index 332c74348a69..2ff9d8314e7b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c | |||
@@ -82,7 +82,7 @@ void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) | |||
82 | break; | 82 | break; |
83 | case LED_PIN_LED0: | 83 | case LED_PIN_LED0: |
84 | ledcfg &= 0xf0; | 84 | ledcfg &= 0xf0; |
85 | if (usbpriv->ledctl.led_opendrain == true) | 85 | if (usbpriv->ledctl.led_opendrain) |
86 | rtl_write_byte(rtlpriv, REG_LEDCFG2, | 86 | rtl_write_byte(rtlpriv, REG_LEDCFG2, |
87 | (ledcfg | BIT(1) | BIT(5) | BIT(6))); | 87 | (ledcfg | BIT(1) | BIT(5) | BIT(6))); |
88 | else | 88 | else |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c index c7576ec4744e..1e851aae58db 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | |||
@@ -82,7 +82,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | |||
82 | (rtlefuse->external_pa)) | 82 | (rtlefuse->external_pa)) |
83 | turbo_scanoff = true; | 83 | turbo_scanoff = true; |
84 | } | 84 | } |
85 | if (mac->act_scanning == true) { | 85 | if (mac->act_scanning) { |
86 | tx_agc[RF90_PATH_A] = 0x3f3f3f3f; | 86 | tx_agc[RF90_PATH_A] = 0x3f3f3f3f; |
87 | tx_agc[RF90_PATH_B] = 0x3f3f3f3f; | 87 | tx_agc[RF90_PATH_B] = 0x3f3f3f3f; |
88 | if (turbo_scanoff) { | 88 | if (turbo_scanoff) { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c index 3a92ba3c4a1e..906e7aa55bc3 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | |||
@@ -342,7 +342,7 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, | |||
342 | (u8)GET_RX_DESC_RX_MCS(pdesc), | 342 | (u8)GET_RX_DESC_RX_MCS(pdesc), |
343 | (bool)GET_RX_DESC_PAGGR(pdesc)); | 343 | (bool)GET_RX_DESC_PAGGR(pdesc)); |
344 | rx_status->mactime = GET_RX_DESC_TSFL(pdesc); | 344 | rx_status->mactime = GET_RX_DESC_TSFL(pdesc); |
345 | if (phystatus == true) { | 345 | if (phystatus) { |
346 | p_drvinfo = (struct rx_fwinfo_92c *)(pdesc + RTL_RX_DESC_SIZE); | 346 | p_drvinfo = (struct rx_fwinfo_92c *)(pdesc + RTL_RX_DESC_SIZE); |
347 | rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc, | 347 | rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc, |
348 | p_drvinfo); | 348 | p_drvinfo); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c index 609c7ec7e66a..4203a8531ca0 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c | |||
@@ -452,7 +452,7 @@ static void _rtl92s_dm_initial_gain_sta_beforeconnect(struct ieee80211_hw *hw) | |||
452 | if (rtlpriv->psc.rfpwr_state != ERFON) | 452 | if (rtlpriv->psc.rfpwr_state != ERFON) |
453 | return; | 453 | return; |
454 | 454 | ||
455 | if (digtable.backoff_enable_flag == true) | 455 | if (digtable.backoff_enable_flag) |
456 | rtl92s_backoff_enable_flag(hw); | 456 | rtl92s_backoff_enable_flag(hw); |
457 | else | 457 | else |
458 | digtable.backoff_val = DM_DIG_BACKOFF; | 458 | digtable.backoff_val = DM_DIG_BACKOFF; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c index 35dd12d0dcf3..13da7b3c0202 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c | |||
@@ -516,7 +516,7 @@ static u8 _rtl92se_rf_onoff_detect(struct ieee80211_hw *hw) | |||
516 | mdelay(10); | 516 | mdelay(10); |
517 | 517 | ||
518 | /* check GPIO3 */ | 518 | /* check GPIO3 */ |
519 | u1tmp = rtl_read_byte(rtlpriv, GPIO_IN); | 519 | u1tmp = rtl_read_byte(rtlpriv, GPIO_IN_SE); |
520 | retval = (u1tmp & HAL_8192S_HW_GPIO_OFF_BIT) ? ERFON : ERFOFF; | 520 | retval = (u1tmp & HAL_8192S_HW_GPIO_OFF_BIT) ? ERFON : ERFOFF; |
521 | 521 | ||
522 | return retval; | 522 | return retval; |
@@ -994,7 +994,8 @@ int rtl92se_hw_init(struct ieee80211_hw *hw) | |||
994 | 994 | ||
995 | rtlpriv->psc.rfoff_reason = RF_CHANGE_BY_INIT; | 995 | rtlpriv->psc.rfoff_reason = RF_CHANGE_BY_INIT; |
996 | rtlpriv->psc.rfpwr_state = ERFON; | 996 | rtlpriv->psc.rfpwr_state = ERFON; |
997 | rtl_ps_set_rf_state(hw, ERFOFF, rfoffreason, true); | 997 | /* FIXME: check spinlocks if this block is uncommented */ |
998 | rtl_ps_set_rf_state(hw, ERFOFF, rfoffreason); | ||
998 | } else { | 999 | } else { |
999 | /* gpio radio on/off is out of adapter start */ | 1000 | /* gpio radio on/off is out of adapter start */ |
1000 | if (rtlpriv->psc.hwradiooff == false) { | 1001 | if (rtlpriv->psc.hwradiooff == false) { |
@@ -1105,7 +1106,7 @@ void rtl92se_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) | |||
1105 | if (rtlpriv->psc.rfpwr_state != ERFON) | 1106 | if (rtlpriv->psc.rfpwr_state != ERFON) |
1106 | return; | 1107 | return; |
1107 | 1108 | ||
1108 | if (check_bssid == true) { | 1109 | if (check_bssid) { |
1109 | reg_rcr |= (RCR_CBSSID); | 1110 | reg_rcr |= (RCR_CBSSID); |
1110 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(®_rcr)); | 1111 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(®_rcr)); |
1111 | } else if (check_bssid == false) { | 1112 | } else if (check_bssid == false) { |
@@ -1651,7 +1652,7 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw) | |||
1651 | rtlefuse->autoload_failflag = false; | 1652 | rtlefuse->autoload_failflag = false; |
1652 | } | 1653 | } |
1653 | 1654 | ||
1654 | if (rtlefuse->autoload_failflag == true) | 1655 | if (rtlefuse->autoload_failflag) |
1655 | return; | 1656 | return; |
1656 | 1657 | ||
1657 | _rtl8192se_get_IC_Inferiority(hw); | 1658 | _rtl8192se_get_IC_Inferiority(hw); |
@@ -2301,7 +2302,7 @@ bool rtl92se_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid) | |||
2301 | 2302 | ||
2302 | rfpwr_toset = _rtl92se_rf_onoff_detect(hw); | 2303 | rfpwr_toset = _rtl92se_rf_onoff_detect(hw); |
2303 | 2304 | ||
2304 | if ((ppsc->hwradiooff == true) && (rfpwr_toset == ERFON)) { | 2305 | if ((ppsc->hwradiooff) && (rfpwr_toset == ERFON)) { |
2305 | RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, | 2306 | RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, |
2306 | ("RFKILL-HW Radio ON, RF ON\n")); | 2307 | ("RFKILL-HW Radio ON, RF ON\n")); |
2307 | 2308 | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/led.c b/drivers/net/wireless/rtlwifi/rtl8192se/led.c index 6d4f66616680..e3fe7c90ebf4 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/led.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/led.c | |||
@@ -90,7 +90,7 @@ void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) | |||
90 | break; | 90 | break; |
91 | case LED_PIN_LED0: | 91 | case LED_PIN_LED0: |
92 | ledcfg &= 0xf0; | 92 | ledcfg &= 0xf0; |
93 | if (pcipriv->ledctl.led_opendrain == true) | 93 | if (pcipriv->ledctl.led_opendrain) |
94 | rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(1))); | 94 | rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(1))); |
95 | else | 95 | else |
96 | rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3))); | 96 | rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3))); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c index 7ee2daccd7d5..81a5aa4370cf 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c | |||
@@ -1416,7 +1416,7 @@ static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw) | |||
1416 | break; | 1416 | break; |
1417 | case FW_CMD_HIGH_PWR_ENABLE: | 1417 | case FW_CMD_HIGH_PWR_ENABLE: |
1418 | if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || | 1418 | if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || |
1419 | (rtlpriv->dm.dynamic_txpower_enable == true)) | 1419 | rtlpriv->dm.dynamic_txpower_enable) |
1420 | break; | 1420 | break; |
1421 | 1421 | ||
1422 | /* CCA threshold */ | 1422 | /* CCA threshold */ |
@@ -1608,7 +1608,7 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio) | |||
1608 | fw_cmdmap &= ~FW_DIG_ENABLE_CTL; | 1608 | fw_cmdmap &= ~FW_DIG_ENABLE_CTL; |
1609 | 1609 | ||
1610 | if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || | 1610 | if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || |
1611 | (rtlpriv->dm.dynamic_txpower_enable == true)) | 1611 | rtlpriv->dm.dynamic_txpower_enable) |
1612 | fw_cmdmap &= ~FW_HIGH_PWR_ENABLE_CTL; | 1612 | fw_cmdmap &= ~FW_HIGH_PWR_ENABLE_CTL; |
1613 | 1613 | ||
1614 | if ((digtable.dig_ext_port_stage == | 1614 | if ((digtable.dig_ext_port_stage == |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h index 0116eaddbfac..ea32ef2d4098 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h +++ b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h | |||
@@ -248,12 +248,8 @@ | |||
248 | #define PSTIME 0x02E0 | 248 | #define PSTIME 0x02E0 |
249 | #define TIMER0 0x02E4 | 249 | #define TIMER0 0x02E4 |
250 | #define TIMER1 0x02E8 | 250 | #define TIMER1 0x02E8 |
251 | #define GPIO_CTRL 0x02EC | 251 | #define GPIO_IN_SE 0x02EC |
252 | #define GPIO_IN 0x02EC | ||
253 | #define GPIO_OUT 0x02ED | ||
254 | #define GPIO_IO_SEL 0x02EE | 252 | #define GPIO_IO_SEL 0x02EE |
255 | #define GPIO_MOD 0x02EF | ||
256 | #define GPIO_INTCTRL 0x02F0 | ||
257 | #define MAC_PINMUX_CFG 0x02F1 | 253 | #define MAC_PINMUX_CFG 0x02F1 |
258 | #define LEDCFG 0x02F2 | 254 | #define LEDCFG 0x02F2 |
259 | #define PHY_REG 0x02F3 | 255 | #define PHY_REG 0x02F3 |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c index 1d3a48330399..c6e3a4ca42f9 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c | |||
@@ -410,7 +410,7 @@ void rtl92s_phy_rf6052_set_ccktxpower(struct ieee80211_hw *hw, u8 pwrlevel) | |||
410 | (rtlefuse->eeprom_regulatory != 0))) | 410 | (rtlefuse->eeprom_regulatory != 0))) |
411 | dont_inc_cck_or_turboscanoff = true; | 411 | dont_inc_cck_or_turboscanoff = true; |
412 | 412 | ||
413 | if (mac->act_scanning == true) { | 413 | if (mac->act_scanning) { |
414 | txagc = 0x3f; | 414 | txagc = 0x3f; |
415 | if (dont_inc_cck_or_turboscanoff) | 415 | if (dont_inc_cck_or_turboscanoff) |
416 | txagc = pwrlevel; | 416 | txagc = pwrlevel; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c index d509cf6a1e4d..cffe30851f79 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | |||
@@ -661,7 +661,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, | |||
661 | 661 | ||
662 | 662 | ||
663 | rx_status->mactime = GET_RX_STATUS_DESC_TSFL(pdesc); | 663 | rx_status->mactime = GET_RX_STATUS_DESC_TSFL(pdesc); |
664 | if (phystatus == true) { | 664 | if (phystatus) { |
665 | p_drvinfo = (struct rx_fwinfo *)(skb->data + | 665 | p_drvinfo = (struct rx_fwinfo *)(skb->data + |
666 | stats->rx_bufshift); | 666 | stats->rx_bufshift); |
667 | _rtl92se_translate_rx_signal_stuff(hw, skb, stats, pdesc, | 667 | _rtl92se_translate_rx_signal_stuff(hw, skb, stats, pdesc, |
@@ -900,7 +900,7 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, | |||
900 | 900 | ||
901 | void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) | 901 | void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) |
902 | { | 902 | { |
903 | if (istx == true) { | 903 | if (istx) { |
904 | switch (desc_name) { | 904 | switch (desc_name) { |
905 | case HW_DESC_OWN: | 905 | case HW_DESC_OWN: |
906 | wmb(); | 906 | wmb(); |
@@ -941,7 +941,7 @@ u32 rtl92se_get_desc(u8 *desc, bool istx, u8 desc_name) | |||
941 | { | 941 | { |
942 | u32 ret = 0; | 942 | u32 ret = 0; |
943 | 943 | ||
944 | if (istx == true) { | 944 | if (istx) { |
945 | switch (desc_name) { | 945 | switch (desc_name) { |
946 | case HW_DESC_OWN: | 946 | case HW_DESC_OWN: |
947 | ret = GET_TX_DESC_OWN(desc); | 947 | ret = GET_TX_DESC_OWN(desc); |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index 9d003e0864f5..c54cda5ce22a 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -938,7 +938,7 @@ struct rtl_mac { | |||
938 | int n_channels; | 938 | int n_channels; |
939 | int n_bitrates; | 939 | int n_bitrates; |
940 | 940 | ||
941 | bool offchan_deley; | 941 | bool offchan_delay; |
942 | 942 | ||
943 | /*filters */ | 943 | /*filters */ |
944 | u32 rx_conf; | 944 | u32 rx_conf; |
@@ -1983,7 +1983,7 @@ static inline u16 rtl_get_tid(struct sk_buff *skb) | |||
1983 | 1983 | ||
1984 | static inline struct ieee80211_sta *get_sta(struct ieee80211_hw *hw, | 1984 | static inline struct ieee80211_sta *get_sta(struct ieee80211_hw *hw, |
1985 | struct ieee80211_vif *vif, | 1985 | struct ieee80211_vif *vif, |
1986 | u8 *bssid) | 1986 | const u8 *bssid) |
1987 | { | 1987 | { |
1988 | return ieee80211_find_sta(vif, bssid); | 1988 | return ieee80211_find_sta(vif, bssid); |
1989 | } | 1989 | } |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index 4be7c3b5b265..117c4123943c 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #ifndef _ZD_CHIP_H | 21 | #ifndef _ZD_CHIP_H |
22 | #define _ZD_CHIP_H | 22 | #define _ZD_CHIP_H |
23 | 23 | ||
24 | #include <net/mac80211.h> | ||
25 | |||
24 | #include "zd_rf.h" | 26 | #include "zd_rf.h" |
25 | #include "zd_usb.h" | 27 | #include "zd_usb.h" |
26 | 28 | ||
diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c index 305ade7825f7..a7aef47bf739 100644 --- a/drivers/ssb/driver_chipcommon_pmu.c +++ b/drivers/ssb/driver_chipcommon_pmu.c | |||
@@ -417,9 +417,9 @@ static void ssb_pmu_resources_init(struct ssb_chipcommon *cc) | |||
417 | u32 min_msk = 0, max_msk = 0; | 417 | u32 min_msk = 0, max_msk = 0; |
418 | unsigned int i; | 418 | unsigned int i; |
419 | const struct pmu_res_updown_tab_entry *updown_tab = NULL; | 419 | const struct pmu_res_updown_tab_entry *updown_tab = NULL; |
420 | unsigned int updown_tab_size; | 420 | unsigned int updown_tab_size = 0; |
421 | const struct pmu_res_depend_tab_entry *depend_tab = NULL; | 421 | const struct pmu_res_depend_tab_entry *depend_tab = NULL; |
422 | unsigned int depend_tab_size; | 422 | unsigned int depend_tab_size = 0; |
423 | 423 | ||
424 | switch (bus->chip_id) { | 424 | switch (bus->chip_id) { |
425 | case 0x4312: | 425 | case 0x4312: |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 6ff080eac0b2..3895aeb494a3 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -244,6 +244,7 @@ void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) | |||
244 | } | 244 | } |
245 | 245 | ||
246 | extern bool bcma_core_is_enabled(struct bcma_device *core); | 246 | extern bool bcma_core_is_enabled(struct bcma_device *core); |
247 | extern void bcma_core_disable(struct bcma_device *core, u32 flags); | ||
247 | extern int bcma_core_enable(struct bcma_device *core, u32 flags); | 248 | extern int bcma_core_enable(struct bcma_device *core, u32 flags); |
248 | 249 | ||
249 | #endif /* LINUX_BCMA_H_ */ | 250 | #endif /* LINUX_BCMA_H_ */ |
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h index b7e191cf00ec..3871b668caf9 100644 --- a/include/linux/bcma/bcma_driver_pci.h +++ b/include/linux/bcma/bcma_driver_pci.h | |||
@@ -85,5 +85,7 @@ struct bcma_drv_pci { | |||
85 | #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) | 85 | #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) |
86 | 86 | ||
87 | extern void bcma_core_pci_init(struct bcma_drv_pci *pc); | 87 | extern void bcma_core_pci_init(struct bcma_drv_pci *pc); |
88 | extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, | ||
89 | struct bcma_device *core, bool enable); | ||
88 | 90 | ||
89 | #endif /* LINUX_BCMA_DRIVER_PCI_H_ */ | 91 | #endif /* LINUX_BCMA_DRIVER_PCI_H_ */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 3b31ec95dd8e..120f102814b6 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1708,6 +1708,14 @@ enum ieee80211_ampdu_mlme_action { | |||
1708 | * any error unless this callback returned a negative error code. | 1708 | * any error unless this callback returned a negative error code. |
1709 | * The callback can sleep. | 1709 | * The callback can sleep. |
1710 | * | 1710 | * |
1711 | * @cancel_hw_scan: Ask the low-level tp cancel the active hw scan. | ||
1712 | * The driver should ask the hardware to cancel the scan (if possible), | ||
1713 | * but the scan will be completed only after the driver will call | ||
1714 | * ieee80211_scan_completed(). | ||
1715 | * This callback is needed for wowlan, to prevent enqueueing a new | ||
1716 | * scan_work after the low-level driver was already suspended. | ||
1717 | * The callback can sleep. | ||
1718 | * | ||
1711 | * @sched_scan_start: Ask the hardware to start scanning repeatedly at | 1719 | * @sched_scan_start: Ask the hardware to start scanning repeatedly at |
1712 | * specific intervals. The driver must call the | 1720 | * specific intervals. The driver must call the |
1713 | * ieee80211_sched_scan_results() function whenever it finds results. | 1721 | * ieee80211_sched_scan_results() function whenever it finds results. |
@@ -1900,6 +1908,8 @@ struct ieee80211_ops { | |||
1900 | u32 iv32, u16 *phase1key); | 1908 | u32 iv32, u16 *phase1key); |
1901 | int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1909 | int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1902 | struct cfg80211_scan_request *req); | 1910 | struct cfg80211_scan_request *req); |
1911 | void (*cancel_hw_scan)(struct ieee80211_hw *hw, | ||
1912 | struct ieee80211_vif *vif); | ||
1903 | int (*sched_scan_start)(struct ieee80211_hw *hw, | 1913 | int (*sched_scan_start)(struct ieee80211_hw *hw, |
1904 | struct ieee80211_vif *vif, | 1914 | struct ieee80211_vif *vif, |
1905 | struct cfg80211_sched_scan_request *req, | 1915 | struct cfg80211_sched_scan_request *req, |
@@ -2920,6 +2930,16 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, | |||
2920 | gfp_t gfp); | 2930 | gfp_t gfp); |
2921 | 2931 | ||
2922 | /** | 2932 | /** |
2933 | * ieee80211_get_operstate - get the operstate of the vif | ||
2934 | * | ||
2935 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
2936 | * | ||
2937 | * The driver might need to know the operstate of the net_device | ||
2938 | * (specifically, whether the link is IF_OPER_UP after resume) | ||
2939 | */ | ||
2940 | unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif); | ||
2941 | |||
2942 | /** | ||
2923 | * ieee80211_chswitch_done - Complete channel switch process | 2943 | * ieee80211_chswitch_done - Complete channel switch process |
2924 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 2944 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
2925 | * @success: make the channel switch successful or not | 2945 | * @success: make the channel switch successful or not |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index eebf7a67daf7..0e7e4268ddf6 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -218,6 +218,16 @@ static inline int drv_hw_scan(struct ieee80211_local *local, | |||
218 | return ret; | 218 | return ret; |
219 | } | 219 | } |
220 | 220 | ||
221 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, | ||
222 | struct ieee80211_sub_if_data *sdata) | ||
223 | { | ||
224 | might_sleep(); | ||
225 | |||
226 | trace_drv_cancel_hw_scan(local, sdata); | ||
227 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); | ||
228 | trace_drv_return_void(local); | ||
229 | } | ||
230 | |||
221 | static inline int | 231 | static inline int |
222 | drv_sched_scan_start(struct ieee80211_local *local, | 232 | drv_sched_scan_start(struct ieee80211_local *local, |
223 | struct ieee80211_sub_if_data *sdata, | 233 | struct ieee80211_sub_if_data *sdata, |
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index ed9edcbd9aa5..3cb6795e926d 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -460,6 +460,12 @@ DEFINE_EVENT(local_sdata_evt, drv_hw_scan, | |||
460 | TP_ARGS(local, sdata) | 460 | TP_ARGS(local, sdata) |
461 | ); | 461 | ); |
462 | 462 | ||
463 | DEFINE_EVENT(local_sdata_evt, drv_cancel_hw_scan, | ||
464 | TP_PROTO(struct ieee80211_local *local, | ||
465 | struct ieee80211_sub_if_data *sdata), | ||
466 | TP_ARGS(local, sdata) | ||
467 | ); | ||
468 | |||
463 | DEFINE_EVENT(local_sdata_evt, drv_sched_scan_start, | 469 | DEFINE_EVENT(local_sdata_evt, drv_sched_scan_start, |
464 | TP_PROTO(struct ieee80211_local *local, | 470 | TP_PROTO(struct ieee80211_local *local, |
465 | struct ieee80211_sub_if_data *sdata), | 471 | struct ieee80211_sub_if_data *sdata), |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 421eaa6b0c2b..56c24cabf26d 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -965,6 +965,10 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) | |||
965 | 965 | ||
966 | mutex_lock(&sdata->u.ibss.mtx); | 966 | mutex_lock(&sdata->u.ibss.mtx); |
967 | 967 | ||
968 | sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; | ||
969 | memset(sdata->u.ibss.bssid, 0, ETH_ALEN); | ||
970 | sdata->u.ibss.ssid_len = 0; | ||
971 | |||
968 | active_ibss = ieee80211_sta_active_ibss(sdata); | 972 | active_ibss = ieee80211_sta_active_ibss(sdata); |
969 | 973 | ||
970 | if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) { | 974 | if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) { |
@@ -999,8 +1003,6 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) | |||
999 | kfree_skb(skb); | 1003 | kfree_skb(skb); |
1000 | 1004 | ||
1001 | skb_queue_purge(&sdata->skb_queue); | 1005 | skb_queue_purge(&sdata->skb_queue); |
1002 | memset(sdata->u.ibss.bssid, 0, ETH_ALEN); | ||
1003 | sdata->u.ibss.ssid_len = 0; | ||
1004 | 1006 | ||
1005 | del_timer_sync(&sdata->u.ibss.timer); | 1007 | del_timer_sync(&sdata->u.ibss.timer); |
1006 | 1008 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 456cccf26b51..faca5033f061 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -232,9 +232,6 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | |||
232 | WARN_ON(!ieee80211_set_channel_type(local, sdata, channel_type)); | 232 | WARN_ON(!ieee80211_set_channel_type(local, sdata, channel_type)); |
233 | } | 233 | } |
234 | 234 | ||
235 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | ||
236 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
237 | |||
238 | /* channel_type change automatically detected */ | 235 | /* channel_type change automatically detected */ |
239 | ieee80211_hw_config(local, 0); | 236 | ieee80211_hw_config(local, 0); |
240 | 237 | ||
@@ -248,9 +245,6 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | |||
248 | rcu_read_unlock(); | 245 | rcu_read_unlock(); |
249 | } | 246 | } |
250 | 247 | ||
251 | ieee80211_wake_queues_by_reason(&sdata->local->hw, | ||
252 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
253 | |||
254 | ht_opmode = le16_to_cpu(hti->operation_mode); | 248 | ht_opmode = le16_to_cpu(hti->operation_mode); |
255 | 249 | ||
256 | /* if bss configuration changed store the new one */ | 250 | /* if bss configuration changed store the new one */ |
@@ -2212,6 +2206,7 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) | |||
2212 | add_timer(&ifmgd->chswitch_timer); | 2206 | add_timer(&ifmgd->chswitch_timer); |
2213 | ieee80211_sta_reset_beacon_monitor(sdata); | 2207 | ieee80211_sta_reset_beacon_monitor(sdata); |
2214 | ieee80211_restart_sta_timer(sdata); | 2208 | ieee80211_restart_sta_timer(sdata); |
2209 | ieee80211_queue_work(&sdata->local->hw, &sdata->u.mgd.monitor_work); | ||
2215 | } | 2210 | } |
2216 | #endif | 2211 | #endif |
2217 | 2212 | ||
@@ -2658,3 +2653,10 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, | |||
2658 | cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, gfp); | 2653 | cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, gfp); |
2659 | } | 2654 | } |
2660 | EXPORT_SYMBOL(ieee80211_cqm_rssi_notify); | 2655 | EXPORT_SYMBOL(ieee80211_cqm_rssi_notify); |
2656 | |||
2657 | unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif) | ||
2658 | { | ||
2659 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | ||
2660 | return sdata->dev->operstate; | ||
2661 | } | ||
2662 | EXPORT_SYMBOL(ieee80211_get_operstate); | ||
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index 730778a2c90c..67839eb90cc1 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c | |||
@@ -6,6 +6,28 @@ | |||
6 | #include "driver-ops.h" | 6 | #include "driver-ops.h" |
7 | #include "led.h" | 7 | #include "led.h" |
8 | 8 | ||
9 | /* return value indicates whether the driver should be further notified */ | ||
10 | static bool ieee80211_quiesce(struct ieee80211_sub_if_data *sdata) | ||
11 | { | ||
12 | switch (sdata->vif.type) { | ||
13 | case NL80211_IFTYPE_STATION: | ||
14 | ieee80211_sta_quiesce(sdata); | ||
15 | return true; | ||
16 | case NL80211_IFTYPE_ADHOC: | ||
17 | ieee80211_ibss_quiesce(sdata); | ||
18 | return true; | ||
19 | case NL80211_IFTYPE_MESH_POINT: | ||
20 | ieee80211_mesh_quiesce(sdata); | ||
21 | return true; | ||
22 | case NL80211_IFTYPE_AP_VLAN: | ||
23 | case NL80211_IFTYPE_MONITOR: | ||
24 | /* don't tell driver about this */ | ||
25 | return false; | ||
26 | default: | ||
27 | return true; | ||
28 | } | ||
29 | } | ||
30 | |||
9 | int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | 31 | int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) |
10 | { | 32 | { |
11 | struct ieee80211_local *local = hw_to_local(hw); | 33 | struct ieee80211_local *local = hw_to_local(hw); |
@@ -54,6 +76,10 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | |||
54 | local->quiescing = false; | 76 | local->quiescing = false; |
55 | return err; | 77 | return err; |
56 | } | 78 | } |
79 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
80 | cancel_work_sync(&sdata->work); | ||
81 | ieee80211_quiesce(sdata); | ||
82 | } | ||
57 | goto suspend; | 83 | goto suspend; |
58 | } | 84 | } |
59 | 85 | ||
@@ -82,23 +108,8 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | |||
82 | list_for_each_entry(sdata, &local->interfaces, list) { | 108 | list_for_each_entry(sdata, &local->interfaces, list) { |
83 | cancel_work_sync(&sdata->work); | 109 | cancel_work_sync(&sdata->work); |
84 | 110 | ||
85 | switch(sdata->vif.type) { | 111 | if (!ieee80211_quiesce(sdata)) |
86 | case NL80211_IFTYPE_STATION: | ||
87 | ieee80211_sta_quiesce(sdata); | ||
88 | break; | ||
89 | case NL80211_IFTYPE_ADHOC: | ||
90 | ieee80211_ibss_quiesce(sdata); | ||
91 | break; | ||
92 | case NL80211_IFTYPE_MESH_POINT: | ||
93 | ieee80211_mesh_quiesce(sdata); | ||
94 | break; | ||
95 | case NL80211_IFTYPE_AP_VLAN: | ||
96 | case NL80211_IFTYPE_MONITOR: | ||
97 | /* don't tell driver about this */ | ||
98 | continue; | 112 | continue; |
99 | default: | ||
100 | break; | ||
101 | } | ||
102 | 113 | ||
103 | if (!ieee80211_sdata_running(sdata)) | 114 | if (!ieee80211_sdata_running(sdata)) |
104 | continue; | 115 | continue; |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 58ffa7d069c7..1758b463c583 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -821,10 +821,8 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, | |||
821 | */ | 821 | */ |
822 | void ieee80211_scan_cancel(struct ieee80211_local *local) | 822 | void ieee80211_scan_cancel(struct ieee80211_local *local) |
823 | { | 823 | { |
824 | bool abortscan; | ||
825 | |||
826 | /* | 824 | /* |
827 | * We are only canceling software scan, or deferred scan that was not | 825 | * We are canceling software scan, or deferred scan that was not |
828 | * yet really started (see __ieee80211_start_scan ). | 826 | * yet really started (see __ieee80211_start_scan ). |
829 | * | 827 | * |
830 | * Regarding hardware scan: | 828 | * Regarding hardware scan: |
@@ -836,23 +834,30 @@ void ieee80211_scan_cancel(struct ieee80211_local *local) | |||
836 | * - we can not cancel scan_work since driver can schedule it | 834 | * - we can not cancel scan_work since driver can schedule it |
837 | * by ieee80211_scan_completed(..., true) to finish scan | 835 | * by ieee80211_scan_completed(..., true) to finish scan |
838 | * | 836 | * |
839 | * Hence low lever driver is responsible for canceling HW scan. | 837 | * Hence we only call the cancel_hw_scan() callback, but the low-level |
838 | * driver is still responsible for calling ieee80211_scan_completed() | ||
839 | * after the scan was completed/aborted. | ||
840 | */ | 840 | */ |
841 | 841 | ||
842 | mutex_lock(&local->mtx); | 842 | mutex_lock(&local->mtx); |
843 | abortscan = local->scan_req && !test_bit(SCAN_HW_SCANNING, &local->scanning); | 843 | if (!local->scan_req) |
844 | if (abortscan) { | 844 | goto out; |
845 | /* | 845 | |
846 | * The scan is canceled, but stop work from being pending. | 846 | if (test_bit(SCAN_HW_SCANNING, &local->scanning)) { |
847 | * | 847 | if (local->ops->cancel_hw_scan) |
848 | * If the work is currently running, it must be blocked on | 848 | drv_cancel_hw_scan(local, local->scan_sdata); |
849 | * the mutex, but we'll set scan_sdata = NULL and it'll | 849 | goto out; |
850 | * simply exit once it acquires the mutex. | ||
851 | */ | ||
852 | cancel_delayed_work(&local->scan_work); | ||
853 | /* and clean up */ | ||
854 | __ieee80211_scan_completed(&local->hw, true, false); | ||
855 | } | 850 | } |
851 | |||
852 | /* | ||
853 | * If the work is currently running, it must be blocked on | ||
854 | * the mutex, but we'll set scan_sdata = NULL and it'll | ||
855 | * simply exit once it acquires the mutex. | ||
856 | */ | ||
857 | cancel_delayed_work(&local->scan_work); | ||
858 | /* and clean up */ | ||
859 | __ieee80211_scan_completed(&local->hw, true, false); | ||
860 | out: | ||
856 | mutex_unlock(&local->mtx); | 861 | mutex_unlock(&local->mtx); |
857 | } | 862 | } |
858 | 863 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index d3fe2d237485..05e3fb889d77 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1276,7 +1276,9 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1276 | if (ieee80211_sdata_running(sdata)) | 1276 | if (ieee80211_sdata_running(sdata)) |
1277 | ieee80211_enable_keys(sdata); | 1277 | ieee80211_enable_keys(sdata); |
1278 | 1278 | ||
1279 | #ifdef CONFIG_PM | ||
1279 | wake_up: | 1280 | wake_up: |
1281 | #endif | ||
1280 | ieee80211_wake_queues_by_reason(hw, | 1282 | ieee80211_wake_queues_by_reason(hw, |
1281 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); | 1283 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); |
1282 | 1284 | ||
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 493b939970cd..3633ab6af184 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -170,7 +170,9 @@ void __cfg80211_send_deauth(struct net_device *dev, | |||
170 | break; | 170 | break; |
171 | } | 171 | } |
172 | if (wdev->authtry_bsses[i] && | 172 | if (wdev->authtry_bsses[i] && |
173 | memcmp(wdev->authtry_bsses[i]->pub.bssid, bssid, ETH_ALEN) == 0) { | 173 | memcmp(wdev->authtry_bsses[i]->pub.bssid, bssid, |
174 | ETH_ALEN) == 0 && | ||
175 | memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) == 0) { | ||
174 | cfg80211_unhold_bss(wdev->authtry_bsses[i]); | 176 | cfg80211_unhold_bss(wdev->authtry_bsses[i]); |
175 | cfg80211_put_bss(&wdev->authtry_bsses[i]->pub); | 177 | cfg80211_put_bss(&wdev->authtry_bsses[i]->pub); |
176 | wdev->authtry_bsses[i] = NULL; | 178 | wdev->authtry_bsses[i] = NULL; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 70cbc8ca371e..10823e2b60ce 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -3406,11 +3406,11 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
3406 | i = 0; | 3406 | i = 0; |
3407 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { | 3407 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { |
3408 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) { | 3408 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) { |
3409 | request->ssids[i].ssid_len = nla_len(attr); | 3409 | if (nla_len(attr) > IEEE80211_MAX_SSID_LEN) { |
3410 | if (request->ssids[i].ssid_len > IEEE80211_MAX_SSID_LEN) { | ||
3411 | err = -EINVAL; | 3410 | err = -EINVAL; |
3412 | goto out_free; | 3411 | goto out_free; |
3413 | } | 3412 | } |
3413 | request->ssids[i].ssid_len = nla_len(attr); | ||
3414 | memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); | 3414 | memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); |
3415 | i++; | 3415 | i++; |
3416 | } | 3416 | } |
@@ -3572,12 +3572,11 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
3572 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { | 3572 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { |
3573 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], | 3573 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], |
3574 | tmp) { | 3574 | tmp) { |
3575 | request->ssids[i].ssid_len = nla_len(attr); | 3575 | if (nla_len(attr) > IEEE80211_MAX_SSID_LEN) { |
3576 | if (request->ssids[i].ssid_len > | ||
3577 | IEEE80211_MAX_SSID_LEN) { | ||
3578 | err = -EINVAL; | 3576 | err = -EINVAL; |
3579 | goto out_free; | 3577 | goto out_free; |
3580 | } | 3578 | } |
3579 | request->ssids[i].ssid_len = nla_len(attr); | ||
3581 | memcpy(request->ssids[i].ssid, nla_data(attr), | 3580 | memcpy(request->ssids[i].ssid, nla_data(attr), |
3582 | nla_len(attr)); | 3581 | nla_len(attr)); |
3583 | i++; | 3582 | i++; |