aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bcma/bcma_private.h4
-rw-r--r--drivers/bcma/driver_chipcommon.c10
-rw-r--r--drivers/bcma/driver_chipcommon_pmu.c39
-rw-r--r--drivers/bcma/driver_mips.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c17
-rw-r--r--drivers/net/wireless/ath/ath5k/mac80211-ops.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h172
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c66
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.h6
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c87
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.h29
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9340_initvals.h6
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c29
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_4k.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_9287.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_def.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h7
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c60
-rw-r--r--drivers/net/wireless/ath/ath9k/link.c22
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c2
-rw-r--r--drivers/net/wireless/ath/carl9170/rx.c2
-rw-r--r--drivers/net/wireless/b43/dma.c7
-rw-r--r--drivers/net/wireless/b43/main.c12
-rw-r--r--drivers/net/wireless/b43/pio.c4
-rw-r--r--drivers/net/wireless/b43legacy/b43legacy.h5
-rw-r--r--drivers/net/wireless/b43legacy/main.c37
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c15
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c44
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd.h1
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h92
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c25
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c40
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c5
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h35
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c57
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c205
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/fweh.c84
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/fweh.h142
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/fwil.c14
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c14
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c91
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c817
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h70
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/aiutils.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c1
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c13
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/calib.c14
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/debugfs.c12
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/dev.h2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/devices.c8
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/lib.c8
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/mac80211.c12
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/main.c57
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rs.c44
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rxon.c4
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/scan.c13
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/sta.c12
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/tx.c67
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/ucode.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-config.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-devtrace.h34
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c84
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h45
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.c40
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.h10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h22
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/1000.c8
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/2000.c16
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/5000.c12
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/6000.c28
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c11
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/rx.c14
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c18
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c7
-rw-r--r--drivers/ssb/main.c3
-rw-r--r--include/linux/ath9k_platform.h2
-rw-r--r--include/linux/ieee80211.h54
-rw-r--r--include/net/mac80211.h5
-rw-r--r--net/mac80211/agg-tx.c2
-rw-r--r--net/mac80211/debugfs_key.c17
-rw-r--r--net/mac80211/ibss.c14
-rw-r--r--net/mac80211/iface.c2
-rw-r--r--net/mac80211/key.h3
-rw-r--r--net/mac80211/mlme.c4
-rw-r--r--net/mac80211/rc80211_minstrel.c9
-rw-r--r--net/mac80211/rx.c9
-rw-r--r--net/mac80211/scan.c2
-rw-r--r--net/mac80211/status.c6
-rw-r--r--net/mac80211/wpa.c5
-rw-r--r--net/wireless/chan.c3
-rw-r--r--net/wireless/wext-compat.c2
101 files changed, 1741 insertions, 1472 deletions
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index bcb830ec4bb4..537ae53231cd 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -48,8 +48,8 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
48#endif /* CONFIG_BCMA_DRIVER_MIPS */ 48#endif /* CONFIG_BCMA_DRIVER_MIPS */
49 49
50/* driver_chipcommon_pmu.c */ 50/* driver_chipcommon_pmu.c */
51u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc); 51u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
52u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc); 52u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
53 53
54#ifdef CONFIG_BCMA_SFLASH 54#ifdef CONFIG_BCMA_SFLASH
55/* driver_chipcommon_sflash.c */ 55/* driver_chipcommon_sflash.c */
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index d017f2512275..dc96dd8ebff2 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -25,10 +25,10 @@ static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
25 return value; 25 return value;
26} 26}
27 27
28static u32 bcma_chipco_alp_clock(struct bcma_drv_cc *cc) 28static u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc)
29{ 29{
30 if (cc->capabilities & BCMA_CC_CAP_PMU) 30 if (cc->capabilities & BCMA_CC_CAP_PMU)
31 return bcma_pmu_alp_clock(cc); 31 return bcma_pmu_get_alp_clock(cc);
32 32
33 return 20000000; 33 return 20000000;
34} 34}
@@ -79,12 +79,12 @@ static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc)
79 if (cc->capabilities & BCMA_CC_CAP_PMU) { 79 if (cc->capabilities & BCMA_CC_CAP_PMU) {
80 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) 80 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
81 /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */ 81 /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */
82 return bcma_chipco_alp_clock(cc) / 4000; 82 return bcma_chipco_get_alp_clock(cc) / 4000;
83 else 83 else
84 /* based on 32KHz ILP clock */ 84 /* based on 32KHz ILP clock */
85 return 32; 85 return 32;
86 } else { 86 } else {
87 return bcma_chipco_alp_clock(cc) / 1000; 87 return bcma_chipco_get_alp_clock(cc) / 1000;
88 } 88 }
89} 89}
90 90
@@ -236,7 +236,7 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
236 struct bcma_serial_port *ports = cc->serial_ports; 236 struct bcma_serial_port *ports = cc->serial_ports;
237 237
238 if (ccrev >= 11 && ccrev != 15) { 238 if (ccrev >= 11 && ccrev != 15) {
239 baud_base = bcma_chipco_alp_clock(cc); 239 baud_base = bcma_chipco_get_alp_clock(cc);
240 if (ccrev >= 21) { 240 if (ccrev >= 21) {
241 /* Turn off UART clock before switching clocksource. */ 241 /* Turn off UART clock before switching clocksource. */
242 bcma_cc_write32(cc, BCMA_CC_CORECTL, 242 bcma_cc_write32(cc, BCMA_CC_CORECTL,
diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
index a63ddd9c70eb..e162999bf916 100644
--- a/drivers/bcma/driver_chipcommon_pmu.c
+++ b/drivers/bcma/driver_chipcommon_pmu.c
@@ -168,7 +168,7 @@ void bcma_pmu_init(struct bcma_drv_cc *cc)
168 bcma_pmu_workarounds(cc); 168 bcma_pmu_workarounds(cc);
169} 169}
170 170
171u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc) 171u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc)
172{ 172{
173 struct bcma_bus *bus = cc->core->bus; 173 struct bcma_bus *bus = cc->core->bus;
174 174
@@ -196,7 +196,7 @@ u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc)
196/* Find the output of the "m" pll divider given pll controls that start with 196/* Find the output of the "m" pll divider given pll controls that start with
197 * pllreg "pll0" i.e. 12 for main 6 for phy, 0 for misc. 197 * pllreg "pll0" i.e. 12 for main 6 for phy, 0 for misc.
198 */ 198 */
199static u32 bcma_pmu_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m) 199static u32 bcma_pmu_pll_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m)
200{ 200{
201 u32 tmp, div, ndiv, p1, p2, fc; 201 u32 tmp, div, ndiv, p1, p2, fc;
202 struct bcma_bus *bus = cc->core->bus; 202 struct bcma_bus *bus = cc->core->bus;
@@ -225,14 +225,14 @@ static u32 bcma_pmu_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m)
225 ndiv = (tmp & BCMA_CC_PPL_NDIV_MASK) >> BCMA_CC_PPL_NDIV_SHIFT; 225 ndiv = (tmp & BCMA_CC_PPL_NDIV_MASK) >> BCMA_CC_PPL_NDIV_SHIFT;
226 226
227 /* Do calculation in Mhz */ 227 /* Do calculation in Mhz */
228 fc = bcma_pmu_alp_clock(cc) / 1000000; 228 fc = bcma_pmu_get_alp_clock(cc) / 1000000;
229 fc = (p1 * ndiv * fc) / p2; 229 fc = (p1 * ndiv * fc) / p2;
230 230
231 /* Return clock in Hertz */ 231 /* Return clock in Hertz */
232 return (fc / div) * 1000000; 232 return (fc / div) * 1000000;
233} 233}
234 234
235static u32 bcma_pmu_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m) 235static u32 bcma_pmu_pll_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m)
236{ 236{
237 u32 tmp, ndiv, p1div, p2div; 237 u32 tmp, ndiv, p1div, p2div;
238 u32 clock; 238 u32 clock;
@@ -263,7 +263,7 @@ static u32 bcma_pmu_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m)
263} 263}
264 264
265/* query bus clock frequency for PMU-enabled chipcommon */ 265/* query bus clock frequency for PMU-enabled chipcommon */
266static u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc) 266static u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc)
267{ 267{
268 struct bcma_bus *bus = cc->core->bus; 268 struct bcma_bus *bus = cc->core->bus;
269 269
@@ -271,40 +271,42 @@ static u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)
271 case BCMA_CHIP_ID_BCM4716: 271 case BCMA_CHIP_ID_BCM4716:
272 case BCMA_CHIP_ID_BCM4748: 272 case BCMA_CHIP_ID_BCM4748:
273 case BCMA_CHIP_ID_BCM47162: 273 case BCMA_CHIP_ID_BCM47162:
274 return bcma_pmu_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0, 274 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0,
275 BCMA_CC_PMU5_MAINPLL_SSB); 275 BCMA_CC_PMU5_MAINPLL_SSB);
276 case BCMA_CHIP_ID_BCM5356: 276 case BCMA_CHIP_ID_BCM5356:
277 return bcma_pmu_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0, 277 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0,
278 BCMA_CC_PMU5_MAINPLL_SSB); 278 BCMA_CC_PMU5_MAINPLL_SSB);
279 case BCMA_CHIP_ID_BCM5357: 279 case BCMA_CHIP_ID_BCM5357:
280 case BCMA_CHIP_ID_BCM4749: 280 case BCMA_CHIP_ID_BCM4749:
281 return bcma_pmu_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0, 281 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0,
282 BCMA_CC_PMU5_MAINPLL_SSB); 282 BCMA_CC_PMU5_MAINPLL_SSB);
283 case BCMA_CHIP_ID_BCM4706: 283 case BCMA_CHIP_ID_BCM4706:
284 return bcma_pmu_clock_bcm4706(cc, BCMA_CC_PMU4706_MAINPLL_PLL0, 284 return bcma_pmu_pll_clock_bcm4706(cc,
285 BCMA_CC_PMU5_MAINPLL_SSB); 285 BCMA_CC_PMU4706_MAINPLL_PLL0,
286 BCMA_CC_PMU5_MAINPLL_SSB);
286 case BCMA_CHIP_ID_BCM53572: 287 case BCMA_CHIP_ID_BCM53572:
287 return 75000000; 288 return 75000000;
288 default: 289 default:
289 bcma_warn(bus, "No backplane clock specified for %04X device, pmu rev. %d, using default %d Hz\n", 290 bcma_warn(bus, "No bus clock specified for %04X device, pmu rev. %d, using default %d Hz\n",
290 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_HT_CLOCK); 291 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_HT_CLOCK);
291 } 292 }
292 return BCMA_CC_PMU_HT_CLOCK; 293 return BCMA_CC_PMU_HT_CLOCK;
293} 294}
294 295
295/* query cpu clock frequency for PMU-enabled chipcommon */ 296/* query cpu clock frequency for PMU-enabled chipcommon */
296u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc) 297u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc)
297{ 298{
298 struct bcma_bus *bus = cc->core->bus; 299 struct bcma_bus *bus = cc->core->bus;
299 300
300 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) 301 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53572)
301 return 300000000; 302 return 300000000;
302 303
304 /* New PMUs can have different clock for bus and CPU */
303 if (cc->pmu.rev >= 5) { 305 if (cc->pmu.rev >= 5) {
304 u32 pll; 306 u32 pll;
305 switch (bus->chipinfo.id) { 307 switch (bus->chipinfo.id) {
306 case BCMA_CHIP_ID_BCM4706: 308 case BCMA_CHIP_ID_BCM4706:
307 return bcma_pmu_clock_bcm4706(cc, 309 return bcma_pmu_pll_clock_bcm4706(cc,
308 BCMA_CC_PMU4706_MAINPLL_PLL0, 310 BCMA_CC_PMU4706_MAINPLL_PLL0,
309 BCMA_CC_PMU5_MAINPLL_CPU); 311 BCMA_CC_PMU5_MAINPLL_CPU);
310 case BCMA_CHIP_ID_BCM5356: 312 case BCMA_CHIP_ID_BCM5356:
@@ -319,10 +321,11 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc)
319 break; 321 break;
320 } 322 }
321 323
322 return bcma_pmu_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU); 324 return bcma_pmu_pll_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU);
323 } 325 }
324 326
325 return bcma_pmu_get_clockcontrol(cc); 327 /* On old PMUs CPU has the same clock as the bus */
328 return bcma_pmu_get_bus_clock(cc);
326} 329}
327 330
328static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset, 331static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset,
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
index 170822ea51c7..792daad28cbc 100644
--- a/drivers/bcma/driver_mips.c
+++ b/drivers/bcma/driver_mips.c
@@ -115,7 +115,7 @@ static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq)
115 bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) & 115 bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) &
116 ~(1 << irqflag)); 116 ~(1 << irqflag));
117 else 117 else
118 bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq), 0); 118 bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0);
119 119
120 /* assign the new one */ 120 /* assign the new one */
121 if (irq == 0) { 121 if (irq == 0) {
@@ -171,7 +171,7 @@ u32 bcma_cpu_clock(struct bcma_drv_mips *mcore)
171 struct bcma_bus *bus = mcore->core->bus; 171 struct bcma_bus *bus = mcore->core->bus;
172 172
173 if (bus->drv_cc.capabilities & BCMA_CC_CAP_PMU) 173 if (bus->drv_cc.capabilities & BCMA_CC_CAP_PMU)
174 return bcma_pmu_get_clockcpu(&bus->drv_cc); 174 return bcma_pmu_get_cpu_clock(&bus->drv_cc);
175 175
176 bcma_err(bus, "No PMU available, need this to get the cpu clock\n"); 176 bcma_err(bus, "No PMU available, need this to get the cpu clock\n");
177 return 0; 177 return 0;
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 3a5a61e03922..30ca0a60a64c 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -849,7 +849,7 @@ ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf)
849 return; 849 return;
850 dma_unmap_single(ah->dev, bf->skbaddr, bf->skb->len, 850 dma_unmap_single(ah->dev, bf->skbaddr, bf->skb->len,
851 DMA_TO_DEVICE); 851 DMA_TO_DEVICE);
852 dev_kfree_skb_any(bf->skb); 852 ieee80211_free_txskb(ah->hw, bf->skb);
853 bf->skb = NULL; 853 bf->skb = NULL;
854 bf->skbaddr = 0; 854 bf->skbaddr = 0;
855 bf->desc->ds_data = 0; 855 bf->desc->ds_data = 0;
@@ -1336,20 +1336,9 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb,
1336 * 15bit only. that means TSF extension has to be done within 1336 * 15bit only. that means TSF extension has to be done within
1337 * 32768usec (about 32ms). it might be necessary to move this to 1337 * 32768usec (about 32ms). it might be necessary to move this to
1338 * the interrupt handler, like it is done in madwifi. 1338 * the interrupt handler, like it is done in madwifi.
1339 *
1340 * Unfortunately we don't know when the hardware takes the rx
1341 * timestamp (beginning of phy frame, data frame, end of rx?).
1342 * The only thing we know is that it is hardware specific...
1343 * On AR5213 it seems the rx timestamp is at the end of the
1344 * frame, but I'm not sure.
1345 *
1346 * NOTE: mac80211 defines mactime at the beginning of the first
1347 * data symbol. Since we don't have any time references it's
1348 * impossible to comply to that. This affects IBSS merge only
1349 * right now, so it's not too bad...
1350 */ 1339 */
1351 rxs->mactime = ath5k_extend_tsf(ah, rs->rs_tstamp); 1340 rxs->mactime = ath5k_extend_tsf(ah, rs->rs_tstamp);
1352 rxs->flag |= RX_FLAG_MACTIME_START; 1341 rxs->flag |= RX_FLAG_MACTIME_END;
1353 1342
1354 rxs->freq = ah->curchan->center_freq; 1343 rxs->freq = ah->curchan->center_freq;
1355 rxs->band = ah->curchan->band; 1344 rxs->band = ah->curchan->band;
@@ -1576,7 +1565,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
1576 return; 1565 return;
1577 1566
1578drop_packet: 1567drop_packet:
1579 dev_kfree_skb_any(skb); 1568 ieee80211_free_txskb(hw, skb);
1580} 1569}
1581 1570
1582static void 1571static void
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index 1ea8c8795c8e..4264341533ea 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -62,7 +62,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
62 u16 qnum = skb_get_queue_mapping(skb); 62 u16 qnum = skb_get_queue_mapping(skb);
63 63
64 if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) { 64 if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) {
65 dev_kfree_skb_any(skb); 65 ieee80211_free_txskb(hw, skb);
66 return; 66 return;
67 } 67 }
68 68
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
index 6f7cf49eff4d..262e1e036fd7 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
@@ -534,98 +534,98 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
534 534
535static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { 535static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
536 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 536 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
537 {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, 537 {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
538 {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, 538 {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
539 {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, 539 {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
540 {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, 540 {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
541 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, 541 {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9},
542 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 542 {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
543 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, 543 {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002},
544 {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, 544 {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004},
545 {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, 545 {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200},
546 {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, 546 {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202},
547 {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, 547 {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400},
548 {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, 548 {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402},
549 {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, 549 {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404},
550 {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, 550 {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603},
551 {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, 551 {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02},
552 {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, 552 {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04},
553 {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, 553 {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20},
554 {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, 554 {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20},
555 {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, 555 {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22},
556 {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, 556 {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24},
557 {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, 557 {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640},
558 {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, 558 {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660},
559 {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861}, 559 {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861},
560 {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81}, 560 {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81},
561 {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83}, 561 {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83},
562 {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84}, 562 {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84},
563 {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3}, 563 {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3},
564 {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5}, 564 {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5},
565 {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9}, 565 {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9},
566 {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb}, 566 {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb},
567 {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, 567 {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
568 {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, 568 {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
569 {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, 569 {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
570 {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, 570 {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
571 {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, 571 {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
572 {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, 572 {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
573 {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, 573 {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
574 {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, 574 {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
575 {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, 575 {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002},
576 {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, 576 {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004},
577 {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, 577 {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200},
578 {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, 578 {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202},
579 {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, 579 {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400},
580 {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, 580 {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402},
581 {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, 581 {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404},
582 {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, 582 {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603},
583 {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, 583 {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02},
584 {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, 584 {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04},
585 {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, 585 {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20},
586 {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, 586 {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20},
587 {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, 587 {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22},
588 {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, 588 {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24},
589 {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, 589 {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640},
590 {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, 590 {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660},
591 {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861}, 591 {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861},
592 {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81}, 592 {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81},
593 {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83}, 593 {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83},
594 {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84}, 594 {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84},
595 {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3}, 595 {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3},
596 {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5}, 596 {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5},
597 {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9}, 597 {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9},
598 {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb}, 598 {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb},
599 {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, 599 {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
600 {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, 600 {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
601 {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, 601 {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
602 {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, 602 {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
603 {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, 603 {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
604 {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, 604 {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
605 {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, 605 {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
606 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 606 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
607 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 607 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
608 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 608 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
609 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 609 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
610 {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 610 {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000},
611 {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000}, 611 {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000},
612 {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501}, 612 {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501},
613 {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501}, 613 {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501},
614 {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03}, 614 {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03},
615 {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04}, 615 {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04},
616 {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04}, 616 {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04},
617 {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, 617 {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
618 {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, 618 {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
619 {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, 619 {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
620 {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, 620 {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
621 {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, 621 {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
622 {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, 622 {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
623 {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, 623 {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
624 {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, 624 {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
625 {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, 625 {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
626 {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, 626 {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
627 {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, 627 {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
628 {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, 628 {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
629 {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, 629 {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
630 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, 630 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
631 {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, 631 {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index c86cb6400040..562186ca9b52 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -2987,10 +2987,6 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
2987 case EEP_RX_MASK: 2987 case EEP_RX_MASK:
2988 return pBase->txrxMask & 0xf; 2988 return pBase->txrxMask & 0xf;
2989 case EEP_PAPRD: 2989 case EEP_PAPRD:
2990 if (AR_SREV_9462(ah))
2991 return false;
2992 if (!ah->config.enable_paprd)
2993 return false;
2994 return !!(pBase->featureEnable & BIT(5)); 2990 return !!(pBase->featureEnable & BIT(5));
2995 case EEP_CHAIN_MASK_REDUCE: 2991 case EEP_CHAIN_MASK_REDUCE:
2996 return (pBase->miscConfiguration >> 0x3) & 0x1; 2992 return (pBase->miscConfiguration >> 0x3) & 0x1;
@@ -3005,24 +3001,24 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
3005 } 3001 }
3006} 3002}
3007 3003
3008static bool ar9300_eeprom_read_byte(struct ath_common *common, int address, 3004static bool ar9300_eeprom_read_byte(struct ath_hw *ah, int address,
3009 u8 *buffer) 3005 u8 *buffer)
3010{ 3006{
3011 u16 val; 3007 u16 val;
3012 3008
3013 if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val))) 3009 if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val)))
3014 return false; 3010 return false;
3015 3011
3016 *buffer = (val >> (8 * (address % 2))) & 0xff; 3012 *buffer = (val >> (8 * (address % 2))) & 0xff;
3017 return true; 3013 return true;
3018} 3014}
3019 3015
3020static bool ar9300_eeprom_read_word(struct ath_common *common, int address, 3016static bool ar9300_eeprom_read_word(struct ath_hw *ah, int address,
3021 u8 *buffer) 3017 u8 *buffer)
3022{ 3018{
3023 u16 val; 3019 u16 val;
3024 3020
3025 if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val))) 3021 if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val)))
3026 return false; 3022 return false;
3027 3023
3028 buffer[0] = val >> 8; 3024 buffer[0] = val >> 8;
@@ -3048,14 +3044,14 @@ static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer,
3048 * the 16-bit word at that address 3044 * the 16-bit word at that address
3049 */ 3045 */
3050 if (address % 2 == 0) { 3046 if (address % 2 == 0) {
3051 if (!ar9300_eeprom_read_byte(common, address--, buffer++)) 3047 if (!ar9300_eeprom_read_byte(ah, address--, buffer++))
3052 goto error; 3048 goto error;
3053 3049
3054 count--; 3050 count--;
3055 } 3051 }
3056 3052
3057 for (i = 0; i < count / 2; i++) { 3053 for (i = 0; i < count / 2; i++) {
3058 if (!ar9300_eeprom_read_word(common, address, buffer)) 3054 if (!ar9300_eeprom_read_word(ah, address, buffer))
3059 goto error; 3055 goto error;
3060 3056
3061 address -= 2; 3057 address -= 2;
@@ -3063,7 +3059,7 @@ static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer,
3063 } 3059 }
3064 3060
3065 if (count % 2) 3061 if (count % 2)
3066 if (!ar9300_eeprom_read_byte(common, address, buffer)) 3062 if (!ar9300_eeprom_read_byte(ah, address, buffer))
3067 goto error; 3063 goto error;
3068 3064
3069 return true; 3065 return true;
@@ -3240,12 +3236,11 @@ static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read,
3240static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr, 3236static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
3241 int mdata_size) 3237 int mdata_size)
3242{ 3238{
3243 struct ath_common *common = ath9k_hw_common(ah);
3244 u16 *data = (u16 *) mptr; 3239 u16 *data = (u16 *) mptr;
3245 int i; 3240 int i;
3246 3241
3247 for (i = 0; i < mdata_size / 2; i++, data++) 3242 for (i = 0; i < mdata_size / 2; i++, data++)
3248 ath9k_hw_nvram_read(common, i, data); 3243 ath9k_hw_nvram_read(ah, i, data);
3249 3244
3250 return 0; 3245 return 0;
3251} 3246}
@@ -5076,6 +5071,33 @@ static inline u8 mcsidx_to_tgtpwridx(unsigned int mcs_idx, u8 base_pwridx)
5076 return base_pwridx + 4 * (mcs_idx / 8) + mod_idx - 2; 5071 return base_pwridx + 4 * (mcs_idx / 8) + mod_idx - 2;
5077} 5072}
5078 5073
5074static void ar9003_paprd_set_txpower(struct ath_hw *ah,
5075 struct ath9k_channel *chan,
5076 u8 *targetPowerValT2)
5077{
5078 int i;
5079
5080 if (!ar9003_is_paprd_enabled(ah))
5081 return;
5082
5083 if (IS_CHAN_HT40(chan))
5084 i = ALL_TARGET_HT40_7;
5085 else
5086 i = ALL_TARGET_HT20_7;
5087
5088 if (IS_CHAN_2GHZ(chan)) {
5089 if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) &&
5090 !AR_SREV_9462(ah) && !AR_SREV_9565(ah)) {
5091 if (IS_CHAN_HT40(chan))
5092 i = ALL_TARGET_HT40_0_8_16;
5093 else
5094 i = ALL_TARGET_HT20_0_8_16;
5095 }
5096 }
5097
5098 ah->paprd_target_power = targetPowerValT2[i];
5099}
5100
5079static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah, 5101static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
5080 struct ath9k_channel *chan, u16 cfgCtl, 5102 struct ath9k_channel *chan, u16 cfgCtl,
5081 u8 twiceAntennaReduction, 5103 u8 twiceAntennaReduction,
@@ -5097,7 +5119,7 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
5097 */ 5119 */
5098 ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2); 5120 ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2);
5099 5121
5100 if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) { 5122 if (ar9003_is_paprd_enabled(ah)) {
5101 if (IS_CHAN_2GHZ(chan)) 5123 if (IS_CHAN_2GHZ(chan))
5102 modal_hdr = &eep->modalHeader2G; 5124 modal_hdr = &eep->modalHeader2G;
5103 else 5125 else
@@ -5138,7 +5160,7 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
5138 twiceAntennaReduction, 5160 twiceAntennaReduction,
5139 powerLimit); 5161 powerLimit);
5140 5162
5141 if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) { 5163 if (ar9003_is_paprd_enabled(ah)) {
5142 for (i = 0; i < ar9300RateSize; i++) { 5164 for (i = 0; i < ar9300RateSize; i++) {
5143 if ((ah->paprd_ratemask & (1 << i)) && 5165 if ((ah->paprd_ratemask & (1 << i)) &&
5144 (abs(targetPowerValT2[i] - 5166 (abs(targetPowerValT2[i] -
@@ -5170,19 +5192,7 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
5170 /* Write target power array to registers */ 5192 /* Write target power array to registers */
5171 ar9003_hw_tx_power_regwrite(ah, targetPowerValT2); 5193 ar9003_hw_tx_power_regwrite(ah, targetPowerValT2);
5172 ar9003_hw_calibration_apply(ah, chan->channel); 5194 ar9003_hw_calibration_apply(ah, chan->channel);
5173 5195 ar9003_paprd_set_txpower(ah, chan, targetPowerValT2);
5174 if (IS_CHAN_2GHZ(chan)) {
5175 if (IS_CHAN_HT40(chan))
5176 i = ALL_TARGET_HT40_0_8_16;
5177 else
5178 i = ALL_TARGET_HT20_0_8_16;
5179 } else {
5180 if (IS_CHAN_HT40(chan))
5181 i = ALL_TARGET_HT40_7;
5182 else
5183 i = ALL_TARGET_HT20_7;
5184 }
5185 ah->paprd_target_power = targetPowerValT2[i];
5186} 5196}
5187 5197
5188static u16 ath9k_hw_ar9300_get_spur_channel(struct ath_hw *ah, 5198static u16 ath9k_hw_ar9300_get_spur_channel(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
index 41b1a75e6bec..54ba42f4108a 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
@@ -68,13 +68,13 @@
68#define AR9300_BASE_ADDR 0x3ff 68#define AR9300_BASE_ADDR 0x3ff
69#define AR9300_BASE_ADDR_512 0x1ff 69#define AR9300_BASE_ADDR_512 0x1ff
70 70
71#define AR9300_OTP_BASE 0x14000 71#define AR9300_OTP_BASE (AR_SREV_9340(ah) ? 0x30000 : 0x14000)
72#define AR9300_OTP_STATUS 0x15f18 72#define AR9300_OTP_STATUS (AR_SREV_9340(ah) ? 0x30018 : 0x15f18)
73#define AR9300_OTP_STATUS_TYPE 0x7 73#define AR9300_OTP_STATUS_TYPE 0x7
74#define AR9300_OTP_STATUS_VALID 0x4 74#define AR9300_OTP_STATUS_VALID 0x4
75#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 75#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2
76#define AR9300_OTP_STATUS_SM_BUSY 0x1 76#define AR9300_OTP_STATUS_SM_BUSY 0x1
77#define AR9300_OTP_READ_DATA 0x15f1c 77#define AR9300_OTP_READ_DATA (AR_SREV_9340(ah) ? 0x3001c : 0x15f1c)
78 78
79enum targetPowerHTRates { 79enum targetPowerHTRates {
80 HT_TARGET_RATE_0_8_16, 80 HT_TARGET_RATE_0_8_16,
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index 0ed3846f9cbb..09c1f9da67a0 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -74,15 +74,23 @@ static int ar9003_get_training_power_2g(struct ath_hw *ah)
74 unsigned int power, scale, delta; 74 unsigned int power, scale, delta;
75 75
76 scale = ar9003_get_paprd_scale_factor(ah, chan); 76 scale = ar9003_get_paprd_scale_factor(ah, chan);
77 power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5,
78 AR_PHY_POWERTX_RATE5_POWERTXHT20_0);
79 77
80 delta = abs((int) ah->paprd_target_power - (int) power); 78 if (AR_SREV_9330(ah) || AR_SREV_9340(ah) ||
81 if (delta > scale) 79 AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
82 return -1; 80 power = ah->paprd_target_power + 2;
83 81 } else if (AR_SREV_9485(ah)) {
84 if (delta < 4) 82 power = 25;
85 power -= 4 - delta; 83 } else {
84 power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5,
85 AR_PHY_POWERTX_RATE5_POWERTXHT20_0);
86
87 delta = abs((int) ah->paprd_target_power - (int) power);
88 if (delta > scale)
89 return -1;
90
91 if (delta < 4)
92 power -= 4 - delta;
93 }
86 94
87 return power; 95 return power;
88} 96}
@@ -169,6 +177,9 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
169 REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK, 177 REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK,
170 ah->paprd_ratemask_ht40); 178 ah->paprd_ratemask_ht40);
171 179
180 ath_dbg(common, CALIBRATE, "PAPRD HT20 mask: 0x%x, HT40 mask: 0x%x\n",
181 ah->paprd_ratemask, ah->paprd_ratemask_ht40);
182
172 for (i = 0; i < ah->caps.max_txchains; i++) { 183 for (i = 0; i < ah->caps.max_txchains; i++) {
173 REG_RMW_FIELD(ah, ctrl0[i], 184 REG_RMW_FIELD(ah, ctrl0[i],
174 AR_PHY_PAPRD_CTRL0_USE_SINGLE_TABLE_MASK, 1); 185 AR_PHY_PAPRD_CTRL0_USE_SINGLE_TABLE_MASK, 1);
@@ -204,7 +215,20 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
204 AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING, 28); 215 AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING, 28);
205 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, 216 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1,
206 AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE, 1); 217 AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE, 1);
207 val = AR_SREV_9462(ah) ? 0x91 : 147; 218
219 if (AR_SREV_9485(ah)) {
220 val = 148;
221 } else {
222 if (IS_CHAN_2GHZ(ah->curchan)) {
223 if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
224 val = 145;
225 else
226 val = 147;
227 } else {
228 val = 137;
229 }
230 }
231
208 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL2, 232 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL2,
209 AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN, val); 233 AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN, val);
210 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 234 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
@@ -215,15 +239,24 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
215 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES, 7); 239 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES, 7);
216 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 240 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
217 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL, 1); 241 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL, 1);
218 if (AR_SREV_9485(ah) || AR_SREV_9462(ah) || AR_SREV_9550(ah)) 242
243 if (AR_SREV_9485(ah) ||
244 AR_SREV_9462(ah) ||
245 AR_SREV_9565(ah) ||
246 AR_SREV_9550(ah) ||
247 AR_SREV_9330(ah) ||
248 AR_SREV_9340(ah))
219 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 249 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
220 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, 250 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, -3);
221 -3);
222 else 251 else
223 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 252 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
224 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, 253 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, -6);
225 -6); 254
226 val = AR_SREV_9462(ah) ? -10 : -15; 255 val = -10;
256
257 if (IS_CHAN_2GHZ(ah->curchan) && !AR_SREV_9462(ah) && !AR_SREV_9565(ah))
258 val = -15;
259
227 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 260 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
228 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE, 261 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE,
229 val); 262 val);
@@ -262,9 +295,6 @@ static void ar9003_paprd_get_gain_table(struct ath_hw *ah)
262 u32 reg = AR_PHY_TXGAIN_TABLE; 295 u32 reg = AR_PHY_TXGAIN_TABLE;
263 int i; 296 int i;
264 297
265 memset(entry, 0, sizeof(ah->paprd_gain_table_entries));
266 memset(index, 0, sizeof(ah->paprd_gain_table_index));
267
268 for (i = 0; i < PAPRD_GAIN_TABLE_ENTRIES; i++) { 298 for (i = 0; i < PAPRD_GAIN_TABLE_ENTRIES; i++) {
269 entry[i] = REG_READ(ah, reg); 299 entry[i] = REG_READ(ah, reg);
270 index[i] = (entry[i] >> 24) & 0xff; 300 index[i] = (entry[i] >> 24) & 0xff;
@@ -763,7 +793,7 @@ void ar9003_paprd_populate_single_table(struct ath_hw *ah,
763} 793}
764EXPORT_SYMBOL(ar9003_paprd_populate_single_table); 794EXPORT_SYMBOL(ar9003_paprd_populate_single_table);
765 795
766int ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain) 796void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain)
767{ 797{
768 unsigned int i, desired_gain, gain_index; 798 unsigned int i, desired_gain, gain_index;
769 unsigned int train_power = ah->paprd_training_power; 799 unsigned int train_power = ah->paprd_training_power;
@@ -781,8 +811,6 @@ int ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain)
781 811
782 REG_CLR_BIT(ah, AR_PHY_PAPRD_TRAINER_STAT1, 812 REG_CLR_BIT(ah, AR_PHY_PAPRD_TRAINER_STAT1,
783 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); 813 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE);
784
785 return 0;
786} 814}
787EXPORT_SYMBOL(ar9003_paprd_setup_gain_table); 815EXPORT_SYMBOL(ar9003_paprd_setup_gain_table);
788 816
@@ -894,7 +922,7 @@ int ar9003_paprd_create_curve(struct ath_hw *ah,
894 922
895 memset(caldata->pa_table[chain], 0, sizeof(caldata->pa_table[chain])); 923 memset(caldata->pa_table[chain], 0, sizeof(caldata->pa_table[chain]));
896 924
897 buf = kmalloc(2 * 48 * sizeof(u32), GFP_ATOMIC); 925 buf = kmalloc(2 * 48 * sizeof(u32), GFP_KERNEL);
898 if (!buf) 926 if (!buf)
899 return -ENOMEM; 927 return -ENOMEM;
900 928
@@ -945,9 +973,13 @@ EXPORT_SYMBOL(ar9003_paprd_init_table);
945bool ar9003_paprd_is_done(struct ath_hw *ah) 973bool ar9003_paprd_is_done(struct ath_hw *ah)
946{ 974{
947 int paprd_done, agc2_pwr; 975 int paprd_done, agc2_pwr;
976
948 paprd_done = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1, 977 paprd_done = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1,
949 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); 978 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE);
950 979
980 if (AR_SREV_9485(ah))
981 goto exit;
982
951 if (paprd_done == 0x1) { 983 if (paprd_done == 0x1) {
952 agc2_pwr = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1, 984 agc2_pwr = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1,
953 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR); 985 AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR);
@@ -963,7 +995,16 @@ bool ar9003_paprd_is_done(struct ath_hw *ah)
963 if (agc2_pwr <= PAPRD_IDEAL_AGC2_PWR_RANGE) 995 if (agc2_pwr <= PAPRD_IDEAL_AGC2_PWR_RANGE)
964 paprd_done = 0; 996 paprd_done = 0;
965 } 997 }
966 998exit:
967 return !!paprd_done; 999 return !!paprd_done;
968} 1000}
969EXPORT_SYMBOL(ar9003_paprd_is_done); 1001EXPORT_SYMBOL(ar9003_paprd_is_done);
1002
1003bool ar9003_is_paprd_enabled(struct ath_hw *ah)
1004{
1005 if ((ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->config.enable_paprd)
1006 return true;
1007
1008 return false;
1009}
1010EXPORT_SYMBOL(ar9003_is_paprd_enabled);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
index 4c3d06de7111..107956298488 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
@@ -1145,9 +1145,8 @@
1145#define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT 0x0ffe0000 1145#define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT 0x0ffe0000
1146#define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT_S 17 1146#define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT_S 17
1147 1147
1148#define AR_PHY_PAPRD_TRAINER_CNTL1 (AR_SM_BASE + \ 1148#define AR_PHY_PAPRD_TRAINER_CNTL1 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x580 : 0x490))
1149 (AR_SREV_9485(ah) ? \ 1149
1150 0x580 : 0x490))
1151#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE 0x00000001 1150#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE 0x00000001
1152#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE_S 0 1151#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE_S 0
1153#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING 0x0000007e 1152#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING 0x0000007e
@@ -1163,15 +1162,13 @@
1163#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP 0x0003f000 1162#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP 0x0003f000
1164#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_S 12 1163#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_S 12
1165 1164
1166#define AR_PHY_PAPRD_TRAINER_CNTL2 (AR_SM_BASE + \ 1165#define AR_PHY_PAPRD_TRAINER_CNTL2 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x584 : 0x494))
1167 (AR_SREV_9485(ah) ? \ 1166
1168 0x584 : 0x494))
1169#define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN 0xFFFFFFFF 1167#define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN 0xFFFFFFFF
1170#define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_S 0 1168#define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_S 0
1171 1169
1172#define AR_PHY_PAPRD_TRAINER_CNTL3 (AR_SM_BASE + \ 1170#define AR_PHY_PAPRD_TRAINER_CNTL3 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x588 : 0x498))
1173 (AR_SREV_9485(ah) ? \ 1171
1174 0x588 : 0x498))
1175#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE 0x0000003f 1172#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE 0x0000003f
1176#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_S 0 1173#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_S 0
1177#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP 0x00000fc0 1174#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP 0x00000fc0
@@ -1187,9 +1184,8 @@
1187#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE 0x20000000 1184#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE 0x20000000
1188#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_S 29 1185#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_S 29
1189 1186
1190#define AR_PHY_PAPRD_TRAINER_CNTL4 (AR_SM_BASE + \ 1187#define AR_PHY_PAPRD_TRAINER_CNTL4 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x58c : 0x49c))
1191 (AR_SREV_9485(ah) ? \ 1188
1192 0x58c : 0x49c))
1193#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES 0x03ff0000 1189#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES 0x03ff0000
1194#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_S 16 1190#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_S 16
1195#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA 0x0000f000 1191#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA 0x0000f000
@@ -1208,7 +1204,8 @@
1208#define AR_PHY_PAPRD_PRE_POST_SCALING 0x3FFFF 1204#define AR_PHY_PAPRD_PRE_POST_SCALING 0x3FFFF
1209#define AR_PHY_PAPRD_PRE_POST_SCALING_S 0 1205#define AR_PHY_PAPRD_PRE_POST_SCALING_S 0
1210 1206
1211#define AR_PHY_PAPRD_TRAINER_STAT1 (AR_SM_BASE + 0x4a0) 1207#define AR_PHY_PAPRD_TRAINER_STAT1 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x590 : 0x4a0))
1208
1212#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE 0x00000001 1209#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE 0x00000001
1213#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_S 0 1210#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_S 0
1214#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE 0x00000002 1211#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE 0x00000002
@@ -1222,7 +1219,8 @@
1222#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR 0x0001fe00 1219#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR 0x0001fe00
1223#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_S 9 1220#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_S 9
1224 1221
1225#define AR_PHY_PAPRD_TRAINER_STAT2 (AR_SM_BASE + 0x4a4) 1222#define AR_PHY_PAPRD_TRAINER_STAT2 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x594 : 0x4a4))
1223
1226#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL 0x0000ffff 1224#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL 0x0000ffff
1227#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_S 0 1225#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_S 0
1228#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX 0x001f0000 1226#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX 0x001f0000
@@ -1230,7 +1228,8 @@
1230#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX 0x00600000 1228#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX 0x00600000
1231#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_S 21 1229#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_S 21
1232 1230
1233#define AR_PHY_PAPRD_TRAINER_STAT3 (AR_SM_BASE + 0x4a8) 1231#define AR_PHY_PAPRD_TRAINER_STAT3 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x598 : 0x4a8))
1232
1234#define AR_PHY_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT 0x000fffff 1233#define AR_PHY_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT 0x000fffff
1235#define AR_PHY_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_S 0 1234#define AR_PHY_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_S 0
1236 1235
diff --git a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h
index 1d8235e19f0f..f69d292bdc02 100644
--- a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h
@@ -211,6 +211,8 @@ static const u32 ar9340_1p0_radio_core_40M[][2] = {
211 {0x0001609c, 0x02566f3a}, 211 {0x0001609c, 0x02566f3a},
212 {0x000160ac, 0xa4647c00}, 212 {0x000160ac, 0xa4647c00},
213 {0x000160b0, 0x01885f5a}, 213 {0x000160b0, 0x01885f5a},
214 {0x00008244, 0x0010f400},
215 {0x0000824c, 0x0001e800},
214}; 216};
215 217
216#define ar9340_1p0_mac_postamble ar9300_2p2_mac_postamble 218#define ar9340_1p0_mac_postamble ar9300_2p2_mac_postamble
@@ -1273,9 +1275,9 @@ static const u32 ar9340_1p0_mac_core[][2] = {
1273 {0x000081f8, 0x00000000}, 1275 {0x000081f8, 0x00000000},
1274 {0x000081fc, 0x00000000}, 1276 {0x000081fc, 0x00000000},
1275 {0x00008240, 0x00100000}, 1277 {0x00008240, 0x00100000},
1276 {0x00008244, 0x0010f424}, 1278 {0x00008244, 0x0010f3d7},
1277 {0x00008248, 0x00000800}, 1279 {0x00008248, 0x00000800},
1278 {0x0000824c, 0x0001e848}, 1280 {0x0000824c, 0x0001e7ae},
1279 {0x00008250, 0x00000000}, 1281 {0x00008250, 0x00000000},
1280 {0x00008254, 0x00000000}, 1282 {0x00008254, 0x00000000},
1281 {0x00008258, 0x00000000}, 1283 {0x00008258, 0x00000000},
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index f3448a032e6f..1e8508530e98 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -69,6 +69,7 @@ s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
69 69
70 if (chan && chan->noisefloor) { 70 if (chan && chan->noisefloor) {
71 s8 delta = chan->noisefloor - 71 s8 delta = chan->noisefloor -
72 ATH9K_NF_CAL_NOISE_THRESH -
72 ath9k_hw_get_default_nf(ah, chan); 73 ath9k_hw_get_default_nf(ah, chan);
73 if (delta > 0) 74 if (delta > 0)
74 noise += delta; 75 noise += delta;
diff --git a/drivers/net/wireless/ath/ath9k/calib.h b/drivers/net/wireless/ath/ath9k/calib.h
index 1060c19a5012..60dcb6c22db9 100644
--- a/drivers/net/wireless/ath/ath9k/calib.h
+++ b/drivers/net/wireless/ath/ath9k/calib.h
@@ -21,6 +21,9 @@
21 21
22#define AR_PHY_CCA_FILTERWINDOW_LENGTH 5 22#define AR_PHY_CCA_FILTERWINDOW_LENGTH 5
23 23
24/* Internal noise floor can vary by about 6db depending on the frequency */
25#define ATH9K_NF_CAL_NOISE_THRESH 6
26
24#define NUM_NF_READINGS 6 27#define NUM_NF_READINGS 6
25#define ATH9K_NF_CAL_HIST_MAX 5 28#define ATH9K_NF_CAL_HIST_MAX 5
26 29
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 72d4893311b1..375c3b46411e 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -242,7 +242,7 @@ struct ath_rx_stats {
242 242
243struct ath_stats { 243struct ath_stats {
244 struct ath_interrupt_stats istats; 244 struct ath_interrupt_stats istats;
245 struct ath_tx_stats txstats[IEEE80211_NUM_ACS]; 245 struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES];
246 struct ath_rx_stats rxstats; 246 struct ath_rx_stats rxstats;
247 struct ath_dfs_stats dfs_stats; 247 struct ath_dfs_stats dfs_stats;
248 u32 reset[__RESET_TYPE_MAX]; 248 u32 reset[__RESET_TYPE_MAX];
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index 0512397a293c..971d770722cf 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -113,9 +113,34 @@ void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data,
113 } 113 }
114} 114}
115 115
116bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data) 116static bool ath9k_hw_nvram_read_blob(struct ath_hw *ah, u32 off,
117 u16 *data)
117{ 118{
118 return common->bus_ops->eeprom_read(common, off, data); 119 u16 *blob_data;
120
121 if (off * sizeof(u16) > ah->eeprom_blob->size)
122 return false;
123
124 blob_data = (u16 *)ah->eeprom_blob->data;
125 *data = blob_data[off];
126 return true;
127}
128
129bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data)
130{
131 struct ath_common *common = ath9k_hw_common(ah);
132 bool ret;
133
134 if (ah->eeprom_blob)
135 ret = ath9k_hw_nvram_read_blob(ah, off, data);
136 else
137 ret = common->bus_ops->eeprom_read(common, off, data);
138
139 if (!ret)
140 ath_dbg(common, EEPROM,
141 "unable to read eeprom region at offset %u\n", off);
142
143 return ret;
119} 144}
120 145
121void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, 146void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 319c651fa6c5..40d4f62d0f16 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -663,7 +663,7 @@ int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight,
663 int16_t targetRight); 663 int16_t targetRight);
664bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, 664bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize,
665 u16 *indexL, u16 *indexR); 665 u16 *indexL, u16 *indexR);
666bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data); 666bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data);
667void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, 667void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data,
668 int eep_start_loc, int size); 668 int eep_start_loc, int size);
669void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, 669void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index 7d075105a85d..c2bfd748eed8 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -32,16 +32,12 @@ static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah)
32 32
33static bool __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) 33static bool __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
34{ 34{
35 struct ath_common *common = ath9k_hw_common(ah);
36 u16 *eep_data = (u16 *)&ah->eeprom.map4k; 35 u16 *eep_data = (u16 *)&ah->eeprom.map4k;
37 int addr, eep_start_loc = 64; 36 int addr, eep_start_loc = 64;
38 37
39 for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { 38 for (addr = 0; addr < SIZE_EEPROM_4K; addr++) {
40 if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, eep_data)) { 39 if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data))
41 ath_dbg(common, EEPROM,
42 "Unable to read eeprom region\n");
43 return false; 40 return false;
44 }
45 eep_data++; 41 eep_data++;
46 } 42 }
47 43
@@ -196,7 +192,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
196 192
197 193
198 if (!ath9k_hw_use_flash(ah)) { 194 if (!ath9k_hw_use_flash(ah)) {
199 if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, 195 if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
200 &magic)) { 196 &magic)) {
201 ath_err(common, "Reading Magic # failed\n"); 197 ath_err(common, "Reading Magic # failed\n");
202 return false; 198 return false;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index cd742fb944c2..3ae1f3df0637 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -33,18 +33,13 @@ static int ath9k_hw_ar9287_get_eeprom_rev(struct ath_hw *ah)
33static bool __ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) 33static bool __ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah)
34{ 34{
35 struct ar9287_eeprom *eep = &ah->eeprom.map9287; 35 struct ar9287_eeprom *eep = &ah->eeprom.map9287;
36 struct ath_common *common = ath9k_hw_common(ah);
37 u16 *eep_data; 36 u16 *eep_data;
38 int addr, eep_start_loc = AR9287_EEP_START_LOC; 37 int addr, eep_start_loc = AR9287_EEP_START_LOC;
39 eep_data = (u16 *)eep; 38 eep_data = (u16 *)eep;
40 39
41 for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) { 40 for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) {
42 if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, 41 if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data))
43 eep_data)) {
44 ath_dbg(common, EEPROM,
45 "Unable to read eeprom region\n");
46 return false; 42 return false;
47 }
48 eep_data++; 43 eep_data++;
49 } 44 }
50 45
@@ -190,7 +185,7 @@ static int ath9k_hw_ar9287_check_eeprom(struct ath_hw *ah)
190 struct ath_common *common = ath9k_hw_common(ah); 185 struct ath_common *common = ath9k_hw_common(ah);
191 186
192 if (!ath9k_hw_use_flash(ah)) { 187 if (!ath9k_hw_use_flash(ah)) {
193 if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, 188 if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
194 &magic)) { 189 &magic)) {
195 ath_err(common, "Reading Magic # failed\n"); 190 ath_err(common, "Reading Magic # failed\n");
196 return false; 191 return false;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index a8ac30a00720..1c25368b3836 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -91,17 +91,13 @@ static int ath9k_hw_def_get_eeprom_rev(struct ath_hw *ah)
91 91
92static bool __ath9k_hw_def_fill_eeprom(struct ath_hw *ah) 92static bool __ath9k_hw_def_fill_eeprom(struct ath_hw *ah)
93{ 93{
94 struct ath_common *common = ath9k_hw_common(ah);
95 u16 *eep_data = (u16 *)&ah->eeprom.def; 94 u16 *eep_data = (u16 *)&ah->eeprom.def;
96 int addr, ar5416_eep_start_loc = 0x100; 95 int addr, ar5416_eep_start_loc = 0x100;
97 96
98 for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) { 97 for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) {
99 if (!ath9k_hw_nvram_read(common, addr + ar5416_eep_start_loc, 98 if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc,
100 eep_data)) { 99 eep_data))
101 ath_err(ath9k_hw_common(ah),
102 "Unable to read eeprom region\n");
103 return false; 100 return false;
104 }
105 eep_data++; 101 eep_data++;
106 } 102 }
107 return true; 103 return true;
@@ -271,7 +267,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
271 bool need_swap = false; 267 bool need_swap = false;
272 int i, addr, size; 268 int i, addr, size;
273 269
274 if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { 270 if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
275 ath_err(common, "Reading Magic # failed\n"); 271 ath_err(common, "Reading Magic # failed\n");
276 return false; 272 return false;
277 } 273 }
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 28cd50ee521a..b6a5a08810b8 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -1082,7 +1082,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
1082 rx_status->freq = hw->conf.channel->center_freq; 1082 rx_status->freq = hw->conf.channel->center_freq;
1083 rx_status->signal = rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR; 1083 rx_status->signal = rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR;
1084 rx_status->antenna = rxbuf->rxstatus.rs_antenna; 1084 rx_status->antenna = rxbuf->rxstatus.rs_antenna;
1085 rx_status->flag |= RX_FLAG_MACTIME_START; 1085 rx_status->flag |= RX_FLAG_MACTIME_END;
1086 1086
1087 return true; 1087 return true;
1088 1088
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index e06bcec655a7..7cb787065913 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2599,6 +2599,10 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
2599 pCap->hw_caps |= ATH9K_HW_WOW_PATTERN_MATCH_DWORD; 2599 pCap->hw_caps |= ATH9K_HW_WOW_PATTERN_MATCH_DWORD;
2600 } 2600 }
2601 2601
2602 if (AR_SREV_9300_20_OR_LATER(ah) &&
2603 ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
2604 pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
2605
2602 return 0; 2606 return 0;
2603} 2607}
2604 2608
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 3636dabf03e1..7f1a8e91c908 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -20,6 +20,7 @@
20#include <linux/if_ether.h> 20#include <linux/if_ether.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/firmware.h>
23 24
24#include "mac.h" 25#include "mac.h"
25#include "ani.h" 26#include "ani.h"
@@ -247,6 +248,7 @@ enum ath9k_hw_caps {
247 ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(17), 248 ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(17),
248 ATH9K_HW_WOW_PATTERN_MATCH_EXACT = BIT(18), 249 ATH9K_HW_WOW_PATTERN_MATCH_EXACT = BIT(18),
249 ATH9K_HW_WOW_PATTERN_MATCH_DWORD = BIT(19), 250 ATH9K_HW_WOW_PATTERN_MATCH_DWORD = BIT(19),
251 ATH9K_HW_CAP_PAPRD = BIT(20),
250}; 252};
251 253
252/* 254/*
@@ -920,6 +922,8 @@ struct ath_hw {
920 bool is_clk_25mhz; 922 bool is_clk_25mhz;
921 int (*get_mac_revision)(void); 923 int (*get_mac_revision)(void);
922 int (*external_reset)(void); 924 int (*external_reset)(void);
925
926 const struct firmware *eeprom_blob;
923}; 927};
924 928
925struct ath_bus_ops { 929struct ath_bus_ops {
@@ -1058,9 +1062,10 @@ void ar9003_paprd_populate_single_table(struct ath_hw *ah,
1058 int chain); 1062 int chain);
1059int ar9003_paprd_create_curve(struct ath_hw *ah, 1063int ar9003_paprd_create_curve(struct ath_hw *ah,
1060 struct ath9k_hw_cal_data *caldata, int chain); 1064 struct ath9k_hw_cal_data *caldata, int chain);
1061int ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain); 1065void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain);
1062int ar9003_paprd_init_table(struct ath_hw *ah); 1066int ar9003_paprd_init_table(struct ath_hw *ah);
1063bool ar9003_paprd_is_done(struct ath_hw *ah); 1067bool ar9003_paprd_is_done(struct ath_hw *ah);
1068bool ar9003_is_paprd_enabled(struct ath_hw *ah);
1064 1069
1065/* Hardware family op attach helpers */ 1070/* Hardware family op attach helpers */
1066void ar5008_hw_attach_phy_ops(struct ath_hw *ah); 1071void ar5008_hw_attach_phy_ops(struct ath_hw *ah);
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 80cae53a33e5..f69ef5d48c7b 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -23,6 +23,11 @@
23 23
24#include "ath9k.h" 24#include "ath9k.h"
25 25
26struct ath9k_eeprom_ctx {
27 struct completion complete;
28 struct ath_hw *ah;
29};
30
26static char *dev_info = "ath9k"; 31static char *dev_info = "ath9k";
27 32
28MODULE_AUTHOR("Atheros Communications"); 33MODULE_AUTHOR("Atheros Communications");
@@ -506,6 +511,51 @@ static void ath9k_init_misc(struct ath_softc *sc)
506 sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT; 511 sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT;
507} 512}
508 513
514static void ath9k_eeprom_request_cb(const struct firmware *eeprom_blob,
515 void *ctx)
516{
517 struct ath9k_eeprom_ctx *ec = ctx;
518
519 if (eeprom_blob)
520 ec->ah->eeprom_blob = eeprom_blob;
521
522 complete(&ec->complete);
523}
524
525static int ath9k_eeprom_request(struct ath_softc *sc, const char *name)
526{
527 struct ath9k_eeprom_ctx ec;
528 struct ath_hw *ah = ah = sc->sc_ah;
529 int err;
530
531 /* try to load the EEPROM content asynchronously */
532 init_completion(&ec.complete);
533 ec.ah = sc->sc_ah;
534
535 err = request_firmware_nowait(THIS_MODULE, 1, name, sc->dev, GFP_KERNEL,
536 &ec, ath9k_eeprom_request_cb);
537 if (err < 0) {
538 ath_err(ath9k_hw_common(ah),
539 "EEPROM request failed\n");
540 return err;
541 }
542
543 wait_for_completion(&ec.complete);
544
545 if (!ah->eeprom_blob) {
546 ath_err(ath9k_hw_common(ah),
547 "Unable to load EEPROM file %s\n", name);
548 return -EINVAL;
549 }
550
551 return 0;
552}
553
554static void ath9k_eeprom_release(struct ath_softc *sc)
555{
556 release_firmware(sc->sc_ah->eeprom_blob);
557}
558
509static int ath9k_init_softc(u16 devid, struct ath_softc *sc, 559static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
510 const struct ath_bus_ops *bus_ops) 560 const struct ath_bus_ops *bus_ops)
511{ 561{
@@ -583,6 +633,12 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
583 ath_read_cachesize(common, &csz); 633 ath_read_cachesize(common, &csz);
584 common->cachelsz = csz << 2; /* convert to bytes */ 634 common->cachelsz = csz << 2; /* convert to bytes */
585 635
636 if (pdata && pdata->eeprom_name) {
637 ret = ath9k_eeprom_request(sc, pdata->eeprom_name);
638 if (ret)
639 goto err_eeprom;
640 }
641
586 /* Initializes the hardware for all supported chipsets */ 642 /* Initializes the hardware for all supported chipsets */
587 ret = ath9k_hw_init(ah); 643 ret = ath9k_hw_init(ah);
588 if (ret) 644 if (ret)
@@ -619,7 +675,8 @@ err_btcoex:
619err_queues: 675err_queues:
620 ath9k_hw_deinit(ah); 676 ath9k_hw_deinit(ah);
621err_hw: 677err_hw:
622 678 ath9k_eeprom_release(sc);
679err_eeprom:
623 kfree(ah); 680 kfree(ah);
624 sc->sc_ah = NULL; 681 sc->sc_ah = NULL;
625 682
@@ -882,6 +939,7 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
882 if (sc->dfs_detector != NULL) 939 if (sc->dfs_detector != NULL)
883 sc->dfs_detector->exit(sc->dfs_detector); 940 sc->dfs_detector->exit(sc->dfs_detector);
884 941
942 ath9k_eeprom_release(sc);
885 kfree(sc->sc_ah); 943 kfree(sc->sc_ah);
886 sc->sc_ah = NULL; 944 sc->sc_ah = NULL;
887} 945}
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c
index fc6b075ad635..ade3afb21f91 100644
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -179,13 +179,15 @@ void ath_rx_poll(unsigned long data)
179static void ath_paprd_activate(struct ath_softc *sc) 179static void ath_paprd_activate(struct ath_softc *sc)
180{ 180{
181 struct ath_hw *ah = sc->sc_ah; 181 struct ath_hw *ah = sc->sc_ah;
182 struct ath_common *common = ath9k_hw_common(ah);
182 struct ath9k_hw_cal_data *caldata = ah->caldata; 183 struct ath9k_hw_cal_data *caldata = ah->caldata;
183 int chain; 184 int chain;
184 185
185 if (!caldata || !caldata->paprd_done) 186 if (!caldata || !caldata->paprd_done) {
187 ath_dbg(common, CALIBRATE, "Failed to activate PAPRD\n");
186 return; 188 return;
189 }
187 190
188 ath9k_ps_wakeup(sc);
189 ar9003_paprd_enable(ah, false); 191 ar9003_paprd_enable(ah, false);
190 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { 192 for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
191 if (!(ah->txchainmask & BIT(chain))) 193 if (!(ah->txchainmask & BIT(chain)))
@@ -194,8 +196,8 @@ static void ath_paprd_activate(struct ath_softc *sc)
194 ar9003_paprd_populate_single_table(ah, caldata, chain); 196 ar9003_paprd_populate_single_table(ah, caldata, chain);
195 } 197 }
196 198
199 ath_dbg(common, CALIBRATE, "Activating PAPRD\n");
197 ar9003_paprd_enable(ah, true); 200 ar9003_paprd_enable(ah, true);
198 ath9k_ps_restore(sc);
199} 201}
200 202
201static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain) 203static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain)
@@ -253,8 +255,10 @@ void ath_paprd_calibrate(struct work_struct *work)
253 int len = 1800; 255 int len = 1800;
254 int ret; 256 int ret;
255 257
256 if (!caldata || !caldata->paprd_packet_sent || caldata->paprd_done) 258 if (!caldata || !caldata->paprd_packet_sent || caldata->paprd_done) {
259 ath_dbg(common, CALIBRATE, "Skipping PAPRD calibration\n");
257 return; 260 return;
261 }
258 262
259 ath9k_ps_wakeup(sc); 263 ath9k_ps_wakeup(sc);
260 264
@@ -430,11 +434,15 @@ set_timer:
430 cal_interval = min(cal_interval, (u32)short_cal_interval); 434 cal_interval = min(cal_interval, (u32)short_cal_interval);
431 435
432 mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); 436 mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
433 if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD) && ah->caldata) { 437
434 if (!ah->caldata->paprd_done) 438 if (ar9003_is_paprd_enabled(ah) && ah->caldata) {
439 if (!ah->caldata->paprd_done) {
435 ieee80211_queue_work(sc->hw, &sc->paprd_work); 440 ieee80211_queue_work(sc->hw, &sc->paprd_work);
436 else if (!ah->paprd_table_write_done) 441 } else if (!ah->paprd_table_write_done) {
442 ath9k_ps_wakeup(sc);
437 ath_paprd_activate(sc); 443 ath_paprd_activate(sc);
444 ath9k_ps_restore(sc);
445 }
438 } 446 }
439} 447}
440 448
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 6aafbb77c498..d4df98a938bf 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -976,7 +976,7 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common,
976 rx_status->freq = hw->conf.channel->center_freq; 976 rx_status->freq = hw->conf.channel->center_freq;
977 rx_status->signal = ah->noise + rx_stats->rs_rssi; 977 rx_status->signal = ah->noise + rx_stats->rs_rssi;
978 rx_status->antenna = rx_stats->rs_antenna; 978 rx_status->antenna = rx_stats->rs_antenna;
979 rx_status->flag |= RX_FLAG_MACTIME_START; 979 rx_status->flag |= RX_FLAG_MACTIME_END;
980 if (rx_stats->rs_moreaggr) 980 if (rx_stats->rs_moreaggr)
981 rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; 981 rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
982 982
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
index 876a773fd0b4..4684dd989496 100644
--- a/drivers/net/wireless/ath/carl9170/rx.c
+++ b/drivers/net/wireless/ath/carl9170/rx.c
@@ -684,7 +684,7 @@ static int carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len,
684 if (!skb) 684 if (!skb)
685 return -ENOMEM; 685 return -ENOMEM;
686 686
687 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); 687 memcpy(IEEE80211_SKB_RXCB(skb), status, sizeof(*status));
688 ieee80211_rx(ar->hw, skb); 688 ieee80211_rx(ar->hw, skb);
689 return 0; 689 return 0;
690} 690}
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 777cd74921d7..38bc5a7997ff 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -409,7 +409,10 @@ static inline
409 struct b43_dmadesc_meta *meta) 409 struct b43_dmadesc_meta *meta)
410{ 410{
411 if (meta->skb) { 411 if (meta->skb) {
412 dev_kfree_skb_any(meta->skb); 412 if (ring->tx)
413 ieee80211_free_txskb(ring->dev->wl->hw, meta->skb);
414 else
415 dev_kfree_skb_any(meta->skb);
413 meta->skb = NULL; 416 meta->skb = NULL;
414 } 417 }
415} 418}
@@ -1454,7 +1457,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1454 if (unlikely(err == -ENOKEY)) { 1457 if (unlikely(err == -ENOKEY)) {
1455 /* Drop this packet, as we don't have the encryption key 1458 /* Drop this packet, as we don't have the encryption key
1456 * anymore and must not transmit it unencrypted. */ 1459 * anymore and must not transmit it unencrypted. */
1457 dev_kfree_skb_any(skb); 1460 ieee80211_free_txskb(dev->wl->hw, skb);
1458 err = 0; 1461 err = 0;
1459 goto out; 1462 goto out;
1460 } 1463 }
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index ddd6a4f78097..16ab280359bd 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3397,7 +3397,7 @@ static void b43_tx_work(struct work_struct *work)
3397 break; 3397 break;
3398 } 3398 }
3399 if (unlikely(err)) 3399 if (unlikely(err))
3400 dev_kfree_skb(skb); /* Drop it */ 3400 ieee80211_free_txskb(wl->hw, skb);
3401 err = 0; 3401 err = 0;
3402 } 3402 }
3403 3403
@@ -3419,7 +3419,7 @@ static void b43_op_tx(struct ieee80211_hw *hw,
3419 3419
3420 if (unlikely(skb->len < 2 + 2 + 6)) { 3420 if (unlikely(skb->len < 2 + 2 + 6)) {
3421 /* Too short, this can't be a valid frame. */ 3421 /* Too short, this can't be a valid frame. */
3422 dev_kfree_skb_any(skb); 3422 ieee80211_free_txskb(hw, skb);
3423 return; 3423 return;
3424 } 3424 }
3425 B43_WARN_ON(skb_shinfo(skb)->nr_frags); 3425 B43_WARN_ON(skb_shinfo(skb)->nr_frags);
@@ -4229,8 +4229,12 @@ redo:
4229 4229
4230 /* Drain all TX queues. */ 4230 /* Drain all TX queues. */
4231 for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) { 4231 for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) {
4232 while (skb_queue_len(&wl->tx_queue[queue_num])) 4232 while (skb_queue_len(&wl->tx_queue[queue_num])) {
4233 dev_kfree_skb(skb_dequeue(&wl->tx_queue[queue_num])); 4233 struct sk_buff *skb;
4234
4235 skb = skb_dequeue(&wl->tx_queue[queue_num]);
4236 ieee80211_free_txskb(wl->hw, skb);
4237 }
4234 } 4238 }
4235 4239
4236 b43_mac_suspend(dev); 4240 b43_mac_suspend(dev);
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index 3533ab86bd36..a73ff8c9deb5 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -196,7 +196,7 @@ static void b43_pio_cancel_tx_packets(struct b43_pio_txqueue *q)
196 for (i = 0; i < ARRAY_SIZE(q->packets); i++) { 196 for (i = 0; i < ARRAY_SIZE(q->packets); i++) {
197 pack = &(q->packets[i]); 197 pack = &(q->packets[i]);
198 if (pack->skb) { 198 if (pack->skb) {
199 dev_kfree_skb_any(pack->skb); 199 ieee80211_free_txskb(q->dev->wl->hw, pack->skb);
200 pack->skb = NULL; 200 pack->skb = NULL;
201 } 201 }
202 } 202 }
@@ -552,7 +552,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
552 if (unlikely(err == -ENOKEY)) { 552 if (unlikely(err == -ENOKEY)) {
553 /* Drop this packet, as we don't have the encryption key 553 /* Drop this packet, as we don't have the encryption key
554 * anymore and must not transmit it unencrypted. */ 554 * anymore and must not transmit it unencrypted. */
555 dev_kfree_skb_any(skb); 555 ieee80211_free_txskb(dev->wl->hw, skb);
556 err = 0; 556 err = 0;
557 goto out; 557 goto out;
558 } 558 }
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h
index a29da674e69d..482476fdb1f3 100644
--- a/drivers/net/wireless/b43legacy/b43legacy.h
+++ b/drivers/net/wireless/b43legacy/b43legacy.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/ssb/ssb.h> 14#include <linux/ssb/ssb.h>
15#include <linux/ssb/ssb_driver_chipcommon.h> 15#include <linux/ssb/ssb_driver_chipcommon.h>
16#include <linux/completion.h>
16 17
17#include <net/mac80211.h> 18#include <net/mac80211.h>
18 19
@@ -733,6 +734,10 @@ struct b43legacy_wldev {
733 734
734 /* Firmware data */ 735 /* Firmware data */
735 struct b43legacy_firmware fw; 736 struct b43legacy_firmware fw;
737 const struct firmware *fwp; /* needed to pass fw pointer */
738
739 /* completion struct for firmware loading */
740 struct completion fw_load_complete;
736 741
737 /* Devicelist in struct b43legacy_wl (all 802.11 cores) */ 742 /* Devicelist in struct b43legacy_wl (all 802.11 cores) */
738 struct list_head list; 743 struct list_head list;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 18e208e3eca1..8c3f70e1a013 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1513,9 +1513,17 @@ static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl)
1513 "and download the correct firmware (version 3).\n"); 1513 "and download the correct firmware (version 3).\n");
1514} 1514}
1515 1515
1516static void b43legacy_fw_cb(const struct firmware *firmware, void *context)
1517{
1518 struct b43legacy_wldev *dev = context;
1519
1520 dev->fwp = firmware;
1521 complete(&dev->fw_load_complete);
1522}
1523
1516static int do_request_fw(struct b43legacy_wldev *dev, 1524static int do_request_fw(struct b43legacy_wldev *dev,
1517 const char *name, 1525 const char *name,
1518 const struct firmware **fw) 1526 const struct firmware **fw, bool async)
1519{ 1527{
1520 char path[sizeof(modparam_fwpostfix) + 32]; 1528 char path[sizeof(modparam_fwpostfix) + 32];
1521 struct b43legacy_fw_header *hdr; 1529 struct b43legacy_fw_header *hdr;
@@ -1528,7 +1536,24 @@ static int do_request_fw(struct b43legacy_wldev *dev,
1528 snprintf(path, ARRAY_SIZE(path), 1536 snprintf(path, ARRAY_SIZE(path),
1529 "b43legacy%s/%s.fw", 1537 "b43legacy%s/%s.fw",
1530 modparam_fwpostfix, name); 1538 modparam_fwpostfix, name);
1531 err = request_firmware(fw, path, dev->dev->dev); 1539 b43legacyinfo(dev->wl, "Loading firmware %s\n", path);
1540 if (async) {
1541 init_completion(&dev->fw_load_complete);
1542 err = request_firmware_nowait(THIS_MODULE, 1, path,
1543 dev->dev->dev, GFP_KERNEL,
1544 dev, b43legacy_fw_cb);
1545 if (err) {
1546 b43legacyerr(dev->wl, "Unable to load firmware\n");
1547 return err;
1548 }
1549 /* stall here until fw ready */
1550 wait_for_completion(&dev->fw_load_complete);
1551 if (!dev->fwp)
1552 err = -EINVAL;
1553 *fw = dev->fwp;
1554 } else {
1555 err = request_firmware(fw, path, dev->dev->dev);
1556 }
1532 if (err) { 1557 if (err) {
1533 b43legacyerr(dev->wl, "Firmware file \"%s\" not found " 1558 b43legacyerr(dev->wl, "Firmware file \"%s\" not found "
1534 "or load failed.\n", path); 1559 "or load failed.\n", path);
@@ -1580,7 +1605,7 @@ static void b43legacy_request_firmware(struct work_struct *work)
1580 filename = "ucode4"; 1605 filename = "ucode4";
1581 else 1606 else
1582 filename = "ucode5"; 1607 filename = "ucode5";
1583 err = do_request_fw(dev, filename, &fw->ucode); 1608 err = do_request_fw(dev, filename, &fw->ucode, true);
1584 if (err) 1609 if (err)
1585 goto err_load; 1610 goto err_load;
1586 } 1611 }
@@ -1589,7 +1614,7 @@ static void b43legacy_request_firmware(struct work_struct *work)
1589 filename = "pcm4"; 1614 filename = "pcm4";
1590 else 1615 else
1591 filename = "pcm5"; 1616 filename = "pcm5";
1592 err = do_request_fw(dev, filename, &fw->pcm); 1617 err = do_request_fw(dev, filename, &fw->pcm, false);
1593 if (err) 1618 if (err)
1594 goto err_load; 1619 goto err_load;
1595 } 1620 }
@@ -1607,7 +1632,7 @@ static void b43legacy_request_firmware(struct work_struct *work)
1607 default: 1632 default:
1608 goto err_no_initvals; 1633 goto err_no_initvals;
1609 } 1634 }
1610 err = do_request_fw(dev, filename, &fw->initvals); 1635 err = do_request_fw(dev, filename, &fw->initvals, false);
1611 if (err) 1636 if (err)
1612 goto err_load; 1637 goto err_load;
1613 } 1638 }
@@ -1627,7 +1652,7 @@ static void b43legacy_request_firmware(struct work_struct *work)
1627 default: 1652 default:
1628 goto err_no_initvals; 1653 goto err_no_initvals;
1629 } 1654 }
1630 err = do_request_fw(dev, filename, &fw->initvals_band); 1655 err = do_request_fw(dev, filename, &fw->initvals_band, false);
1631 if (err) 1656 if (err)
1632 goto err_load; 1657 goto err_load;
1633 } 1658 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 334ddab4a8c5..be35a2f99b1c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -67,9 +67,8 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
67 u8 data; 67 u8 data;
68 unsigned long flags; 68 unsigned long flags;
69 69
70 brcmf_dbg(TRACE, "Entering\n"); 70 brcmf_dbg(TRACE, "Entering: irq %d\n", sdiodev->irq);
71 71
72 brcmf_dbg(ERROR, "requesting irq %d\n", sdiodev->irq);
73 ret = request_irq(sdiodev->irq, brcmf_sdio_irqhandler, 72 ret = request_irq(sdiodev->irq, brcmf_sdio_irqhandler,
74 sdiodev->irq_flags, "brcmf_oob_intr", 73 sdiodev->irq_flags, "brcmf_oob_intr",
75 &sdiodev->func[1]->dev); 74 &sdiodev->func[1]->dev);
@@ -184,7 +183,7 @@ brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
184 } while (err != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); 183 } while (err != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
185 184
186 if (err) { 185 if (err) {
187 brcmf_dbg(ERROR, "failed at addr:0x%0x\n", 186 brcmf_err("failed at addr:0x%0x\n",
188 SBSDIO_FUNC1_SBADDRLOW + i); 187 SBSDIO_FUNC1_SBADDRLOW + i);
189 break; 188 break;
190 } 189 }
@@ -246,7 +245,7 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
246 } while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); 245 } while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
247 246
248 if (ret != 0) 247 if (ret != 0)
249 brcmf_dbg(ERROR, "failed with %d\n", ret); 248 brcmf_err("failed with %d\n", ret);
250 249
251 return ret; 250 return ret;
252} 251}
@@ -340,7 +339,7 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
340 339
341 mypkt = brcmu_pkt_buf_get_skb(nbytes); 340 mypkt = brcmu_pkt_buf_get_skb(nbytes);
342 if (!mypkt) { 341 if (!mypkt) {
343 brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed: len %d\n", 342 brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n",
344 nbytes); 343 nbytes);
345 return -EIO; 344 return -EIO;
346 } 345 }
@@ -409,7 +408,7 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
409 408
410 mypkt = brcmu_pkt_buf_get_skb(nbytes); 409 mypkt = brcmu_pkt_buf_get_skb(nbytes);
411 if (!mypkt) { 410 if (!mypkt) {
412 brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed: len %d\n", 411 brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n",
413 nbytes); 412 nbytes);
414 return -EIO; 413 return -EIO;
415 } 414 }
@@ -472,7 +471,7 @@ int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr,
472 471
473 mypkt = brcmu_pkt_buf_get_skb(nbytes); 472 mypkt = brcmu_pkt_buf_get_skb(nbytes);
474 if (!mypkt) { 473 if (!mypkt) {
475 brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed: len %d\n", 474 brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n",
476 nbytes); 475 nbytes);
477 return -EIO; 476 return -EIO;
478 } 477 }
@@ -519,7 +518,7 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
519 /* try to attach to the target device */ 518 /* try to attach to the target device */
520 sdiodev->bus = brcmf_sdbrcm_probe(regs, sdiodev); 519 sdiodev->bus = brcmf_sdbrcm_probe(regs, sdiodev);
521 if (!sdiodev->bus) { 520 if (!sdiodev->bus) {
522 brcmf_dbg(ERROR, "device attach failed\n"); 521 brcmf_err("device attach failed\n");
523 ret = -ENODEV; 522 ret = -ENODEV;
524 goto out; 523 goto out;
525 } 524 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index a80050223710..d33e5598611b 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -107,15 +107,13 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
107 /* Enable Function 2 */ 107 /* Enable Function 2 */
108 err_ret = sdio_enable_func(sdfunc); 108 err_ret = sdio_enable_func(sdfunc);
109 if (err_ret) 109 if (err_ret)
110 brcmf_dbg(ERROR, 110 brcmf_err("enable F2 failed:%d\n",
111 "enable F2 failed:%d\n",
112 err_ret); 111 err_ret);
113 } else { 112 } else {
114 /* Disable Function 2 */ 113 /* Disable Function 2 */
115 err_ret = sdio_disable_func(sdfunc); 114 err_ret = sdio_disable_func(sdfunc);
116 if (err_ret) 115 if (err_ret)
117 brcmf_dbg(ERROR, 116 brcmf_err("Disable F2 failed:%d\n",
118 "Disable F2 failed:%d\n",
119 err_ret); 117 err_ret);
120 } 118 }
121 } 119 }
@@ -129,7 +127,7 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
129 sdio_writeb(sdfunc, *byte, regaddr, &err_ret); 127 sdio_writeb(sdfunc, *byte, regaddr, &err_ret);
130 kfree(sdfunc); 128 kfree(sdfunc);
131 } else if (regaddr < 0xF0) { 129 } else if (regaddr < 0xF0) {
132 brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); 130 brcmf_err("F0 Wr:0x%02x: write disallowed\n", regaddr);
133 err_ret = -EPERM; 131 err_ret = -EPERM;
134 } else { 132 } else {
135 sdio_f0_writeb(sdfunc, *byte, regaddr, &err_ret); 133 sdio_f0_writeb(sdfunc, *byte, regaddr, &err_ret);
@@ -166,7 +164,7 @@ int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
166 } 164 }
167 165
168 if (err_ret) 166 if (err_ret)
169 brcmf_dbg(ERROR, "Failed to %s byte F%d:@0x%05x=%02x, Err: %d\n", 167 brcmf_err("Failed to %s byte F%d:@0x%05x=%02x, Err: %d\n",
170 rw ? "write" : "read", func, regaddr, *byte, err_ret); 168 rw ? "write" : "read", func, regaddr, *byte, err_ret);
171 169
172 return err_ret; 170 return err_ret;
@@ -179,7 +177,7 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev,
179 int err_ret = -EIO; 177 int err_ret = -EIO;
180 178
181 if (func == 0) { 179 if (func == 0) {
182 brcmf_dbg(ERROR, "Only CMD52 allowed to F0\n"); 180 brcmf_err("Only CMD52 allowed to F0\n");
183 return -EINVAL; 181 return -EINVAL;
184 } 182 }
185 183
@@ -198,7 +196,7 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev,
198 sdio_writew(sdiodev->func[func], (*word & 0xFFFF), 196 sdio_writew(sdiodev->func[func], (*word & 0xFFFF),
199 addr, &err_ret); 197 addr, &err_ret);
200 else 198 else
201 brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes); 199 brcmf_err("Invalid nbytes: %d\n", nbytes);
202 } else { /* CMD52 Read */ 200 } else { /* CMD52 Read */
203 if (nbytes == 4) 201 if (nbytes == 4)
204 *word = sdio_readl(sdiodev->func[func], addr, &err_ret); 202 *word = sdio_readl(sdiodev->func[func], addr, &err_ret);
@@ -206,11 +204,11 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev,
206 *word = sdio_readw(sdiodev->func[func], addr, 204 *word = sdio_readw(sdiodev->func[func], addr,
207 &err_ret) & 0xFFFF; 205 &err_ret) & 0xFFFF;
208 else 206 else
209 brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes); 207 brcmf_err("Invalid nbytes: %d\n", nbytes);
210 } 208 }
211 209
212 if (err_ret) 210 if (err_ret)
213 brcmf_dbg(ERROR, "Failed to %s word, Err: 0x%08x\n", 211 brcmf_err("Failed to %s word, Err: 0x%08x\n",
214 rw ? "write" : "read", err_ret); 212 rw ? "write" : "read", err_ret);
215 213
216 return err_ret; 214 return err_ret;
@@ -270,7 +268,7 @@ brcmf_sdioh_request_chain(struct brcmf_sdio_dev *sdiodev, uint fix_inc,
270 err_ret = brcmf_sdioh_request_data(sdiodev, write, fifo, func, 268 err_ret = brcmf_sdioh_request_data(sdiodev, write, fifo, func,
271 addr, pkt, pkt_len); 269 addr, pkt, pkt_len);
272 if (err_ret) { 270 if (err_ret) {
273 brcmf_dbg(ERROR, "%s FAILED %p[%d], addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", 271 brcmf_err("%s FAILED %p[%d], addr=0x%05x, pkt_len=%d, ERR=0x%08x\n",
274 write ? "TX" : "RX", pkt, SGCount, addr, 272 write ? "TX" : "RX", pkt, SGCount, addr,
275 pkt_len, err_ret); 273 pkt_len, err_ret);
276 } else { 274 } else {
@@ -315,7 +313,7 @@ int brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev,
315 status = brcmf_sdioh_request_data(sdiodev, write, fifo, func, 313 status = brcmf_sdioh_request_data(sdiodev, write, fifo, func,
316 addr, pkt, pkt_len); 314 addr, pkt, pkt_len);
317 if (status) { 315 if (status) {
318 brcmf_dbg(ERROR, "%s FAILED %p, addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", 316 brcmf_err("%s FAILED %p, addr=0x%05x, pkt_len=%d, ERR=0x%08x\n",
319 write ? "TX" : "RX", pkt, addr, pkt_len, status); 317 write ? "TX" : "RX", pkt, addr, pkt_len, status);
320 } else { 318 } else {
321 brcmf_dbg(TRACE, "%s xfr'd %p, addr=0x%05x, len=%d\n", 319 brcmf_dbg(TRACE, "%s xfr'd %p, addr=0x%05x, len=%d\n",
@@ -336,7 +334,7 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
336 for (i = 0; i < 3; i++) { 334 for (i = 0; i < 3; i++) {
337 regdata = brcmf_sdio_regrl(sdiodev, regaddr, &ret); 335 regdata = brcmf_sdio_regrl(sdiodev, regaddr, &ret);
338 if (ret != 0) 336 if (ret != 0)
339 brcmf_dbg(ERROR, "Can't read!\n"); 337 brcmf_err("Can't read!\n");
340 338
341 *ptr++ = (u8) regdata; 339 *ptr++ = (u8) regdata;
342 regaddr++; 340 regaddr++;
@@ -374,7 +372,7 @@ static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev)
374 /* Enable Function 1 */ 372 /* Enable Function 1 */
375 err_ret = sdio_enable_func(sdiodev->func[1]); 373 err_ret = sdio_enable_func(sdiodev->func[1]);
376 if (err_ret) 374 if (err_ret)
377 brcmf_dbg(ERROR, "Failed to enable F1 Err: 0x%08x\n", err_ret); 375 brcmf_err("Failed to enable F1 Err: 0x%08x\n", err_ret);
378 376
379 return false; 377 return false;
380} 378}
@@ -394,13 +392,13 @@ int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
394 392
395 err_ret = sdio_set_block_size(sdiodev->func[1], SDIO_FUNC1_BLOCKSIZE); 393 err_ret = sdio_set_block_size(sdiodev->func[1], SDIO_FUNC1_BLOCKSIZE);
396 if (err_ret) { 394 if (err_ret) {
397 brcmf_dbg(ERROR, "Failed to set F1 blocksize\n"); 395 brcmf_err("Failed to set F1 blocksize\n");
398 goto out; 396 goto out;
399 } 397 }
400 398
401 err_ret = sdio_set_block_size(sdiodev->func[2], SDIO_FUNC2_BLOCKSIZE); 399 err_ret = sdio_set_block_size(sdiodev->func[2], SDIO_FUNC2_BLOCKSIZE);
402 if (err_ret) { 400 if (err_ret) {
403 brcmf_dbg(ERROR, "Failed to set F2 blocksize\n"); 401 brcmf_err("Failed to set F2 blocksize\n");
404 goto out; 402 goto out;
405 } 403 }
406 404
@@ -434,7 +432,7 @@ static int brcmf_sdio_getintrcfg(struct brcmf_sdio_dev *sdiodev)
434 struct brcmf_sdio_oobirq *oobirq_entry; 432 struct brcmf_sdio_oobirq *oobirq_entry;
435 433
436 if (list_empty(&oobirq_lh)) { 434 if (list_empty(&oobirq_lh)) {
437 brcmf_dbg(ERROR, "no valid oob irq resource\n"); 435 brcmf_err("no valid oob irq resource\n");
438 return -ENXIO; 436 return -ENXIO;
439 } 437 }
440 438
@@ -508,7 +506,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
508 brcmf_dbg(TRACE, "F2 found, calling brcmf_sdio_probe...\n"); 506 brcmf_dbg(TRACE, "F2 found, calling brcmf_sdio_probe...\n");
509 err = brcmf_sdio_probe(sdiodev); 507 err = brcmf_sdio_probe(sdiodev);
510 if (err) { 508 if (err) {
511 brcmf_dbg(ERROR, "F2 error, probe failed %d...\n", err); 509 brcmf_err("F2 error, probe failed %d...\n", err);
512 goto fail; 510 goto fail;
513 } 511 }
514 brcmf_dbg(TRACE, "F2 init completed...\n"); 512 brcmf_dbg(TRACE, "F2 init completed...\n");
@@ -564,13 +562,13 @@ static int brcmf_sdio_suspend(struct device *dev)
564 562
565 sdio_flags = sdio_get_host_pm_caps(sdiodev->func[1]); 563 sdio_flags = sdio_get_host_pm_caps(sdiodev->func[1]);
566 if (!(sdio_flags & MMC_PM_KEEP_POWER)) { 564 if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
567 brcmf_dbg(ERROR, "Host can't keep power while suspended\n"); 565 brcmf_err("Host can't keep power while suspended\n");
568 return -EINVAL; 566 return -EINVAL;
569 } 567 }
570 568
571 ret = sdio_set_host_pm_flags(sdiodev->func[1], MMC_PM_KEEP_POWER); 569 ret = sdio_set_host_pm_flags(sdiodev->func[1], MMC_PM_KEEP_POWER);
572 if (ret) { 570 if (ret) {
573 brcmf_dbg(ERROR, "Failed to set pm_flags\n"); 571 brcmf_err("Failed to set pm_flags\n");
574 return ret; 572 return ret;
575 } 573 }
576 574
@@ -635,7 +633,7 @@ static int brcmf_sdio_pd_probe(struct platform_device *pdev)
635 ret = sdio_register_driver(&brcmf_sdmmc_driver); 633 ret = sdio_register_driver(&brcmf_sdmmc_driver);
636 634
637 if (ret) 635 if (ret)
638 brcmf_dbg(ERROR, "sdio_register_driver failed: %d\n", ret); 636 brcmf_err("sdio_register_driver failed: %d\n", ret);
639 637
640 return ret; 638 return ret;
641} 639}
@@ -665,7 +663,7 @@ void brcmf_sdio_init(void)
665 ret = platform_driver_register(&brcmf_sdio_pd); 663 ret = platform_driver_register(&brcmf_sdio_pd);
666 664
667 if (ret) 665 if (ret)
668 brcmf_dbg(ERROR, "platform_driver_register failed: %d\n", ret); 666 brcmf_err("platform_driver_register failed: %d\n", ret);
669} 667}
670#else 668#else
671void brcmf_sdio_exit(void) 669void brcmf_sdio_exit(void)
@@ -684,6 +682,6 @@ void brcmf_sdio_init(void)
684 ret = sdio_register_driver(&brcmf_sdmmc_driver); 682 ret = sdio_register_driver(&brcmf_sdmmc_driver);
685 683
686 if (ret) 684 if (ret)
687 brcmf_dbg(ERROR, "sdio_register_driver failed: %d\n", ret); 685 brcmf_err("sdio_register_driver failed: %d\n", ret);
688} 686}
689#endif /* CONFIG_BRCMFMAC_SDIO_OOB */ 687#endif /* CONFIG_BRCMFMAC_SDIO_OOB */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
index 24bc4e3e162b..fd672bf53867 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
@@ -470,7 +470,6 @@ struct brcmf_pub {
470 struct brcmf_bus *bus_if; 470 struct brcmf_bus *bus_if;
471 struct brcmf_proto *prot; 471 struct brcmf_proto *prot;
472 struct brcmf_cfg80211_info *config; 472 struct brcmf_cfg80211_info *config;
473 struct device *dev; /* fullmac dongle device pointer */
474 473
475 /* Internal brcmf items */ 474 /* Internal brcmf items */
476 uint hdrlen; /* Total BRCMF header length (proto + bus) */ 475 uint hdrlen; /* Total BRCMF header length (proto + bus) */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
index b8f248797f62..dd38b78a9726 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
@@ -43,36 +43,90 @@ struct brcmf_bus_dcmd {
43 struct list_head list; 43 struct list_head list;
44}; 44};
45 45
46/* interface structure between common and bus layer */ 46/**
47 * struct brcmf_bus_ops - bus callback operations.
48 *
49 * @init: prepare for communication with dongle.
50 * @stop: clear pending frames, disable data flow.
51 * @txdata: send a data frame to the dongle (callee disposes skb).
52 * @txctl: transmit a control request message to dongle.
53 * @rxctl: receive a control response message from dongle.
54 *
55 * This structure provides an abstract interface towards the
56 * bus specific driver. For control messages to common driver
57 * will assure there is only one active transaction.
58 */
59struct brcmf_bus_ops {
60 int (*init)(struct device *dev);
61 void (*stop)(struct device *dev);
62 int (*txdata)(struct device *dev, struct sk_buff *skb);
63 int (*txctl)(struct device *dev, unsigned char *msg, uint len);
64 int (*rxctl)(struct device *dev, unsigned char *msg, uint len);
65};
66
67/**
68 * struct brcmf_bus - interface structure between common and bus layer
69 *
70 * @bus_priv: pointer to private bus device.
71 * @dev: device pointer of bus device.
72 * @drvr: public driver information.
73 * @state: operational state of the bus interface.
74 * @maxctl: maximum size for rxctl request message.
75 * @drvr_up: indicates driver up/down status.
76 * @tx_realloc: number of tx packets realloced for headroom.
77 * @dstats: dongle-based statistical data.
78 * @align: alignment requirement for the bus.
79 * @dcmd_list: bus/device specific dongle initialization commands.
80 */
47struct brcmf_bus { 81struct brcmf_bus {
48 union { 82 union {
49 struct brcmf_sdio_dev *sdio; 83 struct brcmf_sdio_dev *sdio;
50 struct brcmf_usbdev *usb; 84 struct brcmf_usbdev *usb;
51 } bus_priv; 85 } bus_priv;
52 struct brcmf_pub *drvr; /* pointer to driver pub structure brcmf_pub */ 86 struct device *dev;
87 struct brcmf_pub *drvr;
53 enum brcmf_bus_state state; 88 enum brcmf_bus_state state;
54 uint maxctl; /* Max size rxctl request from proto to bus */ 89 uint maxctl;
55 bool drvr_up; /* Status flag of driver up/down */ 90 bool drvr_up;
56 unsigned long tx_realloc; /* Tx packets realloced for headroom */ 91 unsigned long tx_realloc;
57 struct dngl_stats dstats; /* Stats for dongle-based data */ 92 struct dngl_stats dstats;
58 u8 align; /* bus alignment requirement */ 93 u8 align;
59 struct list_head dcmd_list; 94 struct list_head dcmd_list;
60 95
61 /* interface functions pointers */ 96 struct brcmf_bus_ops *ops;
62 /* Stop bus module: clear pending frames, disable data flow */
63 void (*brcmf_bus_stop)(struct device *);
64 /* Initialize bus module: prepare for communication w/dongle */
65 int (*brcmf_bus_init)(struct device *);
66 /* Send a data frame to the dongle. Callee disposes of txp. */
67 int (*brcmf_bus_txdata)(struct device *, struct sk_buff *);
68 /* Send/receive a control message to/from the dongle.
69 * Expects caller to enforce a single outstanding transaction.
70 */
71 int (*brcmf_bus_txctl)(struct device *, unsigned char *, uint);
72 int (*brcmf_bus_rxctl)(struct device *, unsigned char *, uint);
73}; 97};
74 98
75/* 99/*
100 * callback wrappers
101 */
102static inline int brcmf_bus_init(struct brcmf_bus *bus)
103{
104 return bus->ops->init(bus->dev);
105}
106
107static inline void brcmf_bus_stop(struct brcmf_bus *bus)
108{
109 bus->ops->stop(bus->dev);
110}
111
112static inline int brcmf_bus_txdata(struct brcmf_bus *bus, struct sk_buff *skb)
113{
114 return bus->ops->txdata(bus->dev, skb);
115}
116
117static inline
118int brcmf_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
119{
120 return bus->ops->txctl(bus->dev, msg, len);
121}
122
123static inline
124int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len)
125{
126 return bus->ops->rxctl(bus->dev, msg, len);
127}
128
129/*
76 * interface functions from common layer 130 * interface functions from common layer
77 */ 131 */
78 132
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
index 87536d38a4ca..83923553f1ac 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
@@ -117,9 +117,7 @@ static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr)
117 len = CDC_MAX_MSG_SIZE; 117 len = CDC_MAX_MSG_SIZE;
118 118
119 /* Send request */ 119 /* Send request */
120 return drvr->bus_if->brcmf_bus_txctl(drvr->dev, 120 return brcmf_bus_txctl(drvr->bus_if, (unsigned char *)&prot->msg, len);
121 (unsigned char *)&prot->msg,
122 len);
123} 121}
124 122
125static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) 123static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len)
@@ -128,11 +126,10 @@ static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len)
128 struct brcmf_proto *prot = drvr->prot; 126 struct brcmf_proto *prot = drvr->prot;
129 127
130 brcmf_dbg(TRACE, "Enter\n"); 128 brcmf_dbg(TRACE, "Enter\n");
131 129 len += sizeof(struct brcmf_proto_cdc_dcmd);
132 do { 130 do {
133 ret = drvr->bus_if->brcmf_bus_rxctl(drvr->dev, 131 ret = brcmf_bus_rxctl(drvr->bus_if, (unsigned char *)&prot->msg,
134 (unsigned char *)&prot->msg, 132 len);
135 len + sizeof(struct brcmf_proto_cdc_dcmd));
136 if (ret < 0) 133 if (ret < 0)
137 break; 134 break;
138 } while (CDC_DCMD_ID(le32_to_cpu(prot->msg.flags)) != id); 135 } while (CDC_DCMD_ID(le32_to_cpu(prot->msg.flags)) != id);
@@ -179,7 +176,7 @@ brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
179 176
180 ret = brcmf_proto_cdc_msg(drvr); 177 ret = brcmf_proto_cdc_msg(drvr);
181 if (ret < 0) { 178 if (ret < 0) {
182 brcmf_dbg(ERROR, "brcmf_proto_cdc_msg failed w/status %d\n", 179 brcmf_err("brcmf_proto_cdc_msg failed w/status %d\n",
183 ret); 180 ret);
184 goto done; 181 goto done;
185 } 182 }
@@ -196,7 +193,7 @@ retry:
196 if ((id < prot->reqid) && (++retries < RETRIES)) 193 if ((id < prot->reqid) && (++retries < RETRIES))
197 goto retry; 194 goto retry;
198 if (id != prot->reqid) { 195 if (id != prot->reqid) {
199 brcmf_dbg(ERROR, "%s: unexpected request id %d (expected %d)\n", 196 brcmf_err("%s: unexpected request id %d (expected %d)\n",
200 brcmf_ifname(drvr, ifidx), id, prot->reqid); 197 brcmf_ifname(drvr, ifidx), id, prot->reqid);
201 ret = -EINVAL; 198 ret = -EINVAL;
202 goto done; 199 goto done;
@@ -258,7 +255,7 @@ int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
258 id = (flags & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT; 255 id = (flags & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT;
259 256
260 if (id != prot->reqid) { 257 if (id != prot->reqid) {
261 brcmf_dbg(ERROR, "%s: unexpected request id %d (expected %d)\n", 258 brcmf_err("%s: unexpected request id %d (expected %d)\n",
262 brcmf_ifname(drvr, ifidx), id, prot->reqid); 259 brcmf_ifname(drvr, ifidx), id, prot->reqid);
263 ret = -EINVAL; 260 ret = -EINVAL;
264 goto done; 261 goto done;
@@ -320,7 +317,7 @@ int brcmf_proto_hdrpull(struct device *dev, int *ifidx,
320 /* Pop BDC header used to convey priority for buses that don't */ 317 /* Pop BDC header used to convey priority for buses that don't */
321 318
322 if (pktbuf->len < BDC_HEADER_LEN) { 319 if (pktbuf->len < BDC_HEADER_LEN) {
323 brcmf_dbg(ERROR, "rx data too short (%d < %d)\n", 320 brcmf_err("rx data too short (%d < %d)\n",
324 pktbuf->len, BDC_HEADER_LEN); 321 pktbuf->len, BDC_HEADER_LEN);
325 return -EBADE; 322 return -EBADE;
326 } 323 }
@@ -329,13 +326,13 @@ int brcmf_proto_hdrpull(struct device *dev, int *ifidx,
329 326
330 *ifidx = BDC_GET_IF_IDX(h); 327 *ifidx = BDC_GET_IF_IDX(h);
331 if (*ifidx >= BRCMF_MAX_IFS) { 328 if (*ifidx >= BRCMF_MAX_IFS) {
332 brcmf_dbg(ERROR, "rx data ifnum out of range (%d)\n", *ifidx); 329 brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
333 return -EBADE; 330 return -EBADE;
334 } 331 }
335 332
336 if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != 333 if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) !=
337 BDC_PROTO_VER) { 334 BDC_PROTO_VER) {
338 brcmf_dbg(ERROR, "%s: non-BDC packet received, flags 0x%x\n", 335 brcmf_err("%s: non-BDC packet received, flags 0x%x\n",
339 brcmf_ifname(drvr, *ifidx), h->flags); 336 brcmf_ifname(drvr, *ifidx), h->flags);
340 return -EBADE; 337 return -EBADE;
341 } 338 }
@@ -364,7 +361,7 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
364 361
365 /* ensure that the msg buf directly follows the cdc msg struct */ 362 /* ensure that the msg buf directly follows the cdc msg struct */
366 if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) { 363 if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) {
367 brcmf_dbg(ERROR, "struct brcmf_proto is not correctly defined\n"); 364 brcmf_err("struct brcmf_proto is not correctly defined\n");
368 goto fail; 365 goto fail;
369 } 366 }
370 367
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
index eee7175f1515..f8b52e5b941a 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
@@ -80,7 +80,7 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
80 p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) : 80 p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) :
81 brcmu_pktq_pdeq_tail(q, eprec); 81 brcmu_pktq_pdeq_tail(q, eprec);
82 if (p == NULL) 82 if (p == NULL)
83 brcmf_dbg(ERROR, "brcmu_pktq_penq() failed, oldest %d\n", 83 brcmf_err("brcmu_pktq_penq() failed, oldest %d\n",
84 discard_oldest); 84 discard_oldest);
85 85
86 brcmu_pkt_buf_free_skb(p); 86 brcmu_pkt_buf_free_skb(p);
@@ -89,7 +89,7 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
89 /* Enqueue */ 89 /* Enqueue */
90 p = brcmu_pktq_penq(q, prec, pkt); 90 p = brcmu_pktq_penq(q, prec, pkt);
91 if (p == NULL) 91 if (p == NULL)
92 brcmf_dbg(ERROR, "brcmu_pktq_penq() failed\n"); 92 brcmf_err("brcmu_pktq_penq() failed\n");
93 93
94 return p != NULL; 94 return p != NULL;
95} 95}
@@ -99,12 +99,12 @@ static int brcmf_c_pattern_atoh(char *src, char *dst)
99{ 99{
100 int i; 100 int i;
101 if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) { 101 if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) {
102 brcmf_dbg(ERROR, "Mask invalid format. Needs to start with 0x\n"); 102 brcmf_err("Mask invalid format. Needs to start with 0x\n");
103 return -EINVAL; 103 return -EINVAL;
104 } 104 }
105 src = src + 2; /* Skip past 0x */ 105 src = src + 2; /* Skip past 0x */
106 if (strlen(src) % 2 != 0) { 106 if (strlen(src) % 2 != 0) {
107 brcmf_dbg(ERROR, "Mask invalid format. Length must be even.\n"); 107 brcmf_err("Mask invalid format. Length must be even.\n");
108 return -EINVAL; 108 return -EINVAL;
109 } 109 }
110 for (i = 0; *src != '\0'; i++) { 110 for (i = 0; *src != '\0'; i++) {
@@ -139,7 +139,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_if *ifp, char *arg, int enable,
139 argv = strsep(&arg_save, " "); 139 argv = strsep(&arg_save, " ");
140 140
141 if (argv == NULL) { 141 if (argv == NULL) {
142 brcmf_dbg(ERROR, "No args provided\n"); 142 brcmf_err("No args provided\n");
143 goto fail; 143 goto fail;
144 } 144 }
145 145
@@ -154,12 +154,12 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_if *ifp, char *arg, int enable,
154 err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_enable", &enable_parm, 154 err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_enable", &enable_parm,
155 sizeof(enable_parm)); 155 sizeof(enable_parm));
156 if (err) 156 if (err)
157 brcmf_dbg(ERROR, "Set pkt_filter_enable error (%d)\n", err); 157 brcmf_err("Set pkt_filter_enable error (%d)\n", err);
158 158
159 /* Control the master mode */ 159 /* Control the master mode */
160 err = brcmf_fil_iovar_int_set(ifp, "pkt_filter_mode", master_mode); 160 err = brcmf_fil_iovar_int_set(ifp, "pkt_filter_mode", master_mode);
161 if (err) 161 if (err)
162 brcmf_dbg(ERROR, "Set pkt_filter_mode error (%d)\n", err); 162 brcmf_err("Set pkt_filter_mode error (%d)\n", err);
163 163
164fail: 164fail:
165 kfree(arg_org); 165 kfree(arg_org);
@@ -191,14 +191,14 @@ static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg)
191 while (argv[i]) { 191 while (argv[i]) {
192 i++; 192 i++;
193 if (i >= 8) { 193 if (i >= 8) {
194 brcmf_dbg(ERROR, "Too many parameters\n"); 194 brcmf_err("Too many parameters\n");
195 goto fail; 195 goto fail;
196 } 196 }
197 argv[i] = strsep(&arg_save, " "); 197 argv[i] = strsep(&arg_save, " ");
198 } 198 }
199 199
200 if (i != 6) { 200 if (i != 6) {
201 brcmf_dbg(ERROR, "Not enough args provided %d\n", i); 201 brcmf_err("Not enough args provided %d\n", i);
202 goto fail; 202 goto fail;
203 } 203 }
204 204
@@ -233,7 +233,7 @@ static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg)
233 (char *)&pkt_filter->u.pattern.mask_and_pattern[mask_size]); 233 (char *)&pkt_filter->u.pattern.mask_and_pattern[mask_size]);
234 234
235 if (mask_size != pattern_size) { 235 if (mask_size != pattern_size) {
236 brcmf_dbg(ERROR, "Mask and pattern not the same size\n"); 236 brcmf_err("Mask and pattern not the same size\n");
237 goto fail; 237 goto fail;
238 } 238 }
239 239
@@ -245,7 +245,7 @@ static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg)
245 err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_add", pkt_filter, 245 err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_add", pkt_filter,
246 buf_len); 246 buf_len);
247 if (err) 247 if (err)
248 brcmf_dbg(ERROR, "Set pkt_filter_add error (%d)\n", err); 248 brcmf_err("Set pkt_filter_add error (%d)\n", err);
249 249
250fail: 250fail:
251 kfree(arg_org); 251 kfree(arg_org);
@@ -266,7 +266,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
266 err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, 266 err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr,
267 sizeof(ifp->mac_addr)); 267 sizeof(ifp->mac_addr));
268 if (err < 0) { 268 if (err < 0) {
269 brcmf_dbg(ERROR, "Retreiving cur_etheraddr failed, %d\n", 269 brcmf_err("Retreiving cur_etheraddr failed, %d\n",
270 err); 270 err);
271 goto done; 271 goto done;
272 } 272 }
@@ -277,14 +277,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
277 strcpy(buf, "ver"); 277 strcpy(buf, "ver");
278 err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); 278 err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf));
279 if (err < 0) { 279 if (err < 0) {
280 brcmf_dbg(ERROR, "Retreiving version information failed, %d\n", 280 brcmf_err("Retreiving version information failed, %d\n",
281 err); 281 err);
282 goto done; 282 goto done;
283 } 283 }
284 ptr = (char *)buf; 284 ptr = (char *)buf;
285 strsep(&ptr, "\n"); 285 strsep(&ptr, "\n");
286 /* Print fw version info */ 286 /* Print fw version info */
287 brcmf_dbg(ERROR, "Firmware version = %s\n", buf); 287 brcmf_err("Firmware version = %s\n", buf);
288 288
289 /* 289 /*
290 * Setup timeout if Beacons are lost and roam is off to report 290 * Setup timeout if Beacons are lost and roam is off to report
@@ -293,7 +293,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
293 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", 293 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout",
294 BRCMF_DEFAULT_BCN_TIMEOUT); 294 BRCMF_DEFAULT_BCN_TIMEOUT);
295 if (err) { 295 if (err) {
296 brcmf_dbg(ERROR, "bcn_timeout error (%d)\n", err); 296 brcmf_err("bcn_timeout error (%d)\n", err);
297 goto done; 297 goto done;
298 } 298 }
299 299
@@ -302,7 +302,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
302 */ 302 */
303 err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1); 303 err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1);
304 if (err) { 304 if (err) {
305 brcmf_dbg(ERROR, "roam_off error (%d)\n", err); 305 brcmf_err("roam_off error (%d)\n", err);
306 goto done; 306 goto done;
307 } 307 }
308 308
@@ -310,14 +310,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
310 err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, 310 err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask,
311 BRCMF_EVENTING_MASK_LEN); 311 BRCMF_EVENTING_MASK_LEN);
312 if (err) { 312 if (err) {
313 brcmf_dbg(ERROR, "Get event_msgs error (%d)\n", err); 313 brcmf_err("Get event_msgs error (%d)\n", err);
314 goto done; 314 goto done;
315 } 315 }
316 setbit(eventmask, BRCMF_E_IF); 316 setbit(eventmask, BRCMF_E_IF);
317 err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask, 317 err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask,
318 BRCMF_EVENTING_MASK_LEN); 318 BRCMF_EVENTING_MASK_LEN);
319 if (err) { 319 if (err) {
320 brcmf_dbg(ERROR, "Set event_msgs error (%d)\n", err); 320 brcmf_err("Set event_msgs error (%d)\n", err);
321 goto done; 321 goto done;
322 } 322 }
323 323
@@ -325,7 +325,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
325 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, 325 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
326 BRCMF_DEFAULT_SCAN_CHANNEL_TIME); 326 BRCMF_DEFAULT_SCAN_CHANNEL_TIME);
327 if (err) { 327 if (err) {
328 brcmf_dbg(ERROR, "BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", 328 brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n",
329 err); 329 err);
330 goto done; 330 goto done;
331 } 331 }
@@ -334,7 +334,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
334 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, 334 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
335 BRCMF_DEFAULT_SCAN_UNASSOC_TIME); 335 BRCMF_DEFAULT_SCAN_UNASSOC_TIME);
336 if (err) { 336 if (err) {
337 brcmf_dbg(ERROR, "BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", 337 brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n",
338 err); 338 err);
339 goto done; 339 goto done;
340 } 340 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
index 7e58e8ce9aba..57671eddf79d 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c
@@ -20,6 +20,7 @@
20#include <brcmu_wifi.h> 20#include <brcmu_wifi.h>
21#include <brcmu_utils.h> 21#include <brcmu_utils.h>
22#include "dhd.h" 22#include "dhd.h"
23#include "dhd_bus.h"
23#include "dhd_dbg.h" 24#include "dhd_dbg.h"
24 25
25static struct dentry *root_folder; 26static struct dentry *root_folder;
@@ -42,10 +43,12 @@ void brcmf_debugfs_exit(void)
42 43
43int brcmf_debugfs_attach(struct brcmf_pub *drvr) 44int brcmf_debugfs_attach(struct brcmf_pub *drvr)
44{ 45{
46 struct device *dev = drvr->bus_if->dev;
47
45 if (!root_folder) 48 if (!root_folder)
46 return -ENODEV; 49 return -ENODEV;
47 50
48 drvr->dbgfs_dir = debugfs_create_dir(dev_name(drvr->dev), root_folder); 51 drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
49 return PTR_RET(drvr->dbgfs_dir); 52 return PTR_RET(drvr->dbgfs_dir);
50} 53}
51 54
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h
index a0e18a1ceb4b..f2ab01cd7966 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h
@@ -18,7 +18,6 @@
18#define _BRCMF_DBG_H_ 18#define _BRCMF_DBG_H_
19 19
20/* message levels */ 20/* message levels */
21#define BRCMF_ERROR_VAL 0x0001
22#define BRCMF_TRACE_VAL 0x0002 21#define BRCMF_TRACE_VAL 0x0002
23#define BRCMF_INFO_VAL 0x0004 22#define BRCMF_INFO_VAL 0x0004
24#define BRCMF_DATA_VAL 0x0008 23#define BRCMF_DATA_VAL 0x0008
@@ -32,23 +31,29 @@
32#define BRCMF_BTA_VAL 0x0800 31#define BRCMF_BTA_VAL 0x0800
33#define BRCMF_FIL_VAL 0x1000 32#define BRCMF_FIL_VAL 0x1000
34#define BRCMF_USB_VAL 0x2000 33#define BRCMF_USB_VAL 0x2000
34#define BRCMF_SCAN_VAL 0x4000
35#define BRCMF_CONN_VAL 0x8000
36
37/* Macro for error messages. net_ratelimit() is used when driver
38 * debugging is not selected. When debugging the driver error
39 * messages are as important as other tracing or even more so.
40 */
41#ifdef CONFIG_BRCMDBG
42#define brcmf_err(fmt, ...) pr_err("%s: " fmt, __func__, ##__VA_ARGS__)
43#else
44#define brcmf_err(fmt, ...) \
45 do { \
46 if (net_ratelimit()) \
47 pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \
48 } while (0)
49#endif
35 50
36#if defined(DEBUG) 51#if defined(DEBUG)
37 52
38#define brcmf_dbg(level, fmt, ...) \ 53#define brcmf_dbg(level, fmt, ...) \
39do { \ 54do { \
40 if (BRCMF_ERROR_VAL == BRCMF_##level##_VAL) { \ 55 if (brcmf_msg_level & BRCMF_##level##_VAL) \
41 if (brcmf_msg_level & BRCMF_##level##_VAL) { \ 56 pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \
42 if (net_ratelimit()) \
43 pr_debug("%s: " fmt, \
44 __func__, ##__VA_ARGS__); \
45 } \
46 } else { \
47 if (brcmf_msg_level & BRCMF_##level##_VAL) { \
48 pr_debug("%s: " fmt, \
49 __func__, ##__VA_ARGS__); \
50 } \
51 } \
52} while (0) 57} while (0)
53 58
54#define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL) 59#define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index b6c86b046c15..74a616b4de8e 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -39,19 +39,19 @@ MODULE_LICENSE("Dual BSD/GPL");
39#define MAX_WAIT_FOR_8021X_TX 50 /* msecs */ 39#define MAX_WAIT_FOR_8021X_TX 50 /* msecs */
40 40
41/* Error bits */ 41/* Error bits */
42int brcmf_msg_level = BRCMF_ERROR_VAL; 42int brcmf_msg_level;
43module_param(brcmf_msg_level, int, 0); 43module_param(brcmf_msg_level, int, 0);
44 44
45 45
46char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx) 46char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
47{ 47{
48 if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) { 48 if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
49 brcmf_dbg(ERROR, "ifidx %d out of range\n", ifidx); 49 brcmf_err("ifidx %d out of range\n", ifidx);
50 return "<if_bad>"; 50 return "<if_bad>";
51 } 51 }
52 52
53 if (drvr->iflist[ifidx] == NULL) { 53 if (drvr->iflist[ifidx] == NULL) {
54 brcmf_dbg(ERROR, "null i/f %d\n", ifidx); 54 brcmf_err("null i/f %d\n", ifidx);
55 return "<if_null>"; 55 return "<if_null>";
56 } 56 }
57 57
@@ -102,7 +102,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
102 102
103 err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen); 103 err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen);
104 if (err < 0) { 104 if (err < 0) {
105 brcmf_dbg(ERROR, "Setting mcast_list failed, %d\n", err); 105 brcmf_err("Setting mcast_list failed, %d\n", err);
106 cmd_value = cnt ? true : cmd_value; 106 cmd_value = cnt ? true : cmd_value;
107 } 107 }
108 108
@@ -115,13 +115,13 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
115 */ 115 */
116 err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value); 116 err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value);
117 if (err < 0) 117 if (err < 0)
118 brcmf_dbg(ERROR, "Setting allmulti failed, %d\n", err); 118 brcmf_err("Setting allmulti failed, %d\n", err);
119 119
120 /*Finally, pick up the PROMISC flag */ 120 /*Finally, pick up the PROMISC flag */
121 cmd_value = (ndev->flags & IFF_PROMISC) ? true : false; 121 cmd_value = (ndev->flags & IFF_PROMISC) ? true : false;
122 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value); 122 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value);
123 if (err < 0) 123 if (err < 0)
124 brcmf_dbg(ERROR, "Setting BRCMF_C_SET_PROMISC failed, %d\n", 124 brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n",
125 err); 125 err);
126} 126}
127 127
@@ -137,7 +137,7 @@ _brcmf_set_mac_address(struct work_struct *work)
137 err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr, 137 err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr,
138 ETH_ALEN); 138 ETH_ALEN);
139 if (err < 0) { 139 if (err < 0) {
140 brcmf_dbg(ERROR, "Setting cur_etheraddr failed, %d\n", err); 140 brcmf_err("Setting cur_etheraddr failed, %d\n", err);
141 } else { 141 } else {
142 brcmf_dbg(TRACE, "MAC address updated to %pM\n", 142 brcmf_dbg(TRACE, "MAC address updated to %pM\n",
143 ifp->mac_addr); 143 ifp->mac_addr);
@@ -173,7 +173,7 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
173 /* Reject if down */ 173 /* Reject if down */
174 if (!drvr->bus_if->drvr_up || 174 if (!drvr->bus_if->drvr_up ||
175 (drvr->bus_if->state != BRCMF_BUS_DATA)) { 175 (drvr->bus_if->state != BRCMF_BUS_DATA)) {
176 brcmf_dbg(ERROR, "xmit rejected drvup=%d state=%d\n", 176 brcmf_err("xmit rejected drvup=%d state=%d\n",
177 drvr->bus_if->drvr_up, 177 drvr->bus_if->drvr_up,
178 drvr->bus_if->state); 178 drvr->bus_if->state);
179 netif_stop_queue(ndev); 179 netif_stop_queue(ndev);
@@ -181,7 +181,7 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
181 } 181 }
182 182
183 if (!drvr->iflist[ifp->idx]) { 183 if (!drvr->iflist[ifp->idx]) {
184 brcmf_dbg(ERROR, "bad ifidx %d\n", ifp->idx); 184 brcmf_err("bad ifidx %d\n", ifp->idx);
185 netif_stop_queue(ndev); 185 netif_stop_queue(ndev);
186 return -ENODEV; 186 return -ENODEV;
187 } 187 }
@@ -197,7 +197,7 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
197 dev_kfree_skb(skb); 197 dev_kfree_skb(skb);
198 skb = skb2; 198 skb = skb2;
199 if (skb == NULL) { 199 if (skb == NULL) {
200 brcmf_dbg(ERROR, "%s: skb_realloc_headroom failed\n", 200 brcmf_err("%s: skb_realloc_headroom failed\n",
201 brcmf_ifname(drvr, ifp->idx)); 201 brcmf_ifname(drvr, ifp->idx));
202 ret = -ENOMEM; 202 ret = -ENOMEM;
203 goto done; 203 goto done;
@@ -219,7 +219,7 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
219 brcmf_proto_hdrpush(drvr, ifp->idx, skb); 219 brcmf_proto_hdrpush(drvr, ifp->idx, skb);
220 220
221 /* Use bus module to send data frame */ 221 /* Use bus module to send data frame */
222 ret = drvr->bus_if->brcmf_bus_txdata(drvr->dev, skb); 222 ret = brcmf_bus_txdata(drvr->bus_if, skb);
223 223
224done: 224done:
225 if (ret) 225 if (ret)
@@ -377,13 +377,13 @@ static int brcmf_toe_set(struct brcmf_if *ifp, u32 toe_ol)
377 377
378 err = brcmf_fil_iovar_int_set(ifp, "toe_ol", toe_ol); 378 err = brcmf_fil_iovar_int_set(ifp, "toe_ol", toe_ol);
379 if (err < 0) { 379 if (err < 0) {
380 brcmf_dbg(ERROR, "Setting toe_ol failed, %d\n", err); 380 brcmf_err("Setting toe_ol failed, %d\n", err);
381 return err; 381 return err;
382 } 382 }
383 383
384 err = brcmf_fil_iovar_int_set(ifp, "toe", (toe_ol != 0)); 384 err = brcmf_fil_iovar_int_set(ifp, "toe", (toe_ol != 0));
385 if (err < 0) 385 if (err < 0)
386 brcmf_dbg(ERROR, "Setting toe failed, %d\n", err); 386 brcmf_err("Setting toe failed, %d\n", err);
387 387
388 return err; 388 return err;
389 389
@@ -397,7 +397,7 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
397 397
398 sprintf(info->driver, KBUILD_MODNAME); 398 sprintf(info->driver, KBUILD_MODNAME);
399 sprintf(info->version, "%lu", drvr->drv_version); 399 sprintf(info->version, "%lu", drvr->drv_version);
400 sprintf(info->bus_info, "%s", dev_name(drvr->dev)); 400 sprintf(info->bus_info, "%s", dev_name(drvr->bus_if->dev));
401} 401}
402 402
403static const struct ethtool_ops brcmf_ethtool_ops = { 403static const struct ethtool_ops brcmf_ethtool_ops = {
@@ -440,7 +440,7 @@ static int brcmf_ethtool(struct brcmf_if *ifp, void __user *uaddr)
440 440
441 /* otherwise, require dongle to be up */ 441 /* otherwise, require dongle to be up */
442 else if (!drvr->bus_if->drvr_up) { 442 else if (!drvr->bus_if->drvr_up) {
443 brcmf_dbg(ERROR, "dongle is not up\n"); 443 brcmf_err("dongle is not up\n");
444 return -ENODEV; 444 return -ENODEV;
445 } 445 }
446 /* finally, report dongle driver type */ 446 /* finally, report dongle driver type */
@@ -559,7 +559,7 @@ static int brcmf_netdev_open(struct net_device *ndev)
559 559
560 /* If bus is not ready, can't continue */ 560 /* If bus is not ready, can't continue */
561 if (bus_if->state != BRCMF_BUS_DATA) { 561 if (bus_if->state != BRCMF_BUS_DATA) {
562 brcmf_dbg(ERROR, "failed bus is not ready\n"); 562 brcmf_err("failed bus is not ready\n");
563 return -EAGAIN; 563 return -EAGAIN;
564 } 564 }
565 565
@@ -583,7 +583,7 @@ static int brcmf_netdev_open(struct net_device *ndev)
583 netif_start_queue(ndev); 583 netif_start_queue(ndev);
584 drvr->bus_if->drvr_up = true; 584 drvr->bus_if->drvr_up = true;
585 if (brcmf_cfg80211_up(ndev)) { 585 if (brcmf_cfg80211_up(ndev)) {
586 brcmf_dbg(ERROR, "failed to bring up cfg80211\n"); 586 brcmf_err("failed to bring up cfg80211\n");
587 return -1; 587 return -1;
588 } 588 }
589 589
@@ -634,7 +634,7 @@ int brcmf_net_attach(struct brcmf_if *ifp)
634 memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); 634 memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
635 635
636 if (register_netdev(ndev) != 0) { 636 if (register_netdev(ndev) != 0) {
637 brcmf_dbg(ERROR, "couldn't register the net device\n"); 637 brcmf_err("couldn't register the net device\n");
638 goto fail; 638 goto fail;
639 } 639 }
640 640
@@ -662,7 +662,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, s32 bssidx,
662 * in case we missed the BRCMF_E_IF_DEL event. 662 * in case we missed the BRCMF_E_IF_DEL event.
663 */ 663 */
664 if (ifp) { 664 if (ifp) {
665 brcmf_dbg(ERROR, "ERROR: netdev:%s already exists\n", 665 brcmf_err("ERROR: netdev:%s already exists\n",
666 ifp->ndev->name); 666 ifp->ndev->name);
667 if (ifidx) { 667 if (ifidx) {
668 netif_stop_queue(ifp->ndev); 668 netif_stop_queue(ifp->ndev);
@@ -670,7 +670,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, s32 bssidx,
670 free_netdev(ifp->ndev); 670 free_netdev(ifp->ndev);
671 drvr->iflist[ifidx] = NULL; 671 drvr->iflist[ifidx] = NULL;
672 } else { 672 } else {
673 brcmf_dbg(ERROR, "ignore IF event\n"); 673 brcmf_err("ignore IF event\n");
674 return ERR_PTR(-EINVAL); 674 return ERR_PTR(-EINVAL);
675 } 675 }
676 } 676 }
@@ -678,7 +678,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, s32 bssidx,
678 /* Allocate netdev, including space for private structure */ 678 /* Allocate netdev, including space for private structure */
679 ndev = alloc_netdev(sizeof(struct brcmf_if), name, ether_setup); 679 ndev = alloc_netdev(sizeof(struct brcmf_if), name, ether_setup);
680 if (!ndev) { 680 if (!ndev) {
681 brcmf_dbg(ERROR, "OOM - alloc_netdev\n"); 681 brcmf_err("OOM - alloc_netdev\n");
682 return ERR_PTR(-ENOMEM); 682 return ERR_PTR(-ENOMEM);
683 } 683 }
684 684
@@ -710,7 +710,7 @@ void brcmf_del_if(struct brcmf_pub *drvr, int ifidx)
710 710
711 ifp = drvr->iflist[ifidx]; 711 ifp = drvr->iflist[ifidx];
712 if (!ifp) { 712 if (!ifp) {
713 brcmf_dbg(ERROR, "Null interface\n"); 713 brcmf_err("Null interface\n");
714 return; 714 return;
715 } 715 }
716 if (ifp->ndev) { 716 if (ifp->ndev) {
@@ -753,7 +753,6 @@ int brcmf_attach(uint bus_hdrlen, struct device *dev)
753 drvr->hdrlen = bus_hdrlen; 753 drvr->hdrlen = bus_hdrlen;
754 drvr->bus_if = dev_get_drvdata(dev); 754 drvr->bus_if = dev_get_drvdata(dev);
755 drvr->bus_if->drvr = drvr; 755 drvr->bus_if->drvr = drvr;
756 drvr->dev = dev;
757 756
758 /* create device debugfs folder */ 757 /* create device debugfs folder */
759 brcmf_debugfs_attach(drvr); 758 brcmf_debugfs_attach(drvr);
@@ -761,7 +760,7 @@ int brcmf_attach(uint bus_hdrlen, struct device *dev)
761 /* Attach and link in the protocol */ 760 /* Attach and link in the protocol */
762 ret = brcmf_proto_attach(drvr); 761 ret = brcmf_proto_attach(drvr);
763 if (ret != 0) { 762 if (ret != 0) {
764 brcmf_dbg(ERROR, "brcmf_prot_attach failed\n"); 763 brcmf_err("brcmf_prot_attach failed\n");
765 goto fail; 764 goto fail;
766 } 765 }
767 766
@@ -790,9 +789,9 @@ int brcmf_bus_start(struct device *dev)
790 brcmf_dbg(TRACE, "\n"); 789 brcmf_dbg(TRACE, "\n");
791 790
792 /* Bring up the bus */ 791 /* Bring up the bus */
793 ret = bus_if->brcmf_bus_init(dev); 792 ret = brcmf_bus_init(bus_if);
794 if (ret != 0) { 793 if (ret != 0) {
795 brcmf_dbg(ERROR, "brcmf_sdbrcm_bus_init failed %d\n", ret); 794 brcmf_err("brcmf_sdbrcm_bus_init failed %d\n", ret);
796 return ret; 795 return ret;
797 } 796 }
798 797
@@ -809,7 +808,7 @@ int brcmf_bus_start(struct device *dev)
809 if (ret < 0) 808 if (ret < 0)
810 goto fail; 809 goto fail;
811 810
812 drvr->config = brcmf_cfg80211_attach(drvr); 811 drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev);
813 if (drvr->config == NULL) { 812 if (drvr->config == NULL) {
814 ret = -ENOMEM; 813 ret = -ENOMEM;
815 goto fail; 814 goto fail;
@@ -822,7 +821,7 @@ int brcmf_bus_start(struct device *dev)
822 ret = brcmf_net_attach(ifp); 821 ret = brcmf_net_attach(ifp);
823fail: 822fail:
824 if (ret < 0) { 823 if (ret < 0) {
825 brcmf_dbg(ERROR, "failed: %d\n", ret); 824 brcmf_err("failed: %d\n", ret);
826 if (drvr->config) 825 if (drvr->config)
827 brcmf_cfg80211_detach(drvr->config); 826 brcmf_cfg80211_detach(drvr->config);
828 free_netdev(drvr->iflist[0]->ndev); 827 free_netdev(drvr->iflist[0]->ndev);
@@ -842,7 +841,7 @@ static void brcmf_bus_detach(struct brcmf_pub *drvr)
842 brcmf_proto_stop(drvr); 841 brcmf_proto_stop(drvr);
843 842
844 /* Stop the bus module */ 843 /* Stop the bus module */
845 drvr->bus_if->brcmf_bus_stop(drvr->dev); 844 brcmf_bus_stop(drvr->bus_if);
846 } 845 }
847} 846}
848 847
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 45725454714d..cf857f1edf8c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -689,7 +689,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
689 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 689 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
690 clkreq, &err); 690 clkreq, &err);
691 if (err) { 691 if (err) {
692 brcmf_dbg(ERROR, "HT Avail request error: %d\n", err); 692 brcmf_err("HT Avail request error: %d\n", err);
693 return -EBADE; 693 return -EBADE;
694 } 694 }
695 695
@@ -697,7 +697,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
697 clkctl = brcmf_sdio_regrb(bus->sdiodev, 697 clkctl = brcmf_sdio_regrb(bus->sdiodev,
698 SBSDIO_FUNC1_CHIPCLKCSR, &err); 698 SBSDIO_FUNC1_CHIPCLKCSR, &err);
699 if (err) { 699 if (err) {
700 brcmf_dbg(ERROR, "HT Avail read error: %d\n", err); 700 brcmf_err("HT Avail read error: %d\n", err);
701 return -EBADE; 701 return -EBADE;
702 } 702 }
703 703
@@ -707,7 +707,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
707 devctl = brcmf_sdio_regrb(bus->sdiodev, 707 devctl = brcmf_sdio_regrb(bus->sdiodev,
708 SBSDIO_DEVICE_CTL, &err); 708 SBSDIO_DEVICE_CTL, &err);
709 if (err) { 709 if (err) {
710 brcmf_dbg(ERROR, "Devctl error setting CA: %d\n", 710 brcmf_err("Devctl error setting CA: %d\n",
711 err); 711 err);
712 return -EBADE; 712 return -EBADE;
713 } 713 }
@@ -741,11 +741,11 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
741 usleep_range(5000, 10000); 741 usleep_range(5000, 10000);
742 } 742 }
743 if (err) { 743 if (err) {
744 brcmf_dbg(ERROR, "HT Avail request error: %d\n", err); 744 brcmf_err("HT Avail request error: %d\n", err);
745 return -EBADE; 745 return -EBADE;
746 } 746 }
747 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { 747 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
748 brcmf_dbg(ERROR, "HT Avail timeout (%d): clkctl 0x%02x\n", 748 brcmf_err("HT Avail timeout (%d): clkctl 0x%02x\n",
749 PMU_MAX_TRANSITION_DLY, clkctl); 749 PMU_MAX_TRANSITION_DLY, clkctl);
750 return -EBADE; 750 return -EBADE;
751 } 751 }
@@ -757,7 +757,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
757#if defined(DEBUG) 757#if defined(DEBUG)
758 if (!bus->alp_only) { 758 if (!bus->alp_only) {
759 if (SBSDIO_ALPONLY(clkctl)) 759 if (SBSDIO_ALPONLY(clkctl))
760 brcmf_dbg(ERROR, "HT Clock should be on\n"); 760 brcmf_err("HT Clock should be on\n");
761 } 761 }
762#endif /* defined (DEBUG) */ 762#endif /* defined (DEBUG) */
763 763
@@ -779,7 +779,7 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
779 clkreq, &err); 779 clkreq, &err);
780 brcmf_dbg(INFO, "CLKCTL: turned OFF\n"); 780 brcmf_dbg(INFO, "CLKCTL: turned OFF\n");
781 if (err) { 781 if (err) {
782 brcmf_dbg(ERROR, "Failed access turning clock off: %d\n", 782 brcmf_err("Failed access turning clock off: %d\n",
783 err); 783 err);
784 return -EBADE; 784 return -EBADE;
785 } 785 }
@@ -836,7 +836,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok)
836 else if (bus->clkstate == CLK_AVAIL) 836 else if (bus->clkstate == CLK_AVAIL)
837 brcmf_sdbrcm_htclk(bus, false, false); 837 brcmf_sdbrcm_htclk(bus, false, false);
838 else 838 else
839 brcmf_dbg(ERROR, "request for %d -> %d\n", 839 brcmf_err("request for %d -> %d\n",
840 bus->clkstate, target); 840 bus->clkstate, target);
841 brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); 841 brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
842 break; 842 break;
@@ -880,7 +880,7 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus)
880 brcmf_dbg(INFO, "Dongle reports NAK handled, expect rtx of %d\n", 880 brcmf_dbg(INFO, "Dongle reports NAK handled, expect rtx of %d\n",
881 bus->rx_seq); 881 bus->rx_seq);
882 if (!bus->rxskip) 882 if (!bus->rxskip)
883 brcmf_dbg(ERROR, "unexpected NAKHANDLED!\n"); 883 brcmf_err("unexpected NAKHANDLED!\n");
884 884
885 bus->rxskip = false; 885 bus->rxskip = false;
886 intstatus |= I_HMB_FRAME_IND; 886 intstatus |= I_HMB_FRAME_IND;
@@ -894,7 +894,7 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus)
894 (hmb_data & HMB_DATA_VERSION_MASK) >> 894 (hmb_data & HMB_DATA_VERSION_MASK) >>
895 HMB_DATA_VERSION_SHIFT; 895 HMB_DATA_VERSION_SHIFT;
896 if (bus->sdpcm_ver != SDPCM_PROT_VERSION) 896 if (bus->sdpcm_ver != SDPCM_PROT_VERSION)
897 brcmf_dbg(ERROR, "Version mismatch, dongle reports %d, " 897 brcmf_err("Version mismatch, dongle reports %d, "
898 "expecting %d\n", 898 "expecting %d\n",
899 bus->sdpcm_ver, SDPCM_PROT_VERSION); 899 bus->sdpcm_ver, SDPCM_PROT_VERSION);
900 else 900 else
@@ -927,7 +927,7 @@ static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus)
927 HMB_DATA_FC | 927 HMB_DATA_FC |
928 HMB_DATA_FWREADY | 928 HMB_DATA_FWREADY |
929 HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK)) 929 HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK))
930 brcmf_dbg(ERROR, "Unknown mailbox data content: 0x%02x\n", 930 brcmf_err("Unknown mailbox data content: 0x%02x\n",
931 hmb_data); 931 hmb_data);
932 932
933 return intstatus; 933 return intstatus;
@@ -940,7 +940,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
940 u8 hi, lo; 940 u8 hi, lo;
941 int err; 941 int err;
942 942
943 brcmf_dbg(ERROR, "%sterminate frame%s\n", 943 brcmf_err("%sterminate frame%s\n",
944 abort ? "abort command, " : "", 944 abort ? "abort command, " : "",
945 rtx ? ", send NAK" : ""); 945 rtx ? ", send NAK" : "");
946 946
@@ -963,14 +963,14 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
963 break; 963 break;
964 964
965 if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) { 965 if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) {
966 brcmf_dbg(ERROR, "count growing: last 0x%04x now 0x%04x\n", 966 brcmf_err("count growing: last 0x%04x now 0x%04x\n",
967 lastrbc, (hi << 8) + lo); 967 lastrbc, (hi << 8) + lo);
968 } 968 }
969 lastrbc = (hi << 8) + lo; 969 lastrbc = (hi << 8) + lo;
970 } 970 }
971 971
972 if (!retries) 972 if (!retries)
973 brcmf_dbg(ERROR, "count never zeroed: last 0x%04x\n", lastrbc); 973 brcmf_err("count never zeroed: last 0x%04x\n", lastrbc);
974 else 974 else
975 brcmf_dbg(INFO, "flush took %d iterations\n", 0xffff - retries); 975 brcmf_dbg(INFO, "flush took %d iterations\n", 0xffff - retries);
976 976
@@ -1057,22 +1057,22 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header,
1057 return -ENODATA; 1057 return -ENODATA;
1058 } 1058 }
1059 if ((u16)(~(len ^ checksum))) { 1059 if ((u16)(~(len ^ checksum))) {
1060 brcmf_dbg(ERROR, "HW header checksum error\n"); 1060 brcmf_err("HW header checksum error\n");
1061 bus->sdcnt.rx_badhdr++; 1061 bus->sdcnt.rx_badhdr++;
1062 brcmf_sdbrcm_rxfail(bus, false, false); 1062 brcmf_sdbrcm_rxfail(bus, false, false);
1063 return -EIO; 1063 return -EIO;
1064 } 1064 }
1065 if (len < SDPCM_HDRLEN) { 1065 if (len < SDPCM_HDRLEN) {
1066 brcmf_dbg(ERROR, "HW header length error\n"); 1066 brcmf_err("HW header length error\n");
1067 return -EPROTO; 1067 return -EPROTO;
1068 } 1068 }
1069 if (type == BRCMF_SDIO_FT_SUPER && 1069 if (type == BRCMF_SDIO_FT_SUPER &&
1070 (roundup(len, bus->blocksize) != rd->len)) { 1070 (roundup(len, bus->blocksize) != rd->len)) {
1071 brcmf_dbg(ERROR, "HW superframe header length error\n"); 1071 brcmf_err("HW superframe header length error\n");
1072 return -EPROTO; 1072 return -EPROTO;
1073 } 1073 }
1074 if (type == BRCMF_SDIO_FT_SUB && len > rd->len) { 1074 if (type == BRCMF_SDIO_FT_SUB && len > rd->len) {
1075 brcmf_dbg(ERROR, "HW subframe header length error\n"); 1075 brcmf_err("HW subframe header length error\n");
1076 return -EPROTO; 1076 return -EPROTO;
1077 } 1077 }
1078 rd->len = len; 1078 rd->len = len;
@@ -1089,7 +1089,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header,
1089 */ 1089 */
1090 if (type == BRCMF_SDIO_FT_SUPER && 1090 if (type == BRCMF_SDIO_FT_SUPER &&
1091 SDPCM_GLOMDESC(&header[SDPCM_FRAMETAG_LEN])) { 1091 SDPCM_GLOMDESC(&header[SDPCM_FRAMETAG_LEN])) {
1092 brcmf_dbg(ERROR, "Glom descriptor found in superframe head\n"); 1092 brcmf_err("Glom descriptor found in superframe head\n");
1093 rd->len = 0; 1093 rd->len = 0;
1094 return -EINVAL; 1094 return -EINVAL;
1095 } 1095 }
@@ -1097,7 +1097,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header,
1097 rd->channel = SDPCM_PACKET_CHANNEL(&header[SDPCM_FRAMETAG_LEN]); 1097 rd->channel = SDPCM_PACKET_CHANNEL(&header[SDPCM_FRAMETAG_LEN]);
1098 if (len > MAX_RX_DATASZ && rd->channel != SDPCM_CONTROL_CHANNEL && 1098 if (len > MAX_RX_DATASZ && rd->channel != SDPCM_CONTROL_CHANNEL &&
1099 type != BRCMF_SDIO_FT_SUPER) { 1099 type != BRCMF_SDIO_FT_SUPER) {
1100 brcmf_dbg(ERROR, "HW header length too long\n"); 1100 brcmf_err("HW header length too long\n");
1101 bus->sdiodev->bus_if->dstats.rx_errors++; 1101 bus->sdiodev->bus_if->dstats.rx_errors++;
1102 bus->sdcnt.rx_toolong++; 1102 bus->sdcnt.rx_toolong++;
1103 brcmf_sdbrcm_rxfail(bus, false, false); 1103 brcmf_sdbrcm_rxfail(bus, false, false);
@@ -1105,26 +1105,26 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header,
1105 return -EPROTO; 1105 return -EPROTO;
1106 } 1106 }
1107 if (type == BRCMF_SDIO_FT_SUPER && rd->channel != SDPCM_GLOM_CHANNEL) { 1107 if (type == BRCMF_SDIO_FT_SUPER && rd->channel != SDPCM_GLOM_CHANNEL) {
1108 brcmf_dbg(ERROR, "Wrong channel for superframe\n"); 1108 brcmf_err("Wrong channel for superframe\n");
1109 rd->len = 0; 1109 rd->len = 0;
1110 return -EINVAL; 1110 return -EINVAL;
1111 } 1111 }
1112 if (type == BRCMF_SDIO_FT_SUB && rd->channel != SDPCM_DATA_CHANNEL && 1112 if (type == BRCMF_SDIO_FT_SUB && rd->channel != SDPCM_DATA_CHANNEL &&
1113 rd->channel != SDPCM_EVENT_CHANNEL) { 1113 rd->channel != SDPCM_EVENT_CHANNEL) {
1114 brcmf_dbg(ERROR, "Wrong channel for subframe\n"); 1114 brcmf_err("Wrong channel for subframe\n");
1115 rd->len = 0; 1115 rd->len = 0;
1116 return -EINVAL; 1116 return -EINVAL;
1117 } 1117 }
1118 rd->dat_offset = SDPCM_DOFFSET_VALUE(&header[SDPCM_FRAMETAG_LEN]); 1118 rd->dat_offset = SDPCM_DOFFSET_VALUE(&header[SDPCM_FRAMETAG_LEN]);
1119 if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) { 1119 if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) {
1120 brcmf_dbg(ERROR, "seq %d: bad data offset\n", rx_seq); 1120 brcmf_err("seq %d: bad data offset\n", rx_seq);
1121 bus->sdcnt.rx_badhdr++; 1121 bus->sdcnt.rx_badhdr++;
1122 brcmf_sdbrcm_rxfail(bus, false, false); 1122 brcmf_sdbrcm_rxfail(bus, false, false);
1123 rd->len = 0; 1123 rd->len = 0;
1124 return -ENXIO; 1124 return -ENXIO;
1125 } 1125 }
1126 if (rd->seq_num != rx_seq) { 1126 if (rd->seq_num != rx_seq) {
1127 brcmf_dbg(ERROR, "seq %d: sequence number error, expect %d\n", 1127 brcmf_err("seq %d: sequence number error, expect %d\n",
1128 rx_seq, rd->seq_num); 1128 rx_seq, rd->seq_num);
1129 bus->sdcnt.rx_badseq++; 1129 bus->sdcnt.rx_badseq++;
1130 rd->seq_num = rx_seq; 1130 rd->seq_num = rx_seq;
@@ -1136,7 +1136,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header,
1136 if (rd->len_nxtfrm << 4 > MAX_RX_DATASZ) { 1136 if (rd->len_nxtfrm << 4 > MAX_RX_DATASZ) {
1137 /* only warm for NON glom packet */ 1137 /* only warm for NON glom packet */
1138 if (rd->channel != SDPCM_GLOM_CHANNEL) 1138 if (rd->channel != SDPCM_GLOM_CHANNEL)
1139 brcmf_dbg(ERROR, "seq %d: next length error\n", rx_seq); 1139 brcmf_err("seq %d: next length error\n", rx_seq);
1140 rd->len_nxtfrm = 0; 1140 rd->len_nxtfrm = 0;
1141 } 1141 }
1142 fc = SDPCM_FCMASK_VALUE(&header[SDPCM_FRAMETAG_LEN]); 1142 fc = SDPCM_FCMASK_VALUE(&header[SDPCM_FRAMETAG_LEN]);
@@ -1150,7 +1150,7 @@ static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header,
1150 } 1150 }
1151 tx_seq_max = SDPCM_WINDOW_VALUE(&header[SDPCM_FRAMETAG_LEN]); 1151 tx_seq_max = SDPCM_WINDOW_VALUE(&header[SDPCM_FRAMETAG_LEN]);
1152 if ((u8)(tx_seq_max - bus->tx_seq) > 0x40) { 1152 if ((u8)(tx_seq_max - bus->tx_seq) > 0x40) {
1153 brcmf_dbg(ERROR, "seq %d: max tx seq number error\n", rx_seq); 1153 brcmf_err("seq %d: max tx seq number error\n", rx_seq);
1154 tx_seq_max = bus->tx_seq + 2; 1154 tx_seq_max = bus->tx_seq + 2;
1155 } 1155 }
1156 bus->tx_max = tx_seq_max; 1156 bus->tx_max = tx_seq_max;
@@ -1186,7 +1186,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1186 dlen = (u16) (bus->glomd->len); 1186 dlen = (u16) (bus->glomd->len);
1187 dptr = bus->glomd->data; 1187 dptr = bus->glomd->data;
1188 if (!dlen || (dlen & 1)) { 1188 if (!dlen || (dlen & 1)) {
1189 brcmf_dbg(ERROR, "bad glomd len(%d), ignore descriptor\n", 1189 brcmf_err("bad glomd len(%d), ignore descriptor\n",
1190 dlen); 1190 dlen);
1191 dlen = 0; 1191 dlen = 0;
1192 } 1192 }
@@ -1198,13 +1198,13 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1198 dptr += sizeof(u16); 1198 dptr += sizeof(u16);
1199 if ((sublen < SDPCM_HDRLEN) || 1199 if ((sublen < SDPCM_HDRLEN) ||
1200 ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) { 1200 ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) {
1201 brcmf_dbg(ERROR, "descriptor len %d bad: %d\n", 1201 brcmf_err("descriptor len %d bad: %d\n",
1202 num, sublen); 1202 num, sublen);
1203 pnext = NULL; 1203 pnext = NULL;
1204 break; 1204 break;
1205 } 1205 }
1206 if (sublen % BRCMF_SDALIGN) { 1206 if (sublen % BRCMF_SDALIGN) {
1207 brcmf_dbg(ERROR, "sublen %d not multiple of %d\n", 1207 brcmf_err("sublen %d not multiple of %d\n",
1208 sublen, BRCMF_SDALIGN); 1208 sublen, BRCMF_SDALIGN);
1209 usechain = false; 1209 usechain = false;
1210 } 1210 }
@@ -1221,7 +1221,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1221 /* Allocate/chain packet for next subframe */ 1221 /* Allocate/chain packet for next subframe */
1222 pnext = brcmu_pkt_buf_get_skb(sublen + BRCMF_SDALIGN); 1222 pnext = brcmu_pkt_buf_get_skb(sublen + BRCMF_SDALIGN);
1223 if (pnext == NULL) { 1223 if (pnext == NULL) {
1224 brcmf_dbg(ERROR, "bcm_pkt_buf_get_skb failed, num %d len %d\n", 1224 brcmf_err("bcm_pkt_buf_get_skb failed, num %d len %d\n",
1225 num, sublen); 1225 num, sublen);
1226 break; 1226 break;
1227 } 1227 }
@@ -1284,13 +1284,13 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1284 bus->dataptr, dlen); 1284 bus->dataptr, dlen);
1285 sublen = (u16) brcmf_sdbrcm_glom_from_buf(bus, dlen); 1285 sublen = (u16) brcmf_sdbrcm_glom_from_buf(bus, dlen);
1286 if (sublen != dlen) { 1286 if (sublen != dlen) {
1287 brcmf_dbg(ERROR, "FAILED TO COPY, dlen %d sublen %d\n", 1287 brcmf_err("FAILED TO COPY, dlen %d sublen %d\n",
1288 dlen, sublen); 1288 dlen, sublen);
1289 errcode = -1; 1289 errcode = -1;
1290 } 1290 }
1291 pnext = NULL; 1291 pnext = NULL;
1292 } else { 1292 } else {
1293 brcmf_dbg(ERROR, "COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n", 1293 brcmf_err("COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n",
1294 dlen); 1294 dlen);
1295 errcode = -1; 1295 errcode = -1;
1296 } 1296 }
@@ -1299,7 +1299,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1299 1299
1300 /* On failure, kill the superframe, allow a couple retries */ 1300 /* On failure, kill the superframe, allow a couple retries */
1301 if (errcode < 0) { 1301 if (errcode < 0) {
1302 brcmf_dbg(ERROR, "glom read of %d bytes failed: %d\n", 1302 brcmf_err("glom read of %d bytes failed: %d\n",
1303 dlen, errcode); 1303 dlen, errcode);
1304 bus->sdiodev->bus_if->dstats.rx_errors++; 1304 bus->sdiodev->bus_if->dstats.rx_errors++;
1305 1305
@@ -1390,7 +1390,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1390 continue; 1390 continue;
1391 } else if (brcmf_proto_hdrpull(bus->sdiodev->dev, 1391 } else if (brcmf_proto_hdrpull(bus->sdiodev->dev,
1392 &ifidx, pfirst) != 0) { 1392 &ifidx, pfirst) != 0) {
1393 brcmf_dbg(ERROR, "rx protocol error\n"); 1393 brcmf_err("rx protocol error\n");
1394 bus->sdiodev->bus_if->dstats.rx_errors++; 1394 bus->sdiodev->bus_if->dstats.rx_errors++;
1395 skb_unlink(pfirst, &bus->glom); 1395 skb_unlink(pfirst, &bus->glom);
1396 brcmu_pkt_buf_free_skb(pfirst); 1396 brcmu_pkt_buf_free_skb(pfirst);
@@ -1456,7 +1456,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
1456 if (bus->rxblen) 1456 if (bus->rxblen)
1457 buf = vzalloc(bus->rxblen); 1457 buf = vzalloc(bus->rxblen);
1458 if (!buf) { 1458 if (!buf) {
1459 brcmf_dbg(ERROR, "no memory for control frame\n"); 1459 brcmf_err("no memory for control frame\n");
1460 goto done; 1460 goto done;
1461 } 1461 }
1462 rbuf = bus->rxbuf; 1462 rbuf = bus->rxbuf;
@@ -1486,7 +1486,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
1486 1486
1487 /* Drop if the read is too big or it exceeds our maximum */ 1487 /* Drop if the read is too big or it exceeds our maximum */
1488 if ((rdlen + BRCMF_FIRSTREAD) > bus->sdiodev->bus_if->maxctl) { 1488 if ((rdlen + BRCMF_FIRSTREAD) > bus->sdiodev->bus_if->maxctl) {
1489 brcmf_dbg(ERROR, "%d-byte control read exceeds %d-byte buffer\n", 1489 brcmf_err("%d-byte control read exceeds %d-byte buffer\n",
1490 rdlen, bus->sdiodev->bus_if->maxctl); 1490 rdlen, bus->sdiodev->bus_if->maxctl);
1491 bus->sdiodev->bus_if->dstats.rx_errors++; 1491 bus->sdiodev->bus_if->dstats.rx_errors++;
1492 brcmf_sdbrcm_rxfail(bus, false, false); 1492 brcmf_sdbrcm_rxfail(bus, false, false);
@@ -1494,7 +1494,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
1494 } 1494 }
1495 1495
1496 if ((len - doff) > bus->sdiodev->bus_if->maxctl) { 1496 if ((len - doff) > bus->sdiodev->bus_if->maxctl) {
1497 brcmf_dbg(ERROR, "%d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n", 1497 brcmf_err("%d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n",
1498 len, len - doff, bus->sdiodev->bus_if->maxctl); 1498 len, len - doff, bus->sdiodev->bus_if->maxctl);
1499 bus->sdiodev->bus_if->dstats.rx_errors++; 1499 bus->sdiodev->bus_if->dstats.rx_errors++;
1500 bus->sdcnt.rx_toolong++; 1500 bus->sdcnt.rx_toolong++;
@@ -1511,7 +1511,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
1511 1511
1512 /* Control frame failures need retransmission */ 1512 /* Control frame failures need retransmission */
1513 if (sdret < 0) { 1513 if (sdret < 0) {
1514 brcmf_dbg(ERROR, "read %d control bytes failed: %d\n", 1514 brcmf_err("read %d control bytes failed: %d\n",
1515 rdlen, sdret); 1515 rdlen, sdret);
1516 bus->sdcnt.rxc_errors++; 1516 bus->sdcnt.rxc_errors++;
1517 brcmf_sdbrcm_rxfail(bus, true, true); 1517 brcmf_sdbrcm_rxfail(bus, true, true);
@@ -1527,7 +1527,7 @@ gotpkt:
1527 /* Point to valid data and indicate its length */ 1527 /* Point to valid data and indicate its length */
1528 spin_lock_bh(&bus->rxctl_lock); 1528 spin_lock_bh(&bus->rxctl_lock);
1529 if (bus->rxctl) { 1529 if (bus->rxctl) {
1530 brcmf_dbg(ERROR, "last control frame is being processed.\n"); 1530 brcmf_err("last control frame is being processed.\n");
1531 spin_unlock_bh(&bus->rxctl_lock); 1531 spin_unlock_bh(&bus->rxctl_lock);
1532 vfree(buf); 1532 vfree(buf);
1533 goto done; 1533 goto done;
@@ -1599,7 +1599,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1599 BRCMF_FIRSTREAD); 1599 BRCMF_FIRSTREAD);
1600 bus->sdcnt.f2rxhdrs++; 1600 bus->sdcnt.f2rxhdrs++;
1601 if (sdret < 0) { 1601 if (sdret < 0) {
1602 brcmf_dbg(ERROR, "RXHEADER FAILED: %d\n", 1602 brcmf_err("RXHEADER FAILED: %d\n",
1603 sdret); 1603 sdret);
1604 bus->sdcnt.rx_hdrfail++; 1604 bus->sdcnt.rx_hdrfail++;
1605 brcmf_sdbrcm_rxfail(bus, true, true); 1605 brcmf_sdbrcm_rxfail(bus, true, true);
@@ -1643,7 +1643,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1643 BRCMF_SDALIGN); 1643 BRCMF_SDALIGN);
1644 if (!pkt) { 1644 if (!pkt) {
1645 /* Give up on data, request rtx of events */ 1645 /* Give up on data, request rtx of events */
1646 brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed\n"); 1646 brcmf_err("brcmu_pkt_buf_get_skb failed\n");
1647 bus->sdiodev->bus_if->dstats.rx_dropped++; 1647 bus->sdiodev->bus_if->dstats.rx_dropped++;
1648 brcmf_sdbrcm_rxfail(bus, false, 1648 brcmf_sdbrcm_rxfail(bus, false,
1649 RETRYCHAN(rd->channel)); 1649 RETRYCHAN(rd->channel));
@@ -1659,7 +1659,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1659 sdio_release_host(bus->sdiodev->func[1]); 1659 sdio_release_host(bus->sdiodev->func[1]);
1660 1660
1661 if (sdret < 0) { 1661 if (sdret < 0) {
1662 brcmf_dbg(ERROR, "read %d bytes from channel %d failed: %d\n", 1662 brcmf_err("read %d bytes from channel %d failed: %d\n",
1663 rd->len, rd->channel, sdret); 1663 rd->len, rd->channel, sdret);
1664 brcmu_pkt_buf_free_skb(pkt); 1664 brcmu_pkt_buf_free_skb(pkt);
1665 bus->sdiodev->bus_if->dstats.rx_errors++; 1665 bus->sdiodev->bus_if->dstats.rx_errors++;
@@ -1685,7 +1685,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1685 } 1685 }
1686 bus->sdcnt.rx_readahead_cnt++; 1686 bus->sdcnt.rx_readahead_cnt++;
1687 if (rd->len != roundup(rd_new.len, 16)) { 1687 if (rd->len != roundup(rd_new.len, 16)) {
1688 brcmf_dbg(ERROR, "frame length mismatch:read %d, should be %d\n", 1688 brcmf_err("frame length mismatch:read %d, should be %d\n",
1689 rd->len, 1689 rd->len,
1690 roundup(rd_new.len, 16) >> 4); 1690 roundup(rd_new.len, 16) >> 4);
1691 rd->len = 0; 1691 rd->len = 0;
@@ -1706,7 +1706,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1706 "RxHdr:\n"); 1706 "RxHdr:\n");
1707 1707
1708 if (rd_new.channel == SDPCM_CONTROL_CHANNEL) { 1708 if (rd_new.channel == SDPCM_CONTROL_CHANNEL) {
1709 brcmf_dbg(ERROR, "readahead on control packet %d?\n", 1709 brcmf_err("readahead on control packet %d?\n",
1710 rd_new.seq_num); 1710 rd_new.seq_num);
1711 /* Force retry w/normal header read */ 1711 /* Force retry w/normal header read */
1712 rd->len = 0; 1712 rd->len = 0;
@@ -1733,7 +1733,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1733 skb_pull(pkt, SDPCM_HDRLEN); 1733 skb_pull(pkt, SDPCM_HDRLEN);
1734 bus->glomd = pkt; 1734 bus->glomd = pkt;
1735 } else { 1735 } else {
1736 brcmf_dbg(ERROR, "%s: glom superframe w/o " 1736 brcmf_err("%s: glom superframe w/o "
1737 "descriptor!\n", __func__); 1737 "descriptor!\n", __func__);
1738 sdio_claim_host(bus->sdiodev->func[1]); 1738 sdio_claim_host(bus->sdiodev->func[1]);
1739 brcmf_sdbrcm_rxfail(bus, false, false); 1739 brcmf_sdbrcm_rxfail(bus, false, false);
@@ -1762,7 +1762,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
1762 continue; 1762 continue;
1763 } else if (brcmf_proto_hdrpull(bus->sdiodev->dev, &ifidx, 1763 } else if (brcmf_proto_hdrpull(bus->sdiodev->dev, &ifidx,
1764 pkt) != 0) { 1764 pkt) != 0) {
1765 brcmf_dbg(ERROR, "rx protocol error\n"); 1765 brcmf_err("rx protocol error\n");
1766 brcmu_pkt_buf_free_skb(pkt); 1766 brcmu_pkt_buf_free_skb(pkt);
1767 bus->sdiodev->bus_if->dstats.rx_errors++; 1767 bus->sdiodev->bus_if->dstats.rx_errors++;
1768 continue; 1768 continue;
@@ -1818,7 +1818,7 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt,
1818 bus->sdiodev->bus_if->tx_realloc++; 1818 bus->sdiodev->bus_if->tx_realloc++;
1819 new = brcmu_pkt_buf_get_skb(pkt->len + BRCMF_SDALIGN); 1819 new = brcmu_pkt_buf_get_skb(pkt->len + BRCMF_SDALIGN);
1820 if (!new) { 1820 if (!new) {
1821 brcmf_dbg(ERROR, "couldn't allocate new %d-byte packet\n", 1821 brcmf_err("couldn't allocate new %d-byte packet\n",
1822 pkt->len + BRCMF_SDALIGN); 1822 pkt->len + BRCMF_SDALIGN);
1823 ret = -ENOMEM; 1823 ret = -ENOMEM;
1824 goto done; 1824 goto done;
@@ -2024,7 +2024,7 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev)
2024 (saveclk | SBSDIO_FORCE_HT), &err); 2024 (saveclk | SBSDIO_FORCE_HT), &err);
2025 } 2025 }
2026 if (err) 2026 if (err)
2027 brcmf_dbg(ERROR, "Failed to force clock for F2: err %d\n", err); 2027 brcmf_err("Failed to force clock for F2: err %d\n", err);
2028 2028
2029 /* Turn off the bus (F2), free any pending packets */ 2029 /* Turn off the bus (F2), free any pending packets */
2030 brcmf_dbg(INTR, "disable SDIO interrupts\n"); 2030 brcmf_dbg(INTR, "disable SDIO interrupts\n");
@@ -2150,7 +2150,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2150 devctl = brcmf_sdio_regrb(bus->sdiodev, 2150 devctl = brcmf_sdio_regrb(bus->sdiodev,
2151 SBSDIO_DEVICE_CTL, &err); 2151 SBSDIO_DEVICE_CTL, &err);
2152 if (err) { 2152 if (err) {
2153 brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", err); 2153 brcmf_err("error reading DEVCTL: %d\n", err);
2154 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 2154 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
2155 } 2155 }
2156#endif /* DEBUG */ 2156#endif /* DEBUG */
@@ -2159,7 +2159,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2159 clkctl = brcmf_sdio_regrb(bus->sdiodev, 2159 clkctl = brcmf_sdio_regrb(bus->sdiodev,
2160 SBSDIO_FUNC1_CHIPCLKCSR, &err); 2160 SBSDIO_FUNC1_CHIPCLKCSR, &err);
2161 if (err) { 2161 if (err) {
2162 brcmf_dbg(ERROR, "error reading CSR: %d\n", 2162 brcmf_err("error reading CSR: %d\n",
2163 err); 2163 err);
2164 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 2164 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
2165 } 2165 }
@@ -2171,7 +2171,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2171 devctl = brcmf_sdio_regrb(bus->sdiodev, 2171 devctl = brcmf_sdio_regrb(bus->sdiodev,
2172 SBSDIO_DEVICE_CTL, &err); 2172 SBSDIO_DEVICE_CTL, &err);
2173 if (err) { 2173 if (err) {
2174 brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", 2174 brcmf_err("error reading DEVCTL: %d\n",
2175 err); 2175 err);
2176 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 2176 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
2177 } 2177 }
@@ -2179,7 +2179,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2179 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, 2179 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
2180 devctl, &err); 2180 devctl, &err);
2181 if (err) { 2181 if (err) {
2182 brcmf_dbg(ERROR, "error writing DEVCTL: %d\n", 2182 brcmf_err("error writing DEVCTL: %d\n",
2183 err); 2183 err);
2184 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 2184 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
2185 } 2185 }
@@ -2226,17 +2226,17 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2226 2226
2227 /* Generally don't ask for these, can get CRC errors... */ 2227 /* Generally don't ask for these, can get CRC errors... */
2228 if (intstatus & I_WR_OOSYNC) { 2228 if (intstatus & I_WR_OOSYNC) {
2229 brcmf_dbg(ERROR, "Dongle reports WR_OOSYNC\n"); 2229 brcmf_err("Dongle reports WR_OOSYNC\n");
2230 intstatus &= ~I_WR_OOSYNC; 2230 intstatus &= ~I_WR_OOSYNC;
2231 } 2231 }
2232 2232
2233 if (intstatus & I_RD_OOSYNC) { 2233 if (intstatus & I_RD_OOSYNC) {
2234 brcmf_dbg(ERROR, "Dongle reports RD_OOSYNC\n"); 2234 brcmf_err("Dongle reports RD_OOSYNC\n");
2235 intstatus &= ~I_RD_OOSYNC; 2235 intstatus &= ~I_RD_OOSYNC;
2236 } 2236 }
2237 2237
2238 if (intstatus & I_SBINT) { 2238 if (intstatus & I_SBINT) {
2239 brcmf_dbg(ERROR, "Dongle reports SBINT\n"); 2239 brcmf_err("Dongle reports SBINT\n");
2240 intstatus &= ~I_SBINT; 2240 intstatus &= ~I_SBINT;
2241 } 2241 }
2242 2242
@@ -2319,7 +2319,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2319 } 2319 }
2320 2320
2321 if ((bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) || (err != 0)) { 2321 if ((bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) || (err != 0)) {
2322 brcmf_dbg(ERROR, "failed backplane access over SDIO, halting operation\n"); 2322 brcmf_err("failed backplane access over SDIO, halting operation\n");
2323 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 2323 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
2324 atomic_set(&bus->intstatus, 0); 2324 atomic_set(&bus->intstatus, 0);
2325 } else if (atomic_read(&bus->intstatus) || 2325 } else if (atomic_read(&bus->intstatus) ||
@@ -2370,7 +2370,7 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt)
2370 skb_pull(pkt, SDPCM_HDRLEN); 2370 skb_pull(pkt, SDPCM_HDRLEN);
2371 brcmf_txcomplete(bus->sdiodev->dev, pkt, false); 2371 brcmf_txcomplete(bus->sdiodev->dev, pkt, false);
2372 brcmu_pkt_buf_free_skb(pkt); 2372 brcmu_pkt_buf_free_skb(pkt);
2373 brcmf_dbg(ERROR, "out of bus->txq !!!\n"); 2373 brcmf_err("out of bus->txq !!!\n");
2374 ret = -ENOSR; 2374 ret = -ENOSR;
2375 } else { 2375 } else {
2376 ret = 0; 2376 ret = 0;
@@ -2420,7 +2420,7 @@ brcmf_sdbrcm_membytes(struct brcmf_sdio *bus, bool write, u32 address, u8 *data,
2420 /* Set the backplane window to include the start address */ 2420 /* Set the backplane window to include the start address */
2421 bcmerror = brcmf_sdcard_set_sbaddr_window(bus->sdiodev, address); 2421 bcmerror = brcmf_sdcard_set_sbaddr_window(bus->sdiodev, address);
2422 if (bcmerror) { 2422 if (bcmerror) {
2423 brcmf_dbg(ERROR, "window change failed\n"); 2423 brcmf_err("window change failed\n");
2424 goto xfer_done; 2424 goto xfer_done;
2425 } 2425 }
2426 2426
@@ -2432,7 +2432,7 @@ brcmf_sdbrcm_membytes(struct brcmf_sdio *bus, bool write, u32 address, u8 *data,
2432 bcmerror = brcmf_sdcard_rwdata(bus->sdiodev, write, 2432 bcmerror = brcmf_sdcard_rwdata(bus->sdiodev, write,
2433 sdaddr, data, dsize); 2433 sdaddr, data, dsize);
2434 if (bcmerror) { 2434 if (bcmerror) {
2435 brcmf_dbg(ERROR, "membytes transfer failed\n"); 2435 brcmf_err("membytes transfer failed\n");
2436 break; 2436 break;
2437 } 2437 }
2438 2438
@@ -2444,7 +2444,7 @@ brcmf_sdbrcm_membytes(struct brcmf_sdio *bus, bool write, u32 address, u8 *data,
2444 bcmerror = brcmf_sdcard_set_sbaddr_window(bus->sdiodev, 2444 bcmerror = brcmf_sdcard_set_sbaddr_window(bus->sdiodev,
2445 address); 2445 address);
2446 if (bcmerror) { 2446 if (bcmerror) {
2447 brcmf_dbg(ERROR, "window change failed\n"); 2447 brcmf_err("window change failed\n");
2448 break; 2448 break;
2449 } 2449 }
2450 sdaddr = 0; 2450 sdaddr = 0;
@@ -2455,7 +2455,7 @@ brcmf_sdbrcm_membytes(struct brcmf_sdio *bus, bool write, u32 address, u8 *data,
2455xfer_done: 2455xfer_done:
2456 /* Return the window to backplane enumeration space for core access */ 2456 /* Return the window to backplane enumeration space for core access */
2457 if (brcmf_sdcard_set_sbaddr_window(bus->sdiodev, bus->sdiodev->sbwad)) 2457 if (brcmf_sdcard_set_sbaddr_window(bus->sdiodev, bus->sdiodev->sbwad))
2458 brcmf_dbg(ERROR, "FAILED to set window back to 0x%x\n", 2458 brcmf_err("FAILED to set window back to 0x%x\n",
2459 bus->sdiodev->sbwad); 2459 bus->sdiodev->sbwad);
2460 2460
2461 sdio_release_host(bus->sdiodev->func[1]); 2461 sdio_release_host(bus->sdiodev->func[1]);
@@ -2739,7 +2739,7 @@ static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
2739 * NVRAM length at the end of memory should have been overwritten. 2739 * NVRAM length at the end of memory should have been overwritten.
2740 */ 2740 */
2741 if (!brcmf_sdio_valid_shared_address(addr)) { 2741 if (!brcmf_sdio_valid_shared_address(addr)) {
2742 brcmf_dbg(ERROR, "invalid sdpcm_shared address 0x%08X\n", 2742 brcmf_err("invalid sdpcm_shared address 0x%08X\n",
2743 addr); 2743 addr);
2744 return -EINVAL; 2744 return -EINVAL;
2745 } 2745 }
@@ -2762,8 +2762,7 @@ static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
2762 sh->msgtrace_addr = le32_to_cpu(sh_le.msgtrace_addr); 2762 sh->msgtrace_addr = le32_to_cpu(sh_le.msgtrace_addr);
2763 2763
2764 if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) { 2764 if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
2765 brcmf_dbg(ERROR, 2765 brcmf_err("sdpcm_shared version mismatch: dhd %d dongle %d\n",
2766 "sdpcm_shared version mismatch: dhd %d dongle %d\n",
2767 SDPCM_SHARED_VERSION, 2766 SDPCM_SHARED_VERSION,
2768 sh->flags & SDPCM_SHARED_VERSION_MASK); 2767 sh->flags & SDPCM_SHARED_VERSION_MASK);
2769 return -EPROTO; 2768 return -EPROTO;
@@ -2938,10 +2937,10 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus)
2938 if ((sh.flags & SDPCM_SHARED_ASSERT_BUILT) == 0) 2937 if ((sh.flags & SDPCM_SHARED_ASSERT_BUILT) == 0)
2939 brcmf_dbg(INFO, "firmware not built with -assert\n"); 2938 brcmf_dbg(INFO, "firmware not built with -assert\n");
2940 else if (sh.flags & SDPCM_SHARED_ASSERT) 2939 else if (sh.flags & SDPCM_SHARED_ASSERT)
2941 brcmf_dbg(ERROR, "assertion in dongle\n"); 2940 brcmf_err("assertion in dongle\n");
2942 2941
2943 if (sh.flags & SDPCM_SHARED_TRAP) 2942 if (sh.flags & SDPCM_SHARED_TRAP)
2944 brcmf_dbg(ERROR, "firmware trap in dongle\n"); 2943 brcmf_err("firmware trap in dongle\n");
2945 2944
2946 return 0; 2945 return 0;
2947} 2946}
@@ -3047,7 +3046,7 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen)
3047 brcmf_dbg(CTL, "resumed on rxctl frame, got %d expected %d\n", 3046 brcmf_dbg(CTL, "resumed on rxctl frame, got %d expected %d\n",
3048 rxlen, msglen); 3047 rxlen, msglen);
3049 } else if (timeleft == 0) { 3048 } else if (timeleft == 0) {
3050 brcmf_dbg(ERROR, "resumed on timeout\n"); 3049 brcmf_err("resumed on timeout\n");
3051 brcmf_sdbrcm_checkdied(bus); 3050 brcmf_sdbrcm_checkdied(bus);
3052 } else if (pending) { 3051 } else if (pending) {
3053 brcmf_dbg(CTL, "cancelled\n"); 3052 brcmf_dbg(CTL, "cancelled\n");
@@ -3098,14 +3097,14 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus)
3098 bcmerror = brcmf_sdbrcm_membytes(bus, false, varaddr, 3097 bcmerror = brcmf_sdbrcm_membytes(bus, false, varaddr,
3099 nvram_ularray, bus->varsz); 3098 nvram_ularray, bus->varsz);
3100 if (bcmerror) { 3099 if (bcmerror) {
3101 brcmf_dbg(ERROR, "error %d on reading %d nvram bytes at 0x%08x\n", 3100 brcmf_err("error %d on reading %d nvram bytes at 0x%08x\n",
3102 bcmerror, bus->varsz, varaddr); 3101 bcmerror, bus->varsz, varaddr);
3103 } 3102 }
3104 /* Compare the org NVRAM with the one read from RAM */ 3103 /* Compare the org NVRAM with the one read from RAM */
3105 if (memcmp(bus->vars, nvram_ularray, bus->varsz)) 3104 if (memcmp(bus->vars, nvram_ularray, bus->varsz))
3106 brcmf_dbg(ERROR, "Downloaded NVRAM image is corrupted\n"); 3105 brcmf_err("Downloaded NVRAM image is corrupted\n");
3107 else 3106 else
3108 brcmf_dbg(ERROR, "Download/Upload/Compare of NVRAM ok\n"); 3107 brcmf_err("Download/Upload/Compare of NVRAM ok\n");
3109 3108
3110 kfree(nvram_ularray); 3109 kfree(nvram_ularray);
3111#endif /* DEBUG */ 3110#endif /* DEBUG */
@@ -3163,14 +3162,14 @@ static int brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter)
3163 } 3162 }
3164 } else { 3163 } else {
3165 if (!ci->iscoreup(bus->sdiodev, ci, BCMA_CORE_INTERNAL_MEM)) { 3164 if (!ci->iscoreup(bus->sdiodev, ci, BCMA_CORE_INTERNAL_MEM)) {
3166 brcmf_dbg(ERROR, "SOCRAM core is down after reset?\n"); 3165 brcmf_err("SOCRAM core is down after reset?\n");
3167 bcmerror = -EBADE; 3166 bcmerror = -EBADE;
3168 goto fail; 3167 goto fail;
3169 } 3168 }
3170 3169
3171 bcmerror = brcmf_sdbrcm_write_vars(bus); 3170 bcmerror = brcmf_sdbrcm_write_vars(bus);
3172 if (bcmerror) { 3171 if (bcmerror) {
3173 brcmf_dbg(ERROR, "no vars written to RAM\n"); 3172 brcmf_err("no vars written to RAM\n");
3174 bcmerror = 0; 3173 bcmerror = 0;
3175 } 3174 }
3176 3175
@@ -3210,7 +3209,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus)
3210 ret = request_firmware(&bus->firmware, BRCMF_SDIO_FW_NAME, 3209 ret = request_firmware(&bus->firmware, BRCMF_SDIO_FW_NAME,
3211 &bus->sdiodev->func[2]->dev); 3210 &bus->sdiodev->func[2]->dev);
3212 if (ret) { 3211 if (ret) {
3213 brcmf_dbg(ERROR, "Fail to request firmware %d\n", ret); 3212 brcmf_err("Fail to request firmware %d\n", ret);
3214 return ret; 3213 return ret;
3215 } 3214 }
3216 bus->fw_ptr = 0; 3215 bus->fw_ptr = 0;
@@ -3229,7 +3228,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus)
3229 brcmf_sdbrcm_get_image((char *)memptr, MEMBLOCK, bus))) { 3228 brcmf_sdbrcm_get_image((char *)memptr, MEMBLOCK, bus))) {
3230 ret = brcmf_sdbrcm_membytes(bus, true, offset, memptr, len); 3229 ret = brcmf_sdbrcm_membytes(bus, true, offset, memptr, len);
3231 if (ret) { 3230 if (ret) {
3232 brcmf_dbg(ERROR, "error %d on writing %d membytes at 0x%08x\n", 3231 brcmf_err("error %d on writing %d membytes at 0x%08x\n",
3233 ret, MEMBLOCK, offset); 3232 ret, MEMBLOCK, offset);
3234 goto err; 3233 goto err;
3235 } 3234 }
@@ -3329,7 +3328,7 @@ static int brcmf_sdbrcm_download_nvram(struct brcmf_sdio *bus)
3329 ret = request_firmware(&bus->firmware, BRCMF_SDIO_NV_NAME, 3328 ret = request_firmware(&bus->firmware, BRCMF_SDIO_NV_NAME,
3330 &bus->sdiodev->func[2]->dev); 3329 &bus->sdiodev->func[2]->dev);
3331 if (ret) { 3330 if (ret) {
3332 brcmf_dbg(ERROR, "Fail to request nvram %d\n", ret); 3331 brcmf_err("Fail to request nvram %d\n", ret);
3333 return ret; 3332 return ret;
3334 } 3333 }
3335 3334
@@ -3346,23 +3345,23 @@ static int _brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus)
3346 3345
3347 /* Keep arm in reset */ 3346 /* Keep arm in reset */
3348 if (brcmf_sdbrcm_download_state(bus, true)) { 3347 if (brcmf_sdbrcm_download_state(bus, true)) {
3349 brcmf_dbg(ERROR, "error placing ARM core in reset\n"); 3348 brcmf_err("error placing ARM core in reset\n");
3350 goto err; 3349 goto err;
3351 } 3350 }
3352 3351
3353 /* External image takes precedence if specified */ 3352 /* External image takes precedence if specified */
3354 if (brcmf_sdbrcm_download_code_file(bus)) { 3353 if (brcmf_sdbrcm_download_code_file(bus)) {
3355 brcmf_dbg(ERROR, "dongle image file download failed\n"); 3354 brcmf_err("dongle image file download failed\n");
3356 goto err; 3355 goto err;
3357 } 3356 }
3358 3357
3359 /* External nvram takes precedence if specified */ 3358 /* External nvram takes precedence if specified */
3360 if (brcmf_sdbrcm_download_nvram(bus)) 3359 if (brcmf_sdbrcm_download_nvram(bus))
3361 brcmf_dbg(ERROR, "dongle nvram file download failed\n"); 3360 brcmf_err("dongle nvram file download failed\n");
3362 3361
3363 /* Take arm out of reset */ 3362 /* Take arm out of reset */
3364 if (brcmf_sdbrcm_download_state(bus, false)) { 3363 if (brcmf_sdbrcm_download_state(bus, false)) {
3365 brcmf_dbg(ERROR, "error getting out of ARM core reset\n"); 3364 brcmf_err("error getting out of ARM core reset\n");
3366 goto err; 3365 goto err;
3367 } 3366 }
3368 3367
@@ -3430,7 +3429,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
3430 (saveclk | SBSDIO_FORCE_HT), &err); 3429 (saveclk | SBSDIO_FORCE_HT), &err);
3431 } 3430 }
3432 if (err) { 3431 if (err) {
3433 brcmf_dbg(ERROR, "Failed to force clock for F2: err %d\n", err); 3432 brcmf_err("Failed to force clock for F2: err %d\n", err);
3434 goto exit; 3433 goto exit;
3435 } 3434 }
3436 3435
@@ -3476,7 +3475,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
3476 if (ret == 0) { 3475 if (ret == 0) {
3477 ret = brcmf_sdio_intr_register(bus->sdiodev); 3476 ret = brcmf_sdio_intr_register(bus->sdiodev);
3478 if (ret != 0) 3477 if (ret != 0)
3479 brcmf_dbg(ERROR, "intr register failed:%d\n", ret); 3478 brcmf_err("intr register failed:%d\n", ret);
3480 } 3479 }
3481 3480
3482 /* If we didn't come up, turn off backplane clock */ 3481 /* If we didn't come up, turn off backplane clock */
@@ -3496,12 +3495,12 @@ void brcmf_sdbrcm_isr(void *arg)
3496 brcmf_dbg(TRACE, "Enter\n"); 3495 brcmf_dbg(TRACE, "Enter\n");
3497 3496
3498 if (!bus) { 3497 if (!bus) {
3499 brcmf_dbg(ERROR, "bus is null pointer, exiting\n"); 3498 brcmf_err("bus is null pointer, exiting\n");
3500 return; 3499 return;
3501 } 3500 }
3502 3501
3503 if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { 3502 if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) {
3504 brcmf_dbg(ERROR, "bus is down. we have nothing to do\n"); 3503 brcmf_err("bus is down. we have nothing to do\n");
3505 return; 3504 return;
3506 } 3505 }
3507 /* Count the interrupt call */ 3506 /* Count the interrupt call */
@@ -3510,13 +3509,13 @@ void brcmf_sdbrcm_isr(void *arg)
3510 atomic_set(&bus->ipend, 1); 3509 atomic_set(&bus->ipend, 1);
3511 else 3510 else
3512 if (brcmf_sdio_intr_rstatus(bus)) { 3511 if (brcmf_sdio_intr_rstatus(bus)) {
3513 brcmf_dbg(ERROR, "failed backplane access\n"); 3512 brcmf_err("failed backplane access\n");
3514 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 3513 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
3515 } 3514 }
3516 3515
3517 /* Disable additional interrupts (is this needed now)? */ 3516 /* Disable additional interrupts (is this needed now)? */
3518 if (!bus->intr) 3517 if (!bus->intr)
3519 brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); 3518 brcmf_err("isr w/o interrupt configured!\n");
3520 3519
3521 brcmf_sdbrcm_adddpctsk(bus); 3520 brcmf_sdbrcm_adddpctsk(bus);
3522 queue_work(bus->brcmf_wq, &bus->datawork); 3521 queue_work(bus->brcmf_wq, &bus->datawork);
@@ -3718,18 +3717,18 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus, u32 regsva)
3718 SBSDIO_FUNC1_CHIPCLKCSR, &err); 3717 SBSDIO_FUNC1_CHIPCLKCSR, &err);
3719 3718
3720 if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) { 3719 if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) {
3721 brcmf_dbg(ERROR, "ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n", 3720 brcmf_err("ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n",
3722 err, BRCMF_INIT_CLKCTL1, clkctl); 3721 err, BRCMF_INIT_CLKCTL1, clkctl);
3723 goto fail; 3722 goto fail;
3724 } 3723 }
3725 3724
3726 if (brcmf_sdio_chip_attach(bus->sdiodev, &bus->ci, regsva)) { 3725 if (brcmf_sdio_chip_attach(bus->sdiodev, &bus->ci, regsva)) {
3727 brcmf_dbg(ERROR, "brcmf_sdio_chip_attach failed!\n"); 3726 brcmf_err("brcmf_sdio_chip_attach failed!\n");
3728 goto fail; 3727 goto fail;
3729 } 3728 }
3730 3729
3731 if (!brcmf_sdbrcm_chipmatch((u16) bus->ci->chip)) { 3730 if (!brcmf_sdbrcm_chipmatch((u16) bus->ci->chip)) {
3732 brcmf_dbg(ERROR, "unsupported chip: 0x%04x\n", bus->ci->chip); 3731 brcmf_err("unsupported chip: 0x%04x\n", bus->ci->chip);
3733 goto fail; 3732 goto fail;
3734 } 3733 }
3735 3734
@@ -3739,7 +3738,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus, u32 regsva)
3739 /* Get info on the SOCRAM cores... */ 3738 /* Get info on the SOCRAM cores... */
3740 bus->ramsize = bus->ci->ramsize; 3739 bus->ramsize = bus->ci->ramsize;
3741 if (!(bus->ramsize)) { 3740 if (!(bus->ramsize)) {
3742 brcmf_dbg(ERROR, "failed to find SOCRAM memory!\n"); 3741 brcmf_err("failed to find SOCRAM memory!\n");
3743 goto fail; 3742 goto fail;
3744 } 3743 }
3745 3744
@@ -3883,6 +3882,14 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus)
3883 brcmf_dbg(TRACE, "Disconnected\n"); 3882 brcmf_dbg(TRACE, "Disconnected\n");
3884} 3883}
3885 3884
3885static struct brcmf_bus_ops brcmf_sdio_bus_ops = {
3886 .stop = brcmf_sdbrcm_bus_stop,
3887 .init = brcmf_sdbrcm_bus_init,
3888 .txdata = brcmf_sdbrcm_bus_txdata,
3889 .txctl = brcmf_sdbrcm_bus_txctl,
3890 .rxctl = brcmf_sdbrcm_bus_rxctl,
3891};
3892
3886void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) 3893void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev)
3887{ 3894{
3888 int ret; 3895 int ret;
@@ -3913,13 +3920,13 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev)
3913 INIT_WORK(&bus->datawork, brcmf_sdio_dataworker); 3920 INIT_WORK(&bus->datawork, brcmf_sdio_dataworker);
3914 bus->brcmf_wq = create_singlethread_workqueue("brcmf_wq"); 3921 bus->brcmf_wq = create_singlethread_workqueue("brcmf_wq");
3915 if (bus->brcmf_wq == NULL) { 3922 if (bus->brcmf_wq == NULL) {
3916 brcmf_dbg(ERROR, "insufficient memory to create txworkqueue\n"); 3923 brcmf_err("insufficient memory to create txworkqueue\n");
3917 goto fail; 3924 goto fail;
3918 } 3925 }
3919 3926
3920 /* attempt to attach to the dongle */ 3927 /* attempt to attach to the dongle */
3921 if (!(brcmf_sdbrcm_probe_attach(bus, regsva))) { 3928 if (!(brcmf_sdbrcm_probe_attach(bus, regsva))) {
3922 brcmf_dbg(ERROR, "brcmf_sdbrcm_probe_attach failed\n"); 3929 brcmf_err("brcmf_sdbrcm_probe_attach failed\n");
3923 goto fail; 3930 goto fail;
3924 } 3931 }
3925 3932
@@ -3946,26 +3953,24 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev)
3946 spin_lock_init(&bus->dpc_tl_lock); 3953 spin_lock_init(&bus->dpc_tl_lock);
3947 3954
3948 /* Assign bus interface call back */ 3955 /* Assign bus interface call back */
3949 bus->sdiodev->bus_if->brcmf_bus_stop = brcmf_sdbrcm_bus_stop; 3956 bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
3950 bus->sdiodev->bus_if->brcmf_bus_init = brcmf_sdbrcm_bus_init; 3957 bus->sdiodev->bus_if->ops = &brcmf_sdio_bus_ops;
3951 bus->sdiodev->bus_if->brcmf_bus_txdata = brcmf_sdbrcm_bus_txdata; 3958
3952 bus->sdiodev->bus_if->brcmf_bus_txctl = brcmf_sdbrcm_bus_txctl;
3953 bus->sdiodev->bus_if->brcmf_bus_rxctl = brcmf_sdbrcm_bus_rxctl;
3954 /* Attach to the brcmf/OS/network interface */ 3959 /* Attach to the brcmf/OS/network interface */
3955 ret = brcmf_attach(SDPCM_RESERVE, bus->sdiodev->dev); 3960 ret = brcmf_attach(SDPCM_RESERVE, bus->sdiodev->dev);
3956 if (ret != 0) { 3961 if (ret != 0) {
3957 brcmf_dbg(ERROR, "brcmf_attach failed\n"); 3962 brcmf_err("brcmf_attach failed\n");
3958 goto fail; 3963 goto fail;
3959 } 3964 }
3960 3965
3961 /* Allocate buffers */ 3966 /* Allocate buffers */
3962 if (!(brcmf_sdbrcm_probe_malloc(bus))) { 3967 if (!(brcmf_sdbrcm_probe_malloc(bus))) {
3963 brcmf_dbg(ERROR, "brcmf_sdbrcm_probe_malloc failed\n"); 3968 brcmf_err("brcmf_sdbrcm_probe_malloc failed\n");
3964 goto fail; 3969 goto fail;
3965 } 3970 }
3966 3971
3967 if (!(brcmf_sdbrcm_probe_init(bus))) { 3972 if (!(brcmf_sdbrcm_probe_init(bus))) {
3968 brcmf_dbg(ERROR, "brcmf_sdbrcm_probe_init failed\n"); 3973 brcmf_err("brcmf_sdbrcm_probe_init failed\n");
3969 goto fail; 3974 goto fail;
3970 } 3975 }
3971 3976
@@ -3995,7 +4000,7 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev)
3995 /* if firmware path present try to download and bring up bus */ 4000 /* if firmware path present try to download and bring up bus */
3996 ret = brcmf_bus_start(bus->sdiodev->dev); 4001 ret = brcmf_bus_start(bus->sdiodev->dev);
3997 if (ret != 0) { 4002 if (ret != 0) {
3998 brcmf_dbg(ERROR, "dongle is not responding\n"); 4003 brcmf_err("dongle is not responding\n");
3999 goto fail; 4004 goto fail;
4000 } 4005 }
4001 4006
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
index 7a00c4614baf..ba0b22512f12 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
@@ -95,76 +95,14 @@ struct brcmf_fweh_event_name {
95}; 95};
96 96
97#ifdef DEBUG 97#ifdef DEBUG
98#define BRCMF_ENUM_DEF(id, val) \
99 { val, #id },
100
98/* array for mapping code to event name */ 101/* array for mapping code to event name */
99static struct brcmf_fweh_event_name fweh_event_names[] = { 102static struct brcmf_fweh_event_name fweh_event_names[] = {
100 { BRCMF_E_SET_SSID, "SET_SSID" }, 103 BRCMF_FWEH_EVENT_ENUM_DEFLIST
101 { BRCMF_E_JOIN, "JOIN" },
102 { BRCMF_E_START, "START" },
103 { BRCMF_E_AUTH, "AUTH" },
104 { BRCMF_E_AUTH_IND, "AUTH_IND" },
105 { BRCMF_E_DEAUTH, "DEAUTH" },
106 { BRCMF_E_DEAUTH_IND, "DEAUTH_IND" },
107 { BRCMF_E_ASSOC, "ASSOC" },
108 { BRCMF_E_ASSOC_IND, "ASSOC_IND" },
109 { BRCMF_E_REASSOC, "REASSOC" },
110 { BRCMF_E_REASSOC_IND, "REASSOC_IND" },
111 { BRCMF_E_DISASSOC, "DISASSOC" },
112 { BRCMF_E_DISASSOC_IND, "DISASSOC_IND" },
113 { BRCMF_E_QUIET_START, "START_QUIET" },
114 { BRCMF_E_QUIET_END, "END_QUIET" },
115 { BRCMF_E_BEACON_RX, "BEACON_RX" },
116 { BRCMF_E_LINK, "LINK" },
117 { BRCMF_E_MIC_ERROR, "MIC_ERROR" },
118 { BRCMF_E_NDIS_LINK, "NDIS_LINK" },
119 { BRCMF_E_ROAM, "ROAM" },
120 { BRCMF_E_TXFAIL, "TXFAIL" },
121 { BRCMF_E_PMKID_CACHE, "PMKID_CACHE" },
122 { BRCMF_E_RETROGRADE_TSF, "RETROGRADE_TSF" },
123 { BRCMF_E_PRUNE, "PRUNE" },
124 { BRCMF_E_AUTOAUTH, "AUTOAUTH" },
125 { BRCMF_E_EAPOL_MSG, "EAPOL_MSG" },
126 { BRCMF_E_SCAN_COMPLETE, "SCAN_COMPLETE" },
127 { BRCMF_E_ADDTS_IND, "ADDTS_IND" },
128 { BRCMF_E_DELTS_IND, "DELTS_IND" },
129 { BRCMF_E_BCNSENT_IND, "BCNSENT_IND" },
130 { BRCMF_E_BCNRX_MSG, "BCNRX_MSG" },
131 { BRCMF_E_BCNLOST_MSG, "BCNLOST_MSG" },
132 { BRCMF_E_ROAM_PREP, "ROAM_PREP" },
133 { BRCMF_E_PFN_NET_FOUND, "PNO_NET_FOUND" },
134 { BRCMF_E_PFN_NET_LOST, "PNO_NET_LOST" },
135 { BRCMF_E_RESET_COMPLETE, "RESET_COMPLETE" },
136 { BRCMF_E_JOIN_START, "JOIN_START" },
137 { BRCMF_E_ROAM_START, "ROAM_START" },
138 { BRCMF_E_ASSOC_START, "ASSOC_START" },
139 { BRCMF_E_IBSS_ASSOC, "IBSS_ASSOC" },
140 { BRCMF_E_RADIO, "RADIO" },
141 { BRCMF_E_PSM_WATCHDOG, "PSM_WATCHDOG" },
142 { BRCMF_E_PROBREQ_MSG, "PROBREQ_MSG" },
143 { BRCMF_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND" },
144 { BRCMF_E_PSK_SUP, "PSK_SUP" },
145 { BRCMF_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED" },
146 { BRCMF_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME" },
147 { BRCMF_E_ICV_ERROR, "ICV_ERROR" },
148 { BRCMF_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR" },
149 { BRCMF_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR" },
150 { BRCMF_E_TRACE, "TRACE" },
151 { BRCMF_E_IF, "IF" },
152 { BRCMF_E_RSSI, "RSSI" },
153 { BRCMF_E_PFN_SCAN_COMPLETE, "PFN_SCAN_COMPLETE" },
154 { BRCMF_E_EXTLOG_MSG, "EXTLOG_MSG" },
155 { BRCMF_E_ACTION_FRAME, "ACTION_FRAME" },
156 { BRCMF_E_ACTION_FRAME_COMPLETE, "ACTION_FRAME_COMPLETE" },
157 { BRCMF_E_PRE_ASSOC_IND, "PRE_ASSOC_IND" },
158 { BRCMF_E_PRE_REASSOC_IND, "PRE_REASSOC_IND" },
159 { BRCMF_E_CHANNEL_ADOPTED, "CHANNEL_ADOPTED" },
160 { BRCMF_E_AP_STARTED, "AP_STARTED" },
161 { BRCMF_E_DFS_AP_STOP, "DFS_AP_STOP" },
162 { BRCMF_E_DFS_AP_RESUME, "DFS_AP_RESUME" },
163 { BRCMF_E_ESCAN_RESULT, "ESCAN_RESULT" },
164 { BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE, "ACTION_FRM_OFF_CHAN_CMPLT" },
165 { BRCMF_E_DCS_REQUEST, "DCS_REQUEST" },
166 { BRCMF_E_FIFO_CREDIT_MAP, "FIFO_CREDIT_MAP"}
167}; 104};
105#undef BRCMF_ENUM_DEF
168 106
169/** 107/**
170 * brcmf_fweh_event_name() - returns name for given event code. 108 * brcmf_fweh_event_name() - returns name for given event code.
@@ -219,9 +157,9 @@ static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp,
219 if (ifp->ndev && fweh->evt_handler[code]) 157 if (ifp->ndev && fweh->evt_handler[code])
220 err = fweh->evt_handler[code](ifp, emsg, data); 158 err = fweh->evt_handler[code](ifp, emsg, data);
221 else 159 else
222 brcmf_dbg(ERROR, "unhandled event %d ignored\n", code); 160 brcmf_err("unhandled event %d ignored\n", code);
223 } else { 161 } else {
224 brcmf_dbg(ERROR, "no interface object\n"); 162 brcmf_err("no interface object\n");
225 } 163 }
226 return err; 164 return err;
227} 165}
@@ -246,7 +184,7 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
246 ifevent->bssidx, ifevent->flags); 184 ifevent->bssidx, ifevent->flags);
247 185
248 if (ifevent->ifidx >= BRCMF_MAX_IFS) { 186 if (ifevent->ifidx >= BRCMF_MAX_IFS) {
249 brcmf_dbg(ERROR, "invalid interface index: %u\n", 187 brcmf_err("invalid interface index: %u\n",
250 ifevent->ifidx); 188 ifevent->ifidx);
251 return; 189 return;
252 } 190 }
@@ -348,7 +286,7 @@ static void brcmf_fweh_event_worker(struct work_struct *work)
348 err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg, 286 err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg,
349 event->data); 287 event->data);
350 if (err) { 288 if (err) {
351 brcmf_dbg(ERROR, "event handler failed (%d)\n", 289 brcmf_err("event handler failed (%d)\n",
352 event->code); 290 event->code);
353 err = 0; 291 err = 0;
354 } 292 }
@@ -405,7 +343,7 @@ int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code,
405 brcmf_fweh_handler_t handler) 343 brcmf_fweh_handler_t handler)
406{ 344{
407 if (drvr->fweh.evt_handler[code]) { 345 if (drvr->fweh.evt_handler[code]) {
408 brcmf_dbg(ERROR, "event code %d already registered\n", code); 346 brcmf_err("event code %d already registered\n", code);
409 return -ENOSPC; 347 return -ENOSPC;
410 } 348 }
411 drvr->fweh.evt_handler[code] = handler; 349 drvr->fweh.evt_handler[code] = handler;
@@ -453,7 +391,7 @@ int brcmf_fweh_activate_events(struct brcmf_if *ifp)
453 err = brcmf_fil_iovar_data_set(ifp, "event_msgs", 391 err = brcmf_fil_iovar_data_set(ifp, "event_msgs",
454 eventmask, BRCMF_EVENTING_MASK_LEN); 392 eventmask, BRCMF_EVENTING_MASK_LEN);
455 if (err) 393 if (err)
456 brcmf_dbg(ERROR, "Set event_msgs error (%d)\n", err); 394 brcmf_err("Set event_msgs error (%d)\n", err);
457 395
458 return err; 396 return err;
459} 397}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
index 240a2eafead5..36901f76a3b5 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
@@ -29,77 +29,85 @@ struct brcmf_if;
29struct brcmf_cfg80211_info; 29struct brcmf_cfg80211_info;
30struct brcmf_event; 30struct brcmf_event;
31 31
32/* list of firmware events */
33#define BRCMF_FWEH_EVENT_ENUM_DEFLIST \
34 BRCMF_ENUM_DEF(SET_SSID, 0) \
35 BRCMF_ENUM_DEF(JOIN, 1) \
36 BRCMF_ENUM_DEF(START, 2) \
37 BRCMF_ENUM_DEF(AUTH, 3) \
38 BRCMF_ENUM_DEF(AUTH_IND, 4) \
39 BRCMF_ENUM_DEF(DEAUTH, 5) \
40 BRCMF_ENUM_DEF(DEAUTH_IND, 6) \
41 BRCMF_ENUM_DEF(ASSOC, 7) \
42 BRCMF_ENUM_DEF(ASSOC_IND, 8) \
43 BRCMF_ENUM_DEF(REASSOC, 9) \
44 BRCMF_ENUM_DEF(REASSOC_IND, 10) \
45 BRCMF_ENUM_DEF(DISASSOC, 11) \
46 BRCMF_ENUM_DEF(DISASSOC_IND, 12) \
47 BRCMF_ENUM_DEF(QUIET_START, 13) \
48 BRCMF_ENUM_DEF(QUIET_END, 14) \
49 BRCMF_ENUM_DEF(BEACON_RX, 15) \
50 BRCMF_ENUM_DEF(LINK, 16) \
51 BRCMF_ENUM_DEF(MIC_ERROR, 17) \
52 BRCMF_ENUM_DEF(NDIS_LINK, 18) \
53 BRCMF_ENUM_DEF(ROAM, 19) \
54 BRCMF_ENUM_DEF(TXFAIL, 20) \
55 BRCMF_ENUM_DEF(PMKID_CACHE, 21) \
56 BRCMF_ENUM_DEF(RETROGRADE_TSF, 22) \
57 BRCMF_ENUM_DEF(PRUNE, 23) \
58 BRCMF_ENUM_DEF(AUTOAUTH, 24) \
59 BRCMF_ENUM_DEF(EAPOL_MSG, 25) \
60 BRCMF_ENUM_DEF(SCAN_COMPLETE, 26) \
61 BRCMF_ENUM_DEF(ADDTS_IND, 27) \
62 BRCMF_ENUM_DEF(DELTS_IND, 28) \
63 BRCMF_ENUM_DEF(BCNSENT_IND, 29) \
64 BRCMF_ENUM_DEF(BCNRX_MSG, 30) \
65 BRCMF_ENUM_DEF(BCNLOST_MSG, 31) \
66 BRCMF_ENUM_DEF(ROAM_PREP, 32) \
67 BRCMF_ENUM_DEF(PFN_NET_FOUND, 33) \
68 BRCMF_ENUM_DEF(PFN_NET_LOST, 34) \
69 BRCMF_ENUM_DEF(RESET_COMPLETE, 35) \
70 BRCMF_ENUM_DEF(JOIN_START, 36) \
71 BRCMF_ENUM_DEF(ROAM_START, 37) \
72 BRCMF_ENUM_DEF(ASSOC_START, 38) \
73 BRCMF_ENUM_DEF(IBSS_ASSOC, 39) \
74 BRCMF_ENUM_DEF(RADIO, 40) \
75 BRCMF_ENUM_DEF(PSM_WATCHDOG, 41) \
76 BRCMF_ENUM_DEF(PROBREQ_MSG, 44) \
77 BRCMF_ENUM_DEF(SCAN_CONFIRM_IND, 45) \
78 BRCMF_ENUM_DEF(PSK_SUP, 46) \
79 BRCMF_ENUM_DEF(COUNTRY_CODE_CHANGED, 47) \
80 BRCMF_ENUM_DEF(EXCEEDED_MEDIUM_TIME, 48) \
81 BRCMF_ENUM_DEF(ICV_ERROR, 49) \
82 BRCMF_ENUM_DEF(UNICAST_DECODE_ERROR, 50) \
83 BRCMF_ENUM_DEF(MULTICAST_DECODE_ERROR, 51) \
84 BRCMF_ENUM_DEF(TRACE, 52) \
85 BRCMF_ENUM_DEF(IF, 54) \
86 BRCMF_ENUM_DEF(RSSI, 56) \
87 BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
88 BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
89 BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
90 BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
91 BRCMF_ENUM_DEF(PRE_ASSOC_IND, 61) \
92 BRCMF_ENUM_DEF(PRE_REASSOC_IND, 62) \
93 BRCMF_ENUM_DEF(CHANNEL_ADOPTED, 63) \
94 BRCMF_ENUM_DEF(AP_STARTED, 64) \
95 BRCMF_ENUM_DEF(DFS_AP_STOP, 65) \
96 BRCMF_ENUM_DEF(DFS_AP_RESUME, 66) \
97 BRCMF_ENUM_DEF(ESCAN_RESULT, 69) \
98 BRCMF_ENUM_DEF(ACTION_FRAME_OFF_CHAN_COMPLETE, 70) \
99 BRCMF_ENUM_DEF(DCS_REQUEST, 73) \
100 BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74)
101
102#define BRCMF_ENUM_DEF(id, val) \
103 BRCMF_E_##id = (val),
104
32/* firmware event codes sent by the dongle */ 105/* firmware event codes sent by the dongle */
33enum brcmf_fweh_event_code { 106enum brcmf_fweh_event_code {
34 BRCMF_E_SET_SSID = 0, 107 BRCMF_FWEH_EVENT_ENUM_DEFLIST
35 BRCMF_E_JOIN = 1,
36 BRCMF_E_START = 2,
37 BRCMF_E_AUTH = 3,
38 BRCMF_E_AUTH_IND = 4,
39 BRCMF_E_DEAUTH = 5,
40 BRCMF_E_DEAUTH_IND = 6,
41 BRCMF_E_ASSOC = 7,
42 BRCMF_E_ASSOC_IND = 8,
43 BRCMF_E_REASSOC = 9,
44 BRCMF_E_REASSOC_IND = 10,
45 BRCMF_E_DISASSOC = 11,
46 BRCMF_E_DISASSOC_IND = 12,
47 BRCMF_E_QUIET_START = 13,
48 BRCMF_E_QUIET_END = 14,
49 BRCMF_E_BEACON_RX = 15,
50 BRCMF_E_LINK = 16,
51 BRCMF_E_MIC_ERROR = 17,
52 BRCMF_E_NDIS_LINK = 18,
53 BRCMF_E_ROAM = 19,
54 BRCMF_E_TXFAIL = 20,
55 BRCMF_E_PMKID_CACHE = 21,
56 BRCMF_E_RETROGRADE_TSF = 22,
57 BRCMF_E_PRUNE = 23,
58 BRCMF_E_AUTOAUTH = 24,
59 BRCMF_E_EAPOL_MSG = 25,
60 BRCMF_E_SCAN_COMPLETE = 26,
61 BRCMF_E_ADDTS_IND = 27,
62 BRCMF_E_DELTS_IND = 28,
63 BRCMF_E_BCNSENT_IND = 29,
64 BRCMF_E_BCNRX_MSG = 30,
65 BRCMF_E_BCNLOST_MSG = 31,
66 BRCMF_E_ROAM_PREP = 32,
67 BRCMF_E_PFN_NET_FOUND = 33,
68 BRCMF_E_PFN_NET_LOST = 34,
69 BRCMF_E_RESET_COMPLETE = 35,
70 BRCMF_E_JOIN_START = 36,
71 BRCMF_E_ROAM_START = 37,
72 BRCMF_E_ASSOC_START = 38,
73 BRCMF_E_IBSS_ASSOC = 39,
74 BRCMF_E_RADIO = 40,
75 BRCMF_E_PSM_WATCHDOG = 41,
76 BRCMF_E_PROBREQ_MSG = 44,
77 BRCMF_E_SCAN_CONFIRM_IND = 45,
78 BRCMF_E_PSK_SUP = 46,
79 BRCMF_E_COUNTRY_CODE_CHANGED = 47,
80 BRCMF_E_EXCEEDED_MEDIUM_TIME = 48,
81 BRCMF_E_ICV_ERROR = 49,
82 BRCMF_E_UNICAST_DECODE_ERROR = 50,
83 BRCMF_E_MULTICAST_DECODE_ERROR = 51,
84 BRCMF_E_TRACE = 52,
85 BRCMF_E_IF = 54,
86 BRCMF_E_RSSI = 56,
87 BRCMF_E_PFN_SCAN_COMPLETE = 57,
88 BRCMF_E_EXTLOG_MSG = 58,
89 BRCMF_E_ACTION_FRAME = 59,
90 BRCMF_E_ACTION_FRAME_COMPLETE = 60,
91 BRCMF_E_PRE_ASSOC_IND = 61,
92 BRCMF_E_PRE_REASSOC_IND = 62,
93 BRCMF_E_CHANNEL_ADOPTED = 63,
94 BRCMF_E_AP_STARTED = 64,
95 BRCMF_E_DFS_AP_STOP = 65,
96 BRCMF_E_DFS_AP_RESUME = 66,
97 BRCMF_E_ESCAN_RESULT = 69,
98 BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE = 70,
99 BRCMF_E_DCS_REQUEST = 73,
100 BRCMF_E_FIFO_CREDIT_MAP = 74,
101 BRCMF_E_LAST 108 BRCMF_E_LAST
102}; 109};
110#undef BRCMF_ENUM_DEF
103 111
104/* flags field values in struct brcmf_event_msg */ 112/* flags field values in struct brcmf_event_msg */
105#define BRCMF_EVENT_MSG_LINK 0x01 113#define BRCMF_EVENT_MSG_LINK 0x01
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
index 51a14505197a..d8d8b6549dc5 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
@@ -38,7 +38,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)
38 s32 err; 38 s32 err;
39 39
40 if (drvr->bus_if->state != BRCMF_BUS_DATA) { 40 if (drvr->bus_if->state != BRCMF_BUS_DATA) {
41 brcmf_dbg(ERROR, "bus is down. we have nothing to do.\n"); 41 brcmf_err("bus is down. we have nothing to do.\n");
42 return -EIO; 42 return -EIO;
43 } 43 }
44 44
@@ -53,7 +53,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)
53 if (err >= 0) 53 if (err >= 0)
54 err = 0; 54 err = 0;
55 else 55 else
56 brcmf_dbg(ERROR, "Failed err=%d\n", err); 56 brcmf_err("Failed err=%d\n", err);
57 57
58 return err; 58 return err;
59} 59}
@@ -161,7 +161,7 @@ brcmf_fil_iovar_data_set(struct brcmf_if *ifp, char *name, void *data,
161 buflen, true); 161 buflen, true);
162 } else { 162 } else {
163 err = -EPERM; 163 err = -EPERM;
164 brcmf_dbg(ERROR, "Creating iovar failed\n"); 164 brcmf_err("Creating iovar failed\n");
165 } 165 }
166 166
167 mutex_unlock(&drvr->proto_block); 167 mutex_unlock(&drvr->proto_block);
@@ -187,7 +187,7 @@ brcmf_fil_iovar_data_get(struct brcmf_if *ifp, char *name, void *data,
187 memcpy(data, drvr->proto_buf, len); 187 memcpy(data, drvr->proto_buf, len);
188 } else { 188 } else {
189 err = -EPERM; 189 err = -EPERM;
190 brcmf_dbg(ERROR, "Creating iovar failed\n"); 190 brcmf_err("Creating iovar failed\n");
191 } 191 }
192 192
193 brcmf_dbg(FIL, "name=%s, len=%d\n", name, len); 193 brcmf_dbg(FIL, "name=%s, len=%d\n", name, len);
@@ -237,7 +237,7 @@ brcmf_create_bsscfg(s32 bssidx, char *name, char *data, u32 datalen, char *buf,
237 iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen; 237 iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen;
238 238
239 if (buflen < iolen) { 239 if (buflen < iolen) {
240 brcmf_dbg(ERROR, "buffer is too short\n"); 240 brcmf_err("buffer is too short\n");
241 return 0; 241 return 0;
242 } 242 }
243 243
@@ -284,7 +284,7 @@ brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, char *name,
284 buflen, true); 284 buflen, true);
285 } else { 285 } else {
286 err = -EPERM; 286 err = -EPERM;
287 brcmf_dbg(ERROR, "Creating bsscfg failed\n"); 287 brcmf_err("Creating bsscfg failed\n");
288 } 288 }
289 289
290 mutex_unlock(&drvr->proto_block); 290 mutex_unlock(&drvr->proto_block);
@@ -310,7 +310,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, char *name,
310 memcpy(data, drvr->proto_buf, len); 310 memcpy(data, drvr->proto_buf, len);
311 } else { 311 } else {
312 err = -EPERM; 312 err = -EPERM;
313 brcmf_dbg(ERROR, "Creating bsscfg failed\n"); 313 brcmf_err("Creating bsscfg failed\n");
314 } 314 }
315 brcmf_dbg(FIL, "bssidx=%d, name=%s, len=%d\n", ifp->bssidx, name, len); 315 brcmf_dbg(FIL, "bssidx=%d, name=%s, len=%d\n", ifp->bssidx, name, len);
316 brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data, 316 brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data,
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
index 9434440bbc65..b1bb46c49799 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
@@ -186,7 +186,7 @@ brcmf_sdio_sb_coredisable(struct brcmf_sdio_dev *sdiodev,
186 CORE_SB(base, sbtmstatehigh), 186 CORE_SB(base, sbtmstatehigh),
187 NULL); 187 NULL);
188 if (regdata & SSB_TMSHIGH_BUSY) 188 if (regdata & SSB_TMSHIGH_BUSY)
189 brcmf_dbg(ERROR, "core state still busy\n"); 189 brcmf_err("core state still busy\n");
190 190
191 regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbidlow), 191 regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbidlow),
192 NULL); 192 NULL);
@@ -438,7 +438,7 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev,
438 ci->ramsize = 0x80000; 438 ci->ramsize = 0x80000;
439 break; 439 break;
440 default: 440 default:
441 brcmf_dbg(ERROR, "chipid 0x%x is not supported\n", ci->chip); 441 brcmf_err("chipid 0x%x is not supported\n", ci->chip);
442 return -ENODEV; 442 return -ENODEV;
443 } 443 }
444 444
@@ -456,7 +456,7 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev,
456 ci->resetcore = brcmf_sdio_ai_resetcore; 456 ci->resetcore = brcmf_sdio_ai_resetcore;
457 break; 457 break;
458 default: 458 default:
459 brcmf_dbg(ERROR, "socitype %u not supported\n", ci->socitype); 459 brcmf_err("socitype %u not supported\n", ci->socitype);
460 return -ENODEV; 460 return -ENODEV;
461 } 461 }
462 462
@@ -473,7 +473,7 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
473 clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ; 473 clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
474 brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); 474 brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
475 if (err) { 475 if (err) {
476 brcmf_dbg(ERROR, "error writing for HT off\n"); 476 brcmf_err("error writing for HT off\n");
477 return err; 477 return err;
478 } 478 }
479 479
@@ -483,7 +483,7 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
483 SBSDIO_FUNC1_CHIPCLKCSR, NULL); 483 SBSDIO_FUNC1_CHIPCLKCSR, NULL);
484 484
485 if ((clkval & ~SBSDIO_AVBITS) != clkset) { 485 if ((clkval & ~SBSDIO_AVBITS) != clkset) {
486 brcmf_dbg(ERROR, "ChipClkCSR access: wrote 0x%02x read 0x%02x\n", 486 brcmf_err("ChipClkCSR access: wrote 0x%02x read 0x%02x\n",
487 clkset, clkval); 487 clkset, clkval);
488 return -EACCES; 488 return -EACCES;
489 } 489 }
@@ -493,7 +493,7 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
493 !SBSDIO_ALPAV(clkval)), 493 !SBSDIO_ALPAV(clkval)),
494 PMU_MAX_TRANSITION_DLY); 494 PMU_MAX_TRANSITION_DLY);
495 if (!SBSDIO_ALPAV(clkval)) { 495 if (!SBSDIO_ALPAV(clkval)) {
496 brcmf_dbg(ERROR, "timeout on ALPAV wait, clkval 0x%02x\n", 496 brcmf_err("timeout on ALPAV wait, clkval 0x%02x\n",
497 clkval); 497 clkval);
498 return -EBUSY; 498 return -EBUSY;
499 } 499 }
@@ -618,7 +618,7 @@ brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev,
618 str_shift = 11; 618 str_shift = 11;
619 break; 619 break;
620 default: 620 default:
621 brcmf_dbg(ERROR, "No SDIO Drive strength init done for chip %s rev %d pmurev %d\n", 621 brcmf_err("No SDIO Drive strength init done for chip %s rev %d pmurev %d\n",
622 brcmf_sdio_chip_name(ci->chip, chn, 8), 622 brcmf_sdio_chip_name(ci->chip, chn, 8),
623 ci->chiprev, ci->pmurev); 623 ci->chiprev, ci->pmurev);
624 break; 624 break;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index 39a5baa92f21..914c56fe6c5f 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -216,7 +216,7 @@ brcmf_usb_send_ctl(struct brcmf_usbdev_info *devinfo, u8 *buf, int len)
216 216
217 ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); 217 ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC);
218 if (ret < 0) 218 if (ret < 0)
219 brcmf_dbg(ERROR, "usb_submit_urb failed %d\n", ret); 219 brcmf_err("usb_submit_urb failed %d\n", ret);
220 220
221 return ret; 221 return ret;
222} 222}
@@ -250,7 +250,7 @@ brcmf_usb_recv_ctl(struct brcmf_usbdev_info *devinfo, u8 *buf, int len)
250 250
251 ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); 251 ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC);
252 if (ret < 0) 252 if (ret < 0)
253 brcmf_dbg(ERROR, "usb_submit_urb failed %d\n", ret); 253 brcmf_err("usb_submit_urb failed %d\n", ret);
254 254
255 return ret; 255 return ret;
256} 256}
@@ -271,14 +271,14 @@ static int brcmf_usb_tx_ctlpkt(struct device *dev, u8 *buf, u32 len)
271 devinfo->ctl_completed = false; 271 devinfo->ctl_completed = false;
272 err = brcmf_usb_send_ctl(devinfo, buf, len); 272 err = brcmf_usb_send_ctl(devinfo, buf, len);
273 if (err) { 273 if (err) {
274 brcmf_dbg(ERROR, "fail %d bytes: %d\n", err, len); 274 brcmf_err("fail %d bytes: %d\n", err, len);
275 clear_bit(0, &devinfo->ctl_op); 275 clear_bit(0, &devinfo->ctl_op);
276 return err; 276 return err;
277 } 277 }
278 timeout = brcmf_usb_ioctl_resp_wait(devinfo); 278 timeout = brcmf_usb_ioctl_resp_wait(devinfo);
279 clear_bit(0, &devinfo->ctl_op); 279 clear_bit(0, &devinfo->ctl_op);
280 if (!timeout) { 280 if (!timeout) {
281 brcmf_dbg(ERROR, "Txctl wait timed out\n"); 281 brcmf_err("Txctl wait timed out\n");
282 err = -EIO; 282 err = -EIO;
283 } 283 }
284 return err; 284 return err;
@@ -300,7 +300,7 @@ static int brcmf_usb_rx_ctlpkt(struct device *dev, u8 *buf, u32 len)
300 devinfo->ctl_completed = false; 300 devinfo->ctl_completed = false;
301 err = brcmf_usb_recv_ctl(devinfo, buf, len); 301 err = brcmf_usb_recv_ctl(devinfo, buf, len);
302 if (err) { 302 if (err) {
303 brcmf_dbg(ERROR, "fail %d bytes: %d\n", err, len); 303 brcmf_err("fail %d bytes: %d\n", err, len);
304 clear_bit(0, &devinfo->ctl_op); 304 clear_bit(0, &devinfo->ctl_op);
305 return err; 305 return err;
306 } 306 }
@@ -308,7 +308,7 @@ static int brcmf_usb_rx_ctlpkt(struct device *dev, u8 *buf, u32 len)
308 err = devinfo->ctl_urb_status; 308 err = devinfo->ctl_urb_status;
309 clear_bit(0, &devinfo->ctl_op); 309 clear_bit(0, &devinfo->ctl_op);
310 if (!timeout) { 310 if (!timeout) {
311 brcmf_dbg(ERROR, "rxctl wait timed out\n"); 311 brcmf_err("rxctl wait timed out\n");
312 err = -EIO; 312 err = -EIO;
313 } 313 }
314 if (!err) 314 if (!err)
@@ -356,7 +356,7 @@ brcmf_usbdev_qinit(struct list_head *q, int qsize)
356 356
357 reqs = kzalloc(sizeof(struct brcmf_usbreq) * qsize, GFP_ATOMIC); 357 reqs = kzalloc(sizeof(struct brcmf_usbreq) * qsize, GFP_ATOMIC);
358 if (reqs == NULL) { 358 if (reqs == NULL) {
359 brcmf_dbg(ERROR, "fail to allocate memory!\n"); 359 brcmf_err("fail to allocate memory!\n");
360 return NULL; 360 return NULL;
361 } 361 }
362 req = reqs; 362 req = reqs;
@@ -372,7 +372,7 @@ brcmf_usbdev_qinit(struct list_head *q, int qsize)
372 } 372 }
373 return reqs; 373 return reqs;
374fail: 374fail:
375 brcmf_dbg(ERROR, "fail!\n"); 375 brcmf_err("fail!\n");
376 while (!list_empty(q)) { 376 while (!list_empty(q)) {
377 req = list_entry(q->next, struct brcmf_usbreq, list); 377 req = list_entry(q->next, struct brcmf_usbreq, list);
378 if (req && req->urb) 378 if (req && req->urb)
@@ -389,7 +389,7 @@ static void brcmf_usb_free_q(struct list_head *q, bool pending)
389 int i = 0; 389 int i = 0;
390 list_for_each_entry_safe(req, next, q, list) { 390 list_for_each_entry_safe(req, next, q, list) {
391 if (!req->urb) { 391 if (!req->urb) {
392 brcmf_dbg(ERROR, "bad req\n"); 392 brcmf_err("bad req\n");
393 break; 393 break;
394 } 394 }
395 i++; 395 i++;
@@ -462,7 +462,7 @@ static void brcmf_usb_rx_complete(struct urb *urb)
462 if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) { 462 if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) {
463 skb_put(skb, urb->actual_length); 463 skb_put(skb, urb->actual_length);
464 if (brcmf_proto_hdrpull(devinfo->dev, &ifidx, skb) != 0) { 464 if (brcmf_proto_hdrpull(devinfo->dev, &ifidx, skb) != 0) {
465 brcmf_dbg(ERROR, "rx protocol error\n"); 465 brcmf_err("rx protocol error\n");
466 brcmu_pkt_buf_free_skb(skb); 466 brcmu_pkt_buf_free_skb(skb);
467 devinfo->bus_pub.bus->dstats.rx_errors++; 467 devinfo->bus_pub.bus->dstats.rx_errors++;
468 } else 468 } else
@@ -513,7 +513,7 @@ static void brcmf_usb_rx_fill_all(struct brcmf_usbdev_info *devinfo)
513 struct brcmf_usbreq *req; 513 struct brcmf_usbreq *req;
514 514
515 if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) { 515 if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) {
516 brcmf_dbg(ERROR, "bus is not up=%d\n", devinfo->bus_pub.state); 516 brcmf_err("bus is not up=%d\n", devinfo->bus_pub.state);
517 return; 517 return;
518 } 518 }
519 while ((req = brcmf_usb_deq(devinfo, &devinfo->rx_freeq, NULL)) != NULL) 519 while ((req = brcmf_usb_deq(devinfo, &devinfo->rx_freeq, NULL)) != NULL)
@@ -569,14 +569,14 @@ brcmf_usb_intr_complete(struct urb *urb)
569 } 569 }
570 570
571 if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_DOWN) { 571 if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_DOWN) {
572 brcmf_dbg(ERROR, "intr cb when DBUS down, ignoring\n"); 572 brcmf_err("intr cb when DBUS down, ignoring\n");
573 return; 573 return;
574 } 574 }
575 575
576 if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) { 576 if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) {
577 err = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); 577 err = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC);
578 if (err) 578 if (err)
579 brcmf_dbg(ERROR, "usb_submit_urb, err=%d\n", err); 579 brcmf_err("usb_submit_urb, err=%d\n", err);
580 } 580 }
581} 581}
582 582
@@ -594,7 +594,7 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb)
594 &devinfo->tx_freecount); 594 &devinfo->tx_freecount);
595 if (!req) { 595 if (!req) {
596 brcmu_pkt_buf_free_skb(skb); 596 brcmu_pkt_buf_free_skb(skb);
597 brcmf_dbg(ERROR, "no req to send\n"); 597 brcmf_err("no req to send\n");
598 return -ENOMEM; 598 return -ENOMEM;
599 } 599 }
600 600
@@ -606,7 +606,7 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb)
606 brcmf_usb_enq(devinfo, &devinfo->tx_postq, req, NULL); 606 brcmf_usb_enq(devinfo, &devinfo->tx_postq, req, NULL);
607 ret = usb_submit_urb(req->urb, GFP_ATOMIC); 607 ret = usb_submit_urb(req->urb, GFP_ATOMIC);
608 if (ret) { 608 if (ret) {
609 brcmf_dbg(ERROR, "brcmf_usb_tx usb_submit_urb FAILED\n"); 609 brcmf_err("brcmf_usb_tx usb_submit_urb FAILED\n");
610 brcmf_usb_del_fromq(devinfo, req); 610 brcmf_usb_del_fromq(devinfo, req);
611 brcmu_pkt_buf_free_skb(req->skb); 611 brcmu_pkt_buf_free_skb(req->skb);
612 req->skb = NULL; 612 req->skb = NULL;
@@ -648,7 +648,7 @@ static int brcmf_usb_up(struct device *dev)
648 648
649 ret = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); 649 ret = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC);
650 if (ret) { 650 if (ret) {
651 brcmf_dbg(ERROR, "USB_SUBMIT_URB failed with status %d\n", 651 brcmf_err("USB_SUBMIT_URB failed with status %d\n",
652 ret); 652 ret);
653 return -EINVAL; 653 return -EINVAL;
654 } 654 }
@@ -745,7 +745,7 @@ static bool brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd,
745 devinfo->ctl_completed = false; 745 devinfo->ctl_completed = false;
746 ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); 746 ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC);
747 if (ret < 0) { 747 if (ret < 0) {
748 brcmf_dbg(ERROR, "usb_submit_urb failed %d\n", ret); 748 brcmf_err("usb_submit_urb failed %d\n", ret);
749 kfree(tmpbuf); 749 kfree(tmpbuf);
750 return false; 750 return false;
751 } 751 }
@@ -815,7 +815,7 @@ brcmf_usb_resetcfg(struct brcmf_usbdev_info *devinfo)
815 brcmf_usb_dl_cmd(devinfo, DL_RESETCFG, &id, sizeof(id)); 815 brcmf_usb_dl_cmd(devinfo, DL_RESETCFG, &id, sizeof(id));
816 return 0; 816 return 0;
817 } else { 817 } else {
818 brcmf_dbg(ERROR, "Cannot talk to Dongle. Firmware is not UP, %d ms\n", 818 brcmf_err("Cannot talk to Dongle. Firmware is not UP, %d ms\n",
819 BRCMF_USB_RESET_GETVER_SPINWAIT * loop_cnt); 819 BRCMF_USB_RESET_GETVER_SPINWAIT * loop_cnt);
820 return -EINVAL; 820 return -EINVAL;
821 } 821 }
@@ -840,7 +840,7 @@ brcmf_usb_dl_send_bulk(struct brcmf_usbdev_info *devinfo, void *buffer, int len)
840 devinfo->ctl_completed = false; 840 devinfo->ctl_completed = false;
841 ret = usb_submit_urb(devinfo->bulk_urb, GFP_ATOMIC); 841 ret = usb_submit_urb(devinfo->bulk_urb, GFP_ATOMIC);
842 if (ret) { 842 if (ret) {
843 brcmf_dbg(ERROR, "usb_submit_urb failed %d\n", ret); 843 brcmf_err("usb_submit_urb failed %d\n", ret);
844 return ret; 844 return ret;
845 } 845 }
846 ret = brcmf_usb_ioctl_resp_wait(devinfo); 846 ret = brcmf_usb_ioctl_resp_wait(devinfo);
@@ -873,7 +873,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen)
873 873
874 /* 2) Check we are in the Waiting state */ 874 /* 2) Check we are in the Waiting state */
875 if (rdlstate != DL_WAITING) { 875 if (rdlstate != DL_WAITING) {
876 brcmf_dbg(ERROR, "Failed to DL_START\n"); 876 brcmf_err("Failed to DL_START\n");
877 err = -EINVAL; 877 err = -EINVAL;
878 goto fail; 878 goto fail;
879 } 879 }
@@ -902,7 +902,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen)
902 memcpy(bulkchunk, dlpos, sendlen); 902 memcpy(bulkchunk, dlpos, sendlen);
903 if (brcmf_usb_dl_send_bulk(devinfo, bulkchunk, 903 if (brcmf_usb_dl_send_bulk(devinfo, bulkchunk,
904 sendlen)) { 904 sendlen)) {
905 brcmf_dbg(ERROR, "send_bulk failed\n"); 905 brcmf_err("send_bulk failed\n");
906 err = -EINVAL; 906 err = -EINVAL;
907 goto fail; 907 goto fail;
908 } 908 }
@@ -912,7 +912,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen)
912 } 912 }
913 if (!brcmf_usb_dl_cmd(devinfo, DL_GETSTATE, &state, 913 if (!brcmf_usb_dl_cmd(devinfo, DL_GETSTATE, &state,
914 sizeof(struct rdl_state_le))) { 914 sizeof(struct rdl_state_le))) {
915 brcmf_dbg(ERROR, "DL_GETSTATE Failed xxxx\n"); 915 brcmf_err("DL_GETSTATE Failed xxxx\n");
916 err = -EINVAL; 916 err = -EINVAL;
917 goto fail; 917 goto fail;
918 } 918 }
@@ -922,7 +922,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen)
922 922
923 /* restart if an error is reported */ 923 /* restart if an error is reported */
924 if (rdlstate == DL_BAD_HDR || rdlstate == DL_BAD_CRC) { 924 if (rdlstate == DL_BAD_HDR || rdlstate == DL_BAD_CRC) {
925 brcmf_dbg(ERROR, "Bad Hdr or Bad CRC state %d\n", 925 brcmf_err("Bad Hdr or Bad CRC state %d\n",
926 rdlstate); 926 rdlstate);
927 err = -EINVAL; 927 err = -EINVAL;
928 goto fail; 928 goto fail;
@@ -981,7 +981,7 @@ static int brcmf_usb_dlrun(struct brcmf_usbdev_info *devinfo)
981 return -ENODEV; 981 return -ENODEV;
982 /* The Dongle may go for re-enumeration. */ 982 /* The Dongle may go for re-enumeration. */
983 } else { 983 } else {
984 brcmf_dbg(ERROR, "Dongle not runnable\n"); 984 brcmf_err("Dongle not runnable\n");
985 return -EINVAL; 985 return -EINVAL;
986 } 986 }
987 brcmf_dbg(USB, "Exit\n"); 987 brcmf_dbg(USB, "Exit\n");
@@ -1019,13 +1019,13 @@ brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo)
1019 chiprev = devinfo->bus_pub.chiprev; 1019 chiprev = devinfo->bus_pub.chiprev;
1020 1020
1021 if (!brcmf_usb_chip_support(devid, chiprev)) { 1021 if (!brcmf_usb_chip_support(devid, chiprev)) {
1022 brcmf_dbg(ERROR, "unsupported chip %d rev %d\n", 1022 brcmf_err("unsupported chip %d rev %d\n",
1023 devid, chiprev); 1023 devid, chiprev);
1024 return -EINVAL; 1024 return -EINVAL;
1025 } 1025 }
1026 1026
1027 if (!devinfo->image) { 1027 if (!devinfo->image) {
1028 brcmf_dbg(ERROR, "No firmware!\n"); 1028 brcmf_err("No firmware!\n");
1029 return -ENOENT; 1029 return -ENOENT;
1030 } 1030 }
1031 1031
@@ -1124,11 +1124,11 @@ static int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo)
1124 /* fw image not yet loaded. Load it now and add to list */ 1124 /* fw image not yet loaded. Load it now and add to list */
1125 err = request_firmware(&fw, fwname, devinfo->dev); 1125 err = request_firmware(&fw, fwname, devinfo->dev);
1126 if (!fw) { 1126 if (!fw) {
1127 brcmf_dbg(ERROR, "fail to request firmware %s\n", fwname); 1127 brcmf_err("fail to request firmware %s\n", fwname);
1128 return err; 1128 return err;
1129 } 1129 }
1130 if (check_file(fw->data) < 0) { 1130 if (check_file(fw->data) < 0) {
1131 brcmf_dbg(ERROR, "invalid firmware %s\n", fwname); 1131 brcmf_err("invalid firmware %s\n", fwname);
1132 return -EINVAL; 1132 return -EINVAL;
1133 } 1133 }
1134 1134
@@ -1196,17 +1196,17 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo,
1196 1196
1197 devinfo->intr_urb = usb_alloc_urb(0, GFP_ATOMIC); 1197 devinfo->intr_urb = usb_alloc_urb(0, GFP_ATOMIC);
1198 if (!devinfo->intr_urb) { 1198 if (!devinfo->intr_urb) {
1199 brcmf_dbg(ERROR, "usb_alloc_urb (intr) failed\n"); 1199 brcmf_err("usb_alloc_urb (intr) failed\n");
1200 goto error; 1200 goto error;
1201 } 1201 }
1202 devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC); 1202 devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC);
1203 if (!devinfo->ctl_urb) { 1203 if (!devinfo->ctl_urb) {
1204 brcmf_dbg(ERROR, "usb_alloc_urb (ctl) failed\n"); 1204 brcmf_err("usb_alloc_urb (ctl) failed\n");
1205 goto error; 1205 goto error;
1206 } 1206 }
1207 devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC); 1207 devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC);
1208 if (!devinfo->bulk_urb) { 1208 if (!devinfo->bulk_urb) {
1209 brcmf_dbg(ERROR, "usb_alloc_urb (bulk) failed\n"); 1209 brcmf_err("usb_alloc_urb (bulk) failed\n");
1210 goto error; 1210 goto error;
1211 } 1211 }
1212 1212
@@ -1223,11 +1223,19 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo,
1223 return &devinfo->bus_pub; 1223 return &devinfo->bus_pub;
1224 1224
1225error: 1225error:
1226 brcmf_dbg(ERROR, "failed!\n"); 1226 brcmf_err("failed!\n");
1227 brcmf_usb_detach(devinfo); 1227 brcmf_usb_detach(devinfo);
1228 return NULL; 1228 return NULL;
1229} 1229}
1230 1230
1231static struct brcmf_bus_ops brcmf_usb_bus_ops = {
1232 .txdata = brcmf_usb_tx,
1233 .init = brcmf_usb_up,
1234 .stop = brcmf_usb_down,
1235 .txctl = brcmf_usb_tx_ctlpkt,
1236 .rxctl = brcmf_usb_rx_ctlpkt,
1237};
1238
1231static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) 1239static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo)
1232{ 1240{
1233 struct brcmf_bus *bus = NULL; 1241 struct brcmf_bus *bus = NULL;
@@ -1246,25 +1254,22 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo)
1246 goto fail; 1254 goto fail;
1247 } 1255 }
1248 1256
1257 bus->dev = dev;
1249 bus_pub->bus = bus; 1258 bus_pub->bus = bus;
1250 bus->brcmf_bus_txdata = brcmf_usb_tx;
1251 bus->brcmf_bus_init = brcmf_usb_up;
1252 bus->brcmf_bus_stop = brcmf_usb_down;
1253 bus->brcmf_bus_txctl = brcmf_usb_tx_ctlpkt;
1254 bus->brcmf_bus_rxctl = brcmf_usb_rx_ctlpkt;
1255 bus->bus_priv.usb = bus_pub; 1259 bus->bus_priv.usb = bus_pub;
1256 dev_set_drvdata(dev, bus); 1260 dev_set_drvdata(dev, bus);
1261 bus->ops = &brcmf_usb_bus_ops;
1257 1262
1258 /* Attach to the common driver interface */ 1263 /* Attach to the common driver interface */
1259 ret = brcmf_attach(0, dev); 1264 ret = brcmf_attach(0, dev);
1260 if (ret) { 1265 if (ret) {
1261 brcmf_dbg(ERROR, "brcmf_attach failed\n"); 1266 brcmf_err("brcmf_attach failed\n");
1262 goto fail; 1267 goto fail;
1263 } 1268 }
1264 1269
1265 ret = brcmf_bus_start(dev); 1270 ret = brcmf_bus_start(dev);
1266 if (ret) { 1271 if (ret) {
1267 brcmf_dbg(ERROR, "dongle is not responding\n"); 1272 brcmf_err("dongle is not responding\n");
1268 brcmf_detach(dev); 1273 brcmf_detach(dev);
1269 goto fail; 1274 goto fail;
1270 } 1275 }
@@ -1339,7 +1344,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1339 if (IFDESC(usb, CONTROL_IF).bInterfaceClass != USB_CLASS_VENDOR_SPEC || 1344 if (IFDESC(usb, CONTROL_IF).bInterfaceClass != USB_CLASS_VENDOR_SPEC ||
1340 IFDESC(usb, CONTROL_IF).bInterfaceSubClass != 2 || 1345 IFDESC(usb, CONTROL_IF).bInterfaceSubClass != 2 ||
1341 IFDESC(usb, CONTROL_IF).bInterfaceProtocol != 0xff) { 1346 IFDESC(usb, CONTROL_IF).bInterfaceProtocol != 0xff) {
1342 brcmf_dbg(ERROR, "invalid control interface: class %d, subclass %d, proto %d\n", 1347 brcmf_err("invalid control interface: class %d, subclass %d, proto %d\n",
1343 IFDESC(usb, CONTROL_IF).bInterfaceClass, 1348 IFDESC(usb, CONTROL_IF).bInterfaceClass,
1344 IFDESC(usb, CONTROL_IF).bInterfaceSubClass, 1349 IFDESC(usb, CONTROL_IF).bInterfaceSubClass,
1345 IFDESC(usb, CONTROL_IF).bInterfaceProtocol); 1350 IFDESC(usb, CONTROL_IF).bInterfaceProtocol);
@@ -1351,7 +1356,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1351 endpoint = &IFEPDESC(usb, CONTROL_IF, 0); 1356 endpoint = &IFEPDESC(usb, CONTROL_IF, 0);
1352 if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 1357 if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
1353 != USB_ENDPOINT_XFER_INT) { 1358 != USB_ENDPOINT_XFER_INT) {
1354 brcmf_dbg(ERROR, "invalid control endpoint %d\n", 1359 brcmf_err("invalid control endpoint %d\n",
1355 endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK); 1360 endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK);
1356 ret = -1; 1361 ret = -1;
1357 goto fail; 1362 goto fail;
@@ -1370,7 +1375,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1370 endpoint = &IFEPDESC(usb, BULK_IF, ep); 1375 endpoint = &IFEPDESC(usb, BULK_IF, ep);
1371 if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != 1376 if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) !=
1372 USB_ENDPOINT_XFER_BULK) { 1377 USB_ENDPOINT_XFER_BULK) {
1373 brcmf_dbg(ERROR, "invalid data endpoint %d\n", ep); 1378 brcmf_err("invalid data endpoint %d\n", ep);
1374 ret = -1; 1379 ret = -1;
1375 goto fail; 1380 goto fail;
1376 } 1381 }
@@ -1413,7 +1418,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1413 return 0; 1418 return 0;
1414 1419
1415fail: 1420fail:
1416 brcmf_dbg(ERROR, "failed with errno %d\n", ret); 1421 brcmf_err("failed with errno %d\n", ret);
1417 kfree(devinfo); 1422 kfree(devinfo);
1418 usb_set_intfdata(intf, NULL); 1423 usb_set_intfdata(intf, NULL);
1419 return ret; 1424 return ret;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 96bc349d7f6c..1261a9b84e04 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -27,6 +27,7 @@
27#include <defs.h> 27#include <defs.h>
28#include <brcmu_wifi.h> 28#include <brcmu_wifi.h>
29#include "dhd.h" 29#include "dhd.h"
30#include "dhd_dbg.h"
30#include "wl_cfg80211.h" 31#include "wl_cfg80211.h"
31#include "fwil.h" 32#include "fwil.h"
32 33
@@ -87,13 +88,11 @@
87#define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ 88#define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
88 (sizeof(struct brcmf_assoc_params_le) - sizeof(u16)) 89 (sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
89 90
90static u32 brcmf_dbg_level = WL_DBG_ERR;
91
92static bool check_vif_up(struct brcmf_cfg80211_vif *vif) 91static bool check_vif_up(struct brcmf_cfg80211_vif *vif)
93{ 92{
94 if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) { 93 if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) {
95 WL_INFO("device is not ready : status (%lu)\n", 94 brcmf_dbg(INFO, "device is not ready : status (%lu)\n",
96 vif->sme_state); 95 vif->sme_state);
97 return false; 96 return false;
98 } 97 }
99 return true; 98 return true;
@@ -437,7 +436,7 @@ send_key_to_dongle(struct net_device *ndev, struct brcmf_wsec_key *key)
437 sizeof(key_le)); 436 sizeof(key_le));
438 437
439 if (err) 438 if (err)
440 WL_ERR("wsec_key error (%d)\n", err); 439 brcmf_err("wsec_key error (%d)\n", err);
441 return err; 440 return err;
442} 441}
443 442
@@ -452,13 +451,13 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
452 s32 ap = 0; 451 s32 ap = 0;
453 s32 err = 0; 452 s32 err = 0;
454 453
455 WL_TRACE("Enter, ndev=%p, type=%d\n", ndev, type); 454 brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
456 455
457 switch (type) { 456 switch (type) {
458 case NL80211_IFTYPE_MONITOR: 457 case NL80211_IFTYPE_MONITOR:
459 case NL80211_IFTYPE_WDS: 458 case NL80211_IFTYPE_WDS:
460 WL_ERR("type (%d) : currently we do not support this type\n", 459 brcmf_err("type (%d) : currently we do not support this type\n",
461 type); 460 type);
462 return -EOPNOTSUPP; 461 return -EOPNOTSUPP;
463 case NL80211_IFTYPE_ADHOC: 462 case NL80211_IFTYPE_ADHOC:
464 vif->mode = WL_MODE_IBSS; 463 vif->mode = WL_MODE_IBSS;
@@ -479,21 +478,21 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
479 478
480 if (ap) { 479 if (ap) {
481 set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state); 480 set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state);
482 WL_INFO("IF Type = AP\n"); 481 brcmf_dbg(INFO, "IF Type = AP\n");
483 } else { 482 } else {
484 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); 483 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
485 if (err) { 484 if (err) {
486 WL_ERR("WLC_SET_INFRA error (%d)\n", err); 485 brcmf_err("WLC_SET_INFRA error (%d)\n", err);
487 err = -EAGAIN; 486 err = -EAGAIN;
488 goto done; 487 goto done;
489 } 488 }
490 WL_INFO("IF Type = %s\n", (vif->mode == WL_MODE_IBSS) ? 489 brcmf_dbg(INFO, "IF Type = %s\n", (vif->mode == WL_MODE_IBSS) ?
491 "Adhoc" : "Infra"); 490 "Adhoc" : "Infra");
492 } 491 }
493 ndev->ieee80211_ptr->iftype = type; 492 ndev->ieee80211_ptr->iftype = type;
494 493
495done: 494done:
496 WL_TRACE("Exit\n"); 495 brcmf_dbg(TRACE, "Exit\n");
497 496
498 return err; 497 return err;
499} 498}
@@ -506,10 +505,10 @@ static void brcmf_set_mpc(struct net_device *ndev, int mpc)
506 if (check_vif_up(ifp->vif)) { 505 if (check_vif_up(ifp->vif)) {
507 err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc); 506 err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
508 if (err) { 507 if (err) {
509 WL_ERR("fail to set mpc\n"); 508 brcmf_err("fail to set mpc\n");
510 return; 509 return;
511 } 510 }
512 WL_INFO("MPC : %d\n", mpc); 511 brcmf_dbg(INFO, "MPC : %d\n", mpc);
513 } 512 }
514} 513}
515 514
@@ -541,19 +540,20 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le,
541 n_ssids = request->n_ssids; 540 n_ssids = request->n_ssids;
542 n_channels = request->n_channels; 541 n_channels = request->n_channels;
543 /* Copy channel array if applicable */ 542 /* Copy channel array if applicable */
544 WL_SCAN("### List of channelspecs to scan ### %d\n", n_channels); 543 brcmf_dbg(SCAN, "### List of channelspecs to scan ### %d\n",
544 n_channels);
545 if (n_channels > 0) { 545 if (n_channels > 0) {
546 for (i = 0; i < n_channels; i++) { 546 for (i = 0; i < n_channels; i++) {
547 chanspec = channel_to_chanspec(request->channels[i]); 547 chanspec = channel_to_chanspec(request->channels[i]);
548 WL_SCAN("Chan : %d, Channel spec: %x\n", 548 brcmf_dbg(SCAN, "Chan : %d, Channel spec: %x\n",
549 request->channels[i]->hw_value, chanspec); 549 request->channels[i]->hw_value, chanspec);
550 params_le->channel_list[i] = cpu_to_le16(chanspec); 550 params_le->channel_list[i] = cpu_to_le16(chanspec);
551 } 551 }
552 } else { 552 } else {
553 WL_SCAN("Scanning all channels\n"); 553 brcmf_dbg(SCAN, "Scanning all channels\n");
554 } 554 }
555 /* Copy ssid array if applicable */ 555 /* Copy ssid array if applicable */
556 WL_SCAN("### List of SSIDs to scan ### %d\n", n_ssids); 556 brcmf_dbg(SCAN, "### List of SSIDs to scan ### %d\n", n_ssids);
557 if (n_ssids > 0) { 557 if (n_ssids > 0) {
558 offset = offsetof(struct brcmf_scan_params_le, channel_list) + 558 offset = offsetof(struct brcmf_scan_params_le, channel_list) +
559 n_channels * sizeof(u16); 559 n_channels * sizeof(u16);
@@ -566,18 +566,19 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le,
566 memcpy(ssid_le.SSID, request->ssids[i].ssid, 566 memcpy(ssid_le.SSID, request->ssids[i].ssid,
567 request->ssids[i].ssid_len); 567 request->ssids[i].ssid_len);
568 if (!ssid_le.SSID_len) 568 if (!ssid_le.SSID_len)
569 WL_SCAN("%d: Broadcast scan\n", i); 569 brcmf_dbg(SCAN, "%d: Broadcast scan\n", i);
570 else 570 else
571 WL_SCAN("%d: scan for %s size =%d\n", i, 571 brcmf_dbg(SCAN, "%d: scan for %s size =%d\n",
572 ssid_le.SSID, ssid_le.SSID_len); 572 i, ssid_le.SSID, ssid_le.SSID_len);
573 memcpy(ptr, &ssid_le, sizeof(ssid_le)); 573 memcpy(ptr, &ssid_le, sizeof(ssid_le));
574 ptr += sizeof(ssid_le); 574 ptr += sizeof(ssid_le);
575 } 575 }
576 } else { 576 } else {
577 WL_SCAN("Broadcast scan %p\n", request->ssids); 577 brcmf_dbg(SCAN, "Broadcast scan %p\n", request->ssids);
578 if ((request->ssids) && request->ssids->ssid_len) { 578 if ((request->ssids) && request->ssids->ssid_len) {
579 WL_SCAN("SSID %s len=%d\n", params_le->ssid_le.SSID, 579 brcmf_dbg(SCAN, "SSID %s len=%d\n",
580 request->ssids->ssid_len); 580 params_le->ssid_le.SSID,
581 request->ssids->ssid_len);
581 params_le->ssid_le.SSID_len = 582 params_le->ssid_le.SSID_len =
582 cpu_to_le32(request->ssids->ssid_len); 583 cpu_to_le32(request->ssids->ssid_len);
583 memcpy(&params_le->ssid_le.SSID, request->ssids->ssid, 584 memcpy(&params_le->ssid_le.SSID, request->ssids->ssid,
@@ -599,7 +600,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
599 struct cfg80211_scan_request *scan_request; 600 struct cfg80211_scan_request *scan_request;
600 s32 err = 0; 601 s32 err = 0;
601 602
602 WL_SCAN("Enter\n"); 603 brcmf_dbg(SCAN, "Enter\n");
603 604
604 /* clear scan request, because the FW abort can cause a second call */ 605 /* clear scan request, because the FW abort can cause a second call */
605 /* to this functon and might cause a double cfg80211_scan_done */ 606 /* to this functon and might cause a double cfg80211_scan_done */
@@ -611,7 +612,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
611 612
612 if (fw_abort) { 613 if (fw_abort) {
613 /* Do a scan abort to stop the driver's scan engine */ 614 /* Do a scan abort to stop the driver's scan engine */
614 WL_SCAN("ABORT scan in firmware\n"); 615 brcmf_dbg(SCAN, "ABORT scan in firmware\n");
615 memset(&params_le, 0, sizeof(params_le)); 616 memset(&params_le, 0, sizeof(params_le));
616 memset(params_le.bssid, 0xFF, ETH_ALEN); 617 memset(params_le.bssid, 0xFF, ETH_ALEN);
617 params_le.bss_type = DOT11_BSSTYPE_ANY; 618 params_le.bss_type = DOT11_BSSTYPE_ANY;
@@ -627,26 +628,26 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
627 err = brcmf_fil_cmd_data_set(netdev_priv(ndev), BRCMF_C_SCAN, 628 err = brcmf_fil_cmd_data_set(netdev_priv(ndev), BRCMF_C_SCAN,
628 &params_le, sizeof(params_le)); 629 &params_le, sizeof(params_le));
629 if (err) 630 if (err)
630 WL_ERR("Scan abort failed\n"); 631 brcmf_err("Scan abort failed\n");
631 } 632 }
632 /* 633 /*
633 * e-scan can be initiated by scheduled scan 634 * e-scan can be initiated by scheduled scan
634 * which takes precedence. 635 * which takes precedence.
635 */ 636 */
636 if (cfg->sched_escan) { 637 if (cfg->sched_escan) {
637 WL_SCAN("scheduled scan completed\n"); 638 brcmf_dbg(SCAN, "scheduled scan completed\n");
638 cfg->sched_escan = false; 639 cfg->sched_escan = false;
639 if (!aborted) 640 if (!aborted)
640 cfg80211_sched_scan_results(cfg_to_wiphy(cfg)); 641 cfg80211_sched_scan_results(cfg_to_wiphy(cfg));
641 brcmf_set_mpc(ndev, 1); 642 brcmf_set_mpc(ndev, 1);
642 } else if (scan_request) { 643 } else if (scan_request) {
643 WL_SCAN("ESCAN Completed scan: %s\n", 644 brcmf_dbg(SCAN, "ESCAN Completed scan: %s\n",
644 aborted ? "Aborted" : "Done"); 645 aborted ? "Aborted" : "Done");
645 cfg80211_scan_done(scan_request, aborted); 646 cfg80211_scan_done(scan_request, aborted);
646 brcmf_set_mpc(ndev, 1); 647 brcmf_set_mpc(ndev, 1);
647 } 648 }
648 if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { 649 if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
649 WL_ERR("Scan complete while device not scanning\n"); 650 brcmf_err("Scan complete while device not scanning\n");
650 return -EPERM; 651 return -EPERM;
651 } 652 }
652 653
@@ -662,7 +663,7 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct net_device *ndev,
662 struct brcmf_escan_params_le *params; 663 struct brcmf_escan_params_le *params;
663 s32 err = 0; 664 s32 err = 0;
664 665
665 WL_SCAN("E-SCAN START\n"); 666 brcmf_dbg(SCAN, "E-SCAN START\n");
666 667
667 if (request != NULL) { 668 if (request != NULL) {
668 /* Allocate space for populating ssids in struct */ 669 /* Allocate space for populating ssids in struct */
@@ -687,9 +688,9 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct net_device *ndev,
687 params, params_size); 688 params, params_size);
688 if (err) { 689 if (err) {
689 if (err == -EBUSY) 690 if (err == -EBUSY)
690 WL_INFO("system busy : escan canceled\n"); 691 brcmf_dbg(INFO, "system busy : escan canceled\n");
691 else 692 else
692 WL_ERR("error (%d)\n", err); 693 brcmf_err("error (%d)\n", err);
693 } 694 }
694 695
695 kfree(params); 696 kfree(params);
@@ -705,7 +706,7 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy,
705 u32 passive_scan; 706 u32 passive_scan;
706 struct brcmf_scan_results *results; 707 struct brcmf_scan_results *results;
707 708
708 WL_SCAN("Enter\n"); 709 brcmf_dbg(SCAN, "Enter\n");
709 cfg->escan_info.ndev = ndev; 710 cfg->escan_info.ndev = ndev;
710 cfg->escan_info.wiphy = wiphy; 711 cfg->escan_info.wiphy = wiphy;
711 cfg->escan_info.escan_state = WL_ESCAN_STATE_SCANNING; 712 cfg->escan_info.escan_state = WL_ESCAN_STATE_SCANNING;
@@ -713,7 +714,7 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy,
713 err = brcmf_fil_cmd_int_set(netdev_priv(ndev), BRCMF_C_SET_PASSIVE_SCAN, 714 err = brcmf_fil_cmd_int_set(netdev_priv(ndev), BRCMF_C_SET_PASSIVE_SCAN,
714 passive_scan); 715 passive_scan);
715 if (err) { 716 if (err) {
716 WL_ERR("error (%d)\n", err); 717 brcmf_err("error (%d)\n", err);
717 return err; 718 return err;
718 } 719 }
719 brcmf_set_mpc(ndev, 0); 720 brcmf_set_mpc(ndev, 0);
@@ -743,19 +744,19 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
743 s32 err; 744 s32 err;
744 u32 SSID_len; 745 u32 SSID_len;
745 746
746 WL_SCAN("START ESCAN\n"); 747 brcmf_dbg(SCAN, "START ESCAN\n");
747 748
748 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { 749 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
749 WL_ERR("Scanning already: status (%lu)\n", cfg->scan_status); 750 brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
750 return -EAGAIN; 751 return -EAGAIN;
751 } 752 }
752 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { 753 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
753 WL_ERR("Scanning being aborted: status (%lu)\n", 754 brcmf_err("Scanning being aborted: status (%lu)\n",
754 cfg->scan_status); 755 cfg->scan_status);
755 return -EAGAIN; 756 return -EAGAIN;
756 } 757 }
757 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) { 758 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) {
758 WL_ERR("Connecting: status (%lu)\n", ifp->vif->sme_state); 759 brcmf_err("Connecting: status (%lu)\n", ifp->vif->sme_state);
759 return -EAGAIN; 760 return -EAGAIN;
760 } 761 }
761 762
@@ -781,8 +782,8 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
781 if (err) 782 if (err)
782 goto scan_out; 783 goto scan_out;
783 } else { 784 } else {
784 WL_SCAN("ssid \"%s\", ssid_len (%d)\n", 785 brcmf_dbg(SCAN, "ssid \"%s\", ssid_len (%d)\n",
785 ssids->ssid, ssids->ssid_len); 786 ssids->ssid, ssids->ssid_len);
786 memset(&sr->ssid_le, 0, sizeof(sr->ssid_le)); 787 memset(&sr->ssid_le, 0, sizeof(sr->ssid_le));
787 SSID_len = min_t(u8, sizeof(sr->ssid_le.SSID), ssids->ssid_len); 788 SSID_len = min_t(u8, sizeof(sr->ssid_le.SSID), ssids->ssid_len);
788 sr->ssid_le.SSID_len = cpu_to_le32(0); 789 sr->ssid_le.SSID_len = cpu_to_le32(0);
@@ -792,13 +793,13 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
792 sr->ssid_le.SSID_len = cpu_to_le32(SSID_len); 793 sr->ssid_le.SSID_len = cpu_to_le32(SSID_len);
793 spec_scan = true; 794 spec_scan = true;
794 } else 795 } else
795 WL_SCAN("Broadcast scan\n"); 796 brcmf_dbg(SCAN, "Broadcast scan\n");
796 797
797 passive_scan = cfg->active_scan ? 0 : 1; 798 passive_scan = cfg->active_scan ? 0 : 1;
798 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN, 799 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN,
799 passive_scan); 800 passive_scan);
800 if (err) { 801 if (err) {
801 WL_ERR("WLC_SET_PASSIVE_SCAN error (%d)\n", err); 802 brcmf_err("WLC_SET_PASSIVE_SCAN error (%d)\n", err);
802 goto scan_out; 803 goto scan_out;
803 } 804 }
804 brcmf_set_mpc(ndev, 0); 805 brcmf_set_mpc(ndev, 0);
@@ -806,10 +807,10 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
806 &sr->ssid_le, sizeof(sr->ssid_le)); 807 &sr->ssid_le, sizeof(sr->ssid_le));
807 if (err) { 808 if (err) {
808 if (err == -EBUSY) 809 if (err == -EBUSY)
809 WL_INFO("BUSY: scan for \"%s\" canceled\n", 810 brcmf_dbg(INFO, "BUSY: scan for \"%s\" canceled\n",
810 sr->ssid_le.SSID); 811 sr->ssid_le.SSID);
811 else 812 else
812 WL_ERR("WLC_SCAN error (%d)\n", err); 813 brcmf_err("WLC_SCAN error (%d)\n", err);
813 814
814 brcmf_set_mpc(ndev, 1); 815 brcmf_set_mpc(ndev, 1);
815 goto scan_out; 816 goto scan_out;
@@ -832,7 +833,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
832 struct net_device *ndev = request->wdev->netdev; 833 struct net_device *ndev = request->wdev->netdev;
833 s32 err = 0; 834 s32 err = 0;
834 835
835 WL_TRACE("Enter\n"); 836 brcmf_dbg(TRACE, "Enter\n");
836 837
837 if (!check_vif_up(container_of(request->wdev, 838 if (!check_vif_up(container_of(request->wdev,
838 struct brcmf_cfg80211_vif, wdev))) 839 struct brcmf_cfg80211_vif, wdev)))
@@ -841,9 +842,9 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
841 err = brcmf_cfg80211_escan(wiphy, ndev, request, NULL); 842 err = brcmf_cfg80211_escan(wiphy, ndev, request, NULL);
842 843
843 if (err) 844 if (err)
844 WL_ERR("scan error (%d)\n", err); 845 brcmf_err("scan error (%d)\n", err);
845 846
846 WL_TRACE("Exit\n"); 847 brcmf_dbg(TRACE, "Exit\n");
847 return err; 848 return err;
848} 849}
849 850
@@ -854,7 +855,7 @@ static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
854 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh", 855 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh",
855 rts_threshold); 856 rts_threshold);
856 if (err) 857 if (err)
857 WL_ERR("Error (%d)\n", err); 858 brcmf_err("Error (%d)\n", err);
858 859
859 return err; 860 return err;
860} 861}
@@ -866,7 +867,7 @@ static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
866 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh", 867 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh",
867 frag_threshold); 868 frag_threshold);
868 if (err) 869 if (err)
869 WL_ERR("Error (%d)\n", err); 870 brcmf_err("Error (%d)\n", err);
870 871
871 return err; 872 return err;
872} 873}
@@ -878,7 +879,7 @@ static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
878 879
879 err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry); 880 err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry);
880 if (err) { 881 if (err) {
881 WL_ERR("cmd (%d) , error (%d)\n", cmd, err); 882 brcmf_err("cmd (%d) , error (%d)\n", cmd, err);
882 return err; 883 return err;
883 } 884 }
884 return err; 885 return err;
@@ -891,7 +892,7 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
891 struct brcmf_if *ifp = netdev_priv(ndev); 892 struct brcmf_if *ifp = netdev_priv(ndev);
892 s32 err = 0; 893 s32 err = 0;
893 894
894 WL_TRACE("Enter\n"); 895 brcmf_dbg(TRACE, "Enter\n");
895 if (!check_vif_up(ifp->vif)) 896 if (!check_vif_up(ifp->vif))
896 return -EIO; 897 return -EIO;
897 898
@@ -925,7 +926,7 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
925 } 926 }
926 927
927done: 928done:
928 WL_TRACE("Exit\n"); 929 brcmf_dbg(TRACE, "Exit\n");
929 return err; 930 return err;
930} 931}
931 932
@@ -955,9 +956,7 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params,
955 join_params->params_le.chanspec_list[0] = cpu_to_le16(chanspec); 956 join_params->params_le.chanspec_list[0] = cpu_to_le16(chanspec);
956 join_params->params_le.chanspec_num = cpu_to_le32(1); 957 join_params->params_le.chanspec_num = cpu_to_le32(1);
957 958
958 WL_CONN("join_params->params.chanspec_list[0]= %#X," 959 brcmf_dbg(CONN, "channel %d, chanspec %#X\n", ch, chanspec);
959 "channel %d, chanspec %#X\n",
960 chanspec, ch, chanspec);
961 } 960 }
962} 961}
963 962
@@ -965,18 +964,18 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif)
965{ 964{
966 s32 err = 0; 965 s32 err = 0;
967 966
968 WL_TRACE("Enter\n"); 967 brcmf_dbg(TRACE, "Enter\n");
969 968
970 if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) { 969 if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) {
971 WL_INFO("Call WLC_DISASSOC to stop excess roaming\n "); 970 brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n ");
972 err = brcmf_fil_cmd_data_set(vif->ifp, 971 err = brcmf_fil_cmd_data_set(vif->ifp,
973 BRCMF_C_DISASSOC, NULL, 0); 972 BRCMF_C_DISASSOC, NULL, 0);
974 if (err) 973 if (err)
975 WL_ERR("WLC_DISASSOC failed (%d)\n", err); 974 brcmf_err("WLC_DISASSOC failed (%d)\n", err);
976 clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); 975 clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state);
977 } 976 }
978 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); 977 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state);
979 WL_TRACE("Exit\n"); 978 brcmf_dbg(TRACE, "Exit\n");
980} 979}
981 980
982static s32 981static s32
@@ -992,53 +991,55 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
992 s32 wsec = 0; 991 s32 wsec = 0;
993 s32 bcnprd; 992 s32 bcnprd;
994 993
995 WL_TRACE("Enter\n"); 994 brcmf_dbg(TRACE, "Enter\n");
996 if (!check_vif_up(ifp->vif)) 995 if (!check_vif_up(ifp->vif))
997 return -EIO; 996 return -EIO;
998 997
999 if (params->ssid) 998 if (params->ssid)
1000 WL_CONN("SSID: %s\n", params->ssid); 999 brcmf_dbg(CONN, "SSID: %s\n", params->ssid);
1001 else { 1000 else {
1002 WL_CONN("SSID: NULL, Not supported\n"); 1001 brcmf_dbg(CONN, "SSID: NULL, Not supported\n");
1003 return -EOPNOTSUPP; 1002 return -EOPNOTSUPP;
1004 } 1003 }
1005 1004
1006 set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); 1005 set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state);
1007 1006
1008 if (params->bssid) 1007 if (params->bssid)
1009 WL_CONN("BSSID: %pM\n", params->bssid); 1008 brcmf_dbg(CONN, "BSSID: %pM\n", params->bssid);
1010 else 1009 else
1011 WL_CONN("No BSSID specified\n"); 1010 brcmf_dbg(CONN, "No BSSID specified\n");
1012 1011
1013 if (params->chandef.chan) 1012 if (params->chandef.chan)
1014 WL_CONN("channel: %d\n", params->chandef.chan->center_freq); 1013 brcmf_dbg(CONN, "channel: %d\n",
1014 params->chandef.chan->center_freq);
1015 else 1015 else
1016 WL_CONN("no channel specified\n"); 1016 brcmf_dbg(CONN, "no channel specified\n");
1017 1017
1018 if (params->channel_fixed) 1018 if (params->channel_fixed)
1019 WL_CONN("fixed channel required\n"); 1019 brcmf_dbg(CONN, "fixed channel required\n");
1020 else 1020 else
1021 WL_CONN("no fixed channel required\n"); 1021 brcmf_dbg(CONN, "no fixed channel required\n");
1022 1022
1023 if (params->ie && params->ie_len) 1023 if (params->ie && params->ie_len)
1024 WL_CONN("ie len: %d\n", params->ie_len); 1024 brcmf_dbg(CONN, "ie len: %d\n", params->ie_len);
1025 else 1025 else
1026 WL_CONN("no ie specified\n"); 1026 brcmf_dbg(CONN, "no ie specified\n");
1027 1027
1028 if (params->beacon_interval) 1028 if (params->beacon_interval)
1029 WL_CONN("beacon interval: %d\n", params->beacon_interval); 1029 brcmf_dbg(CONN, "beacon interval: %d\n",
1030 params->beacon_interval);
1030 else 1031 else
1031 WL_CONN("no beacon interval specified\n"); 1032 brcmf_dbg(CONN, "no beacon interval specified\n");
1032 1033
1033 if (params->basic_rates) 1034 if (params->basic_rates)
1034 WL_CONN("basic rates: %08X\n", params->basic_rates); 1035 brcmf_dbg(CONN, "basic rates: %08X\n", params->basic_rates);
1035 else 1036 else
1036 WL_CONN("no basic rates specified\n"); 1037 brcmf_dbg(CONN, "no basic rates specified\n");
1037 1038
1038 if (params->privacy) 1039 if (params->privacy)
1039 WL_CONN("privacy required\n"); 1040 brcmf_dbg(CONN, "privacy required\n");
1040 else 1041 else
1041 WL_CONN("no privacy required\n"); 1042 brcmf_dbg(CONN, "no privacy required\n");
1042 1043
1043 /* Configure Privacy for starter */ 1044 /* Configure Privacy for starter */
1044 if (params->privacy) 1045 if (params->privacy)
@@ -1046,7 +1047,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1046 1047
1047 err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec); 1048 err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
1048 if (err) { 1049 if (err) {
1049 WL_ERR("wsec failed (%d)\n", err); 1050 brcmf_err("wsec failed (%d)\n", err);
1050 goto done; 1051 goto done;
1051 } 1052 }
1052 1053
@@ -1058,7 +1059,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1058 1059
1059 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd); 1060 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
1060 if (err) { 1061 if (err) {
1061 WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err); 1062 brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err);
1062 goto done; 1063 goto done;
1063 } 1064 }
1064 1065
@@ -1101,7 +1102,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1101 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL, 1102 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
1102 target_channel); 1103 target_channel);
1103 if (err) { 1104 if (err) {
1104 WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err); 1105 brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err);
1105 goto done; 1106 goto done;
1106 } 1107 }
1107 } else 1108 } else
@@ -1113,14 +1114,14 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1113 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, 1114 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1114 &join_params, join_params_size); 1115 &join_params, join_params_size);
1115 if (err) { 1116 if (err) {
1116 WL_ERR("WLC_SET_SSID failed (%d)\n", err); 1117 brcmf_err("WLC_SET_SSID failed (%d)\n", err);
1117 goto done; 1118 goto done;
1118 } 1119 }
1119 1120
1120done: 1121done:
1121 if (err) 1122 if (err)
1122 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); 1123 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state);
1123 WL_TRACE("Exit\n"); 1124 brcmf_dbg(TRACE, "Exit\n");
1124 return err; 1125 return err;
1125} 1126}
1126 1127
@@ -1130,13 +1131,13 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
1130 struct brcmf_if *ifp = netdev_priv(ndev); 1131 struct brcmf_if *ifp = netdev_priv(ndev);
1131 s32 err = 0; 1132 s32 err = 0;
1132 1133
1133 WL_TRACE("Enter\n"); 1134 brcmf_dbg(TRACE, "Enter\n");
1134 if (!check_vif_up(ifp->vif)) 1135 if (!check_vif_up(ifp->vif))
1135 return -EIO; 1136 return -EIO;
1136 1137
1137 brcmf_link_down(ifp->vif); 1138 brcmf_link_down(ifp->vif);
1138 1139
1139 WL_TRACE("Exit\n"); 1140 brcmf_dbg(TRACE, "Exit\n");
1140 1141
1141 return err; 1142 return err;
1142} 1143}
@@ -1155,10 +1156,10 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
1155 val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED; 1156 val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED;
1156 else 1157 else
1157 val = WPA_AUTH_DISABLED; 1158 val = WPA_AUTH_DISABLED;
1158 WL_CONN("setting wpa_auth to 0x%0x\n", val); 1159 brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
1159 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "wpa_auth", val); 1160 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "wpa_auth", val);
1160 if (err) { 1161 if (err) {
1161 WL_ERR("set wpa_auth failed (%d)\n", err); 1162 brcmf_err("set wpa_auth failed (%d)\n", err);
1162 return err; 1163 return err;
1163 } 1164 }
1164 sec = &profile->sec; 1165 sec = &profile->sec;
@@ -1177,27 +1178,27 @@ static s32 brcmf_set_auth_type(struct net_device *ndev,
1177 switch (sme->auth_type) { 1178 switch (sme->auth_type) {
1178 case NL80211_AUTHTYPE_OPEN_SYSTEM: 1179 case NL80211_AUTHTYPE_OPEN_SYSTEM:
1179 val = 0; 1180 val = 0;
1180 WL_CONN("open system\n"); 1181 brcmf_dbg(CONN, "open system\n");
1181 break; 1182 break;
1182 case NL80211_AUTHTYPE_SHARED_KEY: 1183 case NL80211_AUTHTYPE_SHARED_KEY:
1183 val = 1; 1184 val = 1;
1184 WL_CONN("shared key\n"); 1185 brcmf_dbg(CONN, "shared key\n");
1185 break; 1186 break;
1186 case NL80211_AUTHTYPE_AUTOMATIC: 1187 case NL80211_AUTHTYPE_AUTOMATIC:
1187 val = 2; 1188 val = 2;
1188 WL_CONN("automatic\n"); 1189 brcmf_dbg(CONN, "automatic\n");
1189 break; 1190 break;
1190 case NL80211_AUTHTYPE_NETWORK_EAP: 1191 case NL80211_AUTHTYPE_NETWORK_EAP:
1191 WL_CONN("network eap\n"); 1192 brcmf_dbg(CONN, "network eap\n");
1192 default: 1193 default:
1193 val = 2; 1194 val = 2;
1194 WL_ERR("invalid auth type (%d)\n", sme->auth_type); 1195 brcmf_err("invalid auth type (%d)\n", sme->auth_type);
1195 break; 1196 break;
1196 } 1197 }
1197 1198
1198 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "auth", val); 1199 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "auth", val);
1199 if (err) { 1200 if (err) {
1200 WL_ERR("set auth failed (%d)\n", err); 1201 brcmf_err("set auth failed (%d)\n", err);
1201 return err; 1202 return err;
1202 } 1203 }
1203 sec = &profile->sec; 1204 sec = &profile->sec;
@@ -1231,8 +1232,8 @@ brcmf_set_set_cipher(struct net_device *ndev,
1231 pval = AES_ENABLED; 1232 pval = AES_ENABLED;
1232 break; 1233 break;
1233 default: 1234 default:
1234 WL_ERR("invalid cipher pairwise (%d)\n", 1235 brcmf_err("invalid cipher pairwise (%d)\n",
1235 sme->crypto.ciphers_pairwise[0]); 1236 sme->crypto.ciphers_pairwise[0]);
1236 return -EINVAL; 1237 return -EINVAL;
1237 } 1238 }
1238 } 1239 }
@@ -1252,16 +1253,16 @@ brcmf_set_set_cipher(struct net_device *ndev,
1252 gval = AES_ENABLED; 1253 gval = AES_ENABLED;
1253 break; 1254 break;
1254 default: 1255 default:
1255 WL_ERR("invalid cipher group (%d)\n", 1256 brcmf_err("invalid cipher group (%d)\n",
1256 sme->crypto.cipher_group); 1257 sme->crypto.cipher_group);
1257 return -EINVAL; 1258 return -EINVAL;
1258 } 1259 }
1259 } 1260 }
1260 1261
1261 WL_CONN("pval (%d) gval (%d)\n", pval, gval); 1262 brcmf_dbg(CONN, "pval (%d) gval (%d)\n", pval, gval);
1262 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "wsec", pval | gval); 1263 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "wsec", pval | gval);
1263 if (err) { 1264 if (err) {
1264 WL_ERR("error (%d)\n", err); 1265 brcmf_err("error (%d)\n", err);
1265 return err; 1266 return err;
1266 } 1267 }
1267 1268
@@ -1284,7 +1285,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1284 err = brcmf_fil_iovar_int_get(netdev_priv(ndev), 1285 err = brcmf_fil_iovar_int_get(netdev_priv(ndev),
1285 "wpa_auth", &val); 1286 "wpa_auth", &val);
1286 if (err) { 1287 if (err) {
1287 WL_ERR("could not get wpa_auth (%d)\n", err); 1288 brcmf_err("could not get wpa_auth (%d)\n", err);
1288 return err; 1289 return err;
1289 } 1290 }
1290 if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { 1291 if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
@@ -1296,8 +1297,8 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1296 val = WPA_AUTH_PSK; 1297 val = WPA_AUTH_PSK;
1297 break; 1298 break;
1298 default: 1299 default:
1299 WL_ERR("invalid cipher group (%d)\n", 1300 brcmf_err("invalid cipher group (%d)\n",
1300 sme->crypto.cipher_group); 1301 sme->crypto.cipher_group);
1301 return -EINVAL; 1302 return -EINVAL;
1302 } 1303 }
1303 } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { 1304 } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
@@ -1309,17 +1310,17 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1309 val = WPA2_AUTH_PSK; 1310 val = WPA2_AUTH_PSK;
1310 break; 1311 break;
1311 default: 1312 default:
1312 WL_ERR("invalid cipher group (%d)\n", 1313 brcmf_err("invalid cipher group (%d)\n",
1313 sme->crypto.cipher_group); 1314 sme->crypto.cipher_group);
1314 return -EINVAL; 1315 return -EINVAL;
1315 } 1316 }
1316 } 1317 }
1317 1318
1318 WL_CONN("setting wpa_auth to %d\n", val); 1319 brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
1319 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), 1320 err = brcmf_fil_iovar_int_set(netdev_priv(ndev),
1320 "wpa_auth", val); 1321 "wpa_auth", val);
1321 if (err) { 1322 if (err) {
1322 WL_ERR("could not set wpa_auth (%d)\n", err); 1323 brcmf_err("could not set wpa_auth (%d)\n", err);
1323 return err; 1324 return err;
1324 } 1325 }
1325 } 1326 }
@@ -1339,14 +1340,14 @@ brcmf_set_sharedkey(struct net_device *ndev,
1339 s32 val; 1340 s32 val;
1340 s32 err = 0; 1341 s32 err = 0;
1341 1342
1342 WL_CONN("key len (%d)\n", sme->key_len); 1343 brcmf_dbg(CONN, "key len (%d)\n", sme->key_len);
1343 1344
1344 if (sme->key_len == 0) 1345 if (sme->key_len == 0)
1345 return 0; 1346 return 0;
1346 1347
1347 sec = &profile->sec; 1348 sec = &profile->sec;
1348 WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n", 1349 brcmf_dbg(CONN, "wpa_versions 0x%x cipher_pairwise 0x%x\n",
1349 sec->wpa_versions, sec->cipher_pairwise); 1350 sec->wpa_versions, sec->cipher_pairwise);
1350 1351
1351 if (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) 1352 if (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2))
1352 return 0; 1353 return 0;
@@ -1359,7 +1360,7 @@ brcmf_set_sharedkey(struct net_device *ndev,
1359 key.len = (u32) sme->key_len; 1360 key.len = (u32) sme->key_len;
1360 key.index = (u32) sme->key_idx; 1361 key.index = (u32) sme->key_idx;
1361 if (key.len > sizeof(key.data)) { 1362 if (key.len > sizeof(key.data)) {
1362 WL_ERR("Too long key length (%u)\n", key.len); 1363 brcmf_err("Too long key length (%u)\n", key.len);
1363 return -EINVAL; 1364 return -EINVAL;
1364 } 1365 }
1365 memcpy(key.data, sme->key, key.len); 1366 memcpy(key.data, sme->key, key.len);
@@ -1372,24 +1373,24 @@ brcmf_set_sharedkey(struct net_device *ndev,
1372 key.algo = CRYPTO_ALGO_WEP128; 1373 key.algo = CRYPTO_ALGO_WEP128;
1373 break; 1374 break;
1374 default: 1375 default:
1375 WL_ERR("Invalid algorithm (%d)\n", 1376 brcmf_err("Invalid algorithm (%d)\n",
1376 sme->crypto.ciphers_pairwise[0]); 1377 sme->crypto.ciphers_pairwise[0]);
1377 return -EINVAL; 1378 return -EINVAL;
1378 } 1379 }
1379 /* Set the new key/index */ 1380 /* Set the new key/index */
1380 WL_CONN("key length (%d) key index (%d) algo (%d)\n", 1381 brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n",
1381 key.len, key.index, key.algo); 1382 key.len, key.index, key.algo);
1382 WL_CONN("key \"%s\"\n", key.data); 1383 brcmf_dbg(CONN, "key \"%s\"\n", key.data);
1383 err = send_key_to_dongle(ndev, &key); 1384 err = send_key_to_dongle(ndev, &key);
1384 if (err) 1385 if (err)
1385 return err; 1386 return err;
1386 1387
1387 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) { 1388 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
1388 WL_CONN("set auth_type to shared key\n"); 1389 brcmf_dbg(CONN, "set auth_type to shared key\n");
1389 val = WL_AUTH_SHARED_KEY; /* shared key */ 1390 val = WL_AUTH_SHARED_KEY; /* shared key */
1390 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); 1391 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
1391 if (err) 1392 if (err)
1392 WL_ERR("set auth failed (%d)\n", err); 1393 brcmf_err("set auth failed (%d)\n", err);
1393 } 1394 }
1394 return err; 1395 return err;
1395} 1396}
@@ -1408,12 +1409,12 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1408 1409
1409 s32 err = 0; 1410 s32 err = 0;
1410 1411
1411 WL_TRACE("Enter\n"); 1412 brcmf_dbg(TRACE, "Enter\n");
1412 if (!check_vif_up(ifp->vif)) 1413 if (!check_vif_up(ifp->vif))
1413 return -EIO; 1414 return -EIO;
1414 1415
1415 if (!sme->ssid) { 1416 if (!sme->ssid) {
1416 WL_ERR("Invalid ssid\n"); 1417 brcmf_err("Invalid ssid\n");
1417 return -EOPNOTSUPP; 1418 return -EOPNOTSUPP;
1418 } 1419 }
1419 1420
@@ -1422,40 +1423,40 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1422 if (chan) { 1423 if (chan) {
1423 cfg->channel = 1424 cfg->channel =
1424 ieee80211_frequency_to_channel(chan->center_freq); 1425 ieee80211_frequency_to_channel(chan->center_freq);
1425 WL_CONN("channel (%d), center_req (%d)\n", 1426 brcmf_dbg(CONN, "channel (%d), center_req (%d)\n",
1426 cfg->channel, chan->center_freq); 1427 cfg->channel, chan->center_freq);
1427 } else 1428 } else
1428 cfg->channel = 0; 1429 cfg->channel = 0;
1429 1430
1430 WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); 1431 brcmf_dbg(INFO, "ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len);
1431 1432
1432 err = brcmf_set_wpa_version(ndev, sme); 1433 err = brcmf_set_wpa_version(ndev, sme);
1433 if (err) { 1434 if (err) {
1434 WL_ERR("wl_set_wpa_version failed (%d)\n", err); 1435 brcmf_err("wl_set_wpa_version failed (%d)\n", err);
1435 goto done; 1436 goto done;
1436 } 1437 }
1437 1438
1438 err = brcmf_set_auth_type(ndev, sme); 1439 err = brcmf_set_auth_type(ndev, sme);
1439 if (err) { 1440 if (err) {
1440 WL_ERR("wl_set_auth_type failed (%d)\n", err); 1441 brcmf_err("wl_set_auth_type failed (%d)\n", err);
1441 goto done; 1442 goto done;
1442 } 1443 }
1443 1444
1444 err = brcmf_set_set_cipher(ndev, sme); 1445 err = brcmf_set_set_cipher(ndev, sme);
1445 if (err) { 1446 if (err) {
1446 WL_ERR("wl_set_set_cipher failed (%d)\n", err); 1447 brcmf_err("wl_set_set_cipher failed (%d)\n", err);
1447 goto done; 1448 goto done;
1448 } 1449 }
1449 1450
1450 err = brcmf_set_key_mgmt(ndev, sme); 1451 err = brcmf_set_key_mgmt(ndev, sme);
1451 if (err) { 1452 if (err) {
1452 WL_ERR("wl_set_key_mgmt failed (%d)\n", err); 1453 brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
1453 goto done; 1454 goto done;
1454 } 1455 }
1455 1456
1456 err = brcmf_set_sharedkey(ndev, sme); 1457 err = brcmf_set_sharedkey(ndev, sme);
1457 if (err) { 1458 if (err) {
1458 WL_ERR("brcmf_set_sharedkey failed (%d)\n", err); 1459 brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
1459 goto done; 1460 goto done;
1460 } 1461 }
1461 1462
@@ -1471,20 +1472,20 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1471 memset(join_params.params_le.bssid, 0xFF, ETH_ALEN); 1472 memset(join_params.params_le.bssid, 0xFF, ETH_ALEN);
1472 1473
1473 if (ssid.SSID_len < IEEE80211_MAX_SSID_LEN) 1474 if (ssid.SSID_len < IEEE80211_MAX_SSID_LEN)
1474 WL_CONN("ssid \"%s\", len (%d)\n", 1475 brcmf_dbg(CONN, "ssid \"%s\", len (%d)\n",
1475 ssid.SSID, ssid.SSID_len); 1476 ssid.SSID, ssid.SSID_len);
1476 1477
1477 brcmf_ch_to_chanspec(cfg->channel, 1478 brcmf_ch_to_chanspec(cfg->channel,
1478 &join_params, &join_params_size); 1479 &join_params, &join_params_size);
1479 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, 1480 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1480 &join_params, join_params_size); 1481 &join_params, join_params_size);
1481 if (err) 1482 if (err)
1482 WL_ERR("WLC_SET_SSID failed (%d)\n", err); 1483 brcmf_err("WLC_SET_SSID failed (%d)\n", err);
1483 1484
1484done: 1485done:
1485 if (err) 1486 if (err)
1486 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); 1487 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state);
1487 WL_TRACE("Exit\n"); 1488 brcmf_dbg(TRACE, "Exit\n");
1488 return err; 1489 return err;
1489} 1490}
1490 1491
@@ -1497,7 +1498,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
1497 struct brcmf_scb_val_le scbval; 1498 struct brcmf_scb_val_le scbval;
1498 s32 err = 0; 1499 s32 err = 0;
1499 1500
1500 WL_TRACE("Enter. Reason code = %d\n", reason_code); 1501 brcmf_dbg(TRACE, "Enter. Reason code = %d\n", reason_code);
1501 if (!check_vif_up(ifp->vif)) 1502 if (!check_vif_up(ifp->vif))
1502 return -EIO; 1503 return -EIO;
1503 1504
@@ -1508,9 +1509,9 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
1508 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC, 1509 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
1509 &scbval, sizeof(scbval)); 1510 &scbval, sizeof(scbval));
1510 if (err) 1511 if (err)
1511 WL_ERR("error (%d)\n", err); 1512 brcmf_err("error (%d)\n", err);
1512 1513
1513 WL_TRACE("Exit\n"); 1514 brcmf_dbg(TRACE, "Exit\n");
1514 return err; 1515 return err;
1515} 1516}
1516 1517
@@ -1527,7 +1528,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
1527 s32 disable = 0; 1528 s32 disable = 0;
1528 s32 dbm = MBM_TO_DBM(mbm); 1529 s32 dbm = MBM_TO_DBM(mbm);
1529 1530
1530 WL_TRACE("Enter\n"); 1531 brcmf_dbg(TRACE, "Enter\n");
1531 if (!check_vif_up(ifp->vif)) 1532 if (!check_vif_up(ifp->vif))
1532 return -EIO; 1533 return -EIO;
1533 1534
@@ -1537,7 +1538,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
1537 case NL80211_TX_POWER_LIMITED: 1538 case NL80211_TX_POWER_LIMITED:
1538 case NL80211_TX_POWER_FIXED: 1539 case NL80211_TX_POWER_FIXED:
1539 if (dbm < 0) { 1540 if (dbm < 0) {
1540 WL_ERR("TX_POWER_FIXED - dbm is negative\n"); 1541 brcmf_err("TX_POWER_FIXED - dbm is negative\n");
1541 err = -EINVAL; 1542 err = -EINVAL;
1542 goto done; 1543 goto done;
1543 } 1544 }
@@ -1547,7 +1548,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
1547 disable = WL_RADIO_SW_DISABLE << 16; 1548 disable = WL_RADIO_SW_DISABLE << 16;
1548 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable); 1549 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
1549 if (err) 1550 if (err)
1550 WL_ERR("WLC_SET_RADIO error (%d)\n", err); 1551 brcmf_err("WLC_SET_RADIO error (%d)\n", err);
1551 1552
1552 if (dbm > 0xffff) 1553 if (dbm > 0xffff)
1553 txpwrmw = 0xffff; 1554 txpwrmw = 0xffff;
@@ -1556,11 +1557,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
1556 err = brcmf_fil_iovar_int_set(ifp, "qtxpower", 1557 err = brcmf_fil_iovar_int_set(ifp, "qtxpower",
1557 (s32)brcmf_mw_to_qdbm(txpwrmw)); 1558 (s32)brcmf_mw_to_qdbm(txpwrmw));
1558 if (err) 1559 if (err)
1559 WL_ERR("qtxpower error (%d)\n", err); 1560 brcmf_err("qtxpower error (%d)\n", err);
1560 cfg->conf->tx_power = dbm; 1561 cfg->conf->tx_power = dbm;
1561 1562
1562done: 1563done:
1563 WL_TRACE("Exit\n"); 1564 brcmf_dbg(TRACE, "Exit\n");
1564 return err; 1565 return err;
1565} 1566}
1566 1567
@@ -1574,13 +1575,13 @@ static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy,
1574 u8 result; 1575 u8 result;
1575 s32 err = 0; 1576 s32 err = 0;
1576 1577
1577 WL_TRACE("Enter\n"); 1578 brcmf_dbg(TRACE, "Enter\n");
1578 if (!check_vif_up(ifp->vif)) 1579 if (!check_vif_up(ifp->vif))
1579 return -EIO; 1580 return -EIO;
1580 1581
1581 err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &txpwrdbm); 1582 err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &txpwrdbm);
1582 if (err) { 1583 if (err) {
1583 WL_ERR("error (%d)\n", err); 1584 brcmf_err("error (%d)\n", err);
1584 goto done; 1585 goto done;
1585 } 1586 }
1586 1587
@@ -1588,7 +1589,7 @@ static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy,
1588 *dbm = (s32) brcmf_qdbm_to_mw(result); 1589 *dbm = (s32) brcmf_qdbm_to_mw(result);
1589 1590
1590done: 1591done:
1591 WL_TRACE("Exit\n"); 1592 brcmf_dbg(TRACE, "Exit\n");
1592 return err; 1593 return err;
1593} 1594}
1594 1595
@@ -1601,14 +1602,14 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
1601 u32 wsec; 1602 u32 wsec;
1602 s32 err = 0; 1603 s32 err = 0;
1603 1604
1604 WL_TRACE("Enter\n"); 1605 brcmf_dbg(TRACE, "Enter\n");
1605 WL_CONN("key index (%d)\n", key_idx); 1606 brcmf_dbg(CONN, "key index (%d)\n", key_idx);
1606 if (!check_vif_up(ifp->vif)) 1607 if (!check_vif_up(ifp->vif))
1607 return -EIO; 1608 return -EIO;
1608 1609
1609 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); 1610 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
1610 if (err) { 1611 if (err) {
1611 WL_ERR("WLC_GET_WSEC error (%d)\n", err); 1612 brcmf_err("WLC_GET_WSEC error (%d)\n", err);
1612 goto done; 1613 goto done;
1613 } 1614 }
1614 1615
@@ -1618,10 +1619,10 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
1618 err = brcmf_fil_cmd_int_set(ifp, 1619 err = brcmf_fil_cmd_int_set(ifp,
1619 BRCMF_C_SET_KEY_PRIMARY, index); 1620 BRCMF_C_SET_KEY_PRIMARY, index);
1620 if (err) 1621 if (err)
1621 WL_ERR("error (%d)\n", err); 1622 brcmf_err("error (%d)\n", err);
1622 } 1623 }
1623done: 1624done:
1624 WL_TRACE("Exit\n"); 1625 brcmf_dbg(TRACE, "Exit\n");
1625 return err; 1626 return err;
1626} 1627}
1627 1628
@@ -1644,14 +1645,14 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
1644 /* key delete */ 1645 /* key delete */
1645 err = send_key_to_dongle(ndev, &key); 1646 err = send_key_to_dongle(ndev, &key);
1646 if (err) 1647 if (err)
1647 WL_ERR("key delete error (%d)\n", err); 1648 brcmf_err("key delete error (%d)\n", err);
1648 } else { 1649 } else {
1649 if (key.len > sizeof(key.data)) { 1650 if (key.len > sizeof(key.data)) {
1650 WL_ERR("Invalid key length (%d)\n", key.len); 1651 brcmf_err("Invalid key length (%d)\n", key.len);
1651 return -EINVAL; 1652 return -EINVAL;
1652 } 1653 }
1653 1654
1654 WL_CONN("Setting the key index %d\n", key.index); 1655 brcmf_dbg(CONN, "Setting the key index %d\n", key.index);
1655 memcpy(key.data, params->key, key.len); 1656 memcpy(key.data, params->key, key.len);
1656 1657
1657 if (params->cipher == WLAN_CIPHER_SUITE_TKIP) { 1658 if (params->cipher == WLAN_CIPHER_SUITE_TKIP) {
@@ -1675,31 +1676,31 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
1675 switch (params->cipher) { 1676 switch (params->cipher) {
1676 case WLAN_CIPHER_SUITE_WEP40: 1677 case WLAN_CIPHER_SUITE_WEP40:
1677 key.algo = CRYPTO_ALGO_WEP1; 1678 key.algo = CRYPTO_ALGO_WEP1;
1678 WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); 1679 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n");
1679 break; 1680 break;
1680 case WLAN_CIPHER_SUITE_WEP104: 1681 case WLAN_CIPHER_SUITE_WEP104:
1681 key.algo = CRYPTO_ALGO_WEP128; 1682 key.algo = CRYPTO_ALGO_WEP128;
1682 WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); 1683 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n");
1683 break; 1684 break;
1684 case WLAN_CIPHER_SUITE_TKIP: 1685 case WLAN_CIPHER_SUITE_TKIP:
1685 key.algo = CRYPTO_ALGO_TKIP; 1686 key.algo = CRYPTO_ALGO_TKIP;
1686 WL_CONN("WLAN_CIPHER_SUITE_TKIP\n"); 1687 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n");
1687 break; 1688 break;
1688 case WLAN_CIPHER_SUITE_AES_CMAC: 1689 case WLAN_CIPHER_SUITE_AES_CMAC:
1689 key.algo = CRYPTO_ALGO_AES_CCM; 1690 key.algo = CRYPTO_ALGO_AES_CCM;
1690 WL_CONN("WLAN_CIPHER_SUITE_AES_CMAC\n"); 1691 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
1691 break; 1692 break;
1692 case WLAN_CIPHER_SUITE_CCMP: 1693 case WLAN_CIPHER_SUITE_CCMP:
1693 key.algo = CRYPTO_ALGO_AES_CCM; 1694 key.algo = CRYPTO_ALGO_AES_CCM;
1694 WL_CONN("WLAN_CIPHER_SUITE_CCMP\n"); 1695 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
1695 break; 1696 break;
1696 default: 1697 default:
1697 WL_ERR("Invalid cipher (0x%x)\n", params->cipher); 1698 brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
1698 return -EINVAL; 1699 return -EINVAL;
1699 } 1700 }
1700 err = send_key_to_dongle(ndev, &key); 1701 err = send_key_to_dongle(ndev, &key);
1701 if (err) 1702 if (err)
1702 WL_ERR("wsec_key error (%d)\n", err); 1703 brcmf_err("wsec_key error (%d)\n", err);
1703 } 1704 }
1704 return err; 1705 return err;
1705} 1706}
@@ -1716,13 +1717,13 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
1716 s32 err = 0; 1717 s32 err = 0;
1717 u8 keybuf[8]; 1718 u8 keybuf[8];
1718 1719
1719 WL_TRACE("Enter\n"); 1720 brcmf_dbg(TRACE, "Enter\n");
1720 WL_CONN("key index (%d)\n", key_idx); 1721 brcmf_dbg(CONN, "key index (%d)\n", key_idx);
1721 if (!check_vif_up(ifp->vif)) 1722 if (!check_vif_up(ifp->vif))
1722 return -EIO; 1723 return -EIO;
1723 1724
1724 if (mac_addr) { 1725 if (mac_addr) {
1725 WL_TRACE("Exit"); 1726 brcmf_dbg(TRACE, "Exit");
1726 return brcmf_add_keyext(wiphy, ndev, key_idx, mac_addr, params); 1727 return brcmf_add_keyext(wiphy, ndev, key_idx, mac_addr, params);
1727 } 1728 }
1728 memset(&key, 0, sizeof(key)); 1729 memset(&key, 0, sizeof(key));
@@ -1731,7 +1732,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
1731 key.index = (u32) key_idx; 1732 key.index = (u32) key_idx;
1732 1733
1733 if (key.len > sizeof(key.data)) { 1734 if (key.len > sizeof(key.data)) {
1734 WL_ERR("Too long key length (%u)\n", key.len); 1735 brcmf_err("Too long key length (%u)\n", key.len);
1735 err = -EINVAL; 1736 err = -EINVAL;
1736 goto done; 1737 goto done;
1737 } 1738 }
@@ -1742,36 +1743,36 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
1742 case WLAN_CIPHER_SUITE_WEP40: 1743 case WLAN_CIPHER_SUITE_WEP40:
1743 key.algo = CRYPTO_ALGO_WEP1; 1744 key.algo = CRYPTO_ALGO_WEP1;
1744 val = WEP_ENABLED; 1745 val = WEP_ENABLED;
1745 WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); 1746 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n");
1746 break; 1747 break;
1747 case WLAN_CIPHER_SUITE_WEP104: 1748 case WLAN_CIPHER_SUITE_WEP104:
1748 key.algo = CRYPTO_ALGO_WEP128; 1749 key.algo = CRYPTO_ALGO_WEP128;
1749 val = WEP_ENABLED; 1750 val = WEP_ENABLED;
1750 WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); 1751 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n");
1751 break; 1752 break;
1752 case WLAN_CIPHER_SUITE_TKIP: 1753 case WLAN_CIPHER_SUITE_TKIP:
1753 if (ifp->vif->mode != WL_MODE_AP) { 1754 if (ifp->vif->mode != WL_MODE_AP) {
1754 WL_CONN("Swapping key\n"); 1755 brcmf_dbg(CONN, "Swapping key\n");
1755 memcpy(keybuf, &key.data[24], sizeof(keybuf)); 1756 memcpy(keybuf, &key.data[24], sizeof(keybuf));
1756 memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); 1757 memcpy(&key.data[24], &key.data[16], sizeof(keybuf));
1757 memcpy(&key.data[16], keybuf, sizeof(keybuf)); 1758 memcpy(&key.data[16], keybuf, sizeof(keybuf));
1758 } 1759 }
1759 key.algo = CRYPTO_ALGO_TKIP; 1760 key.algo = CRYPTO_ALGO_TKIP;
1760 val = TKIP_ENABLED; 1761 val = TKIP_ENABLED;
1761 WL_CONN("WLAN_CIPHER_SUITE_TKIP\n"); 1762 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n");
1762 break; 1763 break;
1763 case WLAN_CIPHER_SUITE_AES_CMAC: 1764 case WLAN_CIPHER_SUITE_AES_CMAC:
1764 key.algo = CRYPTO_ALGO_AES_CCM; 1765 key.algo = CRYPTO_ALGO_AES_CCM;
1765 val = AES_ENABLED; 1766 val = AES_ENABLED;
1766 WL_CONN("WLAN_CIPHER_SUITE_AES_CMAC\n"); 1767 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
1767 break; 1768 break;
1768 case WLAN_CIPHER_SUITE_CCMP: 1769 case WLAN_CIPHER_SUITE_CCMP:
1769 key.algo = CRYPTO_ALGO_AES_CCM; 1770 key.algo = CRYPTO_ALGO_AES_CCM;
1770 val = AES_ENABLED; 1771 val = AES_ENABLED;
1771 WL_CONN("WLAN_CIPHER_SUITE_CCMP\n"); 1772 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
1772 break; 1773 break;
1773 default: 1774 default:
1774 WL_ERR("Invalid cipher (0x%x)\n", params->cipher); 1775 brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
1775 err = -EINVAL; 1776 err = -EINVAL;
1776 goto done; 1777 goto done;
1777 } 1778 }
@@ -1782,18 +1783,18 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
1782 1783
1783 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); 1784 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
1784 if (err) { 1785 if (err) {
1785 WL_ERR("get wsec error (%d)\n", err); 1786 brcmf_err("get wsec error (%d)\n", err);
1786 goto done; 1787 goto done;
1787 } 1788 }
1788 wsec |= val; 1789 wsec |= val;
1789 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); 1790 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
1790 if (err) { 1791 if (err) {
1791 WL_ERR("set wsec error (%d)\n", err); 1792 brcmf_err("set wsec error (%d)\n", err);
1792 goto done; 1793 goto done;
1793 } 1794 }
1794 1795
1795done: 1796done:
1796 WL_TRACE("Exit\n"); 1797 brcmf_dbg(TRACE, "Exit\n");
1797 return err; 1798 return err;
1798} 1799}
1799 1800
@@ -1805,13 +1806,13 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
1805 struct brcmf_wsec_key key; 1806 struct brcmf_wsec_key key;
1806 s32 err = 0; 1807 s32 err = 0;
1807 1808
1808 WL_TRACE("Enter\n"); 1809 brcmf_dbg(TRACE, "Enter\n");
1809 if (!check_vif_up(ifp->vif)) 1810 if (!check_vif_up(ifp->vif))
1810 return -EIO; 1811 return -EIO;
1811 1812
1812 if (key_idx >= DOT11_MAX_DEFAULT_KEYS) { 1813 if (key_idx >= DOT11_MAX_DEFAULT_KEYS) {
1813 /* we ignore this key index in this case */ 1814 /* we ignore this key index in this case */
1814 WL_ERR("invalid key index (%d)\n", key_idx); 1815 brcmf_err("invalid key index (%d)\n", key_idx);
1815 return -EINVAL; 1816 return -EINVAL;
1816 } 1817 }
1817 1818
@@ -1821,12 +1822,12 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
1821 key.flags = BRCMF_PRIMARY_KEY; 1822 key.flags = BRCMF_PRIMARY_KEY;
1822 key.algo = CRYPTO_ALGO_OFF; 1823 key.algo = CRYPTO_ALGO_OFF;
1823 1824
1824 WL_CONN("key index (%d)\n", key_idx); 1825 brcmf_dbg(CONN, "key index (%d)\n", key_idx);
1825 1826
1826 /* Set the new key/index */ 1827 /* Set the new key/index */
1827 err = send_key_to_dongle(ndev, &key); 1828 err = send_key_to_dongle(ndev, &key);
1828 1829
1829 WL_TRACE("Exit\n"); 1830 brcmf_dbg(TRACE, "Exit\n");
1830 return err; 1831 return err;
1831} 1832}
1832 1833
@@ -1842,8 +1843,8 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
1842 s32 wsec; 1843 s32 wsec;
1843 s32 err = 0; 1844 s32 err = 0;
1844 1845
1845 WL_TRACE("Enter\n"); 1846 brcmf_dbg(TRACE, "Enter\n");
1846 WL_CONN("key index (%d)\n", key_idx); 1847 brcmf_dbg(CONN, "key index (%d)\n", key_idx);
1847 if (!check_vif_up(ifp->vif)) 1848 if (!check_vif_up(ifp->vif))
1848 return -EIO; 1849 return -EIO;
1849 1850
@@ -1851,7 +1852,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
1851 1852
1852 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); 1853 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
1853 if (err) { 1854 if (err) {
1854 WL_ERR("WLC_GET_WSEC error (%d)\n", err); 1855 brcmf_err("WLC_GET_WSEC error (%d)\n", err);
1855 /* Ignore this error, may happen during DISASSOC */ 1856 /* Ignore this error, may happen during DISASSOC */
1856 err = -EAGAIN; 1857 err = -EAGAIN;
1857 goto done; 1858 goto done;
@@ -1861,29 +1862,29 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
1861 sec = &profile->sec; 1862 sec = &profile->sec;
1862 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { 1863 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) {
1863 params.cipher = WLAN_CIPHER_SUITE_WEP40; 1864 params.cipher = WLAN_CIPHER_SUITE_WEP40;
1864 WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); 1865 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n");
1865 } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) { 1866 } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) {
1866 params.cipher = WLAN_CIPHER_SUITE_WEP104; 1867 params.cipher = WLAN_CIPHER_SUITE_WEP104;
1867 WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); 1868 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n");
1868 } 1869 }
1869 break; 1870 break;
1870 case TKIP_ENABLED: 1871 case TKIP_ENABLED:
1871 params.cipher = WLAN_CIPHER_SUITE_TKIP; 1872 params.cipher = WLAN_CIPHER_SUITE_TKIP;
1872 WL_CONN("WLAN_CIPHER_SUITE_TKIP\n"); 1873 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n");
1873 break; 1874 break;
1874 case AES_ENABLED: 1875 case AES_ENABLED:
1875 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; 1876 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
1876 WL_CONN("WLAN_CIPHER_SUITE_AES_CMAC\n"); 1877 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
1877 break; 1878 break;
1878 default: 1879 default:
1879 WL_ERR("Invalid algo (0x%x)\n", wsec); 1880 brcmf_err("Invalid algo (0x%x)\n", wsec);
1880 err = -EINVAL; 1881 err = -EINVAL;
1881 goto done; 1882 goto done;
1882 } 1883 }
1883 callback(cookie, &params); 1884 callback(cookie, &params);
1884 1885
1885done: 1886done:
1886 WL_TRACE("Exit\n"); 1887 brcmf_dbg(TRACE, "Exit\n");
1887 return err; 1888 return err;
1888} 1889}
1889 1890
@@ -1891,7 +1892,7 @@ static s32
1891brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, 1892brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
1892 struct net_device *ndev, u8 key_idx) 1893 struct net_device *ndev, u8 key_idx)
1893{ 1894{
1894 WL_INFO("Not supported\n"); 1895 brcmf_dbg(INFO, "Not supported\n");
1895 1896
1896 return -EOPNOTSUPP; 1897 return -EOPNOTSUPP;
1897} 1898}
@@ -1909,7 +1910,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
1909 u8 *bssid = profile->bssid; 1910 u8 *bssid = profile->bssid;
1910 struct brcmf_sta_info_le sta_info_le; 1911 struct brcmf_sta_info_le sta_info_le;
1911 1912
1912 WL_TRACE("Enter, MAC %pM\n", mac); 1913 brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
1913 if (!check_vif_up(ifp->vif)) 1914 if (!check_vif_up(ifp->vif))
1914 return -EIO; 1915 return -EIO;
1915 1916
@@ -1919,7 +1920,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
1919 &sta_info_le, 1920 &sta_info_le,
1920 sizeof(sta_info_le)); 1921 sizeof(sta_info_le));
1921 if (err < 0) { 1922 if (err < 0) {
1922 WL_ERR("GET STA INFO failed, %d\n", err); 1923 brcmf_err("GET STA INFO failed, %d\n", err);
1923 goto done; 1924 goto done;
1924 } 1925 }
1925 sinfo->filled = STATION_INFO_INACTIVE_TIME; 1926 sinfo->filled = STATION_INFO_INACTIVE_TIME;
@@ -1928,24 +1929,24 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
1928 sinfo->filled |= STATION_INFO_CONNECTED_TIME; 1929 sinfo->filled |= STATION_INFO_CONNECTED_TIME;
1929 sinfo->connected_time = le32_to_cpu(sta_info_le.in); 1930 sinfo->connected_time = le32_to_cpu(sta_info_le.in);
1930 } 1931 }
1931 WL_TRACE("STA idle time : %d ms, connected time :%d sec\n", 1932 brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n",
1932 sinfo->inactive_time, sinfo->connected_time); 1933 sinfo->inactive_time, sinfo->connected_time);
1933 } else if (ifp->vif->mode == WL_MODE_BSS) { 1934 } else if (ifp->vif->mode == WL_MODE_BSS) {
1934 if (memcmp(mac, bssid, ETH_ALEN)) { 1935 if (memcmp(mac, bssid, ETH_ALEN)) {
1935 WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n", 1936 brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
1936 mac, bssid); 1937 mac, bssid);
1937 err = -ENOENT; 1938 err = -ENOENT;
1938 goto done; 1939 goto done;
1939 } 1940 }
1940 /* Report the current tx rate */ 1941 /* Report the current tx rate */
1941 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate); 1942 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
1942 if (err) { 1943 if (err) {
1943 WL_ERR("Could not get rate (%d)\n", err); 1944 brcmf_err("Could not get rate (%d)\n", err);
1944 goto done; 1945 goto done;
1945 } else { 1946 } else {
1946 sinfo->filled |= STATION_INFO_TX_BITRATE; 1947 sinfo->filled |= STATION_INFO_TX_BITRATE;
1947 sinfo->txrate.legacy = rate * 5; 1948 sinfo->txrate.legacy = rate * 5;
1948 WL_CONN("Rate %d Mbps\n", rate / 2); 1949 brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2);
1949 } 1950 }
1950 1951
1951 if (test_bit(BRCMF_VIF_STATUS_CONNECTED, 1952 if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
@@ -1954,19 +1955,19 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
1954 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, 1955 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
1955 &scb_val, sizeof(scb_val)); 1956 &scb_val, sizeof(scb_val));
1956 if (err) { 1957 if (err) {
1957 WL_ERR("Could not get rssi (%d)\n", err); 1958 brcmf_err("Could not get rssi (%d)\n", err);
1958 goto done; 1959 goto done;
1959 } else { 1960 } else {
1960 rssi = le32_to_cpu(scb_val.val); 1961 rssi = le32_to_cpu(scb_val.val);
1961 sinfo->filled |= STATION_INFO_SIGNAL; 1962 sinfo->filled |= STATION_INFO_SIGNAL;
1962 sinfo->signal = rssi; 1963 sinfo->signal = rssi;
1963 WL_CONN("RSSI %d dBm\n", rssi); 1964 brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
1964 } 1965 }
1965 } 1966 }
1966 } else 1967 } else
1967 err = -EPERM; 1968 err = -EPERM;
1968done: 1969done:
1969 WL_TRACE("Exit\n"); 1970 brcmf_dbg(TRACE, "Exit\n");
1970 return err; 1971 return err;
1971} 1972}
1972 1973
@@ -1979,7 +1980,7 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
1979 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1980 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1980 struct brcmf_if *ifp = netdev_priv(ndev); 1981 struct brcmf_if *ifp = netdev_priv(ndev);
1981 1982
1982 WL_TRACE("Enter\n"); 1983 brcmf_dbg(TRACE, "Enter\n");
1983 1984
1984 /* 1985 /*
1985 * Powersave enable/disable request is coming from the 1986 * Powersave enable/disable request is coming from the
@@ -1991,22 +1992,22 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
1991 cfg->pwr_save = enabled; 1992 cfg->pwr_save = enabled;
1992 if (!check_vif_up(ifp->vif)) { 1993 if (!check_vif_up(ifp->vif)) {
1993 1994
1994 WL_INFO("Device is not ready, storing the value in cfg_info struct\n"); 1995 brcmf_dbg(INFO, "Device is not ready, storing the value in cfg_info struct\n");
1995 goto done; 1996 goto done;
1996 } 1997 }
1997 1998
1998 pm = enabled ? PM_FAST : PM_OFF; 1999 pm = enabled ? PM_FAST : PM_OFF;
1999 WL_INFO("power save %s\n", (pm ? "enabled" : "disabled")); 2000 brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled"));
2000 2001
2001 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); 2002 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
2002 if (err) { 2003 if (err) {
2003 if (err == -ENODEV) 2004 if (err == -ENODEV)
2004 WL_ERR("net_device is not ready yet\n"); 2005 brcmf_err("net_device is not ready yet\n");
2005 else 2006 else
2006 WL_ERR("error (%d)\n", err); 2007 brcmf_err("error (%d)\n", err);
2007 } 2008 }
2008done: 2009done:
2009 WL_TRACE("Exit\n"); 2010 brcmf_dbg(TRACE, "Exit\n");
2010 return err; 2011 return err;
2011} 2012}
2012 2013
@@ -2024,7 +2025,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev,
2024 u32 legacy; 2025 u32 legacy;
2025 s32 err = 0; 2026 s32 err = 0;
2026 2027
2027 WL_TRACE("Enter\n"); 2028 brcmf_dbg(TRACE, "Enter\n");
2028 if (!check_vif_up(ifp->vif)) 2029 if (!check_vif_up(ifp->vif))
2029 return -EIO; 2030 return -EIO;
2030 2031
@@ -2033,7 +2034,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev,
2033 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_CURR_RATESET, 2034 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_CURR_RATESET,
2034 &rateset_le, sizeof(rateset_le)); 2035 &rateset_le, sizeof(rateset_le));
2035 if (err) { 2036 if (err) {
2036 WL_ERR("could not get current rateset (%d)\n", err); 2037 brcmf_err("could not get current rateset (%d)\n", err);
2037 goto done; 2038 goto done;
2038 } 2039 }
2039 2040
@@ -2051,7 +2052,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev,
2051 /* Specified rate in bps */ 2052 /* Specified rate in bps */
2052 rate = val / 500000; 2053 rate = val / 500000;
2053 2054
2054 WL_CONN("rate %d mbps\n", rate / 2); 2055 brcmf_dbg(CONN, "rate %d mbps\n", rate / 2);
2055 2056
2056 /* 2057 /*
2057 * 2058 *
@@ -2061,12 +2062,13 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev,
2061 err_bg = brcmf_fil_iovar_int_set(ifp, "bg_rate", rate); 2062 err_bg = brcmf_fil_iovar_int_set(ifp, "bg_rate", rate);
2062 err_a = brcmf_fil_iovar_int_set(ifp, "a_rate", rate); 2063 err_a = brcmf_fil_iovar_int_set(ifp, "a_rate", rate);
2063 if (err_bg && err_a) { 2064 if (err_bg && err_a) {
2064 WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a); 2065 brcmf_err("could not set fixed rate (%d) (%d)\n", err_bg,
2066 err_a);
2065 err = err_bg | err_a; 2067 err = err_bg | err_a;
2066 } 2068 }
2067 2069
2068done: 2070done:
2069 WL_TRACE("Exit\n"); 2071 brcmf_dbg(TRACE, "Exit\n");
2070 return err; 2072 return err;
2071} 2073}
2072 2074
@@ -2087,7 +2089,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2087 s32 notify_signal; 2089 s32 notify_signal;
2088 2090
2089 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { 2091 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
2090 WL_ERR("Bss info is larger than buffer. Discarding\n"); 2092 brcmf_err("Bss info is larger than buffer. Discarding\n");
2091 return 0; 2093 return 0;
2092 } 2094 }
2093 2095
@@ -2108,13 +2110,11 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2108 notify_ielen = le32_to_cpu(bi->ie_length); 2110 notify_ielen = le32_to_cpu(bi->ie_length);
2109 notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; 2111 notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
2110 2112
2111 WL_CONN("bssid: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", 2113 brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID);
2112 bi->BSSID[0], bi->BSSID[1], bi->BSSID[2], 2114 brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq);
2113 bi->BSSID[3], bi->BSSID[4], bi->BSSID[5]); 2115 brcmf_dbg(CONN, "Capability: %X\n", notify_capability);
2114 WL_CONN("Channel: %d(%d)\n", channel, freq); 2116 brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval);
2115 WL_CONN("Capability: %X\n", notify_capability); 2117 brcmf_dbg(CONN, "Signal: %d\n", notify_signal);
2116 WL_CONN("Beacon interval: %d\n", notify_interval);
2117 WL_CONN("Signal: %d\n", notify_signal);
2118 2118
2119 bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)bi->BSSID, 2119 bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)bi->BSSID,
2120 0, notify_capability, notify_interval, notify_ie, 2120 0, notify_capability, notify_interval, notify_ie,
@@ -2147,11 +2147,11 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
2147 bss_list = cfg->bss_list; 2147 bss_list = cfg->bss_list;
2148 if (bss_list->count != 0 && 2148 if (bss_list->count != 0 &&
2149 bss_list->version != BRCMF_BSS_INFO_VERSION) { 2149 bss_list->version != BRCMF_BSS_INFO_VERSION) {
2150 WL_ERR("Version %d != WL_BSS_INFO_VERSION\n", 2150 brcmf_err("Version %d != WL_BSS_INFO_VERSION\n",
2151 bss_list->version); 2151 bss_list->version);
2152 return -EOPNOTSUPP; 2152 return -EOPNOTSUPP;
2153 } 2153 }
2154 WL_SCAN("scanned AP count (%d)\n", bss_list->count); 2154 brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count);
2155 for (i = 0; i < bss_list->count; i++) { 2155 for (i = 0; i < bss_list->count; i++) {
2156 bi = next_bss_le(bss_list, bi); 2156 bi = next_bss_le(bss_list, bi);
2157 err = brcmf_inform_single_bss(cfg, bi); 2157 err = brcmf_inform_single_bss(cfg, bi);
@@ -2179,7 +2179,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg,
2179 size_t notify_ielen; 2179 size_t notify_ielen;
2180 s32 notify_signal; 2180 s32 notify_signal;
2181 2181
2182 WL_TRACE("Enter\n"); 2182 brcmf_dbg(TRACE, "Enter\n");
2183 2183
2184 buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); 2184 buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
2185 if (buf == NULL) { 2185 if (buf == NULL) {
@@ -2192,7 +2192,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg,
2192 err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO, 2192 err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
2193 buf, WL_BSS_INFO_MAX); 2193 buf, WL_BSS_INFO_MAX);
2194 if (err) { 2194 if (err) {
2195 WL_ERR("WLC_GET_BSS_INFO failed: %d\n", err); 2195 brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err);
2196 goto CleanUp; 2196 goto CleanUp;
2197 } 2197 }
2198 2198
@@ -2215,10 +2215,10 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg,
2215 notify_ielen = le32_to_cpu(bi->ie_length); 2215 notify_ielen = le32_to_cpu(bi->ie_length);
2216 notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; 2216 notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
2217 2217
2218 WL_CONN("channel: %d(%d)\n", channel, freq); 2218 brcmf_dbg(CONN, "channel: %d(%d)\n", channel, freq);
2219 WL_CONN("capability: %X\n", notify_capability); 2219 brcmf_dbg(CONN, "capability: %X\n", notify_capability);
2220 WL_CONN("beacon interval: %d\n", notify_interval); 2220 brcmf_dbg(CONN, "beacon interval: %d\n", notify_interval);
2221 WL_CONN("signal: %d\n", notify_signal); 2221 brcmf_dbg(CONN, "signal: %d\n", notify_signal);
2222 2222
2223 bss = cfg80211_inform_bss(wiphy, notify_channel, bssid, 2223 bss = cfg80211_inform_bss(wiphy, notify_channel, bssid,
2224 0, notify_capability, notify_interval, 2224 0, notify_capability, notify_interval,
@@ -2235,7 +2235,7 @@ CleanUp:
2235 2235
2236 kfree(buf); 2236 kfree(buf);
2237 2237
2238 WL_TRACE("Exit\n"); 2238 brcmf_dbg(TRACE, "Exit\n");
2239 2239
2240 return err; 2240 return err;
2241} 2241}
@@ -2326,7 +2326,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg)
2326 u8 *ie; 2326 u8 *ie;
2327 s32 err = 0; 2327 s32 err = 0;
2328 2328
2329 WL_TRACE("Enter\n"); 2329 brcmf_dbg(TRACE, "Enter\n");
2330 if (brcmf_is_ibssmode(ifp->vif)) 2330 if (brcmf_is_ibssmode(ifp->vif))
2331 return err; 2331 return err;
2332 2332
@@ -2336,7 +2336,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg)
2336 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, 2336 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
2337 cfg->extra_buf, WL_EXTRA_BUF_MAX); 2337 cfg->extra_buf, WL_EXTRA_BUF_MAX);
2338 if (err) { 2338 if (err) {
2339 WL_ERR("Could not get bss info %d\n", err); 2339 brcmf_err("Could not get bss info %d\n", err);
2340 goto update_bss_info_out; 2340 goto update_bss_info_out;
2341 } 2341 }
2342 2342
@@ -2361,14 +2361,14 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg)
2361 u32 var; 2361 u32 var;
2362 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var); 2362 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
2363 if (err) { 2363 if (err) {
2364 WL_ERR("wl dtim_assoc failed (%d)\n", err); 2364 brcmf_err("wl dtim_assoc failed (%d)\n", err);
2365 goto update_bss_info_out; 2365 goto update_bss_info_out;
2366 } 2366 }
2367 dtim_period = (u8)var; 2367 dtim_period = (u8)var;
2368 } 2368 }
2369 2369
2370update_bss_info_out: 2370update_bss_info_out:
2371 WL_TRACE("Exit"); 2371 brcmf_dbg(TRACE, "Exit");
2372 return err; 2372 return err;
2373} 2373}
2374 2374
@@ -2401,7 +2401,7 @@ static void brcmf_escan_timeout(unsigned long data)
2401 (struct brcmf_cfg80211_info *)data; 2401 (struct brcmf_cfg80211_info *)data;
2402 2402
2403 if (cfg->scan_request) { 2403 if (cfg->scan_request) {
2404 WL_ERR("timer expired\n"); 2404 brcmf_err("timer expired\n");
2405 schedule_work(&cfg->escan_timeout_work); 2405 schedule_work(&cfg->escan_timeout_work);
2406 } 2406 }
2407} 2407}
@@ -2457,26 +2457,26 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2457 status = e->status; 2457 status = e->status;
2458 2458
2459 if (!ndev || !test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { 2459 if (!ndev || !test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
2460 WL_ERR("scan not ready ndev %p drv_status %x\n", ndev, 2460 brcmf_err("scan not ready ndev %p drv_status %x\n", ndev,
2461 !test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)); 2461 !test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status));
2462 return -EPERM; 2462 return -EPERM;
2463 } 2463 }
2464 2464
2465 if (status == BRCMF_E_STATUS_PARTIAL) { 2465 if (status == BRCMF_E_STATUS_PARTIAL) {
2466 WL_SCAN("ESCAN Partial result\n"); 2466 brcmf_dbg(SCAN, "ESCAN Partial result\n");
2467 escan_result_le = (struct brcmf_escan_result_le *) data; 2467 escan_result_le = (struct brcmf_escan_result_le *) data;
2468 if (!escan_result_le) { 2468 if (!escan_result_le) {
2469 WL_ERR("Invalid escan result (NULL pointer)\n"); 2469 brcmf_err("Invalid escan result (NULL pointer)\n");
2470 goto exit; 2470 goto exit;
2471 } 2471 }
2472 if (!cfg->scan_request) { 2472 if (!cfg->scan_request) {
2473 WL_SCAN("result without cfg80211 request\n"); 2473 brcmf_dbg(SCAN, "result without cfg80211 request\n");
2474 goto exit; 2474 goto exit;
2475 } 2475 }
2476 2476
2477 if (le16_to_cpu(escan_result_le->bss_count) != 1) { 2477 if (le16_to_cpu(escan_result_le->bss_count) != 1) {
2478 WL_ERR("Invalid bss_count %d: ignoring\n", 2478 brcmf_err("Invalid bss_count %d: ignoring\n",
2479 escan_result_le->bss_count); 2479 escan_result_le->bss_count);
2480 goto exit; 2480 goto exit;
2481 } 2481 }
2482 bss_info_le = &escan_result_le->bss_info_le; 2482 bss_info_le = &escan_result_le->bss_info_le;
@@ -2484,8 +2484,8 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2484 bi_length = le32_to_cpu(bss_info_le->length); 2484 bi_length = le32_to_cpu(bss_info_le->length);
2485 if (bi_length != (le32_to_cpu(escan_result_le->buflen) - 2485 if (bi_length != (le32_to_cpu(escan_result_le->buflen) -
2486 WL_ESCAN_RESULTS_FIXED_SIZE)) { 2486 WL_ESCAN_RESULTS_FIXED_SIZE)) {
2487 WL_ERR("Invalid bss_info length %d: ignoring\n", 2487 brcmf_err("Invalid bss_info length %d: ignoring\n",
2488 bi_length); 2488 bi_length);
2489 goto exit; 2489 goto exit;
2490 } 2490 }
2491 2491
@@ -2493,7 +2493,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2493 BIT(NL80211_IFTYPE_ADHOC))) { 2493 BIT(NL80211_IFTYPE_ADHOC))) {
2494 if (le16_to_cpu(bss_info_le->capability) & 2494 if (le16_to_cpu(bss_info_le->capability) &
2495 WLAN_CAPABILITY_IBSS) { 2495 WLAN_CAPABILITY_IBSS) {
2496 WL_ERR("Ignoring IBSS result\n"); 2496 brcmf_err("Ignoring IBSS result\n");
2497 goto exit; 2497 goto exit;
2498 } 2498 }
2499 } 2499 }
@@ -2501,7 +2501,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2501 list = (struct brcmf_scan_results *) 2501 list = (struct brcmf_scan_results *)
2502 cfg->escan_info.escan_buf; 2502 cfg->escan_info.escan_buf;
2503 if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) { 2503 if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) {
2504 WL_ERR("Buffer is too small: ignoring\n"); 2504 brcmf_err("Buffer is too small: ignoring\n");
2505 goto exit; 2505 goto exit;
2506 } 2506 }
2507 2507
@@ -2527,7 +2527,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2527 brcmf_notify_escan_complete(cfg, ndev, aborted, 2527 brcmf_notify_escan_complete(cfg, ndev, aborted,
2528 false); 2528 false);
2529 } else 2529 } else
2530 WL_ERR("Unexpected scan result 0x%x\n", status); 2530 brcmf_err("Unexpected scan result 0x%x\n", status);
2531 } 2531 }
2532exit: 2532exit:
2533 return err; 2533 return err;
@@ -2558,7 +2558,7 @@ static __always_inline void brcmf_delay(u32 ms)
2558 2558
2559static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) 2559static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
2560{ 2560{
2561 WL_TRACE("Enter\n"); 2561 brcmf_dbg(TRACE, "Enter\n");
2562 2562
2563 return 0; 2563 return 0;
2564} 2564}
@@ -2570,7 +2570,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
2570 struct net_device *ndev = cfg_to_ndev(cfg); 2570 struct net_device *ndev = cfg_to_ndev(cfg);
2571 struct brcmf_cfg80211_vif *vif; 2571 struct brcmf_cfg80211_vif *vif;
2572 2572
2573 WL_TRACE("Enter\n"); 2573 brcmf_dbg(TRACE, "Enter\n");
2574 2574
2575 /* 2575 /*
2576 * if the primary net_device is not READY there is nothing 2576 * if the primary net_device is not READY there is nothing
@@ -2604,7 +2604,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
2604 brcmf_set_mpc(ndev, 1); 2604 brcmf_set_mpc(ndev, 1);
2605 2605
2606exit: 2606exit:
2607 WL_TRACE("Exit\n"); 2607 brcmf_dbg(TRACE, "Exit\n");
2608 /* clear any scanning activity */ 2608 /* clear any scanning activity */
2609 cfg->scan_status = 0; 2609 cfg->scan_status = 0;
2610 return 0; 2610 return 0;
@@ -2619,12 +2619,13 @@ brcmf_update_pmklist(struct net_device *ndev,
2619 2619
2620 pmkid_len = le32_to_cpu(pmk_list->pmkids.npmkid); 2620 pmkid_len = le32_to_cpu(pmk_list->pmkids.npmkid);
2621 2621
2622 WL_CONN("No of elements %d\n", pmkid_len); 2622 brcmf_dbg(CONN, "No of elements %d\n", pmkid_len);
2623 for (i = 0; i < pmkid_len; i++) { 2623 for (i = 0; i < pmkid_len; i++) {
2624 WL_CONN("PMKID[%d]: %pM =\n", i, 2624 brcmf_dbg(CONN, "PMKID[%d]: %pM =\n", i,
2625 &pmk_list->pmkids.pmkid[i].BSSID); 2625 &pmk_list->pmkids.pmkid[i].BSSID);
2626 for (j = 0; j < WLAN_PMKID_LEN; j++) 2626 for (j = 0; j < WLAN_PMKID_LEN; j++)
2627 WL_CONN("%02x\n", pmk_list->pmkids.pmkid[i].PMKID[j]); 2627 brcmf_dbg(CONN, "%02x\n",
2628 pmk_list->pmkids.pmkid[i].PMKID[j]);
2628 } 2629 }
2629 2630
2630 if (!err) 2631 if (!err)
@@ -2645,7 +2646,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
2645 int i; 2646 int i;
2646 int pmkid_len; 2647 int pmkid_len;
2647 2648
2648 WL_TRACE("Enter\n"); 2649 brcmf_dbg(TRACE, "Enter\n");
2649 if (!check_vif_up(ifp->vif)) 2650 if (!check_vif_up(ifp->vif))
2650 return -EIO; 2651 return -EIO;
2651 2652
@@ -2663,14 +2664,14 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
2663 } else 2664 } else
2664 err = -EINVAL; 2665 err = -EINVAL;
2665 2666
2666 WL_CONN("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n", 2667 brcmf_dbg(CONN, "set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n",
2667 pmkids->pmkid[pmkid_len].BSSID); 2668 pmkids->pmkid[pmkid_len].BSSID);
2668 for (i = 0; i < WLAN_PMKID_LEN; i++) 2669 for (i = 0; i < WLAN_PMKID_LEN; i++)
2669 WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]); 2670 brcmf_dbg(CONN, "%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]);
2670 2671
2671 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); 2672 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
2672 2673
2673 WL_TRACE("Exit\n"); 2674 brcmf_dbg(TRACE, "Exit\n");
2674 return err; 2675 return err;
2675} 2676}
2676 2677
@@ -2684,17 +2685,17 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
2684 s32 err = 0; 2685 s32 err = 0;
2685 int i, pmkid_len; 2686 int i, pmkid_len;
2686 2687
2687 WL_TRACE("Enter\n"); 2688 brcmf_dbg(TRACE, "Enter\n");
2688 if (!check_vif_up(ifp->vif)) 2689 if (!check_vif_up(ifp->vif))
2689 return -EIO; 2690 return -EIO;
2690 2691
2691 memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETH_ALEN); 2692 memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETH_ALEN);
2692 memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); 2693 memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WLAN_PMKID_LEN);
2693 2694
2694 WL_CONN("del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n", 2695 brcmf_dbg(CONN, "del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n",
2695 &pmkid.pmkid[0].BSSID); 2696 &pmkid.pmkid[0].BSSID);
2696 for (i = 0; i < WLAN_PMKID_LEN; i++) 2697 for (i = 0; i < WLAN_PMKID_LEN; i++)
2697 WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]); 2698 brcmf_dbg(CONN, "%02x\n", pmkid.pmkid[0].PMKID[i]);
2698 2699
2699 pmkid_len = le32_to_cpu(cfg->pmk_list->pmkids.npmkid); 2700 pmkid_len = le32_to_cpu(cfg->pmk_list->pmkids.npmkid);
2700 for (i = 0; i < pmkid_len; i++) 2701 for (i = 0; i < pmkid_len; i++)
@@ -2721,7 +2722,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
2721 2722
2722 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); 2723 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
2723 2724
2724 WL_TRACE("Exit\n"); 2725 brcmf_dbg(TRACE, "Exit\n");
2725 return err; 2726 return err;
2726 2727
2727} 2728}
@@ -2733,14 +2734,14 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev)
2733 struct brcmf_if *ifp = netdev_priv(ndev); 2734 struct brcmf_if *ifp = netdev_priv(ndev);
2734 s32 err = 0; 2735 s32 err = 0;
2735 2736
2736 WL_TRACE("Enter\n"); 2737 brcmf_dbg(TRACE, "Enter\n");
2737 if (!check_vif_up(ifp->vif)) 2738 if (!check_vif_up(ifp->vif))
2738 return -EIO; 2739 return -EIO;
2739 2740
2740 memset(cfg->pmk_list, 0, sizeof(*cfg->pmk_list)); 2741 memset(cfg->pmk_list, 0, sizeof(*cfg->pmk_list));
2741 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); 2742 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
2742 2743
2743 WL_TRACE("Exit\n"); 2744 brcmf_dbg(TRACE, "Exit\n");
2744 return err; 2745 return err;
2745 2746
2746} 2747}
@@ -2771,10 +2772,10 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
2771 u32 result_count; 2772 u32 result_count;
2772 u32 status; 2773 u32 status;
2773 2774
2774 WL_SCAN("Enter\n"); 2775 brcmf_dbg(SCAN, "Enter\n");
2775 2776
2776 if (e->event_code == BRCMF_E_PFN_NET_LOST) { 2777 if (e->event_code == BRCMF_E_PFN_NET_LOST) {
2777 WL_SCAN("PFN NET LOST event. Do Nothing\n"); 2778 brcmf_dbg(SCAN, "PFN NET LOST event. Do Nothing\n");
2778 return 0; 2779 return 0;
2779 } 2780 }
2780 2781
@@ -2787,7 +2788,7 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
2787 * multiple NET_FOUND events. For now place a warning here. 2788 * multiple NET_FOUND events. For now place a warning here.
2788 */ 2789 */
2789 WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE); 2790 WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
2790 WL_SCAN("PFN NET FOUND event. count: %d\n", result_count); 2791 brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
2791 if (result_count > 0) { 2792 if (result_count > 0) {
2792 int i; 2793 int i;
2793 2794
@@ -2806,13 +2807,14 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
2806 for (i = 0; i < result_count; i++) { 2807 for (i = 0; i < result_count; i++) {
2807 netinfo = &netinfo_start[i]; 2808 netinfo = &netinfo_start[i];
2808 if (!netinfo) { 2809 if (!netinfo) {
2809 WL_ERR("Invalid netinfo ptr. index: %d\n", i); 2810 brcmf_err("Invalid netinfo ptr. index: %d\n",
2811 i);
2810 err = -EINVAL; 2812 err = -EINVAL;
2811 goto out_err; 2813 goto out_err;
2812 } 2814 }
2813 2815
2814 WL_SCAN("SSID:%s Channel:%d\n", 2816 brcmf_dbg(SCAN, "SSID:%s Channel:%d\n",
2815 netinfo->SSID, netinfo->channel); 2817 netinfo->SSID, netinfo->channel);
2816 memcpy(ssid[i].ssid, netinfo->SSID, netinfo->SSID_len); 2818 memcpy(ssid[i].ssid, netinfo->SSID, netinfo->SSID_len);
2817 ssid[i].ssid_len = netinfo->SSID_len; 2819 ssid[i].ssid_len = netinfo->SSID_len;
2818 request->n_ssids++; 2820 request->n_ssids++;
@@ -2849,7 +2851,7 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
2849 cfg->sched_escan = true; 2851 cfg->sched_escan = true;
2850 cfg->scan_request = request; 2852 cfg->scan_request = request;
2851 } else { 2853 } else {
2852 WL_ERR("FALSE PNO Event. (pfn_count == 0)\n"); 2854 brcmf_err("FALSE PNO Event. (pfn_count == 0)\n");
2853 goto out_err; 2855 goto out_err;
2854 } 2856 }
2855 2857
@@ -2878,7 +2880,7 @@ static int brcmf_dev_pno_clean(struct net_device *ndev)
2878 NULL, 0); 2880 NULL, 0);
2879 } 2881 }
2880 if (ret < 0) 2882 if (ret < 0)
2881 WL_ERR("failed code %d\n", ret); 2883 brcmf_err("failed code %d\n", ret);
2882 2884
2883 return ret; 2885 return ret;
2884} 2886}
@@ -2913,24 +2915,24 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
2913 int i; 2915 int i;
2914 int ret = 0; 2916 int ret = 0;
2915 2917
2916 WL_SCAN("Enter n_match_sets:%d n_ssids:%d\n", 2918 brcmf_dbg(SCAN, "Enter n_match_sets:%d n_ssids:%d\n",
2917 request->n_match_sets, request->n_ssids); 2919 request->n_match_sets, request->n_ssids);
2918 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { 2920 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
2919 WL_ERR("Scanning already: status (%lu)\n", cfg->scan_status); 2921 brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
2920 return -EAGAIN; 2922 return -EAGAIN;
2921 } 2923 }
2922 2924
2923 if (!request || !request->n_ssids || !request->n_match_sets) { 2925 if (!request || !request->n_ssids || !request->n_match_sets) {
2924 WL_ERR("Invalid sched scan req!! n_ssids:%d\n", 2926 brcmf_err("Invalid sched scan req!! n_ssids:%d\n",
2925 request ? request->n_ssids : 0); 2927 request ? request->n_ssids : 0);
2926 return -EINVAL; 2928 return -EINVAL;
2927 } 2929 }
2928 2930
2929 if (request->n_ssids > 0) { 2931 if (request->n_ssids > 0) {
2930 for (i = 0; i < request->n_ssids; i++) { 2932 for (i = 0; i < request->n_ssids; i++) {
2931 /* Active scan req for ssids */ 2933 /* Active scan req for ssids */
2932 WL_SCAN(">>> Active scan req for ssid (%s)\n", 2934 brcmf_dbg(SCAN, ">>> Active scan req for ssid (%s)\n",
2933 request->ssids[i].ssid); 2935 request->ssids[i].ssid);
2934 2936
2935 /* 2937 /*
2936 * match_set ssids is a supert set of n_ssid list, 2938 * match_set ssids is a supert set of n_ssid list,
@@ -2943,14 +2945,14 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
2943 /* clean up everything */ 2945 /* clean up everything */
2944 ret = brcmf_dev_pno_clean(ndev); 2946 ret = brcmf_dev_pno_clean(ndev);
2945 if (ret < 0) { 2947 if (ret < 0) {
2946 WL_ERR("failed error=%d\n", ret); 2948 brcmf_err("failed error=%d\n", ret);
2947 return ret; 2949 return ret;
2948 } 2950 }
2949 2951
2950 /* configure pno */ 2952 /* configure pno */
2951 ret = brcmf_dev_pno_config(ndev); 2953 ret = brcmf_dev_pno_config(ndev);
2952 if (ret < 0) { 2954 if (ret < 0) {
2953 WL_ERR("PNO setup failed!! ret=%d\n", ret); 2955 brcmf_err("PNO setup failed!! ret=%d\n", ret);
2954 return -EINVAL; 2956 return -EINVAL;
2955 } 2957 }
2956 2958
@@ -2963,7 +2965,7 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
2963 ssid_len = ssid->ssid_len; 2965 ssid_len = ssid->ssid_len;
2964 2966
2965 if (!ssid_len) { 2967 if (!ssid_len) {
2966 WL_ERR("skip broadcast ssid\n"); 2968 brcmf_err("skip broadcast ssid\n");
2967 continue; 2969 continue;
2968 } 2970 }
2969 pfn.auth = cpu_to_le32(WLAN_AUTH_OPEN); 2971 pfn.auth = cpu_to_le32(WLAN_AUTH_OPEN);
@@ -2975,13 +2977,12 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
2975 memcpy(pfn.ssid.SSID, ssid->ssid, ssid_len); 2977 memcpy(pfn.ssid.SSID, ssid->ssid, ssid_len);
2976 ret = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, 2978 ret = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn,
2977 sizeof(pfn)); 2979 sizeof(pfn));
2978 WL_SCAN(">>> PNO filter %s for ssid (%s)\n", 2980 brcmf_dbg(SCAN, ">>> PNO filter %s for ssid (%s)\n",
2979 ret == 0 ? "set" : "failed", 2981 ret == 0 ? "set" : "failed", ssid->ssid);
2980 ssid->ssid);
2981 } 2982 }
2982 /* Enable the PNO */ 2983 /* Enable the PNO */
2983 if (brcmf_fil_iovar_int_set(ifp, "pfn", 1) < 0) { 2984 if (brcmf_fil_iovar_int_set(ifp, "pfn", 1) < 0) {
2984 WL_ERR("PNO enable failed!! ret=%d\n", ret); 2985 brcmf_err("PNO enable failed!! ret=%d\n", ret);
2985 return -EINVAL; 2986 return -EINVAL;
2986 } 2987 }
2987 } else { 2988 } else {
@@ -2996,7 +2997,7 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy,
2996{ 2997{
2997 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 2998 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2998 2999
2999 WL_SCAN("enter\n"); 3000 brcmf_dbg(SCAN, "enter\n");
3000 brcmf_dev_pno_clean(ndev); 3001 brcmf_dev_pno_clean(ndev);
3001 if (cfg->sched_escan) 3002 if (cfg->sched_escan)
3002 brcmf_notify_escan_complete(cfg, ndev, true, true); 3003 brcmf_notify_escan_complete(cfg, ndev, true, true);
@@ -3012,8 +3013,8 @@ static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len)
3012 struct sk_buff *reply; 3013 struct sk_buff *reply;
3013 int ret; 3014 int ret;
3014 3015
3015 WL_TRACE("cmd %x set %d buf %p len %d\n", dcmd->cmd, dcmd->set, 3016 brcmf_dbg(TRACE, "cmd %x set %d buf %p len %d\n", dcmd->cmd, dcmd->set,
3016 dcmd->buf, dcmd->len); 3017 dcmd->buf, dcmd->len);
3017 3018
3018 if (dcmd->set) 3019 if (dcmd->set)
3019 ret = brcmf_fil_cmd_data_set(netdev_priv(ndev), dcmd->cmd, 3020 ret = brcmf_fil_cmd_data_set(netdev_priv(ndev), dcmd->cmd,
@@ -3038,19 +3039,19 @@ static s32 brcmf_configure_opensecurity(struct net_device *ndev, s32 bssidx)
3038 /* set auth */ 3039 /* set auth */
3039 err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0); 3040 err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
3040 if (err < 0) { 3041 if (err < 0) {
3041 WL_ERR("auth error %d\n", err); 3042 brcmf_err("auth error %d\n", err);
3042 return err; 3043 return err;
3043 } 3044 }
3044 /* set wsec */ 3045 /* set wsec */
3045 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0); 3046 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
3046 if (err < 0) { 3047 if (err < 0) {
3047 WL_ERR("wsec error %d\n", err); 3048 brcmf_err("wsec error %d\n", err);
3048 return err; 3049 return err;
3049 } 3050 }
3050 /* set upper-layer auth */ 3051 /* set upper-layer auth */
3051 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", WPA_AUTH_NONE); 3052 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", WPA_AUTH_NONE);
3052 if (err < 0) { 3053 if (err < 0) {
3053 WL_ERR("wpa_auth error %d\n", err); 3054 brcmf_err("wpa_auth error %d\n", err);
3054 return err; 3055 return err;
3055 } 3056 }
3056 3057
@@ -3084,7 +3085,7 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3084 u16 rsn_cap; 3085 u16 rsn_cap;
3085 u32 wme_bss_disable; 3086 u32 wme_bss_disable;
3086 3087
3087 WL_TRACE("Enter\n"); 3088 brcmf_dbg(TRACE, "Enter\n");
3088 if (wpa_ie == NULL) 3089 if (wpa_ie == NULL)
3089 goto exit; 3090 goto exit;
3090 3091
@@ -3098,13 +3099,13 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3098 /* check for multicast cipher suite */ 3099 /* check for multicast cipher suite */
3099 if (offset + WPA_IE_MIN_OUI_LEN > len) { 3100 if (offset + WPA_IE_MIN_OUI_LEN > len) {
3100 err = -EINVAL; 3101 err = -EINVAL;
3101 WL_ERR("no multicast cipher suite\n"); 3102 brcmf_err("no multicast cipher suite\n");
3102 goto exit; 3103 goto exit;
3103 } 3104 }
3104 3105
3105 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { 3106 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
3106 err = -EINVAL; 3107 err = -EINVAL;
3107 WL_ERR("ivalid OUI\n"); 3108 brcmf_err("ivalid OUI\n");
3108 goto exit; 3109 goto exit;
3109 } 3110 }
3110 offset += TLV_OUI_LEN; 3111 offset += TLV_OUI_LEN;
@@ -3126,7 +3127,7 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3126 break; 3127 break;
3127 default: 3128 default:
3128 err = -EINVAL; 3129 err = -EINVAL;
3129 WL_ERR("Invalid multi cast cipher info\n"); 3130 brcmf_err("Invalid multi cast cipher info\n");
3130 goto exit; 3131 goto exit;
3131 } 3132 }
3132 3133
@@ -3137,13 +3138,13 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3137 /* Check for unicast suite(s) */ 3138 /* Check for unicast suite(s) */
3138 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { 3139 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
3139 err = -EINVAL; 3140 err = -EINVAL;
3140 WL_ERR("no unicast cipher suite\n"); 3141 brcmf_err("no unicast cipher suite\n");
3141 goto exit; 3142 goto exit;
3142 } 3143 }
3143 for (i = 0; i < count; i++) { 3144 for (i = 0; i < count; i++) {
3144 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { 3145 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
3145 err = -EINVAL; 3146 err = -EINVAL;
3146 WL_ERR("ivalid OUI\n"); 3147 brcmf_err("ivalid OUI\n");
3147 goto exit; 3148 goto exit;
3148 } 3149 }
3149 offset += TLV_OUI_LEN; 3150 offset += TLV_OUI_LEN;
@@ -3161,7 +3162,7 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3161 pval |= AES_ENABLED; 3162 pval |= AES_ENABLED;
3162 break; 3163 break;
3163 default: 3164 default:
3164 WL_ERR("Ivalid unicast security info\n"); 3165 brcmf_err("Ivalid unicast security info\n");
3165 } 3166 }
3166 offset++; 3167 offset++;
3167 } 3168 }
@@ -3171,33 +3172,33 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3171 /* Check for auth key management suite(s) */ 3172 /* Check for auth key management suite(s) */
3172 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { 3173 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
3173 err = -EINVAL; 3174 err = -EINVAL;
3174 WL_ERR("no auth key mgmt suite\n"); 3175 brcmf_err("no auth key mgmt suite\n");
3175 goto exit; 3176 goto exit;
3176 } 3177 }
3177 for (i = 0; i < count; i++) { 3178 for (i = 0; i < count; i++) {
3178 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { 3179 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
3179 err = -EINVAL; 3180 err = -EINVAL;
3180 WL_ERR("ivalid OUI\n"); 3181 brcmf_err("ivalid OUI\n");
3181 goto exit; 3182 goto exit;
3182 } 3183 }
3183 offset += TLV_OUI_LEN; 3184 offset += TLV_OUI_LEN;
3184 switch (data[offset]) { 3185 switch (data[offset]) {
3185 case RSN_AKM_NONE: 3186 case RSN_AKM_NONE:
3186 WL_TRACE("RSN_AKM_NONE\n"); 3187 brcmf_dbg(TRACE, "RSN_AKM_NONE\n");
3187 wpa_auth |= WPA_AUTH_NONE; 3188 wpa_auth |= WPA_AUTH_NONE;
3188 break; 3189 break;
3189 case RSN_AKM_UNSPECIFIED: 3190 case RSN_AKM_UNSPECIFIED:
3190 WL_TRACE("RSN_AKM_UNSPECIFIED\n"); 3191 brcmf_dbg(TRACE, "RSN_AKM_UNSPECIFIED\n");
3191 is_rsn_ie ? (wpa_auth |= WPA2_AUTH_UNSPECIFIED) : 3192 is_rsn_ie ? (wpa_auth |= WPA2_AUTH_UNSPECIFIED) :
3192 (wpa_auth |= WPA_AUTH_UNSPECIFIED); 3193 (wpa_auth |= WPA_AUTH_UNSPECIFIED);
3193 break; 3194 break;
3194 case RSN_AKM_PSK: 3195 case RSN_AKM_PSK:
3195 WL_TRACE("RSN_AKM_PSK\n"); 3196 brcmf_dbg(TRACE, "RSN_AKM_PSK\n");
3196 is_rsn_ie ? (wpa_auth |= WPA2_AUTH_PSK) : 3197 is_rsn_ie ? (wpa_auth |= WPA2_AUTH_PSK) :
3197 (wpa_auth |= WPA_AUTH_PSK); 3198 (wpa_auth |= WPA_AUTH_PSK);
3198 break; 3199 break;
3199 default: 3200 default:
3200 WL_ERR("Ivalid key mgmt info\n"); 3201 brcmf_err("Ivalid key mgmt info\n");
3201 } 3202 }
3202 offset++; 3203 offset++;
3203 } 3204 }
@@ -3213,7 +3214,7 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3213 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable", 3214 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
3214 wme_bss_disable); 3215 wme_bss_disable);
3215 if (err < 0) { 3216 if (err < 0) {
3216 WL_ERR("wme_bss_disable error %d\n", err); 3217 brcmf_err("wme_bss_disable error %d\n", err);
3217 goto exit; 3218 goto exit;
3218 } 3219 }
3219 } 3220 }
@@ -3223,19 +3224,19 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3223 /* set auth */ 3224 /* set auth */
3224 err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth); 3225 err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
3225 if (err < 0) { 3226 if (err < 0) {
3226 WL_ERR("auth error %d\n", err); 3227 brcmf_err("auth error %d\n", err);
3227 goto exit; 3228 goto exit;
3228 } 3229 }
3229 /* set wsec */ 3230 /* set wsec */
3230 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); 3231 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
3231 if (err < 0) { 3232 if (err < 0) {
3232 WL_ERR("wsec error %d\n", err); 3233 brcmf_err("wsec error %d\n", err);
3233 goto exit; 3234 goto exit;
3234 } 3235 }
3235 /* set upper-layer auth */ 3236 /* set upper-layer auth */
3236 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth); 3237 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
3237 if (err < 0) { 3238 if (err < 0) {
3238 WL_ERR("wpa_auth error %d\n", err); 3239 brcmf_err("wpa_auth error %d\n", err);
3239 goto exit; 3240 goto exit;
3240 } 3241 }
3241 3242
@@ -3263,15 +3264,15 @@ brcmf_parse_vndr_ies(const u8 *vndr_ie_buf, u32 vndr_ie_len,
3263 vndrie = (struct brcmf_vs_tlv *)ie; 3264 vndrie = (struct brcmf_vs_tlv *)ie;
3264 /* len should be bigger than OUI length + one */ 3265 /* len should be bigger than OUI length + one */
3265 if (vndrie->len < (VS_IE_FIXED_HDR_LEN - TLV_HDR_LEN + 1)) { 3266 if (vndrie->len < (VS_IE_FIXED_HDR_LEN - TLV_HDR_LEN + 1)) {
3266 WL_ERR("invalid vndr ie. length is too small %d\n", 3267 brcmf_err("invalid vndr ie. length is too small %d\n",
3267 vndrie->len); 3268 vndrie->len);
3268 goto next; 3269 goto next;
3269 } 3270 }
3270 /* if wpa or wme ie, do not add ie */ 3271 /* if wpa or wme ie, do not add ie */
3271 if (!memcmp(vndrie->oui, (u8 *)WPA_OUI, TLV_OUI_LEN) && 3272 if (!memcmp(vndrie->oui, (u8 *)WPA_OUI, TLV_OUI_LEN) &&
3272 ((vndrie->oui_type == WPA_OUI_TYPE) || 3273 ((vndrie->oui_type == WPA_OUI_TYPE) ||
3273 (vndrie->oui_type == WME_OUI_TYPE))) { 3274 (vndrie->oui_type == WME_OUI_TYPE))) {
3274 WL_TRACE("Found WPA/WME oui. Do not add it\n"); 3275 brcmf_dbg(TRACE, "Found WPA/WME oui. Do not add it\n");
3275 goto next; 3276 goto next;
3276 } 3277 }
3277 3278
@@ -3284,11 +3285,11 @@ brcmf_parse_vndr_ies(const u8 *vndr_ie_buf, u32 vndr_ie_len,
3284 3285
3285 vndr_ies->count++; 3286 vndr_ies->count++;
3286 3287
3287 WL_TRACE("** OUI %02x %02x %02x, type 0x%02x\n", 3288 brcmf_dbg(TRACE, "** OUI %02x %02x %02x, type 0x%02x\n",
3288 parsed_info->vndrie.oui[0], 3289 parsed_info->vndrie.oui[0],
3289 parsed_info->vndrie.oui[1], 3290 parsed_info->vndrie.oui[1],
3290 parsed_info->vndrie.oui[2], 3291 parsed_info->vndrie.oui[2],
3291 parsed_info->vndrie.oui_type); 3292 parsed_info->vndrie.oui_type);
3292 3293
3293 if (vndr_ies->count >= MAX_VNDR_IE_NUMBER) 3294 if (vndr_ies->count >= MAX_VNDR_IE_NUMBER)
3294 break; 3295 break;
@@ -3351,7 +3352,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
3351 ifp = vif->ifp; 3352 ifp = vif->ifp;
3352 saved_ie = &vif->saved_ie; 3353 saved_ie = &vif->saved_ie;
3353 3354
3354 WL_TRACE("bssidx %d, pktflag : 0x%02X\n", ifp->bssidx, pktflag); 3355 brcmf_dbg(TRACE, "bssidx %d, pktflag : 0x%02X\n", ifp->bssidx, pktflag);
3355 iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); 3356 iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
3356 if (!iovar_ie_buf) 3357 if (!iovar_ie_buf)
3357 return -ENOMEM; 3358 return -ENOMEM;
@@ -3370,18 +3371,18 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
3370 break; 3371 break;
3371 default: 3372 default:
3372 err = -EPERM; 3373 err = -EPERM;
3373 WL_ERR("not suitable type\n"); 3374 brcmf_err("not suitable type\n");
3374 goto exit; 3375 goto exit;
3375 } 3376 }
3376 } else { 3377 } else {
3377 err = -EPERM; 3378 err = -EPERM;
3378 WL_ERR("not suitable type\n"); 3379 brcmf_err("not suitable type\n");
3379 goto exit; 3380 goto exit;
3380 } 3381 }
3381 3382
3382 if (vndr_ie_len > mgmt_ie_buf_len) { 3383 if (vndr_ie_len > mgmt_ie_buf_len) {
3383 err = -ENOMEM; 3384 err = -ENOMEM;
3384 WL_ERR("extra IE size too big\n"); 3385 brcmf_err("extra IE size too big\n");
3385 goto exit; 3386 goto exit;
3386 } 3387 }
3387 3388
@@ -3401,7 +3402,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
3401 if (parsed_ie_buf_len && (parsed_ie_buf_len == *mgmt_ie_len) && 3402 if (parsed_ie_buf_len && (parsed_ie_buf_len == *mgmt_ie_len) &&
3402 (memcmp(mgmt_ie_buf, curr_ie_buf, 3403 (memcmp(mgmt_ie_buf, curr_ie_buf,
3403 parsed_ie_buf_len) == 0)) { 3404 parsed_ie_buf_len) == 0)) {
3404 WL_TRACE("Previous mgmt IE equals to current IE\n"); 3405 brcmf_dbg(TRACE, "Previous mgmt IE equals to current IE\n");
3405 goto exit; 3406 goto exit;
3406 } 3407 }
3407 3408
@@ -3412,12 +3413,12 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
3412 for (i = 0; i < old_vndr_ies.count; i++) { 3413 for (i = 0; i < old_vndr_ies.count; i++) {
3413 vndrie_info = &old_vndr_ies.ie_info[i]; 3414 vndrie_info = &old_vndr_ies.ie_info[i];
3414 3415
3415 WL_TRACE("DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n", 3416 brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n",
3416 vndrie_info->vndrie.id, 3417 vndrie_info->vndrie.id,
3417 vndrie_info->vndrie.len, 3418 vndrie_info->vndrie.len,
3418 vndrie_info->vndrie.oui[0], 3419 vndrie_info->vndrie.oui[0],
3419 vndrie_info->vndrie.oui[1], 3420 vndrie_info->vndrie.oui[1],
3420 vndrie_info->vndrie.oui[2]); 3421 vndrie_info->vndrie.oui[2]);
3421 3422
3422 del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, 3423 del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag,
3423 vndrie_info->ie_ptr, 3424 vndrie_info->ie_ptr,
@@ -3442,19 +3443,19 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
3442 /* verify remained buf size before copy data */ 3443 /* verify remained buf size before copy data */
3443 if (remained_buf_len < (vndrie_info->vndrie.len + 3444 if (remained_buf_len < (vndrie_info->vndrie.len +
3444 VNDR_IE_VSIE_OFFSET)) { 3445 VNDR_IE_VSIE_OFFSET)) {
3445 WL_ERR("no space in mgmt_ie_buf: len left %d", 3446 brcmf_err("no space in mgmt_ie_buf: len left %d",
3446 remained_buf_len); 3447 remained_buf_len);
3447 break; 3448 break;
3448 } 3449 }
3449 remained_buf_len -= (vndrie_info->ie_len + 3450 remained_buf_len -= (vndrie_info->ie_len +
3450 VNDR_IE_VSIE_OFFSET); 3451 VNDR_IE_VSIE_OFFSET);
3451 3452
3452 WL_TRACE("ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n", 3453 brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n",
3453 vndrie_info->vndrie.id, 3454 vndrie_info->vndrie.id,
3454 vndrie_info->vndrie.len, 3455 vndrie_info->vndrie.len,
3455 vndrie_info->vndrie.oui[0], 3456 vndrie_info->vndrie.oui[0],
3456 vndrie_info->vndrie.oui[1], 3457 vndrie_info->vndrie.oui[1],
3457 vndrie_info->vndrie.oui[2]); 3458 vndrie_info->vndrie.oui[2]);
3458 3459
3459 del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, 3460 del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag,
3460 vndrie_info->ie_ptr, 3461 vndrie_info->ie_ptr,
@@ -3474,7 +3475,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
3474 err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf, 3475 err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
3475 total_ie_buf_len); 3476 total_ie_buf_len);
3476 if (err) 3477 if (err)
3477 WL_ERR("vndr ie set error : %d\n", err); 3478 brcmf_err("vndr ie set error : %d\n", err);
3478 } 3479 }
3479 3480
3480exit: 3481exit:
@@ -3496,16 +3497,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3496 struct brcmf_join_params join_params; 3497 struct brcmf_join_params join_params;
3497 s32 bssidx = 0; 3498 s32 bssidx = 0;
3498 3499
3499 WL_TRACE("channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", 3500 brcmf_dbg(TRACE, "channel_type=%d, beacon_interval=%d, dtim_period=%d,\n",
3500 cfg80211_get_chandef_type(&settings->chandef), 3501 cfg80211_get_chandef_type(&settings->chandef),
3501 settings->beacon_interval, 3502 settings->beacon_interval,
3502 settings->dtim_period); 3503 settings->dtim_period);
3503 WL_TRACE("ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", 3504 brcmf_dbg(TRACE, "ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n",
3504 settings->ssid, settings->ssid_len, settings->auth_type, 3505 settings->ssid, settings->ssid_len, settings->auth_type,
3505 settings->inactivity_timeout); 3506 settings->inactivity_timeout);
3506 3507
3507 if (!test_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state)) { 3508 if (!test_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state)) {
3508 WL_ERR("Not in AP creation mode\n"); 3509 brcmf_err("Not in AP creation mode\n");
3509 return -EPERM; 3510 return -EPERM;
3510 } 3511 }
3511 3512
@@ -3521,7 +3522,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3521 3522
3522 memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); 3523 memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len);
3523 ssid_le.SSID_len = cpu_to_le32(ssid_ie->len); 3524 ssid_le.SSID_len = cpu_to_le32(ssid_ie->len);
3524 WL_TRACE("SSID is (%s) in Head\n", ssid_le.SSID); 3525 brcmf_dbg(TRACE, "SSID is (%s) in Head\n", ssid_le.SSID);
3525 } else { 3526 } else {
3526 memcpy(ssid_le.SSID, settings->ssid, settings->ssid_len); 3527 memcpy(ssid_le.SSID, settings->ssid, settings->ssid_len);
3527 ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len); 3528 ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len);
@@ -3530,17 +3531,17 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3530 brcmf_set_mpc(ndev, 0); 3531 brcmf_set_mpc(ndev, 0);
3531 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); 3532 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
3532 if (err < 0) { 3533 if (err < 0) {
3533 WL_ERR("BRCMF_C_DOWN error %d\n", err); 3534 brcmf_err("BRCMF_C_DOWN error %d\n", err);
3534 goto exit; 3535 goto exit;
3535 } 3536 }
3536 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1); 3537 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
3537 if (err < 0) { 3538 if (err < 0) {
3538 WL_ERR("SET INFRA error %d\n", err); 3539 brcmf_err("SET INFRA error %d\n", err);
3539 goto exit; 3540 goto exit;
3540 } 3541 }
3541 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1); 3542 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
3542 if (err < 0) { 3543 if (err < 0) {
3543 WL_ERR("setting AP mode failed %d\n", err); 3544 brcmf_err("setting AP mode failed %d\n", err);
3544 goto exit; 3545 goto exit;
3545 } 3546 }
3546 3547
@@ -3553,7 +3554,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3553 settings->beacon.tail_len); 3554 settings->beacon.tail_len);
3554 3555
3555 if ((wpa_ie != NULL || rsn_ie != NULL)) { 3556 if ((wpa_ie != NULL || rsn_ie != NULL)) {
3556 WL_TRACE("WPA(2) IE is found\n"); 3557 brcmf_dbg(TRACE, "WPA(2) IE is found\n");
3557 if (wpa_ie != NULL) { 3558 if (wpa_ie != NULL) {
3558 /* WPA IE */ 3559 /* WPA IE */
3559 err = brcmf_configure_wpaie(ndev, wpa_ie, false); 3560 err = brcmf_configure_wpaie(ndev, wpa_ie, false);
@@ -3567,7 +3568,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3567 goto exit; 3568 goto exit;
3568 } 3569 }
3569 } else { 3570 } else {
3570 WL_TRACE("No WPA(2) IEs found\n"); 3571 brcmf_dbg(TRACE, "No WPA(2) IEs found\n");
3571 brcmf_configure_opensecurity(ndev, bssidx); 3572 brcmf_configure_opensecurity(ndev, bssidx);
3572 } 3573 }
3573 /* Set Beacon IEs to FW */ 3574 /* Set Beacon IEs to FW */
@@ -3576,9 +3577,9 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3576 settings->beacon.tail, 3577 settings->beacon.tail,
3577 settings->beacon.tail_len); 3578 settings->beacon.tail_len);
3578 if (err) 3579 if (err)
3579 WL_ERR("Set Beacon IE Failed\n"); 3580 brcmf_err("Set Beacon IE Failed\n");
3580 else 3581 else
3581 WL_TRACE("Applied Vndr IEs for Beacon\n"); 3582 brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
3582 3583
3583 /* Set Probe Response IEs to FW */ 3584 /* Set Probe Response IEs to FW */
3584 err = brcmf_vif_set_mgmt_ie(ndev_to_vif(ndev), 3585 err = brcmf_vif_set_mgmt_ie(ndev_to_vif(ndev),
@@ -3586,15 +3587,15 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3586 settings->beacon.proberesp_ies, 3587 settings->beacon.proberesp_ies,
3587 settings->beacon.proberesp_ies_len); 3588 settings->beacon.proberesp_ies_len);
3588 if (err) 3589 if (err)
3589 WL_ERR("Set Probe Resp IE Failed\n"); 3590 brcmf_err("Set Probe Resp IE Failed\n");
3590 else 3591 else
3591 WL_TRACE("Applied Vndr IEs for Probe Resp\n"); 3592 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
3592 3593
3593 if (settings->beacon_interval) { 3594 if (settings->beacon_interval) {
3594 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, 3595 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
3595 settings->beacon_interval); 3596 settings->beacon_interval);
3596 if (err < 0) { 3597 if (err < 0) {
3597 WL_ERR("Beacon Interval Set Error, %d\n", err); 3598 brcmf_err("Beacon Interval Set Error, %d\n", err);
3598 goto exit; 3599 goto exit;
3599 } 3600 }
3600 } 3601 }
@@ -3602,13 +3603,13 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3602 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD, 3603 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
3603 settings->dtim_period); 3604 settings->dtim_period);
3604 if (err < 0) { 3605 if (err < 0) {
3605 WL_ERR("DTIM Interval Set Error, %d\n", err); 3606 brcmf_err("DTIM Interval Set Error, %d\n", err);
3606 goto exit; 3607 goto exit;
3607 } 3608 }
3608 } 3609 }
3609 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); 3610 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
3610 if (err < 0) { 3611 if (err < 0) {
3611 WL_ERR("BRCMF_C_UP error (%d)\n", err); 3612 brcmf_err("BRCMF_C_UP error (%d)\n", err);
3612 goto exit; 3613 goto exit;
3613 } 3614 }
3614 3615
@@ -3619,7 +3620,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
3619 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, 3620 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
3620 &join_params, sizeof(join_params)); 3621 &join_params, sizeof(join_params));
3621 if (err < 0) { 3622 if (err < 0) {
3622 WL_ERR("SET SSID error (%d)\n", err); 3623 brcmf_err("SET SSID error (%d)\n", err);
3623 goto exit; 3624 goto exit;
3624 } 3625 }
3625 clear_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); 3626 clear_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
@@ -3636,7 +3637,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
3636 struct brcmf_if *ifp = netdev_priv(ndev); 3637 struct brcmf_if *ifp = netdev_priv(ndev);
3637 s32 err = -EPERM; 3638 s32 err = -EPERM;
3638 3639
3639 WL_TRACE("Enter\n"); 3640 brcmf_dbg(TRACE, "Enter\n");
3640 3641
3641 if (ifp->vif->mode == WL_MODE_AP) { 3642 if (ifp->vif->mode == WL_MODE_AP) {
3642 /* Due to most likely deauths outstanding we sleep */ 3643 /* Due to most likely deauths outstanding we sleep */
@@ -3644,12 +3645,12 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
3644 msleep(400); 3645 msleep(400);
3645 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); 3646 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
3646 if (err < 0) { 3647 if (err < 0) {
3647 WL_ERR("setting AP mode failed %d\n", err); 3648 brcmf_err("setting AP mode failed %d\n", err);
3648 goto exit; 3649 goto exit;
3649 } 3650 }
3650 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); 3651 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0);
3651 if (err < 0) { 3652 if (err < 0) {
3652 WL_ERR("BRCMF_C_UP error %d\n", err); 3653 brcmf_err("BRCMF_C_UP error %d\n", err);
3653 goto exit; 3654 goto exit;
3654 } 3655 }
3655 brcmf_set_mpc(ndev, 1); 3656 brcmf_set_mpc(ndev, 1);
@@ -3671,7 +3672,7 @@ brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev,
3671 if (!mac) 3672 if (!mac)
3672 return -EFAULT; 3673 return -EFAULT;
3673 3674
3674 WL_TRACE("Enter %pM\n", mac); 3675 brcmf_dbg(TRACE, "Enter %pM\n", mac);
3675 3676
3676 if (!check_vif_up(ifp->vif)) 3677 if (!check_vif_up(ifp->vif))
3677 return -EIO; 3678 return -EIO;
@@ -3681,9 +3682,9 @@ brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev,
3681 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON, 3682 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
3682 &scbval, sizeof(scbval)); 3683 &scbval, sizeof(scbval));
3683 if (err) 3684 if (err)
3684 WL_ERR("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err); 3685 brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err);
3685 3686
3686 WL_TRACE("Exit\n"); 3687 brcmf_dbg(TRACE, "Exit\n");
3687 return err; 3688 return err;
3688} 3689}
3689 3690
@@ -3752,7 +3753,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev)
3752 3753
3753 wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct brcmf_cfg80211_info)); 3754 wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct brcmf_cfg80211_info));
3754 if (!wiphy) { 3755 if (!wiphy) {
3755 WL_ERR("Could not allocate wiphy device\n"); 3756 brcmf_err("Could not allocate wiphy device\n");
3756 return ERR_PTR(-ENOMEM); 3757 return ERR_PTR(-ENOMEM);
3757 } 3758 }
3758 set_wiphy_dev(wiphy, phydev); 3759 set_wiphy_dev(wiphy, phydev);
@@ -3779,7 +3780,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev)
3779 brcmf_wiphy_pno_params(wiphy); 3780 brcmf_wiphy_pno_params(wiphy);
3780 err = wiphy_register(wiphy); 3781 err = wiphy_register(wiphy);
3781 if (err < 0) { 3782 if (err < 0) {
3782 WL_ERR("Could not register wiphy device (%d)\n", err); 3783 brcmf_err("Could not register wiphy device (%d)\n", err);
3783 wiphy_free(wiphy); 3784 wiphy_free(wiphy);
3784 return ERR_PTR(err); 3785 return ERR_PTR(err);
3785 } 3786 }
@@ -3844,7 +3845,7 @@ static bool brcmf_is_linkup(const struct brcmf_event_msg *e)
3844 u32 status = e->status; 3845 u32 status = e->status;
3845 3846
3846 if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) { 3847 if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) {
3847 WL_CONN("Processing set ssid\n"); 3848 brcmf_dbg(CONN, "Processing set ssid\n");
3848 return true; 3849 return true;
3849 } 3850 }
3850 3851
@@ -3857,7 +3858,7 @@ static bool brcmf_is_linkdown(const struct brcmf_event_msg *e)
3857 u16 flags = e->flags; 3858 u16 flags = e->flags;
3858 3859
3859 if (event == BRCMF_E_LINK && (!(flags & BRCMF_EVENT_MSG_LINK))) { 3860 if (event == BRCMF_E_LINK && (!(flags & BRCMF_EVENT_MSG_LINK))) {
3860 WL_CONN("Processing link down\n"); 3861 brcmf_dbg(CONN, "Processing link down\n");
3861 return true; 3862 return true;
3862 } 3863 }
3863 return false; 3864 return false;
@@ -3870,13 +3871,13 @@ static bool brcmf_is_nonetwork(struct brcmf_cfg80211_info *cfg,
3870 u32 status = e->status; 3871 u32 status = e->status;
3871 3872
3872 if (event == BRCMF_E_LINK && status == BRCMF_E_STATUS_NO_NETWORKS) { 3873 if (event == BRCMF_E_LINK && status == BRCMF_E_STATUS_NO_NETWORKS) {
3873 WL_CONN("Processing Link %s & no network found\n", 3874 brcmf_dbg(CONN, "Processing Link %s & no network found\n",
3874 e->flags & BRCMF_EVENT_MSG_LINK ? "up" : "down"); 3875 e->flags & BRCMF_EVENT_MSG_LINK ? "up" : "down");
3875 return true; 3876 return true;
3876 } 3877 }
3877 3878
3878 if (event == BRCMF_E_SET_SSID && status != BRCMF_E_STATUS_SUCCESS) { 3879 if (event == BRCMF_E_SET_SSID && status != BRCMF_E_STATUS_SUCCESS) {
3879 WL_CONN("Processing connecting & no network found\n"); 3880 brcmf_dbg(CONN, "Processing connecting & no network found\n");
3880 return true; 3881 return true;
3881 } 3882 }
3882 3883
@@ -3909,7 +3910,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg)
3909 err = brcmf_fil_iovar_data_get(ifp, "assoc_info", 3910 err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
3910 cfg->extra_buf, WL_ASSOC_INFO_MAX); 3911 cfg->extra_buf, WL_ASSOC_INFO_MAX);
3911 if (err) { 3912 if (err) {
3912 WL_ERR("could not get assoc info (%d)\n", err); 3913 brcmf_err("could not get assoc info (%d)\n", err);
3913 return err; 3914 return err;
3914 } 3915 }
3915 assoc_info = 3916 assoc_info =
@@ -3921,7 +3922,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg)
3921 cfg->extra_buf, 3922 cfg->extra_buf,
3922 WL_ASSOC_INFO_MAX); 3923 WL_ASSOC_INFO_MAX);
3923 if (err) { 3924 if (err) {
3924 WL_ERR("could not get assoc req (%d)\n", err); 3925 brcmf_err("could not get assoc req (%d)\n", err);
3925 return err; 3926 return err;
3926 } 3927 }
3927 conn_info->req_ie_len = req_len; 3928 conn_info->req_ie_len = req_len;
@@ -3937,7 +3938,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg)
3937 cfg->extra_buf, 3938 cfg->extra_buf,
3938 WL_ASSOC_INFO_MAX); 3939 WL_ASSOC_INFO_MAX);
3939 if (err) { 3940 if (err) {
3940 WL_ERR("could not get assoc resp (%d)\n", err); 3941 brcmf_err("could not get assoc resp (%d)\n", err);
3941 return err; 3942 return err;
3942 } 3943 }
3943 conn_info->resp_ie_len = resp_len; 3944 conn_info->resp_ie_len = resp_len;
@@ -3948,8 +3949,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg)
3948 conn_info->resp_ie_len = 0; 3949 conn_info->resp_ie_len = 0;
3949 conn_info->resp_ie = NULL; 3950 conn_info->resp_ie = NULL;
3950 } 3951 }
3951 WL_CONN("req len (%d) resp len (%d)\n", 3952 brcmf_dbg(CONN, "req len (%d) resp len (%d)\n",
3952 conn_info->req_ie_len, conn_info->resp_ie_len); 3953 conn_info->req_ie_len, conn_info->resp_ie_len);
3953 3954
3954 return err; 3955 return err;
3955} 3956}
@@ -3971,7 +3972,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
3971 u32 target_channel; 3972 u32 target_channel;
3972 u8 *buf; 3973 u8 *buf;
3973 3974
3974 WL_TRACE("Enter\n"); 3975 brcmf_dbg(TRACE, "Enter\n");
3975 3976
3976 brcmf_get_assoc_ies(cfg); 3977 brcmf_get_assoc_ies(cfg);
3977 memcpy(profile->bssid, e->addr, ETH_ALEN); 3978 memcpy(profile->bssid, e->addr, ETH_ALEN);
@@ -4008,10 +4009,10 @@ done:
4008 cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, 4009 cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid,
4009 conn_info->req_ie, conn_info->req_ie_len, 4010 conn_info->req_ie, conn_info->req_ie_len,
4010 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); 4011 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
4011 WL_CONN("Report roaming result\n"); 4012 brcmf_dbg(CONN, "Report roaming result\n");
4012 4013
4013 set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); 4014 set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state);
4014 WL_TRACE("Exit\n"); 4015 brcmf_dbg(TRACE, "Exit\n");
4015 return err; 4016 return err;
4016} 4017}
4017 4018
@@ -4025,7 +4026,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
4025 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); 4026 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
4026 s32 err = 0; 4027 s32 err = 0;
4027 4028
4028 WL_TRACE("Enter\n"); 4029 brcmf_dbg(TRACE, "Enter\n");
4029 4030
4030 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTING, 4031 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTING,
4031 &ifp->vif->sme_state)) { 4032 &ifp->vif->sme_state)) {
@@ -4046,10 +4047,10 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
4046 if (completed) 4047 if (completed)
4047 set_bit(BRCMF_VIF_STATUS_CONNECTED, 4048 set_bit(BRCMF_VIF_STATUS_CONNECTED,
4048 &ifp->vif->sme_state); 4049 &ifp->vif->sme_state);
4049 WL_CONN("Report connect result - connection %s\n", 4050 brcmf_dbg(CONN, "Report connect result - connection %s\n",
4050 completed ? "succeeded" : "failed"); 4051 completed ? "succeeded" : "failed");
4051 } 4052 }
4052 WL_TRACE("Exit\n"); 4053 brcmf_dbg(TRACE, "Exit\n");
4053 return err; 4054 return err;
4054} 4055}
4055 4056
@@ -4066,7 +4067,7 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg,
4066 4067
4067 struct station_info sinfo; 4068 struct station_info sinfo;
4068 4069
4069 WL_CONN("event %d, reason %d\n", event, reason); 4070 brcmf_dbg(CONN, "event %d, reason %d\n", event, reason);
4070 memset(&sinfo, 0, sizeof(sinfo)); 4071 memset(&sinfo, 0, sizeof(sinfo));
4071 4072
4072 sinfo.filled = 0; 4073 sinfo.filled = 0;
@@ -4074,7 +4075,7 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg,
4074 reason == BRCMF_E_STATUS_SUCCESS) { 4075 reason == BRCMF_E_STATUS_SUCCESS) {
4075 sinfo.filled = STATION_INFO_ASSOC_REQ_IES; 4076 sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
4076 if (!data) { 4077 if (!data) {
4077 WL_ERR("No IEs present in ASSOC/REASSOC_IND"); 4078 brcmf_err("No IEs present in ASSOC/REASSOC_IND");
4078 return -EINVAL; 4079 return -EINVAL;
4079 } 4080 }
4080 sinfo.assoc_req_ies = data; 4081 sinfo.assoc_req_ies = data;
@@ -4104,7 +4105,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
4104 if (ifp->vif->mode == WL_MODE_AP) { 4105 if (ifp->vif->mode == WL_MODE_AP) {
4105 err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); 4106 err = brcmf_notify_connect_status_ap(cfg, ndev, e, data);
4106 } else if (brcmf_is_linkup(e)) { 4107 } else if (brcmf_is_linkup(e)) {
4107 WL_CONN("Linkup\n"); 4108 brcmf_dbg(CONN, "Linkup\n");
4108 if (brcmf_is_ibssmode(ifp->vif)) { 4109 if (brcmf_is_ibssmode(ifp->vif)) {
4109 memcpy(profile->bssid, e->addr, ETH_ALEN); 4110 memcpy(profile->bssid, e->addr, ETH_ALEN);
4110 wl_inform_ibss(cfg, ndev, e->addr); 4111 wl_inform_ibss(cfg, ndev, e->addr);
@@ -4116,7 +4117,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
4116 } else 4117 } else
4117 brcmf_bss_connect_done(cfg, ndev, e, true); 4118 brcmf_bss_connect_done(cfg, ndev, e, true);
4118 } else if (brcmf_is_linkdown(e)) { 4119 } else if (brcmf_is_linkdown(e)) {
4119 WL_CONN("Linkdown\n"); 4120 brcmf_dbg(CONN, "Linkdown\n");
4120 if (!brcmf_is_ibssmode(ifp->vif)) { 4121 if (!brcmf_is_ibssmode(ifp->vif)) {
4121 brcmf_bss_connect_done(cfg, ndev, e, false); 4122 brcmf_bss_connect_done(cfg, ndev, e, false);
4122 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, 4123 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED,
@@ -4271,10 +4272,10 @@ static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg)
4271 brcmf_deinit_priv_mem(cfg); 4272 brcmf_deinit_priv_mem(cfg);
4272} 4273}
4273 4274
4274struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr) 4275struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
4276 struct device *busdev)
4275{ 4277{
4276 struct net_device *ndev = drvr->iflist[0]->ndev; 4278 struct net_device *ndev = drvr->iflist[0]->ndev;
4277 struct device *busdev = drvr->dev;
4278 struct brcmf_cfg80211_info *cfg; 4279 struct brcmf_cfg80211_info *cfg;
4279 struct wiphy *wiphy; 4280 struct wiphy *wiphy;
4280 struct brcmf_cfg80211_vif *vif; 4281 struct brcmf_cfg80211_vif *vif;
@@ -4282,7 +4283,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr)
4282 s32 err = 0; 4283 s32 err = 0;
4283 4284
4284 if (!ndev) { 4285 if (!ndev) {
4285 WL_ERR("ndev is invalid\n"); 4286 brcmf_err("ndev is invalid\n");
4286 return NULL; 4287 return NULL;
4287 } 4288 }
4288 4289
@@ -4304,7 +4305,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr)
4304 4305
4305 err = wl_init_priv(cfg); 4306 err = wl_init_priv(cfg);
4306 if (err) { 4307 if (err) {
4307 WL_ERR("Failed to init iwm_priv (%d)\n", err); 4308 brcmf_err("Failed to init iwm_priv (%d)\n", err);
4308 goto cfg80211_attach_out; 4309 goto cfg80211_attach_out;
4309 } 4310 }
4310 4311
@@ -4342,7 +4343,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
4342 if (roamvar) { 4343 if (roamvar) {
4343 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout); 4344 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
4344 if (err) { 4345 if (err) {
4345 WL_ERR("bcn_timeout error (%d)\n", err); 4346 brcmf_err("bcn_timeout error (%d)\n", err);
4346 goto dongle_rom_out; 4347 goto dongle_rom_out;
4347 } 4348 }
4348 } 4349 }
@@ -4351,10 +4352,10 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
4351 * Enable/Disable built-in roaming to allow supplicant 4352 * Enable/Disable built-in roaming to allow supplicant
4352 * to take care of roaming 4353 * to take care of roaming
4353 */ 4354 */
4354 WL_INFO("Internal Roaming = %s\n", roamvar ? "Off" : "On"); 4355 brcmf_dbg(INFO, "Internal Roaming = %s\n", roamvar ? "Off" : "On");
4355 err = brcmf_fil_iovar_int_set(ifp, "roam_off", roamvar); 4356 err = brcmf_fil_iovar_int_set(ifp, "roam_off", roamvar);
4356 if (err) { 4357 if (err) {
4357 WL_ERR("roam_off error (%d)\n", err); 4358 brcmf_err("roam_off error (%d)\n", err);
4358 goto dongle_rom_out; 4359 goto dongle_rom_out;
4359 } 4360 }
4360 4361
@@ -4363,7 +4364,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
4363 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, 4364 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
4364 (void *)roamtrigger, sizeof(roamtrigger)); 4365 (void *)roamtrigger, sizeof(roamtrigger));
4365 if (err) { 4366 if (err) {
4366 WL_ERR("WLC_SET_ROAM_TRIGGER error (%d)\n", err); 4367 brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
4367 goto dongle_rom_out; 4368 goto dongle_rom_out;
4368 } 4369 }
4369 4370
@@ -4372,7 +4373,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
4372 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA, 4373 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
4373 (void *)roam_delta, sizeof(roam_delta)); 4374 (void *)roam_delta, sizeof(roam_delta));
4374 if (err) { 4375 if (err) {
4375 WL_ERR("WLC_SET_ROAM_DELTA error (%d)\n", err); 4376 brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
4376 goto dongle_rom_out; 4377 goto dongle_rom_out;
4377 } 4378 }
4378 4379
@@ -4391,18 +4392,18 @@ brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
4391 scan_assoc_time); 4392 scan_assoc_time);
4392 if (err) { 4393 if (err) {
4393 if (err == -EOPNOTSUPP) 4394 if (err == -EOPNOTSUPP)
4394 WL_INFO("Scan assoc time is not supported\n"); 4395 brcmf_dbg(INFO, "Scan assoc time is not supported\n");
4395 else 4396 else
4396 WL_ERR("Scan assoc time error (%d)\n", err); 4397 brcmf_err("Scan assoc time error (%d)\n", err);
4397 goto dongle_scantime_out; 4398 goto dongle_scantime_out;
4398 } 4399 }
4399 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, 4400 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
4400 scan_unassoc_time); 4401 scan_unassoc_time);
4401 if (err) { 4402 if (err) {
4402 if (err == -EOPNOTSUPP) 4403 if (err == -EOPNOTSUPP)
4403 WL_INFO("Scan unassoc time is not supported\n"); 4404 brcmf_dbg(INFO, "Scan unassoc time is not supported\n");
4404 else 4405 else
4405 WL_ERR("Scan unassoc time error (%d)\n", err); 4406 brcmf_err("Scan unassoc time error (%d)\n", err);
4406 goto dongle_scantime_out; 4407 goto dongle_scantime_out;
4407 } 4408 }
4408 4409
@@ -4410,9 +4411,9 @@ brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
4410 scan_passive_time); 4411 scan_passive_time);
4411 if (err) { 4412 if (err) {
4412 if (err == -EOPNOTSUPP) 4413 if (err == -EOPNOTSUPP)
4413 WL_INFO("Scan passive time is not supported\n"); 4414 brcmf_dbg(INFO, "Scan passive time is not supported\n");
4414 else 4415 else
4415 WL_ERR("Scan passive time error (%d)\n", err); 4416 brcmf_err("Scan passive time error (%d)\n", err);
4416 goto dongle_scantime_out; 4417 goto dongle_scantime_out;
4417 } 4418 }
4418 4419
@@ -4431,12 +4432,12 @@ static s32 wl_update_wiphybands(struct brcmf_cfg80211_info *cfg)
4431 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_PHYLIST, 4432 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_PHYLIST,
4432 &phy_list, sizeof(phy_list)); 4433 &phy_list, sizeof(phy_list));
4433 if (err) { 4434 if (err) {
4434 WL_ERR("error (%d)\n", err); 4435 brcmf_err("error (%d)\n", err);
4435 return err; 4436 return err;
4436 } 4437 }
4437 4438
4438 phy = ((char *)&phy_list)[0]; 4439 phy = ((char *)&phy_list)[0];
4439 WL_INFO("%c phy\n", phy); 4440 brcmf_dbg(INFO, "%c phy\n", phy);
4440 if (phy == 'n' || phy == 'a') { 4441 if (phy == 'n' || phy == 'a') {
4441 wiphy = cfg_to_wiphy(cfg); 4442 wiphy = cfg_to_wiphy(cfg);
4442 wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n; 4443 wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
@@ -4471,8 +4472,8 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
4471 power_mode); 4472 power_mode);
4472 if (err) 4473 if (err)
4473 goto default_conf_out; 4474 goto default_conf_out;
4474 WL_INFO("power save set to %s\n", 4475 brcmf_dbg(INFO, "power save set to %s\n",
4475 (power_mode ? "enabled" : "disabled")); 4476 (power_mode ? "enabled" : "disabled"));
4476 4477
4477 err = brcmf_dongle_roam(ndev, (cfg->roam_on ? 0 : 1), 4478 err = brcmf_dongle_roam(ndev, (cfg->roam_on ? 0 : 1),
4478 WL_BEACON_TIMEOUT); 4479 WL_BEACON_TIMEOUT);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
index d60de187e7d9..e4d9cc7a8e63 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
@@ -17,73 +17,6 @@
17#ifndef _wl_cfg80211_h_ 17#ifndef _wl_cfg80211_h_
18#define _wl_cfg80211_h_ 18#define _wl_cfg80211_h_
19 19
20#define WL_DBG_NONE 0
21#define WL_DBG_CONN (1 << 5)
22#define WL_DBG_SCAN (1 << 4)
23#define WL_DBG_TRACE (1 << 3)
24#define WL_DBG_INFO (1 << 1)
25#define WL_DBG_ERR (1 << 0)
26#define WL_DBG_MASK ((WL_DBG_INFO | WL_DBG_ERR | WL_DBG_TRACE) | \
27 (WL_DBG_SCAN) | (WL_DBG_CONN))
28
29#define WL_ERR(fmt, ...) \
30do { \
31 if (brcmf_dbg_level & WL_DBG_ERR) { \
32 if (net_ratelimit()) { \
33 pr_err("ERROR @%s : " fmt, \
34 __func__, ##__VA_ARGS__); \
35 } \
36 } \
37} while (0)
38
39#if (defined DEBUG)
40#define WL_INFO(fmt, ...) \
41do { \
42 if (brcmf_dbg_level & WL_DBG_INFO) { \
43 if (net_ratelimit()) { \
44 pr_err("INFO @%s : " fmt, \
45 __func__, ##__VA_ARGS__); \
46 } \
47 } \
48} while (0)
49
50#define WL_TRACE(fmt, ...) \
51do { \
52 if (brcmf_dbg_level & WL_DBG_TRACE) { \
53 if (net_ratelimit()) { \
54 pr_err("TRACE @%s : " fmt, \
55 __func__, ##__VA_ARGS__); \
56 } \
57 } \
58} while (0)
59
60#define WL_SCAN(fmt, ...) \
61do { \
62 if (brcmf_dbg_level & WL_DBG_SCAN) { \
63 if (net_ratelimit()) { \
64 pr_err("SCAN @%s : " fmt, \
65 __func__, ##__VA_ARGS__); \
66 } \
67 } \
68} while (0)
69
70#define WL_CONN(fmt, ...) \
71do { \
72 if (brcmf_dbg_level & WL_DBG_CONN) { \
73 if (net_ratelimit()) { \
74 pr_err("CONN @%s : " fmt, \
75 __func__, ##__VA_ARGS__); \
76 } \
77 } \
78} while (0)
79
80#else /* (defined DEBUG) */
81#define WL_INFO(fmt, args...)
82#define WL_TRACE(fmt, args...)
83#define WL_SCAN(fmt, args...)
84#define WL_CONN(fmt, args...)
85#endif /* (defined DEBUG) */
86
87#define WL_NUM_SCAN_MAX 10 20#define WL_NUM_SCAN_MAX 10
88#define WL_NUM_PMKIDS_MAX MAXPMKID 21#define WL_NUM_PMKIDS_MAX MAXPMKID
89#define WL_TLV_INFO_MAX 1024 22#define WL_TLV_INFO_MAX 1024
@@ -450,7 +383,8 @@ brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
450 return &cfg->conn_info; 383 return &cfg->conn_info;
451} 384}
452 385
453struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr); 386struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
387 struct device *busdev);
454void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); 388void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
455s32 brcmf_cfg80211_up(struct net_device *ndev); 389s32 brcmf_cfg80211_up(struct net_device *ndev);
456s32 brcmf_cfg80211_down(struct net_device *ndev); 390s32 brcmf_cfg80211_down(struct net_device *ndev);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index de96290f5ccd..f0888a9ee32e 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -721,7 +721,7 @@ void ai_epa_4313war(struct si_pub *sih)
721/* check if the device is removed */ 721/* check if the device is removed */
722bool ai_deviceremoved(struct si_pub *sih) 722bool ai_deviceremoved(struct si_pub *sih)
723{ 723{
724 u32 w; 724 u32 w = 0;
725 struct si_info *sii; 725 struct si_info *sii;
726 726
727 sii = container_of(sih, struct si_info, pub); 727 sii = container_of(sih, struct si_info, pub);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 02d27eacc0e2..1fbd8ecbe2ea 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -93,6 +93,7 @@ MODULE_FIRMWARE("brcm/bcm43xx_hdr-0.fw");
93 93
94/* recognized BCMA Core IDs */ 94/* recognized BCMA Core IDs */
95static struct bcma_device_id brcms_coreid_table[] = { 95static struct bcma_device_id brcms_coreid_table[] = {
96 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS),
96 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS), 97 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS),
97 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS), 98 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS),
98 BCMA_CORETABLE_END 99 BCMA_CORETABLE_END
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 8fce68751e47..17594de4199e 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -717,7 +717,7 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw)
717 brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs); 717 brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs);
718 718
719 /* do band-specific ucode IHR, SHM, and SCR inits */ 719 /* do band-specific ucode IHR, SHM, and SCR inits */
720 if (D11REV_IS(wlc_hw->corerev, 23)) { 720 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) {
721 if (BRCMS_ISNPHY(wlc_hw->band)) 721 if (BRCMS_ISNPHY(wlc_hw->band))
722 brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); 722 brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16);
723 else 723 else
@@ -2264,7 +2264,7 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw)
2264 if (wlc_hw->ucode_loaded) 2264 if (wlc_hw->ucode_loaded)
2265 return; 2265 return;
2266 2266
2267 if (D11REV_IS(wlc_hw->corerev, 23)) { 2267 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) {
2268 if (BRCMS_ISNPHY(wlc_hw->band)) { 2268 if (BRCMS_ISNPHY(wlc_hw->band)) {
2269 brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo, 2269 brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo,
2270 ucode->bcm43xx_16_mimosz); 2270 ucode->bcm43xx_16_mimosz);
@@ -2920,7 +2920,7 @@ brcms_b_write_objmem(struct brcms_hardware *wlc_hw, uint offset, u16 v,
2920 if (offset & 2) 2920 if (offset & 2)
2921 objoff += 2; 2921 objoff += 2;
2922 2922
2923 bcma_write16(core, objoff, v); 2923 bcma_wflush16(core, objoff, v);
2924} 2924}
2925 2925
2926/* 2926/*
@@ -3216,7 +3216,7 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)
3216 3216
3217 sflags = bcma_aread32(core, BCMA_IOST); 3217 sflags = bcma_aread32(core, BCMA_IOST);
3218 3218
3219 if (D11REV_IS(wlc_hw->corerev, 23)) { 3219 if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) {
3220 if (BRCMS_ISNPHY(wlc_hw->band)) 3220 if (BRCMS_ISNPHY(wlc_hw->band))
3221 brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); 3221 brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16);
3222 else 3222 else
@@ -4500,7 +4500,8 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
4500 4500
4501 /* check device id(srom, nvram etc.) to set bands */ 4501 /* check device id(srom, nvram etc.) to set bands */
4502 if (wlc_hw->deviceid == BCM43224_D11N_ID || 4502 if (wlc_hw->deviceid == BCM43224_D11N_ID ||
4503 wlc_hw->deviceid == BCM43224_D11N_ID_VEN1) 4503 wlc_hw->deviceid == BCM43224_D11N_ID_VEN1 ||
4504 wlc_hw->deviceid == BCM43224_CHIP_ID)
4504 /* Dualband boards */ 4505 /* Dualband boards */
4505 wlc_hw->_nbands = 2; 4506 wlc_hw->_nbands = 2;
4506 else 4507 else
@@ -5653,7 +5654,7 @@ static bool brcms_c_chipmatch_pci(struct bcma_device *core)
5653 return false; 5654 return false;
5654 } 5655 }
5655 5656
5656 if (device == BCM43224_D11N_ID_VEN1) 5657 if (device == BCM43224_D11N_ID_VEN1 || device == BCM43224_CHIP_ID)
5657 return true; 5658 return true;
5658 if ((device == BCM43224_D11N_ID) || (device == BCM43225_D11N2G_ID)) 5659 if ((device == BCM43224_D11N_ID) || (device == BCM43225_D11N2G_ID))
5659 return true; 5660 return true;
diff --git a/drivers/net/wireless/iwlwifi/dvm/calib.c b/drivers/net/wireless/iwlwifi/dvm/calib.c
index f2dd671d7dc8..de54713b680c 100644
--- a/drivers/net/wireless/iwlwifi/dvm/calib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/calib.c
@@ -833,14 +833,14 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
833 * To be safe, simply mask out any chains that we know 833 * To be safe, simply mask out any chains that we know
834 * are not on the device. 834 * are not on the device.
835 */ 835 */
836 active_chains &= priv->eeprom_data->valid_rx_ant; 836 active_chains &= priv->nvm_data->valid_rx_ant;
837 837
838 num_tx_chains = 0; 838 num_tx_chains = 0;
839 for (i = 0; i < NUM_RX_CHAINS; i++) { 839 for (i = 0; i < NUM_RX_CHAINS; i++) {
840 /* loops on all the bits of 840 /* loops on all the bits of
841 * priv->hw_setting.valid_tx_ant */ 841 * priv->hw_setting.valid_tx_ant */
842 u8 ant_msk = (1 << i); 842 u8 ant_msk = (1 << i);
843 if (!(priv->eeprom_data->valid_tx_ant & ant_msk)) 843 if (!(priv->nvm_data->valid_tx_ant & ant_msk))
844 continue; 844 continue;
845 845
846 num_tx_chains++; 846 num_tx_chains++;
@@ -854,7 +854,7 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
854 * connect the first valid tx chain 854 * connect the first valid tx chain
855 */ 855 */
856 first_chain = 856 first_chain =
857 find_first_chain(priv->eeprom_data->valid_tx_ant); 857 find_first_chain(priv->nvm_data->valid_tx_ant);
858 data->disconn_array[first_chain] = 0; 858 data->disconn_array[first_chain] = 0;
859 active_chains |= BIT(first_chain); 859 active_chains |= BIT(first_chain);
860 IWL_DEBUG_CALIB(priv, 860 IWL_DEBUG_CALIB(priv,
@@ -864,13 +864,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
864 } 864 }
865 } 865 }
866 866
867 if (active_chains != priv->eeprom_data->valid_rx_ant && 867 if (active_chains != priv->nvm_data->valid_rx_ant &&
868 active_chains != priv->chain_noise_data.active_chains) 868 active_chains != priv->chain_noise_data.active_chains)
869 IWL_DEBUG_CALIB(priv, 869 IWL_DEBUG_CALIB(priv,
870 "Detected that not all antennas are connected! " 870 "Detected that not all antennas are connected! "
871 "Connected: %#x, valid: %#x.\n", 871 "Connected: %#x, valid: %#x.\n",
872 active_chains, 872 active_chains,
873 priv->eeprom_data->valid_rx_ant); 873 priv->nvm_data->valid_rx_ant);
874 874
875 /* Save for use within RXON, TX, SCAN commands, etc. */ 875 /* Save for use within RXON, TX, SCAN commands, etc. */
876 data->active_chains = active_chains; 876 data->active_chains = active_chains;
@@ -1055,7 +1055,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
1055 priv->cfg->bt_params->advanced_bt_coexist) { 1055 priv->cfg->bt_params->advanced_bt_coexist) {
1056 /* Disable disconnected antenna algorithm for advanced 1056 /* Disable disconnected antenna algorithm for advanced
1057 bt coex, assuming valid antennas are connected */ 1057 bt coex, assuming valid antennas are connected */
1058 data->active_chains = priv->eeprom_data->valid_rx_ant; 1058 data->active_chains = priv->nvm_data->valid_rx_ant;
1059 for (i = 0; i < NUM_RX_CHAINS; i++) 1059 for (i = 0; i < NUM_RX_CHAINS; i++)
1060 if (!(data->active_chains & (1<<i))) 1060 if (!(data->active_chains & (1<<i)))
1061 data->disconn_array[i] = 1; 1061 data->disconn_array[i] = 1;
@@ -1086,7 +1086,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
1086 1086
1087 iwlagn_gain_computation( 1087 iwlagn_gain_computation(
1088 priv, average_noise, 1088 priv, average_noise,
1089 find_first_chain(priv->eeprom_data->valid_rx_ant)); 1089 find_first_chain(priv->nvm_data->valid_rx_ant));
1090 1090
1091 /* Some power changes may have been made during the calibration. 1091 /* Some power changes may have been made during the calibration.
1092 * Update and commit the RXON 1092 * Update and commit the RXON
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
index 769a08bca86f..5b9533eef54d 100644
--- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
@@ -305,7 +305,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
305 int pos = 0, ofs = 0, buf_size = 0; 305 int pos = 0, ofs = 0, buf_size = 0;
306 const u8 *ptr; 306 const u8 *ptr;
307 char *buf; 307 char *buf;
308 u16 eeprom_ver; 308 u16 nvm_ver;
309 size_t eeprom_len = priv->eeprom_blob_size; 309 size_t eeprom_len = priv->eeprom_blob_size;
310 buf_size = 4 * eeprom_len + 256; 310 buf_size = 4 * eeprom_len + 256;
311 311
@@ -321,9 +321,9 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
321 if (!buf) 321 if (!buf)
322 return -ENOMEM; 322 return -ENOMEM;
323 323
324 eeprom_ver = priv->eeprom_data->eeprom_version; 324 nvm_ver = priv->nvm_data->nvm_version;
325 pos += scnprintf(buf + pos, buf_size - pos, 325 pos += scnprintf(buf + pos, buf_size - pos,
326 "NVM version: 0x%x\n", eeprom_ver); 326 "NVM version: 0x%x\n", nvm_ver);
327 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { 327 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
328 pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); 328 pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
329 hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos, 329 hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
@@ -1333,17 +1333,17 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1333 if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) { 1333 if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) {
1334 pos += scnprintf(buf + pos, bufsz - pos, 1334 pos += scnprintf(buf + pos, bufsz - pos,
1335 "tx power: (1/2 dB step)\n"); 1335 "tx power: (1/2 dB step)\n");
1336 if ((priv->eeprom_data->valid_tx_ant & ANT_A) && 1336 if ((priv->nvm_data->valid_tx_ant & ANT_A) &&
1337 tx->tx_power.ant_a) 1337 tx->tx_power.ant_a)
1338 pos += scnprintf(buf + pos, bufsz - pos, 1338 pos += scnprintf(buf + pos, bufsz - pos,
1339 fmt_hex, "antenna A:", 1339 fmt_hex, "antenna A:",
1340 tx->tx_power.ant_a); 1340 tx->tx_power.ant_a);
1341 if ((priv->eeprom_data->valid_tx_ant & ANT_B) && 1341 if ((priv->nvm_data->valid_tx_ant & ANT_B) &&
1342 tx->tx_power.ant_b) 1342 tx->tx_power.ant_b)
1343 pos += scnprintf(buf + pos, bufsz - pos, 1343 pos += scnprintf(buf + pos, bufsz - pos,
1344 fmt_hex, "antenna B:", 1344 fmt_hex, "antenna B:",
1345 tx->tx_power.ant_b); 1345 tx->tx_power.ant_b);
1346 if ((priv->eeprom_data->valid_tx_ant & ANT_C) && 1346 if ((priv->nvm_data->valid_tx_ant & ANT_C) &&
1347 tx->tx_power.ant_c) 1347 tx->tx_power.ant_c)
1348 pos += scnprintf(buf + pos, bufsz - pos, 1348 pos += scnprintf(buf + pos, bufsz - pos,
1349 fmt_hex, "antenna C:", 1349 fmt_hex, "antenna C:",
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h
index 29c571a56251..2653a891cc7e 100644
--- a/drivers/net/wireless/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h
@@ -843,7 +843,7 @@ struct iwl_priv {
843 void *wowlan_sram; 843 void *wowlan_sram;
844#endif /* CONFIG_IWLWIFI_DEBUGFS */ 844#endif /* CONFIG_IWLWIFI_DEBUGFS */
845 845
846 struct iwl_eeprom_data *eeprom_data; 846 struct iwl_nvm_data *nvm_data;
847 /* eeprom blob for debugfs/testmode */ 847 /* eeprom blob for debugfs/testmode */
848 u8 *eeprom_blob; 848 u8 *eeprom_blob;
849 size_t eeprom_blob_size; 849 size_t eeprom_blob_size;
diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c
index da5862064195..8c72be3f37c1 100644
--- a/drivers/net/wireless/iwlwifi/dvm/devices.c
+++ b/drivers/net/wireless/iwlwifi/dvm/devices.c
@@ -305,8 +305,8 @@ static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
305{ 305{
306 u16 temperature, voltage; 306 u16 temperature, voltage;
307 307
308 temperature = le16_to_cpu(priv->eeprom_data->kelvin_temperature); 308 temperature = le16_to_cpu(priv->nvm_data->kelvin_temperature);
309 voltage = le16_to_cpu(priv->eeprom_data->kelvin_voltage); 309 voltage = le16_to_cpu(priv->nvm_data->kelvin_voltage);
310 310
311 /* offset = temp - volt / coeff */ 311 /* offset = temp - volt / coeff */
312 return (s32)(temperature - 312 return (s32)(temperature -
@@ -460,13 +460,13 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
460 break; 460 break;
461 case IWL_DEVICE_FAMILY_6050: 461 case IWL_DEVICE_FAMILY_6050:
462 /* Indicate calibration version to uCode. */ 462 /* Indicate calibration version to uCode. */
463 if (priv->eeprom_data->calib_version >= 6) 463 if (priv->nvm_data->calib_version >= 6)
464 iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, 464 iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
465 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); 465 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
466 break; 466 break;
467 case IWL_DEVICE_FAMILY_6150: 467 case IWL_DEVICE_FAMILY_6150:
468 /* Indicate calibration version to uCode. */ 468 /* Indicate calibration version to uCode. */
469 if (priv->eeprom_data->calib_version >= 6) 469 if (priv->nvm_data->calib_version >= 6)
470 iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, 470 iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
471 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); 471 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
472 iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, 472 iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c
index 7e59be4b89b8..6ff46605ad4f 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -59,7 +59,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
59 /* half dBm need to multiply */ 59 /* half dBm need to multiply */
60 tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt); 60 tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);
61 61
62 if (tx_power_cmd.global_lmt > priv->eeprom_data->max_tx_pwr_half_dbm) { 62 if (tx_power_cmd.global_lmt > priv->nvm_data->max_tx_pwr_half_dbm) {
63 /* 63 /*
64 * For the newer devices which using enhanced/extend tx power 64 * For the newer devices which using enhanced/extend tx power
65 * table in EEPROM, the format is in half dBm. driver need to 65 * table in EEPROM, the format is in half dBm. driver need to
@@ -72,7 +72,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
72 * half-dBm format), lower the tx power based on EEPROM 72 * half-dBm format), lower the tx power based on EEPROM
73 */ 73 */
74 tx_power_cmd.global_lmt = 74 tx_power_cmd.global_lmt =
75 priv->eeprom_data->max_tx_pwr_half_dbm; 75 priv->nvm_data->max_tx_pwr_half_dbm;
76 } 76 }
77 tx_power_cmd.flags = IWLAGN_TX_POWER_NO_CLOSED; 77 tx_power_cmd.flags = IWLAGN_TX_POWER_NO_CLOSED;
78 tx_power_cmd.srv_chan_lmt = IWLAGN_TX_POWER_AUTO; 78 tx_power_cmd.srv_chan_lmt = IWLAGN_TX_POWER_AUTO;
@@ -159,7 +159,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv)
159 IWL_PAN_SCD_MGMT_MSK | 159 IWL_PAN_SCD_MGMT_MSK |
160 IWL_PAN_SCD_MULTICAST_MSK; 160 IWL_PAN_SCD_MULTICAST_MSK;
161 161
162 if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE) 162 if (priv->nvm_data->sku_cap_11n_enable)
163 flush_cmd.queue_control |= IWL_AGG_TX_QUEUE_MSK; 163 flush_cmd.queue_control |= IWL_AGG_TX_QUEUE_MSK;
164 164
165 IWL_DEBUG_INFO(priv, "queue control: 0x%x\n", 165 IWL_DEBUG_INFO(priv, "queue control: 0x%x\n",
@@ -825,7 +825,7 @@ void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
825 if (priv->chain_noise_data.active_chains) 825 if (priv->chain_noise_data.active_chains)
826 active_chains = priv->chain_noise_data.active_chains; 826 active_chains = priv->chain_noise_data.active_chains;
827 else 827 else
828 active_chains = priv->eeprom_data->valid_rx_ant; 828 active_chains = priv->nvm_data->valid_rx_ant;
829 829
830 if (priv->cfg->bt_params && 830 if (priv->cfg->bt_params &&
831 priv->cfg->bt_params->advanced_bt_coexist && 831 priv->cfg->bt_params->advanced_bt_coexist &&
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index fb959b00b208..3163e0f38c25 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -164,7 +164,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
164 hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; 164 hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
165 */ 165 */
166 166
167 if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE) 167 if (priv->nvm_data->sku_cap_11n_enable)
168 hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | 168 hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
169 IEEE80211_HW_SUPPORTS_STATIC_SMPS; 169 IEEE80211_HW_SUPPORTS_STATIC_SMPS;
170 170
@@ -242,12 +242,12 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
242 242
243 hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; 243 hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
244 244
245 if (priv->eeprom_data->bands[IEEE80211_BAND_2GHZ].n_channels) 245 if (priv->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels)
246 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 246 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
247 &priv->eeprom_data->bands[IEEE80211_BAND_2GHZ]; 247 &priv->nvm_data->bands[IEEE80211_BAND_2GHZ];
248 if (priv->eeprom_data->bands[IEEE80211_BAND_5GHZ].n_channels) 248 if (priv->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels)
249 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 249 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
250 &priv->eeprom_data->bands[IEEE80211_BAND_5GHZ]; 250 &priv->nvm_data->bands[IEEE80211_BAND_5GHZ];
251 251
252 hw->wiphy->hw_version = priv->trans->hw_id; 252 hw->wiphy->hw_version = priv->trans->hw_id;
253 253
@@ -654,7 +654,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
654 IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", 654 IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
655 sta->addr, tid); 655 sta->addr, tid);
656 656
657 if (!(priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE)) 657 if (!(priv->nvm_data->sku_cap_11n_enable))
658 return -EACCES; 658 return -EACCES;
659 659
660 IWL_DEBUG_MAC80211(priv, "enter\n"); 660 IWL_DEBUG_MAC80211(priv, "enter\n");
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c
index e3a07c916812..faa05932efae 100644
--- a/drivers/net/wireless/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
@@ -185,7 +185,7 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
185 rate = info->control.rates[0].idx; 185 rate = info->control.rates[0].idx;
186 186
187 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, 187 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
188 priv->eeprom_data->valid_tx_ant); 188 priv->nvm_data->valid_tx_ant);
189 rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant); 189 rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
190 190
191 /* In mac80211, rates for 5 GHz start at 0 */ 191 /* In mac80211, rates for 5 GHz start at 0 */
@@ -776,7 +776,7 @@ int iwl_alive_start(struct iwl_priv *priv)
776 ieee80211_wake_queues(priv->hw); 776 ieee80211_wake_queues(priv->hw);
777 777
778 /* Configure Tx antenna selection based on H/W config */ 778 /* Configure Tx antenna selection based on H/W config */
779 iwlagn_send_tx_ant_config(priv, priv->eeprom_data->valid_tx_ant); 779 iwlagn_send_tx_ant_config(priv, priv->nvm_data->valid_tx_ant);
780 780
781 if (iwl_is_associated_ctx(ctx) && !priv->wowlan) { 781 if (iwl_is_associated_ctx(ctx) && !priv->wowlan) {
782 struct iwl_rxon_cmd *active_rxon = 782 struct iwl_rxon_cmd *active_rxon =
@@ -1191,30 +1191,38 @@ static void iwl_option_config(struct iwl_priv *priv)
1191 1191
1192static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) 1192static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
1193{ 1193{
1194 if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE && 1194 struct iwl_nvm_data *data = priv->nvm_data;
1195 char *debug_msg;
1196
1197 if (data->sku_cap_11n_enable &&
1195 !priv->cfg->ht_params) { 1198 !priv->cfg->ht_params) {
1196 IWL_ERR(priv, "Invalid 11n configuration\n"); 1199 IWL_ERR(priv, "Invalid 11n configuration\n");
1197 return -EINVAL; 1200 return -EINVAL;
1198 } 1201 }
1199 1202
1200 if (!priv->eeprom_data->sku) { 1203 if (!data->sku_cap_11n_enable && !data->sku_cap_band_24GHz_enable &&
1204 !data->sku_cap_band_52GHz_enable) {
1201 IWL_ERR(priv, "Invalid device sku\n"); 1205 IWL_ERR(priv, "Invalid device sku\n");
1202 return -EINVAL; 1206 return -EINVAL;
1203 } 1207 }
1204 1208
1205 IWL_DEBUG_INFO(priv, "Device SKU: 0x%X\n", priv->eeprom_data->sku); 1209 debug_msg = "Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n";
1210 IWL_DEBUG_INFO(priv, debug_msg,
1211 data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled",
1212 data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled",
1213 data->sku_cap_11n_enable ? "" : "NOT", "enabled");
1206 1214
1207 priv->hw_params.tx_chains_num = 1215 priv->hw_params.tx_chains_num =
1208 num_of_ant(priv->eeprom_data->valid_tx_ant); 1216 num_of_ant(data->valid_tx_ant);
1209 if (priv->cfg->rx_with_siso_diversity) 1217 if (priv->cfg->rx_with_siso_diversity)
1210 priv->hw_params.rx_chains_num = 1; 1218 priv->hw_params.rx_chains_num = 1;
1211 else 1219 else
1212 priv->hw_params.rx_chains_num = 1220 priv->hw_params.rx_chains_num =
1213 num_of_ant(priv->eeprom_data->valid_rx_ant); 1221 num_of_ant(data->valid_rx_ant);
1214 1222
1215 IWL_DEBUG_INFO(priv, "Valid Tx ant: 0x%X, Valid Rx ant: 0x%X\n", 1223 IWL_DEBUG_INFO(priv, "Valid Tx ant: 0x%X, Valid Rx ant: 0x%X\n",
1216 priv->eeprom_data->valid_tx_ant, 1224 data->valid_tx_ant,
1217 priv->eeprom_data->valid_rx_ant); 1225 data->valid_rx_ant);
1218 1226
1219 return 0; 1227 return 0;
1220} 1228}
@@ -1374,24 +1382,24 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1374 /* Reset chip to save power until we load uCode during "up". */ 1382 /* Reset chip to save power until we load uCode during "up". */
1375 iwl_trans_stop_hw(priv->trans, false); 1383 iwl_trans_stop_hw(priv->trans, false);
1376 1384
1377 priv->eeprom_data = iwl_parse_eeprom_data(priv->trans->dev, priv->cfg, 1385 priv->nvm_data = iwl_parse_eeprom_data(priv->trans->dev, priv->cfg,
1378 priv->eeprom_blob, 1386 priv->eeprom_blob,
1379 priv->eeprom_blob_size); 1387 priv->eeprom_blob_size);
1380 if (!priv->eeprom_data) 1388 if (!priv->nvm_data)
1381 goto out_free_eeprom_blob; 1389 goto out_free_eeprom_blob;
1382 1390
1383 if (iwl_eeprom_check_version(priv->eeprom_data, priv->trans)) 1391 if (iwl_nvm_check_version(priv->nvm_data, priv->trans))
1384 goto out_free_eeprom; 1392 goto out_free_eeprom;
1385 1393
1386 if (iwl_eeprom_init_hw_params(priv)) 1394 if (iwl_eeprom_init_hw_params(priv))
1387 goto out_free_eeprom; 1395 goto out_free_eeprom;
1388 1396
1389 /* extract MAC Address */ 1397 /* extract MAC Address */
1390 memcpy(priv->addresses[0].addr, priv->eeprom_data->hw_addr, ETH_ALEN); 1398 memcpy(priv->addresses[0].addr, priv->nvm_data->hw_addr, ETH_ALEN);
1391 IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); 1399 IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr);
1392 priv->hw->wiphy->addresses = priv->addresses; 1400 priv->hw->wiphy->addresses = priv->addresses;
1393 priv->hw->wiphy->n_addresses = 1; 1401 priv->hw->wiphy->n_addresses = 1;
1394 num_mac = priv->eeprom_data->n_hw_addrs; 1402 num_mac = priv->nvm_data->n_hw_addrs;
1395 if (num_mac > 1) { 1403 if (num_mac > 1) {
1396 memcpy(priv->addresses[1].addr, priv->addresses[0].addr, 1404 memcpy(priv->addresses[1].addr, priv->addresses[0].addr,
1397 ETH_ALEN); 1405 ETH_ALEN);
@@ -1404,7 +1412,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1404 ************************/ 1412 ************************/
1405 iwl_set_hw_params(priv); 1413 iwl_set_hw_params(priv);
1406 1414
1407 if (!(priv->eeprom_data->sku & EEPROM_SKU_CAP_IPAN_ENABLE)) { 1415 if (!(priv->nvm_data->sku_cap_ipan_enable)) {
1408 IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN"); 1416 IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN");
1409 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; 1417 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
1410 /* 1418 /*
@@ -1486,7 +1494,7 @@ out_destroy_workqueue:
1486out_free_eeprom_blob: 1494out_free_eeprom_blob:
1487 kfree(priv->eeprom_blob); 1495 kfree(priv->eeprom_blob);
1488out_free_eeprom: 1496out_free_eeprom:
1489 iwl_free_eeprom_data(priv->eeprom_data); 1497 iwl_free_nvm_data(priv->nvm_data);
1490out_free_hw: 1498out_free_hw:
1491 ieee80211_free_hw(priv->hw); 1499 ieee80211_free_hw(priv->hw);
1492out: 1500out:
@@ -1506,7 +1514,7 @@ static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode)
1506 iwl_tt_exit(priv); 1514 iwl_tt_exit(priv);
1507 1515
1508 kfree(priv->eeprom_blob); 1516 kfree(priv->eeprom_blob);
1509 iwl_free_eeprom_data(priv->eeprom_data); 1517 iwl_free_nvm_data(priv->nvm_data);
1510 1518
1511 /*netif_stop_queue(dev); */ 1519 /*netif_stop_queue(dev); */
1512 flush_workqueue(priv->workqueue); 1520 flush_workqueue(priv->workqueue);
@@ -1980,7 +1988,6 @@ static void iwl_cmd_queue_full(struct iwl_op_mode *op_mode)
1980static void iwl_nic_config(struct iwl_op_mode *op_mode) 1988static void iwl_nic_config(struct iwl_op_mode *op_mode)
1981{ 1989{
1982 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); 1990 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
1983 u16 radio_cfg = priv->eeprom_data->radio_cfg;
1984 1991
1985 /* SKU Control */ 1992 /* SKU Control */
1986 iwl_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG, 1993 iwl_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG,
@@ -1992,13 +1999,13 @@ static void iwl_nic_config(struct iwl_op_mode *op_mode)
1992 CSR_HW_IF_CONFIG_REG_POS_MAC_DASH)); 1999 CSR_HW_IF_CONFIG_REG_POS_MAC_DASH));
1993 2000
1994 /* write radio config values to register */ 2001 /* write radio config values to register */
1995 if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) { 2002 if (priv->nvm_data->radio_cfg_type <= EEPROM_RF_CONFIG_TYPE_MAX) {
1996 u32 reg_val = 2003 u32 reg_val =
1997 EEPROM_RF_CFG_TYPE_MSK(radio_cfg) << 2004 priv->nvm_data->radio_cfg_type <<
1998 CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE | 2005 CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE |
1999 EEPROM_RF_CFG_STEP_MSK(radio_cfg) << 2006 priv->nvm_data->radio_cfg_step <<
2000 CSR_HW_IF_CONFIG_REG_POS_PHY_STEP | 2007 CSR_HW_IF_CONFIG_REG_POS_PHY_STEP |
2001 EEPROM_RF_CFG_DASH_MSK(radio_cfg) << 2008 priv->nvm_data->radio_cfg_dash <<
2002 CSR_HW_IF_CONFIG_REG_POS_PHY_DASH; 2009 CSR_HW_IF_CONFIG_REG_POS_PHY_DASH;
2003 2010
2004 iwl_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG, 2011 iwl_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG,
@@ -2007,9 +2014,9 @@ static void iwl_nic_config(struct iwl_op_mode *op_mode)
2007 CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH, reg_val); 2014 CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH, reg_val);
2008 2015
2009 IWL_INFO(priv, "Radio type=0x%x-0x%x-0x%x\n", 2016 IWL_INFO(priv, "Radio type=0x%x-0x%x-0x%x\n",
2010 EEPROM_RF_CFG_TYPE_MSK(radio_cfg), 2017 priv->nvm_data->radio_cfg_type,
2011 EEPROM_RF_CFG_STEP_MSK(radio_cfg), 2018 priv->nvm_data->radio_cfg_step,
2012 EEPROM_RF_CFG_DASH_MSK(radio_cfg)); 2019 priv->nvm_data->radio_cfg_dash);
2013 } else { 2020 } else {
2014 WARN_ON(1); 2021 WARN_ON(1);
2015 } 2022 }
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c
index a82f46c10f5e..f3dd0da60d8a 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rs.c
@@ -820,7 +820,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
820 820
821 if (num_of_ant(tbl->ant_type) > 1) 821 if (num_of_ant(tbl->ant_type) > 1)
822 tbl->ant_type = 822 tbl->ant_type =
823 first_antenna(priv->eeprom_data->valid_tx_ant); 823 first_antenna(priv->nvm_data->valid_tx_ant);
824 824
825 tbl->is_ht40 = 0; 825 tbl->is_ht40 = 0;
826 tbl->is_SGI = 0; 826 tbl->is_SGI = 0;
@@ -1448,7 +1448,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1448 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1448 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1449 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1449 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1450 u8 start_action; 1450 u8 start_action;
1451 u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant; 1451 u8 valid_tx_ant = priv->nvm_data->valid_tx_ant;
1452 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1452 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1453 int ret = 0; 1453 int ret = 0;
1454 u8 update_search_tbl_counter = 0; 1454 u8 update_search_tbl_counter = 0;
@@ -1466,7 +1466,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1466 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: 1466 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
1467 /* avoid antenna B and MIMO */ 1467 /* avoid antenna B and MIMO */
1468 valid_tx_ant = 1468 valid_tx_ant =
1469 first_antenna(priv->eeprom_data->valid_tx_ant); 1469 first_antenna(priv->nvm_data->valid_tx_ant);
1470 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 && 1470 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 &&
1471 tbl->action != IWL_LEGACY_SWITCH_SISO) 1471 tbl->action != IWL_LEGACY_SWITCH_SISO)
1472 tbl->action = IWL_LEGACY_SWITCH_SISO; 1472 tbl->action = IWL_LEGACY_SWITCH_SISO;
@@ -1490,7 +1490,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1490 else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) 1490 else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
1491 tbl->action = IWL_LEGACY_SWITCH_SISO; 1491 tbl->action = IWL_LEGACY_SWITCH_SISO;
1492 valid_tx_ant = 1492 valid_tx_ant =
1493 first_antenna(priv->eeprom_data->valid_tx_ant); 1493 first_antenna(priv->nvm_data->valid_tx_ant);
1494 } 1494 }
1495 1495
1496 start_action = tbl->action; 1496 start_action = tbl->action;
@@ -1624,7 +1624,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1624 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1624 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1625 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1625 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1626 u8 start_action; 1626 u8 start_action;
1627 u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant; 1627 u8 valid_tx_ant = priv->nvm_data->valid_tx_ant;
1628 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1628 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1629 u8 update_search_tbl_counter = 0; 1629 u8 update_search_tbl_counter = 0;
1630 int ret; 1630 int ret;
@@ -1642,7 +1642,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1642 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: 1642 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
1643 /* avoid antenna B and MIMO */ 1643 /* avoid antenna B and MIMO */
1644 valid_tx_ant = 1644 valid_tx_ant =
1645 first_antenna(priv->eeprom_data->valid_tx_ant); 1645 first_antenna(priv->nvm_data->valid_tx_ant);
1646 if (tbl->action != IWL_SISO_SWITCH_ANTENNA1) 1646 if (tbl->action != IWL_SISO_SWITCH_ANTENNA1)
1647 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1647 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
1648 break; 1648 break;
@@ -1660,7 +1660,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1660 /* configure as 1x1 if bt full concurrency */ 1660 /* configure as 1x1 if bt full concurrency */
1661 if (priv->bt_full_concurrent) { 1661 if (priv->bt_full_concurrent) {
1662 valid_tx_ant = 1662 valid_tx_ant =
1663 first_antenna(priv->eeprom_data->valid_tx_ant); 1663 first_antenna(priv->nvm_data->valid_tx_ant);
1664 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) 1664 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
1665 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1665 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
1666 } 1666 }
@@ -1796,7 +1796,7 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv,
1796 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1796 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1797 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1797 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1798 u8 start_action; 1798 u8 start_action;
1799 u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant; 1799 u8 valid_tx_ant = priv->nvm_data->valid_tx_ant;
1800 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1800 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1801 u8 update_search_tbl_counter = 0; 1801 u8 update_search_tbl_counter = 0;
1802 int ret; 1802 int ret;
@@ -1966,7 +1966,7 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv,
1966 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1966 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1967 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1967 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1968 u8 start_action; 1968 u8 start_action;
1969 u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant; 1969 u8 valid_tx_ant = priv->nvm_data->valid_tx_ant;
1970 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1970 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1971 int ret; 1971 int ret;
1972 u8 update_search_tbl_counter = 0; 1972 u8 update_search_tbl_counter = 0;
@@ -2700,7 +2700,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2700 2700
2701 i = lq_sta->last_txrate_idx; 2701 i = lq_sta->last_txrate_idx;
2702 2702
2703 valid_tx_ant = priv->eeprom_data->valid_tx_ant; 2703 valid_tx_ant = priv->nvm_data->valid_tx_ant;
2704 2704
2705 if (!lq_sta->search_better_tbl) 2705 if (!lq_sta->search_better_tbl)
2706 active_tbl = lq_sta->active_tbl; 2706 active_tbl = lq_sta->active_tbl;
@@ -2894,15 +2894,15 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
2894 2894
2895 /* These values will be overridden later */ 2895 /* These values will be overridden later */
2896 lq_sta->lq.general_params.single_stream_ant_msk = 2896 lq_sta->lq.general_params.single_stream_ant_msk =
2897 first_antenna(priv->eeprom_data->valid_tx_ant); 2897 first_antenna(priv->nvm_data->valid_tx_ant);
2898 lq_sta->lq.general_params.dual_stream_ant_msk = 2898 lq_sta->lq.general_params.dual_stream_ant_msk =
2899 priv->eeprom_data->valid_tx_ant & 2899 priv->nvm_data->valid_tx_ant &
2900 ~first_antenna(priv->eeprom_data->valid_tx_ant); 2900 ~first_antenna(priv->nvm_data->valid_tx_ant);
2901 if (!lq_sta->lq.general_params.dual_stream_ant_msk) { 2901 if (!lq_sta->lq.general_params.dual_stream_ant_msk) {
2902 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; 2902 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
2903 } else if (num_of_ant(priv->eeprom_data->valid_tx_ant) == 2) { 2903 } else if (num_of_ant(priv->nvm_data->valid_tx_ant) == 2) {
2904 lq_sta->lq.general_params.dual_stream_ant_msk = 2904 lq_sta->lq.general_params.dual_stream_ant_msk =
2905 priv->eeprom_data->valid_tx_ant; 2905 priv->nvm_data->valid_tx_ant;
2906 } 2906 }
2907 2907
2908 /* as default allow aggregation for all tids */ 2908 /* as default allow aggregation for all tids */
@@ -2948,7 +2948,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
2948 if (priv && priv->bt_full_concurrent) { 2948 if (priv && priv->bt_full_concurrent) {
2949 /* 1x1 only */ 2949 /* 1x1 only */
2950 tbl_type.ant_type = 2950 tbl_type.ant_type =
2951 first_antenna(priv->eeprom_data->valid_tx_ant); 2951 first_antenna(priv->nvm_data->valid_tx_ant);
2952 } 2952 }
2953 2953
2954 /* How many times should we repeat the initial rate? */ 2954 /* How many times should we repeat the initial rate? */
@@ -2980,7 +2980,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
2980 if (priv->bt_full_concurrent) 2980 if (priv->bt_full_concurrent)
2981 valid_tx_ant = ANT_A; 2981 valid_tx_ant = ANT_A;
2982 else 2982 else
2983 valid_tx_ant = priv->eeprom_data->valid_tx_ant; 2983 valid_tx_ant = priv->nvm_data->valid_tx_ant;
2984 } 2984 }
2985 2985
2986 /* Fill rest of rate table */ 2986 /* Fill rest of rate table */
@@ -3014,7 +3014,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
3014 if (priv && priv->bt_full_concurrent) { 3014 if (priv && priv->bt_full_concurrent) {
3015 /* 1x1 only */ 3015 /* 1x1 only */
3016 tbl_type.ant_type = 3016 tbl_type.ant_type =
3017 first_antenna(priv->eeprom_data->valid_tx_ant); 3017 first_antenna(priv->nvm_data->valid_tx_ant);
3018 } 3018 }
3019 3019
3020 /* Indicate to uCode which entries might be MIMO. 3020 /* Indicate to uCode which entries might be MIMO.
@@ -3101,7 +3101,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
3101 u8 ant_sel_tx; 3101 u8 ant_sel_tx;
3102 3102
3103 priv = lq_sta->drv; 3103 priv = lq_sta->drv;
3104 valid_tx_ant = priv->eeprom_data->valid_tx_ant; 3104 valid_tx_ant = priv->nvm_data->valid_tx_ant;
3105 if (lq_sta->dbg_fixed_rate) { 3105 if (lq_sta->dbg_fixed_rate) {
3106 ant_sel_tx = 3106 ant_sel_tx =
3107 ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) 3107 ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK)
@@ -3172,9 +3172,9 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
3172 desc += sprintf(buff+desc, "fixed rate 0x%X\n", 3172 desc += sprintf(buff+desc, "fixed rate 0x%X\n",
3173 lq_sta->dbg_fixed_rate); 3173 lq_sta->dbg_fixed_rate);
3174 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", 3174 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n",
3175 (priv->eeprom_data->valid_tx_ant & ANT_A) ? "ANT_A," : "", 3175 (priv->nvm_data->valid_tx_ant & ANT_A) ? "ANT_A," : "",
3176 (priv->eeprom_data->valid_tx_ant & ANT_B) ? "ANT_B," : "", 3176 (priv->nvm_data->valid_tx_ant & ANT_B) ? "ANT_B," : "",
3177 (priv->eeprom_data->valid_tx_ant & ANT_C) ? "ANT_C" : ""); 3177 (priv->nvm_data->valid_tx_ant & ANT_C) ? "ANT_C" : "");
3178 desc += sprintf(buff+desc, "lq type %s\n", 3178 desc += sprintf(buff+desc, "lq type %s\n",
3179 (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); 3179 (is_legacy(tbl->lq_type)) ? "legacy" : "HT");
3180 if (is_Ht(tbl->lq_type)) { 3180 if (is_Ht(tbl->lq_type)) {
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
index 2830ea290502..9a891e6e60e8 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
@@ -420,10 +420,10 @@ static int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
420 return -EINVAL; 420 return -EINVAL;
421 } 421 }
422 422
423 if (tx_power > DIV_ROUND_UP(priv->eeprom_data->max_tx_pwr_half_dbm, 2)) { 423 if (tx_power > DIV_ROUND_UP(priv->nvm_data->max_tx_pwr_half_dbm, 2)) {
424 IWL_WARN(priv, 424 IWL_WARN(priv,
425 "Requested user TXPOWER %d above upper limit %d.\n", 425 "Requested user TXPOWER %d above upper limit %d.\n",
426 tx_power, priv->eeprom_data->max_tx_pwr_half_dbm); 426 tx_power, priv->nvm_data->max_tx_pwr_half_dbm);
427 return -EINVAL; 427 return -EINVAL;
428 } 428 }
429 429
diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c
index bb9f6252d28f..610ed2204e1f 100644
--- a/drivers/net/wireless/iwlwifi/dvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/dvm/scan.c
@@ -660,12 +660,12 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
660 u16 rx_chain = 0; 660 u16 rx_chain = 0;
661 enum ieee80211_band band; 661 enum ieee80211_band band;
662 u8 n_probes = 0; 662 u8 n_probes = 0;
663 u8 rx_ant = priv->eeprom_data->valid_rx_ant; 663 u8 rx_ant = priv->nvm_data->valid_rx_ant;
664 u8 rate; 664 u8 rate;
665 bool is_active = false; 665 bool is_active = false;
666 int chan_mod; 666 int chan_mod;
667 u8 active_chains; 667 u8 active_chains;
668 u8 scan_tx_antennas = priv->eeprom_data->valid_tx_ant; 668 u8 scan_tx_antennas = priv->nvm_data->valid_tx_ant;
669 int ret; 669 int ret;
670 int scan_cmd_size = sizeof(struct iwl_scan_cmd) + 670 int scan_cmd_size = sizeof(struct iwl_scan_cmd) +
671 MAX_SCAN_CHANNEL * sizeof(struct iwl_scan_channel) + 671 MAX_SCAN_CHANNEL * sizeof(struct iwl_scan_channel) +
@@ -673,8 +673,9 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
673 const u8 *ssid = NULL; 673 const u8 *ssid = NULL;
674 u8 ssid_len = 0; 674 u8 ssid_len = 0;
675 675
676 if (WARN_ON_ONCE(priv->scan_request && 676 if (WARN_ON(priv->scan_type == IWL_SCAN_NORMAL &&
677 priv->scan_request->n_channels > MAX_SCAN_CHANNEL)) 677 (!priv->scan_request ||
678 priv->scan_request->n_channels > MAX_SCAN_CHANNEL)))
678 return -EINVAL; 679 return -EINVAL;
679 680
680 lockdep_assert_held(&priv->mutex); 681 lockdep_assert_held(&priv->mutex);
@@ -881,7 +882,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
881 882
882 /* MIMO is not used here, but value is required */ 883 /* MIMO is not used here, but value is required */
883 rx_chain |= 884 rx_chain |=
884 priv->eeprom_data->valid_rx_ant << RXON_RX_CHAIN_VALID_POS; 885 priv->nvm_data->valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
885 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; 886 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
886 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; 887 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS;
887 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; 888 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
@@ -998,7 +999,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
998 999
999void iwl_init_scan_params(struct iwl_priv *priv) 1000void iwl_init_scan_params(struct iwl_priv *priv)
1000{ 1001{
1001 u8 ant_idx = fls(priv->eeprom_data->valid_tx_ant) - 1; 1002 u8 ant_idx = fls(priv->nvm_data->valid_tx_ant) - 1;
1002 if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) 1003 if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ])
1003 priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx; 1004 priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx;
1004 if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) 1005 if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ])
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c
index cd9b6de4273e..bdba9543c351 100644
--- a/drivers/net/wireless/iwlwifi/dvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/dvm/sta.c
@@ -634,23 +634,23 @@ static void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
634 if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) 634 if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE)
635 rate_flags |= RATE_MCS_CCK_MSK; 635 rate_flags |= RATE_MCS_CCK_MSK;
636 636
637 rate_flags |= first_antenna(priv->eeprom_data->valid_tx_ant) << 637 rate_flags |= first_antenna(priv->nvm_data->valid_tx_ant) <<
638 RATE_MCS_ANT_POS; 638 RATE_MCS_ANT_POS;
639 rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); 639 rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
640 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) 640 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
641 link_cmd->rs_table[i].rate_n_flags = rate_n_flags; 641 link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
642 642
643 link_cmd->general_params.single_stream_ant_msk = 643 link_cmd->general_params.single_stream_ant_msk =
644 first_antenna(priv->eeprom_data->valid_tx_ant); 644 first_antenna(priv->nvm_data->valid_tx_ant);
645 645
646 link_cmd->general_params.dual_stream_ant_msk = 646 link_cmd->general_params.dual_stream_ant_msk =
647 priv->eeprom_data->valid_tx_ant & 647 priv->nvm_data->valid_tx_ant &
648 ~first_antenna(priv->eeprom_data->valid_tx_ant); 648 ~first_antenna(priv->nvm_data->valid_tx_ant);
649 if (!link_cmd->general_params.dual_stream_ant_msk) { 649 if (!link_cmd->general_params.dual_stream_ant_msk) {
650 link_cmd->general_params.dual_stream_ant_msk = ANT_AB; 650 link_cmd->general_params.dual_stream_ant_msk = ANT_AB;
651 } else if (num_of_ant(priv->eeprom_data->valid_tx_ant) == 2) { 651 } else if (num_of_ant(priv->nvm_data->valid_tx_ant) == 2) {
652 link_cmd->general_params.dual_stream_ant_msk = 652 link_cmd->general_params.dual_stream_ant_msk =
653 priv->eeprom_data->valid_tx_ant; 653 priv->nvm_data->valid_tx_ant;
654 } 654 }
655 655
656 link_cmd->agg_params.agg_dis_start_th = 656 link_cmd->agg_params.agg_dis_start_th =
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c
index 4ae031f6726b..da21328ca8ed 100644
--- a/drivers/net/wireless/iwlwifi/dvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/dvm/tx.c
@@ -188,7 +188,7 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
188 if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || 188 if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS ||
189 (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY)) 189 (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY))
190 rate_idx = rate_lowest_index( 190 rate_idx = rate_lowest_index(
191 &priv->eeprom_data->bands[info->band], sta); 191 &priv->nvm_data->bands[info->band], sta);
192 /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ 192 /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
193 if (info->band == IEEE80211_BAND_5GHZ) 193 if (info->band == IEEE80211_BAND_5GHZ)
194 rate_idx += IWL_FIRST_OFDM_RATE; 194 rate_idx += IWL_FIRST_OFDM_RATE;
@@ -207,11 +207,11 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
207 priv->bt_full_concurrent) { 207 priv->bt_full_concurrent) {
208 /* operated as 1x1 in full concurrency mode */ 208 /* operated as 1x1 in full concurrency mode */
209 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, 209 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
210 first_antenna(priv->eeprom_data->valid_tx_ant)); 210 first_antenna(priv->nvm_data->valid_tx_ant));
211 } else 211 } else
212 priv->mgmt_tx_ant = iwl_toggle_tx_ant( 212 priv->mgmt_tx_ant = iwl_toggle_tx_ant(
213 priv, priv->mgmt_tx_ant, 213 priv, priv->mgmt_tx_ant,
214 priv->eeprom_data->valid_tx_ant); 214 priv->nvm_data->valid_tx_ant);
215 rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant); 215 rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
216 216
217 /* Set the rate in the TX cmd */ 217 /* Set the rate in the TX cmd */
@@ -305,7 +305,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
305 u8 hdr_len; 305 u8 hdr_len;
306 u16 len, seq_number = 0; 306 u16 len, seq_number = 0;
307 u8 sta_id, tid = IWL_MAX_TID_COUNT; 307 u8 sta_id, tid = IWL_MAX_TID_COUNT;
308 bool is_agg = false; 308 bool is_agg = false, is_data_qos = false;
309 int txq_id; 309 int txq_id;
310 310
311 if (info->control.vif) 311 if (info->control.vif)
@@ -378,9 +378,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
378 iwl_sta_modify_sleep_tx_count(priv, sta_id, 1); 378 iwl_sta_modify_sleep_tx_count(priv, sta_id, 1);
379 } 379 }
380 380
381 if (info->flags & IEEE80211_TX_CTL_AMPDU)
382 is_agg = true;
383
384 dev_cmd = iwl_trans_alloc_tx_cmd(priv->trans); 381 dev_cmd = iwl_trans_alloc_tx_cmd(priv->trans);
385 382
386 if (unlikely(!dev_cmd)) 383 if (unlikely(!dev_cmd))
@@ -442,6 +439,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
442 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); 439 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
443 hdr->seq_ctrl |= cpu_to_le16(seq_number); 440 hdr->seq_ctrl |= cpu_to_le16(seq_number);
444 seq_number += 0x10; 441 seq_number += 0x10;
442
443 if (info->flags & IEEE80211_TX_CTL_AMPDU)
444 is_agg = true;
445 is_data_qos = true;
445 } 446 }
446 447
447 /* Copy MAC header from skb into command buffer */ 448 /* Copy MAC header from skb into command buffer */
@@ -474,8 +475,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
474 if (iwl_trans_tx(priv->trans, skb, dev_cmd, txq_id)) 475 if (iwl_trans_tx(priv->trans, skb, dev_cmd, txq_id))
475 goto drop_unlock_sta; 476 goto drop_unlock_sta;
476 477
477 if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc) && 478 if (is_data_qos && !ieee80211_has_morefrags(fc))
478 !ieee80211_has_morefrags(fc))
479 priv->tid_data[sta_id][tid].seq_number = seq_number; 479 priv->tid_data[sta_id][tid].seq_number = seq_number;
480 480
481 spin_unlock(&priv->sta_lock); 481 spin_unlock(&priv->sta_lock);
@@ -1097,29 +1097,6 @@ static void iwl_check_abort_status(struct iwl_priv *priv,
1097 } 1097 }
1098} 1098}
1099 1099
1100static int iwl_reclaim(struct iwl_priv *priv, int sta_id, int tid,
1101 int txq_id, int ssn, struct sk_buff_head *skbs)
1102{
1103 if (unlikely(txq_id >= IWLAGN_FIRST_AMPDU_QUEUE &&
1104 tid != IWL_TID_NON_QOS &&
1105 txq_id != priv->tid_data[sta_id][tid].agg.txq_id)) {
1106 /*
1107 * FIXME: this is a uCode bug which need to be addressed,
1108 * log the information and return for now.
1109 * Since it is can possibly happen very often and in order
1110 * not to fill the syslog, don't use IWL_ERR or IWL_WARN
1111 */
1112 IWL_DEBUG_TX_QUEUES(priv,
1113 "Bad queue mapping txq_id=%d, agg_txq[sta:%d,tid:%d]=%d\n",
1114 txq_id, sta_id, tid,
1115 priv->tid_data[sta_id][tid].agg.txq_id);
1116 return 1;
1117 }
1118
1119 iwl_trans_reclaim(priv->trans, txq_id, ssn, skbs);
1120 return 0;
1121}
1122
1123int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, 1100int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1124 struct iwl_device_cmd *cmd) 1101 struct iwl_device_cmd *cmd)
1125{ 1102{
@@ -1181,9 +1158,8 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1181 next_reclaimed); 1158 next_reclaimed);
1182 } 1159 }
1183 1160
1184 /*we can free until ssn % q.n_bd not inclusive */ 1161 iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs);
1185 WARN_ON_ONCE(iwl_reclaim(priv, sta_id, tid, 1162
1186 txq_id, ssn, &skbs));
1187 iwlagn_check_ratid_empty(priv, sta_id, tid); 1163 iwlagn_check_ratid_empty(priv, sta_id, tid);
1188 freed = 0; 1164 freed = 0;
1189 1165
@@ -1308,16 +1284,27 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
1308 return 0; 1284 return 0;
1309 } 1285 }
1310 1286
1287 if (unlikely(scd_flow != agg->txq_id)) {
1288 /*
1289 * FIXME: this is a uCode bug which need to be addressed,
1290 * log the information and return for now.
1291 * Since it is can possibly happen very often and in order
1292 * not to fill the syslog, don't use IWL_ERR or IWL_WARN
1293 */
1294 IWL_DEBUG_TX_QUEUES(priv,
1295 "Bad queue mapping txq_id=%d, agg_txq[sta:%d,tid:%d]=%d\n",
1296 scd_flow, sta_id, tid, agg->txq_id);
1297 spin_unlock(&priv->sta_lock);
1298 return 0;
1299 }
1300
1311 __skb_queue_head_init(&reclaimed_skbs); 1301 __skb_queue_head_init(&reclaimed_skbs);
1312 1302
1313 /* Release all TFDs before the SSN, i.e. all TFDs in front of 1303 /* Release all TFDs before the SSN, i.e. all TFDs in front of
1314 * block-ack window (we assume that they've been successfully 1304 * block-ack window (we assume that they've been successfully
1315 * transmitted ... if not, it's too late anyway). */ 1305 * transmitted ... if not, it's too late anyway). */
1316 if (iwl_reclaim(priv, sta_id, tid, scd_flow, 1306 iwl_trans_reclaim(priv->trans, scd_flow, ba_resp_scd_ssn,
1317 ba_resp_scd_ssn, &reclaimed_skbs)) { 1307 &reclaimed_skbs);
1318 spin_unlock(&priv->sta_lock);
1319 return 0;
1320 }
1321 1308
1322 IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " 1309 IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, "
1323 "sta_id = %d\n", 1310 "sta_id = %d\n",
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c
index 95e6d33f5159..c6467e5554f5 100644
--- a/drivers/net/wireless/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c
@@ -61,7 +61,7 @@ iwl_get_ucode_image(struct iwl_priv *priv, enum iwl_ucode_type ucode_type)
61static int iwl_set_Xtal_calib(struct iwl_priv *priv) 61static int iwl_set_Xtal_calib(struct iwl_priv *priv)
62{ 62{
63 struct iwl_calib_xtal_freq_cmd cmd; 63 struct iwl_calib_xtal_freq_cmd cmd;
64 __le16 *xtal_calib = priv->eeprom_data->xtal_calib; 64 __le16 *xtal_calib = priv->nvm_data->xtal_calib;
65 65
66 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD); 66 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD);
67 cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); 67 cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
@@ -75,7 +75,7 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
75 75
76 memset(&cmd, 0, sizeof(cmd)); 76 memset(&cmd, 0, sizeof(cmd));
77 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); 77 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
78 cmd.radio_sensor_offset = priv->eeprom_data->raw_temperature; 78 cmd.radio_sensor_offset = priv->nvm_data->raw_temperature;
79 if (!(cmd.radio_sensor_offset)) 79 if (!(cmd.radio_sensor_offset))
80 cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; 80 cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET;
81 81
@@ -90,14 +90,14 @@ static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
90 90
91 memset(&cmd, 0, sizeof(cmd)); 91 memset(&cmd, 0, sizeof(cmd));
92 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); 92 iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
93 cmd.radio_sensor_offset_high = priv->eeprom_data->kelvin_temperature; 93 cmd.radio_sensor_offset_high = priv->nvm_data->kelvin_temperature;
94 cmd.radio_sensor_offset_low = priv->eeprom_data->raw_temperature; 94 cmd.radio_sensor_offset_low = priv->nvm_data->raw_temperature;
95 if (!cmd.radio_sensor_offset_low) { 95 if (!cmd.radio_sensor_offset_low) {
96 IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n"); 96 IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n");
97 cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET; 97 cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET;
98 cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET; 98 cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET;
99 } 99 }
100 cmd.burntVoltageRef = priv->eeprom_data->calib_voltage; 100 cmd.burntVoltageRef = priv->nvm_data->calib_voltage;
101 101
102 IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n", 102 IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n",
103 le16_to_cpu(cmd.radio_sensor_offset_high)); 103 le16_to_cpu(cmd.radio_sensor_offset_high));
@@ -257,7 +257,7 @@ static int iwl_alive_notify(struct iwl_priv *priv)
257 iwl_trans_fw_alive(priv->trans, 0); 257 iwl_trans_fw_alive(priv->trans, 0);
258 258
259 if (priv->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN && 259 if (priv->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN &&
260 priv->eeprom_data->sku & EEPROM_SKU_CAP_IPAN_ENABLE) { 260 priv->nvm_data->sku_cap_ipan_enable) {
261 n_queues = ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo); 261 n_queues = ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo);
262 queue_to_txf = iwlagn_ipan_queue_to_tx_fifo; 262 queue_to_txf = iwlagn_ipan_queue_to_tx_fifo;
263 } else { 263 } else {
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h
index 196266aa5a9d..864219d2136a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/iwlwifi/iwl-config.h
@@ -226,8 +226,8 @@ struct iwl_eeprom_params {
226 * @max_data_size: The maximal length of the fw data section 226 * @max_data_size: The maximal length of the fw data section
227 * @valid_tx_ant: valid transmit antenna 227 * @valid_tx_ant: valid transmit antenna
228 * @valid_rx_ant: valid receive antenna 228 * @valid_rx_ant: valid receive antenna
229 * @eeprom_ver: EEPROM version 229 * @nvm_ver: NVM version
230 * @eeprom_calib_ver: EEPROM calibration version 230 * @nvm_calib_ver: NVM calibration version
231 * @lib: pointer to the lib ops 231 * @lib: pointer to the lib ops
232 * @base_params: pointer to basic parameters 232 * @base_params: pointer to basic parameters
233 * @ht_params: point to ht patameters 233 * @ht_params: point to ht patameters
@@ -257,8 +257,8 @@ struct iwl_cfg {
257 const u32 max_inst_size; 257 const u32 max_inst_size;
258 u8 valid_tx_ant; 258 u8 valid_tx_ant;
259 u8 valid_rx_ant; 259 u8 valid_rx_ant;
260 u16 eeprom_ver; 260 u16 nvm_ver;
261 u16 eeprom_calib_ver; 261 u16 nvm_calib_ver;
262 /* params not likely to change within a device family */ 262 /* params not likely to change within a device family */
263 const struct iwl_base_params *base_params; 263 const struct iwl_base_params *base_params;
264 /* params likely to change within a device family */ 264 /* params likely to change within a device family */
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
index b3fde5f7b9bc..dc7e26b2f383 100644
--- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
@@ -133,6 +133,40 @@ TRACE_EVENT(iwlwifi_dev_iowrite32,
133 __get_str(dev), __entry->offs, __entry->val) 133 __get_str(dev), __entry->offs, __entry->val)
134); 134);
135 135
136TRACE_EVENT(iwlwifi_dev_iowrite_prph32,
137 TP_PROTO(const struct device *dev, u32 offs, u32 val),
138 TP_ARGS(dev, offs, val),
139 TP_STRUCT__entry(
140 DEV_ENTRY
141 __field(u32, offs)
142 __field(u32, val)
143 ),
144 TP_fast_assign(
145 DEV_ASSIGN;
146 __entry->offs = offs;
147 __entry->val = val;
148 ),
149 TP_printk("[%s] write PRPH[%#x] = %#x)",
150 __get_str(dev), __entry->offs, __entry->val)
151);
152
153TRACE_EVENT(iwlwifi_dev_ioread_prph32,
154 TP_PROTO(const struct device *dev, u32 offs, u32 val),
155 TP_ARGS(dev, offs, val),
156 TP_STRUCT__entry(
157 DEV_ENTRY
158 __field(u32, offs)
159 __field(u32, val)
160 ),
161 TP_fast_assign(
162 DEV_ASSIGN;
163 __entry->offs = offs;
164 __entry->val = val;
165 ),
166 TP_printk("[%s] read PRPH[%#x] = %#x",
167 __get_str(dev), __entry->offs, __entry->val)
168);
169
136TRACE_EVENT(iwlwifi_dev_irq, 170TRACE_EVENT(iwlwifi_dev_irq,
137 TP_PROTO(const struct device *dev), 171 TP_PROTO(const struct device *dev),
138 TP_ARGS(dev), 172 TP_ARGS(dev),
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 198634b75ed0..d3549f493a17 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -1032,6 +1032,7 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
1032 1032
1033 if (!drv->dbgfs_drv) { 1033 if (!drv->dbgfs_drv) {
1034 IWL_ERR(drv, "failed to create debugfs directory\n"); 1034 IWL_ERR(drv, "failed to create debugfs directory\n");
1035 ret = -ENOMEM;
1035 goto err_free_drv; 1036 goto err_free_drv;
1036 } 1037 }
1037 1038
@@ -1040,12 +1041,12 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
1040 1041
1041 if (!drv->trans->dbgfs_dir) { 1042 if (!drv->trans->dbgfs_dir) {
1042 IWL_ERR(drv, "failed to create transport debugfs directory\n"); 1043 IWL_ERR(drv, "failed to create transport debugfs directory\n");
1044 ret = -ENOMEM;
1043 goto err_free_dbgfs; 1045 goto err_free_dbgfs;
1044 } 1046 }
1045#endif 1047#endif
1046 1048
1047 ret = iwl_request_firmware(drv, true); 1049 ret = iwl_request_firmware(drv, true);
1048
1049 if (ret) { 1050 if (ret) {
1050 IWL_ERR(trans, "Couldn't request the fw\n"); 1051 IWL_ERR(trans, "Couldn't request the fw\n");
1051 goto err_fw; 1052 goto err_fw;
@@ -1060,9 +1061,8 @@ err_free_dbgfs:
1060err_free_drv: 1061err_free_drv:
1061#endif 1062#endif
1062 kfree(drv); 1063 kfree(drv);
1063 drv = NULL;
1064 1064
1065 return drv; 1065 return ERR_PTR(ret);
1066} 1066}
1067 1067
1068void iwl_drv_stop(struct iwl_drv *drv) 1068void iwl_drv_stop(struct iwl_drv *drv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
index 4a9dc9629efe..471986690cf0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
@@ -116,6 +116,24 @@ struct iwl_eeprom_calib_hdr {
116#define EEPROM_KELVIN_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL) 116#define EEPROM_KELVIN_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL)
117#define EEPROM_RAW_TEMPERATURE ((2*0x12B) | EEPROM_CALIB_ALL) 117#define EEPROM_RAW_TEMPERATURE ((2*0x12B) | EEPROM_CALIB_ALL)
118 118
119/* SKU Capabilities (actual values from EEPROM definition) */
120enum eeprom_sku_bits {
121 EEPROM_SKU_CAP_BAND_24GHZ = BIT(4),
122 EEPROM_SKU_CAP_BAND_52GHZ = BIT(5),
123 EEPROM_SKU_CAP_11N_ENABLE = BIT(6),
124 EEPROM_SKU_CAP_AMT_ENABLE = BIT(7),
125 EEPROM_SKU_CAP_IPAN_ENABLE = BIT(8)
126};
127
128/* radio config bits (actual values from EEPROM definition) */
129#define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */
130#define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */
131#define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */
132#define EEPROM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3) /* bits 6-7 */
133#define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */
134#define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */
135
136
119/* 137/*
120 * EEPROM bands 138 * EEPROM bands
121 * These are the channel numbers from each band in the order 139 * These are the channel numbers from each band in the order
@@ -251,7 +269,7 @@ static const u8 *iwl_eeprom_query_addr(const u8 *eeprom, size_t eeprom_size,
251} 269}
252 270
253static int iwl_eeprom_read_calib(const u8 *eeprom, size_t eeprom_size, 271static int iwl_eeprom_read_calib(const u8 *eeprom, size_t eeprom_size,
254 struct iwl_eeprom_data *data) 272 struct iwl_nvm_data *data)
255{ 273{
256 struct iwl_eeprom_calib_hdr *hdr; 274 struct iwl_eeprom_calib_hdr *hdr;
257 275
@@ -330,7 +348,7 @@ struct iwl_eeprom_enhanced_txpwr {
330 s8 mimo3_max; 348 s8 mimo3_max;
331} __packed; 349} __packed;
332 350
333static s8 iwl_get_max_txpwr_half_dbm(const struct iwl_eeprom_data *data, 351static s8 iwl_get_max_txpwr_half_dbm(const struct iwl_nvm_data *data,
334 struct iwl_eeprom_enhanced_txpwr *txp) 352 struct iwl_eeprom_enhanced_txpwr *txp)
335{ 353{
336 s8 result = 0; /* (.5 dBm) */ 354 s8 result = 0; /* (.5 dBm) */
@@ -364,7 +382,7 @@ static s8 iwl_get_max_txpwr_half_dbm(const struct iwl_eeprom_data *data,
364 ((txp->flags & IWL_EEPROM_ENH_TXP_FL_##x) ? # x " " : "") 382 ((txp->flags & IWL_EEPROM_ENH_TXP_FL_##x) ? # x " " : "")
365 383
366static void 384static void
367iwl_eeprom_enh_txp_read_element(struct iwl_eeprom_data *data, 385iwl_eeprom_enh_txp_read_element(struct iwl_nvm_data *data,
368 struct iwl_eeprom_enhanced_txpwr *txp, 386 struct iwl_eeprom_enhanced_txpwr *txp,
369 int n_channels, s8 max_txpower_avg) 387 int n_channels, s8 max_txpower_avg)
370{ 388{
@@ -392,7 +410,7 @@ iwl_eeprom_enh_txp_read_element(struct iwl_eeprom_data *data,
392} 410}
393 411
394static void iwl_eeprom_enhanced_txpower(struct device *dev, 412static void iwl_eeprom_enhanced_txpower(struct device *dev,
395 struct iwl_eeprom_data *data, 413 struct iwl_nvm_data *data,
396 const u8 *eeprom, size_t eeprom_size, 414 const u8 *eeprom, size_t eeprom_size,
397 int n_channels) 415 int n_channels)
398{ 416{
@@ -504,7 +522,7 @@ static void iwl_init_band_reference(const struct iwl_cfg *cfg,
504 ((eeprom_ch->flags & EEPROM_CHANNEL_##x) ? # x " " : "") 522 ((eeprom_ch->flags & EEPROM_CHANNEL_##x) ? # x " " : "")
505 523
506static void iwl_mod_ht40_chan_info(struct device *dev, 524static void iwl_mod_ht40_chan_info(struct device *dev,
507 struct iwl_eeprom_data *data, int n_channels, 525 struct iwl_nvm_data *data, int n_channels,
508 enum ieee80211_band band, u16 channel, 526 enum ieee80211_band band, u16 channel,
509 const struct iwl_eeprom_channel *eeprom_ch, 527 const struct iwl_eeprom_channel *eeprom_ch,
510 u8 clear_ht40_extension_channel) 528 u8 clear_ht40_extension_channel)
@@ -547,7 +565,7 @@ static void iwl_mod_ht40_chan_info(struct device *dev,
547 ((eeprom_ch_info[ch_idx].flags & EEPROM_CHANNEL_##x) ? # x " " : "") 565 ((eeprom_ch_info[ch_idx].flags & EEPROM_CHANNEL_##x) ? # x " " : "")
548 566
549static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, 567static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
550 struct iwl_eeprom_data *data, 568 struct iwl_nvm_data *data,
551 const u8 *eeprom, size_t eeprom_size) 569 const u8 *eeprom, size_t eeprom_size)
552{ 570{
553 int band, ch_idx; 571 int band, ch_idx;
@@ -685,7 +703,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
685 return n_channels; 703 return n_channels;
686} 704}
687 705
688static int iwl_init_sband_channels(struct iwl_eeprom_data *data, 706static int iwl_init_sband_channels(struct iwl_nvm_data *data,
689 struct ieee80211_supported_band *sband, 707 struct ieee80211_supported_band *sband,
690 int n_channels, enum ieee80211_band band) 708 int n_channels, enum ieee80211_band band)
691{ 709{
@@ -711,7 +729,7 @@ static int iwl_init_sband_channels(struct iwl_eeprom_data *data,
711#define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ 729#define MAX_BIT_RATE_20_MHZ 72 /* Mbps */
712 730
713static void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg, 731static void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
714 struct iwl_eeprom_data *data, 732 struct iwl_nvm_data *data,
715 struct ieee80211_sta_ht_cap *ht_info, 733 struct ieee80211_sta_ht_cap *ht_info,
716 enum ieee80211_band band) 734 enum ieee80211_band band)
717{ 735{
@@ -725,7 +743,7 @@ static void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
725 else 743 else
726 rx_chains = hweight8(data->valid_rx_ant); 744 rx_chains = hweight8(data->valid_rx_ant);
727 745
728 if (!(data->sku & EEPROM_SKU_CAP_11N_ENABLE) || !cfg->ht_params) { 746 if (!(data->sku_cap_11n_enable) || !cfg->ht_params) {
729 ht_info->ht_supported = false; 747 ht_info->ht_supported = false;
730 return; 748 return;
731 } 749 }
@@ -773,7 +791,7 @@ static void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
773} 791}
774 792
775static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg, 793static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
776 struct iwl_eeprom_data *data, 794 struct iwl_nvm_data *data,
777 const u8 *eeprom, size_t eeprom_size) 795 const u8 *eeprom, size_t eeprom_size)
778{ 796{
779 int n_channels = iwl_init_channel_map(dev, cfg, data, 797 int n_channels = iwl_init_channel_map(dev, cfg, data,
@@ -804,12 +822,13 @@ static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
804 822
805/* EEPROM data functions */ 823/* EEPROM data functions */
806 824
807struct iwl_eeprom_data * 825struct iwl_nvm_data *
808iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg, 826iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
809 const u8 *eeprom, size_t eeprom_size) 827 const u8 *eeprom, size_t eeprom_size)
810{ 828{
811 struct iwl_eeprom_data *data; 829 struct iwl_nvm_data *data;
812 const void *tmp; 830 const void *tmp;
831 u16 radio_cfg, sku;
813 832
814 if (WARN_ON(!cfg || !cfg->eeprom_params)) 833 if (WARN_ON(!cfg || !cfg->eeprom_params))
815 return NULL; 834 return NULL;
@@ -849,18 +868,27 @@ iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
849 data->kelvin_temperature = *(__le16 *)tmp; 868 data->kelvin_temperature = *(__le16 *)tmp;
850 data->kelvin_voltage = *((__le16 *)tmp + 1); 869 data->kelvin_voltage = *((__le16 *)tmp + 1);
851 870
852 data->radio_cfg = iwl_eeprom_query16(eeprom, eeprom_size, 871 radio_cfg = iwl_eeprom_query16(eeprom, eeprom_size,
853 EEPROM_RADIO_CONFIG); 872 EEPROM_RADIO_CONFIG);
854 data->sku = iwl_eeprom_query16(eeprom, eeprom_size, 873 data->radio_cfg_dash = EEPROM_RF_CFG_DASH_MSK(radio_cfg);
855 EEPROM_SKU_CAP); 874 data->radio_cfg_pnum = EEPROM_RF_CFG_PNUM_MSK(radio_cfg);
875 data->radio_cfg_step = EEPROM_RF_CFG_STEP_MSK(radio_cfg);
876 data->radio_cfg_type = EEPROM_RF_CFG_TYPE_MSK(radio_cfg);
877 data->valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg);
878 data->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg);
879
880 sku = iwl_eeprom_query16(eeprom, eeprom_size,
881 EEPROM_SKU_CAP);
882 data->sku_cap_11n_enable = sku & EEPROM_SKU_CAP_11N_ENABLE;
883 data->sku_cap_amt_enable = sku & EEPROM_SKU_CAP_AMT_ENABLE;
884 data->sku_cap_band_24GHz_enable = sku & EEPROM_SKU_CAP_BAND_24GHZ;
885 data->sku_cap_band_52GHz_enable = sku & EEPROM_SKU_CAP_BAND_52GHZ;
886 data->sku_cap_ipan_enable = sku & EEPROM_SKU_CAP_IPAN_ENABLE;
856 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL) 887 if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL)
857 data->sku &= ~EEPROM_SKU_CAP_11N_ENABLE; 888 data->sku_cap_11n_enable = false;
858
859 data->eeprom_version = iwl_eeprom_query16(eeprom, eeprom_size,
860 EEPROM_VERSION);
861 889
862 data->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(data->radio_cfg); 890 data->nvm_version = iwl_eeprom_query16(eeprom, eeprom_size,
863 data->valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(data->radio_cfg); 891 EEPROM_VERSION);
864 892
865 /* check overrides (some devices have wrong EEPROM) */ 893 /* check overrides (some devices have wrong EEPROM) */
866 if (cfg->valid_tx_ant) 894 if (cfg->valid_tx_ant)
@@ -884,20 +912,20 @@ iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
884EXPORT_SYMBOL_GPL(iwl_parse_eeprom_data); 912EXPORT_SYMBOL_GPL(iwl_parse_eeprom_data);
885 913
886/* helper functions */ 914/* helper functions */
887int iwl_eeprom_check_version(struct iwl_eeprom_data *data, 915int iwl_nvm_check_version(struct iwl_nvm_data *data,
888 struct iwl_trans *trans) 916 struct iwl_trans *trans)
889{ 917{
890 if (data->eeprom_version >= trans->cfg->eeprom_ver || 918 if (data->nvm_version >= trans->cfg->nvm_ver ||
891 data->calib_version >= trans->cfg->eeprom_calib_ver) { 919 data->calib_version >= trans->cfg->nvm_calib_ver) {
892 IWL_DEBUG_INFO(trans, "device EEPROM VER=0x%x, CALIB=0x%x\n", 920 IWL_DEBUG_INFO(trans, "device EEPROM VER=0x%x, CALIB=0x%x\n",
893 data->eeprom_version, data->calib_version); 921 data->nvm_version, data->calib_version);
894 return 0; 922 return 0;
895 } 923 }
896 924
897 IWL_ERR(trans, 925 IWL_ERR(trans,
898 "Unsupported (too old) EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", 926 "Unsupported (too old) EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
899 data->eeprom_version, trans->cfg->eeprom_ver, 927 data->nvm_version, trans->cfg->nvm_ver,
900 data->calib_version, trans->cfg->eeprom_calib_ver); 928 data->calib_version, trans->cfg->nvm_calib_ver);
901 return -EINVAL; 929 return -EINVAL;
902} 930}
903EXPORT_SYMBOL_GPL(iwl_eeprom_check_version); 931EXPORT_SYMBOL_GPL(iwl_nvm_check_version);
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h
index a5e425718f56..555f0eb61d48 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h
@@ -66,22 +66,7 @@
66#include <linux/if_ether.h> 66#include <linux/if_ether.h>
67#include "iwl-trans.h" 67#include "iwl-trans.h"
68 68
69/* SKU Capabilities (actual values from EEPROM definition) */ 69struct iwl_nvm_data {
70#define EEPROM_SKU_CAP_BAND_24GHZ (1 << 4)
71#define EEPROM_SKU_CAP_BAND_52GHZ (1 << 5)
72#define EEPROM_SKU_CAP_11N_ENABLE (1 << 6)
73#define EEPROM_SKU_CAP_AMT_ENABLE (1 << 7)
74#define EEPROM_SKU_CAP_IPAN_ENABLE (1 << 8)
75
76/* radio config bits (actual values from EEPROM definition) */
77#define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */
78#define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */
79#define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */
80#define EEPROM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3) /* bits 6-7 */
81#define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */
82#define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */
83
84struct iwl_eeprom_data {
85 int n_hw_addrs; 70 int n_hw_addrs;
86 u8 hw_addr[ETH_ALEN]; 71 u8 hw_addr[ETH_ALEN];
87 72
@@ -93,13 +78,21 @@ struct iwl_eeprom_data {
93 __le16 kelvin_voltage; 78 __le16 kelvin_voltage;
94 __le16 xtal_calib[2]; 79 __le16 xtal_calib[2];
95 80
96 u16 sku; 81 bool sku_cap_band_24GHz_enable;
97 u16 radio_cfg; 82 bool sku_cap_band_52GHz_enable;
98 u16 eeprom_version; 83 bool sku_cap_11n_enable;
99 s8 max_tx_pwr_half_dbm; 84 bool sku_cap_amt_enable;
85 bool sku_cap_ipan_enable;
100 86
87 u8 radio_cfg_type;
88 u8 radio_cfg_step;
89 u8 radio_cfg_dash;
90 u8 radio_cfg_pnum;
101 u8 valid_tx_ant, valid_rx_ant; 91 u8 valid_tx_ant, valid_rx_ant;
102 92
93 u16 nvm_version;
94 s8 max_tx_pwr_half_dbm;
95
103 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; 96 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
104 struct ieee80211_channel channels[]; 97 struct ieee80211_channel channels[];
105}; 98};
@@ -115,22 +108,22 @@ struct iwl_eeprom_data {
115 * This function parses all EEPROM values we need and then 108 * This function parses all EEPROM values we need and then
116 * returns a (newly allocated) struct containing all the 109 * returns a (newly allocated) struct containing all the
117 * relevant values for driver use. The struct must be freed 110 * relevant values for driver use. The struct must be freed
118 * later with iwl_free_eeprom_data(). 111 * later with iwl_free_nvm_data().
119 */ 112 */
120struct iwl_eeprom_data * 113struct iwl_nvm_data *
121iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg, 114iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
122 const u8 *eeprom, size_t eeprom_size); 115 const u8 *eeprom, size_t eeprom_size);
123 116
124/** 117/**
125 * iwl_free_eeprom_data - free EEPROM data 118 * iwl_free_nvm_data - free NVM data
126 * @data: the data to free 119 * @data: the data to free
127 */ 120 */
128static inline void iwl_free_eeprom_data(struct iwl_eeprom_data *data) 121static inline void iwl_free_nvm_data(struct iwl_nvm_data *data)
129{ 122{
130 kfree(data); 123 kfree(data);
131} 124}
132 125
133int iwl_eeprom_check_version(struct iwl_eeprom_data *data, 126int iwl_nvm_check_version(struct iwl_nvm_data *data,
134 struct iwl_trans *trans); 127 struct iwl_trans *trans);
135 128
136#endif /* __iwl_eeprom_parse_h__ */ 129#endif /* __iwl_eeprom_parse_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index 54c41b44bffe..cdaff9572059 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -214,84 +214,84 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask,
214} 214}
215EXPORT_SYMBOL_GPL(iwl_poll_direct_bit); 215EXPORT_SYMBOL_GPL(iwl_poll_direct_bit);
216 216
217static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 reg) 217static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 ofs)
218{ 218{
219 iwl_write32(trans, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); 219 u32 val = iwl_trans_read_prph(trans, ofs);
220 return iwl_read32(trans, HBUS_TARG_PRPH_RDAT); 220 trace_iwlwifi_dev_ioread_prph32(trans->dev, ofs, val);
221 return val;
221} 222}
222 223
223static inline void __iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val) 224static inline void __iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val)
224{ 225{
225 iwl_write32(trans, HBUS_TARG_PRPH_WADDR, 226 trace_iwlwifi_dev_iowrite_prph32(trans->dev, ofs, val);
226 ((addr & 0x0000FFFF) | (3 << 24))); 227 iwl_trans_write_prph(trans, ofs, val);
227 iwl_write32(trans, HBUS_TARG_PRPH_WDAT, val);
228} 228}
229 229
230u32 iwl_read_prph(struct iwl_trans *trans, u32 reg) 230u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs)
231{ 231{
232 unsigned long flags; 232 unsigned long flags;
233 u32 val; 233 u32 val;
234 234
235 spin_lock_irqsave(&trans->reg_lock, flags); 235 spin_lock_irqsave(&trans->reg_lock, flags);
236 iwl_grab_nic_access(trans); 236 iwl_grab_nic_access(trans);
237 val = __iwl_read_prph(trans, reg); 237 val = __iwl_read_prph(trans, ofs);
238 iwl_release_nic_access(trans); 238 iwl_release_nic_access(trans);
239 spin_unlock_irqrestore(&trans->reg_lock, flags); 239 spin_unlock_irqrestore(&trans->reg_lock, flags);
240 return val; 240 return val;
241} 241}
242EXPORT_SYMBOL_GPL(iwl_read_prph); 242EXPORT_SYMBOL_GPL(iwl_read_prph);
243 243
244void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val) 244void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val)
245{ 245{
246 unsigned long flags; 246 unsigned long flags;
247 247
248 spin_lock_irqsave(&trans->reg_lock, flags); 248 spin_lock_irqsave(&trans->reg_lock, flags);
249 if (likely(iwl_grab_nic_access(trans))) { 249 if (likely(iwl_grab_nic_access(trans))) {
250 __iwl_write_prph(trans, addr, val); 250 __iwl_write_prph(trans, ofs, val);
251 iwl_release_nic_access(trans); 251 iwl_release_nic_access(trans);
252 } 252 }
253 spin_unlock_irqrestore(&trans->reg_lock, flags); 253 spin_unlock_irqrestore(&trans->reg_lock, flags);
254} 254}
255EXPORT_SYMBOL_GPL(iwl_write_prph); 255EXPORT_SYMBOL_GPL(iwl_write_prph);
256 256
257void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) 257void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask)
258{ 258{
259 unsigned long flags; 259 unsigned long flags;
260 260
261 spin_lock_irqsave(&trans->reg_lock, flags); 261 spin_lock_irqsave(&trans->reg_lock, flags);
262 if (likely(iwl_grab_nic_access(trans))) { 262 if (likely(iwl_grab_nic_access(trans))) {
263 __iwl_write_prph(trans, reg, 263 __iwl_write_prph(trans, ofs,
264 __iwl_read_prph(trans, reg) | mask); 264 __iwl_read_prph(trans, ofs) | mask);
265 iwl_release_nic_access(trans); 265 iwl_release_nic_access(trans);
266 } 266 }
267 spin_unlock_irqrestore(&trans->reg_lock, flags); 267 spin_unlock_irqrestore(&trans->reg_lock, flags);
268} 268}
269EXPORT_SYMBOL_GPL(iwl_set_bits_prph); 269EXPORT_SYMBOL_GPL(iwl_set_bits_prph);
270 270
271void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg, 271void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs,
272 u32 bits, u32 mask) 272 u32 bits, u32 mask)
273{ 273{
274 unsigned long flags; 274 unsigned long flags;
275 275
276 spin_lock_irqsave(&trans->reg_lock, flags); 276 spin_lock_irqsave(&trans->reg_lock, flags);
277 if (likely(iwl_grab_nic_access(trans))) { 277 if (likely(iwl_grab_nic_access(trans))) {
278 __iwl_write_prph(trans, reg, 278 __iwl_write_prph(trans, ofs,
279 (__iwl_read_prph(trans, reg) & mask) | bits); 279 (__iwl_read_prph(trans, ofs) & mask) | bits);
280 iwl_release_nic_access(trans); 280 iwl_release_nic_access(trans);
281 } 281 }
282 spin_unlock_irqrestore(&trans->reg_lock, flags); 282 spin_unlock_irqrestore(&trans->reg_lock, flags);
283} 283}
284EXPORT_SYMBOL_GPL(iwl_set_bits_mask_prph); 284EXPORT_SYMBOL_GPL(iwl_set_bits_mask_prph);
285 285
286void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) 286void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask)
287{ 287{
288 unsigned long flags; 288 unsigned long flags;
289 u32 val; 289 u32 val;
290 290
291 spin_lock_irqsave(&trans->reg_lock, flags); 291 spin_lock_irqsave(&trans->reg_lock, flags);
292 if (likely(iwl_grab_nic_access(trans))) { 292 if (likely(iwl_grab_nic_access(trans))) {
293 val = __iwl_read_prph(trans, reg); 293 val = __iwl_read_prph(trans, ofs);
294 __iwl_write_prph(trans, reg, (val & ~mask)); 294 __iwl_write_prph(trans, ofs, (val & ~mask));
295 iwl_release_nic_access(trans); 295 iwl_release_nic_access(trans);
296 } 296 }
297 spin_unlock_irqrestore(&trans->reg_lock, flags); 297 spin_unlock_irqrestore(&trans->reg_lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index e1aa69f66de6..48dc753e3742 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -69,12 +69,12 @@ u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg);
69void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); 69void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value);
70 70
71 71
72u32 iwl_read_prph(struct iwl_trans *trans, u32 reg); 72u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs);
73void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val); 73void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val);
74void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask); 74void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
75void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg, 75void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs,
76 u32 bits, u32 mask); 76 u32 bits, u32 mask);
77void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask); 77void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
78 78
79void _iwl_read_targ_mem_dwords(struct iwl_trans *trans, u32 addr, 79void _iwl_read_targ_mem_dwords(struct iwl_trans *trans, u32 addr,
80 void *buf, int dwords); 80 void *buf, int dwords);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index e378ea6dca9c..b76532e238c1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -385,6 +385,8 @@ struct iwl_trans;
385 * @write8: write a u8 to a register at offset ofs from the BAR 385 * @write8: write a u8 to a register at offset ofs from the BAR
386 * @write32: write a u32 to a register at offset ofs from the BAR 386 * @write32: write a u32 to a register at offset ofs from the BAR
387 * @read32: read a u32 register at offset ofs from the BAR 387 * @read32: read a u32 register at offset ofs from the BAR
388 * @read_prph: read a DWORD from a periphery register
389 * @write_prph: write a DWORD to a periphery register
388 * @configure: configure parameters required by the transport layer from 390 * @configure: configure parameters required by the transport layer from
389 * the op_mode. May be called several times before start_fw, can't be 391 * the op_mode. May be called several times before start_fw, can't be
390 * called after that. 392 * called after that.
@@ -420,6 +422,8 @@ struct iwl_trans_ops {
420 void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val); 422 void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val);
421 void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val); 423 void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val);
422 u32 (*read32)(struct iwl_trans *trans, u32 ofs); 424 u32 (*read32)(struct iwl_trans *trans, u32 ofs);
425 u32 (*read_prph)(struct iwl_trans *trans, u32 ofs);
426 void (*write_prph)(struct iwl_trans *trans, u32 ofs, u32 val);
423 void (*configure)(struct iwl_trans *trans, 427 void (*configure)(struct iwl_trans *trans,
424 const struct iwl_trans_config *trans_cfg); 428 const struct iwl_trans_config *trans_cfg);
425 void (*set_pmi)(struct iwl_trans *trans, bool state); 429 void (*set_pmi)(struct iwl_trans *trans, bool state);
@@ -489,10 +493,6 @@ struct iwl_trans {
489static inline void iwl_trans_configure(struct iwl_trans *trans, 493static inline void iwl_trans_configure(struct iwl_trans *trans,
490 const struct iwl_trans_config *trans_cfg) 494 const struct iwl_trans_config *trans_cfg)
491{ 495{
492 /*
493 * only set the op_mode for the moment. Later on, this function will do
494 * more
495 */
496 trans->op_mode = trans_cfg->op_mode; 496 trans->op_mode = trans_cfg->op_mode;
497 497
498 trans->ops->configure(trans, trans_cfg); 498 trans->ops->configure(trans, trans_cfg);
@@ -512,6 +512,9 @@ static inline void iwl_trans_stop_hw(struct iwl_trans *trans,
512 512
513 trans->ops->stop_hw(trans, op_mode_leaving); 513 trans->ops->stop_hw(trans, op_mode_leaving);
514 514
515 if (op_mode_leaving)
516 trans->op_mode = NULL;
517
515 trans->state = IWL_TRANS_NO_FW; 518 trans->state = IWL_TRANS_NO_FW;
516} 519}
517 520
@@ -665,6 +668,17 @@ static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs)
665 return trans->ops->read32(trans, ofs); 668 return trans->ops->read32(trans, ofs);
666} 669}
667 670
671static inline u32 iwl_trans_read_prph(struct iwl_trans *trans, u32 ofs)
672{
673 return trans->ops->read_prph(trans, ofs);
674}
675
676static inline void iwl_trans_write_prph(struct iwl_trans *trans, u32 ofs,
677 u32 val)
678{
679 return trans->ops->write_prph(trans, ofs, val);
680}
681
668static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) 682static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state)
669{ 683{
670 trans->ops->set_pmi(trans, state); 684 trans->ops->set_pmi(trans, state);
diff --git a/drivers/net/wireless/iwlwifi/pcie/1000.c b/drivers/net/wireless/iwlwifi/pcie/1000.c
index 81b83f484f08..f8620ecae6b4 100644
--- a/drivers/net/wireless/iwlwifi/pcie/1000.c
+++ b/drivers/net/wireless/iwlwifi/pcie/1000.c
@@ -94,8 +94,8 @@ static const struct iwl_eeprom_params iwl1000_eeprom_params = {
94 .device_family = IWL_DEVICE_FAMILY_1000, \ 94 .device_family = IWL_DEVICE_FAMILY_1000, \
95 .max_inst_size = IWLAGN_RTC_INST_SIZE, \ 95 .max_inst_size = IWLAGN_RTC_INST_SIZE, \
96 .max_data_size = IWLAGN_RTC_DATA_SIZE, \ 96 .max_data_size = IWLAGN_RTC_DATA_SIZE, \
97 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, \ 97 .nvm_ver = EEPROM_1000_EEPROM_VERSION, \
98 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ 98 .nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION, \
99 .base_params = &iwl1000_base_params, \ 99 .base_params = &iwl1000_base_params, \
100 .eeprom_params = &iwl1000_eeprom_params, \ 100 .eeprom_params = &iwl1000_eeprom_params, \
101 .led_mode = IWL_LED_BLINK 101 .led_mode = IWL_LED_BLINK
@@ -119,8 +119,8 @@ const struct iwl_cfg iwl1000_bg_cfg = {
119 .device_family = IWL_DEVICE_FAMILY_100, \ 119 .device_family = IWL_DEVICE_FAMILY_100, \
120 .max_inst_size = IWLAGN_RTC_INST_SIZE, \ 120 .max_inst_size = IWLAGN_RTC_INST_SIZE, \
121 .max_data_size = IWLAGN_RTC_DATA_SIZE, \ 121 .max_data_size = IWLAGN_RTC_DATA_SIZE, \
122 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, \ 122 .nvm_ver = EEPROM_1000_EEPROM_VERSION, \
123 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ 123 .nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION, \
124 .base_params = &iwl1000_base_params, \ 124 .base_params = &iwl1000_base_params, \
125 .eeprom_params = &iwl1000_eeprom_params, \ 125 .eeprom_params = &iwl1000_eeprom_params, \
126 .led_mode = IWL_LED_RF_STATE, \ 126 .led_mode = IWL_LED_RF_STATE, \
diff --git a/drivers/net/wireless/iwlwifi/pcie/2000.c b/drivers/net/wireless/iwlwifi/pcie/2000.c
index 9fbde32f7559..244019cec3e1 100644
--- a/drivers/net/wireless/iwlwifi/pcie/2000.c
+++ b/drivers/net/wireless/iwlwifi/pcie/2000.c
@@ -138,8 +138,8 @@ static const struct iwl_eeprom_params iwl20x0_eeprom_params = {
138 .device_family = IWL_DEVICE_FAMILY_2000, \ 138 .device_family = IWL_DEVICE_FAMILY_2000, \
139 .max_inst_size = IWL60_RTC_INST_SIZE, \ 139 .max_inst_size = IWL60_RTC_INST_SIZE, \
140 .max_data_size = IWL60_RTC_DATA_SIZE, \ 140 .max_data_size = IWL60_RTC_DATA_SIZE, \
141 .eeprom_ver = EEPROM_2000_EEPROM_VERSION, \ 141 .nvm_ver = EEPROM_2000_EEPROM_VERSION, \
142 .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ 142 .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
143 .base_params = &iwl2000_base_params, \ 143 .base_params = &iwl2000_base_params, \
144 .eeprom_params = &iwl20x0_eeprom_params, \ 144 .eeprom_params = &iwl20x0_eeprom_params, \
145 .need_temp_offset_calib = true, \ 145 .need_temp_offset_calib = true, \
@@ -166,8 +166,8 @@ const struct iwl_cfg iwl2000_2bgn_d_cfg = {
166 .device_family = IWL_DEVICE_FAMILY_2030, \ 166 .device_family = IWL_DEVICE_FAMILY_2030, \
167 .max_inst_size = IWL60_RTC_INST_SIZE, \ 167 .max_inst_size = IWL60_RTC_INST_SIZE, \
168 .max_data_size = IWL60_RTC_DATA_SIZE, \ 168 .max_data_size = IWL60_RTC_DATA_SIZE, \
169 .eeprom_ver = EEPROM_2000_EEPROM_VERSION, \ 169 .nvm_ver = EEPROM_2000_EEPROM_VERSION, \
170 .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ 170 .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
171 .base_params = &iwl2030_base_params, \ 171 .base_params = &iwl2030_base_params, \
172 .bt_params = &iwl2030_bt_params, \ 172 .bt_params = &iwl2030_bt_params, \
173 .eeprom_params = &iwl20x0_eeprom_params, \ 173 .eeprom_params = &iwl20x0_eeprom_params, \
@@ -190,8 +190,8 @@ const struct iwl_cfg iwl2030_2bgn_cfg = {
190 .device_family = IWL_DEVICE_FAMILY_105, \ 190 .device_family = IWL_DEVICE_FAMILY_105, \
191 .max_inst_size = IWL60_RTC_INST_SIZE, \ 191 .max_inst_size = IWL60_RTC_INST_SIZE, \
192 .max_data_size = IWL60_RTC_DATA_SIZE, \ 192 .max_data_size = IWL60_RTC_DATA_SIZE, \
193 .eeprom_ver = EEPROM_2000_EEPROM_VERSION, \ 193 .nvm_ver = EEPROM_2000_EEPROM_VERSION, \
194 .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ 194 .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
195 .base_params = &iwl2000_base_params, \ 195 .base_params = &iwl2000_base_params, \
196 .eeprom_params = &iwl20x0_eeprom_params, \ 196 .eeprom_params = &iwl20x0_eeprom_params, \
197 .need_temp_offset_calib = true, \ 197 .need_temp_offset_calib = true, \
@@ -220,8 +220,8 @@ const struct iwl_cfg iwl105_bgn_d_cfg = {
220 .device_family = IWL_DEVICE_FAMILY_135, \ 220 .device_family = IWL_DEVICE_FAMILY_135, \
221 .max_inst_size = IWL60_RTC_INST_SIZE, \ 221 .max_inst_size = IWL60_RTC_INST_SIZE, \
222 .max_data_size = IWL60_RTC_DATA_SIZE, \ 222 .max_data_size = IWL60_RTC_DATA_SIZE, \
223 .eeprom_ver = EEPROM_2000_EEPROM_VERSION, \ 223 .nvm_ver = EEPROM_2000_EEPROM_VERSION, \
224 .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ 224 .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
225 .base_params = &iwl2030_base_params, \ 225 .base_params = &iwl2030_base_params, \
226 .bt_params = &iwl2030_bt_params, \ 226 .bt_params = &iwl2030_bt_params, \
227 .eeprom_params = &iwl20x0_eeprom_params, \ 227 .eeprom_params = &iwl20x0_eeprom_params, \
diff --git a/drivers/net/wireless/iwlwifi/pcie/5000.c b/drivers/net/wireless/iwlwifi/pcie/5000.c
index d1665fa6d15a..83ca40321ff1 100644
--- a/drivers/net/wireless/iwlwifi/pcie/5000.c
+++ b/drivers/net/wireless/iwlwifi/pcie/5000.c
@@ -92,8 +92,8 @@ static const struct iwl_eeprom_params iwl5000_eeprom_params = {
92 .device_family = IWL_DEVICE_FAMILY_5000, \ 92 .device_family = IWL_DEVICE_FAMILY_5000, \
93 .max_inst_size = IWLAGN_RTC_INST_SIZE, \ 93 .max_inst_size = IWLAGN_RTC_INST_SIZE, \
94 .max_data_size = IWLAGN_RTC_DATA_SIZE, \ 94 .max_data_size = IWLAGN_RTC_DATA_SIZE, \
95 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, \ 95 .nvm_ver = EEPROM_5000_EEPROM_VERSION, \
96 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, \ 96 .nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION, \
97 .base_params = &iwl5000_base_params, \ 97 .base_params = &iwl5000_base_params, \
98 .eeprom_params = &iwl5000_eeprom_params, \ 98 .eeprom_params = &iwl5000_eeprom_params, \
99 .led_mode = IWL_LED_BLINK 99 .led_mode = IWL_LED_BLINK
@@ -139,8 +139,8 @@ const struct iwl_cfg iwl5350_agn_cfg = {
139 .device_family = IWL_DEVICE_FAMILY_5000, 139 .device_family = IWL_DEVICE_FAMILY_5000,
140 .max_inst_size = IWLAGN_RTC_INST_SIZE, 140 .max_inst_size = IWLAGN_RTC_INST_SIZE,
141 .max_data_size = IWLAGN_RTC_DATA_SIZE, 141 .max_data_size = IWLAGN_RTC_DATA_SIZE,
142 .eeprom_ver = EEPROM_5050_EEPROM_VERSION, 142 .nvm_ver = EEPROM_5050_EEPROM_VERSION,
143 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, 143 .nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,
144 .base_params = &iwl5000_base_params, 144 .base_params = &iwl5000_base_params,
145 .eeprom_params = &iwl5000_eeprom_params, 145 .eeprom_params = &iwl5000_eeprom_params,
146 .ht_params = &iwl5000_ht_params, 146 .ht_params = &iwl5000_ht_params,
@@ -156,8 +156,8 @@ const struct iwl_cfg iwl5350_agn_cfg = {
156 .device_family = IWL_DEVICE_FAMILY_5150, \ 156 .device_family = IWL_DEVICE_FAMILY_5150, \
157 .max_inst_size = IWLAGN_RTC_INST_SIZE, \ 157 .max_inst_size = IWLAGN_RTC_INST_SIZE, \
158 .max_data_size = IWLAGN_RTC_DATA_SIZE, \ 158 .max_data_size = IWLAGN_RTC_DATA_SIZE, \
159 .eeprom_ver = EEPROM_5050_EEPROM_VERSION, \ 159 .nvm_ver = EEPROM_5050_EEPROM_VERSION, \
160 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, \ 160 .nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION, \
161 .base_params = &iwl5000_base_params, \ 161 .base_params = &iwl5000_base_params, \
162 .eeprom_params = &iwl5000_eeprom_params, \ 162 .eeprom_params = &iwl5000_eeprom_params, \
163 .no_xtal_calib = true, \ 163 .no_xtal_calib = true, \
diff --git a/drivers/net/wireless/iwlwifi/pcie/6000.c b/drivers/net/wireless/iwlwifi/pcie/6000.c
index 4a57624afc40..d4df976d4709 100644
--- a/drivers/net/wireless/iwlwifi/pcie/6000.c
+++ b/drivers/net/wireless/iwlwifi/pcie/6000.c
@@ -160,8 +160,8 @@ static const struct iwl_eeprom_params iwl6000_eeprom_params = {
160 .device_family = IWL_DEVICE_FAMILY_6005, \ 160 .device_family = IWL_DEVICE_FAMILY_6005, \
161 .max_inst_size = IWL60_RTC_INST_SIZE, \ 161 .max_inst_size = IWL60_RTC_INST_SIZE, \
162 .max_data_size = IWL60_RTC_DATA_SIZE, \ 162 .max_data_size = IWL60_RTC_DATA_SIZE, \
163 .eeprom_ver = EEPROM_6005_EEPROM_VERSION, \ 163 .nvm_ver = EEPROM_6005_EEPROM_VERSION, \
164 .eeprom_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ 164 .nvm_calib_ver = EEPROM_6005_TX_POWER_VERSION, \
165 .base_params = &iwl6000_g2_base_params, \ 165 .base_params = &iwl6000_g2_base_params, \
166 .eeprom_params = &iwl6000_eeprom_params, \ 166 .eeprom_params = &iwl6000_eeprom_params, \
167 .need_temp_offset_calib = true, \ 167 .need_temp_offset_calib = true, \
@@ -215,8 +215,8 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = {
215 .device_family = IWL_DEVICE_FAMILY_6030, \ 215 .device_family = IWL_DEVICE_FAMILY_6030, \
216 .max_inst_size = IWL60_RTC_INST_SIZE, \ 216 .max_inst_size = IWL60_RTC_INST_SIZE, \
217 .max_data_size = IWL60_RTC_DATA_SIZE, \ 217 .max_data_size = IWL60_RTC_DATA_SIZE, \
218 .eeprom_ver = EEPROM_6030_EEPROM_VERSION, \ 218 .nvm_ver = EEPROM_6030_EEPROM_VERSION, \
219 .eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ 219 .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \
220 .base_params = &iwl6000_g2_base_params, \ 220 .base_params = &iwl6000_g2_base_params, \
221 .bt_params = &iwl6000_bt_params, \ 221 .bt_params = &iwl6000_bt_params, \
222 .eeprom_params = &iwl6000_eeprom_params, \ 222 .eeprom_params = &iwl6000_eeprom_params, \
@@ -254,8 +254,8 @@ const struct iwl_cfg iwl6030_2bg_cfg = {
254 .device_family = IWL_DEVICE_FAMILY_6030, \ 254 .device_family = IWL_DEVICE_FAMILY_6030, \
255 .max_inst_size = IWL60_RTC_INST_SIZE, \ 255 .max_inst_size = IWL60_RTC_INST_SIZE, \
256 .max_data_size = IWL60_RTC_DATA_SIZE, \ 256 .max_data_size = IWL60_RTC_DATA_SIZE, \
257 .eeprom_ver = EEPROM_6030_EEPROM_VERSION, \ 257 .nvm_ver = EEPROM_6030_EEPROM_VERSION, \
258 .eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ 258 .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \
259 .base_params = &iwl6000_g2_base_params, \ 259 .base_params = &iwl6000_g2_base_params, \
260 .bt_params = &iwl6000_bt_params, \ 260 .bt_params = &iwl6000_bt_params, \
261 .eeprom_params = &iwl6000_eeprom_params, \ 261 .eeprom_params = &iwl6000_eeprom_params, \
@@ -306,8 +306,8 @@ const struct iwl_cfg iwl130_bg_cfg = {
306 .max_data_size = IWL60_RTC_DATA_SIZE, \ 306 .max_data_size = IWL60_RTC_DATA_SIZE, \
307 .valid_tx_ant = ANT_BC, /* .cfg overwrite */ \ 307 .valid_tx_ant = ANT_BC, /* .cfg overwrite */ \
308 .valid_rx_ant = ANT_BC, /* .cfg overwrite */ \ 308 .valid_rx_ant = ANT_BC, /* .cfg overwrite */ \
309 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, \ 309 .nvm_ver = EEPROM_6000_EEPROM_VERSION, \
310 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, \ 310 .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION, \
311 .base_params = &iwl6000_base_params, \ 311 .base_params = &iwl6000_base_params, \
312 .eeprom_params = &iwl6000_eeprom_params, \ 312 .eeprom_params = &iwl6000_eeprom_params, \
313 .led_mode = IWL_LED_BLINK 313 .led_mode = IWL_LED_BLINK
@@ -337,8 +337,8 @@ const struct iwl_cfg iwl6000i_2bg_cfg = {
337 .max_data_size = IWL60_RTC_DATA_SIZE, \ 337 .max_data_size = IWL60_RTC_DATA_SIZE, \
338 .valid_tx_ant = ANT_AB, /* .cfg overwrite */ \ 338 .valid_tx_ant = ANT_AB, /* .cfg overwrite */ \
339 .valid_rx_ant = ANT_AB, /* .cfg overwrite */ \ 339 .valid_rx_ant = ANT_AB, /* .cfg overwrite */ \
340 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, \ 340 .nvm_ver = EEPROM_6050_EEPROM_VERSION, \
341 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \ 341 .nvm_calib_ver = EEPROM_6050_TX_POWER_VERSION, \
342 .base_params = &iwl6050_base_params, \ 342 .base_params = &iwl6050_base_params, \
343 .eeprom_params = &iwl6000_eeprom_params, \ 343 .eeprom_params = &iwl6000_eeprom_params, \
344 .led_mode = IWL_LED_BLINK, \ 344 .led_mode = IWL_LED_BLINK, \
@@ -362,8 +362,8 @@ const struct iwl_cfg iwl6050_2abg_cfg = {
362 .device_family = IWL_DEVICE_FAMILY_6150, \ 362 .device_family = IWL_DEVICE_FAMILY_6150, \
363 .max_inst_size = IWL60_RTC_INST_SIZE, \ 363 .max_inst_size = IWL60_RTC_INST_SIZE, \
364 .max_data_size = IWL60_RTC_DATA_SIZE, \ 364 .max_data_size = IWL60_RTC_DATA_SIZE, \
365 .eeprom_ver = EEPROM_6150_EEPROM_VERSION, \ 365 .nvm_ver = EEPROM_6150_EEPROM_VERSION, \
366 .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \ 366 .nvm_calib_ver = EEPROM_6150_TX_POWER_VERSION, \
367 .base_params = &iwl6050_base_params, \ 367 .base_params = &iwl6050_base_params, \
368 .eeprom_params = &iwl6000_eeprom_params, \ 368 .eeprom_params = &iwl6000_eeprom_params, \
369 .led_mode = IWL_LED_BLINK, \ 369 .led_mode = IWL_LED_BLINK, \
@@ -389,8 +389,8 @@ const struct iwl_cfg iwl6000_3agn_cfg = {
389 .device_family = IWL_DEVICE_FAMILY_6000, 389 .device_family = IWL_DEVICE_FAMILY_6000,
390 .max_inst_size = IWL60_RTC_INST_SIZE, 390 .max_inst_size = IWL60_RTC_INST_SIZE,
391 .max_data_size = IWL60_RTC_DATA_SIZE, 391 .max_data_size = IWL60_RTC_DATA_SIZE,
392 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 392 .nvm_ver = EEPROM_6000_EEPROM_VERSION,
393 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 393 .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION,
394 .base_params = &iwl6000_base_params, 394 .base_params = &iwl6000_base_params,
395 .eeprom_params = &iwl6000_eeprom_params, 395 .eeprom_params = &iwl6000_eeprom_params,
396 .ht_params = &iwl6000_ht_params, 396 .ht_params = &iwl6000_ht_params,
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index 2b7e8a0b1cd4..c2e141af353c 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -267,6 +267,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
267 const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); 267 const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
268 struct iwl_trans *iwl_trans; 268 struct iwl_trans *iwl_trans;
269 struct iwl_trans_pcie *trans_pcie; 269 struct iwl_trans_pcie *trans_pcie;
270 int ret;
270 271
271 iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); 272 iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
272 if (iwl_trans == NULL) 273 if (iwl_trans == NULL)
@@ -276,11 +277,15 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
276 277
277 trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); 278 trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
278 trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); 279 trans_pcie->drv = iwl_drv_start(iwl_trans, cfg);
279 if (!trans_pcie->drv) 280
281 if (IS_ERR_OR_NULL(trans_pcie->drv)) {
282 ret = PTR_ERR(trans_pcie->drv);
280 goto out_free_trans; 283 goto out_free_trans;
284 }
281 285
282 /* register transport layer debugfs here */ 286 /* register transport layer debugfs here */
283 if (iwl_trans_dbgfs_register(iwl_trans, iwl_trans->dbgfs_dir)) 287 ret = iwl_trans_dbgfs_register(iwl_trans, iwl_trans->dbgfs_dir);
288 if (ret)
284 goto out_free_drv; 289 goto out_free_drv;
285 290
286 return 0; 291 return 0;
@@ -290,7 +295,7 @@ out_free_drv:
290out_free_trans: 295out_free_trans:
291 iwl_trans_pcie_free(iwl_trans); 296 iwl_trans_pcie_free(iwl_trans);
292 pci_set_drvdata(pdev, NULL); 297 pci_set_drvdata(pdev, NULL);
293 return -EFAULT; 298 return ret;
294} 299}
295 300
296static void iwl_pci_remove(struct pci_dev *pdev) 301static void iwl_pci_remove(struct pci_dev *pdev)
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index bb32510fdd62..dad4c4aad91f 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -717,7 +717,7 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans)
717 717
718 /* uCode's read index (stored in shared DRAM) indicates the last Rx 718 /* uCode's read index (stored in shared DRAM) indicates the last Rx
719 * buffer that the driver may process (last buffer filled by ucode). */ 719 * buffer that the driver may process (last buffer filled by ucode). */
720 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF; 720 r = le16_to_cpu(ACCESS_ONCE(rxq->rb_stts->closed_rb_num)) & 0x0FFF;
721 i = rxq->read; 721 i = rxq->read;
722 722
723 /* Rx interrupt, but nothing sent from uCode */ 723 /* Rx interrupt, but nothing sent from uCode */
@@ -1122,12 +1122,20 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
1122 * back-to-back ISRs and sporadic interrupts from our NIC. 1122 * back-to-back ISRs and sporadic interrupts from our NIC.
1123 * If we have something to service, the tasklet will re-enable ints. 1123 * If we have something to service, the tasklet will re-enable ints.
1124 * If we *don't* have something, we'll re-enable before leaving here. */ 1124 * If we *don't* have something, we'll re-enable before leaving here. */
1125 inta_mask = iwl_read32(trans, CSR_INT_MASK); /* just for debug */ 1125 inta_mask = iwl_read32(trans, CSR_INT_MASK);
1126 iwl_write32(trans, CSR_INT_MASK, 0x00000000); 1126 iwl_write32(trans, CSR_INT_MASK, 0x00000000);
1127 1127
1128 /* Discover which interrupts are active/pending */ 1128 /* Discover which interrupts are active/pending */
1129 inta = iwl_read32(trans, CSR_INT); 1129 inta = iwl_read32(trans, CSR_INT);
1130 1130
1131 if (inta & (~inta_mask)) {
1132 IWL_DEBUG_ISR(trans,
1133 "We got a masked interrupt (0x%08x)...Ack and ignore\n",
1134 inta & (~inta_mask));
1135 iwl_write32(trans, CSR_INT, inta & (~inta_mask));
1136 inta &= inta_mask;
1137 }
1138
1131 /* Ignore interrupt if there's nothing in NIC to service. 1139 /* Ignore interrupt if there's nothing in NIC to service.
1132 * This may be due to IRQ shared with another device, 1140 * This may be due to IRQ shared with another device,
1133 * or due to sporadic interrupts thrown from our NIC. */ 1141 * or due to sporadic interrupts thrown from our NIC. */
@@ -1209,7 +1217,7 @@ irqreturn_t iwl_pcie_isr_ict(int irq, void *data)
1209 * If we have something to service, the tasklet will re-enable ints. 1217 * If we have something to service, the tasklet will re-enable ints.
1210 * If we *don't* have something, we'll re-enable before leaving here. 1218 * If we *don't* have something, we'll re-enable before leaving here.
1211 */ 1219 */
1212 inta_mask = iwl_read32(trans, CSR_INT_MASK); /* just for debug */ 1220 inta_mask = iwl_read32(trans, CSR_INT_MASK);
1213 iwl_write32(trans, CSR_INT_MASK, 0x00000000); 1221 iwl_write32(trans, CSR_INT_MASK, 0x00000000);
1214 1222
1215 /* Ignore interrupt if there's nothing in NIC to service. 1223 /* Ignore interrupt if there's nothing in NIC to service.
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index f6c21e7edaf2..d66cad4a7d6a 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -633,6 +633,8 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans,
633 iwl_disable_interrupts(trans); 633 iwl_disable_interrupts(trans);
634 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); 634 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
635 635
636 iwl_pcie_disable_ict(trans);
637
636 if (!op_mode_leaving) { 638 if (!op_mode_leaving) {
637 /* 639 /*
638 * Even if we stop the HW, we still want the RF kill 640 * Even if we stop the HW, we still want the RF kill
@@ -666,6 +668,20 @@ static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs)
666 return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs); 668 return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs);
667} 669}
668 670
671static u32 iwl_trans_pcie_read_prph(struct iwl_trans *trans, u32 reg)
672{
673 iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
674 return iwl_trans_pcie_read32(trans, HBUS_TARG_PRPH_RDAT);
675}
676
677static void iwl_trans_pcie_write_prph(struct iwl_trans *trans, u32 addr,
678 u32 val)
679{
680 iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WADDR,
681 ((addr & 0x0000FFFF) | (3 << 24)));
682 iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WDAT, val);
683}
684
669static void iwl_trans_pcie_configure(struct iwl_trans *trans, 685static void iwl_trans_pcie_configure(struct iwl_trans *trans,
670 const struct iwl_trans_config *trans_cfg) 686 const struct iwl_trans_config *trans_cfg)
671{ 687{
@@ -1221,6 +1237,8 @@ static const struct iwl_trans_ops trans_ops_pcie = {
1221 .write8 = iwl_trans_pcie_write8, 1237 .write8 = iwl_trans_pcie_write8,
1222 .write32 = iwl_trans_pcie_write32, 1238 .write32 = iwl_trans_pcie_write32,
1223 .read32 = iwl_trans_pcie_read32, 1239 .read32 = iwl_trans_pcie_read32,
1240 .read_prph = iwl_trans_pcie_read_prph,
1241 .write_prph = iwl_trans_pcie_write_prph,
1224 .configure = iwl_trans_pcie_configure, 1242 .configure = iwl_trans_pcie_configure,
1225 .set_pmi = iwl_trans_pcie_set_pmi, 1243 .set_pmi = iwl_trans_pcie_set_pmi,
1226}; 1244};
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 8a61dbd320e6..ff9085502bea 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2223,7 +2223,7 @@ static int __init init_mac80211_hwsim(void)
2223 IEEE80211_VHT_CAP_RXSTBC_2 | 2223 IEEE80211_VHT_CAP_RXSTBC_2 |
2224 IEEE80211_VHT_CAP_RXSTBC_3 | 2224 IEEE80211_VHT_CAP_RXSTBC_3 |
2225 IEEE80211_VHT_CAP_RXSTBC_4 | 2225 IEEE80211_VHT_CAP_RXSTBC_4 |
2226 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT; 2226 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
2227 sband->vht_cap.vht_mcs.rx_mcs_map = 2227 sband->vht_cap.vht_mcs.rx_mcs_map =
2228 cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_8 << 0 | 2228 cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_8 << 0 |
2229 IEEE80211_VHT_MCS_SUPPORT_0_8 << 2 | 2229 IEEE80211_VHT_MCS_SUPPORT_0_8 << 2 |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index d4d0c3664eb2..197b4466a5d2 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -5090,7 +5090,8 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
5090 IEEE80211_HW_SUPPORTS_PS | 5090 IEEE80211_HW_SUPPORTS_PS |
5091 IEEE80211_HW_PS_NULLFUNC_STACK | 5091 IEEE80211_HW_PS_NULLFUNC_STACK |
5092 IEEE80211_HW_AMPDU_AGGREGATION | 5092 IEEE80211_HW_AMPDU_AGGREGATION |
5093 IEEE80211_HW_REPORTS_TX_ACK_STATUS; 5093 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
5094 IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL;
5094 5095
5095 /* 5096 /*
5096 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices 5097 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 023081286e0c..5c149b58ab46 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1170,6 +1170,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
1170 { USB_DEVICE(0x2001, 0x3c19) }, 1170 { USB_DEVICE(0x2001, 0x3c19) },
1171 { USB_DEVICE(0x2001, 0x3c1c) }, 1171 { USB_DEVICE(0x2001, 0x3c1c) },
1172 { USB_DEVICE(0x2001, 0x3c1d) }, 1172 { USB_DEVICE(0x2001, 0x3c1d) },
1173 { USB_DEVICE(0x2001, 0x3c1e) },
1173 /* LG innotek */ 1174 /* LG innotek */
1174 { USB_DEVICE(0x043e, 0x7a22) }, 1175 { USB_DEVICE(0x043e, 0x7a22) },
1175 /* Panasonic */ 1176 /* Panasonic */
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 3248b4224c4e..4ffb6a584cd0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -392,10 +392,9 @@ void rt2x00lib_txdone(struct queue_entry *entry,
392 tx_info->flags |= IEEE80211_TX_STAT_AMPDU; 392 tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
393 tx_info->status.ampdu_len = 1; 393 tx_info->status.ampdu_len = 1;
394 tx_info->status.ampdu_ack_len = success ? 1 : 0; 394 tx_info->status.ampdu_ack_len = success ? 1 : 0;
395 /* 395
396 * TODO: Need to tear down BA session here 396 if (!success)
397 * if not successful. 397 tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
398 */
399 } 398 }
400 399
401 if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { 400 if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 58c7da29a37c..6e0daaa0e04b 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -1126,8 +1126,7 @@ static u32 ssb_tmslow_reject_bitmask(struct ssb_device *dev)
1126 case SSB_IDLOW_SSBREV_27: /* same here */ 1126 case SSB_IDLOW_SSBREV_27: /* same here */
1127 return SSB_TMSLOW_REJECT; /* this is a guess */ 1127 return SSB_TMSLOW_REJECT; /* this is a guess */
1128 default: 1128 default:
1129 printk(KERN_INFO "ssb: Backplane Revision 0x%.8X\n", rev); 1129 WARN(1, KERN_INFO "ssb: Backplane Revision 0x%.8X\n", rev);
1130 WARN_ON(1);
1131 } 1130 }
1132 return (SSB_TMSLOW_REJECT | SSB_TMSLOW_REJECT_23); 1131 return (SSB_TMSLOW_REJECT | SSB_TMSLOW_REJECT_23);
1133} 1132}
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index 6e3f54f37844..fcdd81bd5314 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -22,6 +22,8 @@
22#define ATH9K_PLAT_EEP_MAX_WORDS 2048 22#define ATH9K_PLAT_EEP_MAX_WORDS 2048
23 23
24struct ath9k_platform_data { 24struct ath9k_platform_data {
25 const char *eeprom_name;
26
25 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; 27 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
26 u8 *macaddr; 28 u8 *macaddr;
27 29
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 8f690e53dd89..f0859cc73861 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1251,32 +1251,34 @@ struct ieee80211_vht_operation {
1251#define IEEE80211_VHT_MCS_NOT_SUPPORTED 3 1251#define IEEE80211_VHT_MCS_NOT_SUPPORTED 3
1252 1252
1253/* 802.11ac VHT Capabilities */ 1253/* 802.11ac VHT Capabilities */
1254#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 1254#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000
1255#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 1255#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001
1256#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 1256#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002
1257#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004 1257#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
1258#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008 1258#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
1259#define IEEE80211_VHT_CAP_RXLDPC 0x00000010 1259#define IEEE80211_VHT_CAP_RXLDPC 0x00000010
1260#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 1260#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020
1261#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 1261#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040
1262#define IEEE80211_VHT_CAP_TXSTBC 0x00000080 1262#define IEEE80211_VHT_CAP_TXSTBC 0x00000080
1263#define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 1263#define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100
1264#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 1264#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200
1265#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 1265#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
1266#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 1266#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
1267#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 1267#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
1268#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 1268#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
1269#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 1269#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000
1270#define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000 1270#define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000
1271#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 1271#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000
1272#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 1272#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000
1273#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 1273#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
1274#define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 1274#define IEEE80211_VHT_CAP_HTC_VHT 0x00400000
1275#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT 0x00800000 1275#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23
1276#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000 1276#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
1277#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 1277 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT)
1278#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 1278#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000
1279#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 1279#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000
1280#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000
1281#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000
1280 1282
1281/* Authentication algorithms */ 1283/* Authentication algorithms */
1282#define WLAN_AUTH_OPEN 0 1284#define WLAN_AUTH_OPEN 0
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 1c02fb3b3817..ee50c5eba50c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1369,6 +1369,10 @@ struct ieee80211_tx_control {
1369 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any 1369 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
1370 * P2P Interface. This will be honoured even if more than one interface 1370 * P2P Interface. This will be honoured even if more than one interface
1371 * is supported. 1371 * is supported.
1372 *
1373 * @IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL: On this hardware TX BA session
1374 * should be tear down once BAR frame will not be acked.
1375 *
1372 */ 1376 */
1373enum ieee80211_hw_flags { 1377enum ieee80211_hw_flags {
1374 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1378 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1397,6 +1401,7 @@ enum ieee80211_hw_flags {
1397 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1401 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1398 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, 1402 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1399 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1403 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1404 IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL = 1<<26,
1400}; 1405};
1401 1406
1402/** 1407/**
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 4152ed1034b8..eb9df22418f0 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -445,7 +445,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
445 445
446 trace_api_start_tx_ba_session(pubsta, tid); 446 trace_api_start_tx_ba_session(pubsta, tid);
447 447
448 if (WARN_ON(!local->ops->ampdu_action)) 448 if (WARN_ON_ONCE(!local->ops->ampdu_action))
449 return -EINVAL; 449 return -EINVAL;
450 450
451 if ((tid >= IEEE80211_NUM_TIDS) || 451 if ((tid >= IEEE80211_NUM_TIDS) ||
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 2d4235497f1b..c3a3082b72e5 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -199,6 +199,22 @@ static ssize_t key_icverrors_read(struct file *file, char __user *userbuf,
199} 199}
200KEY_OPS(icverrors); 200KEY_OPS(icverrors);
201 201
202static ssize_t key_mic_failures_read(struct file *file, char __user *userbuf,
203 size_t count, loff_t *ppos)
204{
205 struct ieee80211_key *key = file->private_data;
206 char buf[20];
207 int len;
208
209 if (key->conf.cipher != WLAN_CIPHER_SUITE_TKIP)
210 return -EINVAL;
211
212 len = scnprintf(buf, sizeof(buf), "%u\n", key->u.tkip.mic_failures);
213
214 return simple_read_from_buffer(userbuf, count, ppos, buf, len);
215}
216KEY_OPS(mic_failures);
217
202static ssize_t key_key_read(struct file *file, char __user *userbuf, 218static ssize_t key_key_read(struct file *file, char __user *userbuf,
203 size_t count, loff_t *ppos) 219 size_t count, loff_t *ppos)
204{ 220{
@@ -260,6 +276,7 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key)
260 DEBUGFS_ADD(rx_spec); 276 DEBUGFS_ADD(rx_spec);
261 DEBUGFS_ADD(replays); 277 DEBUGFS_ADD(replays);
262 DEBUGFS_ADD(icverrors); 278 DEBUGFS_ADD(icverrors);
279 DEBUGFS_ADD(mic_failures);
263 DEBUGFS_ADD(key); 280 DEBUGFS_ADD(key);
264 DEBUGFS_ADD(ifindex); 281 DEBUGFS_ADD(ifindex);
265}; 282};
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index fa862b24a7e0..8881fc77fb13 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -201,6 +201,20 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
201 bss_change |= BSS_CHANGED_BASIC_RATES; 201 bss_change |= BSS_CHANGED_BASIC_RATES;
202 bss_change |= BSS_CHANGED_HT; 202 bss_change |= BSS_CHANGED_HT;
203 bss_change |= BSS_CHANGED_IBSS; 203 bss_change |= BSS_CHANGED_IBSS;
204
205 /*
206 * In 5 GHz/802.11a, we can always use short slot time.
207 * (IEEE 802.11-2012 18.3.8.7)
208 *
209 * In 2.4GHz, we must always use long slots in IBSS for compatibility
210 * reasons.
211 * (IEEE 802.11-2012 19.4.5)
212 *
213 * HT follows these specifications (IEEE 802.11-2012 20.3.18)
214 */
215 sdata->vif.bss_conf.use_short_slot = chan->band == IEEE80211_BAND_5GHZ;
216 bss_change |= BSS_CHANGED_ERP_SLOT;
217
204 sdata->vif.bss_conf.ibss_joined = true; 218 sdata->vif.bss_conf.ibss_joined = true;
205 sdata->vif.bss_conf.ibss_creator = creator; 219 sdata->vif.bss_conf.ibss_creator = creator;
206 ieee80211_bss_info_change_notify(sdata, bss_change); 220 ieee80211_bss_info_change_notify(sdata, bss_change);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 40c36d5d7377..09a80b55cf5a 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -862,7 +862,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
862 rcu_assign_pointer(local->p2p_sdata, NULL); 862 rcu_assign_pointer(local->p2p_sdata, NULL);
863 /* fall through */ 863 /* fall through */
864 default: 864 default:
865 flush_work(&sdata->work); 865 cancel_work_sync(&sdata->work);
866 /* 866 /*
867 * When we get here, the interface is marked down. 867 * When we get here, the interface is marked down.
868 * Call rcu_barrier() to wait both for the RX path 868 * Call rcu_barrier() to wait both for the RX path
diff --git a/net/mac80211/key.h b/net/mac80211/key.h
index 7cff0d3a519c..382dc44ed330 100644
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -81,6 +81,9 @@ struct ieee80211_key {
81 81
82 /* last received RSC */ 82 /* last received RSC */
83 struct tkip_ctx rx[IEEE80211_NUM_TIDS]; 83 struct tkip_ctx rx[IEEE80211_NUM_TIDS];
84
85 /* number of mic failures */
86 u32 mic_failures;
84 } tkip; 87 } tkip;
85 struct { 88 struct {
86 atomic64_t tx_pn; 89 atomic64_t tx_pn;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 09556303c7e1..7753a9ca98a6 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2360,9 +2360,9 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2360 2360
2361 return RX_MGMT_CFG80211_RX_ASSOC; 2361 return RX_MGMT_CFG80211_RX_ASSOC;
2362} 2362}
2363
2363static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, 2364static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
2364 struct ieee80211_mgmt *mgmt, 2365 struct ieee80211_mgmt *mgmt, size_t len,
2365 size_t len,
2366 struct ieee80211_rx_status *rx_status, 2366 struct ieee80211_rx_status *rx_status,
2367 struct ieee802_11_elems *elems, 2367 struct ieee802_11_elems *elems,
2368 bool beacon) 2368 bool beacon)
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 79633ae06fd6..8c5acdc06226 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -154,6 +154,7 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
154 struct ieee80211_sta *sta, void *priv_sta, 154 struct ieee80211_sta *sta, void *priv_sta,
155 struct sk_buff *skb) 155 struct sk_buff *skb)
156{ 156{
157 struct minstrel_priv *mp = priv;
157 struct minstrel_sta_info *mi = priv_sta; 158 struct minstrel_sta_info *mi = priv_sta;
158 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 159 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
159 struct ieee80211_tx_rate *ar = info->status.rates; 160 struct ieee80211_tx_rate *ar = info->status.rates;
@@ -181,6 +182,10 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
181 182
182 if (mi->sample_deferred > 0) 183 if (mi->sample_deferred > 0)
183 mi->sample_deferred--; 184 mi->sample_deferred--;
185
186 if (time_after(jiffies, mi->stats_update +
187 (mp->update_interval * HZ) / 1000))
188 minstrel_update_stats(mp, mi);
184} 189}
185 190
186 191
@@ -235,10 +240,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
235 240
236 mrr = mp->has_mrr && !txrc->rts && !txrc->bss_conf->use_cts_prot; 241 mrr = mp->has_mrr && !txrc->rts && !txrc->bss_conf->use_cts_prot;
237 242
238 if (time_after(jiffies, mi->stats_update + (mp->update_interval *
239 HZ) / 1000))
240 minstrel_update_stats(mp, mi);
241
242 ndx = mi->max_tp_rate; 243 ndx = mi->max_tp_rate;
243 244
244 if (mrr) 245 if (mrr)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index db343fa8033c..580704eba8b8 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -378,9 +378,6 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
378 * the SKB because it has a bad FCS/PLCP checksum. 378 * the SKB because it has a bad FCS/PLCP checksum.
379 */ 379 */
380 380
381 /* room for the radiotap header based on driver features */
382 needed_headroom = ieee80211_rx_radiotap_space(local, status);
383
384 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) 381 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
385 present_fcs_len = FCS_LEN; 382 present_fcs_len = FCS_LEN;
386 383
@@ -399,6 +396,9 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
399 return remove_monitor_info(local, origskb); 396 return remove_monitor_info(local, origskb);
400 } 397 }
401 398
399 /* room for the radiotap header based on driver features */
400 needed_headroom = ieee80211_rx_radiotap_space(local, status);
401
402 if (should_drop_frame(origskb, present_fcs_len)) { 402 if (should_drop_frame(origskb, present_fcs_len)) {
403 /* only need to expand headroom if necessary */ 403 /* only need to expand headroom if necessary */
404 skb = origskb; 404 skb = origskb;
@@ -2333,7 +2333,8 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
2333 if (len < IEEE80211_MIN_ACTION_SIZE) 2333 if (len < IEEE80211_MIN_ACTION_SIZE)
2334 return RX_DROP_UNUSABLE; 2334 return RX_DROP_UNUSABLE;
2335 2335
2336 if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC) 2336 if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC &&
2337 mgmt->u.action.category != WLAN_CATEGORY_SELF_PROTECTED)
2337 return RX_DROP_UNUSABLE; 2338 return RX_DROP_UNUSABLE;
2338 2339
2339 if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) 2340 if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index f7176ac5a535..8ed83dcc149f 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -118,7 +118,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
118 struct ieee80211_tim_ie *tim_ie = elems->tim; 118 struct ieee80211_tim_ie *tim_ie = elems->tim;
119 bss->dtim_period = tim_ie->dtim_period; 119 bss->dtim_period = tim_ie->dtim_period;
120 if (!elems->parse_error) 120 if (!elems->parse_error)
121 bss->valid_data |= IEEE80211_BSS_VALID_DTIM; 121 bss->valid_data |= IEEE80211_BSS_VALID_DTIM;
122 } 122 }
123 123
124 /* If the beacon had no TIM IE, or it was invalid, use 1 */ 124 /* If the beacon had no TIM IE, or it was invalid, use 1 */
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index ab50285fcbab..07d99578a2b1 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -502,7 +502,11 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
502 IEEE80211_BAR_CTRL_TID_INFO_MASK) >> 502 IEEE80211_BAR_CTRL_TID_INFO_MASK) >>
503 IEEE80211_BAR_CTRL_TID_INFO_SHIFT; 503 IEEE80211_BAR_CTRL_TID_INFO_SHIFT;
504 504
505 ieee80211_set_bar_pending(sta, tid, ssn); 505 if (local->hw.flags &
506 IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL)
507 ieee80211_stop_tx_ba_session(&sta->sta, tid);
508 else
509 ieee80211_set_bar_pending(sta, tid, ssn);
506 } 510 }
507 } 511 }
508 512
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 8bd2f5c6a56e..c175ee866ff4 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -104,7 +104,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
104 */ 104 */
105 if (status->flag & (RX_FLAG_MMIC_STRIPPED | RX_FLAG_IV_STRIPPED)) { 105 if (status->flag & (RX_FLAG_MMIC_STRIPPED | RX_FLAG_IV_STRIPPED)) {
106 if (status->flag & RX_FLAG_MMIC_ERROR) 106 if (status->flag & RX_FLAG_MMIC_ERROR)
107 goto mic_fail; 107 goto mic_fail_no_key;
108 108
109 if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key && 109 if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key &&
110 rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP) 110 rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
@@ -161,6 +161,9 @@ update_iv:
161 return RX_CONTINUE; 161 return RX_CONTINUE;
162 162
163mic_fail: 163mic_fail:
164 rx->key->u.tkip.mic_failures++;
165
166mic_fail_no_key:
164 /* 167 /*
165 * In some cases the key can be unset - e.g. a multicast packet, in 168 * In some cases the key can be unset - e.g. a multicast packet, in
166 * a driver that supports HW encryption. Send up the key idx only if 169 * a driver that supports HW encryption. Send up the key idx only if
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index b5f69831e318..a7990bb16529 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -265,6 +265,9 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
265 265
266 /* TODO: missing regulatory check on 80/160 bandwidth */ 266 /* TODO: missing regulatory check on 80/160 bandwidth */
267 267
268 if (width > 20)
269 prohibited_flags |= IEEE80211_CHAN_NO_OFDM;
270
268 if (!cfg80211_secondary_chans_ok(wiphy, chandef->center_freq1, 271 if (!cfg80211_secondary_chans_ok(wiphy, chandef->center_freq1,
269 width, prohibited_flags)) 272 width, prohibited_flags))
270 return false; 273 return false;
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index f9680c9cf9b3..d997d0f0c54a 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -176,7 +176,7 @@ int cfg80211_wext_giwrange(struct net_device *dev,
176 case CFG80211_SIGNAL_TYPE_NONE: 176 case CFG80211_SIGNAL_TYPE_NONE:
177 break; 177 break;
178 case CFG80211_SIGNAL_TYPE_MBM: 178 case CFG80211_SIGNAL_TYPE_MBM:
179 range->max_qual.level = -110; 179 range->max_qual.level = (u8)-110;
180 range->max_qual.qual = 70; 180 range->max_qual.qual = 70;
181 range->avg_qual.qual = 35; 181 range->avg_qual.qual = 35;
182 range->max_qual.updated |= IW_QUAL_DBM; 182 range->max_qual.updated |= IW_QUAL_DBM;