Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'wireless-drivers-next-for-davem-2016-07-22' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
pull-request: wireless-drivers-next 2016-07-22

I'm sick so I have to keep this short, but here's the last pull request
to net-next. This time there's a trivial conflict with mtd tree:

http://lkml.kernel.org/g/20160720123133.44dab209@canb.auug.org.au

We concluded with Brian (CCed) that it's best that we ask Linus to fix
this. The patches have been in linux-next for a couple of days. This
time I haven't done any merge tests so I don't know if there are any
other conflicts etc.

Please let me know if there are any problems.

wireless-drivers-next patches for 4.8

Major changes:

wl18xx

* add initial mesh support

bcma

* serial flash support on non-MIPS SoCs

ath10k

* enable support for QCA9888
* disable wake_tx_queue() mac80211 op for older devices to workaround
throughput regression

ath9k

* implement temperature compensation support for AR9003+
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+1179 -645
+32 -9
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
··· 1 - * Texas Instruments wl1271 wireless lan controller 1 + * Texas Instruments wl12xx/wl18xx wireless lan controller 2 2 3 - The wl1271 chip can be connected via SPI or via SDIO. This 3 + The wl12xx/wl18xx chips can be connected via SPI or via SDIO. This 4 4 document describes the binding for the SPI connected chip. 5 5 6 6 Required properties: 7 - - compatible : Should be "ti,wl1271" 7 + - compatible : Should be one of the following: 8 + * "ti,wl1271" 9 + * "ti,wl1273" 10 + * "ti,wl1281" 11 + * "ti,wl1283" 12 + * "ti,wl1801" 13 + * "ti,wl1805" 14 + * "ti,wl1807" 15 + * "ti,wl1831" 16 + * "ti,wl1835" 17 + * "ti,wl1837" 8 18 - reg : Chip select address of device 9 19 - spi-max-frequency : Maximum SPI clocking speed of device in Hz 10 - - ref-clock-frequency : Reference clock frequency 11 20 - interrupt-parent, interrupts : 12 21 Should contain parameters for 1 interrupt line. 13 22 Interrupt parameters: parent, line number, type. 14 - - vwlan-supply : Point the node of the regulator that powers/enable the wl1271 chip 23 + - vwlan-supply : Point the node of the regulator that powers/enable the 24 + wl12xx/wl18xx chip 15 25 16 26 Optional properties: 27 + - ref-clock-frequency : Reference clock frequency (should be set for wl12xx) 17 28 - clock-xtal : boolean, clock is generated from XTAL 18 29 19 30 - Please consult Documentation/devicetree/bindings/spi/spi-bus.txt ··· 32 21 33 22 Examples: 34 23 24 + For wl12xx family: 35 25 &spi1 { 36 - wl1271@1 { 26 + wlcore: wlcore@1 { 37 27 compatible = "ti,wl1271"; 38 - 39 28 reg = <1>; 40 29 spi-max-frequency = <48000000>; 41 - clock-xtal; 42 - ref-clock-frequency = <38400000>; 43 30 interrupt-parent = <&gpio3>; 44 31 interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; 32 + vwlan-supply = <&vwlan_fixed>; 33 + clock-xtal; 34 + ref-clock-frequency = <38400000>; 35 + }; 36 + }; 37 + 38 + For wl18xx family: 39 + &spi0 { 40 + wlcore: wlcore@0 { 41 + compatible = "ti,wl1835"; 42 + reg = <0>; 43 + spi-max-frequency = <48000000>; 44 + interrupt-parent = <&gpio0>; 45 + interrupts = <27 IRQ_TYPE_EDGE_RISING>; 45 46 vwlan-supply = <&vwlan_fixed>; 46 47 }; 47 48 };
+9 -2
drivers/bcma/Kconfig
··· 76 76 default y 77 77 78 78 config BCMA_SFLASH 79 - bool 80 - depends on BCMA_DRIVER_MIPS 79 + bool "ChipCommon-attached serial flash support" 80 + depends on BCMA_HOST_SOC 81 81 default y 82 + help 83 + Some cheap devices have serial flash connected to the ChipCommon 84 + instead of independent SPI controller. It requires using a separated 85 + driver that implements ChipCommon specific interface communication. 86 + 87 + Enabling this symbol will let bcma recognize serial flash and register 88 + it as platform device. 82 89 83 90 config BCMA_NFLASH 84 91 bool
+5 -4
drivers/bcma/driver_chipcommon_b.c
··· 33 33 void bcma_chipco_b_mii_write(struct bcma_drv_cc_b *ccb, u32 offset, u32 value) 34 34 { 35 35 struct bcma_bus *bus = ccb->core->bus; 36 + void __iomem *mii = ccb->mii; 36 37 37 - writel(offset, ccb->mii + 0x00); 38 - bcma_wait_reg(bus, ccb->mii + 0x00, 0x0100, 0x0000, 100); 39 - writel(value, ccb->mii + 0x04); 40 - bcma_wait_reg(bus, ccb->mii + 0x00, 0x0100, 0x0000, 100); 38 + writel(offset, mii + BCMA_CCB_MII_MNG_CTL); 39 + bcma_wait_reg(bus, mii + BCMA_CCB_MII_MNG_CTL, 0x0100, 0x0000, 100); 40 + writel(value, mii + BCMA_CCB_MII_MNG_CMD_DATA); 41 + bcma_wait_reg(bus, mii + BCMA_CCB_MII_MNG_CTL, 0x0100, 0x0000, 100); 41 42 } 42 43 EXPORT_SYMBOL_GPL(bcma_chipco_b_mii_write); 43 44
+1
drivers/bcma/host_pci.c
··· 295 295 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) }, 296 296 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) }, 297 297 { PCI_DEVICE_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_DELL, 0x0016) }, 298 + { PCI_DEVICE_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_FOXCONN, 0xe092) }, 298 299 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) }, 299 300 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, 300 301 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
+1 -1
drivers/mtd/devices/Kconfig
··· 114 114 115 115 config MTD_BCM47XXSFLASH 116 116 tristate "R/O support for serial flash on BCMA bus" 117 - depends on BCMA_SFLASH 117 + depends on BCMA_SFLASH && (MIPS || ARM) 118 118 help 119 119 BCMA bus can have various flash memories attached, they are 120 120 registered by bcma as platform devices. This enables driver for
+27 -1
drivers/net/wireless/ath/ath10k/core.c
··· 207 207 }, 208 208 }, 209 209 { 210 + .id = QCA9888_HW_2_0_DEV_VERSION, 211 + .dev_id = QCA9888_2_0_DEVICE_ID, 212 + .name = "qca9888 hw2.0", 213 + .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, 214 + .uart_pin = 7, 215 + .otp_exe_param = 0x00000700, 216 + .continuous_frag_desc = true, 217 + .channel_counters_freq_hz = 150000, 218 + .max_probe_resp_desc_thres = 24, 219 + .hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE, 220 + .tx_chain_mask = 3, 221 + .rx_chain_mask = 3, 222 + .max_spatial_stream = 2, 223 + .cal_data_len = 12064, 224 + .fw = { 225 + .dir = QCA9888_HW_2_0_FW_DIR, 226 + .board = QCA9888_HW_2_0_BOARD_DATA_FILE, 227 + .board_size = QCA99X0_BOARD_DATA_SZ, 228 + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ, 229 + }, 230 + }, 231 + { 210 232 .id = QCA9377_HW_1_0_DEV_VERSION, 211 233 .dev_id = QCA9377_1_0_DEVICE_ID, 212 234 .name = "qca9377 hw1.0", ··· 1697 1675 case ATH10K_FW_WMI_OP_VERSION_10_4: 1698 1676 case ATH10K_FW_WMI_OP_VERSION_UNSET: 1699 1677 case ATH10K_FW_WMI_OP_VERSION_MAX: 1700 - WARN_ON(1); 1678 + ath10k_err(ar, "htt op version not found from fw meta data"); 1701 1679 return -EINVAL; 1702 1680 } 1703 1681 } ··· 2192 2170 case ATH10K_HW_QCA9984: 2193 2171 ar->regs = &qca99x0_regs; 2194 2172 ar->hw_values = &qca99x0_values; 2173 + break; 2174 + case ATH10K_HW_QCA9888: 2175 + ar->regs = &qca99x0_regs; 2176 + ar->hw_values = &qca9888_values; 2195 2177 break; 2196 2178 case ATH10K_HW_QCA4019: 2197 2179 ar->regs = &qca4019_regs;
+10
drivers/net/wireless/ath/ath10k/core.h
··· 165 165 u32 rx_duration; 166 166 }; 167 167 168 + struct ath10k_fw_extd_stats_peer { 169 + struct list_head list; 170 + 171 + u8 peer_macaddr[ETH_ALEN]; 172 + u32 rx_duration; 173 + }; 174 + 168 175 struct ath10k_fw_stats_vdev { 169 176 struct list_head list; 170 177 ··· 263 256 }; 264 257 265 258 struct ath10k_fw_stats { 259 + bool extended; 266 260 struct list_head pdevs; 267 261 struct list_head vdevs; 268 262 struct list_head peers; 263 + struct list_head peers_extd; 269 264 }; 270 265 271 266 #define ATH10K_TPC_TABLE_TYPE_FLAG 1 ··· 676 667 struct ath10k { 677 668 struct ath_common ath_common; 678 669 struct ieee80211_hw *hw; 670 + struct ieee80211_ops *ops; 679 671 struct device *dev; 680 672 u8 mac_addr[ETH_ALEN]; 681 673
+18 -1
drivers/net/wireless/ath/ath10k/debug.c
··· 313 313 } 314 314 } 315 315 316 + static void ath10k_fw_extd_stats_peers_free(struct list_head *head) 317 + { 318 + struct ath10k_fw_extd_stats_peer *i, *tmp; 319 + 320 + list_for_each_entry_safe(i, tmp, head, list) { 321 + list_del(&i->list); 322 + kfree(i); 323 + } 324 + } 325 + 316 326 static void ath10k_debug_fw_stats_reset(struct ath10k *ar) 317 327 { 318 328 spin_lock_bh(&ar->data_lock); 319 329 ar->debug.fw_stats_done = false; 330 + ar->debug.fw_stats.extended = false; 320 331 ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs); 321 332 ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs); 322 333 ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers); 334 + ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd); 323 335 spin_unlock_bh(&ar->data_lock); 324 336 } 325 337 ··· 346 334 INIT_LIST_HEAD(&stats.pdevs); 347 335 INIT_LIST_HEAD(&stats.vdevs); 348 336 INIT_LIST_HEAD(&stats.peers); 337 + INIT_LIST_HEAD(&stats.peers_extd); 349 338 350 339 spin_lock_bh(&ar->data_lock); 351 340 ret = ath10k_wmi_pull_fw_stats(ar, skb, &stats); ··· 367 354 * delivered which is treated as end-of-data and is itself discarded 368 355 */ 369 356 if (ath10k_peer_stats_enabled(ar)) 370 - ath10k_sta_update_rx_duration(ar, &stats.peers); 357 + ath10k_sta_update_rx_duration(ar, &stats); 371 358 372 359 if (ar->debug.fw_stats_done) { 373 360 if (!ath10k_peer_stats_enabled(ar)) ··· 409 396 410 397 list_splice_tail_init(&stats.peers, &ar->debug.fw_stats.peers); 411 398 list_splice_tail_init(&stats.vdevs, &ar->debug.fw_stats.vdevs); 399 + list_splice_tail_init(&stats.peers_extd, 400 + &ar->debug.fw_stats.peers_extd); 412 401 } 413 402 414 403 complete(&ar->debug.fw_stats_complete); ··· 422 407 ath10k_fw_stats_pdevs_free(&stats.pdevs); 423 408 ath10k_fw_stats_vdevs_free(&stats.vdevs); 424 409 ath10k_fw_stats_peers_free(&stats.peers); 410 + ath10k_fw_extd_stats_peers_free(&stats.peers_extd); 425 411 426 412 spin_unlock_bh(&ar->data_lock); 427 413 } ··· 2346 2330 INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs); 2347 2331 INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs); 2348 2332 INIT_LIST_HEAD(&ar->debug.fw_stats.peers); 2333 + INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd); 2349 2334 2350 2335 return 0; 2351 2336 }
+8 -3
drivers/net/wireless/ath/ath10k/debug.h
··· 154 154 #ifdef CONFIG_MAC80211_DEBUGFS 155 155 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 156 156 struct ieee80211_sta *sta, struct dentry *dir); 157 - void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *peer); 157 + void ath10k_sta_update_rx_duration(struct ath10k *ar, 158 + struct ath10k_fw_stats *stats); 159 + void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 160 + struct ieee80211_sta *sta, 161 + struct station_info *sinfo); 158 162 #else 159 - static inline void ath10k_sta_update_rx_duration(struct ath10k *ar, 160 - struct list_head *peer) 163 + static inline 164 + void ath10k_sta_update_rx_duration(struct ath10k *ar, 165 + struct ath10k_fw_stats *stats) 161 166 { 162 167 } 163 168 #endif /* CONFIG_MAC80211_DEBUGFS */
+48 -28
drivers/net/wireless/ath/ath10k/debugfs_sta.c
··· 18 18 #include "wmi-ops.h" 19 19 #include "debug.h" 20 20 21 - void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *head) 22 - { struct ieee80211_sta *sta; 23 - struct ath10k_fw_stats_peer *peer; 21 + static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar, 22 + struct ath10k_fw_stats *stats) 23 + { 24 + struct ath10k_fw_extd_stats_peer *peer; 25 + struct ieee80211_sta *sta; 24 26 struct ath10k_sta *arsta; 25 27 26 28 rcu_read_lock(); 27 - list_for_each_entry(peer, head, list) { 29 + list_for_each_entry(peer, &stats->peers_extd, list) { 28 30 sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, 29 31 NULL); 30 32 if (!sta) ··· 35 33 arsta->rx_duration += (u64)peer->rx_duration; 36 34 } 37 35 rcu_read_unlock(); 36 + } 37 + 38 + static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar, 39 + struct ath10k_fw_stats *stats) 40 + { 41 + struct ath10k_fw_stats_peer *peer; 42 + struct ieee80211_sta *sta; 43 + struct ath10k_sta *arsta; 44 + 45 + rcu_read_lock(); 46 + list_for_each_entry(peer, &stats->peers, list) { 47 + sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, 48 + NULL); 49 + if (!sta) 50 + continue; 51 + arsta = (struct ath10k_sta *)sta->drv_priv; 52 + arsta->rx_duration += (u64)peer->rx_duration; 53 + } 54 + rcu_read_unlock(); 55 + } 56 + 57 + void ath10k_sta_update_rx_duration(struct ath10k *ar, 58 + struct ath10k_fw_stats *stats) 59 + { 60 + if (stats->extended) 61 + ath10k_sta_update_extd_stats_rx_duration(ar, stats); 62 + else 63 + ath10k_sta_update_stats_rx_duration(ar, stats); 64 + } 65 + 66 + void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 67 + struct ieee80211_sta *sta, 68 + struct station_info *sinfo) 69 + { 70 + struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; 71 + struct ath10k *ar = arsta->arvif->ar; 72 + 73 + if (!ath10k_peer_stats_enabled(ar)) 74 + return; 75 + 76 + sinfo->rx_duration = arsta->rx_duration; 77 + sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION; 38 78 } 39 79 40 80 static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file, ··· 293 249 .llseek = default_llseek, 294 250 }; 295 251 296 - static ssize_t ath10k_dbg_sta_read_rx_duration(struct file *file, 297 - char __user *user_buf, 298 - size_t count, loff_t *ppos) 299 - { 300 - struct ieee80211_sta *sta = file->private_data; 301 - struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; 302 - char buf[100]; 303 - int len = 0; 304 - 305 - len = scnprintf(buf, sizeof(buf), 306 - "%llu usecs\n", arsta->rx_duration); 307 - 308 - return simple_read_from_buffer(user_buf, count, ppos, buf, len); 309 - } 310 - 311 - static const struct file_operations fops_rx_duration = { 312 - .read = ath10k_dbg_sta_read_rx_duration, 313 - .open = simple_open, 314 - .owner = THIS_MODULE, 315 - .llseek = default_llseek, 316 - }; 317 - 318 252 void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 319 253 struct ieee80211_sta *sta, struct dentry *dir) 320 254 { ··· 301 279 debugfs_create_file("addba", S_IWUSR, dir, sta, &fops_addba); 302 280 debugfs_create_file("addba_resp", S_IWUSR, dir, sta, &fops_addba_resp); 303 281 debugfs_create_file("delba", S_IWUSR, dir, sta, &fops_delba); 304 - debugfs_create_file("rx_duration", S_IRUGO, dir, sta, 305 - &fops_rx_duration); 306 282 }
-1
drivers/net/wireless/ath/ath10k/htc.h
··· 22 22 #include <linux/list.h> 23 23 #include <linux/bug.h> 24 24 #include <linux/skbuff.h> 25 - #include <linux/semaphore.h> 26 25 #include <linux/timer.h> 27 26 28 27 struct ath10k;
+4 -6
drivers/net/wireless/ath/ath10k/htt_rx.c
··· 748 748 if (WARN_ON_ONCE(!arvif)) 749 749 return NULL; 750 750 751 - if (WARN_ON_ONCE(ath10k_mac_vif_chan(arvif->vif, &def))) 751 + if (ath10k_mac_vif_chan(arvif->vif, &def)) 752 752 return NULL; 753 753 754 754 return def.chan; ··· 2307 2307 ath10k_htt_rx_delba(ar, resp); 2308 2308 break; 2309 2309 case HTT_T2H_MSG_TYPE_PKTLOG: { 2310 - struct ath10k_pktlog_hdr *hdr = 2311 - (struct ath10k_pktlog_hdr *)resp->pktlog_msg.payload; 2312 - 2313 2310 trace_ath10k_htt_pktlog(ar, resp->pktlog_msg.payload, 2314 - sizeof(*hdr) + 2315 - __le16_to_cpu(hdr->size)); 2311 + skb->len - 2312 + offsetof(struct htt_resp, 2313 + pktlog_msg.payload)); 2316 2314 break; 2317 2315 } 2318 2316 case HTT_T2H_MSG_TYPE_RX_FLUSH: {
+14 -8
drivers/net/wireless/ath/ath10k/htt_tx.c
··· 49 49 struct ieee80211_txq *txq) 50 50 { 51 51 struct ath10k *ar = hw->priv; 52 - struct ath10k_sta *arsta = (void *)txq->sta->drv_priv; 52 + struct ath10k_sta *arsta; 53 53 struct ath10k_vif *arvif = (void *)txq->vif->drv_priv; 54 54 unsigned long frame_cnt; 55 55 unsigned long byte_cnt; ··· 67 67 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH_PULL) 68 68 return; 69 69 70 - if (txq->sta) 70 + if (txq->sta) { 71 + arsta = (void *)txq->sta->drv_priv; 71 72 peer_id = arsta->peer_id; 72 - else 73 + } else { 73 74 peer_id = arvif->peer_id; 75 + } 74 76 75 77 tid = txq->tid; 76 78 bit = BIT(peer_id % 32); ··· 389 387 void ath10k_htt_tx_free(struct ath10k_htt *htt) 390 388 { 391 389 int size; 390 + 391 + tasklet_kill(&htt->txrx_compl_task); 392 392 393 393 idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar); 394 394 idr_destroy(&htt->pending_tx); ··· 737 733 { 738 734 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 739 735 struct ath10k_skb_cb *cb = ATH10K_SKB_CB(skb); 740 - struct ath10k_vif *arvif = (void *)cb->vif->drv_priv; 736 + struct ath10k_vif *arvif; 741 737 742 - if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) 738 + if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { 743 739 return ar->scan.vdev_id; 744 - else if (cb->vif) 740 + } else if (cb->vif) { 741 + arvif = (void *)cb->vif->drv_priv; 745 742 return arvif->vdev_id; 746 - else if (ar->monitor_started) 743 + } else if (ar->monitor_started) { 747 744 return ar->monitor_vdev_id; 748 - else 745 + } else { 749 746 return 0; 747 + } 750 748 } 751 749 752 750 static u8 ath10k_htt_tx_get_tid(struct sk_buff *skb, bool is_eth)
+11 -4
drivers/net/wireless/ath/ath10k/hw.c
··· 19 19 #include "hw.h" 20 20 21 21 const struct ath10k_hw_regs qca988x_regs = { 22 - .rtc_state_cold_reset_mask = 0x00000400, 23 22 .rtc_soc_base_address = 0x00004000, 24 23 .rtc_wmac_base_address = 0x00005000, 25 24 .soc_core_base_address = 0x00009000, ··· 45 46 }; 46 47 47 48 const struct ath10k_hw_regs qca6174_regs = { 48 - .rtc_state_cold_reset_mask = 0x00002000, 49 49 .rtc_soc_base_address = 0x00000800, 50 50 .rtc_wmac_base_address = 0x00001000, 51 51 .soc_core_base_address = 0x0003a000, ··· 71 73 }; 72 74 73 75 const struct ath10k_hw_regs qca99x0_regs = { 74 - .rtc_state_cold_reset_mask = 0x00000400, 75 76 .rtc_soc_base_address = 0x00080000, 76 77 .rtc_wmac_base_address = 0x00000000, 77 78 .soc_core_base_address = 0x00082000, ··· 165 168 .ce_desc_meta_data_lsb = 4, 166 169 }; 167 170 171 + const struct ath10k_hw_values qca9888_values = { 172 + .rtc_state_val_on = 3, 173 + .ce_count = 12, 174 + .msi_assign_ce_max = 12, 175 + .num_target_ce_config_wlan = 10, 176 + .ce_desc_meta_data_mask = 0xFFF0, 177 + .ce_desc_meta_data_lsb = 4, 178 + }; 179 + 168 180 const struct ath10k_hw_values qca4019_values = { 169 181 .ce_count = 12, 170 182 .num_target_ce_config_wlan = 10, ··· 204 198 case ATH10K_HW_CC_WRAP_SHIFTED_EACH: 205 199 if (cc < cc_prev) 206 200 cc_fix = 0x7fffffff; 207 - else 201 + 202 + if (rcc < rcc_prev) 208 203 rcc_fix = 0x7fffffff; 209 204 break; 210 205 case ATH10K_HW_CC_WRAP_DISABLED:
+12 -21
drivers/net/wireless/ath/ath10k/hw.h
··· 26 26 #define QCA6164_2_1_DEVICE_ID (0x0041) 27 27 #define QCA6174_2_1_DEVICE_ID (0x003e) 28 28 #define QCA99X0_2_0_DEVICE_ID (0x0040) 29 + #define QCA9888_2_0_DEVICE_ID (0x0056) 29 30 #define QCA9984_1_0_DEVICE_ID (0x0046) 30 31 #define QCA9377_1_0_DEVICE_ID (0x0042) 31 32 #define QCA9887_1_0_DEVICE_ID (0x0050) ··· 108 107 #define QCA9984_HW_1_0_FW_DIR ATH10K_FW_DIR "/QCA9984/hw1.0" 109 108 #define QCA9984_HW_1_0_BOARD_DATA_FILE "board.bin" 110 109 #define QCA9984_HW_1_0_PATCH_LOAD_ADDR 0x1234 110 + 111 + /* QCA9888 2.0 defines */ 112 + #define QCA9888_HW_2_0_DEV_VERSION 0x1000000 113 + #define QCA9888_HW_DEV_TYPE 0xc 114 + #define QCA9888_HW_2_0_CHIP_ID_REV 0x0 115 + #define QCA9888_HW_2_0_FW_DIR ATH10K_FW_DIR "/QCA9888/hw2.0" 116 + #define QCA9888_HW_2_0_BOARD_DATA_FILE "board.bin" 117 + #define QCA9888_HW_2_0_PATCH_LOAD_ADDR 0x1234 111 118 112 119 /* QCA9377 1.0 definitions */ 113 120 #define QCA9377_HW_1_0_FW_DIR ATH10K_FW_DIR "/QCA9377/hw1.0" ··· 219 210 ATH10K_HW_QCA988X, 220 211 ATH10K_HW_QCA6174, 221 212 ATH10K_HW_QCA99X0, 213 + ATH10K_HW_QCA9888, 222 214 ATH10K_HW_QCA9984, 223 215 ATH10K_HW_QCA9377, 224 216 ATH10K_HW_QCA4019, ··· 227 217 }; 228 218 229 219 struct ath10k_hw_regs { 230 - u32 rtc_state_cold_reset_mask; 231 220 u32 rtc_soc_base_address; 232 221 u32 rtc_wmac_base_address; 233 222 u32 soc_core_base_address; ··· 269 260 extern const struct ath10k_hw_values qca988x_values; 270 261 extern const struct ath10k_hw_values qca6174_values; 271 262 extern const struct ath10k_hw_values qca99x0_values; 263 + extern const struct ath10k_hw_values qca9888_values; 272 264 extern const struct ath10k_hw_values qca4019_values; 273 265 274 266 void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey, ··· 279 269 #define QCA_REV_9887(ar) ((ar)->hw_rev == ATH10K_HW_QCA9887) 280 270 #define QCA_REV_6174(ar) ((ar)->hw_rev == ATH10K_HW_QCA6174) 281 271 #define QCA_REV_99X0(ar) ((ar)->hw_rev == ATH10K_HW_QCA99X0) 272 + #define QCA_REV_9888(ar) ((ar)->hw_rev == ATH10K_HW_QCA9888) 282 273 #define QCA_REV_9984(ar) ((ar)->hw_rev == ATH10K_HW_QCA9984) 283 274 #define QCA_REV_9377(ar) ((ar)->hw_rev == ATH10K_HW_QCA9377) 284 275 #define QCA_REV_40XX(ar) ((ar)->hw_rev == ATH10K_HW_QCA4019) ··· 306 295 ATH10K_MCAST2UCAST_DISABLED = 0, 307 296 ATH10K_MCAST2UCAST_ENABLED = 1, 308 297 }; 309 - 310 - struct ath10k_pktlog_hdr { 311 - __le16 flags; 312 - __le16 missed_cnt; 313 - __le16 log_type; 314 - __le16 size; 315 - __le32 timestamp; 316 - u8 payload[0]; 317 - } __packed; 318 - 319 - struct ath10k_pktlog_10_4_hdr { 320 - __le16 flags; 321 - __le16 missed_cnt; 322 - __le16 log_type; 323 - __le16 size; 324 - __le32 timestamp; 325 - __le32 type_specific_data; 326 - u8 payload[0]; 327 - } __packed; 328 298 329 299 enum ath10k_hw_rate_ofdm { 330 300 ATH10K_HW_RATE_OFDM_48M = 0, ··· 527 535 /* as of IP3.7.1 */ 528 536 #define RTC_STATE_V_ON ar->hw_values->rtc_state_val_on 529 537 530 - #define RTC_STATE_COLD_RESET_MASK ar->regs->rtc_state_cold_reset_mask 531 538 #define RTC_STATE_V_LSB 0 532 539 #define RTC_STATE_V_MASK 0x00000007 533 540 #define RTC_STATE_ADDRESS 0x0000
+59 -8
drivers/net/wireless/ath/ath10k/mac.c
··· 802 802 { 803 803 struct ath10k_peer *peer, *tmp; 804 804 int peer_id; 805 + int i; 805 806 806 807 lockdep_assert_held(&ar->conf_mutex); 807 808 ··· 819 818 ar->peer_map[peer_id] = NULL; 820 819 } 821 820 821 + /* Double check that peer is properly un-referenced from 822 + * the peer_map 823 + */ 824 + for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { 825 + if (ar->peer_map[i] == peer) { 826 + ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n", 827 + peer->addr, peer, i); 828 + ar->peer_map[i] = NULL; 829 + } 830 + } 831 + 822 832 list_del(&peer->list); 823 833 kfree(peer); 824 834 ar->num_peers--; ··· 840 828 static void ath10k_peer_cleanup_all(struct ath10k *ar) 841 829 { 842 830 struct ath10k_peer *peer, *tmp; 831 + int i; 843 832 844 833 lockdep_assert_held(&ar->conf_mutex); 845 834 ··· 849 836 list_del(&peer->list); 850 837 kfree(peer); 851 838 } 839 + 840 + for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) 841 + ar->peer_map[i] = NULL; 842 + 852 843 spin_unlock_bh(&ar->data_lock); 853 844 854 845 ar->num_peers = 0; ··· 2956 2939 if (channel->flags & IEEE80211_CHAN_DISABLED) 2957 2940 continue; 2958 2941 2959 - ch->allow_ht = true; 2942 + ch->allow_ht = true; 2960 2943 2961 2944 /* FIXME: when should we really allow VHT? */ 2962 2945 ch->allow_vht = true; ··· 3692 3675 3693 3676 static void ath10k_mac_txq_init(struct ieee80211_txq *txq) 3694 3677 { 3695 - struct ath10k_txq *artxq = (void *)txq->drv_priv; 3678 + struct ath10k_txq *artxq; 3696 3679 3697 3680 if (!txq) 3698 3681 return; 3699 3682 3683 + artxq = (void *)txq->drv_priv; 3700 3684 INIT_LIST_HEAD(&artxq->list); 3701 3685 } 3702 3686 3703 3687 static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq) 3704 3688 { 3705 - struct ath10k_txq *artxq = (void *)txq->drv_priv; 3689 + struct ath10k_txq *artxq; 3706 3690 struct ath10k_skb_cb *cb; 3707 3691 struct sk_buff *msdu; 3708 3692 int msdu_id; ··· 3711 3693 if (!txq) 3712 3694 return; 3713 3695 3696 + artxq = (void *)txq->drv_priv; 3714 3697 spin_lock_bh(&ar->txqs_lock); 3715 3698 if (!list_empty(&artxq->list)) 3716 3699 list_del_init(&artxq->list); ··· 4247 4228 mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i * 2); 4248 4229 } 4249 4230 4231 + if (ar->cfg_tx_chainmask <= 1) 4232 + vht_cap.cap &= ~IEEE80211_VHT_CAP_TXSTBC; 4233 + 4250 4234 vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map); 4251 4235 vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map); 4252 4236 ··· 4287 4265 ht_cap.cap |= smps; 4288 4266 } 4289 4267 4290 - if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC) 4268 + if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC && (ar->cfg_tx_chainmask > 1)) 4291 4269 ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC; 4292 4270 4293 4271 if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) { ··· 6001 5979 continue; 6002 5980 6003 5981 if (peer->sta == sta) { 6004 - ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n", 6005 - sta->addr, arvif->vdev_id); 5982 + ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n", 5983 + sta->addr, peer, i, arvif->vdev_id); 6006 5984 peer->sta = NULL; 5985 + 5986 + /* Clean up the peer object as well since we 5987 + * must have failed to do this above. 5988 + */ 5989 + list_del(&peer->list); 5990 + ar->peer_map[i] = NULL; 5991 + kfree(peer); 5992 + ar->num_peers--; 6007 5993 } 6008 5994 } 6009 5995 spin_unlock_bh(&ar->data_lock); ··· 7436 7406 #endif 7437 7407 #ifdef CONFIG_MAC80211_DEBUGFS 7438 7408 .sta_add_debugfs = ath10k_sta_add_debugfs, 7409 + .sta_statistics = ath10k_sta_statistics, 7439 7410 #endif 7440 7411 }; 7441 7412 ··· 7506 7475 struct ath10k *ath10k_mac_create(size_t priv_size) 7507 7476 { 7508 7477 struct ieee80211_hw *hw; 7478 + struct ieee80211_ops *ops; 7509 7479 struct ath10k *ar; 7510 7480 7511 - hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops); 7512 - if (!hw) 7481 + ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL); 7482 + if (!ops) 7513 7483 return NULL; 7484 + 7485 + hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops); 7486 + if (!hw) { 7487 + kfree(ops); 7488 + return NULL; 7489 + } 7514 7490 7515 7491 ar = hw->priv; 7516 7492 ar->hw = hw; 7493 + ar->ops = ops; 7517 7494 7518 7495 return ar; 7519 7496 } 7520 7497 7521 7498 void ath10k_mac_destroy(struct ath10k *ar) 7522 7499 { 7500 + struct ieee80211_ops *ops = ar->ops; 7501 + 7523 7502 ieee80211_free_hw(ar->hw); 7503 + kfree(ops); 7524 7504 } 7525 7505 7526 7506 static const struct ieee80211_iface_limit ath10k_if_limits[] = { ··· 7964 7922 if (!ar->dfs_detector) 7965 7923 ath10k_warn(ar, "failed to initialise DFS pattern detector\n"); 7966 7924 } 7925 + 7926 + /* Current wake_tx_queue implementation imposes a significant 7927 + * performance penalty in some setups. The tx scheduling code needs 7928 + * more work anyway so disable the wake_tx_queue unless firmware 7929 + * supports the pull-push mechanism. 7930 + */ 7931 + if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL, 7932 + ar->running_fw->fw_file.fw_features)) 7933 + ar->ops->wake_tx_queue = NULL; 7967 7934 7968 7935 ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, 7969 7936 ath10k_reg_notifier);
+24
drivers/net/wireless/ath/ath10k/pci.c
··· 56 56 { PCI_VDEVICE(ATHEROS, QCA6164_2_1_DEVICE_ID) }, /* PCI-E QCA6164 V2.1 */ 57 57 { PCI_VDEVICE(ATHEROS, QCA6174_2_1_DEVICE_ID) }, /* PCI-E QCA6174 V2.1 */ 58 58 { PCI_VDEVICE(ATHEROS, QCA99X0_2_0_DEVICE_ID) }, /* PCI-E QCA99X0 V2 */ 59 + { PCI_VDEVICE(ATHEROS, QCA9888_2_0_DEVICE_ID) }, /* PCI-E QCA9888 V2 */ 59 60 { PCI_VDEVICE(ATHEROS, QCA9984_1_0_DEVICE_ID) }, /* PCI-E QCA9984 V1 */ 60 61 { PCI_VDEVICE(ATHEROS, QCA9377_1_0_DEVICE_ID) }, /* PCI-E QCA9377 V1 */ 61 62 { PCI_VDEVICE(ATHEROS, QCA9887_1_0_DEVICE_ID) }, /* PCI-E QCA9887 */ ··· 85 84 { QCA99X0_2_0_DEVICE_ID, QCA99X0_HW_2_0_CHIP_ID_REV }, 86 85 87 86 { QCA9984_1_0_DEVICE_ID, QCA9984_HW_1_0_CHIP_ID_REV }, 87 + 88 + { QCA9888_2_0_DEVICE_ID, QCA9888_HW_2_0_CHIP_ID_REV }, 88 89 89 90 { QCA9377_1_0_DEVICE_ID, QCA9377_HW_1_0_CHIP_ID_REV }, 90 91 { QCA9377_1_0_DEVICE_ID, QCA9377_HW_1_1_CHIP_ID_REV }, ··· 853 850 CORE_CTRL_ADDRESS) & 854 851 0x7ff) << 21; 855 852 break; 853 + case ATH10K_HW_QCA9888: 856 854 case ATH10K_HW_QCA99X0: 857 855 case ATH10K_HW_QCA9984: 858 856 case ATH10K_HW_QCA4019: ··· 1587 1583 break; 1588 1584 case ATH10K_HW_QCA99X0: 1589 1585 case ATH10K_HW_QCA9984: 1586 + case ATH10K_HW_QCA9888: 1590 1587 case ATH10K_HW_QCA4019: 1591 1588 /* TODO: Find appropriate register configuration for QCA99X0 1592 1589 * to mask irq/MSI. ··· 1613 1608 break; 1614 1609 case ATH10K_HW_QCA99X0: 1615 1610 case ATH10K_HW_QCA9984: 1611 + case ATH10K_HW_QCA9888: 1616 1612 case ATH10K_HW_QCA4019: 1617 1613 /* TODO: Find appropriate register configuration for QCA99X0 1618 1614 * to unmask irq/MSI. ··· 1954 1948 switch (ar_pci->pdev->device) { 1955 1949 case QCA988X_2_0_DEVICE_ID: 1956 1950 case QCA99X0_2_0_DEVICE_ID: 1951 + case QCA9888_2_0_DEVICE_ID: 1957 1952 case QCA9984_1_0_DEVICE_ID: 1958 1953 case QCA9887_1_0_DEVICE_ID: 1959 1954 return 1; ··· 2221 2214 val = ath10k_pci_read32(ar, FW_INDICATOR_ADDRESS); 2222 2215 val &= ~FW_IND_EVENT_PENDING; 2223 2216 ath10k_pci_write32(ar, FW_INDICATOR_ADDRESS, val); 2217 + } 2218 + 2219 + static bool ath10k_pci_has_device_gone(struct ath10k *ar) 2220 + { 2221 + u32 val; 2222 + 2223 + val = ath10k_pci_read32(ar, FW_INDICATOR_ADDRESS); 2224 + return (val == 0xffffffff); 2224 2225 } 2225 2226 2226 2227 /* this function effectively clears target memory controller assert line */ ··· 2763 2748 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 2764 2749 int ret; 2765 2750 2751 + if (ath10k_pci_has_device_gone(ar)) 2752 + return IRQ_NONE; 2753 + 2766 2754 ret = ath10k_pci_force_wake(ar); 2767 2755 if (ret) { 2768 2756 ath10k_warn(ar, "failed to wake device up on irq: %d\n", ret); ··· 3183 3165 break; 3184 3166 case QCA9984_1_0_DEVICE_ID: 3185 3167 hw_rev = ATH10K_HW_QCA9984; 3168 + pci_ps = false; 3169 + pci_soft_reset = ath10k_pci_qca99x0_soft_chip_reset; 3170 + pci_hard_reset = ath10k_pci_qca99x0_chip_reset; 3171 + break; 3172 + case QCA9888_2_0_DEVICE_ID: 3173 + hw_rev = ATH10K_HW_QCA9888; 3186 3174 pci_ps = false; 3187 3175 pci_soft_reset = ath10k_pci_qca99x0_soft_chip_reset; 3188 3176 pci_hard_reset = ath10k_pci_qca99x0_chip_reset;
+2 -2
drivers/net/wireless/ath/ath10k/spectral.c
··· 101 101 break; 102 102 case 80: 103 103 /* TODO: As experiments with an analogue sender and various 104 - * configuaritions (fft-sizes of 64/128/256 and 20/40/80 Mhz) 104 + * configurations (fft-sizes of 64/128/256 and 20/40/80 Mhz) 105 105 * show, the particular configuration of 80 MHz/64 bins does 106 - * not match with the other smaples at all. Until the reason 106 + * not match with the other samples at all. Until the reason 107 107 * for that is found, don't report these samples. 108 108 */ 109 109 if (bin_len == 64)
+4 -2
drivers/net/wireless/ath/ath10k/txrx.c
··· 81 81 82 82 skb_cb = ATH10K_SKB_CB(msdu); 83 83 txq = skb_cb->txq; 84 - artxq = (void *)txq->drv_priv; 85 84 86 - if (txq) 85 + if (txq) { 86 + artxq = (void *)txq->drv_priv; 87 87 artxq->num_fw_queued--; 88 + } 88 89 89 90 ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); 90 91 ath10k_htt_tx_dec_pending(htt); ··· 217 216 ath10k_dbg(ar, ATH10K_DBG_HTT, "htt peer map vdev %d peer %pM id %d\n", 218 217 ev->vdev_id, ev->addr, ev->peer_id); 219 218 219 + WARN_ON(ar->peer_map[ev->peer_id] && (ar->peer_map[ev->peer_id] != peer)); 220 220 ar->peer_map[ev->peer_id] = peer; 221 221 set_bit(ev->peer_id, peer->peer_ids); 222 222 exit:
+50 -17
drivers/net/wireless/ath/ath10k/wmi.c
··· 1826 1826 ath10k_wmi_op_gen_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu) 1827 1827 { 1828 1828 struct ath10k_skb_cb *cb = ATH10K_SKB_CB(msdu); 1829 - struct ath10k_vif *arvif = (void *)cb->vif->drv_priv; 1829 + struct ath10k_vif *arvif; 1830 1830 struct wmi_mgmt_tx_cmd *cmd; 1831 1831 struct ieee80211_hdr *hdr; 1832 1832 struct sk_buff *skb; ··· 1838 1838 hdr = (struct ieee80211_hdr *)msdu->data; 1839 1839 fc = le16_to_cpu(hdr->frame_control); 1840 1840 1841 - if (cb->vif) 1841 + if (cb->vif) { 1842 + arvif = (void *)cb->vif->drv_priv; 1842 1843 vdev_id = arvif->vdev_id; 1843 - else 1844 + } else { 1844 1845 vdev_id = 0; 1846 + } 1845 1847 1846 1848 if (WARN_ON_ONCE(!ieee80211_is_mgmt(hdr->frame_control))) 1847 1849 return ERR_PTR(-EINVAL); ··· 2926 2924 u32 num_pdev_ext_stats; 2927 2925 u32 num_vdev_stats; 2928 2926 u32 num_peer_stats; 2927 + u32 num_bcnflt_stats; 2929 2928 u32 stats_id; 2930 2929 int i; 2931 2930 ··· 2937 2934 num_pdev_ext_stats = __le32_to_cpu(ev->num_pdev_ext_stats); 2938 2935 num_vdev_stats = __le32_to_cpu(ev->num_vdev_stats); 2939 2936 num_peer_stats = __le32_to_cpu(ev->num_peer_stats); 2937 + num_bcnflt_stats = __le32_to_cpu(ev->num_bcnflt_stats); 2940 2938 stats_id = __le32_to_cpu(ev->stats_id); 2941 2939 2942 2940 for (i = 0; i < num_pdev_stats; i++) { ··· 2978 2974 /* fw doesn't implement vdev stats */ 2979 2975 2980 2976 for (i = 0; i < num_peer_stats; i++) { 2981 - const struct wmi_10_4_peer_extd_stats *src; 2977 + const struct wmi_10_4_peer_stats *src; 2982 2978 struct ath10k_fw_stats_peer *dst; 2983 - int stats_len; 2984 - bool extd_peer_stats = !!(stats_id & WMI_10_4_STAT_PEER_EXTD); 2985 - 2986 - if (extd_peer_stats) 2987 - stats_len = sizeof(struct wmi_10_4_peer_extd_stats); 2988 - else 2989 - stats_len = sizeof(struct wmi_10_4_peer_stats); 2990 2979 2991 2980 src = (void *)skb->data; 2992 - if (!skb_pull(skb, stats_len)) 2981 + if (!skb_pull(skb, sizeof(*src))) 2993 2982 return -EPROTO; 2994 2983 2995 2984 dst = kzalloc(sizeof(*dst), GFP_ATOMIC); 2996 2985 if (!dst) 2997 2986 continue; 2998 2987 2999 - ath10k_wmi_10_4_pull_peer_stats(&src->common, dst); 3000 - /* FIXME: expose 10.4 specific values */ 3001 - if (extd_peer_stats) 3002 - dst->rx_duration = __le32_to_cpu(src->rx_duration); 3003 - 2988 + ath10k_wmi_10_4_pull_peer_stats(src, dst); 3004 2989 list_add_tail(&dst->list, &stats->peers); 2990 + } 2991 + 2992 + for (i = 0; i < num_bcnflt_stats; i++) { 2993 + const struct wmi_10_4_bss_bcn_filter_stats *src; 2994 + 2995 + src = (void *)skb->data; 2996 + if (!skb_pull(skb, sizeof(*src))) 2997 + return -EPROTO; 2998 + 2999 + /* FIXME: expose values to userspace 3000 + * 3001 + * Note: Even though this loop seems to do nothing it is 3002 + * required to parse following sub-structures properly. 3003 + */ 3004 + } 3005 + 3006 + if ((stats_id & WMI_10_4_STAT_PEER_EXTD) == 0) 3007 + return 0; 3008 + 3009 + stats->extended = true; 3010 + 3011 + for (i = 0; i < num_peer_stats; i++) { 3012 + const struct wmi_10_4_peer_extd_stats *src; 3013 + struct ath10k_fw_extd_stats_peer *dst; 3014 + 3015 + src = (void *)skb->data; 3016 + if (!skb_pull(skb, sizeof(*src))) 3017 + return -EPROTO; 3018 + 3019 + dst = kzalloc(sizeof(*dst), GFP_ATOMIC); 3020 + if (!dst) 3021 + continue; 3022 + 3023 + ether_addr_copy(dst->peer_macaddr, src->peer_macaddr.addr); 3024 + dst->rx_duration = __le32_to_cpu(src->rx_duration); 3025 + list_add_tail(&dst->list, &stats->peers_extd); 3005 3026 } 3006 3027 3007 3028 return 0; ··· 5285 5256 break; 5286 5257 case WMI_10_4_PEER_STA_KICKOUT_EVENTID: 5287 5258 ath10k_wmi_event_peer_sta_kickout(ar, skb); 5259 + break; 5260 + case WMI_10_4_ROAM_EVENTID: 5261 + ath10k_wmi_event_roam(ar, skb); 5288 5262 break; 5289 5263 case WMI_10_4_HOST_SWBA_EVENTID: 5290 5264 ath10k_wmi_event_host_swba(ar, skb); ··· 7935 7903 .pull_phyerr = ath10k_wmi_10_4_op_pull_phyerr_ev, 7936 7904 .pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev, 7937 7905 .pull_rdy = ath10k_wmi_op_pull_rdy_ev, 7906 + .pull_roam_ev = ath10k_wmi_op_pull_roam_ev, 7938 7907 .get_txbf_conf_scheme = ath10k_wmi_10_4_txbf_conf_scheme, 7939 7908 7940 7909 .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
+13 -1
drivers/net/wireless/ath/ath10k/wmi.h
··· 4340 4340 } __packed; 4341 4341 4342 4342 struct wmi_10_4_peer_extd_stats { 4343 - struct wmi_10_4_peer_stats common; 4344 4343 struct wmi_mac_addr peer_macaddr; 4345 4344 __le32 inactive_time; 4346 4345 __le32 peer_chain_rssi; 4347 4346 __le32 rx_duration; 4348 4347 __le32 reserved[10]; 4348 + } __packed; 4349 + 4350 + struct wmi_10_4_bss_bcn_stats { 4351 + __le32 vdev_id; 4352 + __le32 bss_bcns_dropped; 4353 + __le32 bss_bcn_delivered; 4354 + } __packed; 4355 + 4356 + struct wmi_10_4_bss_bcn_filter_stats { 4357 + __le32 bcns_dropped; 4358 + __le32 bcns_delivered; 4359 + __le32 active_filters; 4360 + struct wmi_10_4_bss_bcn_stats bss_stats; 4349 4361 } __packed; 4350 4362 4351 4363 struct wmi_10_2_pdev_ext_stats {
+3 -3
drivers/net/wireless/ath/ath6kl/cfg80211.c
··· 847 847 848 848 up(&ar->sem); 849 849 850 - vif->sme_state = SME_DISCONNECTED; 851 - 852 850 return 0; 853 851 } 854 852 ··· 1109 1111 1110 1112 cfg80211_chandef_create(&chandef, 1111 1113 ieee80211_get_channel(vif->ar->wiphy, freq), 1112 - (mode == WMI_11G_HT20) ? 1114 + (mode == WMI_11G_HT20 && 1115 + ath6kl_band_2ghz.ht_cap.ht_supported) ? 1113 1116 NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT); 1114 1117 1115 1118 mutex_lock(&vif->wdev.mtx); ··· 2977 2978 2978 2979 ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx); 2979 2980 clear_bit(CONNECTED, &vif->flags); 2981 + netif_carrier_off(vif->ndev); 2980 2982 2981 2983 /* Restore ht setting in firmware */ 2982 2984 return ath6kl_restore_htcap(vif);
+5 -4
drivers/net/wireless/ath/ath6kl/txrx.c
··· 1401 1401 return; 1402 1402 } 1403 1403 1404 + pad_before_data_start = 1405 + (le16_to_cpu(dhdr->info3) >> WMI_DATA_HDR_PAD_BEFORE_DATA_SHIFT) 1406 + & WMI_DATA_HDR_PAD_BEFORE_DATA_MASK; 1407 + 1404 1408 /* Get the Power save state of the STA */ 1405 1409 if (vif->nw_type == AP_NETWORK) { 1406 1410 meta_type = wmi_data_hdr_get_meta(dhdr); ··· 1412 1408 ps_state = !!((dhdr->info >> WMI_DATA_HDR_PS_SHIFT) & 1413 1409 WMI_DATA_HDR_PS_MASK); 1414 1410 1415 - offset = sizeof(struct wmi_data_hdr); 1411 + offset = sizeof(struct wmi_data_hdr) + pad_before_data_start; 1416 1412 trig_state = !!(le16_to_cpu(dhdr->info3) & WMI_DATA_HDR_TRIG); 1417 1413 1418 1414 switch (meta_type) { ··· 1527 1523 seq_no = wmi_data_hdr_get_seqno(dhdr); 1528 1524 meta_type = wmi_data_hdr_get_meta(dhdr); 1529 1525 dot11_hdr = wmi_data_hdr_get_dot11(dhdr); 1530 - pad_before_data_start = 1531 - (le16_to_cpu(dhdr->info3) >> WMI_DATA_HDR_PAD_BEFORE_DATA_SHIFT) 1532 - & WMI_DATA_HDR_PAD_BEFORE_DATA_MASK; 1533 1526 1534 1527 skb_pull(skb, sizeof(struct wmi_data_hdr)); 1535 1528
+3 -15
drivers/net/wireless/ath/ath9k/ahb.c
··· 18 18 19 19 #include <linux/nl80211.h> 20 20 #include <linux/platform_device.h> 21 - #include <linux/ath9k_platform.h> 22 21 #include <linux/module.h> 23 22 #include "ath9k.h" 24 23 ··· 57 58 58 59 static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) 59 60 { 60 - struct ath_softc *sc = (struct ath_softc *)common->priv; 61 - struct platform_device *pdev = to_platform_device(sc->dev); 62 - struct ath9k_platform_data *pdata; 63 - 64 - pdata = dev_get_platdata(&pdev->dev); 65 - if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { 66 - ath_err(common, 67 - "%s: flash read failed, offset %08x is out of range\n", 68 - __func__, off); 69 - return false; 70 - } 71 - 72 - *data = pdata->eeprom_data[off]; 73 - return true; 61 + ath_err(common, "%s: eeprom data has to be provided externally\n", 62 + __func__); 63 + return false; 74 64 } 75 65 76 66 static struct ath_bus_ops ath_ahb_bus_ops = {
+24 -10
drivers/net/wireless/ath/ath9k/ar9002_phy.c
··· 476 476 static void ar9002_hw_spectral_scan_config(struct ath_hw *ah, 477 477 struct ath_spec_scan *param) 478 478 { 479 + u32 repeat_bit; 479 480 u8 count; 480 481 481 482 if (!param->enabled) { ··· 487 486 REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA); 488 487 REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE); 489 488 490 - if (param->short_repeat) 491 - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, 492 - AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); 489 + if (AR_SREV_9280(ah)) 490 + repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT; 493 491 else 494 - REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, 495 - AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); 492 + repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI; 493 + 494 + if (param->short_repeat) 495 + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit); 496 + else 497 + REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit); 496 498 497 499 /* on AR92xx, the highest bit of count will make the the chip send 498 500 * spectral samples endlessly. Check if this really was intended, ··· 503 499 */ 504 500 count = param->count; 505 501 if (param->endless) { 506 - if (AR_SREV_9271(ah)) 507 - count = 0; 508 - else 502 + if (AR_SREV_9280(ah)) 509 503 count = 0x80; 504 + else 505 + count = 0; 510 506 } else if (count & 0x80) 511 507 count = 0x7f; 508 + else if (!count) 509 + count = 1; 512 510 513 - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, 514 - AR_PHY_SPECTRAL_SCAN_COUNT, count); 511 + if (AR_SREV_9280(ah)) { 512 + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, 513 + AR_PHY_SPECTRAL_SCAN_COUNT, count); 514 + } else { 515 + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, 516 + AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count); 517 + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, 518 + AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT); 519 + } 520 + 515 521 REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, 516 522 AR_PHY_SPECTRAL_SCAN_PERIOD, param->period); 517 523 REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
+4 -1
drivers/net/wireless/ath/ath9k/ar9002_phy.h
··· 177 177 #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8 178 178 #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/ 179 179 #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16 180 + #define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/ 181 + #define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16 180 182 #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/ 181 - #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/ 183 + #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/ 184 + #define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000 182 185 183 186 #define AR_PHY_RX_DELAY 0x9914 184 187 #define AR_PHY_SEARCH_START_DELAY 0x9918
+68 -60
drivers/net/wireless/ath/ath9k/ar9003_calib.c
··· 33 33 34 34 enum ar9003_cal_types { 35 35 IQ_MISMATCH_CAL = BIT(0), 36 + TEMP_COMP_CAL = BIT(1), 36 37 }; 37 38 38 39 static void ar9003_hw_setup_calibration(struct ath_hw *ah, ··· 59 58 /* Kick-off cal */ 60 59 REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL); 61 60 break; 61 + case TEMP_COMP_CAL: 62 + ath_dbg(common, CALIBRATE, 63 + "starting Temperature Compensation Calibration\n"); 64 + REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL); 65 + REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START); 66 + break; 62 67 default: 63 68 ath_err(common, "Invalid calibration type\n"); 64 69 break; ··· 82 75 struct ath9k_cal_list *currCal) 83 76 { 84 77 struct ath9k_hw_cal_data *caldata = ah->caldata; 85 - /* Cal is assumed not done until explicitly set below */ 86 - bool iscaldone = false; 78 + const struct ath9k_percal_data *cur_caldata = currCal->calData; 87 79 88 80 /* Calibration in progress. */ 89 81 if (currCal->calState == CAL_RUNNING) { 90 82 /* Check to see if it has finished. */ 91 - if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) { 83 + if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL) 84 + return false; 85 + 86 + /* 87 + * Accumulate cal measures for active chains 88 + */ 89 + if (cur_caldata->calCollect) 90 + cur_caldata->calCollect(ah); 91 + ah->cal_samples++; 92 + 93 + if (ah->cal_samples >= cur_caldata->calNumSamples) { 94 + unsigned int i, numChains = 0; 95 + for (i = 0; i < AR9300_MAX_CHAINS; i++) { 96 + if (rxchainmask & (1 << i)) 97 + numChains++; 98 + } 99 + 92 100 /* 93 - * Accumulate cal measures for active chains 101 + * Process accumulated data 94 102 */ 95 - currCal->calData->calCollect(ah); 96 - ah->cal_samples++; 103 + if (cur_caldata->calPostProc) 104 + cur_caldata->calPostProc(ah, numChains); 97 105 98 - if (ah->cal_samples >= 99 - currCal->calData->calNumSamples) { 100 - unsigned int i, numChains = 0; 101 - for (i = 0; i < AR9300_MAX_CHAINS; i++) { 102 - if (rxchainmask & (1 << i)) 103 - numChains++; 104 - } 105 - 106 - /* 107 - * Process accumulated data 108 - */ 109 - currCal->calData->calPostProc(ah, numChains); 110 - 111 - /* Calibration has finished. */ 112 - caldata->CalValid |= currCal->calData->calType; 113 - currCal->calState = CAL_DONE; 114 - iscaldone = true; 115 - } else { 106 + /* Calibration has finished. */ 107 + caldata->CalValid |= cur_caldata->calType; 108 + currCal->calState = CAL_DONE; 109 + return true; 110 + } else { 116 111 /* 117 112 * Set-up collection of another sub-sample until we 118 113 * get desired number 119 114 */ 120 115 ar9003_hw_setup_calibration(ah, currCal); 121 - } 122 116 } 123 - } else if (!(caldata->CalValid & currCal->calData->calType)) { 117 + } else if (!(caldata->CalValid & cur_caldata->calType)) { 124 118 /* If current cal is marked invalid in channel, kick it off */ 125 119 ath9k_hw_reset_calibration(ah, currCal); 126 120 } 127 121 128 - return iscaldone; 122 + return false; 129 123 } 130 124 131 125 static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, ··· 323 315 ar9003_hw_iqcalibrate 324 316 }; 325 317 318 + static const struct ath9k_percal_data temp_cal_single_sample = { 319 + TEMP_COMP_CAL, 320 + MIN_CAL_SAMPLES, 321 + PER_MAX_LOG_COUNT, 322 + }; 323 + 326 324 static void ar9003_hw_init_cal_settings(struct ath_hw *ah) 327 325 { 328 326 ah->iq_caldata.calData = &iq_cal_single_sample; 327 + ah->temp_caldata.calData = &temp_cal_single_sample; 329 328 330 329 if (AR_SREV_9300_20_OR_LATER(ah)) { 331 330 ah->enabled_cals |= TX_IQ_CAL; ··· 340 325 ah->enabled_cals |= TX_IQ_ON_AGC_CAL; 341 326 } 342 327 343 - ah->supp_cals = IQ_MISMATCH_CAL; 328 + ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL; 344 329 } 345 330 346 331 #define OFF_UPPER_LT 24 ··· 1389 1374 } 1390 1375 } 1391 1376 1377 + static void ar9003_hw_init_cal_common(struct ath_hw *ah) 1378 + { 1379 + struct ath9k_hw_cal_data *caldata = ah->caldata; 1380 + 1381 + /* Initialize list pointers */ 1382 + ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; 1383 + 1384 + INIT_CAL(&ah->iq_caldata); 1385 + INSERT_CAL(ah, &ah->iq_caldata); 1386 + 1387 + INIT_CAL(&ah->temp_caldata); 1388 + INSERT_CAL(ah, &ah->temp_caldata); 1389 + 1390 + /* Initialize current pointer to first element in list */ 1391 + ah->cal_list_curr = ah->cal_list; 1392 + 1393 + if (ah->cal_list_curr) 1394 + ath9k_hw_reset_calibration(ah, ah->cal_list_curr); 1395 + 1396 + if (caldata) 1397 + caldata->CalValid = 0; 1398 + } 1399 + 1392 1400 static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah, 1393 1401 struct ath9k_channel *chan) 1394 1402 { ··· 1571 1533 /* Revert chainmask to runtime parameters */ 1572 1534 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); 1573 1535 1574 - /* Initialize list pointers */ 1575 - ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; 1576 - 1577 - INIT_CAL(&ah->iq_caldata); 1578 - INSERT_CAL(ah, &ah->iq_caldata); 1579 - ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n"); 1580 - 1581 - /* Initialize current pointer to first element in list */ 1582 - ah->cal_list_curr = ah->cal_list; 1583 - 1584 - if (ah->cal_list_curr) 1585 - ath9k_hw_reset_calibration(ah, ah->cal_list_curr); 1586 - 1587 - if (caldata) 1588 - caldata->CalValid = 0; 1536 + ar9003_hw_init_cal_common(ah); 1589 1537 1590 1538 return true; 1591 1539 } ··· 1602 1578 static bool ar9003_hw_init_cal_soc(struct ath_hw *ah, 1603 1579 struct ath9k_channel *chan) 1604 1580 { 1605 - struct ath_common *common = ath9k_hw_common(ah); 1606 - struct ath9k_hw_cal_data *caldata = ah->caldata; 1607 1581 bool txiqcal_done = false; 1608 1582 bool status = true; 1609 1583 bool run_agc_cal = false, sep_iq_cal = false; ··· 1699 1677 /* Revert chainmask to runtime parameters */ 1700 1678 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); 1701 1679 1702 - /* Initialize list pointers */ 1703 - ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; 1704 - 1705 - INIT_CAL(&ah->iq_caldata); 1706 - INSERT_CAL(ah, &ah->iq_caldata); 1707 - ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n"); 1708 - 1709 - /* Initialize current pointer to first element in list */ 1710 - ah->cal_list_curr = ah->cal_list; 1711 - 1712 - if (ah->cal_list_curr) 1713 - ath9k_hw_reset_calibration(ah, ah->cal_list_curr); 1714 - 1715 - if (caldata) 1716 - caldata->CalValid = 0; 1680 + ar9003_hw_init_cal_common(ah); 1717 1681 1718 1682 return true; 1719 1683 }
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
··· 4175 4175 if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah)) 4176 4176 ar9003_hw_internal_regulator_apply(ah); 4177 4177 ar9003_hw_apply_tuning_caps(ah); 4178 - ar9003_hw_apply_minccapwr_thresh(ah, chan); 4178 + ar9003_hw_apply_minccapwr_thresh(ah, is2ghz); 4179 4179 ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz); 4180 4180 ar9003_hw_thermometer_apply(ah); 4181 4181 ar9003_hw_thermo_cal_apply(ah);
+10 -15
drivers/net/wireless/ath/ath9k/ar9003_phy.h
··· 689 689 #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300) 690 690 #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8) 691 691 692 - #define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \ 693 - ((AR_SREV_9485(ah) ? 0x1628c : 0x16294))) 694 - #define AR_CH0_THERM_XPABIASLVL_MSB 0x3 695 - #define AR_CH0_THERM_XPABIASLVL_MSB_S 0 696 - #define AR_CH0_THERM_XPASHORT2GND 0x4 697 - #define AR_CH0_THERM_XPASHORT2GND_S 2 698 - 699 692 #define AR_SWITCH_TABLE_COM_ALL (0xffff) 700 693 #define AR_SWITCH_TABLE_COM_ALL_S (0) 701 694 #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff) ··· 705 712 #define AR_SWITCH_TABLE_ALL (0xfff) 706 713 #define AR_SWITCH_TABLE_ALL_S (0) 707 714 708 - #define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\ 709 - ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c)) 715 + #define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\ 716 + ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c)) 717 + #define AR_CH0_THERM_XPABIASLVL_MSB 0x3 718 + #define AR_CH0_THERM_XPABIASLVL_MSB_S 0 719 + #define AR_CH0_THERM_XPASHORT2GND 0x4 720 + #define AR_CH0_THERM_XPASHORT2GND_S 2 710 721 711 - #define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 712 - #define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 713 - #define AR_PHY_65NM_CH0_THERM_START 0x20000000 714 - #define AR_PHY_65NM_CH0_THERM_START_S 29 715 - #define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00 716 - #define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8 722 + #define AR_CH0_THERM_LOCAL 0x80000000 723 + #define AR_CH0_THERM_START 0x20000000 724 + #define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00 725 + #define AR_CH0_THERM_SAR_ADC_OUT_S 8 717 726 718 727 #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \ 719 728 (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
+5 -2
drivers/net/wireless/ath/ath9k/ath9k.h
··· 637 637 int nwds; /* number of WDS vifs */ 638 638 int nadhocs; /* number of adhoc vifs */ 639 639 int nocbs; /* number of OCB vifs */ 640 + int nbcnvifs; /* number of beaconing vifs */ 641 + struct ieee80211_vif *primary_beacon_vif; 640 642 struct ieee80211_vif *primary_sta; 641 643 }; 642 644 ··· 687 685 }; 688 686 689 687 void ath9k_beacon_tasklet(unsigned long data); 690 - void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif, 691 - u32 changed); 688 + void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif, 689 + bool beacons); 692 690 void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif); 693 691 void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif); 692 + void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc); 694 693 void ath9k_set_beacon(struct ath_softc *sc); 695 694 bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif); 696 695 void ath9k_csa_update(struct ath_softc *sc);
+136 -106
drivers/net/wireless/ath/ath9k/beacon.c
··· 50 50 txq = sc->tx.txq_map[IEEE80211_AC_BE]; 51 51 ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be); 52 52 qi.tqi_aifs = qi_be.tqi_aifs; 53 - if (ah->slottime == ATH9K_SLOT_TIME_20) 53 + if (ah->slottime == 20) 54 54 qi.tqi_cwmin = 2*qi_be.tqi_cwmin; 55 55 else 56 56 qi.tqi_cwmin = 4*qi_be.tqi_cwmin; ··· 209 209 } 210 210 211 211 sc->beacon.bslot[avp->av_bslot] = vif; 212 - sc->nbcnvifs++; 213 212 214 213 ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n", 215 214 avp->av_bslot); ··· 219 220 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 220 221 struct ath_vif *avp = (void *)vif->drv_priv; 221 222 struct ath_buf *bf = avp->av_bcbuf; 222 - struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; 223 223 224 224 ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n", 225 225 avp->av_bslot); 226 226 227 227 tasklet_disable(&sc->bcon_tasklet); 228 - 229 - cur_conf->enable_beacon &= ~BIT(avp->av_bslot); 230 228 231 229 if (bf && bf->bf_mpdu) { 232 230 struct sk_buff *skb = bf->bf_mpdu; ··· 236 240 237 241 avp->av_bcbuf = NULL; 238 242 sc->beacon.bslot[avp->av_bslot] = NULL; 239 - sc->nbcnvifs--; 240 243 list_add_tail(&bf->list, &sc->beacon.bbuf); 241 244 245 + tasklet_enable(&sc->bcon_tasklet); 246 + } 247 + 248 + void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc) 249 + { 250 + struct ath_common *common = ath9k_hw_common(sc->sc_ah); 251 + struct ieee80211_vif *vif; 252 + struct ath_vif *avp; 253 + s64 tsfadjust; 254 + u32 offset; 255 + int first_slot = ATH_BCBUF; 256 + int slot; 257 + 258 + tasklet_disable(&sc->bcon_tasklet); 259 + 260 + /* Find first taken slot. */ 261 + for (slot = 0; slot < ATH_BCBUF; slot++) { 262 + if (sc->beacon.bslot[slot]) { 263 + first_slot = slot; 264 + break; 265 + } 266 + } 267 + if (first_slot == 0) 268 + goto out; 269 + 270 + /* Re-enumarate all slots, moving them forward. */ 271 + for (slot = 0; slot < ATH_BCBUF; slot++) { 272 + if (slot + first_slot < ATH_BCBUF) { 273 + vif = sc->beacon.bslot[slot + first_slot]; 274 + sc->beacon.bslot[slot] = vif; 275 + 276 + if (vif) { 277 + avp = (void *)vif->drv_priv; 278 + avp->av_bslot = slot; 279 + } 280 + } else { 281 + sc->beacon.bslot[slot] = NULL; 282 + } 283 + } 284 + 285 + vif = sc->beacon.bslot[0]; 286 + if (WARN_ON(!vif)) 287 + goto out; 288 + 289 + /* Get the tsf_adjust value for the new first slot. */ 290 + avp = (void *)vif->drv_priv; 291 + tsfadjust = le64_to_cpu(avp->tsf_adjust); 292 + 293 + ath_dbg(common, CONFIG, 294 + "Adjusting global TSF after beacon slot reassignment: %lld\n", 295 + (signed long long)tsfadjust); 296 + 297 + /* Modify TSF as required and update the HW. */ 298 + avp->chanctx->tsf_val += tsfadjust; 299 + if (sc->cur_chan == avp->chanctx) { 300 + offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL); 301 + ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset); 302 + } 303 + 304 + /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */ 305 + 306 + out: 242 307 tasklet_enable(&sc->bcon_tasklet); 243 308 } 244 309 ··· 331 274 return slot; 332 275 } 333 276 334 - static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif) 277 + static void ath9k_set_tsfadjust(struct ath_softc *sc, 278 + struct ath_beacon_config *cur_conf) 335 279 { 336 280 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 337 - struct ath_vif *avp = (void *)vif->drv_priv; 338 - struct ath_beacon_config *cur_conf = &avp->chanctx->beacon; 339 - u32 tsfadjust; 281 + s64 tsfadjust; 282 + int slot; 340 283 341 - if (avp->av_bslot == 0) 342 - return; 284 + for (slot = 0; slot < ATH_BCBUF; slot++) { 285 + struct ath_vif *avp; 343 286 344 - tsfadjust = cur_conf->beacon_interval * avp->av_bslot; 345 - tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF; 346 - avp->tsf_adjust = cpu_to_le64(tsfadjust); 287 + if (!sc->beacon.bslot[slot]) 288 + continue; 347 289 348 - ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n", 349 - (unsigned long long)tsfadjust, avp->av_bslot); 290 + avp = (void *)sc->beacon.bslot[slot]->drv_priv; 291 + 292 + /* tsf_adjust is added to the TSF value. We send out the 293 + * beacon late, so need to adjust the TSF starting point to be 294 + * later in time (i.e. the theoretical first beacon has a TSF 295 + * of 0 after correction). 296 + */ 297 + tsfadjust = cur_conf->beacon_interval * avp->av_bslot; 298 + tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF; 299 + avp->tsf_adjust = cpu_to_le64(tsfadjust); 300 + 301 + ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n", 302 + (signed long long)tsfadjust, avp->av_bslot); 303 + } 350 304 } 351 305 352 306 bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif) ··· 511 443 * Both nexttbtt and intval have to be in usecs. 512 444 */ 513 445 static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt, 514 - u32 intval, bool reset_tsf) 446 + u32 intval) 515 447 { 516 448 struct ath_hw *ah = sc->sc_ah; 517 449 518 450 ath9k_hw_disable_interrupts(ah); 519 - if (reset_tsf) 520 - ath9k_hw_reset_tsf(ah); 521 451 ath9k_beaconq_config(sc); 522 452 ath9k_hw_beaconinit(ah, nexttbtt, intval); 453 + ah->imask |= ATH9K_INT_SWBA; 523 454 sc->beacon.bmisscnt = 0; 524 455 ath9k_hw_set_interrupts(ah); 525 456 ath9k_hw_enable_interrupts(ah); 457 + } 458 + 459 + static void ath9k_beacon_stop(struct ath_softc *sc) 460 + { 461 + ath9k_hw_disable_interrupts(sc->sc_ah); 462 + sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); 463 + sc->beacon.bmisscnt = 0; 464 + ath9k_hw_set_interrupts(sc->sc_ah); 465 + ath9k_hw_enable_interrupts(sc->sc_ah); 526 466 } 527 467 528 468 /* ··· 544 468 struct ath_hw *ah = sc->sc_ah; 545 469 546 470 ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF); 547 - ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false); 471 + ath9k_beacon_init(sc, conf->nexttbtt, conf->intval); 548 472 } 549 473 550 474 static void ath9k_beacon_config_sta(struct ath_hw *ah, ··· 573 497 574 498 ath9k_cmn_beacon_config_adhoc(ah, conf); 575 499 576 - ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator); 500 + ath9k_beacon_init(sc, conf->nexttbtt, conf->intval); 577 501 578 502 /* 579 503 * Set the global 'beacon has been configured' flag for the ··· 581 505 */ 582 506 if (!conf->ibss_creator && conf->enable_beacon) 583 507 set_bit(ATH_OP_BEACONS, &common->op_flags); 584 - } 585 - 586 - static bool ath9k_allow_beacon_config(struct ath_softc *sc, 587 - struct ieee80211_vif *vif) 588 - { 589 - struct ath_common *common = ath9k_hw_common(sc->sc_ah); 590 - struct ath_vif *avp = (void *)vif->drv_priv; 591 - 592 - if (ath9k_is_chanctx_enabled()) { 593 - /* 594 - * If the VIF is not present in the current channel context, 595 - * then we can't do the usual opmode checks. Allow the 596 - * beacon config for the VIF to be updated in this case and 597 - * return immediately. 598 - */ 599 - if (sc->cur_chan != avp->chanctx) 600 - return true; 601 - } 602 - 603 - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) { 604 - if (vif->type != NL80211_IFTYPE_AP) { 605 - ath_dbg(common, CONFIG, 606 - "An AP interface is already present !\n"); 607 - return false; 608 - } 609 - } 610 - 611 - if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { 612 - if ((vif->type == NL80211_IFTYPE_STATION) && 613 - test_bit(ATH_OP_BEACONS, &common->op_flags) && 614 - vif != sc->cur_chan->primary_sta) { 615 - ath_dbg(common, CONFIG, 616 - "Beacon already configured for a station interface\n"); 617 - return false; 618 - } 619 - } 620 - 621 - return true; 622 508 } 623 509 624 510 static void ath9k_cache_beacon_config(struct ath_softc *sc, ··· 618 580 if (cur_conf->dtim_period == 0) 619 581 cur_conf->dtim_period = 1; 620 582 583 + ath9k_set_tsfadjust(sc, cur_conf); 621 584 } 622 585 623 - void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif, 624 - u32 changed) 586 + void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif, 587 + bool beacons) 625 588 { 626 - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; 627 - struct ath_hw *ah = sc->sc_ah; 628 - struct ath_common *common = ath9k_hw_common(ah); 629 - struct ath_vif *avp = (void *)vif->drv_priv; 630 - struct ath_chanctx *ctx = avp->chanctx; 589 + struct ath_hw *ah = sc->sc_ah; 590 + struct ath_common *common = ath9k_hw_common(ah); 591 + struct ath_vif *avp; 592 + struct ath_chanctx *ctx; 631 593 struct ath_beacon_config *cur_conf; 632 594 unsigned long flags; 595 + bool enabled; 633 596 bool skip_beacon = false; 634 597 635 - if (!ctx) 598 + if (!beacons) { 599 + clear_bit(ATH_OP_BEACONS, &common->op_flags); 600 + ath9k_beacon_stop(sc); 601 + return; 602 + } 603 + 604 + if (WARN_ON(!main_vif)) 636 605 return; 637 606 638 - cur_conf = &avp->chanctx->beacon; 639 - if (vif->type == NL80211_IFTYPE_AP) 640 - ath9k_set_tsfadjust(sc, vif); 607 + avp = (void *)main_vif->drv_priv; 608 + ctx = avp->chanctx; 609 + cur_conf = &ctx->beacon; 610 + enabled = cur_conf->enable_beacon; 611 + cur_conf->enable_beacon = beacons; 641 612 642 - if (!ath9k_allow_beacon_config(sc, vif)) 643 - return; 644 - 645 - if (vif->type == NL80211_IFTYPE_STATION) { 646 - ath9k_cache_beacon_config(sc, ctx, bss_conf); 647 - if (ctx != sc->cur_chan) 648 - return; 613 + if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { 614 + ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf); 649 615 650 616 ath9k_set_beacon(sc); 651 617 set_bit(ATH_OP_BEACONS, &common->op_flags); 652 618 return; 653 619 } 654 620 655 - /* 656 - * Take care of multiple interfaces when 657 - * enabling/disabling SWBA. 658 - */ 659 - if (changed & BSS_CHANGED_BEACON_ENABLED) { 660 - bool enabled = cur_conf->enable_beacon; 661 - 662 - if (!bss_conf->enable_beacon) { 663 - cur_conf->enable_beacon &= ~BIT(avp->av_bslot); 664 - } else { 665 - cur_conf->enable_beacon |= BIT(avp->av_bslot); 666 - if (!enabled) 667 - ath9k_cache_beacon_config(sc, ctx, bss_conf); 668 - } 669 - } 670 - 671 - if (ctx != sc->cur_chan) 672 - return; 621 + /* Update the beacon configuration. */ 622 + ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf); 673 623 674 624 /* 675 625 * Configure the HW beacon registers only when we have a valid 676 626 * beacon interval. 677 627 */ 678 628 if (cur_conf->beacon_interval) { 679 - /* 680 - * If we are joining an existing IBSS network, start beaconing 681 - * only after a TSF-sync has taken place. Ensure that this 682 - * happens by setting the appropriate flags. 629 + /* Special case to sync the TSF when joining an existing IBSS. 630 + * This is only done if no AP interface is active. 631 + * Note that mac80211 always resets the TSF when creating a new 632 + * IBSS interface. 683 633 */ 684 - if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator && 685 - bss_conf->enable_beacon) { 634 + if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC && 635 + !enabled && beacons && !main_vif->bss_conf.ibss_creator) { 686 636 spin_lock_irqsave(&sc->sc_pm_lock, flags); 687 637 sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; 688 638 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); 689 639 skip_beacon = true; 690 - } else { 691 - ath9k_set_beacon(sc); 692 640 } 693 641 694 642 /* 695 643 * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode 696 644 * here, it is done in ath9k_beacon_config_adhoc(). 697 645 */ 698 - if (cur_conf->enable_beacon && !skip_beacon) 646 + if (beacons && !skip_beacon) { 699 647 set_bit(ATH_OP_BEACONS, &common->op_flags); 700 - else 648 + ath9k_set_beacon(sc); 649 + } else { 701 650 clear_bit(ATH_OP_BEACONS, &common->op_flags); 651 + ath9k_beacon_stop(sc); 652 + } 653 + } else { 654 + clear_bit(ATH_OP_BEACONS, &common->op_flags); 655 + ath9k_beacon_stop(sc); 702 656 } 703 657 } 704 658
+1
drivers/net/wireless/ath/ath9k/common.h
··· 50 50 #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) 51 51 52 52 struct ath_beacon_config { 53 + struct ieee80211_vif *main_vif; 53 54 int beacon_interval; 54 55 u16 dtim_period; 55 56 u16 bmiss_timeout;
+2 -2
drivers/net/wireless/ath/ath9k/dynack.c
··· 280 280 void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an) 281 281 { 282 282 /* ackto = slottime + sifs + air delay */ 283 - u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64; 283 + u32 ackto = 9 + 16 + 64; 284 284 struct ath_dynack *da = &ah->dynack; 285 285 286 286 an->ackto = ackto; ··· 315 315 void ath_dynack_reset(struct ath_hw *ah) 316 316 { 317 317 /* ackto = slottime + sifs + air delay */ 318 - u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64; 318 + u32 ackto = 9 + 16 + 64; 319 319 struct ath_dynack *da = &ah->dynack; 320 320 321 321 da->lto = jiffies;
+25 -8
drivers/net/wireless/ath/ath9k/eeprom.c
··· 15 15 */ 16 16 17 17 #include "hw.h" 18 + #include <linux/ath9k_platform.h> 18 19 19 20 void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val) 20 21 { ··· 109 108 } 110 109 } 111 110 112 - static bool ath9k_hw_nvram_read_blob(struct ath_hw *ah, u32 off, 113 - u16 *data) 111 + static bool ath9k_hw_nvram_read_array(u16 *blob, size_t blob_size, 112 + off_t offset, u16 *data) 114 113 { 115 - u16 *blob_data; 116 - 117 - if (off * sizeof(u16) > ah->eeprom_blob->size) 114 + if (offset > blob_size) 118 115 return false; 119 116 120 - blob_data = (u16 *)ah->eeprom_blob->data; 121 - *data = blob_data[off]; 117 + *data = blob[offset]; 122 118 return true; 119 + } 120 + 121 + static bool ath9k_hw_nvram_read_pdata(struct ath9k_platform_data *pdata, 122 + off_t offset, u16 *data) 123 + { 124 + return ath9k_hw_nvram_read_array(pdata->eeprom_data, 125 + ARRAY_SIZE(pdata->eeprom_data), 126 + offset, data); 127 + } 128 + 129 + static bool ath9k_hw_nvram_read_firmware(const struct firmware *eeprom_blob, 130 + off_t offset, u16 *data) 131 + { 132 + return ath9k_hw_nvram_read_array((u16 *) eeprom_blob->data, 133 + eeprom_blob->size / sizeof(u16), 134 + offset, data); 123 135 } 124 136 125 137 bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data) 126 138 { 127 139 struct ath_common *common = ath9k_hw_common(ah); 140 + struct ath9k_platform_data *pdata = ah->dev->platform_data; 128 141 bool ret; 129 142 130 143 if (ah->eeprom_blob) 131 - ret = ath9k_hw_nvram_read_blob(ah, off, data); 144 + ret = ath9k_hw_nvram_read_firmware(ah->eeprom_blob, off, data); 145 + else if (pdata && !pdata->use_eeprom && pdata->eeprom_data) 146 + ret = ath9k_hw_nvram_read_pdata(pdata, off, data); 132 147 else 133 148 ret = common->bus_ops->eeprom_read(common, off, data); 134 149
+1 -1
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
··· 45 45 * Long slot time : 2x cwmin 46 46 * Short slot time : 4x cwmin 47 47 */ 48 - if (ah->slottime == ATH9K_SLOT_TIME_20) 48 + if (ah->slottime == 20) 49 49 qi.tqi_cwmin = 2*qi_be.tqi_cwmin; 50 50 else 51 51 qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
+1 -1
drivers/net/wireless/ath/ath9k/htc_drv_init.c
··· 678 678 679 679 for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++) 680 680 priv->beacon.bslot[i] = NULL; 681 - priv->beacon.slottime = ATH9K_SLOT_TIME_9; 681 + priv->beacon.slottime = 9; 682 682 683 683 ath9k_cmn_init_channels_rates(common); 684 684 ath9k_cmn_init_crypto(ah);
+25 -29
drivers/net/wireless/ath/ath9k/hw.c
··· 454 454 if (AR_SREV_9100(ah)) 455 455 ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX; 456 456 457 - ah->slottime = ATH9K_SLOT_TIME_9; 457 + ah->slottime = 9; 458 458 ah->globaltxtimeout = (u32) -1; 459 459 ah->power_mode = ATH9K_PM_UNDEFINED; 460 460 ah->htc_reset_init = true; ··· 471 471 ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S); 472 472 } 473 473 474 - static int ath9k_hw_init_macaddr(struct ath_hw *ah) 474 + static void ath9k_hw_init_macaddr(struct ath_hw *ah) 475 475 { 476 476 struct ath_common *common = ath9k_hw_common(ah); 477 - u32 sum; 478 477 int i; 479 478 u16 eeval; 480 479 static const u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW }; 481 480 482 - sum = 0; 481 + /* MAC address may already be loaded via ath9k_platform_data */ 482 + if (is_valid_ether_addr(common->macaddr)) 483 + return; 484 + 483 485 for (i = 0; i < 3; i++) { 484 486 eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]); 485 - sum += eeval; 486 487 common->macaddr[2 * i] = eeval >> 8; 487 488 common->macaddr[2 * i + 1] = eeval & 0xff; 488 489 } 489 - if (!is_valid_ether_addr(common->macaddr)) { 490 - ath_err(common, 491 - "eeprom contains invalid mac address: %pM\n", 492 - common->macaddr); 493 490 494 - random_ether_addr(common->macaddr); 495 - ath_err(common, 496 - "random mac address will be used: %pM\n", 497 - common->macaddr); 498 - } 491 + if (is_valid_ether_addr(common->macaddr)) 492 + return; 499 493 500 - return 0; 494 + ath_err(common, "eeprom contains invalid mac address: %pM\n", 495 + common->macaddr); 496 + 497 + random_ether_addr(common->macaddr); 498 + ath_err(common, "random mac address will be used: %pM\n", 499 + common->macaddr); 500 + 501 + return; 501 502 } 502 503 503 504 static int ath9k_hw_post_init(struct ath_hw *ah) ··· 637 636 if (r) 638 637 return r; 639 638 640 - r = ath9k_hw_init_macaddr(ah); 641 - if (r) { 642 - ath_err(common, "Failed to initialize MAC address\n"); 643 - return r; 644 - } 645 - 639 + ath9k_hw_init_macaddr(ah); 646 640 ath9k_hw_init_hang_checks(ah); 647 641 648 642 common->state = ATH_HW_INITIALIZED; ··· 1828 1832 u32 saveLedState; 1829 1833 u32 saveDefAntenna; 1830 1834 u32 macStaId1; 1835 + struct timespec tsf_ts; 1836 + u32 tsf_offset; 1831 1837 u64 tsf = 0; 1832 - s64 usec = 0; 1833 1838 int r; 1834 1839 bool start_mci_reset = false; 1835 1840 bool save_fullsleep = ah->chip_fullsleep; ··· 1874 1877 macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B; 1875 1878 1876 1879 /* Save TSF before chip reset, a cold reset clears it */ 1880 + getrawmonotonic(&tsf_ts); 1877 1881 tsf = ath9k_hw_gettsf64(ah); 1878 - usec = ktime_to_us(ktime_get_raw()); 1879 1882 1880 1883 saveLedState = REG_READ(ah, AR_CFG_LED) & 1881 1884 (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL | ··· 1908 1911 } 1909 1912 1910 1913 /* Restore TSF */ 1911 - usec = ktime_to_us(ktime_get_raw()) - usec; 1912 - ath9k_hw_settsf64(ah, tsf + usec); 1914 + tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL); 1915 + ath9k_hw_settsf64(ah, tsf + tsf_offset); 1913 1916 1914 1917 if (AR_SREV_9280_20_OR_LATER(ah)) 1915 1918 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); ··· 1929 1932 /* 1930 1933 * Some AR91xx SoC devices frequently fail to accept TSF writes 1931 1934 * right after the chip reset. When that happens, write a new 1932 - * value after the initvals have been applied, with an offset 1933 - * based on measured time difference 1935 + * value after the initvals have been applied. 1934 1936 */ 1935 1937 if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) { 1936 - tsf += 1500; 1937 - ath9k_hw_settsf64(ah, tsf); 1938 + tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL); 1939 + ath9k_hw_settsf64(ah, tsf + tsf_offset); 1938 1940 } 1939 1941 1940 1942 ath9k_hw_init_mfp(ah);
+1
drivers/net/wireless/ath/ath9k/hw.h
··· 830 830 /* Calibration */ 831 831 u32 supp_cals; 832 832 struct ath9k_cal_list iq_caldata; 833 + struct ath9k_cal_list temp_caldata; 833 834 struct ath9k_cal_list adcgain_caldata; 834 835 struct ath9k_cal_list adcdc_caldata; 835 836 struct ath9k_cal_list *cal_list;
+29 -25
drivers/net/wireless/ath/ath9k/init.c
··· 372 372 373 373 common->last_rssi = ATH_RSSI_DUMMY_MARKER; 374 374 memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN); 375 - sc->beacon.slottime = ATH9K_SLOT_TIME_9; 375 + sc->beacon.slottime = 9; 376 376 377 377 for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) 378 378 sc->beacon.bslot[i] = NULL; ··· 512 512 release_firmware(sc->sc_ah->eeprom_blob); 513 513 } 514 514 515 - static int ath9k_init_soc_platform(struct ath_softc *sc) 515 + static int ath9k_init_platform(struct ath_softc *sc) 516 516 { 517 517 struct ath9k_platform_data *pdata = sc->dev->platform_data; 518 518 struct ath_hw *ah = sc->sc_ah; 519 - int ret = 0; 519 + struct ath_common *common = ath9k_hw_common(ah); 520 + int ret; 520 521 521 522 if (!pdata) 522 523 return 0; 524 + 525 + if (!pdata->use_eeprom) { 526 + ah->ah_flags &= ~AH_USE_EEPROM; 527 + ah->gpio_mask = pdata->gpio_mask; 528 + ah->gpio_val = pdata->gpio_val; 529 + ah->led_pin = pdata->led_pin; 530 + ah->is_clk_25mhz = pdata->is_clk_25mhz; 531 + ah->get_mac_revision = pdata->get_mac_revision; 532 + ah->external_reset = pdata->external_reset; 533 + ah->disable_2ghz = pdata->disable_2ghz; 534 + ah->disable_5ghz = pdata->disable_5ghz; 535 + 536 + if (!pdata->endian_check) 537 + ah->ah_flags |= AH_NO_EEP_SWAP; 538 + } 523 539 524 540 if (pdata->eeprom_name) { 525 541 ret = ath9k_eeprom_request(sc, pdata->eeprom_name); ··· 543 527 return ret; 544 528 } 545 529 530 + if (pdata->led_active_high) 531 + ah->config.led_active_high = true; 532 + 546 533 if (pdata->tx_gain_buffalo) 547 534 ah->config.tx_gain_buffalo = true; 548 535 549 - return ret; 536 + if (pdata->macaddr) 537 + ether_addr_copy(common->macaddr, pdata->macaddr); 538 + 539 + return 0; 550 540 } 551 541 552 542 static int ath9k_init_softc(u16 devid, struct ath_softc *sc, 553 543 const struct ath_bus_ops *bus_ops) 554 544 { 555 - struct ath9k_platform_data *pdata = sc->dev->platform_data; 556 545 struct ath_hw *ah = NULL; 557 546 struct ath9k_hw_capabilities *pCap; 558 547 struct ath_common *common; ··· 571 550 ah->dev = sc->dev; 572 551 ah->hw = sc->hw; 573 552 ah->hw_version.devid = devid; 553 + ah->ah_flags |= AH_USE_EEPROM; 554 + ah->led_pin = -1; 574 555 ah->reg_ops.read = ath9k_ioread32; 575 556 ah->reg_ops.multi_read = ath9k_multi_ioread32; 576 557 ah->reg_ops.write = ath9k_iowrite32; ··· 592 569 if (!ath9k_is_chanctx_enabled()) 593 570 sc->cur_chan->hw_queue_base = 0; 594 571 595 - if (!pdata || pdata->use_eeprom) { 596 - ah->ah_flags |= AH_USE_EEPROM; 597 - sc->sc_ah->led_pin = -1; 598 - } else { 599 - sc->sc_ah->gpio_mask = pdata->gpio_mask; 600 - sc->sc_ah->gpio_val = pdata->gpio_val; 601 - sc->sc_ah->led_pin = pdata->led_pin; 602 - ah->is_clk_25mhz = pdata->is_clk_25mhz; 603 - ah->get_mac_revision = pdata->get_mac_revision; 604 - ah->external_reset = pdata->external_reset; 605 - ah->disable_2ghz = pdata->disable_2ghz; 606 - ah->disable_5ghz = pdata->disable_5ghz; 607 - if (!pdata->endian_check) 608 - ah->ah_flags |= AH_NO_EEP_SWAP; 609 - } 610 - 611 572 common->ops = &ah->reg_ops; 612 573 common->bus_ops = bus_ops; 613 574 common->ps_ops = &ath9k_ps_ops; ··· 607 600 */ 608 601 ath9k_init_pcoem_platform(sc); 609 602 610 - ret = ath9k_init_soc_platform(sc); 603 + ret = ath9k_init_platform(sc); 611 604 if (ret) 612 605 return ret; 613 606 ··· 652 645 ret = ath9k_hw_init(ah); 653 646 if (ret) 654 647 goto err_hw; 655 - 656 - if (pdata && pdata->macaddr) 657 - memcpy(common->macaddr, pdata->macaddr, ETH_ALEN); 658 648 659 649 ret = ath9k_init_queues(sc); 660 650 if (ret)
-4
drivers/net/wireless/ath/ath9k/mac.h
··· 65 65 #define INIT_SSH_RETRY 32 66 66 #define INIT_SLG_RETRY 32 67 67 68 - #define ATH9K_SLOT_TIME_6 6 69 - #define ATH9K_SLOT_TIME_9 9 70 - #define ATH9K_SLOT_TIME_20 20 71 - 72 68 #define ATH9K_TXERR_XRETRY 0x01 73 69 #define ATH9K_TXERR_FILT 0x02 74 70 #define ATH9K_TXERR_FIFO 0x04
+50 -23
drivers/net/wireless/ath/ath9k/main.c
··· 910 910 } 911 911 } 912 912 913 + static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data, 914 + struct ieee80211_vif *vif) 915 + { 916 + /* Use the first (configured) interface, but prefering AP interfaces. */ 917 + if (!iter_data->primary_beacon_vif) { 918 + iter_data->primary_beacon_vif = vif; 919 + } else { 920 + if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP && 921 + vif->type == NL80211_IFTYPE_AP) 922 + iter_data->primary_beacon_vif = vif; 923 + } 924 + 925 + iter_data->beacons = true; 926 + iter_data->nbcnvifs += 1; 927 + } 928 + 913 929 static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data, 914 930 u8 *mac, struct ieee80211_vif *vif) 915 931 { ··· 942 926 } 943 927 944 928 if (!vif->bss_conf.use_short_slot) 945 - iter_data->slottime = ATH9K_SLOT_TIME_20; 929 + iter_data->slottime = 20; 946 930 947 931 switch (vif->type) { 948 932 case NL80211_IFTYPE_AP: 949 933 iter_data->naps++; 934 + if (vif->bss_conf.enable_beacon) 935 + ath9k_vif_iter_set_beacon(iter_data, vif); 950 936 break; 951 937 case NL80211_IFTYPE_STATION: 952 938 iter_data->nstations++; ··· 961 943 case NL80211_IFTYPE_ADHOC: 962 944 iter_data->nadhocs++; 963 945 if (vif->bss_conf.enable_beacon) 964 - iter_data->beacons = true; 946 + ath9k_vif_iter_set_beacon(iter_data, vif); 965 947 break; 966 948 case NL80211_IFTYPE_MESH_POINT: 967 949 iter_data->nmeshes++; 968 950 if (vif->bss_conf.enable_beacon) 969 - iter_data->beacons = true; 951 + ath9k_vif_iter_set_beacon(iter_data, vif); 970 952 break; 971 953 case NL80211_IFTYPE_WDS: 972 954 iter_data->nwds++; ··· 1017 999 */ 1018 1000 memset(iter_data, 0, sizeof(*iter_data)); 1019 1001 eth_broadcast_addr(iter_data->mask); 1020 - iter_data->slottime = ATH9K_SLOT_TIME_9; 1002 + iter_data->slottime = 9; 1021 1003 1022 1004 list_for_each_entry(avp, &ctx->vifs, list) 1023 1005 ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif); ··· 1079 1061 ah->opmode = vif->type; 1080 1062 ah->imask &= ~ATH9K_INT_SWBA; 1081 1063 ah->imask &= ~ATH9K_INT_TSFOOR; 1082 - ah->slottime = ATH9K_SLOT_TIME_9; 1064 + ah->slottime = 9; 1083 1065 1084 1066 ath_hw_setbssidmask(common); 1085 1067 ath9k_hw_setopmode(ah); ··· 1099 1081 struct ath_hw *ah = sc->sc_ah; 1100 1082 struct ath_common *common = ath9k_hw_common(ah); 1101 1083 struct ath9k_vif_iter_data iter_data; 1102 - struct ath_beacon_config *cur_conf; 1103 1084 1104 1085 ath_chanctx_check_active(sc, ctx); 1105 1086 ··· 1120 1103 ath_hw_setbssidmask(common); 1121 1104 1122 1105 if (iter_data.naps > 0) { 1123 - cur_conf = &ctx->beacon; 1124 1106 ath9k_hw_set_tsfadjust(ah, true); 1125 1107 ah->opmode = NL80211_IFTYPE_AP; 1126 - if (cur_conf->enable_beacon) 1127 - iter_data.beacons = true; 1128 1108 } else { 1129 1109 ath9k_hw_set_tsfadjust(ah, false); 1110 + if (iter_data.beacons) 1111 + ath9k_beacon_ensure_primary_slot(sc); 1130 1112 1131 1113 if (iter_data.nmeshes) 1132 1114 ah->opmode = NL80211_IFTYPE_MESH_POINT; ··· 1150 1134 ctx->switch_after_beacon = true; 1151 1135 } 1152 1136 1153 - ah->imask &= ~ATH9K_INT_SWBA; 1154 1137 if (ah->opmode == NL80211_IFTYPE_STATION) { 1155 1138 bool changed = (iter_data.primary_sta != ctx->primary_sta); 1156 1139 ··· 1166 1151 if (ath9k_hw_mci_is_enabled(sc->sc_ah)) 1167 1152 ath9k_mci_update_wlan_channels(sc, true); 1168 1153 } 1169 - } else if (iter_data.beacons) { 1170 - ah->imask |= ATH9K_INT_SWBA; 1171 1154 } 1155 + sc->nbcnvifs = iter_data.nbcnvifs; 1156 + ath9k_beacon_config(sc, iter_data.primary_beacon_vif, 1157 + iter_data.beacons); 1172 1158 ath9k_hw_set_interrupts(ah); 1173 - 1174 - if (iter_data.beacons) 1175 - set_bit(ATH_OP_BEACONS, &common->op_flags); 1176 - else 1177 - clear_bit(ATH_OP_BEACONS, &common->op_flags); 1178 1159 1179 1160 if (ah->slottime != iter_data.slottime) { 1180 1161 ah->slottime = iter_data.slottime; ··· 1788 1777 if ((changed & BSS_CHANGED_BEACON_ENABLED) || 1789 1778 (changed & BSS_CHANGED_BEACON_INT) || 1790 1779 (changed & BSS_CHANGED_BEACON_INFO)) { 1791 - ath9k_beacon_config(sc, vif, changed); 1792 - if (changed & BSS_CHANGED_BEACON_ENABLED) 1793 - ath9k_calculate_summary_state(sc, avp->chanctx); 1780 + ath9k_calculate_summary_state(sc, avp->chanctx); 1794 1781 } 1795 1782 1796 1783 if ((avp->chanctx == sc->cur_chan) && ··· 1797 1788 slottime = 9; 1798 1789 else 1799 1790 slottime = 20; 1791 + 1800 1792 if (vif->type == NL80211_IFTYPE_AP) { 1801 1793 /* 1802 1794 * Defer update, so that connected stations can adjust ··· 1833 1823 static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1834 1824 { 1835 1825 struct ath_softc *sc = hw->priv; 1826 + struct ath_vif *avp = (void *)vif->drv_priv; 1836 1827 u64 tsf; 1837 1828 1838 1829 mutex_lock(&sc->mutex); 1839 1830 ath9k_ps_wakeup(sc); 1840 - tsf = ath9k_hw_gettsf64(sc->sc_ah); 1831 + /* Get current TSF either from HW or kernel time. */ 1832 + if (sc->cur_chan == avp->chanctx) { 1833 + tsf = ath9k_hw_gettsf64(sc->sc_ah); 1834 + } else { 1835 + tsf = sc->cur_chan->tsf_val + 1836 + ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL); 1837 + } 1838 + tsf += le64_to_cpu(avp->tsf_adjust); 1841 1839 ath9k_ps_restore(sc); 1842 1840 mutex_unlock(&sc->mutex); 1843 1841 ··· 1857 1839 u64 tsf) 1858 1840 { 1859 1841 struct ath_softc *sc = hw->priv; 1842 + struct ath_vif *avp = (void *)vif->drv_priv; 1860 1843 1861 1844 mutex_lock(&sc->mutex); 1862 1845 ath9k_ps_wakeup(sc); 1863 - ath9k_hw_settsf64(sc->sc_ah, tsf); 1846 + tsf -= le64_to_cpu(avp->tsf_adjust); 1847 + getrawmonotonic(&avp->chanctx->tsf_ts); 1848 + if (sc->cur_chan == avp->chanctx) 1849 + ath9k_hw_settsf64(sc->sc_ah, tsf); 1850 + avp->chanctx->tsf_val = tsf; 1864 1851 ath9k_ps_restore(sc); 1865 1852 mutex_unlock(&sc->mutex); 1866 1853 } ··· 1873 1850 static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1874 1851 { 1875 1852 struct ath_softc *sc = hw->priv; 1853 + struct ath_vif *avp = (void *)vif->drv_priv; 1876 1854 1877 1855 mutex_lock(&sc->mutex); 1878 1856 1879 1857 ath9k_ps_wakeup(sc); 1880 - ath9k_hw_reset_tsf(sc->sc_ah); 1858 + getrawmonotonic(&avp->chanctx->tsf_ts); 1859 + if (sc->cur_chan == avp->chanctx) 1860 + ath9k_hw_reset_tsf(sc->sc_ah); 1861 + avp->chanctx->tsf_val = 0; 1881 1862 ath9k_ps_restore(sc); 1882 1863 1883 1864 mutex_unlock(&sc->mutex);
+11 -26
drivers/net/wireless/ath/ath9k/pci.c
··· 19 19 #include <linux/nl80211.h> 20 20 #include <linux/pci.h> 21 21 #include <linux/pci-aspm.h> 22 - #include <linux/ath9k_platform.h> 23 22 #include <linux/module.h> 24 23 #include "ath9k.h" 25 24 ··· 785 786 786 787 static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data) 787 788 { 788 - struct ath_softc *sc = (struct ath_softc *) common->priv; 789 - struct ath9k_platform_data *pdata = sc->dev->platform_data; 789 + struct ath_hw *ah = (struct ath_hw *) common->ah; 790 790 791 - if (pdata && !pdata->use_eeprom) { 792 - if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { 793 - ath_err(common, 794 - "%s: eeprom read failed, offset %08x is out of range\n", 795 - __func__, off); 796 - } 791 + common->ops->read(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); 797 792 798 - *data = pdata->eeprom_data[off]; 799 - } else { 800 - struct ath_hw *ah = (struct ath_hw *) common->ah; 801 - 802 - common->ops->read(ah, AR5416_EEPROM_OFFSET + 803 - (off << AR5416_EEPROM_S)); 804 - 805 - if (!ath9k_hw_wait(ah, 806 - AR_EEPROM_STATUS_DATA, 807 - AR_EEPROM_STATUS_DATA_BUSY | 808 - AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0, 809 - AH_WAIT_TIMEOUT)) { 810 - return false; 811 - } 812 - 813 - *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA), 814 - AR_EEPROM_STATUS_DATA_VAL); 793 + if (!ath9k_hw_wait(ah, 794 + AR_EEPROM_STATUS_DATA, 795 + AR_EEPROM_STATUS_DATA_BUSY | 796 + AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0, 797 + AH_WAIT_TIMEOUT)) { 798 + return false; 815 799 } 800 + 801 + *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA), 802 + AR_EEPROM_STATUS_DATA_VAL); 816 803 817 804 return true; 818 805 }
+18 -13
drivers/net/wireless/ath/wcn36xx/dxe.c
··· 35 35 return ch->head_blk_ctl->bd_cpu_addr; 36 36 } 37 37 38 + static void wcn36xx_ccu_write_register(struct wcn36xx *wcn, int addr, int data) 39 + { 40 + wcn36xx_dbg(WCN36XX_DBG_DXE, 41 + "wcn36xx_ccu_write_register: addr=%x, data=%x\n", 42 + addr, data); 43 + 44 + writel(data, wcn->ccu_base + addr); 45 + } 46 + 38 47 static void wcn36xx_dxe_write_register(struct wcn36xx *wcn, int addr, int data) 39 48 { 40 49 wcn36xx_dbg(WCN36XX_DBG_DXE, 41 50 "wcn36xx_dxe_write_register: addr=%x, data=%x\n", 42 51 addr, data); 43 52 44 - writel(data, wcn->mmio + addr); 53 + writel(data, wcn->dxe_base + addr); 45 54 } 46 - 47 - #define wcn36xx_dxe_write_register_x(wcn, reg, reg_data) \ 48 - do { \ 49 - if (wcn->chip_version == WCN36XX_CHIP_3680) \ 50 - wcn36xx_dxe_write_register(wcn, reg ## _3680, reg_data); \ 51 - else \ 52 - wcn36xx_dxe_write_register(wcn, reg ## _3660, reg_data); \ 53 - } while (0) \ 54 55 55 56 static void wcn36xx_dxe_read_register(struct wcn36xx *wcn, int addr, int *data) 56 57 { 57 - *data = readl(wcn->mmio + addr); 58 + *data = readl(wcn->dxe_base + addr); 58 59 59 60 wcn36xx_dbg(WCN36XX_DBG_DXE, 60 61 "wcn36xx_dxe_read_register: addr=%x, data=%x\n", ··· 702 701 reg_data = WCN36XX_DXE_REG_RESET; 703 702 wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_REG_CSR_RESET, reg_data); 704 703 705 - /* Setting interrupt path */ 706 - reg_data = WCN36XX_DXE_CCU_INT; 707 - wcn36xx_dxe_write_register_x(wcn, WCN36XX_DXE_REG_CCU_INT, reg_data); 704 + /* Select channels for rx avail and xfer done interrupts... */ 705 + reg_data = (WCN36XX_DXE_INT_CH3_MASK | WCN36XX_DXE_INT_CH1_MASK) << 16 | 706 + WCN36XX_DXE_INT_CH0_MASK | WCN36XX_DXE_INT_CH4_MASK; 707 + if (wcn->is_pronto) 708 + wcn36xx_ccu_write_register(wcn, WCN36XX_CCU_DXE_INT_SELECT_PRONTO, reg_data); 709 + else 710 + wcn36xx_ccu_write_register(wcn, WCN36XX_CCU_DXE_INT_SELECT_RIVA, reg_data); 708 711 709 712 /***************************************/ 710 713 /* Init descriptors for TX LOW channel */
+3 -4
drivers/net/wireless/ath/wcn36xx/dxe.h
··· 28 28 */ 29 29 30 30 /* DXE registers */ 31 - #define WCN36XX_DXE_MEM_REG 0x202000 31 + #define WCN36XX_DXE_MEM_REG 0 32 32 33 - #define WCN36XX_DXE_CCU_INT 0xA0011 34 - #define WCN36XX_DXE_REG_CCU_INT_3660 0x200b10 35 - #define WCN36XX_DXE_REG_CCU_INT_3680 0x2050dc 33 + #define WCN36XX_CCU_DXE_INT_SELECT_RIVA 0x310 34 + #define WCN36XX_CCU_DXE_INT_SELECT_PRONTO 0x10dc 36 35 37 36 /* TODO This must calculated properly but not hardcoded */ 38 37 #define WCN36XX_DXE_CTRL_TX_L 0x328a44
+2 -2
drivers/net/wireless/ath/wcn36xx/hal.h
··· 4123 4123 4124 4124 /* Update scan params - sent from host to PNO to be used during PNO 4125 4125 * scanningx */ 4126 - struct update_scan_params_req_ex { 4126 + struct wcn36xx_hal_update_scan_params_req_ex { 4127 4127 4128 4128 struct wcn36xx_hal_msg_header header; 4129 4129 ··· 4151 4151 4152 4152 /* Cb State */ 4153 4153 enum phy_chan_bond_state state; 4154 - }; 4154 + } __packed; 4155 4155 4156 4156 /* Update scan params - sent from host to PNO to be used during PNO 4157 4157 * scanningx */
+41 -26
drivers/net/wireless/ath/wcn36xx/main.c
··· 19 19 #include <linux/module.h> 20 20 #include <linux/firmware.h> 21 21 #include <linux/platform_device.h> 22 + #include <linux/of_address.h> 23 + #include <linux/of_device.h> 22 24 #include "wcn36xx.h" 23 25 24 26 unsigned int wcn36xx_dbg_mask; ··· 261 259 } 262 260 } 263 261 264 - static void wcn36xx_detect_chip_version(struct wcn36xx *wcn) 265 - { 266 - if (get_feat_caps(wcn->fw_feat_caps, DOT11AC)) { 267 - wcn36xx_info("Chip is 3680\n"); 268 - wcn->chip_version = WCN36XX_CHIP_3680; 269 - } else { 270 - wcn36xx_info("Chip is 3660\n"); 271 - wcn->chip_version = WCN36XX_CHIP_3660; 272 - } 273 - } 274 - 275 262 static int wcn36xx_start(struct ieee80211_hw *hw) 276 263 { 277 264 struct wcn36xx *wcn = hw->priv; ··· 314 323 else 315 324 wcn36xx_feat_caps_info(wcn); 316 325 } 317 - 318 - wcn36xx_detect_chip_version(wcn); 319 - wcn36xx_smd_update_cfg(wcn, WCN36XX_HAL_CFG_ENABLE_MC_ADDR_LIST, 1); 320 326 321 327 /* DMA channel initialization */ 322 328 ret = wcn36xx_dxe_init(wcn); ··· 1052 1064 static int wcn36xx_platform_get_resources(struct wcn36xx *wcn, 1053 1065 struct platform_device *pdev) 1054 1066 { 1067 + struct device_node *mmio_node; 1055 1068 struct resource *res; 1069 + int index; 1070 + int ret; 1071 + 1056 1072 /* Set TX IRQ */ 1057 1073 res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, 1058 1074 "wcnss_wlantx_irq"); ··· 1075 1083 } 1076 1084 wcn->rx_irq = res->start; 1077 1085 1078 - /* Map the memory */ 1079 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 1080 - "wcnss_mmio"); 1081 - if (!res) { 1082 - wcn36xx_err("failed to get mmio\n"); 1083 - return -ENOENT; 1086 + mmio_node = of_parse_phandle(pdev->dev.parent->of_node, "qcom,mmio", 0); 1087 + if (!mmio_node) { 1088 + wcn36xx_err("failed to acquire qcom,mmio reference\n"); 1089 + return -EINVAL; 1084 1090 } 1085 - wcn->mmio = ioremap(res->start, resource_size(res)); 1086 - if (!wcn->mmio) { 1087 - wcn36xx_err("failed to map io memory\n"); 1088 - return -ENOMEM; 1091 + 1092 + wcn->is_pronto = !!of_device_is_compatible(mmio_node, "qcom,pronto"); 1093 + 1094 + /* Map the CCU memory */ 1095 + index = of_property_match_string(mmio_node, "reg-names", "ccu"); 1096 + wcn->ccu_base = of_iomap(mmio_node, index); 1097 + if (!wcn->ccu_base) { 1098 + wcn36xx_err("failed to map ccu memory\n"); 1099 + ret = -ENOMEM; 1100 + goto put_mmio_node; 1089 1101 } 1102 + 1103 + /* Map the DXE memory */ 1104 + index = of_property_match_string(mmio_node, "reg-names", "dxe"); 1105 + wcn->dxe_base = of_iomap(mmio_node, index); 1106 + if (!wcn->dxe_base) { 1107 + wcn36xx_err("failed to map dxe memory\n"); 1108 + ret = -ENOMEM; 1109 + goto unmap_ccu; 1110 + } 1111 + 1112 + of_node_put(mmio_node); 1090 1113 return 0; 1114 + 1115 + unmap_ccu: 1116 + iounmap(wcn->ccu_base); 1117 + put_mmio_node: 1118 + of_node_put(mmio_node); 1119 + return ret; 1091 1120 } 1092 1121 1093 1122 static int wcn36xx_probe(struct platform_device *pdev) ··· 1151 1138 return 0; 1152 1139 1153 1140 out_unmap: 1154 - iounmap(wcn->mmio); 1141 + iounmap(wcn->ccu_base); 1142 + iounmap(wcn->dxe_base); 1155 1143 out_wq: 1156 1144 ieee80211_free_hw(hw); 1157 1145 out_err: ··· 1168 1154 mutex_destroy(&wcn->hal_mutex); 1169 1155 1170 1156 ieee80211_unregister_hw(hw); 1171 - iounmap(wcn->mmio); 1157 + iounmap(wcn->dxe_base); 1158 + iounmap(wcn->ccu_base); 1172 1159 ieee80211_free_hw(hw); 1173 1160 1174 1161 return 0;
+23 -21
drivers/net/wireless/ath/wcn36xx/smd.c
··· 674 674 return 0; 675 675 } 676 676 677 - int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn) 677 + int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn, 678 + u8 *channels, size_t channel_count) 678 679 { 679 - struct wcn36xx_hal_update_scan_params_req msg_body; 680 + struct wcn36xx_hal_update_scan_params_req_ex msg_body; 680 681 int ret = 0; 681 682 682 683 mutex_lock(&wcn->hal_mutex); 683 684 INIT_HAL_MSG(msg_body, WCN36XX_HAL_UPDATE_SCAN_PARAM_REQ); 684 685 685 - msg_body.dot11d_enabled = 0; 686 - msg_body.dot11d_resolved = 0; 687 - msg_body.channel_count = 26; 686 + msg_body.dot11d_enabled = false; 687 + msg_body.dot11d_resolved = true; 688 + 689 + msg_body.channel_count = channel_count; 690 + memcpy(msg_body.channels, channels, channel_count); 688 691 msg_body.active_min_ch_time = 60; 689 692 msg_body.active_max_ch_time = 120; 690 693 msg_body.passive_min_ch_time = 60; 691 694 msg_body.passive_max_ch_time = 110; 692 - msg_body.state = 0; 695 + msg_body.state = PHY_SINGLE_CHANNEL_CENTERED; 693 696 694 697 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); 695 698 ··· 2229 2226 2230 2227 case WCN36XX_HAL_COEX_IND: 2231 2228 case WCN36XX_HAL_AVOID_FREQ_RANGE_IND: 2229 + case WCN36XX_HAL_DEL_BA_IND: 2232 2230 case WCN36XX_HAL_OTA_TX_COMPL_IND: 2233 2231 case WCN36XX_HAL_MISSED_BEACON_IND: 2234 2232 case WCN36XX_HAL_DELETE_STA_CONTEXT_IND: 2235 - msg_ind = kmalloc(sizeof(*msg_ind), GFP_KERNEL); 2236 - if (!msg_ind) 2237 - goto nomem; 2238 - msg_ind->msg_len = len; 2239 - msg_ind->msg = kmemdup(buf, len, GFP_KERNEL); 2240 - if (!msg_ind->msg) { 2241 - kfree(msg_ind); 2242 - nomem: 2233 + msg_ind = kmalloc(sizeof(*msg_ind) + len, GFP_KERNEL); 2234 + if (!msg_ind) { 2243 2235 /* 2244 2236 * FIXME: Do something smarter then just 2245 2237 * printing an error. ··· 2243 2245 msg_header->msg_type); 2244 2246 break; 2245 2247 } 2246 - mutex_lock(&wcn->hal_ind_mutex); 2248 + 2249 + msg_ind->msg_len = len; 2250 + memcpy(msg_ind->msg, buf, len); 2251 + 2252 + spin_lock(&wcn->hal_ind_lock); 2247 2253 list_add_tail(&msg_ind->list, &wcn->hal_ind_queue); 2248 2254 queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work); 2249 - mutex_unlock(&wcn->hal_ind_mutex); 2255 + spin_unlock(&wcn->hal_ind_lock); 2250 2256 wcn36xx_dbg(WCN36XX_DBG_HAL, "indication arrived\n"); 2251 2257 break; 2252 2258 default: ··· 2264 2262 container_of(work, struct wcn36xx, hal_ind_work); 2265 2263 struct wcn36xx_hal_msg_header *msg_header; 2266 2264 struct wcn36xx_hal_ind_msg *hal_ind_msg; 2265 + unsigned long flags; 2267 2266 2268 - mutex_lock(&wcn->hal_ind_mutex); 2267 + spin_lock_irqsave(&wcn->hal_ind_lock, flags); 2269 2268 2270 2269 hal_ind_msg = list_first_entry(&wcn->hal_ind_queue, 2271 2270 struct wcn36xx_hal_ind_msg, ··· 2276 2273 2277 2274 switch (msg_header->msg_type) { 2278 2275 case WCN36XX_HAL_COEX_IND: 2276 + case WCN36XX_HAL_DEL_BA_IND: 2279 2277 case WCN36XX_HAL_AVOID_FREQ_RANGE_IND: 2280 2278 break; 2281 2279 case WCN36XX_HAL_OTA_TX_COMPL_IND: ··· 2299 2295 msg_header->msg_type); 2300 2296 } 2301 2297 list_del(wcn->hal_ind_queue.next); 2302 - kfree(hal_ind_msg->msg); 2298 + spin_unlock_irqrestore(&wcn->hal_ind_lock, flags); 2303 2299 kfree(hal_ind_msg); 2304 - mutex_unlock(&wcn->hal_ind_mutex); 2305 2300 } 2306 2301 int wcn36xx_smd_open(struct wcn36xx *wcn) 2307 2302 { ··· 2313 2310 } 2314 2311 INIT_WORK(&wcn->hal_ind_work, wcn36xx_ind_smd_work); 2315 2312 INIT_LIST_HEAD(&wcn->hal_ind_queue); 2316 - mutex_init(&wcn->hal_ind_mutex); 2313 + spin_lock_init(&wcn->hal_ind_lock); 2317 2314 2318 2315 ret = wcn->ctrl_ops->open(wcn, wcn36xx_smd_rsp_process); 2319 2316 if (ret) { ··· 2333 2330 { 2334 2331 wcn->ctrl_ops->close(); 2335 2332 destroy_workqueue(wcn->hal_ind_wq); 2336 - mutex_destroy(&wcn->hal_ind_mutex); 2337 2333 }
+2 -2
drivers/net/wireless/ath/wcn36xx/smd.h
··· 46 46 47 47 struct wcn36xx_hal_ind_msg { 48 48 struct list_head list; 49 - u8 *msg; 50 49 size_t msg_len; 50 + u8 msg[]; 51 51 }; 52 52 53 53 struct wcn36xx; ··· 63 63 int wcn36xx_smd_end_scan(struct wcn36xx *wcn); 64 64 int wcn36xx_smd_finish_scan(struct wcn36xx *wcn, 65 65 enum wcn36xx_hal_sys_mode mode); 66 - int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn); 66 + int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn, u8 *channels, size_t channel_count); 67 67 int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif); 68 68 int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr); 69 69 int wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index);
+4 -6
drivers/net/wireless/ath/wcn36xx/wcn36xx.h
··· 193 193 u8 fw_minor; 194 194 u8 fw_major; 195 195 u32 fw_feat_caps[WCN36XX_HAL_CAPS_SIZE]; 196 - u32 chip_version; 196 + bool is_pronto; 197 197 198 198 /* extra byte for the NULL termination */ 199 199 u8 crm_version[WCN36XX_HAL_VERSION_LENGTH + 1]; ··· 202 202 /* IRQs */ 203 203 int tx_irq; 204 204 int rx_irq; 205 - void __iomem *mmio; 205 + void __iomem *ccu_base; 206 + void __iomem *dxe_base; 206 207 207 208 struct wcn36xx_platform_ctrl_ops *ctrl_ops; 208 209 /* ··· 216 215 struct completion hal_rsp_compl; 217 216 struct workqueue_struct *hal_ind_wq; 218 217 struct work_struct hal_ind_work; 219 - struct mutex hal_ind_mutex; 218 + spinlock_t hal_ind_lock; 220 219 struct list_head hal_ind_queue; 221 220 222 221 /* DXE channels */ ··· 241 240 #endif /* CONFIG_WCN36XX_DEBUGFS */ 242 241 243 242 }; 244 - 245 - #define WCN36XX_CHIP_3660 0 246 - #define WCN36XX_CHIP_3680 1 247 243 248 244 static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn, 249 245 u8 major,
+3 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
··· 726 726 return -ENOMEM; 727 727 err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr, 728 728 glom_skb); 729 - if (err) 729 + if (err) { 730 + brcmu_pkt_buf_free_skb(glom_skb); 730 731 goto done; 732 + } 731 733 732 734 skb_queue_walk(pktq, skb) { 733 735 memcpy(skb->data, glom_skb->data, skb->len);
+13
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
··· 4666 4666 brcmf_err("SET SSID error (%d)\n", err); 4667 4667 goto exit; 4668 4668 } 4669 + 4670 + if (settings->hidden_ssid) { 4671 + err = brcmf_fil_iovar_int_set(ifp, "closednet", 1); 4672 + if (err) { 4673 + brcmf_err("closednet error (%d)\n", err); 4674 + goto exit; 4675 + } 4676 + } 4677 + 4669 4678 brcmf_dbg(TRACE, "AP mode configuration complete\n"); 4670 4679 } else if (dev_role == NL80211_IFTYPE_P2P_GO) { 4671 4680 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); ··· 4732 4723 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); 4733 4724 return err; 4734 4725 } 4726 + 4727 + /* First BSS doesn't get a full reset */ 4728 + if (ifp->bsscfgidx == 0) 4729 + brcmf_fil_iovar_int_set(ifp, "closednet", 0); 4735 4730 4736 4731 memset(&join_params, 0, sizeof(join_params)); 4737 4732 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
+17 -5
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
··· 2469 2469 void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked) 2470 2470 { 2471 2471 struct brcmf_fws_info *fws = drvr->fws; 2472 + struct brcmf_if *ifp; 2473 + int i; 2472 2474 2473 - fws->bus_flow_blocked = flow_blocked; 2474 - if (!flow_blocked) 2475 - brcmf_fws_schedule_deq(fws); 2476 - else 2477 - fws->stats.bus_flow_block++; 2475 + if (fws->avoid_queueing) { 2476 + for (i = 0; i < BRCMF_MAX_IFS; i++) { 2477 + ifp = drvr->iflist[i]; 2478 + if (!ifp || !ifp->ndev) 2479 + continue; 2480 + brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, 2481 + flow_blocked); 2482 + } 2483 + } else { 2484 + fws->bus_flow_blocked = flow_blocked; 2485 + if (!flow_blocked) 2486 + brcmf_fws_schedule_deq(fws); 2487 + else 2488 + fws->stats.bus_flow_block++; 2489 + } 2478 2490 }
+3 -4
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
··· 3305 3305 goto err; 3306 3306 } 3307 3307 3308 - /* Allow full data communication using DPC from now on. */ 3309 - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); 3310 - bcmerror = 0; 3311 - 3312 3308 err: 3313 3309 brcmf_sdio_clkctl(bus, CLK_SDONLY, false); 3314 3310 sdio_release_host(bus->sdiodev->func[1]); ··· 4042 4046 } 4043 4047 4044 4048 if (err == 0) { 4049 + /* Allow full data communication using DPC from now on. */ 4050 + brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); 4051 + 4045 4052 err = brcmf_sdiod_intr_register(sdiodev); 4046 4053 if (err != 0) 4047 4054 brcmf_err("intr register failed:%d\n", err);
+3 -1
drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c
··· 1079 1079 1080 1080 pa = dma_map_single(di->dmadev, p->data, di->rxbufsize, 1081 1081 DMA_FROM_DEVICE); 1082 - if (dma_mapping_error(di->dmadev, pa)) 1082 + if (dma_mapping_error(di->dmadev, pa)) { 1083 + brcmu_pkt_buf_free_skb(p); 1083 1084 return false; 1085 + } 1084 1086 1085 1087 /* save the free packet pointer */ 1086 1088 di->rxp[rxout] = p;
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmsmac/stf.c
··· 87 87 brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel, 88 88 u16 chanspec) 89 89 { 90 - struct tx_power power; 90 + struct tx_power power = { }; 91 91 u8 siso_mcs_id, cdd_mcs_id, stbc_mcs_id; 92 92 93 93 /* Clear previous settings */
+2 -2
drivers/net/wireless/intel/iwlwifi/iwl-7000.c
··· 73 73 /* Highest firmware API version supported */ 74 74 #define IWL7260_UCODE_API_MAX 17 75 75 #define IWL7265_UCODE_API_MAX 17 76 - #define IWL7265D_UCODE_API_MAX 21 77 - #define IWL3168_UCODE_API_MAX 21 76 + #define IWL7265D_UCODE_API_MAX 24 77 + #define IWL3168_UCODE_API_MAX 24 78 78 79 79 /* Lowest firmware API version supported */ 80 80 #define IWL7260_UCODE_API_MIN 16
+2 -2
drivers/net/wireless/intel/iwlwifi/iwl-8000.c
··· 70 70 #include "iwl-agn-hw.h" 71 71 72 72 /* Highest firmware API version supported */ 73 - #define IWL8000_UCODE_API_MAX 21 74 - #define IWL8265_UCODE_API_MAX 21 73 + #define IWL8000_UCODE_API_MAX 24 74 + #define IWL8265_UCODE_API_MAX 24 75 75 76 76 /* Lowest firmware API version supported */ 77 77 #define IWL8000_UCODE_API_MIN 16
+1 -1
drivers/net/wireless/intel/iwlwifi/iwl-9000.c
··· 55 55 #include "iwl-agn-hw.h" 56 56 57 57 /* Highest firmware API version supported */ 58 - #define IWL9000_UCODE_API_MAX 21 58 + #define IWL9000_UCODE_API_MAX 24 59 59 60 60 /* Lowest firmware API version supported */ 61 61 #define IWL9000_UCODE_API_MIN 16
+2 -2
drivers/net/wireless/marvell/libertas/cfg.c
··· 2044 2044 2045 2045 2046 2046 2047 - int lbs_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, 2048 - bool enabled, int timeout) 2047 + static int lbs_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, 2048 + bool enabled, int timeout) 2049 2049 { 2050 2050 struct lbs_private *priv = wiphy_priv(wiphy); 2051 2051
+8 -6
drivers/net/wireless/marvell/mwifiex/cfg80211.c
··· 1936 1936 mwifiex_set_uap_rates(bss_cfg, params); 1937 1937 1938 1938 if (mwifiex_set_secure_params(priv, bss_cfg, params)) { 1939 - kfree(bss_cfg); 1940 1939 mwifiex_dbg(priv->adapter, ERROR, 1941 1940 "Failed to parse secuirty parameters!\n"); 1942 - return -1; 1941 + goto out; 1943 1942 } 1944 1943 1945 1944 mwifiex_set_ht_params(priv, bss_cfg, params); ··· 1967 1968 if (mwifiex_11h_activate(priv, false)) { 1968 1969 mwifiex_dbg(priv->adapter, ERROR, 1969 1970 "Failed to disable 11h extensions!!"); 1970 - return -1; 1971 + goto out; 1971 1972 } 1972 1973 priv->state_11h.is_11h_active = false; 1973 1974 } ··· 1975 1976 if (mwifiex_config_start_uap(priv, bss_cfg)) { 1976 1977 mwifiex_dbg(priv->adapter, ERROR, 1977 1978 "Failed to start AP\n"); 1978 - kfree(bss_cfg); 1979 - return -1; 1979 + goto out; 1980 1980 } 1981 1981 1982 1982 if (mwifiex_set_mgmt_ies(priv, &params->beacon)) 1983 - return -1; 1983 + goto out; 1984 1984 1985 1985 if (!netif_carrier_ok(priv->netdev)) 1986 1986 netif_carrier_on(priv->netdev); ··· 1988 1990 memcpy(&priv->bss_cfg, bss_cfg, sizeof(priv->bss_cfg)); 1989 1991 kfree(bss_cfg); 1990 1992 return 0; 1993 + 1994 + out: 1995 + kfree(bss_cfg); 1996 + return -1; 1991 1997 } 1992 1998 1993 1999 /*
+5 -5
drivers/net/wireless/marvell/mwifiex/ioctl.h
··· 343 343 }; 344 344 345 345 struct mwifiex_ds_reg_rw { 346 - __le32 type; 347 - __le32 offset; 348 - __le32 value; 346 + u32 type; 347 + u32 offset; 348 + u32 value; 349 349 }; 350 350 351 351 #define MAX_EEPROM_DATA 256 352 352 353 353 struct mwifiex_ds_read_eeprom { 354 - __le16 offset; 355 - __le16 byte_count; 354 + u16 offset; 355 + u16 byte_count; 356 356 u8 value[MAX_EEPROM_DATA]; 357 357 }; 358 358
+7 -2
drivers/net/wireless/marvell/mwifiex/pcie.c
··· 202 202 if (mwifiex_add_card(card, &add_remove_card_sem, &pcie_ops, 203 203 MWIFIEX_PCIE)) { 204 204 pr_err("%s failed\n", __func__); 205 - kfree(card); 206 205 return -1; 207 206 } 208 207 ··· 1616 1617 1617 1618 pkt_len = *((__le16 *)skb->data); 1618 1619 rx_len = le16_to_cpu(pkt_len); 1620 + skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len); 1619 1621 skb_trim(skb, rx_len); 1620 1622 skb_pull(skb, INTF_HEADER_LEN); 1621 1623 ··· 2301 2301 } 2302 2302 2303 2303 } 2304 + if (!card->msi_enable) { 2305 + spin_lock_irqsave(&adapter->int_lock, flags); 2306 + pcie_ireg |= adapter->int_status; 2307 + adapter->int_status = 0; 2308 + spin_unlock_irqrestore(&adapter->int_lock, flags); 2309 + } 2304 2310 } 2305 2311 mwifiex_dbg(adapter, INTR, 2306 2312 "info: cmd_sent=%d data_sent=%d\n", ··· 2849 2843 "MRVL_PCIE", &card->share_irq_ctx); 2850 2844 if (ret) { 2851 2845 pr_err("request_irq failed: ret=%d\n", ret); 2852 - adapter->card = NULL; 2853 2846 return -1; 2854 2847 } 2855 2848
+12 -16
drivers/net/wireless/marvell/mwifiex/sta_cmd.c
··· 1148 1148 cmd->size = cpu_to_le16(sizeof(*mac_reg) + S_DS_GEN); 1149 1149 mac_reg = &cmd->params.mac_reg; 1150 1150 mac_reg->action = cpu_to_le16(cmd_action); 1151 - mac_reg->offset = 1152 - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 1153 - mac_reg->value = reg_rw->value; 1151 + mac_reg->offset = cpu_to_le16((u16) reg_rw->offset); 1152 + mac_reg->value = cpu_to_le32(reg_rw->value); 1154 1153 break; 1155 1154 } 1156 1155 case HostCmd_CMD_BBP_REG_ACCESS: ··· 1159 1160 cmd->size = cpu_to_le16(sizeof(*bbp_reg) + S_DS_GEN); 1160 1161 bbp_reg = &cmd->params.bbp_reg; 1161 1162 bbp_reg->action = cpu_to_le16(cmd_action); 1162 - bbp_reg->offset = 1163 - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 1164 - bbp_reg->value = (u8) le32_to_cpu(reg_rw->value); 1163 + bbp_reg->offset = cpu_to_le16((u16) reg_rw->offset); 1164 + bbp_reg->value = (u8) reg_rw->value; 1165 1165 break; 1166 1166 } 1167 1167 case HostCmd_CMD_RF_REG_ACCESS: ··· 1170 1172 cmd->size = cpu_to_le16(sizeof(*rf_reg) + S_DS_GEN); 1171 1173 rf_reg = &cmd->params.rf_reg; 1172 1174 rf_reg->action = cpu_to_le16(cmd_action); 1173 - rf_reg->offset = cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 1174 - rf_reg->value = (u8) le32_to_cpu(reg_rw->value); 1175 + rf_reg->offset = cpu_to_le16((u16) reg_rw->offset); 1176 + rf_reg->value = (u8) reg_rw->value; 1175 1177 break; 1176 1178 } 1177 1179 case HostCmd_CMD_PMIC_REG_ACCESS: ··· 1181 1183 cmd->size = cpu_to_le16(sizeof(*pmic_reg) + S_DS_GEN); 1182 1184 pmic_reg = &cmd->params.pmic_reg; 1183 1185 pmic_reg->action = cpu_to_le16(cmd_action); 1184 - pmic_reg->offset = 1185 - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 1186 - pmic_reg->value = (u8) le32_to_cpu(reg_rw->value); 1186 + pmic_reg->offset = cpu_to_le16((u16) reg_rw->offset); 1187 + pmic_reg->value = (u8) reg_rw->value; 1187 1188 break; 1188 1189 } 1189 1190 case HostCmd_CMD_CAU_REG_ACCESS: ··· 1192 1195 cmd->size = cpu_to_le16(sizeof(*cau_reg) + S_DS_GEN); 1193 1196 cau_reg = &cmd->params.rf_reg; 1194 1197 cau_reg->action = cpu_to_le16(cmd_action); 1195 - cau_reg->offset = 1196 - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); 1197 - cau_reg->value = (u8) le32_to_cpu(reg_rw->value); 1198 + cau_reg->offset = cpu_to_le16((u16) reg_rw->offset); 1199 + cau_reg->value = (u8) reg_rw->value; 1198 1200 break; 1199 1201 } 1200 1202 case HostCmd_CMD_802_11_EEPROM_ACCESS: ··· 1204 1208 1205 1209 cmd->size = cpu_to_le16(sizeof(*cmd_eeprom) + S_DS_GEN); 1206 1210 cmd_eeprom->action = cpu_to_le16(cmd_action); 1207 - cmd_eeprom->offset = rd_eeprom->offset; 1208 - cmd_eeprom->byte_count = rd_eeprom->byte_count; 1211 + cmd_eeprom->offset = cpu_to_le16(rd_eeprom->offset); 1212 + cmd_eeprom->byte_count = cpu_to_le16(rd_eeprom->byte_count); 1209 1213 cmd_eeprom->value = 0; 1210 1214 break; 1211 1215 }
+18 -19
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
··· 786 786 switch (type) { 787 787 case HostCmd_CMD_MAC_REG_ACCESS: 788 788 r.mac = &resp->params.mac_reg; 789 - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset)); 790 - reg_rw->value = r.mac->value; 789 + reg_rw->offset = (u32) le16_to_cpu(r.mac->offset); 790 + reg_rw->value = le32_to_cpu(r.mac->value); 791 791 break; 792 792 case HostCmd_CMD_BBP_REG_ACCESS: 793 793 r.bbp = &resp->params.bbp_reg; 794 - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset)); 795 - reg_rw->value = cpu_to_le32((u32) r.bbp->value); 794 + reg_rw->offset = (u32) le16_to_cpu(r.bbp->offset); 795 + reg_rw->value = (u32) r.bbp->value; 796 796 break; 797 797 798 798 case HostCmd_CMD_RF_REG_ACCESS: 799 799 r.rf = &resp->params.rf_reg; 800 - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset)); 801 - reg_rw->value = cpu_to_le32((u32) r.bbp->value); 800 + reg_rw->offset = (u32) le16_to_cpu(r.rf->offset); 801 + reg_rw->value = (u32) r.bbp->value; 802 802 break; 803 803 case HostCmd_CMD_PMIC_REG_ACCESS: 804 804 r.pmic = &resp->params.pmic_reg; 805 - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset)); 806 - reg_rw->value = cpu_to_le32((u32) r.pmic->value); 805 + reg_rw->offset = (u32) le16_to_cpu(r.pmic->offset); 806 + reg_rw->value = (u32) r.pmic->value; 807 807 break; 808 808 case HostCmd_CMD_CAU_REG_ACCESS: 809 809 r.rf = &resp->params.rf_reg; 810 - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset)); 811 - reg_rw->value = cpu_to_le32((u32) r.rf->value); 810 + reg_rw->offset = (u32) le16_to_cpu(r.rf->offset); 811 + reg_rw->value = (u32) r.rf->value; 812 812 break; 813 813 case HostCmd_CMD_802_11_EEPROM_ACCESS: 814 814 r.eeprom = &resp->params.eeprom; 815 - pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count); 816 - if (le16_to_cpu(eeprom->byte_count) < 817 - le16_to_cpu(r.eeprom->byte_count)) { 818 - eeprom->byte_count = cpu_to_le16(0); 815 + pr_debug("info: EEPROM read len=%x\n", 816 + le16_to_cpu(r.eeprom->byte_count)); 817 + if (eeprom->byte_count < le16_to_cpu(r.eeprom->byte_count)) { 818 + eeprom->byte_count = 0; 819 819 pr_debug("info: EEPROM read length is too big\n"); 820 820 return -1; 821 821 } 822 - eeprom->offset = r.eeprom->offset; 823 - eeprom->byte_count = r.eeprom->byte_count; 824 - if (le16_to_cpu(eeprom->byte_count) > 0) 822 + eeprom->offset = le16_to_cpu(r.eeprom->offset); 823 + eeprom->byte_count = le16_to_cpu(r.eeprom->byte_count); 824 + if (eeprom->byte_count > 0) 825 825 memcpy(&eeprom->value, &r.eeprom->value, 826 - le16_to_cpu(r.eeprom->byte_count)); 827 - 826 + min((u16)MAX_EEPROM_DATA, eeprom->byte_count)); 828 827 break; 829 828 default: 830 829 return -1;
+11 -10
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
··· 1251 1251 { 1252 1252 u16 cmd_no; 1253 1253 1254 - switch (le32_to_cpu(reg_rw->type)) { 1254 + switch (reg_rw->type) { 1255 1255 case MWIFIEX_REG_MAC: 1256 1256 cmd_no = HostCmd_CMD_MAC_REG_ACCESS; 1257 1257 break; ··· 1286 1286 { 1287 1287 struct mwifiex_ds_reg_rw reg_rw; 1288 1288 1289 - reg_rw.type = cpu_to_le32(reg_type); 1290 - reg_rw.offset = cpu_to_le32(reg_offset); 1291 - reg_rw.value = cpu_to_le32(reg_value); 1289 + reg_rw.type = reg_type; 1290 + reg_rw.offset = reg_offset; 1291 + reg_rw.value = reg_value; 1292 1292 1293 1293 return mwifiex_reg_mem_ioctl_reg_rw(priv, &reg_rw, HostCmd_ACT_GEN_SET); 1294 1294 } ··· 1306 1306 int ret; 1307 1307 struct mwifiex_ds_reg_rw reg_rw; 1308 1308 1309 - reg_rw.type = cpu_to_le32(reg_type); 1310 - reg_rw.offset = cpu_to_le32(reg_offset); 1309 + reg_rw.type = reg_type; 1310 + reg_rw.offset = reg_offset; 1311 1311 ret = mwifiex_reg_mem_ioctl_reg_rw(priv, &reg_rw, HostCmd_ACT_GEN_GET); 1312 1312 1313 1313 if (ret) 1314 1314 goto done; 1315 1315 1316 - *value = le32_to_cpu(reg_rw.value); 1316 + *value = reg_rw.value; 1317 1317 1318 1318 done: 1319 1319 return ret; ··· 1332 1332 int ret; 1333 1333 struct mwifiex_ds_read_eeprom rd_eeprom; 1334 1334 1335 - rd_eeprom.offset = cpu_to_le16((u16) offset); 1336 - rd_eeprom.byte_count = cpu_to_le16((u16) bytes); 1335 + rd_eeprom.offset = offset; 1336 + rd_eeprom.byte_count = bytes; 1337 1337 1338 1338 /* Send request to firmware */ 1339 1339 ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_EEPROM_ACCESS, 1340 1340 HostCmd_ACT_GEN_GET, 0, &rd_eeprom, true); 1341 1341 1342 1342 if (!ret) 1343 - memcpy(value, rd_eeprom.value, MAX_EEPROM_DATA); 1343 + memcpy(value, rd_eeprom.value, min((u16)MAX_EEPROM_DATA, 1344 + rd_eeprom.byte_count)); 1344 1345 return ret; 1345 1346 } 1346 1347
+1 -1
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/Makefile
··· 12 12 13 13 obj-$(CONFIG_RTL8188EE) += rtl8188ee.o 14 14 15 - ccflags-y += -Idrivers/net/wireless/rtlwifi -D__CHECK_ENDIAN__ 15 + ccflags-y += -D__CHECK_ENDIAN__
+16 -3
drivers/net/wireless/ti/wl18xx/main.c
··· 1214 1214 int_fw_status->counters.tx_voice_released_blks; 1215 1215 fw_status->counters.tx_last_rate = 1216 1216 int_fw_status->counters.tx_last_rate; 1217 + fw_status->counters.tx_last_rate_mbps = 1218 + int_fw_status->counters.tx_last_rate_mbps; 1219 + fw_status->counters.hlid = 1220 + int_fw_status->counters.hlid; 1217 1221 1218 1222 fw_status->log_start_addr = le32_to_cpu(int_fw_status->log_start_addr); 1219 1223 ··· 1825 1821 }, 1826 1822 { 1827 1823 .max = 1, 1828 - .types = BIT(NL80211_IFTYPE_AP) | 1829 - BIT(NL80211_IFTYPE_P2P_GO) | 1830 - BIT(NL80211_IFTYPE_P2P_CLIENT), 1824 + .types = BIT(NL80211_IFTYPE_AP) 1825 + | BIT(NL80211_IFTYPE_P2P_GO) 1826 + | BIT(NL80211_IFTYPE_P2P_CLIENT) 1827 + #ifdef CONFIG_MAC80211_MESH 1828 + | BIT(NL80211_IFTYPE_MESH_POINT) 1829 + #endif 1831 1830 }, 1832 1831 { 1833 1832 .max = 1, ··· 1843 1836 .max = 2, 1844 1837 .types = BIT(NL80211_IFTYPE_AP), 1845 1838 }, 1839 + #ifdef CONFIG_MAC80211_MESH 1840 + { 1841 + .max = 1, 1842 + .types = BIT(NL80211_IFTYPE_MESH_POINT), 1843 + }, 1844 + #endif 1846 1845 { 1847 1846 .max = 1, 1848 1847 .types = BIT(NL80211_IFTYPE_P2P_DEVICE),
+18 -4
drivers/net/wireless/ti/wl18xx/tx.c
··· 30 30 31 31 static 32 32 void wl18xx_get_last_tx_rate(struct wl1271 *wl, struct ieee80211_vif *vif, 33 - u8 band, struct ieee80211_tx_rate *rate) 33 + u8 band, struct ieee80211_tx_rate *rate, u8 hlid) 34 34 { 35 - u8 fw_rate = wl->fw_status->counters.tx_last_rate; 35 + u8 fw_rate = wl->links[hlid].fw_rate_idx; 36 36 37 37 if (fw_rate > CONF_HW_RATE_INDEX_MAX) { 38 38 wl1271_error("last Tx rate invalid: %d", fw_rate); ··· 79 79 struct sk_buff *skb; 80 80 int id = tx_stat_byte & WL18XX_TX_STATUS_DESC_ID_MASK; 81 81 bool tx_success; 82 + struct wl1271_tx_hw_descr *tx_desc; 82 83 83 84 /* check for id legality */ 84 85 if (unlikely(id >= wl->num_tx_desc || wl->tx_frames[id] == NULL)) { ··· 92 91 93 92 skb = wl->tx_frames[id]; 94 93 info = IEEE80211_SKB_CB(skb); 94 + tx_desc = (struct wl1271_tx_hw_descr *)skb->data; 95 95 96 96 if (wl12xx_is_dummy_packet(wl, skb)) { 97 97 wl1271_free_tx_id(wl, id); ··· 107 105 * the info->status structures 108 106 */ 109 107 wl18xx_get_last_tx_rate(wl, info->control.vif, 110 - info->band, &info->status.rates[0]); 108 + info->band, 109 + &info->status.rates[0], 110 + tx_desc->hlid); 111 111 112 112 info->status.rates[0].count = 1; /* no data about retries */ 113 113 info->status.ack_signal = -1; ··· 148 144 struct wl18xx_fw_status_priv *status_priv = 149 145 (struct wl18xx_fw_status_priv *)wl->fw_status->priv; 150 146 struct wl18xx_priv *priv = wl->priv; 151 - u8 i; 147 + u8 i, hlid; 152 148 153 149 /* nothing to do here */ 154 150 if (priv->last_fw_rls_idx == status_priv->fw_release_idx) 155 151 return; 152 + 153 + /* update rates per link */ 154 + hlid = wl->fw_status->counters.hlid; 155 + 156 + if (hlid < WLCORE_MAX_LINKS) { 157 + wl->links[hlid].fw_rate_idx = 158 + wl->fw_status->counters.tx_last_rate; 159 + wl->links[hlid].fw_rate_mbps = 160 + wl->fw_status->counters.tx_last_rate_mbps; 161 + } 156 162 157 163 /* freed Tx descriptors */ 158 164 wl1271_debug(DEBUG_TX, "last released desc = %d, current idx = %d",
+6 -2
drivers/net/wireless/ti/wl18xx/wl18xx.h
··· 29 29 #define WL18XX_IFTYPE_VER 9 30 30 #define WL18XX_MAJOR_VER WLCORE_FW_VER_IGNORE 31 31 #define WL18XX_SUBTYPE_VER WLCORE_FW_VER_IGNORE 32 - #define WL18XX_MINOR_VER 11 32 + #define WL18XX_MINOR_VER 58 33 33 34 34 #define WL18XX_CMD_MAX_SIZE 740 35 35 ··· 125 125 /* Tx rate of the last transmitted packet */ 126 126 u8 tx_last_rate; 127 127 128 - u8 padding[2]; 128 + /* Tx rate or Tx rate estimate pre-calculated by fw in mbps units */ 129 + u8 tx_last_rate_mbps; 130 + 131 + /* hlid for which the rates were reported */ 132 + u8 hlid; 129 133 } __packed; 130 134 131 135 /* FW status registers */
+1
drivers/net/wireless/ti/wlcore/acx.h
··· 105 105 WL1271_ROLE_DEVICE, 106 106 WL1271_ROLE_P2P_CL, 107 107 WL1271_ROLE_P2P_GO, 108 + WL1271_ROLE_MESH_POINT, 108 109 109 110 WL12XX_INVALID_ROLE_TYPE = 0xff 110 111 };
+1 -1
drivers/net/wireless/ti/wlcore/boot.c
··· 130 130 wl1271_error("Your WiFi FW version (%u.%u.%u.%u.%u) is invalid.\n" 131 131 "Please use at least FW %s\n" 132 132 "You can get the latest firmwares at:\n" 133 - "git://github.com/TI-OpenLink/firmwares.git", 133 + "git://git.ti.com/wilink8-wlan/wl18xx_fw.git", 134 134 fw_ver[FW_VER_CHIP], fw_ver[FW_VER_IF_TYPE], 135 135 fw_ver[FW_VER_MAJOR], fw_ver[FW_VER_SUBTYPE], 136 136 fw_ver[FW_VER_MINOR], min_fw_str);
+8 -5
drivers/net/wireless/ti/wlcore/cmd.c
··· 629 629 630 630 wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wlvif->role_id); 631 631 632 - /* trying to use hidden SSID with an old hostapd version */ 633 - if (wlvif->ssid_len == 0 && !bss_conf->hidden_ssid) { 634 - wl1271_error("got a null SSID from beacon/bss"); 635 - ret = -EINVAL; 636 - goto out; 632 + /* If MESH --> ssid_len is always 0 */ 633 + if (!ieee80211_vif_is_mesh(vif)) { 634 + /* trying to use hidden SSID with an old hostapd version */ 635 + if (wlvif->ssid_len == 0 && !bss_conf->hidden_ssid) { 636 + wl1271_error("got a null SSID from beacon/bss"); 637 + ret = -EINVAL; 638 + goto out; 639 + } 637 640 } 638 641 639 642 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+40 -4
drivers/net/wireless/ti/wlcore/main.c
··· 221 221 struct wl12xx_vif *wlvif = container_of(work, struct wl12xx_vif, 222 222 rc_update_work); 223 223 struct wl1271 *wl = wlvif->wl; 224 + struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); 224 225 225 226 mutex_lock(&wl->mutex); 226 227 ··· 232 231 if (ret < 0) 233 232 goto out; 234 233 235 - wlcore_hw_sta_rc_update(wl, wlvif); 234 + if (ieee80211_vif_is_mesh(vif)) { 235 + ret = wl1271_acx_set_ht_capabilities(wl, &wlvif->rc_ht_cap, 236 + true, wlvif->sta.hlid); 237 + if (ret < 0) 238 + goto out_sleep; 239 + } else { 240 + wlcore_hw_sta_rc_update(wl, wlvif); 241 + } 236 242 243 + out_sleep: 237 244 wl1271_ps_elp_sleep(wl); 238 245 out: 239 246 mutex_unlock(&wl->mutex); ··· 2162 2153 2163 2154 static u8 wl12xx_get_role_type(struct wl1271 *wl, struct wl12xx_vif *wlvif) 2164 2155 { 2156 + struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); 2157 + 2165 2158 switch (wlvif->bss_type) { 2166 2159 case BSS_TYPE_AP_BSS: 2167 2160 if (wlvif->p2p) 2168 2161 return WL1271_ROLE_P2P_GO; 2162 + else if (ieee80211_vif_is_mesh(vif)) 2163 + return WL1271_ROLE_MESH_POINT; 2169 2164 else 2170 2165 return WL1271_ROLE_AP; 2171 2166 ··· 2211 2198 wlvif->p2p = 1; 2212 2199 /* fall-through */ 2213 2200 case NL80211_IFTYPE_AP: 2201 + case NL80211_IFTYPE_MESH_POINT: 2214 2202 wlvif->bss_type = BSS_TYPE_AP_BSS; 2215 2203 break; 2216 2204 default: ··· 4145 4131 if (ret < 0) 4146 4132 goto out; 4147 4133 4148 - ret = wl1271_ap_set_probe_resp_tmpl(wl, wlvif->basic_rate, vif); 4149 - if (ret < 0) 4150 - goto out; 4134 + /* No need to set probe resp template for mesh */ 4135 + if (!ieee80211_vif_is_mesh(vif)) { 4136 + ret = wl1271_ap_set_probe_resp_tmpl(wl, 4137 + wlvif->basic_rate, 4138 + vif); 4139 + if (ret < 0) 4140 + goto out; 4141 + } 4151 4142 4152 4143 ret = wlcore_set_beacon_template(wl, vif, true); 4153 4144 if (ret < 0) ··· 4986 4967 return ret; 4987 4968 4988 4969 wl_sta = (struct wl1271_station *)sta->drv_priv; 4970 + wl_sta->wl = wl; 4989 4971 hlid = wl_sta->hlid; 4990 4972 4991 4973 ret = wl12xx_cmd_add_peer(wl, wlvif, sta, hlid); ··· 5661 5641 5662 5642 /* this callback is atomic, so schedule a new work */ 5663 5643 wlvif->rc_update_bw = sta->bandwidth; 5644 + memcpy(&wlvif->rc_ht_cap, &sta->ht_cap, sizeof(sta->ht_cap)); 5664 5645 ieee80211_queue_work(hw, &wlvif->rc_update_work); 5665 5646 } 5666 5647 ··· 5698 5677 5699 5678 out: 5700 5679 mutex_unlock(&wl->mutex); 5680 + } 5681 + 5682 + static u32 wlcore_op_get_expected_throughput(struct ieee80211_sta *sta) 5683 + { 5684 + struct wl1271_station *wl_sta = (struct wl1271_station *)sta->drv_priv; 5685 + struct wl1271 *wl = wl_sta->wl; 5686 + u8 hlid = wl_sta->hlid; 5687 + 5688 + /* return in units of Kbps */ 5689 + return (wl->links[hlid].fw_rate_mbps * 1000); 5701 5690 } 5702 5691 5703 5692 static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw) ··· 5910 5879 .switch_vif_chanctx = wlcore_op_switch_vif_chanctx, 5911 5880 .sta_rc_update = wlcore_op_sta_rc_update, 5912 5881 .sta_statistics = wlcore_op_sta_statistics, 5882 + .get_expected_throughput = wlcore_op_get_expected_throughput, 5913 5883 CFG80211_TESTMODE_CMD(wl1271_tm_cmd) 5914 5884 }; 5915 5885 ··· 6094 6062 BIT(NL80211_IFTYPE_AP) | 6095 6063 BIT(NL80211_IFTYPE_P2P_DEVICE) | 6096 6064 BIT(NL80211_IFTYPE_P2P_CLIENT) | 6065 + #ifdef CONFIG_MAC80211_MESH 6066 + BIT(NL80211_IFTYPE_MESH_POINT) | 6067 + #endif 6097 6068 BIT(NL80211_IFTYPE_P2P_GO); 6069 + 6098 6070 wl->hw->wiphy->max_scan_ssids = 1; 6099 6071 wl->hw->wiphy->max_sched_scan_ssids = 16; 6100 6072 wl->hw->wiphy->max_match_sets = 16;
+7
drivers/net/wireless/ti/wlcore/rx.c
··· 222 222 enum wl_rx_buf_align rx_align; 223 223 int ret = 0; 224 224 225 + /* update rates per link */ 226 + hlid = status->counters.hlid; 227 + 228 + if (hlid < WLCORE_MAX_LINKS) 229 + wl->links[hlid].fw_rate_mbps = 230 + status->counters.tx_last_rate_mbps; 231 + 225 232 while (drv_rx_counter != fw_rx_counter) { 226 233 buf_size = 0; 227 234 rx_counter = drv_rx_counter;
+105 -19
drivers/net/wireless/ti/wlcore/spi.c
··· 70 70 #define WSPI_MAX_CHUNK_SIZE 4092 71 71 72 72 /* 73 - * only support SPI for 12xx - this code should be reworked when 18xx 74 - * support is introduced 73 + * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to 74 + * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx 75 75 */ 76 - #define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) 76 + #define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE) 77 77 78 78 /* Maximum number of SPI write chunks */ 79 79 #define WSPI_MAX_NUM_OF_CHUNKS \ 80 80 ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1) 81 81 82 + 83 + struct wilink_familiy_data { 84 + char name[8]; 85 + }; 86 + 87 + const struct wilink_familiy_data *wilink_data; 88 + 89 + static const struct wilink_familiy_data wl18xx_data = { 90 + .name = "wl18xx", 91 + }; 92 + 93 + static const struct wilink_familiy_data wl12xx_data = { 94 + .name = "wl12xx", 95 + }; 82 96 83 97 struct wl12xx_spi_glue { 84 98 struct device *dev; ··· 133 119 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); 134 120 struct spi_transfer t; 135 121 struct spi_message m; 122 + struct spi_device *spi = to_spi_device(glue->dev); 136 123 u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 137 124 138 125 if (!cmd) { ··· 166 151 cmd[6] |= WSPI_INIT_CMD_EN_FIXEDBUSY; 167 152 168 153 cmd[7] = crc7_be(0, cmd+2, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END; 154 + 169 155 /* 170 156 * The above is the logical order; it must actually be stored 171 157 * in the buffer byte-swapped. ··· 179 163 spi_message_add_tail(&t, &m); 180 164 181 165 spi_sync(to_spi_device(glue->dev), &m); 166 + 167 + /* Send extra clocks with inverted CS (high). this is required 168 + * by the wilink family in order to successfully enter WSPI mode. 169 + */ 170 + spi->mode ^= SPI_CS_HIGH; 171 + memset(&m, 0, sizeof(m)); 172 + spi_message_init(&m); 173 + 174 + cmd[0] = 0xff; 175 + cmd[1] = 0xff; 176 + cmd[2] = 0xff; 177 + cmd[3] = 0xff; 178 + __swab32s((u32 *)cmd); 179 + 180 + t.tx_buf = cmd; 181 + t.len = 4; 182 + spi_message_add_tail(&t, &m); 183 + 184 + spi_sync(to_spi_device(glue->dev), &m); 185 + 186 + /* Restore chip select configration to normal */ 187 + spi->mode ^= SPI_CS_HIGH; 182 188 kfree(cmd); 183 189 } 184 190 ··· 308 270 return 0; 309 271 } 310 272 311 - static int __must_check wl12xx_spi_raw_write(struct device *child, int addr, 312 - void *buf, size_t len, bool fixed) 273 + static int __wl12xx_spi_raw_write(struct device *child, int addr, 274 + void *buf, size_t len, bool fixed) 313 275 { 314 276 struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); 315 - /* SPI write buffers - 2 for each chunk */ 316 - struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; 277 + struct spi_transfer *t; 317 278 struct spi_message m; 318 279 u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; /* 1 command per chunk */ 319 280 u32 *cmd; 320 281 u32 chunk_len; 321 282 int i; 322 283 284 + /* SPI write buffers - 2 for each chunk */ 285 + t = kzalloc(sizeof(*t) * 2 * WSPI_MAX_NUM_OF_CHUNKS, GFP_KERNEL); 286 + if (!t) 287 + return -ENOMEM; 288 + 323 289 WARN_ON(len > SPI_AGGR_BUFFER_SIZE); 324 290 325 291 spi_message_init(&m); 326 - memset(t, 0, sizeof(t)); 327 292 328 293 cmd = &commands[0]; 329 294 i = 0; ··· 359 318 360 319 spi_sync(to_spi_device(glue->dev), &m); 361 320 321 + kfree(t); 362 322 return 0; 323 + } 324 + 325 + static int __must_check wl12xx_spi_raw_write(struct device *child, int addr, 326 + void *buf, size_t len, bool fixed) 327 + { 328 + int ret; 329 + 330 + /* The ELP wakeup write may fail the first time due to internal 331 + * hardware latency. It is safer to send the wakeup command twice to 332 + * avoid unexpected failures. 333 + */ 334 + if (addr == HW_ACCESS_ELP_CTRL_REG) 335 + ret = __wl12xx_spi_raw_write(child, addr, buf, len, fixed); 336 + ret = __wl12xx_spi_raw_write(child, addr, buf, len, fixed); 337 + 338 + return ret; 363 339 } 364 340 365 341 /** ··· 407 349 return ret; 408 350 } 409 351 352 + /** 353 + * wl12xx_spi_set_block_size 354 + * 355 + * This function is not needed for spi mode, but need to be present. 356 + * Without it defined the wlcore fallback to use the wrong packet 357 + * allignment on tx. 358 + */ 359 + static void wl12xx_spi_set_block_size(struct device *child, 360 + unsigned int blksz) 361 + { 362 + } 363 + 410 364 static struct wl1271_if_operations spi_ops = { 411 365 .read = wl12xx_spi_raw_read, 412 366 .write = wl12xx_spi_raw_write, 413 367 .reset = wl12xx_spi_reset, 414 368 .init = wl12xx_spi_init, 415 369 .power = wl12xx_spi_set_power, 416 - .set_block_size = NULL, 370 + .set_block_size = wl12xx_spi_set_block_size, 417 371 }; 418 372 419 373 static const struct of_device_id wlcore_spi_of_match_table[] = { 420 - { .compatible = "ti,wl1271" }, 374 + { .compatible = "ti,wl1271", .data = &wl12xx_data}, 375 + { .compatible = "ti,wl1273", .data = &wl12xx_data}, 376 + { .compatible = "ti,wl1281", .data = &wl12xx_data}, 377 + { .compatible = "ti,wl1283", .data = &wl12xx_data}, 378 + { .compatible = "ti,wl1801", .data = &wl18xx_data}, 379 + { .compatible = "ti,wl1805", .data = &wl18xx_data}, 380 + { .compatible = "ti,wl1807", .data = &wl18xx_data}, 381 + { .compatible = "ti,wl1831", .data = &wl18xx_data}, 382 + { .compatible = "ti,wl1835", .data = &wl18xx_data}, 383 + { .compatible = "ti,wl1837", .data = &wl18xx_data}, 421 384 { } 422 385 }; 423 386 MODULE_DEVICE_TABLE(of, wlcore_spi_of_match_table); ··· 454 375 struct wlcore_platdev_data *pdev_data) 455 376 { 456 377 struct device_node *dt_node = spi->dev.of_node; 457 - int ret; 378 + const struct of_device_id *of_id; 379 + 380 + of_id = of_match_node(wlcore_spi_of_match_table, dt_node); 381 + if (!of_id) 382 + return -ENODEV; 383 + 384 + wilink_data = of_id->data; 385 + dev_info(&spi->dev, "selected chip familiy is %s\n", 386 + wilink_data->name); 458 387 459 388 if (of_find_property(dt_node, "clock-xtal", NULL)) 460 389 pdev_data->ref_clock_xtal = true; 461 390 462 - ret = of_property_read_u32(dt_node, "ref-clock-frequency", 463 - &pdev_data->ref_clock_freq); 464 - if (ret) { 465 - dev_err(glue->dev, 466 - "can't get reference clock frequency (%d)\n", ret); 467 - return ret; 468 - } 391 + /* optional clock frequency params */ 392 + of_property_read_u32(dt_node, "ref-clock-frequency", 393 + &pdev_data->ref_clock_freq); 394 + of_property_read_u32(dt_node, "tcxo-clock-frequency", 395 + &pdev_data->tcxo_clock_freq); 469 396 470 397 return 0; 471 398 } ··· 522 437 return ret; 523 438 } 524 439 525 - glue->core = platform_device_alloc("wl12xx", PLATFORM_DEVID_AUTO); 440 + glue->core = platform_device_alloc(wilink_data->name, 441 + PLATFORM_DEVID_AUTO); 526 442 if (!glue->core) { 527 443 dev_err(glue->dev, "can't allocate platform_device\n"); 528 444 return -ENOMEM;
+14
drivers/net/wireless/ti/wlcore/wlcore_i.h
··· 171 171 172 172 /* Tx rate of the last transmitted packet */ 173 173 u8 tx_last_rate; 174 + 175 + /* Tx rate or Tx rate estimate pre calculated by fw in mbps */ 176 + u8 tx_last_rate_mbps; 177 + 178 + /* hlid for which the rates were reported */ 179 + u8 hlid; 174 180 } counters; 175 181 176 182 u32 log_start_addr; ··· 279 273 /* bitmap of TIDs where RX BA sessions are active for this link */ 280 274 u8 ba_bitmap; 281 275 276 + /* the last fw rate index we used for this link */ 277 + u8 fw_rate_idx; 278 + 279 + /* the last fw rate [Mbps] we used for this link */ 280 + u8 fw_rate_mbps; 281 + 282 282 /* The wlvif this link belongs to. Might be null for global links */ 283 283 struct wl12xx_vif *wlvif; 284 284 ··· 347 335 * Used in both AP and STA mode. 348 336 */ 349 337 u64 total_freed_pkts; 338 + struct wl1271 *wl; 350 339 }; 351 340 352 341 struct wl12xx_vif { ··· 485 472 486 473 /* update rate conrol */ 487 474 enum ieee80211_sta_rx_bandwidth rc_update_bw; 475 + struct ieee80211_sta_ht_cap rc_ht_cap; 488 476 struct work_struct rc_update_work; 489 477 490 478 /*
+1
include/linux/ath9k_platform.h
··· 40 40 bool tx_gain_buffalo; 41 41 bool disable_2ghz; 42 42 bool disable_5ghz; 43 + bool led_active_high; 43 44 44 45 int (*get_mac_revision)(void); 45 46 int (*external_reset)(void);
+3
include/linux/bcma/bcma_driver_chipcommon.h
··· 504 504 #define BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK 0x1ff00000 505 505 #define BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT 20 506 506 507 + #define BCMA_CCB_MII_MNG_CTL 0x0000 508 + #define BCMA_CCB_MII_MNG_CMD_DATA 0x0004 509 + 507 510 /* BCM4331 ChipControl numbers. */ 508 511 #define BCMA_CHIPCTL_4331_BT_COEXIST BIT(0) /* 0 disable */ 509 512 #define BCMA_CHIPCTL_4331_SECI BIT(1) /* 0 SECI is disabled (JATG functional) */