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

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem

+5590 -3933
+68 -2
Documentation/DocBook/80211.tmpl
··· 146 146 !Finclude/net/cfg80211.h cfg80211_rx_mgmt 147 147 !Finclude/net/cfg80211.h cfg80211_mgmt_tx_status 148 148 !Finclude/net/cfg80211.h cfg80211_cqm_rssi_notify 149 + !Finclude/net/cfg80211.h cfg80211_cqm_pktloss_notify 149 150 !Finclude/net/cfg80211.h cfg80211_michael_mic_failure 150 151 </chapter> 151 152 <chapter> ··· 333 332 <title>functions/definitions</title> 334 333 !Finclude/net/mac80211.h ieee80211_rx_status 335 334 !Finclude/net/mac80211.h mac80211_rx_flags 335 + !Finclude/net/mac80211.h mac80211_tx_control_flags 336 + !Finclude/net/mac80211.h mac80211_rate_control_flags 337 + !Finclude/net/mac80211.h ieee80211_tx_rate 336 338 !Finclude/net/mac80211.h ieee80211_tx_info 339 + !Finclude/net/mac80211.h ieee80211_tx_info_clear_status 337 340 !Finclude/net/mac80211.h ieee80211_rx 341 + !Finclude/net/mac80211.h ieee80211_rx_ni 338 342 !Finclude/net/mac80211.h ieee80211_rx_irqsafe 339 343 !Finclude/net/mac80211.h ieee80211_tx_status 344 + !Finclude/net/mac80211.h ieee80211_tx_status_ni 340 345 !Finclude/net/mac80211.h ieee80211_tx_status_irqsafe 341 346 !Finclude/net/mac80211.h ieee80211_rts_get 342 347 !Finclude/net/mac80211.h ieee80211_rts_duration ··· 353 346 !Finclude/net/mac80211.h ieee80211_stop_queue 354 347 !Finclude/net/mac80211.h ieee80211_wake_queues 355 348 !Finclude/net/mac80211.h ieee80211_stop_queues 349 + !Finclude/net/mac80211.h ieee80211_queue_stopped 356 350 </sect1> 357 351 </chapter> 358 352 ··· 361 353 <title>Frame filtering</title> 362 354 !Pinclude/net/mac80211.h Frame filtering 363 355 !Finclude/net/mac80211.h ieee80211_filter_flags 356 + </chapter> 357 + 358 + <chapter id="workqueue"> 359 + <title>The mac80211 workqueue</title> 360 + !Pinclude/net/mac80211.h mac80211 workqueue 361 + !Finclude/net/mac80211.h ieee80211_queue_work 362 + !Finclude/net/mac80211.h ieee80211_queue_delayed_work 364 363 </chapter> 365 364 </part> 366 365 ··· 389 374 !Finclude/net/mac80211.h set_key_cmd 390 375 !Finclude/net/mac80211.h ieee80211_key_conf 391 376 !Finclude/net/mac80211.h ieee80211_key_flags 377 + !Finclude/net/mac80211.h ieee80211_tkip_key_type 378 + !Finclude/net/mac80211.h ieee80211_get_tkip_key 379 + !Finclude/net/mac80211.h ieee80211_key_removed 392 380 </chapter> 393 381 394 382 <chapter id="powersave"> ··· 435 417 supported by mac80211, add notes about supporting hw crypto 436 418 with it. 437 419 </para> 420 + !Finclude/net/mac80211.h ieee80211_iterate_active_interfaces 421 + !Finclude/net/mac80211.h ieee80211_iterate_active_interfaces_atomic 422 + </chapter> 423 + 424 + <chapter id="station-handling"> 425 + <title>Station handling</title> 426 + <para>TODO</para> 427 + !Finclude/net/mac80211.h ieee80211_sta 428 + !Finclude/net/mac80211.h sta_notify_cmd 429 + !Finclude/net/mac80211.h ieee80211_find_sta 430 + !Finclude/net/mac80211.h ieee80211_find_sta_by_ifaddr 431 + !Finclude/net/mac80211.h ieee80211_sta_block_awake 438 432 </chapter> 439 433 440 434 <chapter id="hardware-scan-offload"> 441 435 <title>Hardware scan offload</title> 442 436 <para>TBD</para> 443 437 !Finclude/net/mac80211.h ieee80211_scan_completed 438 + </chapter> 439 + 440 + <chapter id="aggregation"> 441 + <title>Aggregation</title> 442 + <sect1> 443 + <title>TX A-MPDU aggregation</title> 444 + !Pnet/mac80211/agg-tx.c TX A-MPDU aggregation 445 + !Cnet/mac80211/agg-tx.c 446 + </sect1> 447 + <sect1> 448 + <title>RX A-MPDU aggregation</title> 449 + !Pnet/mac80211/agg-rx.c RX A-MPDU aggregation 450 + !Cnet/mac80211/agg-rx.c 451 + </sect1> 452 + !Finclude/net/mac80211.h ieee80211_ampdu_mlme_action 453 + </chapter> 454 + 455 + <chapter id="smps"> 456 + <title>Spatial Multiplexing Powersave (SMPS)</title> 457 + !Pinclude/net/mac80211.h Spatial multiplexing power save 458 + !Finclude/net/mac80211.h ieee80211_request_smps 459 + !Finclude/net/mac80211.h ieee80211_smps_mode 444 460 </chapter> 445 461 </part> 446 462 ··· 487 435 interface and how it relates to mac80211 and drivers. 488 436 </para> 489 437 </partintro> 490 - <chapter id="dummy"> 491 - <title>dummy chapter</title> 438 + <chapter id="ratecontrol-api"> 439 + <title>Rate Control API</title> 492 440 <para>TBD</para> 441 + !Finclude/net/mac80211.h ieee80211_start_tx_ba_session 442 + !Finclude/net/mac80211.h ieee80211_start_tx_ba_cb_irqsafe 443 + !Finclude/net/mac80211.h ieee80211_stop_tx_ba_session 444 + !Finclude/net/mac80211.h ieee80211_stop_tx_ba_cb_irqsafe 445 + !Finclude/net/mac80211.h rate_control_changed 446 + !Finclude/net/mac80211.h ieee80211_tx_rate_control 447 + !Finclude/net/mac80211.h rate_control_send_low 493 448 </chapter> 494 449 </part> 495 450 ··· 542 483 <title>STA information lifetime rules</title> 543 484 !Pnet/mac80211/sta_info.c STA information lifetime rules 544 485 </sect1> 486 + </chapter> 487 + 488 + <chapter id="aggregation-internals"> 489 + <title>Aggregation</title> 490 + !Fnet/mac80211/sta_info.h sta_ampdu_mlme 491 + !Fnet/mac80211/sta_info.h tid_ampdu_tx 492 + !Fnet/mac80211/sta_info.h tid_ampdu_rx 545 493 </chapter> 546 494 547 495 <chapter id="synchronisation">
+4
drivers/bluetooth/ath3k.c
··· 35 35 static struct usb_device_id ath3k_table[] = { 36 36 /* Atheros AR3011 */ 37 37 { USB_DEVICE(0x0CF3, 0x3000) }, 38 + 39 + /* Atheros AR3011 with sflash firmware*/ 40 + { USB_DEVICE(0x0CF3, 0x3002) }, 41 + 38 42 { } /* Terminating entry */ 39 43 }; 40 44
+9 -3
drivers/bluetooth/btusb.c
··· 99 99 /* Broadcom BCM2033 without firmware */ 100 100 { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, 101 101 102 + /* Atheros 3011 with sflash firmware */ 103 + { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, 104 + 102 105 /* Broadcom BCM2035 */ 103 106 { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, 104 107 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, ··· 242 239 243 240 err = usb_submit_urb(urb, GFP_ATOMIC); 244 241 if (err < 0) { 245 - BT_ERR("%s urb %p failed to resubmit (%d)", 242 + if (err != -EPERM) 243 + BT_ERR("%s urb %p failed to resubmit (%d)", 246 244 hdev->name, urb, -err); 247 245 usb_unanchor_urb(urb); 248 246 } ··· 327 323 328 324 err = usb_submit_urb(urb, GFP_ATOMIC); 329 325 if (err < 0) { 330 - BT_ERR("%s urb %p failed to resubmit (%d)", 326 + if (err != -EPERM) 327 + BT_ERR("%s urb %p failed to resubmit (%d)", 331 328 hdev->name, urb, -err); 332 329 usb_unanchor_urb(urb); 333 330 } ··· 417 412 418 413 err = usb_submit_urb(urb, GFP_ATOMIC); 419 414 if (err < 0) { 420 - BT_ERR("%s urb %p failed to resubmit (%d)", 415 + if (err != -EPERM) 416 + BT_ERR("%s urb %p failed to resubmit (%d)", 421 417 hdev->name, urb, -err); 422 418 usb_unanchor_urb(urb); 423 419 }
+2 -4
drivers/net/wireless/ath/ar9170/usb.c
··· 161 161 static void ar9170_usb_tx_urb_complete_frame(struct urb *urb) 162 162 { 163 163 struct sk_buff *skb = urb->context; 164 - struct ar9170_usb *aru = (struct ar9170_usb *) 165 - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 164 + struct ar9170_usb *aru = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 166 165 167 166 if (unlikely(!aru)) { 168 167 dev_kfree_skb_irq(skb); ··· 218 219 static void ar9170_usb_rx_completed(struct urb *urb) 219 220 { 220 221 struct sk_buff *skb = urb->context; 221 - struct ar9170_usb *aru = (struct ar9170_usb *) 222 - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 222 + struct ar9170_usb *aru = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 223 223 int err; 224 224 225 225 if (!aru)
+2
drivers/net/wireless/ath/ath.h
··· 168 168 struct ath_regulatory regulatory; 169 169 const struct ath_ops *ops; 170 170 const struct ath_bus_ops *bus_ops; 171 + 172 + bool btcoex_enabled; 171 173 }; 172 174 173 175 struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
+16 -1
drivers/net/wireless/ath/ath5k/Kconfig
··· 1 1 config ATH5K 2 2 tristate "Atheros 5xxx wireless cards support" 3 - depends on PCI && MAC80211 3 + depends on (PCI || ATHEROS_AR231X) && MAC80211 4 4 select MAC80211_LEDS 5 5 select LEDS_CLASS 6 6 select NEW_LEDS 7 7 select AVERAGE 8 + select ATH5K_AHB if (ATHEROS_AR231X && !PCI) 9 + select ATH5K_PCI if (!ATHEROS_AR231X && PCI) 8 10 ---help--- 9 11 This module adds support for wireless adapters based on 10 12 Atheros 5xxx chipset. ··· 40 38 41 39 modprobe ath5k debug=0x00000400 42 40 41 + config ATH5K_AHB 42 + bool "Atheros 5xxx AHB bus support" 43 + depends on (ATHEROS_AR231X && !PCI) 44 + ---help--- 45 + This adds support for WiSoC type chipsets of the 5xxx Atheros 46 + family. 47 + 48 + config ATH5K_PCI 49 + bool "Atheros 5xxx PCI bus support" 50 + depends on (!ATHEROS_AR231X && PCI) 51 + ---help--- 52 + This adds support for PCI type chipsets of the 5xxx Atheros 53 + family.
+2
drivers/net/wireless/ath/ath5k/Makefile
··· 15 15 ath5k-y += ani.o 16 16 ath5k-y += sysfs.o 17 17 ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o 18 + ath5k-$(CONFIG_ATH5K_AHB) += ahb.o 19 + ath5k-$(CONFIG_ATH5K_PCI) += pci.o 18 20 obj-$(CONFIG_ATH5K) += ath5k.o
+219
drivers/net/wireless/ath/ath5k/ahb.c
··· 1 + /* 2 + * Copyright (c) 2008-2009 Atheros Communications Inc. 3 + * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org> 4 + * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org> 5 + * 6 + * Permission to use, copy, modify, and/or distribute this software for any 7 + * purpose with or without fee is hereby granted, provided that the above 8 + * copyright notice and this permission notice appear in all copies. 9 + * 10 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 + */ 18 + 19 + #include <linux/nl80211.h> 20 + #include <linux/platform_device.h> 21 + #include <ar231x_platform.h> 22 + #include "ath5k.h" 23 + #include "debug.h" 24 + #include "base.h" 25 + #include "reg.h" 26 + #include "debug.h" 27 + 28 + /* return bus cachesize in 4B word units */ 29 + static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz) 30 + { 31 + *csz = L1_CACHE_BYTES >> 2; 32 + } 33 + 34 + bool ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) 35 + { 36 + struct ath5k_softc *sc = common->priv; 37 + struct platform_device *pdev = to_platform_device(sc->dev); 38 + struct ar231x_board_config *bcfg = pdev->dev.platform_data; 39 + u16 *eeprom, *eeprom_end; 40 + 41 + 42 + 43 + bcfg = pdev->dev.platform_data; 44 + eeprom = (u16 *) bcfg->radio; 45 + eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ; 46 + 47 + eeprom += off; 48 + if (eeprom > eeprom_end) 49 + return -EINVAL; 50 + 51 + *data = *eeprom; 52 + return 0; 53 + } 54 + 55 + int ath5k_hw_read_srev(struct ath5k_hw *ah) 56 + { 57 + struct ath5k_softc *sc = ah->ah_sc; 58 + struct platform_device *pdev = to_platform_device(sc->dev); 59 + struct ar231x_board_config *bcfg = pdev->dev.platform_data; 60 + ah->ah_mac_srev = bcfg->devid; 61 + return 0; 62 + } 63 + 64 + static const struct ath_bus_ops ath_ahb_bus_ops = { 65 + .ath_bus_type = ATH_AHB, 66 + .read_cachesize = ath5k_ahb_read_cachesize, 67 + .eeprom_read = ath5k_ahb_eeprom_read, 68 + }; 69 + 70 + /*Initialization*/ 71 + static int ath_ahb_probe(struct platform_device *pdev) 72 + { 73 + struct ar231x_board_config *bcfg = pdev->dev.platform_data; 74 + struct ath5k_softc *sc; 75 + struct ieee80211_hw *hw; 76 + struct resource *res; 77 + void __iomem *mem; 78 + int irq; 79 + int ret = 0; 80 + u32 reg; 81 + 82 + if (!pdev->dev.platform_data) { 83 + dev_err(&pdev->dev, "no platform data specified\n"); 84 + ret = -EINVAL; 85 + goto err_out; 86 + } 87 + 88 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 89 + if (res == NULL) { 90 + dev_err(&pdev->dev, "no memory resource found\n"); 91 + ret = -ENXIO; 92 + goto err_out; 93 + } 94 + 95 + mem = ioremap_nocache(res->start, res->end - res->start + 1); 96 + if (mem == NULL) { 97 + dev_err(&pdev->dev, "ioremap failed\n"); 98 + ret = -ENOMEM; 99 + goto err_out; 100 + } 101 + 102 + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 103 + if (res == NULL) { 104 + dev_err(&pdev->dev, "no IRQ resource found\n"); 105 + ret = -ENXIO; 106 + goto err_out; 107 + } 108 + 109 + irq = res->start; 110 + 111 + hw = ieee80211_alloc_hw(sizeof(struct ath5k_softc), &ath5k_hw_ops); 112 + if (hw == NULL) { 113 + dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); 114 + ret = -ENOMEM; 115 + goto err_out; 116 + } 117 + 118 + sc = hw->priv; 119 + sc->hw = hw; 120 + sc->dev = &pdev->dev; 121 + sc->iobase = mem; 122 + sc->irq = irq; 123 + sc->devid = bcfg->devid; 124 + 125 + if (bcfg->devid >= AR5K_SREV_AR2315_R6) { 126 + /* Enable WMAC AHB arbitration */ 127 + reg = __raw_readl((void __iomem *) AR5K_AR2315_AHB_ARB_CTL); 128 + reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN; 129 + __raw_writel(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL); 130 + 131 + /* Enable global WMAC swapping */ 132 + reg = __raw_readl((void __iomem *) AR5K_AR2315_BYTESWAP); 133 + reg |= AR5K_AR2315_BYTESWAP_WMAC; 134 + __raw_writel(reg, (void __iomem *) AR5K_AR2315_BYTESWAP); 135 + } else { 136 + /* Enable WMAC DMA access (assuming 5312 or 231x*/ 137 + /* TODO: check other platforms */ 138 + reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); 139 + if (to_platform_device(sc->dev)->id == 0) 140 + reg |= AR5K_AR5312_ENABLE_WLAN0; 141 + else 142 + reg |= AR5K_AR5312_ENABLE_WLAN1; 143 + __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE); 144 + } 145 + 146 + ret = ath5k_init_softc(sc, &ath_ahb_bus_ops); 147 + if (ret != 0) { 148 + dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret); 149 + ret = -ENODEV; 150 + goto err_free_hw; 151 + } 152 + 153 + platform_set_drvdata(pdev, hw); 154 + 155 + return 0; 156 + 157 + err_free_hw: 158 + ieee80211_free_hw(hw); 159 + platform_set_drvdata(pdev, NULL); 160 + err_out: 161 + return ret; 162 + } 163 + 164 + static int ath_ahb_remove(struct platform_device *pdev) 165 + { 166 + struct ar231x_board_config *bcfg = pdev->dev.platform_data; 167 + struct ieee80211_hw *hw = platform_get_drvdata(pdev); 168 + struct ath5k_softc *sc; 169 + u32 reg; 170 + 171 + if (!hw) 172 + return 0; 173 + 174 + sc = hw->priv; 175 + 176 + if (bcfg->devid >= AR5K_SREV_AR2315_R6) { 177 + /* Disable WMAC AHB arbitration */ 178 + reg = __raw_readl((void __iomem *) AR5K_AR2315_AHB_ARB_CTL); 179 + reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN; 180 + __raw_writel(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL); 181 + } else { 182 + /*Stop DMA access */ 183 + reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); 184 + if (to_platform_device(sc->dev)->id == 0) 185 + reg &= ~AR5K_AR5312_ENABLE_WLAN0; 186 + else 187 + reg &= ~AR5K_AR5312_ENABLE_WLAN1; 188 + __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE); 189 + } 190 + 191 + ath5k_deinit_softc(sc); 192 + platform_set_drvdata(pdev, NULL); 193 + 194 + return 0; 195 + } 196 + 197 + static struct platform_driver ath_ahb_driver = { 198 + .probe = ath_ahb_probe, 199 + .remove = ath_ahb_remove, 200 + .driver = { 201 + .name = "ar231x-wmac", 202 + .owner = THIS_MODULE, 203 + }, 204 + }; 205 + 206 + static int __init 207 + ath5k_ahb_init(void) 208 + { 209 + return platform_driver_register(&ath_ahb_driver); 210 + } 211 + 212 + static void __exit 213 + ath5k_ahb_exit(void) 214 + { 215 + platform_driver_unregister(&ath_ahb_driver); 216 + } 217 + 218 + module_init(ath5k_ahb_init); 219 + module_exit(ath5k_ahb_exit);
+3 -3
drivers/net/wireless/ath/ath5k/ani.c
··· 58 58 { 59 59 /* TODO: 60 60 * ANI documents suggest the following five levels to use, but the HAL 61 - * and ath9k use only use the last two levels, making this 61 + * and ath9k use only the last two levels, making this 62 62 * essentially an on/off option. There *may* be a reason for this (???), 63 63 * so i stick with the HAL version for now... 64 64 */ 65 65 #if 0 66 - static const s8 hi[] = { -18, -18, -16, -14, -12 }; 67 66 static const s8 lo[] = { -52, -56, -60, -64, -70 }; 67 + static const s8 hi[] = { -18, -18, -16, -14, -12 }; 68 68 static const s8 sz[] = { -34, -41, -48, -55, -62 }; 69 69 static const s8 fr[] = { -70, -72, -75, -78, -80 }; 70 70 #else 71 - static const s8 sz[] = { -55, -62 }; 72 71 static const s8 lo[] = { -64, -70 }; 73 72 static const s8 hi[] = { -14, -12 }; 73 + static const s8 sz[] = { -55, -62 }; 74 74 static const s8 fr[] = { -78, -80 }; 75 75 #endif 76 76 if (level < 0 || level >= ARRAY_SIZE(sz)) {
+173 -87
drivers/net/wireless/ath/ath5k/ath5k.h
··· 158 158 #define AR5K_INI_RFGAIN_5GHZ 0 159 159 #define AR5K_INI_RFGAIN_2GHZ 1 160 160 161 - /* TODO: Clean this up */ 162 - #define AR5K_INI_VAL_11A 0 163 - #define AR5K_INI_VAL_11A_TURBO 1 164 - #define AR5K_INI_VAL_11B 2 165 - #define AR5K_INI_VAL_11G 3 166 - #define AR5K_INI_VAL_11G_TURBO 4 167 - #define AR5K_INI_VAL_XR 0 168 - #define AR5K_INI_VAL_MAX 5 169 - 170 161 /* 171 162 * Some tuneable values (these should be changeable by the user) 172 163 * TODO: Make use of them and add more options OR use debug/configfs ··· 213 222 214 223 /* Initial values */ 215 224 #define AR5K_INIT_CYCRSSI_THR1 2 216 - #define AR5K_INIT_TX_LATENCY 502 217 - #define AR5K_INIT_USEC 39 218 - #define AR5K_INIT_USEC_TURBO 79 219 - #define AR5K_INIT_USEC_32 31 220 - #define AR5K_INIT_SLOT_TIME 396 221 - #define AR5K_INIT_SLOT_TIME_TURBO 480 222 - #define AR5K_INIT_ACK_CTS_TIMEOUT 1024 223 - #define AR5K_INIT_ACK_CTS_TIMEOUT_TURBO 0x08000800 224 - #define AR5K_INIT_PROG_IFS 920 225 - #define AR5K_INIT_PROG_IFS_TURBO 960 226 - #define AR5K_INIT_EIFS 3440 227 - #define AR5K_INIT_EIFS_TURBO 6880 228 - #define AR5K_INIT_SIFS 560 229 - #define AR5K_INIT_SIFS_TURBO 480 225 + 226 + /* Tx retry limits */ 230 227 #define AR5K_INIT_SH_RETRY 10 231 228 #define AR5K_INIT_LG_RETRY AR5K_INIT_SH_RETRY 229 + /* For station mode */ 232 230 #define AR5K_INIT_SSH_RETRY 32 233 231 #define AR5K_INIT_SLG_RETRY AR5K_INIT_SSH_RETRY 234 232 #define AR5K_INIT_TX_RETRY 10 235 233 236 - #define AR5K_INIT_TRANSMIT_LATENCY ( \ 237 - (AR5K_INIT_TX_LATENCY << 14) | (AR5K_INIT_USEC_32 << 7) | \ 238 - (AR5K_INIT_USEC) \ 239 - ) 240 - #define AR5K_INIT_TRANSMIT_LATENCY_TURBO ( \ 241 - (AR5K_INIT_TX_LATENCY << 14) | (AR5K_INIT_USEC_32 << 7) | \ 242 - (AR5K_INIT_USEC_TURBO) \ 243 - ) 244 - #define AR5K_INIT_PROTO_TIME_CNTRL ( \ 245 - (AR5K_INIT_CARR_SENSE_EN << 26) | (AR5K_INIT_EIFS << 12) | \ 246 - (AR5K_INIT_PROG_IFS) \ 247 - ) 248 - #define AR5K_INIT_PROTO_TIME_CNTRL_TURBO ( \ 249 - (AR5K_INIT_CARR_SENSE_EN << 26) | (AR5K_INIT_EIFS_TURBO << 12) | \ 250 - (AR5K_INIT_PROG_IFS_TURBO) \ 251 - ) 234 + 235 + /* Slot time */ 236 + #define AR5K_INIT_SLOT_TIME_TURBO 6 237 + #define AR5K_INIT_SLOT_TIME_DEFAULT 9 238 + #define AR5K_INIT_SLOT_TIME_HALF_RATE 13 239 + #define AR5K_INIT_SLOT_TIME_QUARTER_RATE 21 240 + #define AR5K_INIT_SLOT_TIME_B 20 241 + #define AR5K_SLOT_TIME_MAX 0xffff 242 + 243 + /* SIFS */ 244 + #define AR5K_INIT_SIFS_TURBO 6 245 + /* XXX: 8 from initvals 10 from standard */ 246 + #define AR5K_INIT_SIFS_DEFAULT_BG 8 247 + #define AR5K_INIT_SIFS_DEFAULT_A 16 248 + #define AR5K_INIT_SIFS_HALF_RATE 32 249 + #define AR5K_INIT_SIFS_QUARTER_RATE 64 250 + 251 + /* Used to calculate tx time for non 5/10/40MHz 252 + * operation */ 253 + /* It's preamble time + signal time (16 + 4) */ 254 + #define AR5K_INIT_OFDM_PREAMPLE_TIME 20 255 + /* Preamble time for 40MHz (turbo) operation (min ?) */ 256 + #define AR5K_INIT_OFDM_PREAMBLE_TIME_MIN 14 257 + #define AR5K_INIT_OFDM_SYMBOL_TIME 4 258 + #define AR5K_INIT_OFDM_PLCP_BITS 22 259 + 260 + /* Rx latency for 5 and 10MHz operation (max ?) */ 261 + #define AR5K_INIT_RX_LAT_MAX 63 262 + /* Tx latencies from initvals (5212 only but no problem 263 + * because we only tweak them on 5212) */ 264 + #define AR5K_INIT_TX_LAT_A 54 265 + #define AR5K_INIT_TX_LAT_BG 384 266 + /* Tx latency for 40MHz (turbo) operation (min ?) */ 267 + #define AR5K_INIT_TX_LAT_MIN 32 268 + /* Default Tx/Rx latencies (same for 5211)*/ 269 + #define AR5K_INIT_TX_LATENCY_5210 54 270 + #define AR5K_INIT_RX_LATENCY_5210 29 271 + 272 + /* Tx frame to Tx data start delay */ 273 + #define AR5K_INIT_TXF2TXD_START_DEFAULT 14 274 + #define AR5K_INIT_TXF2TXD_START_DELAY_10MHZ 12 275 + #define AR5K_INIT_TXF2TXD_START_DELAY_5MHZ 13 276 + 277 + /* We need to increase PHY switch and agc settling time 278 + * on turbo mode */ 279 + #define AR5K_SWITCH_SETTLING 5760 280 + #define AR5K_SWITCH_SETTLING_TURBO 7168 281 + 282 + #define AR5K_AGC_SETTLING 28 283 + /* 38 on 5210 but shouldn't matter */ 284 + #define AR5K_AGC_SETTLING_TURBO 37 252 285 253 286 254 287 /* GENERIC CHIPSET DEFINITIONS */ ··· 319 304 #define AR5K_SREV_AR5311B 0x30 /* Spirit */ 320 305 #define AR5K_SREV_AR5211 0x40 /* Oahu */ 321 306 #define AR5K_SREV_AR5212 0x50 /* Venice */ 307 + #define AR5K_SREV_AR5312_R2 0x52 /* AP31 */ 322 308 #define AR5K_SREV_AR5212_V4 0x54 /* ??? */ 323 309 #define AR5K_SREV_AR5213 0x55 /* ??? */ 310 + #define AR5K_SREV_AR5312_R7 0x57 /* AP30 */ 311 + #define AR5K_SREV_AR2313_R8 0x58 /* AP43 */ 324 312 #define AR5K_SREV_AR5213A 0x59 /* Hainan */ 325 313 #define AR5K_SREV_AR2413 0x78 /* Griffin lite */ 326 314 #define AR5K_SREV_AR2414 0x70 /* Griffin */ 315 + #define AR5K_SREV_AR2315_R6 0x86 /* AP51-Light */ 316 + #define AR5K_SREV_AR2315_R7 0x87 /* AP51-Full */ 327 317 #define AR5K_SREV_AR5424 0x90 /* Condor */ 318 + #define AR5K_SREV_AR2317_R1 0x90 /* AP61-Light */ 319 + #define AR5K_SREV_AR2317_R2 0x91 /* AP61-Full */ 328 320 #define AR5K_SREV_AR5413 0xa4 /* Eagle lite */ 329 321 #define AR5K_SREV_AR5414 0xa0 /* Eagle */ 330 322 #define AR5K_SREV_AR2415 0xb0 /* Talon */ ··· 427 405 428 406 enum ath5k_driver_mode { 429 407 AR5K_MODE_11A = 0, 430 - AR5K_MODE_11A_TURBO = 1, 431 - AR5K_MODE_11B = 2, 432 - AR5K_MODE_11G = 3, 433 - AR5K_MODE_11G_TURBO = 4, 408 + AR5K_MODE_11B = 1, 409 + AR5K_MODE_11G = 2, 434 410 AR5K_MODE_XR = 0, 435 - AR5K_MODE_MAX = 5 411 + AR5K_MODE_MAX = 3 436 412 }; 437 413 438 414 enum ath5k_ant_mode { ··· 444 424 AR5K_ANTMODE_MAX, 445 425 }; 446 426 427 + enum ath5k_bw_mode { 428 + AR5K_BWMODE_DEFAULT = 0, /* 20MHz, default operation */ 429 + AR5K_BWMODE_5MHZ = 1, /* Quarter rate */ 430 + AR5K_BWMODE_10MHZ = 2, /* Half rate */ 431 + AR5K_BWMODE_40MHZ = 3 /* Turbo */ 432 + }; 447 433 448 434 /****************\ 449 435 TX DEFINITIONS ··· 682 656 683 657 /* channel_flags */ 684 658 #define CHANNEL_CW_INT 0x0008 /* Contention Window interference detected */ 685 - #define CHANNEL_TURBO 0x0010 /* Turbo Channel */ 686 659 #define CHANNEL_CCK 0x0020 /* CCK channel */ 687 660 #define CHANNEL_OFDM 0x0040 /* OFDM channel */ 688 661 #define CHANNEL_2GHZ 0x0080 /* 2GHz channel. */ ··· 693 668 #define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM) 694 669 #define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK) 695 670 #define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM) 696 - #define CHANNEL_T (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO) 697 - #define CHANNEL_TG (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO) 698 - #define CHANNEL_108A CHANNEL_T 699 - #define CHANNEL_108G CHANNEL_TG 700 671 #define CHANNEL_X (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR) 701 672 702 - #define CHANNEL_ALL (CHANNEL_OFDM|CHANNEL_CCK|CHANNEL_2GHZ|CHANNEL_5GHZ| \ 703 - CHANNEL_TURBO) 673 + #define CHANNEL_ALL (CHANNEL_OFDM|CHANNEL_CCK|CHANNEL_2GHZ|CHANNEL_5GHZ) 704 674 705 - #define CHANNEL_ALL_NOTURBO (CHANNEL_ALL & ~CHANNEL_TURBO) 706 675 #define CHANNEL_MODES CHANNEL_ALL 707 676 708 677 /* ··· 1045 1026 enum ath5k_int ah_imr; 1046 1027 1047 1028 struct ieee80211_channel *ah_current_channel; 1048 - bool ah_turbo; 1049 1029 bool ah_calibration; 1050 1030 bool ah_single_chip; 1051 1031 ··· 1053 1035 u32 ah_phy; 1054 1036 u32 ah_mac_srev; 1055 1037 u16 ah_mac_version; 1038 + u16 ah_mac_revision; 1056 1039 u16 ah_phy_revision; 1057 1040 u16 ah_radio_5ghz_revision; 1058 1041 u16 ah_radio_2ghz_revision; ··· 1063 1044 1064 1045 u32 ah_limit_tx_retries; 1065 1046 u8 ah_coverage_class; 1047 + bool ah_ack_bitrate_high; 1048 + u8 ah_bwmode; 1066 1049 1067 1050 /* Antenna Control */ 1068 1051 u32 ah_ant_ctl[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX]; ··· 1153 1132 /* 1154 1133 * Prototypes 1155 1134 */ 1135 + extern const struct ieee80211_ops ath5k_hw_ops; 1156 1136 1157 - /* Attach/Detach Functions */ 1158 - int ath5k_hw_attach(struct ath5k_softc *sc); 1159 - void ath5k_hw_detach(struct ath5k_hw *ah); 1137 + /* Initialization and detach functions */ 1138 + int ath5k_init_softc(struct ath5k_softc *sc, const struct ath_bus_ops *bus_ops); 1139 + void ath5k_deinit_softc(struct ath5k_softc *sc); 1140 + int ath5k_hw_init(struct ath5k_softc *sc); 1141 + void ath5k_hw_deinit(struct ath5k_hw *ah); 1160 1142 1161 1143 int ath5k_sysfs_register(struct ath5k_softc *sc); 1162 1144 void ath5k_sysfs_unregister(struct ath5k_softc *sc); 1145 + 1146 + /*Chip id helper functions */ 1147 + const char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val); 1148 + int ath5k_hw_read_srev(struct ath5k_hw *ah); 1163 1149 1164 1150 /* LED functions */ 1165 1151 int ath5k_init_leds(struct ath5k_softc *sc); ··· 1174 1146 void ath5k_led_off(struct ath5k_softc *sc); 1175 1147 void ath5k_unregister_leds(struct ath5k_softc *sc); 1176 1148 1149 + 1177 1150 /* Reset Functions */ 1178 1151 int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial); 1179 1152 int ath5k_hw_on_hold(struct ath5k_hw *ah); 1180 1153 int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, 1181 - struct ieee80211_channel *channel, bool change_channel); 1154 + struct ieee80211_channel *channel, bool fast, bool skip_pcu); 1182 1155 int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val, 1183 1156 bool is_set); 1184 1157 /* Power management functions */ 1185 1158 1159 + 1160 + /* Clock rate related functions */ 1161 + unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec); 1162 + unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock); 1163 + void ath5k_hw_set_clockrate(struct ath5k_hw *ah); 1164 + 1165 + 1186 1166 /* DMA Related Functions */ 1187 1167 void ath5k_hw_start_rx_dma(struct ath5k_hw *ah); 1188 - int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah); 1189 1168 u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah); 1190 - void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr); 1169 + int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr); 1191 1170 int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue); 1192 - int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue); 1171 + int ath5k_hw_stop_beacon_queue(struct ath5k_hw *ah, unsigned int queue); 1193 1172 u32 ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue); 1194 1173 int ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue, 1195 1174 u32 phys_addr); ··· 1206 1171 int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask); 1207 1172 enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask); 1208 1173 void ath5k_hw_update_mib_counters(struct ath5k_hw *ah); 1174 + /* Init/Stop functions */ 1175 + void ath5k_hw_dma_init(struct ath5k_hw *ah); 1176 + int ath5k_hw_dma_stop(struct ath5k_hw *ah); 1209 1177 1210 1178 /* EEPROM access functions */ 1211 1179 int ath5k_eeprom_init(struct ath5k_hw *ah); 1212 1180 void ath5k_eeprom_detach(struct ath5k_hw *ah); 1213 1181 int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac); 1214 1182 1183 + 1215 1184 /* Protocol Control Unit Functions */ 1185 + /* Helpers */ 1186 + int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, 1187 + int len, struct ieee80211_rate *rate); 1188 + unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah); 1189 + unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah); 1216 1190 extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode); 1217 1191 void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class); 1218 - /* BSSID Functions */ 1192 + /* RX filter control*/ 1219 1193 int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac); 1220 1194 void ath5k_hw_set_bssid(struct ath5k_hw *ah); 1221 1195 void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask); 1222 - /* Receive start/stop functions */ 1223 - void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah); 1224 - void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah); 1225 - /* RX Filter functions */ 1226 1196 void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1); 1227 1197 u32 ath5k_hw_get_rx_filter(struct ath5k_hw *ah); 1228 1198 void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter); 1199 + /* Receive (DRU) start/stop functions */ 1200 + void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah); 1201 + void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah); 1229 1202 /* Beacon control functions */ 1230 1203 u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah); 1231 1204 void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64); 1232 1205 void ath5k_hw_reset_tsf(struct ath5k_hw *ah); 1233 1206 void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval); 1234 1207 bool ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval); 1235 - /* ACK bit rate */ 1236 - void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high); 1237 - /* Clock rate related functions */ 1238 - unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec); 1239 - unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock); 1240 - void ath5k_hw_set_clockrate(struct ath5k_hw *ah); 1208 + /* Init function */ 1209 + void ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode, 1210 + u8 mode); 1241 1211 1242 1212 /* Queue Control Unit, DFS Control Unit Functions */ 1243 1213 int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue, ··· 1255 1215 u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue); 1256 1216 void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue); 1257 1217 int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue); 1258 - int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time); 1218 + int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time); 1219 + /* Init function */ 1220 + int ath5k_hw_init_queues(struct ath5k_hw *ah); 1259 1221 1260 1222 /* Hardware Descriptor Functions */ 1261 1223 int ath5k_hw_init_desc_functions(struct ath5k_hw *ah); ··· 1266 1224 int ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, 1267 1225 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2, 1268 1226 u_int tx_tries2, unsigned int tx_rate3, u_int tx_tries3); 1227 + 1269 1228 1270 1229 /* GPIO Functions */ 1271 1230 void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state); ··· 1277 1234 void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, 1278 1235 u32 interrupt_level); 1279 1236 1280 - /* rfkill Functions */ 1237 + 1238 + /* RFkill Functions */ 1281 1239 void ath5k_rfkill_hw_start(struct ath5k_hw *ah); 1282 1240 void ath5k_rfkill_hw_stop(struct ath5k_hw *ah); 1283 1241 1284 - /* Misc functions */ 1242 + 1243 + /* Misc functions TODO: Cleanup */ 1285 1244 int ath5k_hw_set_capabilities(struct ath5k_hw *ah); 1286 1245 int ath5k_hw_get_capability(struct ath5k_hw *ah, 1287 1246 enum ath5k_capability_type cap_type, u32 capability, ··· 1291 1246 int ath5k_hw_enable_pspoll(struct ath5k_hw *ah, u8 *bssid, u16 assoc_id); 1292 1247 int ath5k_hw_disable_pspoll(struct ath5k_hw *ah); 1293 1248 1249 + 1294 1250 /* Initial register settings functions */ 1295 1251 int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel); 1296 1252 1297 - /* Initialize RF */ 1298 - int ath5k_hw_rfregs_init(struct ath5k_hw *ah, 1299 - struct ieee80211_channel *channel, 1300 - unsigned int mode); 1301 - int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq); 1253 + 1254 + /* PHY functions */ 1255 + /* Misc PHY functions */ 1256 + u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan); 1257 + int ath5k_hw_phy_disable(struct ath5k_hw *ah); 1258 + /* Gain_F optimization */ 1302 1259 enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah); 1303 1260 int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah); 1304 1261 /* PHY/RF channel functions */ 1305 1262 bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags); 1306 - int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel); 1307 1263 /* PHY calibration */ 1308 1264 void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah); 1309 1265 int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, ··· 1313 1267 /* Spur mitigation */ 1314 1268 bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, 1315 1269 struct ieee80211_channel *channel); 1316 - void ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah, 1317 - struct ieee80211_channel *channel); 1318 - /* Misc PHY functions */ 1319 - u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan); 1320 - int ath5k_hw_phy_disable(struct ath5k_hw *ah); 1321 1270 /* Antenna control */ 1322 1271 void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode); 1323 1272 void ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode); 1324 1273 /* TX power setup */ 1325 - int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, 1326 - u8 ee_mode, u8 txpower); 1327 1274 int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower); 1275 + /* Init function */ 1276 + int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, 1277 + u8 mode, u8 ee_mode, u8 freq, bool fast); 1328 1278 1329 1279 /* 1330 1280 * Functions used internaly ··· 1336 1294 return &(ath5k_hw_common(ah)->regulatory); 1337 1295 } 1338 1296 1297 + #ifdef CONFIG_ATHEROS_AR231X 1298 + #define AR5K_AR2315_PCI_BASE ((void __iomem *)0xb0100000) 1299 + 1300 + static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg) 1301 + { 1302 + /* On AR2315 and AR2317 the PCI clock domain registers 1303 + * are outside of the WMAC register space */ 1304 + if (unlikely((reg >= 0x4000) && (reg < 0x5000) && 1305 + (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6))) 1306 + return AR5K_AR2315_PCI_BASE + reg; 1307 + 1308 + return ah->ah_iobase + reg; 1309 + } 1310 + 1311 + static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg) 1312 + { 1313 + return __raw_readl(ath5k_ahb_reg(ah, reg)); 1314 + } 1315 + 1316 + static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg) 1317 + { 1318 + __raw_writel(val, ath5k_ahb_reg(ah, reg)); 1319 + } 1320 + 1321 + #else 1322 + 1339 1323 static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg) 1340 1324 { 1341 1325 return ioread32(ah->ah_iobase + reg); ··· 1370 1302 static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg) 1371 1303 { 1372 1304 iowrite32(val, ah->ah_iobase + reg); 1305 + } 1306 + 1307 + #endif 1308 + 1309 + static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah) 1310 + { 1311 + return ath5k_hw_common(ah)->bus_ops->ath_bus_type; 1312 + } 1313 + 1314 + static inline void ath5k_read_cachesize(struct ath_common *common, int *csz) 1315 + { 1316 + common->bus_ops->read_cachesize(common, csz); 1317 + } 1318 + 1319 + static inline bool ath5k_hw_nvram_read(struct ath5k_hw *ah, u32 off, u16 *data) 1320 + { 1321 + struct ath_common *common = ath5k_hw_common(ah); 1322 + return common->bus_ops->eeprom_read(common, off, data); 1373 1323 } 1374 1324 1375 1325 static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
+15 -13
drivers/net/wireless/ath/ath5k/attach.c
··· 93 93 } 94 94 95 95 /** 96 - * ath5k_hw_attach - Check if hw is supported and init the needed structs 96 + * ath5k_hw_init - Check if hw is supported and init the needed structs 97 97 * 98 - * @sc: The &struct ath5k_softc we got from the driver's attach function 98 + * @sc: The &struct ath5k_softc we got from the driver's init_softc function 99 99 * 100 100 * Check if the device is supported, perform a POST and initialize the needed 101 101 * structs. Returns -ENOMEM if we don't have memory for the needed structs, 102 102 * -ENODEV if the device is not supported or prints an error msg if something 103 103 * else went wrong. 104 104 */ 105 - int ath5k_hw_attach(struct ath5k_softc *sc) 105 + int ath5k_hw_init(struct ath5k_softc *sc) 106 106 { 107 107 struct ath5k_hw *ah = sc->ah; 108 108 struct ath_common *common = ath5k_hw_common(ah); ··· 115 115 * HW information 116 116 */ 117 117 ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT; 118 - ah->ah_turbo = false; 118 + ah->ah_bwmode = AR5K_BWMODE_DEFAULT; 119 119 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; 120 120 ah->ah_imr = 0; 121 121 ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY; ··· 128 128 /* 129 129 * Find the mac version 130 130 */ 131 - srev = ath5k_hw_reg_read(ah, AR5K_SREV); 131 + ath5k_hw_read_srev(ah); 132 + srev = ah->ah_mac_srev; 132 133 if (srev < AR5K_SREV_AR5311) 133 134 ah->ah_version = AR5K_AR5210; 134 135 else if (srev < AR5K_SREV_AR5212) 135 136 ah->ah_version = AR5K_AR5211; 136 137 else 137 138 ah->ah_version = AR5K_AR5212; 139 + 140 + /* Get the MAC revision */ 141 + ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER); 142 + ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV); 138 143 139 144 /* Fill the ath5k_hw struct with the needed functions */ 140 145 ret = ath5k_hw_init_desc_functions(ah); ··· 151 146 if (ret) 152 147 goto err; 153 148 154 - /* Get MAC, PHY and RADIO revisions */ 155 - ah->ah_mac_srev = srev; 156 - ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER); 149 + /* Get PHY and RADIO revisions */ 157 150 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) & 158 151 0xffffffff; 159 152 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah, ··· 276 273 /* 277 274 * Write PCI-E power save settings 278 275 */ 279 - if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { 276 + if ((ah->ah_version == AR5K_AR5212) && pdev && (pdev->is_pcie)) { 280 277 ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES); 281 278 ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES); 282 279 ··· 308 305 /* Get misc capabilities */ 309 306 ret = ath5k_hw_set_capabilities(ah); 310 307 if (ret) { 311 - ATH5K_ERR(sc, "unable to get device capabilities: 0x%04x\n", 312 - sc->pdev->device); 308 + ATH5K_ERR(sc, "unable to get device capabilities\n"); 313 309 goto err; 314 310 } 315 311 ··· 348 346 } 349 347 350 348 /** 351 - * ath5k_hw_detach - Free the ath5k_hw struct 349 + * ath5k_hw_deinit - Free the ath5k_hw struct 352 350 * 353 351 * @ah: The &struct ath5k_hw 354 352 */ 355 - void ath5k_hw_detach(struct ath5k_hw *ah) 353 + void ath5k_hw_deinit(struct ath5k_hw *ah) 356 354 { 357 355 __set_bit(ATH_STAT_INVALID, ah->ah_sc->status); 358 356
+276 -481
drivers/net/wireless/ath/ath5k/base.c
··· 47 47 #include <linux/io.h> 48 48 #include <linux/netdevice.h> 49 49 #include <linux/cache.h> 50 - #include <linux/pci.h> 51 - #include <linux/pci-aspm.h> 52 50 #include <linux/ethtool.h> 53 51 #include <linux/uaccess.h> 54 52 #include <linux/slab.h> ··· 78 80 MODULE_LICENSE("Dual BSD/GPL"); 79 81 MODULE_VERSION("0.6.0 (EXPERIMENTAL)"); 80 82 81 - static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan); 83 + static int ath5k_init(struct ieee80211_hw *hw); 84 + static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, 85 + bool skip_pcu); 82 86 static int ath5k_beacon_update(struct ieee80211_hw *hw, 83 87 struct ieee80211_vif *vif); 84 88 static void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf); 85 89 86 - /* Known PCI ids */ 87 - static DEFINE_PCI_DEVICE_TABLE(ath5k_pci_id_table) = { 88 - { PCI_VDEVICE(ATHEROS, 0x0207) }, /* 5210 early */ 89 - { PCI_VDEVICE(ATHEROS, 0x0007) }, /* 5210 */ 90 - { PCI_VDEVICE(ATHEROS, 0x0011) }, /* 5311 - this is on AHB bus !*/ 91 - { PCI_VDEVICE(ATHEROS, 0x0012) }, /* 5211 */ 92 - { PCI_VDEVICE(ATHEROS, 0x0013) }, /* 5212 */ 93 - { PCI_VDEVICE(3COM_2, 0x0013) }, /* 3com 5212 */ 94 - { PCI_VDEVICE(3COM, 0x0013) }, /* 3com 3CRDAG675 5212 */ 95 - { PCI_VDEVICE(ATHEROS, 0x1014) }, /* IBM minipci 5212 */ 96 - { PCI_VDEVICE(ATHEROS, 0x0014) }, /* 5212 combatible */ 97 - { PCI_VDEVICE(ATHEROS, 0x0015) }, /* 5212 combatible */ 98 - { PCI_VDEVICE(ATHEROS, 0x0016) }, /* 5212 combatible */ 99 - { PCI_VDEVICE(ATHEROS, 0x0017) }, /* 5212 combatible */ 100 - { PCI_VDEVICE(ATHEROS, 0x0018) }, /* 5212 combatible */ 101 - { PCI_VDEVICE(ATHEROS, 0x0019) }, /* 5212 combatible */ 102 - { PCI_VDEVICE(ATHEROS, 0x001a) }, /* 2413 Griffin-lite */ 103 - { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */ 104 - { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ 105 - { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ 106 - { 0 } 107 - }; 108 - MODULE_DEVICE_TABLE(pci, ath5k_pci_id_table); 109 - 110 90 /* Known SREVs */ 111 91 static const struct ath5k_srev_name srev_names[] = { 92 + #ifdef CONFIG_ATHEROS_AR231X 93 + { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R2 }, 94 + { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R7 }, 95 + { "2313", AR5K_VERSION_MAC, AR5K_SREV_AR2313_R8 }, 96 + { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R6 }, 97 + { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R7 }, 98 + { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R1 }, 99 + { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R2 }, 100 + #else 112 101 { "5210", AR5K_VERSION_MAC, AR5K_SREV_AR5210 }, 113 102 { "5311", AR5K_VERSION_MAC, AR5K_SREV_AR5311 }, 114 103 { "5311A", AR5K_VERSION_MAC, AR5K_SREV_AR5311A }, ··· 114 129 { "5418", AR5K_VERSION_MAC, AR5K_SREV_AR5418 }, 115 130 { "2425", AR5K_VERSION_MAC, AR5K_SREV_AR2425 }, 116 131 { "2417", AR5K_VERSION_MAC, AR5K_SREV_AR2417 }, 132 + #endif 117 133 { "xxxxx", AR5K_VERSION_MAC, AR5K_SREV_UNKNOWN }, 118 134 { "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 }, 119 135 { "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 }, ··· 128 142 { "2112B", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112B }, 129 143 { "2413", AR5K_VERSION_RAD, AR5K_SREV_RAD_2413 }, 130 144 { "5413", AR5K_VERSION_RAD, AR5K_SREV_RAD_5413 }, 131 - { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 }, 132 - { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 }, 133 145 { "5424", AR5K_VERSION_RAD, AR5K_SREV_RAD_5424 }, 134 146 { "5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133 }, 147 + #ifdef CONFIG_ATHEROS_AR231X 148 + { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 }, 149 + { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 }, 150 + #endif 135 151 { "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN }, 136 152 }; 137 153 ··· 185 197 BUG_ON(!bf); 186 198 if (!bf->skb) 187 199 return; 188 - pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len, 189 - PCI_DMA_TODEVICE); 200 + dma_unmap_single(sc->dev, bf->skbaddr, bf->skb->len, 201 + DMA_TO_DEVICE); 190 202 dev_kfree_skb_any(bf->skb); 191 203 bf->skb = NULL; 192 204 bf->skbaddr = 0; ··· 202 214 BUG_ON(!bf); 203 215 if (!bf->skb) 204 216 return; 205 - pci_unmap_single(sc->pdev, bf->skbaddr, common->rx_bufsize, 206 - PCI_DMA_FROMDEVICE); 217 + dma_unmap_single(sc->dev, bf->skbaddr, common->rx_bufsize, 218 + DMA_FROM_DEVICE); 207 219 dev_kfree_skb_any(bf->skb); 208 220 bf->skb = NULL; 209 221 bf->skbaddr = 0; ··· 221 233 return (tsf & ~0x7fff) | rstamp; 222 234 } 223 235 224 - static const char * 236 + const char * 225 237 ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) 226 238 { 227 239 const char *name = "xxxxx"; ··· 315 327 316 328 switch (mode) { 317 329 case AR5K_MODE_11A: 318 - case AR5K_MODE_11A_TURBO: 319 330 /* 1..220, but 2GHz frequencies are filtered by check_channel */ 320 331 size = 220 ; 321 332 chfreq = CHANNEL_5GHZ; 322 333 break; 323 334 case AR5K_MODE_11B: 324 335 case AR5K_MODE_11G: 325 - case AR5K_MODE_11G_TURBO: 326 336 size = 26; 327 337 chfreq = CHANNEL_2GHZ; 328 338 break; ··· 348 362 case AR5K_MODE_11A: 349 363 case AR5K_MODE_11G: 350 364 channels[count].hw_value = chfreq | CHANNEL_OFDM; 351 - break; 352 - case AR5K_MODE_11A_TURBO: 353 - case AR5K_MODE_11G_TURBO: 354 - channels[count].hw_value = chfreq | 355 - CHANNEL_OFDM | CHANNEL_TURBO; 356 365 break; 357 366 case AR5K_MODE_11B: 358 367 channels[count].hw_value = CHANNEL_B; ··· 477 496 * hardware at the new frequency, and then re-enable 478 497 * the relevant bits of the h/w. 479 498 */ 480 - return ath5k_reset(sc, chan); 499 + return ath5k_reset(sc, chan, true); 481 500 } 482 501 483 502 static void ··· 634 653 return NULL; 635 654 } 636 655 637 - *skb_addr = pci_map_single(sc->pdev, 656 + *skb_addr = dma_map_single(sc->dev, 638 657 skb->data, common->rx_bufsize, 639 - PCI_DMA_FROMDEVICE); 640 - if (unlikely(pci_dma_mapping_error(sc->pdev, *skb_addr))) { 658 + DMA_FROM_DEVICE); 659 + 660 + if (unlikely(dma_mapping_error(sc->dev, *skb_addr))) { 641 661 ATH5K_ERR(sc, "%s: DMA mapping failed\n", __func__); 642 662 dev_kfree_skb(skb); 643 663 return NULL; ··· 734 752 flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK; 735 753 736 754 /* XXX endianness */ 737 - bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len, 738 - PCI_DMA_TODEVICE); 755 + bf->skbaddr = dma_map_single(sc->dev, skb->data, skb->len, 756 + DMA_TO_DEVICE); 739 757 740 758 rate = ieee80211_get_tx_rate(sc->hw, info); 741 759 if (!rate) { ··· 815 833 816 834 return 0; 817 835 err_unmap: 818 - pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, PCI_DMA_TODEVICE); 836 + dma_unmap_single(sc->dev, bf->skbaddr, skb->len, DMA_TO_DEVICE); 819 837 return ret; 820 838 } 821 839 ··· 824 842 \*******************/ 825 843 826 844 static int 827 - ath5k_desc_alloc(struct ath5k_softc *sc, struct pci_dev *pdev) 845 + ath5k_desc_alloc(struct ath5k_softc *sc) 828 846 { 829 847 struct ath5k_desc *ds; 830 848 struct ath5k_buf *bf; ··· 835 853 /* allocate descriptors */ 836 854 sc->desc_len = sizeof(struct ath5k_desc) * 837 855 (ATH_TXBUF + ATH_RXBUF + ATH_BCBUF + 1); 838 - sc->desc = pci_alloc_consistent(pdev, sc->desc_len, &sc->desc_daddr); 856 + 857 + sc->desc = dma_alloc_coherent(sc->dev, sc->desc_len, 858 + &sc->desc_daddr, GFP_KERNEL); 839 859 if (sc->desc == NULL) { 840 860 ATH5K_ERR(sc, "can't allocate descriptors\n"); 841 861 ret = -ENOMEM; ··· 883 899 884 900 return 0; 885 901 err_free: 886 - pci_free_consistent(pdev, sc->desc_len, sc->desc, sc->desc_daddr); 902 + dma_free_coherent(sc->dev, sc->desc_len, sc->desc, sc->desc_daddr); 887 903 err: 888 904 sc->desc = NULL; 889 905 return ret; 890 906 } 891 907 892 908 static void 893 - ath5k_desc_free(struct ath5k_softc *sc, struct pci_dev *pdev) 909 + ath5k_desc_free(struct ath5k_softc *sc) 894 910 { 895 911 struct ath5k_buf *bf; 896 912 ··· 902 918 ath5k_txbuf_free_skb(sc, bf); 903 919 904 920 /* Free memory associated with all descriptors */ 905 - pci_free_consistent(pdev, sc->desc_len, sc->desc, sc->desc_daddr); 921 + dma_free_coherent(sc->dev, sc->desc_len, sc->desc, sc->desc_daddr); 906 922 sc->desc = NULL; 907 923 sc->desc_daddr = 0; 908 924 ··· 1047 1063 return ret; 1048 1064 } 1049 1065 1050 - static void 1051 - ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq) 1052 - { 1053 - struct ath5k_buf *bf, *bf0; 1054 - 1055 - /* 1056 - * NB: this assumes output has been stopped and 1057 - * we do not need to block ath5k_tx_tasklet 1058 - */ 1059 - spin_lock_bh(&txq->lock); 1060 - list_for_each_entry_safe(bf, bf0, &txq->q, list) { 1061 - ath5k_debug_printtxbuf(sc, bf); 1062 - 1063 - ath5k_txbuf_free_skb(sc, bf); 1064 - 1065 - spin_lock_bh(&sc->txbuflock); 1066 - list_move_tail(&bf->list, &sc->txbuf); 1067 - sc->txbuf_len++; 1068 - txq->txq_len--; 1069 - spin_unlock_bh(&sc->txbuflock); 1070 - } 1071 - txq->link = NULL; 1072 - txq->txq_poll_mark = false; 1073 - spin_unlock_bh(&txq->lock); 1074 - } 1075 - 1076 - /* 1077 - * Drain the transmit queues and reclaim resources. 1066 + /** 1067 + * ath5k_drain_tx_buffs - Empty tx buffers 1068 + * 1069 + * @sc The &struct ath5k_softc 1070 + * 1071 + * Empty tx buffers from all queues in preparation 1072 + * of a reset or during shutdown. 1073 + * 1074 + * NB: this assumes output has been stopped and 1075 + * we do not need to block ath5k_tx_tasklet 1078 1076 */ 1079 1077 static void 1080 - ath5k_txq_cleanup(struct ath5k_softc *sc) 1078 + ath5k_drain_tx_buffs(struct ath5k_softc *sc) 1081 1079 { 1082 - struct ath5k_hw *ah = sc->ah; 1083 - unsigned int i; 1080 + struct ath5k_txq *txq; 1081 + struct ath5k_buf *bf, *bf0; 1082 + int i; 1084 1083 1085 - /* XXX return value */ 1086 - if (likely(!test_bit(ATH_STAT_INVALID, sc->status))) { 1087 - /* don't touch the hardware if marked invalid */ 1088 - ath5k_hw_stop_tx_dma(ah, sc->bhalq); 1089 - ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "beacon queue %x\n", 1090 - ath5k_hw_get_txdp(ah, sc->bhalq)); 1091 - for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) 1092 - if (sc->txqs[i].setup) { 1093 - ath5k_hw_stop_tx_dma(ah, sc->txqs[i].qnum); 1094 - ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "txq [%u] %x, " 1095 - "link %p\n", 1096 - sc->txqs[i].qnum, 1097 - ath5k_hw_get_txdp(ah, 1098 - sc->txqs[i].qnum), 1099 - sc->txqs[i].link); 1084 + for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) { 1085 + if (sc->txqs[i].setup) { 1086 + txq = &sc->txqs[i]; 1087 + spin_lock_bh(&txq->lock); 1088 + list_for_each_entry_safe(bf, bf0, &txq->q, list) { 1089 + ath5k_debug_printtxbuf(sc, bf); 1090 + 1091 + ath5k_txbuf_free_skb(sc, bf); 1092 + 1093 + spin_lock_bh(&sc->txbuflock); 1094 + list_move_tail(&bf->list, &sc->txbuf); 1095 + sc->txbuf_len++; 1096 + txq->txq_len--; 1097 + spin_unlock_bh(&sc->txbuflock); 1100 1098 } 1099 + txq->link = NULL; 1100 + txq->txq_poll_mark = false; 1101 + spin_unlock_bh(&txq->lock); 1102 + } 1101 1103 } 1102 - 1103 - for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) 1104 - if (sc->txqs[i].setup) 1105 - ath5k_txq_drainq(sc, &sc->txqs[i]); 1106 1104 } 1107 1105 1108 1106 static void ··· 1144 1178 } 1145 1179 1146 1180 /* 1147 - * Disable the receive h/w in preparation for a reset. 1181 + * Disable the receive logic on PCU (DRU) 1182 + * In preparation for a shutdown. 1183 + * 1184 + * Note: Doesn't stop rx DMA, ath5k_hw_dma_stop 1185 + * does. 1148 1186 */ 1149 1187 static void 1150 1188 ath5k_rx_stop(struct ath5k_softc *sc) 1151 1189 { 1152 1190 struct ath5k_hw *ah = sc->ah; 1153 1191 1154 - ath5k_hw_stop_rx_pcu(ah); /* disable PCU */ 1155 1192 ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */ 1156 - ath5k_hw_stop_rx_dma(ah); /* disable DMA engine */ 1193 + ath5k_hw_stop_rx_pcu(ah); /* disable PCU */ 1157 1194 1158 1195 ath5k_debug_printrxbuffs(sc, ah); 1159 1196 } ··· 1513 1544 if (!next_skb) 1514 1545 goto next; 1515 1546 1516 - pci_unmap_single(sc->pdev, bf->skbaddr, 1547 + dma_unmap_single(sc->dev, bf->skbaddr, 1517 1548 common->rx_bufsize, 1518 - PCI_DMA_FROMDEVICE); 1549 + DMA_FROM_DEVICE); 1519 1550 1520 1551 skb_put(skb, rs.rs_datalen); 1521 1552 ··· 1678 1709 1679 1710 skb = bf->skb; 1680 1711 bf->skb = NULL; 1681 - pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, 1682 - PCI_DMA_TODEVICE); 1712 + 1713 + dma_unmap_single(sc->dev, bf->skbaddr, skb->len, 1714 + DMA_TO_DEVICE); 1683 1715 ath5k_tx_frame_completed(sc, skb, &ts); 1684 1716 } 1685 1717 ··· 1734 1764 u32 flags; 1735 1765 const int padsize = 0; 1736 1766 1737 - bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len, 1738 - PCI_DMA_TODEVICE); 1767 + bf->skbaddr = dma_map_single(sc->dev, skb->data, skb->len, 1768 + DMA_TO_DEVICE); 1739 1769 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "skb %p [data %p len %u] " 1740 1770 "skbaddr %llx\n", skb, skb->data, skb->len, 1741 1771 (unsigned long long)bf->skbaddr); 1742 - if (pci_dma_mapping_error(sc->pdev, bf->skbaddr)) { 1772 + 1773 + if (dma_mapping_error(sc->dev, bf->skbaddr)) { 1743 1774 ATH5K_ERR(sc, "beacon DMA mapping failed\n"); 1744 1775 return -EIO; 1745 1776 } ··· 1792 1821 1793 1822 return 0; 1794 1823 err_unmap: 1795 - pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, PCI_DMA_TODEVICE); 1824 + dma_unmap_single(sc->dev, bf->skbaddr, skb->len, DMA_TO_DEVICE); 1796 1825 return ret; 1797 1826 } 1798 1827 ··· 1908 1937 * This should never fail since we check above that no frames 1909 1938 * are still pending on the queue. 1910 1939 */ 1911 - if (unlikely(ath5k_hw_stop_tx_dma(ah, sc->bhalq))) { 1940 + if (unlikely(ath5k_hw_stop_beacon_queue(ah, sc->bhalq))) { 1912 1941 ATH5K_WARN(sc, "beacon queue %u didn't start/stop ?\n", sc->bhalq); 1913 1942 /* NB: hw still stops DMA, so proceed */ 1914 1943 } ··· 2077 2106 } else 2078 2107 ath5k_beacon_update_timers(sc, -1); 2079 2108 } else { 2080 - ath5k_hw_stop_tx_dma(sc->ah, sc->bhalq); 2109 + ath5k_hw_stop_beacon_queue(sc->ah, sc->bhalq); 2081 2110 } 2082 2111 2083 2112 ath5k_hw_set_imr(ah, sc->imask); ··· 2139 2168 * AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); */ 2140 2169 } 2141 2170 2142 - static irqreturn_t 2171 + irqreturn_t 2143 2172 ath5k_intr(int irq, void *dev_id) 2144 2173 { 2145 2174 struct ath5k_softc *sc = dev_id; ··· 2148 2177 unsigned int counter = 1000; 2149 2178 2150 2179 if (unlikely(test_bit(ATH_STAT_INVALID, sc->status) || 2151 - !ath5k_hw_is_intr_pending(ah))) 2180 + ((ath5k_get_bus_type(ah) != ATH_AHB) && 2181 + !ath5k_hw_is_intr_pending(ah)))) 2152 2182 return IRQ_NONE; 2153 2183 2154 2184 do { ··· 2215 2243 tasklet_schedule(&sc->rf_kill.toggleq); 2216 2244 2217 2245 } 2246 + 2247 + if (ath5k_get_bus_type(ah) == ATH_AHB) 2248 + break; 2249 + 2218 2250 } while (ath5k_hw_is_intr_pending(ah) && --counter > 0); 2219 2251 2220 2252 if (unlikely(!counter)) ··· 2318 2342 if (needreset) { 2319 2343 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, 2320 2344 "TX queues stuck, resetting\n"); 2321 - ath5k_reset(sc, sc->curchan); 2345 + ath5k_reset(sc, NULL, true); 2322 2346 } 2323 2347 2324 2348 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, ··· 2329 2353 /*************************\ 2330 2354 * Initialization routines * 2331 2355 \*************************/ 2356 + 2357 + int 2358 + ath5k_init_softc(struct ath5k_softc *sc, const struct ath_bus_ops *bus_ops) 2359 + { 2360 + struct ieee80211_hw *hw = sc->hw; 2361 + struct ath_common *common; 2362 + int ret; 2363 + int csz; 2364 + 2365 + /* Initialize driver private data */ 2366 + SET_IEEE80211_DEV(hw, sc->dev); 2367 + hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | 2368 + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 2369 + IEEE80211_HW_SIGNAL_DBM; 2370 + 2371 + hw->wiphy->interface_modes = 2372 + BIT(NL80211_IFTYPE_AP) | 2373 + BIT(NL80211_IFTYPE_STATION) | 2374 + BIT(NL80211_IFTYPE_ADHOC) | 2375 + BIT(NL80211_IFTYPE_MESH_POINT); 2376 + 2377 + hw->extra_tx_headroom = 2; 2378 + hw->channel_change_time = 5000; 2379 + 2380 + /* 2381 + * Mark the device as detached to avoid processing 2382 + * interrupts until setup is complete. 2383 + */ 2384 + __set_bit(ATH_STAT_INVALID, sc->status); 2385 + 2386 + sc->opmode = NL80211_IFTYPE_STATION; 2387 + sc->bintval = 1000; 2388 + mutex_init(&sc->lock); 2389 + spin_lock_init(&sc->rxbuflock); 2390 + spin_lock_init(&sc->txbuflock); 2391 + spin_lock_init(&sc->block); 2392 + 2393 + 2394 + /* Setup interrupt handler */ 2395 + ret = request_irq(sc->irq, ath5k_intr, IRQF_SHARED, "ath", sc); 2396 + if (ret) { 2397 + ATH5K_ERR(sc, "request_irq failed\n"); 2398 + goto err; 2399 + } 2400 + 2401 + /* If we passed the test, malloc an ath5k_hw struct */ 2402 + sc->ah = kzalloc(sizeof(struct ath5k_hw), GFP_KERNEL); 2403 + if (!sc->ah) { 2404 + ret = -ENOMEM; 2405 + ATH5K_ERR(sc, "out of memory\n"); 2406 + goto err_irq; 2407 + } 2408 + 2409 + sc->ah->ah_sc = sc; 2410 + sc->ah->ah_iobase = sc->iobase; 2411 + common = ath5k_hw_common(sc->ah); 2412 + common->ops = &ath5k_common_ops; 2413 + common->bus_ops = bus_ops; 2414 + common->ah = sc->ah; 2415 + common->hw = hw; 2416 + common->priv = sc; 2417 + 2418 + /* 2419 + * Cache line size is used to size and align various 2420 + * structures used to communicate with the hardware. 2421 + */ 2422 + ath5k_read_cachesize(common, &csz); 2423 + common->cachelsz = csz << 2; /* convert to bytes */ 2424 + 2425 + spin_lock_init(&common->cc_lock); 2426 + 2427 + /* Initialize device */ 2428 + ret = ath5k_hw_init(sc); 2429 + if (ret) 2430 + goto err_free_ah; 2431 + 2432 + /* set up multi-rate retry capabilities */ 2433 + if (sc->ah->ah_version == AR5K_AR5212) { 2434 + hw->max_rates = 4; 2435 + hw->max_rate_tries = 11; 2436 + } 2437 + 2438 + hw->vif_data_size = sizeof(struct ath5k_vif); 2439 + 2440 + /* Finish private driver data initialization */ 2441 + ret = ath5k_init(hw); 2442 + if (ret) 2443 + goto err_ah; 2444 + 2445 + ATH5K_INFO(sc, "Atheros AR%s chip found (MAC: 0x%x, PHY: 0x%x)\n", 2446 + ath5k_chip_name(AR5K_VERSION_MAC, sc->ah->ah_mac_srev), 2447 + sc->ah->ah_mac_srev, 2448 + sc->ah->ah_phy_revision); 2449 + 2450 + if (!sc->ah->ah_single_chip) { 2451 + /* Single chip radio (!RF5111) */ 2452 + if (sc->ah->ah_radio_5ghz_revision && 2453 + !sc->ah->ah_radio_2ghz_revision) { 2454 + /* No 5GHz support -> report 2GHz radio */ 2455 + if (!test_bit(AR5K_MODE_11A, 2456 + sc->ah->ah_capabilities.cap_mode)) { 2457 + ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n", 2458 + ath5k_chip_name(AR5K_VERSION_RAD, 2459 + sc->ah->ah_radio_5ghz_revision), 2460 + sc->ah->ah_radio_5ghz_revision); 2461 + /* No 2GHz support (5110 and some 2462 + * 5Ghz only cards) -> report 5Ghz radio */ 2463 + } else if (!test_bit(AR5K_MODE_11B, 2464 + sc->ah->ah_capabilities.cap_mode)) { 2465 + ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n", 2466 + ath5k_chip_name(AR5K_VERSION_RAD, 2467 + sc->ah->ah_radio_5ghz_revision), 2468 + sc->ah->ah_radio_5ghz_revision); 2469 + /* Multiband radio */ 2470 + } else { 2471 + ATH5K_INFO(sc, "RF%s multiband radio found" 2472 + " (0x%x)\n", 2473 + ath5k_chip_name(AR5K_VERSION_RAD, 2474 + sc->ah->ah_radio_5ghz_revision), 2475 + sc->ah->ah_radio_5ghz_revision); 2476 + } 2477 + } 2478 + /* Multi chip radio (RF5111 - RF2111) -> 2479 + * report both 2GHz/5GHz radios */ 2480 + else if (sc->ah->ah_radio_5ghz_revision && 2481 + sc->ah->ah_radio_2ghz_revision){ 2482 + ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n", 2483 + ath5k_chip_name(AR5K_VERSION_RAD, 2484 + sc->ah->ah_radio_5ghz_revision), 2485 + sc->ah->ah_radio_5ghz_revision); 2486 + ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n", 2487 + ath5k_chip_name(AR5K_VERSION_RAD, 2488 + sc->ah->ah_radio_2ghz_revision), 2489 + sc->ah->ah_radio_2ghz_revision); 2490 + } 2491 + } 2492 + 2493 + ath5k_debug_init_device(sc); 2494 + 2495 + /* ready to process interrupts */ 2496 + __clear_bit(ATH_STAT_INVALID, sc->status); 2497 + 2498 + return 0; 2499 + err_ah: 2500 + ath5k_hw_deinit(sc->ah); 2501 + err_free_ah: 2502 + kfree(sc->ah); 2503 + err_irq: 2504 + free_irq(sc->irq, sc); 2505 + err: 2506 + return ret; 2507 + } 2332 2508 2333 2509 static int 2334 2510 ath5k_stop_locked(struct ath5k_softc *sc) ··· 2510 2382 if (!test_bit(ATH_STAT_INVALID, sc->status)) { 2511 2383 ath5k_led_off(sc); 2512 2384 ath5k_hw_set_imr(ah, 0); 2513 - synchronize_irq(sc->pdev->irq); 2514 - } 2515 - ath5k_txq_cleanup(sc); 2516 - if (!test_bit(ATH_STAT_INVALID, sc->status)) { 2385 + synchronize_irq(sc->irq); 2517 2386 ath5k_rx_stop(sc); 2387 + ath5k_hw_dma_stop(ah); 2388 + ath5k_drain_tx_buffs(sc); 2518 2389 ath5k_hw_phy_disable(ah); 2519 2390 } 2520 2391 ··· 2521 2394 } 2522 2395 2523 2396 static int 2524 - ath5k_init(struct ath5k_softc *sc) 2397 + ath5k_init_hw(struct ath5k_softc *sc) 2525 2398 { 2526 2399 struct ath5k_hw *ah = sc->ah; 2527 2400 struct ath_common *common = ath5k_hw_common(ah); ··· 2550 2423 AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL | 2551 2424 AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_MIB; 2552 2425 2553 - ret = ath5k_reset(sc, NULL); 2426 + ret = ath5k_reset(sc, NULL, false); 2554 2427 if (ret) 2555 2428 goto done; 2556 2429 ··· 2563 2436 for (i = 0; i < common->keymax; i++) 2564 2437 ath_hw_keyreset(common, (u16) i); 2565 2438 2566 - ath5k_hw_set_ack_bitrate_high(ah, true); 2439 + /* Use higher rates for acks instead of base 2440 + * rate */ 2441 + ah->ah_ack_bitrate_high = true; 2567 2442 2568 2443 for (i = 0; i < ARRAY_SIZE(sc->bslot); i++) 2569 2444 sc->bslot[i] = NULL; ··· 2649 2520 * This should be called with sc->lock. 2650 2521 */ 2651 2522 static int 2652 - ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan) 2523 + ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, 2524 + bool skip_pcu) 2653 2525 { 2654 2526 struct ath5k_hw *ah = sc->ah; 2655 2527 int ret; ··· 2658 2528 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); 2659 2529 2660 2530 ath5k_hw_set_imr(ah, 0); 2661 - synchronize_irq(sc->pdev->irq); 2531 + synchronize_irq(sc->irq); 2662 2532 stop_tasklets(sc); 2663 2533 2664 2534 if (chan) { 2665 - ath5k_txq_cleanup(sc); 2666 - ath5k_rx_stop(sc); 2535 + ath5k_drain_tx_buffs(sc); 2667 2536 2668 2537 sc->curchan = chan; 2669 2538 sc->curband = &sc->sbands[chan->band]; 2670 2539 } 2671 - ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL); 2540 + ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL, 2541 + skip_pcu); 2672 2542 if (ret) { 2673 2543 ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret); 2674 2544 goto err; ··· 2714 2584 reset_work); 2715 2585 2716 2586 mutex_lock(&sc->lock); 2717 - ath5k_reset(sc, sc->curchan); 2587 + ath5k_reset(sc, NULL, true); 2718 2588 mutex_unlock(&sc->lock); 2719 2589 } 2720 2590 2721 2591 static int 2722 - ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) 2592 + ath5k_init(struct ieee80211_hw *hw) 2723 2593 { 2594 + 2724 2595 struct ath5k_softc *sc = hw->priv; 2725 2596 struct ath5k_hw *ah = sc->ah; 2726 2597 struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); ··· 2729 2598 u8 mac[ETH_ALEN] = {}; 2730 2599 int ret; 2731 2600 2732 - ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device); 2733 2601 2734 2602 /* 2735 2603 * Check if the MAC has multi-rate retry support. ··· 2765 2635 /* 2766 2636 * Allocate tx+rx descriptors and populate the lists. 2767 2637 */ 2768 - ret = ath5k_desc_alloc(sc, pdev); 2638 + ret = ath5k_desc_alloc(sc); 2769 2639 if (ret) { 2770 2640 ATH5K_ERR(sc, "can't allocate descriptors\n"); 2771 2641 goto err; ··· 2829 2699 2830 2700 ret = ath5k_eeprom_read_mac(ah, mac); 2831 2701 if (ret) { 2832 - ATH5K_ERR(sc, "unable to read address from EEPROM: 0x%04x\n", 2833 - sc->pdev->device); 2702 + ATH5K_ERR(sc, "unable to read address from EEPROM\n"); 2834 2703 goto err_queues; 2835 2704 } 2836 2705 ··· 2864 2735 err_bhal: 2865 2736 ath5k_hw_release_tx_queue(ah, sc->bhalq); 2866 2737 err_desc: 2867 - ath5k_desc_free(sc, pdev); 2738 + ath5k_desc_free(sc); 2868 2739 err: 2869 2740 return ret; 2870 2741 } 2871 2742 2872 - static void 2873 - ath5k_detach(struct pci_dev *pdev, struct ieee80211_hw *hw) 2743 + void 2744 + ath5k_deinit_softc(struct ath5k_softc *sc) 2874 2745 { 2875 - struct ath5k_softc *sc = hw->priv; 2746 + struct ieee80211_hw *hw = sc->hw; 2876 2747 2877 2748 /* 2878 2749 * NB: the order of these is important: ··· 2887 2758 * XXX: ??? detach ath5k_hw ??? 2888 2759 * Other than that, it's straightforward... 2889 2760 */ 2761 + ath5k_debug_finish_device(sc); 2890 2762 ieee80211_unregister_hw(hw); 2891 - ath5k_desc_free(sc, pdev); 2763 + ath5k_desc_free(sc); 2892 2764 ath5k_txq_release(sc); 2893 2765 ath5k_hw_release_tx_queue(sc->ah, sc->bhalq); 2894 2766 ath5k_unregister_leds(sc); ··· 2900 2770 * returns because we'll get called back to reclaim node 2901 2771 * state and potentially want to use them. 2902 2772 */ 2773 + ath5k_hw_deinit(sc->ah); 2774 + free_irq(sc->irq, sc); 2903 2775 } 2904 2776 2905 2777 /********************\ ··· 2924 2792 2925 2793 static int ath5k_start(struct ieee80211_hw *hw) 2926 2794 { 2927 - return ath5k_init(hw->priv); 2795 + return ath5k_init_hw(hw->priv); 2928 2796 } 2929 2797 2930 2798 static void ath5k_stop(struct ieee80211_hw *hw) ··· 3569 3437 return 0; 3570 3438 } 3571 3439 3572 - static const struct ieee80211_ops ath5k_hw_ops = { 3440 + const struct ieee80211_ops ath5k_hw_ops = { 3573 3441 .tx = ath5k_tx, 3574 3442 .start = ath5k_start, 3575 3443 .stop = ath5k_stop, ··· 3592 3460 .set_antenna = ath5k_set_antenna, 3593 3461 .get_antenna = ath5k_get_antenna, 3594 3462 }; 3595 - 3596 - /********************\ 3597 - * PCI Initialization * 3598 - \********************/ 3599 - 3600 - static int __devinit 3601 - ath5k_pci_probe(struct pci_dev *pdev, 3602 - const struct pci_device_id *id) 3603 - { 3604 - void __iomem *mem; 3605 - struct ath5k_softc *sc; 3606 - struct ath_common *common; 3607 - struct ieee80211_hw *hw; 3608 - int ret; 3609 - u8 csz; 3610 - 3611 - /* 3612 - * L0s needs to be disabled on all ath5k cards. 3613 - * 3614 - * For distributions shipping with CONFIG_PCIEASPM (this will be enabled 3615 - * by default in the future in 2.6.36) this will also mean both L1 and 3616 - * L0s will be disabled when a pre 1.1 PCIe device is detected. We do 3617 - * know L1 works correctly even for all ath5k pre 1.1 PCIe devices 3618 - * though but cannot currently undue the effect of a blacklist, for 3619 - * details you can read pcie_aspm_sanity_check() and see how it adjusts 3620 - * the device link capability. 3621 - * 3622 - * It may be possible in the future to implement some PCI API to allow 3623 - * drivers to override blacklists for pre 1.1 PCIe but for now it is 3624 - * best to accept that both L0s and L1 will be disabled completely for 3625 - * distributions shipping with CONFIG_PCIEASPM rather than having this 3626 - * issue present. Motivation for adding this new API will be to help 3627 - * with power consumption for some of these devices. 3628 - */ 3629 - pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S); 3630 - 3631 - ret = pci_enable_device(pdev); 3632 - if (ret) { 3633 - dev_err(&pdev->dev, "can't enable device\n"); 3634 - goto err; 3635 - } 3636 - 3637 - /* XXX 32-bit addressing only */ 3638 - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 3639 - if (ret) { 3640 - dev_err(&pdev->dev, "32-bit DMA not available\n"); 3641 - goto err_dis; 3642 - } 3643 - 3644 - /* 3645 - * Cache line size is used to size and align various 3646 - * structures used to communicate with the hardware. 3647 - */ 3648 - pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &csz); 3649 - if (csz == 0) { 3650 - /* 3651 - * Linux 2.4.18 (at least) writes the cache line size 3652 - * register as a 16-bit wide register which is wrong. 3653 - * We must have this setup properly for rx buffer 3654 - * DMA to work so force a reasonable value here if it 3655 - * comes up zero. 3656 - */ 3657 - csz = L1_CACHE_BYTES >> 2; 3658 - pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, csz); 3659 - } 3660 - /* 3661 - * The default setting of latency timer yields poor results, 3662 - * set it to the value used by other systems. It may be worth 3663 - * tweaking this setting more. 3664 - */ 3665 - pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xa8); 3666 - 3667 - /* Enable bus mastering */ 3668 - pci_set_master(pdev); 3669 - 3670 - /* 3671 - * Disable the RETRY_TIMEOUT register (0x41) to keep 3672 - * PCI Tx retries from interfering with C3 CPU state. 3673 - */ 3674 - pci_write_config_byte(pdev, 0x41, 0); 3675 - 3676 - ret = pci_request_region(pdev, 0, "ath5k"); 3677 - if (ret) { 3678 - dev_err(&pdev->dev, "cannot reserve PCI memory region\n"); 3679 - goto err_dis; 3680 - } 3681 - 3682 - mem = pci_iomap(pdev, 0, 0); 3683 - if (!mem) { 3684 - dev_err(&pdev->dev, "cannot remap PCI memory region\n") ; 3685 - ret = -EIO; 3686 - goto err_reg; 3687 - } 3688 - 3689 - /* 3690 - * Allocate hw (mac80211 main struct) 3691 - * and hw->priv (driver private data) 3692 - */ 3693 - hw = ieee80211_alloc_hw(sizeof(*sc), &ath5k_hw_ops); 3694 - if (hw == NULL) { 3695 - dev_err(&pdev->dev, "cannot allocate ieee80211_hw\n"); 3696 - ret = -ENOMEM; 3697 - goto err_map; 3698 - } 3699 - 3700 - dev_info(&pdev->dev, "registered as '%s'\n", wiphy_name(hw->wiphy)); 3701 - 3702 - /* Initialize driver private data */ 3703 - SET_IEEE80211_DEV(hw, &pdev->dev); 3704 - hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | 3705 - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 3706 - IEEE80211_HW_SIGNAL_DBM; 3707 - 3708 - hw->wiphy->interface_modes = 3709 - BIT(NL80211_IFTYPE_AP) | 3710 - BIT(NL80211_IFTYPE_STATION) | 3711 - BIT(NL80211_IFTYPE_ADHOC) | 3712 - BIT(NL80211_IFTYPE_MESH_POINT); 3713 - 3714 - hw->extra_tx_headroom = 2; 3715 - hw->channel_change_time = 5000; 3716 - sc = hw->priv; 3717 - sc->hw = hw; 3718 - sc->pdev = pdev; 3719 - 3720 - /* 3721 - * Mark the device as detached to avoid processing 3722 - * interrupts until setup is complete. 3723 - */ 3724 - __set_bit(ATH_STAT_INVALID, sc->status); 3725 - 3726 - sc->iobase = mem; /* So we can unmap it on detach */ 3727 - sc->opmode = NL80211_IFTYPE_STATION; 3728 - sc->bintval = 1000; 3729 - mutex_init(&sc->lock); 3730 - spin_lock_init(&sc->rxbuflock); 3731 - spin_lock_init(&sc->txbuflock); 3732 - spin_lock_init(&sc->block); 3733 - 3734 - /* Set private data */ 3735 - pci_set_drvdata(pdev, sc); 3736 - 3737 - /* Setup interrupt handler */ 3738 - ret = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc); 3739 - if (ret) { 3740 - ATH5K_ERR(sc, "request_irq failed\n"); 3741 - goto err_free; 3742 - } 3743 - 3744 - /* If we passed the test, malloc an ath5k_hw struct */ 3745 - sc->ah = kzalloc(sizeof(struct ath5k_hw), GFP_KERNEL); 3746 - if (!sc->ah) { 3747 - ret = -ENOMEM; 3748 - ATH5K_ERR(sc, "out of memory\n"); 3749 - goto err_irq; 3750 - } 3751 - 3752 - sc->ah->ah_sc = sc; 3753 - sc->ah->ah_iobase = sc->iobase; 3754 - common = ath5k_hw_common(sc->ah); 3755 - common->ops = &ath5k_common_ops; 3756 - common->ah = sc->ah; 3757 - common->hw = hw; 3758 - common->cachelsz = csz << 2; /* convert to bytes */ 3759 - spin_lock_init(&common->cc_lock); 3760 - 3761 - /* Initialize device */ 3762 - ret = ath5k_hw_attach(sc); 3763 - if (ret) { 3764 - goto err_free_ah; 3765 - } 3766 - 3767 - /* set up multi-rate retry capabilities */ 3768 - if (sc->ah->ah_version == AR5K_AR5212) { 3769 - hw->max_rates = 4; 3770 - hw->max_rate_tries = 11; 3771 - } 3772 - 3773 - hw->vif_data_size = sizeof(struct ath5k_vif); 3774 - 3775 - /* Finish private driver data initialization */ 3776 - ret = ath5k_attach(pdev, hw); 3777 - if (ret) 3778 - goto err_ah; 3779 - 3780 - ATH5K_INFO(sc, "Atheros AR%s chip found (MAC: 0x%x, PHY: 0x%x)\n", 3781 - ath5k_chip_name(AR5K_VERSION_MAC, sc->ah->ah_mac_srev), 3782 - sc->ah->ah_mac_srev, 3783 - sc->ah->ah_phy_revision); 3784 - 3785 - if (!sc->ah->ah_single_chip) { 3786 - /* Single chip radio (!RF5111) */ 3787 - if (sc->ah->ah_radio_5ghz_revision && 3788 - !sc->ah->ah_radio_2ghz_revision) { 3789 - /* No 5GHz support -> report 2GHz radio */ 3790 - if (!test_bit(AR5K_MODE_11A, 3791 - sc->ah->ah_capabilities.cap_mode)) { 3792 - ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n", 3793 - ath5k_chip_name(AR5K_VERSION_RAD, 3794 - sc->ah->ah_radio_5ghz_revision), 3795 - sc->ah->ah_radio_5ghz_revision); 3796 - /* No 2GHz support (5110 and some 3797 - * 5Ghz only cards) -> report 5Ghz radio */ 3798 - } else if (!test_bit(AR5K_MODE_11B, 3799 - sc->ah->ah_capabilities.cap_mode)) { 3800 - ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n", 3801 - ath5k_chip_name(AR5K_VERSION_RAD, 3802 - sc->ah->ah_radio_5ghz_revision), 3803 - sc->ah->ah_radio_5ghz_revision); 3804 - /* Multiband radio */ 3805 - } else { 3806 - ATH5K_INFO(sc, "RF%s multiband radio found" 3807 - " (0x%x)\n", 3808 - ath5k_chip_name(AR5K_VERSION_RAD, 3809 - sc->ah->ah_radio_5ghz_revision), 3810 - sc->ah->ah_radio_5ghz_revision); 3811 - } 3812 - } 3813 - /* Multi chip radio (RF5111 - RF2111) -> 3814 - * report both 2GHz/5GHz radios */ 3815 - else if (sc->ah->ah_radio_5ghz_revision && 3816 - sc->ah->ah_radio_2ghz_revision){ 3817 - ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n", 3818 - ath5k_chip_name(AR5K_VERSION_RAD, 3819 - sc->ah->ah_radio_5ghz_revision), 3820 - sc->ah->ah_radio_5ghz_revision); 3821 - ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n", 3822 - ath5k_chip_name(AR5K_VERSION_RAD, 3823 - sc->ah->ah_radio_2ghz_revision), 3824 - sc->ah->ah_radio_2ghz_revision); 3825 - } 3826 - } 3827 - 3828 - ath5k_debug_init_device(sc); 3829 - 3830 - /* ready to process interrupts */ 3831 - __clear_bit(ATH_STAT_INVALID, sc->status); 3832 - 3833 - return 0; 3834 - err_ah: 3835 - ath5k_hw_detach(sc->ah); 3836 - err_free_ah: 3837 - kfree(sc->ah); 3838 - err_irq: 3839 - free_irq(pdev->irq, sc); 3840 - err_free: 3841 - ieee80211_free_hw(hw); 3842 - err_map: 3843 - pci_iounmap(pdev, mem); 3844 - err_reg: 3845 - pci_release_region(pdev, 0); 3846 - err_dis: 3847 - pci_disable_device(pdev); 3848 - err: 3849 - return ret; 3850 - } 3851 - 3852 - static void __devexit 3853 - ath5k_pci_remove(struct pci_dev *pdev) 3854 - { 3855 - struct ath5k_softc *sc = pci_get_drvdata(pdev); 3856 - 3857 - ath5k_debug_finish_device(sc); 3858 - ath5k_detach(pdev, sc->hw); 3859 - ath5k_hw_detach(sc->ah); 3860 - kfree(sc->ah); 3861 - free_irq(pdev->irq, sc); 3862 - pci_iounmap(pdev, sc->iobase); 3863 - pci_release_region(pdev, 0); 3864 - pci_disable_device(pdev); 3865 - ieee80211_free_hw(sc->hw); 3866 - } 3867 - 3868 - #ifdef CONFIG_PM_SLEEP 3869 - static int ath5k_pci_suspend(struct device *dev) 3870 - { 3871 - struct ath5k_softc *sc = pci_get_drvdata(to_pci_dev(dev)); 3872 - 3873 - ath5k_led_off(sc); 3874 - return 0; 3875 - } 3876 - 3877 - static int ath5k_pci_resume(struct device *dev) 3878 - { 3879 - struct pci_dev *pdev = to_pci_dev(dev); 3880 - struct ath5k_softc *sc = pci_get_drvdata(pdev); 3881 - 3882 - /* 3883 - * Suspend/Resume resets the PCI configuration space, so we have to 3884 - * re-disable the RETRY_TIMEOUT register (0x41) to keep 3885 - * PCI Tx retries from interfering with C3 CPU state 3886 - */ 3887 - pci_write_config_byte(pdev, 0x41, 0); 3888 - 3889 - ath5k_led_enable(sc); 3890 - return 0; 3891 - } 3892 - 3893 - static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume); 3894 - #define ATH5K_PM_OPS (&ath5k_pm_ops) 3895 - #else 3896 - #define ATH5K_PM_OPS NULL 3897 - #endif /* CONFIG_PM_SLEEP */ 3898 - 3899 - static struct pci_driver ath5k_pci_driver = { 3900 - .name = KBUILD_MODNAME, 3901 - .id_table = ath5k_pci_id_table, 3902 - .probe = ath5k_pci_probe, 3903 - .remove = __devexit_p(ath5k_pci_remove), 3904 - .driver.pm = ATH5K_PM_OPS, 3905 - }; 3906 - 3907 - /* 3908 - * Module init/exit functions 3909 - */ 3910 - static int __init 3911 - init_ath5k_pci(void) 3912 - { 3913 - int ret; 3914 - 3915 - ret = pci_register_driver(&ath5k_pci_driver); 3916 - if (ret) { 3917 - printk(KERN_ERR "ath5k_pci: can't register pci driver\n"); 3918 - return ret; 3919 - } 3920 - 3921 - return 0; 3922 - } 3923 - 3924 - static void __exit 3925 - exit_ath5k_pci(void) 3926 - { 3927 - pci_unregister_driver(&ath5k_pci_driver); 3928 - } 3929 - 3930 - module_init(init_ath5k_pci); 3931 - module_exit(exit_ath5k_pci);
+4 -1
drivers/net/wireless/ath/ath5k/base.h
··· 169 169 /* Software Carrier, keeps track of the driver state 170 170 * associated with an instance of a device */ 171 171 struct ath5k_softc { 172 - struct pci_dev *pdev; /* for dma mapping */ 172 + struct pci_dev *pdev; 173 + struct device *dev; /* for dma mapping */ 174 + int irq; 175 + u16 devid; 173 176 void __iomem *iobase; /* address of the device */ 174 177 struct mutex lock; /* dev-level lock */ 175 178 struct ieee80211_hw *hw; /* IEEE 802.11 common */
-6
drivers/net/wireless/ath/ath5k/caps.c
··· 49 49 50 50 /* Set supported modes */ 51 51 __set_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode); 52 - __set_bit(AR5K_MODE_11A_TURBO, ah->ah_capabilities.cap_mode); 53 52 } else { 54 53 /* 55 54 * XXX The tranceiver supports frequencies from 4920 to 6100GHz ··· 73 74 /* Set supported modes */ 74 75 __set_bit(AR5K_MODE_11A, 75 76 ah->ah_capabilities.cap_mode); 76 - __set_bit(AR5K_MODE_11A_TURBO, 77 - ah->ah_capabilities.cap_mode); 78 - if (ah->ah_version == AR5K_AR5212) 79 - __set_bit(AR5K_MODE_11G_TURBO, 80 - ah->ah_capabilities.cap_mode); 81 77 } 82 78 83 79 /* Enable 802.11b if a 2GHz capable radio (2111/5112) is
+1
drivers/net/wireless/ath/ath5k/debug.c
··· 312 312 { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, 313 313 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, 314 314 { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, 315 + { ATH5K_DEBUG_DMA, "dma", "dma start/stop" }, 315 316 { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" }, 316 317 { ATH5K_DEBUG_DESC, "desc", "descriptor chains" }, 317 318 { ATH5K_DEBUG_ANY, "all", "show all debug levels" },
+2
drivers/net/wireless/ath/ath5k/debug.h
··· 95 95 * @ATH5K_DEBUG_DUMP_RX: print received skb content 96 96 * @ATH5K_DEBUG_DUMP_TX: print transmit skb content 97 97 * @ATH5K_DEBUG_DUMPBANDS: dump bands 98 + * @ATH5K_DEBUG_DMA: debug dma start/stop 98 99 * @ATH5K_DEBUG_TRACE: trace function calls 99 100 * @ATH5K_DEBUG_DESC: descriptor setup 100 101 * @ATH5K_DEBUG_ANY: show at any debug level ··· 119 118 ATH5K_DEBUG_DUMP_RX = 0x00000100, 120 119 ATH5K_DEBUG_DUMP_TX = 0x00000200, 121 120 ATH5K_DEBUG_DUMPBANDS = 0x00000400, 121 + ATH5K_DEBUG_DMA = 0x00000800, 122 122 ATH5K_DEBUG_ANI = 0x00002000, 123 123 ATH5K_DEBUG_DESC = 0x00004000, 124 124 ATH5K_DEBUG_ANY = 0xffffffff
+18 -6
drivers/net/wireless/ath/ath5k/desc.c
··· 26 26 #include "debug.h" 27 27 #include "base.h" 28 28 29 - /* 30 - * TX Descriptors 31 - */ 29 + 30 + /************************\ 31 + * TX Control descriptors * 32 + \************************/ 32 33 33 34 /* 34 35 * Initialize the 2-word tx control descriptor on 5210/5211 ··· 336 335 return 0; 337 336 } 338 337 338 + 339 + /***********************\ 340 + * TX Status descriptors * 341 + \***********************/ 342 + 339 343 /* 340 344 * Proccess the tx status descriptor on 5210/5211 341 345 */ ··· 482 476 return 0; 483 477 } 484 478 485 - /* 486 - * RX Descriptors 487 - */ 479 + 480 + /****************\ 481 + * RX Descriptors * 482 + \****************/ 488 483 489 484 /* 490 485 * Initialize an rx control descriptor ··· 672 665 } 673 666 return 0; 674 667 } 668 + 669 + 670 + /********\ 671 + * Attach * 672 + \********/ 675 673 676 674 /* 677 675 * Init function pointers inside ath5k_hw struct
+168 -12
drivers/net/wireless/ath/ath5k/dma.c
··· 37 37 #include "debug.h" 38 38 #include "base.h" 39 39 40 + 40 41 /*********\ 41 42 * Receive * 42 43 \*********/ ··· 58 57 * 59 58 * @ah: The &struct ath5k_hw 60 59 */ 61 - int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah) 60 + static int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah) 62 61 { 63 62 unsigned int i; 64 63 ··· 70 69 for (i = 1000; i > 0 && 71 70 (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) != 0; 72 71 i--) 73 - udelay(10); 72 + udelay(100); 73 + 74 + if (i) 75 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, 76 + "failed to stop RX DMA !\n"); 74 77 75 78 return i ? 0 : -EBUSY; 76 79 } ··· 95 90 * @ah: The &struct ath5k_hw 96 91 * @phys_addr: RX descriptor address 97 92 * 98 - * XXX: Should we check if rx is enabled before setting rxdp ? 93 + * Returns -EIO if rx is active 99 94 */ 100 - void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr) 95 + int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr) 101 96 { 97 + if (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) { 98 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, 99 + "tried to set RXDP while rx was active !\n"); 100 + return -EIO; 101 + } 102 + 102 103 ath5k_hw_reg_write(ah, phys_addr, AR5K_RXDP); 104 + return 0; 103 105 } 104 106 105 107 ··· 137 125 138 126 /* Return if queue is declared inactive */ 139 127 if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) 140 - return -EIO; 128 + return -EINVAL; 141 129 142 130 if (ah->ah_version == AR5K_AR5210) { 143 131 tx_queue = ath5k_hw_reg_read(ah, AR5K_CR); ··· 185 173 * 186 174 * Stop DMA transmit on a specific hw queue and drain queue so we don't 187 175 * have any pending frames. Returns -EBUSY if we still have pending frames, 188 - * -EINVAL if queue number is out of range. 176 + * -EINVAL if queue number is out of range or inactive. 189 177 * 190 178 */ 191 - int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) 179 + static int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) 192 180 { 193 181 unsigned int i = 40; 194 182 u32 tx_queue, pending; ··· 197 185 198 186 /* Return if queue is declared inactive */ 199 187 if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) 200 - return -EIO; 188 + return -EINVAL; 201 189 202 190 if (ah->ah_version == AR5K_AR5210) { 203 191 tx_queue = ath5k_hw_reg_read(ah, AR5K_CR); ··· 223 211 ath5k_hw_reg_write(ah, tx_queue, AR5K_CR); 224 212 ath5k_hw_reg_read(ah, AR5K_CR); 225 213 } else { 214 + 215 + /* 216 + * Enable DCU early termination to quickly 217 + * flush any pending frames from QCU 218 + */ 219 + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 220 + AR5K_QCU_MISC_DCU_EARLY); 221 + 226 222 /* 227 223 * Schedule TX disable and wait until queue is empty 228 224 */ 229 225 AR5K_REG_WRITE_Q(ah, AR5K_QCU_TXD, queue); 230 226 231 - /*Check for pending frames*/ 227 + /* Wait for queue to stop */ 228 + for (i = 1000; i > 0 && 229 + (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue) != 0); 230 + i--) 231 + udelay(100); 232 + 233 + if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue)) 234 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, 235 + "queue %i didn't stop !\n", queue); 236 + 237 + /* Check for pending frames */ 238 + i = 1000; 232 239 do { 233 240 pending = ath5k_hw_reg_read(ah, 234 241 AR5K_QUEUE_STATUS(queue)) & ··· 278 247 AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); 279 248 280 249 /* Wait a while and disable mechanism */ 281 - udelay(200); 250 + udelay(400); 282 251 AR5K_REG_DISABLE_BITS(ah, AR5K_QUIET_CTL1, 283 252 AR5K_QUIET_CTL1_QT_EN); 284 253 285 254 /* Re-check for pending frames */ 286 - i = 40; 255 + i = 100; 287 256 do { 288 257 pending = ath5k_hw_reg_read(ah, 289 258 AR5K_QUEUE_STATUS(queue)) & ··· 293 262 294 263 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5211, 295 264 AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); 265 + 266 + if (pending) 267 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, 268 + "quiet mechanism didn't work q:%i !\n", 269 + queue); 296 270 } 271 + 272 + /* 273 + * Disable DCU early termination 274 + */ 275 + AR5K_REG_DISABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 276 + AR5K_QCU_MISC_DCU_EARLY); 297 277 298 278 /* Clear register */ 299 279 ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD); 300 - if (pending) 280 + if (pending) { 281 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, 282 + "tx dma didn't stop (q:%i, frm:%i) !\n", 283 + queue, pending); 301 284 return -EBUSY; 285 + } 302 286 } 303 287 304 288 /* TODO: Check for success on 5210 else return error */ 289 + return 0; 290 + } 291 + 292 + /** 293 + * ath5k_hw_stop_beacon_queue - Stop beacon queue 294 + * 295 + * @ah The &struct ath5k_hw 296 + * @queue The queue number 297 + * 298 + * Returns -EIO if queue didn't stop 299 + */ 300 + int ath5k_hw_stop_beacon_queue(struct ath5k_hw *ah, unsigned int queue) 301 + { 302 + int ret; 303 + ret = ath5k_hw_stop_tx_dma(ah, queue); 304 + if (ret) { 305 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, 306 + "beacon queue didn't stop !\n"); 307 + return -EIO; 308 + } 305 309 return 0; 306 310 } 307 311 ··· 492 426 493 427 return ret; 494 428 } 429 + 495 430 496 431 /*******************\ 497 432 * Interrupt masking * ··· 755 688 return old_mask; 756 689 } 757 690 691 + 692 + /********************\ 693 + Init/Stop functions 694 + \********************/ 695 + 696 + /** 697 + * ath5k_hw_dma_init - Initialize DMA unit 698 + * 699 + * @ah: The &struct ath5k_hw 700 + * 701 + * Set DMA size and pre-enable interrupts 702 + * (driver handles tx/rx buffer setup and 703 + * dma start/stop) 704 + * 705 + * XXX: Save/restore RXDP/TXDP registers ? 706 + */ 707 + void ath5k_hw_dma_init(struct ath5k_hw *ah) 708 + { 709 + /* 710 + * Set Rx/Tx DMA Configuration 711 + * 712 + * Set standard DMA size (128). Note that 713 + * a DMA size of 512 causes rx overruns and tx errors 714 + * on pci-e cards (tested on 5424 but since rx overruns 715 + * also occur on 5416/5418 with madwifi we set 128 716 + * for all PCI-E cards to be safe). 717 + * 718 + * XXX: need to check 5210 for this 719 + * TODO: Check out tx triger level, it's always 64 on dumps but I 720 + * guess we can tweak it and see how it goes ;-) 721 + */ 722 + if (ah->ah_version != AR5K_AR5210) { 723 + AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, 724 + AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B); 725 + AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, 726 + AR5K_RXCFG_SDMAMW, AR5K_DMASIZE_128B); 727 + } 728 + 729 + /* Pre-enable interrupts on 5211/5212*/ 730 + if (ah->ah_version != AR5K_AR5210) 731 + ath5k_hw_set_imr(ah, ah->ah_imr); 732 + 733 + } 734 + 735 + /** 736 + * ath5k_hw_dma_stop - stop DMA unit 737 + * 738 + * @ah: The &struct ath5k_hw 739 + * 740 + * Stop tx/rx DMA and interrupts. Returns 741 + * -EBUSY if tx or rx dma failed to stop. 742 + * 743 + * XXX: Sometimes DMA unit hangs and we have 744 + * stuck frames on tx queues, only a reset 745 + * can fix that. 746 + */ 747 + int ath5k_hw_dma_stop(struct ath5k_hw *ah) 748 + { 749 + int i, qmax, err; 750 + err = 0; 751 + 752 + /* Disable interrupts */ 753 + ath5k_hw_set_imr(ah, 0); 754 + 755 + /* Stop rx dma */ 756 + err = ath5k_hw_stop_rx_dma(ah); 757 + if (err) 758 + return err; 759 + 760 + /* Clear any pending interrupts 761 + * and disable tx dma */ 762 + if (ah->ah_version != AR5K_AR5210) { 763 + ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR); 764 + qmax = AR5K_NUM_TX_QUEUES; 765 + } else { 766 + /* PISR/SISR Not available on 5210 */ 767 + ath5k_hw_reg_read(ah, AR5K_ISR); 768 + qmax = AR5K_NUM_TX_QUEUES_NOQCU; 769 + } 770 + 771 + for (i = 0; i < qmax; i++) { 772 + err = ath5k_hw_stop_tx_dma(ah, i); 773 + /* -EINVAL -> queue inactive */ 774 + if (err != -EINVAL) 775 + return err; 776 + } 777 + 778 + return err; 779 + }
+55 -72
drivers/net/wireless/ath/ath5k/eeprom.c
··· 28 28 #include "debug.h" 29 29 #include "base.h" 30 30 31 - /* 32 - * Read from eeprom 33 - */ 34 - static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data) 35 - { 36 - u32 status, timeout; 37 31 38 - /* 39 - * Initialize EEPROM access 40 - */ 41 - if (ah->ah_version == AR5K_AR5210) { 42 - AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, AR5K_PCICFG_EEAE); 43 - (void)ath5k_hw_reg_read(ah, AR5K_EEPROM_BASE + (4 * offset)); 44 - } else { 45 - ath5k_hw_reg_write(ah, offset, AR5K_EEPROM_BASE); 46 - AR5K_REG_ENABLE_BITS(ah, AR5K_EEPROM_CMD, 47 - AR5K_EEPROM_CMD_READ); 48 - } 49 - 50 - for (timeout = AR5K_TUNE_REGISTER_TIMEOUT; timeout > 0; timeout--) { 51 - status = ath5k_hw_reg_read(ah, AR5K_EEPROM_STATUS); 52 - if (status & AR5K_EEPROM_STAT_RDDONE) { 53 - if (status & AR5K_EEPROM_STAT_RDERR) 54 - return -EIO; 55 - *data = (u16)(ath5k_hw_reg_read(ah, AR5K_EEPROM_DATA) & 56 - 0xffff); 57 - return 0; 58 - } 59 - udelay(15); 60 - } 61 - 62 - return -ETIMEDOUT; 63 - } 32 + /******************\ 33 + * Helper functions * 34 + \******************/ 64 35 65 36 /* 66 37 * Translate binary channel representation in EEPROM to frequency 67 38 */ 68 39 static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, 69 - unsigned int mode) 40 + unsigned int mode) 70 41 { 71 42 u16 val; 72 43 ··· 59 88 60 89 return val; 61 90 } 91 + 92 + 93 + /*********\ 94 + * Parsers * 95 + \*********/ 62 96 63 97 /* 64 98 * Initialize eeprom & capabilities structs ··· 174 198 * 175 199 * XXX: Serdes values seem to be fixed so 176 200 * no need to read them here, we write them 177 - * during ath5k_hw_attach */ 201 + * during ath5k_hw_init */ 178 202 AR5K_EEPROM_READ(AR5K_EEPROM_PCIE_OFFSET, val); 179 203 ee->ee_serdes = (val == AR5K_EEPROM_PCIE_SERDES_SECTION) ? 180 204 true : false; ··· 622 646 623 647 return 0; 624 648 } 649 + 625 650 626 651 /* 627 652 * Read power calibration for RF5111 chips ··· 1491 1514 return 0; 1492 1515 } 1493 1516 1517 + 1494 1518 /* 1495 1519 * Read per channel calibration info from EEPROM 1496 1520 * ··· 1583 1605 } 1584 1606 1585 1607 return 0; 1586 - } 1587 - 1588 - void 1589 - ath5k_eeprom_detach(struct ath5k_hw *ah) 1590 - { 1591 - u8 mode; 1592 - 1593 - for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++) 1594 - ath5k_eeprom_free_pcal_info(ah, mode); 1595 1608 } 1596 1609 1597 1610 /* Read conformance test limits used for regulatory control */ ··· 1726 1757 } 1727 1758 1728 1759 /* 1760 + * Read the MAC address from eeprom 1761 + */ 1762 + int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) 1763 + { 1764 + u8 mac_d[ETH_ALEN] = {}; 1765 + u32 total, offset; 1766 + u16 data; 1767 + int octet, ret; 1768 + 1769 + ret = ath5k_hw_nvram_read(ah, 0x20, &data); 1770 + if (ret) 1771 + return ret; 1772 + 1773 + for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) { 1774 + ret = ath5k_hw_nvram_read(ah, offset, &data); 1775 + if (ret) 1776 + return ret; 1777 + 1778 + total += data; 1779 + mac_d[octet + 1] = data & 0xff; 1780 + mac_d[octet] = data >> 8; 1781 + octet += 2; 1782 + } 1783 + 1784 + if (!total || total == 3 * 0xffff) 1785 + return -EINVAL; 1786 + 1787 + memcpy(mac, mac_d, ETH_ALEN); 1788 + 1789 + return 0; 1790 + } 1791 + 1792 + 1793 + /***********************\ 1794 + * Init/Detach functions * 1795 + \***********************/ 1796 + 1797 + /* 1729 1798 * Initialize eeprom data structure 1730 1799 */ 1731 1800 int ··· 1794 1787 return 0; 1795 1788 } 1796 1789 1797 - /* 1798 - * Read the MAC address from eeprom 1799 - */ 1800 - int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) 1790 + void 1791 + ath5k_eeprom_detach(struct ath5k_hw *ah) 1801 1792 { 1802 - u8 mac_d[ETH_ALEN] = {}; 1803 - u32 total, offset; 1804 - u16 data; 1805 - int octet, ret; 1793 + u8 mode; 1806 1794 1807 - ret = ath5k_hw_eeprom_read(ah, 0x20, &data); 1808 - if (ret) 1809 - return ret; 1810 - 1811 - for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) { 1812 - ret = ath5k_hw_eeprom_read(ah, offset, &data); 1813 - if (ret) 1814 - return ret; 1815 - 1816 - total += data; 1817 - mac_d[octet + 1] = data & 0xff; 1818 - mac_d[octet] = data >> 8; 1819 - octet += 2; 1820 - } 1821 - 1822 - if (!total || total == 3 * 0xffff) 1823 - return -EINVAL; 1824 - 1825 - memcpy(mac, mac_d, ETH_ALEN); 1826 - 1827 - return 0; 1795 + for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++) 1796 + ath5k_eeprom_free_pcal_info(ah, mode); 1828 1797 }
+1 -1
drivers/net/wireless/ath/ath5k/eeprom.h
··· 241 241 #define AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz 6250 242 242 243 243 #define AR5K_EEPROM_READ(_o, _v) do { \ 244 - ret = ath5k_hw_eeprom_read(ah, (_o), &(_v)); \ 244 + ret = ath5k_hw_nvram_read(ah, (_o), &(_v)); \ 245 245 if (ret) \ 246 246 return ret; \ 247 247 } while (0)
+213 -196
drivers/net/wireless/ath/ath5k/initvals.c
··· 44 44 45 45 struct ath5k_ini_mode { 46 46 u16 mode_register; 47 - u32 mode_value[5]; 47 + u32 mode_value[3]; 48 48 }; 49 49 50 50 /* Initial register settings for AR5210 */ ··· 391 391 */ 392 392 static const struct ath5k_ini_mode ar5211_ini_mode[] = { 393 393 { AR5K_TXCFG, 394 - /* a aTurbo b g (OFDM) */ 395 - { 0x00000015, 0x00000015, 0x0000001d, 0x00000015 } }, 394 + /* A/XR B G */ 395 + { 0x00000015, 0x0000001d, 0x00000015 } }, 396 396 { AR5K_QUEUE_DFS_LOCAL_IFS(0), 397 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 397 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 398 398 { AR5K_QUEUE_DFS_LOCAL_IFS(1), 399 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 399 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 400 400 { AR5K_QUEUE_DFS_LOCAL_IFS(2), 401 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 401 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 402 402 { AR5K_QUEUE_DFS_LOCAL_IFS(3), 403 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 403 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 404 404 { AR5K_QUEUE_DFS_LOCAL_IFS(4), 405 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 405 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 406 406 { AR5K_QUEUE_DFS_LOCAL_IFS(5), 407 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 407 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 408 408 { AR5K_QUEUE_DFS_LOCAL_IFS(6), 409 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 409 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 410 410 { AR5K_QUEUE_DFS_LOCAL_IFS(7), 411 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 411 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 412 412 { AR5K_QUEUE_DFS_LOCAL_IFS(8), 413 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 413 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 414 414 { AR5K_QUEUE_DFS_LOCAL_IFS(9), 415 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 415 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 416 416 { AR5K_DCU_GBL_IFS_SLOT, 417 - { 0x00000168, 0x000001e0, 0x000001b8, 0x00000168 } }, 417 + { 0x00000168, 0x000001b8, 0x00000168 } }, 418 418 { AR5K_DCU_GBL_IFS_SIFS, 419 - { 0x00000230, 0x000001e0, 0x000000b0, 0x00000230 } }, 419 + { 0x00000230, 0x000000b0, 0x00000230 } }, 420 420 { AR5K_DCU_GBL_IFS_EIFS, 421 - { 0x00000d98, 0x00001180, 0x00001f48, 0x00000d98 } }, 421 + { 0x00000d98, 0x00001f48, 0x00000d98 } }, 422 422 { AR5K_DCU_GBL_IFS_MISC, 423 - { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000a0e0 } }, 423 + { 0x0000a0e0, 0x00005880, 0x0000a0e0 } }, 424 424 { AR5K_TIME_OUT, 425 - { 0x04000400, 0x08000800, 0x20003000, 0x04000400 } }, 425 + { 0x04000400, 0x20003000, 0x04000400 } }, 426 426 { AR5K_USEC_5211, 427 - { 0x0e8d8fa7, 0x0e8d8fcf, 0x01608f95, 0x0e8d8fa7 } }, 428 - { AR5K_PHY_TURBO, 429 - { 0x00000000, 0x00000003, 0x00000000, 0x00000000 } }, 427 + { 0x0e8d8fa7, 0x01608f95, 0x0e8d8fa7 } }, 430 428 { AR5K_PHY(8), 431 - { 0x02020200, 0x02020200, 0x02010200, 0x02020200 } }, 432 - { AR5K_PHY(9), 433 - { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e } }, 434 - { AR5K_PHY(10), 435 - { 0x0a020001, 0x0a020001, 0x05010000, 0x0a020001 } }, 436 - { AR5K_PHY(13), 437 - { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 438 - { AR5K_PHY(14), 439 - { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b } }, 440 - { AR5K_PHY(17), 441 - { 0x1372169c, 0x137216a5, 0x137216a8, 0x1372169c } }, 442 - { AR5K_PHY(18), 443 - { 0x0018ba67, 0x0018ba67, 0x0018ba69, 0x0018ba69 } }, 444 - { AR5K_PHY(20), 445 - { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } }, 429 + { 0x02020200, 0x02010200, 0x02020200 } }, 430 + { AR5K_PHY_RF_CTL2, 431 + { 0x00000e0e, 0x00000707, 0x00000e0e } }, 432 + { AR5K_PHY_RF_CTL3, 433 + { 0x0a020001, 0x05010000, 0x0a020001 } }, 434 + { AR5K_PHY_RF_CTL4, 435 + { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 436 + { AR5K_PHY_PA_CTL, 437 + { 0x00000007, 0x0000000b, 0x0000000b } }, 438 + { AR5K_PHY_SETTLING, 439 + { 0x1372169c, 0x137216a8, 0x1372169c } }, 440 + { AR5K_PHY_GAIN, 441 + { 0x0018ba67, 0x0018ba69, 0x0018ba69 } }, 442 + { AR5K_PHY_DESIRED_SIZE, 443 + { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } }, 446 444 { AR5K_PHY_SIG, 447 - { 0x7e800d2e, 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } }, 445 + { 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } }, 448 446 { AR5K_PHY_AGCCOARSE, 449 - { 0x31375d5e, 0x31375d5e, 0x313a5d5e, 0x31375d5e } }, 447 + { 0x31375d5e, 0x313a5d5e, 0x31375d5e } }, 450 448 { AR5K_PHY_AGCCTL, 451 - { 0x0000bd10, 0x0000bd10, 0x0000bd38, 0x0000bd10 } }, 449 + { 0x0000bd10, 0x0000bd38, 0x0000bd10 } }, 452 450 { AR5K_PHY_NF, 453 - { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, 451 + { 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, 454 452 { AR5K_PHY_RX_DELAY, 455 - { 0x00002710, 0x00002710, 0x0000157c, 0x00002710 } }, 453 + { 0x00002710, 0x0000157c, 0x00002710 } }, 456 454 { AR5K_PHY(70), 457 - { 0x00000190, 0x00000190, 0x00000084, 0x00000190 } }, 455 + { 0x00000190, 0x00000084, 0x00000190 } }, 458 456 { AR5K_PHY_FRAME_CTL_5211, 459 - { 0x6fe01020, 0x6fe01020, 0x6fe00920, 0x6fe01020 } }, 457 + { 0x6fe01020, 0x6fe00920, 0x6fe01020 } }, 460 458 { AR5K_PHY_PCDAC_TXPOWER_BASE, 461 - { 0x05ff14ff, 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } }, 459 + { 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } }, 462 460 { AR5K_RF_BUFFER_CONTROL_4, 463 - { 0x00000010, 0x00000014, 0x00000010, 0x00000010 } }, 461 + { 0x00000010, 0x00000010, 0x00000010 } }, 464 462 }; 465 463 466 464 /* Initial register settings for AR5212 */ ··· 675 677 /* Initial mode-specific settings for AR5212 (Written before ar5212_ini) */ 676 678 static const struct ath5k_ini_mode ar5212_ini_mode_start[] = { 677 679 { AR5K_QUEUE_DFS_LOCAL_IFS(0), 678 - /* a/XR aTurbo b g (DYN) gTurbo */ 679 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 680 + /* A/XR B G */ 681 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 680 682 { AR5K_QUEUE_DFS_LOCAL_IFS(1), 681 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 683 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 682 684 { AR5K_QUEUE_DFS_LOCAL_IFS(2), 683 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 685 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 684 686 { AR5K_QUEUE_DFS_LOCAL_IFS(3), 685 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 687 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 686 688 { AR5K_QUEUE_DFS_LOCAL_IFS(4), 687 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 689 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 688 690 { AR5K_QUEUE_DFS_LOCAL_IFS(5), 689 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 691 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 690 692 { AR5K_QUEUE_DFS_LOCAL_IFS(6), 691 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 693 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 692 694 { AR5K_QUEUE_DFS_LOCAL_IFS(7), 693 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 695 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 694 696 { AR5K_QUEUE_DFS_LOCAL_IFS(8), 695 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 697 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 696 698 { AR5K_QUEUE_DFS_LOCAL_IFS(9), 697 - { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 699 + { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 698 700 { AR5K_DCU_GBL_IFS_SIFS, 699 - { 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 } }, 701 + { 0x00000230, 0x000000b0, 0x00000160 } }, 700 702 { AR5K_DCU_GBL_IFS_SLOT, 701 - { 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 } }, 703 + { 0x00000168, 0x000001b8, 0x0000018c } }, 702 704 { AR5K_DCU_GBL_IFS_EIFS, 703 - { 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 } }, 705 + { 0x00000e60, 0x00001f1c, 0x00003e38 } }, 704 706 { AR5K_DCU_GBL_IFS_MISC, 705 - { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } }, 707 + { 0x0000a0e0, 0x00005880, 0x0000b0e0 } }, 706 708 { AR5K_TIME_OUT, 707 - { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } }, 708 - { AR5K_PHY_TURBO, 709 - { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } }, 709 + { 0x03e803e8, 0x04200420, 0x08400840 } }, 710 710 { AR5K_PHY(8), 711 - { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } }, 711 + { 0x02020200, 0x02010200, 0x02020200 } }, 712 712 { AR5K_PHY_RF_CTL2, 713 - { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e, 0x00000e0e } }, 713 + { 0x00000e0e, 0x00000707, 0x00000e0e } }, 714 714 { AR5K_PHY_SETTLING, 715 - { 0x1372161c, 0x13721c25, 0x13721722, 0x137216a2, 0x13721c25 } }, 715 + { 0x1372161c, 0x13721722, 0x137216a2 } }, 716 716 { AR5K_PHY_AGCCTL, 717 - { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d18, 0x00009d10 } }, 717 + { 0x00009d10, 0x00009d18, 0x00009d18 } }, 718 718 { AR5K_PHY_NF, 719 - { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, 719 + { 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, 720 720 { AR5K_PHY_WEAK_OFDM_HIGH_THR, 721 - { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } }, 721 + { 0x409a4190, 0x409a4190, 0x409a4190 } }, 722 722 { AR5K_PHY(70), 723 - { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } }, 723 + { 0x000001b8, 0x00000084, 0x00000108 } }, 724 724 { AR5K_PHY_OFDM_SELFCORR, 725 - { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } }, 725 + { 0x10058a05, 0x10058a05, 0x10058a05 } }, 726 726 { 0xa230, 727 - { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } }, 727 + { 0x00000000, 0x00000000, 0x00000108 } }, 728 728 }; 729 729 730 730 /* Initial mode-specific settings for AR5212 + RF5111 (Written after ar5212_ini) */ 731 731 static const struct ath5k_ini_mode rf5111_ini_mode_end[] = { 732 732 { AR5K_TXCFG, 733 - /* a/XR aTurbo b g (DYN) gTurbo */ 734 - { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } }, 733 + /* A/XR B G */ 734 + { 0x00008015, 0x00008015, 0x00008015 } }, 735 735 { AR5K_USEC_5211, 736 - { 0x128d8fa7, 0x09880fcf, 0x04e00f95, 0x12e00fab, 0x09880fcf } }, 736 + { 0x128d8fa7, 0x04e00f95, 0x12e00fab } }, 737 737 { AR5K_PHY_RF_CTL3, 738 - { 0x0a020001, 0x0a020001, 0x05010100, 0x0a020001, 0x0a020001 } }, 738 + { 0x0a020001, 0x05010100, 0x0a020001 } }, 739 739 { AR5K_PHY_RF_CTL4, 740 - { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 740 + { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 741 741 { AR5K_PHY_PA_CTL, 742 - { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } }, 742 + { 0x00000007, 0x0000000b, 0x0000000b } }, 743 743 { AR5K_PHY_GAIN, 744 - { 0x0018da5a, 0x0018da5a, 0x0018ca69, 0x0018ca69, 0x0018ca69 } }, 744 + { 0x0018da5a, 0x0018ca69, 0x0018ca69 } }, 745 745 { AR5K_PHY_DESIRED_SIZE, 746 - { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, 746 + { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, 747 747 { AR5K_PHY_SIG, 748 - { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } }, 748 + { 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e } }, 749 749 { AR5K_PHY_AGCCOARSE, 750 - { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137615e } }, 750 + { 0x3137665e, 0x3137665e, 0x3137665e } }, 751 751 { AR5K_PHY_WEAK_OFDM_LOW_THR, 752 - { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb080, 0x050cb080 } }, 752 + { 0x050cb081, 0x050cb081, 0x050cb080 } }, 753 753 { AR5K_PHY_RX_DELAY, 754 - { 0x00002710, 0x00002710, 0x0000157c, 0x00002af8, 0x00002710 } }, 754 + { 0x00002710, 0x0000157c, 0x00002af8 } }, 755 755 { AR5K_PHY_FRAME_CTL_5211, 756 - { 0xf7b81020, 0xf7b81020, 0xf7b80d20, 0xf7b81020, 0xf7b81020 } }, 756 + { 0xf7b81020, 0xf7b80d20, 0xf7b81020 } }, 757 757 { AR5K_PHY_GAIN_2GHZ, 758 - { 0x642c416a, 0x642c416a, 0x6440416a, 0x6440416a, 0x6440416a } }, 758 + { 0x642c416a, 0x6440416a, 0x6440416a } }, 759 759 { AR5K_PHY_CCK_RX_CTL_4, 760 - { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } }, 760 + { 0x1883800a, 0x1873800a, 0x1883800a } }, 761 761 }; 762 762 763 763 static const struct ath5k_ini rf5111_ini_common_end[] = { ··· 778 782 /* Initial mode-specific settings for AR5212 + RF5112 (Written after ar5212_ini) */ 779 783 static const struct ath5k_ini_mode rf5112_ini_mode_end[] = { 780 784 { AR5K_TXCFG, 781 - /* a/XR aTurbo b g (DYN) gTurbo */ 782 - { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } }, 785 + /* A/XR B G */ 786 + { 0x00008015, 0x00008015, 0x00008015 } }, 783 787 { AR5K_USEC_5211, 784 - { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } }, 788 + { 0x128d93a7, 0x04e01395, 0x12e013ab } }, 785 789 { AR5K_PHY_RF_CTL3, 786 - { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } }, 790 + { 0x0a020001, 0x05020100, 0x0a020001 } }, 787 791 { AR5K_PHY_RF_CTL4, 788 - { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 792 + { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 789 793 { AR5K_PHY_PA_CTL, 790 - { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } }, 794 + { 0x00000007, 0x0000000b, 0x0000000b } }, 791 795 { AR5K_PHY_GAIN, 792 - { 0x0018da6d, 0x0018da6d, 0x0018ca75, 0x0018ca75, 0x0018ca75 } }, 796 + { 0x0018da6d, 0x0018ca75, 0x0018ca75 } }, 793 797 { AR5K_PHY_DESIRED_SIZE, 794 - { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, 798 + { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, 795 799 { AR5K_PHY_SIG, 796 - { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e, 0x7e800d2e } }, 800 + { 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e } }, 797 801 { AR5K_PHY_AGCCOARSE, 798 - { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e } }, 802 + { 0x3137665e, 0x3137665e, 0x3137665e } }, 799 803 { AR5K_PHY_WEAK_OFDM_LOW_THR, 800 - { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } }, 804 + { 0x050cb081, 0x050cb081, 0x050cb081 } }, 801 805 { AR5K_PHY_RX_DELAY, 802 - { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } }, 806 + { 0x000007d0, 0x0000044c, 0x00000898 } }, 803 807 { AR5K_PHY_FRAME_CTL_5211, 804 - { 0xf7b81020, 0xf7b81020, 0xf7b80d10, 0xf7b81010, 0xf7b81010 } }, 808 + { 0xf7b81020, 0xf7b80d10, 0xf7b81010 } }, 805 809 { AR5K_PHY_CCKTXCTL, 806 - { 0x00000000, 0x00000000, 0x00000008, 0x00000008, 0x00000008 } }, 810 + { 0x00000000, 0x00000008, 0x00000008 } }, 807 811 { AR5K_PHY_CCK_CROSSCORR, 808 - { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 812 + { 0xd6be6788, 0xd03e6788, 0xd03e6788 } }, 809 813 { AR5K_PHY_GAIN_2GHZ, 810 - { 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 } }, 814 + { 0x642c0140, 0x6442c160, 0x6442c160 } }, 811 815 { AR5K_PHY_CCK_RX_CTL_4, 812 - { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } }, 816 + { 0x1883800a, 0x1873800a, 0x1883800a } }, 813 817 }; 814 818 815 819 static const struct ath5k_ini rf5112_ini_common_end[] = { ··· 829 833 /* Initial mode-specific settings for RF5413/5414 (Written after ar5212_ini) */ 830 834 static const struct ath5k_ini_mode rf5413_ini_mode_end[] = { 831 835 { AR5K_TXCFG, 832 - /* a/XR aTurbo b g (DYN) gTurbo */ 833 - { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } }, 836 + /* A/XR B G */ 837 + { 0x00000015, 0x00000015, 0x00000015 } }, 834 838 { AR5K_USEC_5211, 835 - { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } }, 839 + { 0x128d93a7, 0x04e01395, 0x12e013ab } }, 836 840 { AR5K_PHY_RF_CTL3, 837 - { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } }, 841 + { 0x0a020001, 0x05020100, 0x0a020001 } }, 838 842 { AR5K_PHY_RF_CTL4, 839 - { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 843 + { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 840 844 { AR5K_PHY_PA_CTL, 841 - { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } }, 845 + { 0x00000007, 0x0000000b, 0x0000000b } }, 842 846 { AR5K_PHY_GAIN, 843 - { 0x0018fa61, 0x0018fa61, 0x001a1a63, 0x001a1a63, 0x001a1a63 } }, 847 + { 0x0018fa61, 0x001a1a63, 0x001a1a63 } }, 844 848 { AR5K_PHY_DESIRED_SIZE, 845 - { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } }, 849 + { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } }, 846 850 { AR5K_PHY_SIG, 847 - { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } }, 851 + { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } }, 848 852 { AR5K_PHY_AGCCOARSE, 849 - { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } }, 853 + { 0x3139605e, 0x3139605e, 0x3139605e } }, 850 854 { AR5K_PHY_WEAK_OFDM_LOW_THR, 851 - { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } }, 855 + { 0x050cb081, 0x050cb081, 0x050cb081 } }, 852 856 { AR5K_PHY_RX_DELAY, 853 - { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } }, 857 + { 0x000007d0, 0x0000044c, 0x00000898 } }, 854 858 { AR5K_PHY_FRAME_CTL_5211, 855 - { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } }, 859 + { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } }, 856 860 { AR5K_PHY_CCKTXCTL, 857 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 861 + { 0x00000000, 0x00000000, 0x00000000 } }, 858 862 { AR5K_PHY_CCK_CROSSCORR, 859 - { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 863 + { 0xd6be6788, 0xd03e6788, 0xd03e6788 } }, 860 864 { AR5K_PHY_GAIN_2GHZ, 861 - { 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 } }, 865 + { 0x002ec1e0, 0x002ac120, 0x002ac120 } }, 862 866 { AR5K_PHY_CCK_RX_CTL_4, 863 - { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } }, 867 + { 0x1883800a, 0x1863800a, 0x1883800a } }, 864 868 { 0xa300, 865 - { 0x18010000, 0x18010000, 0x18010000, 0x18010000, 0x18010000 } }, 869 + { 0x18010000, 0x18010000, 0x18010000 } }, 866 870 { 0xa304, 867 - { 0x30032602, 0x30032602, 0x30032602, 0x30032602, 0x30032602 } }, 871 + { 0x30032602, 0x30032602, 0x30032602 } }, 868 872 { 0xa308, 869 - { 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06 } }, 873 + { 0x48073e06, 0x48073e06, 0x48073e06 } }, 870 874 { 0xa30c, 871 - { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } }, 875 + { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } }, 872 876 { 0xa310, 873 - { 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f } }, 877 + { 0x641a600f, 0x641a600f, 0x641a600f } }, 874 878 { 0xa314, 875 - { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } }, 879 + { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } }, 876 880 { 0xa318, 877 - { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } }, 881 + { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } }, 878 882 { 0xa31c, 879 - { 0x90cf865b, 0x90cf865b, 0x8ecf865b, 0x8ecf865b, 0x8ecf865b } }, 883 + { 0x90cf865b, 0x8ecf865b, 0x8ecf865b } }, 880 884 { 0xa320, 881 - { 0x9d4f970f, 0x9d4f970f, 0x9b4f970f, 0x9b4f970f, 0x9b4f970f } }, 885 + { 0x9d4f970f, 0x9b4f970f, 0x9b4f970f } }, 882 886 { 0xa324, 883 - { 0xa7cfa38f, 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f, 0xa3cf9f8f } }, 887 + { 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f } }, 884 888 { 0xa328, 885 - { 0xb55faf1f, 0xb55faf1f, 0xb35faf1f, 0xb35faf1f, 0xb35faf1f } }, 889 + { 0xb55faf1f, 0xb35faf1f, 0xb35faf1f } }, 886 890 { 0xa32c, 887 - { 0xbddfb99f, 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f, 0xbbdfb99f } }, 891 + { 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f } }, 888 892 { 0xa330, 889 - { 0xcb7fc53f, 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f, 0xcb7fc73f } }, 893 + { 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f } }, 890 894 { 0xa334, 891 - { 0xd5ffd1bf, 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } }, 895 + { 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } }, 892 896 }; 893 897 894 898 static const struct ath5k_ini rf5413_ini_common_end[] = { ··· 968 972 /* XXX: a mode ? */ 969 973 static const struct ath5k_ini_mode rf2413_ini_mode_end[] = { 970 974 { AR5K_TXCFG, 971 - /* a/XR aTurbo b g (DYN) gTurbo */ 972 - { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } }, 975 + /* A/XR B G */ 976 + { 0x00000015, 0x00000015, 0x00000015 } }, 973 977 { AR5K_USEC_5211, 974 - { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } }, 978 + { 0x128d93a7, 0x04e01395, 0x12e013ab } }, 975 979 { AR5K_PHY_RF_CTL3, 976 - { 0x0a020001, 0x0a020001, 0x05020000, 0x0a020001, 0x0a020001 } }, 980 + { 0x0a020001, 0x05020000, 0x0a020001 } }, 977 981 { AR5K_PHY_RF_CTL4, 978 - { 0x00000e00, 0x00000e00, 0x00000e00, 0x00000e00, 0x00000e00 } }, 982 + { 0x00000e00, 0x00000e00, 0x00000e00 } }, 979 983 { AR5K_PHY_PA_CTL, 980 - { 0x00000002, 0x00000002, 0x0000000a, 0x0000000a, 0x0000000a } }, 984 + { 0x00000002, 0x0000000a, 0x0000000a } }, 981 985 { AR5K_PHY_GAIN, 982 - { 0x0018da6d, 0x0018da6d, 0x001a6a64, 0x001a6a64, 0x001a6a64 } }, 986 + { 0x0018da6d, 0x001a6a64, 0x001a6a64 } }, 983 987 { AR5K_PHY_DESIRED_SIZE, 984 - { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da, 0x0de8b0da } }, 988 + { 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da } }, 985 989 { AR5K_PHY_SIG, 986 - { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e, 0x7e800d2e } }, 990 + { 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e } }, 987 991 { AR5K_PHY_AGCCOARSE, 988 - { 0x3137665e, 0x3137665e, 0x3137665e, 0x3139605e, 0x3137665e } }, 992 + { 0x3137665e, 0x3137665e, 0x3139605e } }, 989 993 { AR5K_PHY_WEAK_OFDM_LOW_THR, 990 - { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } }, 994 + { 0x050cb081, 0x050cb081, 0x050cb081 } }, 991 995 { AR5K_PHY_RX_DELAY, 992 - { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } }, 996 + { 0x000007d0, 0x0000044c, 0x00000898 } }, 993 997 { AR5K_PHY_FRAME_CTL_5211, 994 - { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } }, 998 + { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } }, 995 999 { AR5K_PHY_CCKTXCTL, 996 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 1000 + { 0x00000000, 0x00000000, 0x00000000 } }, 997 1001 { AR5K_PHY_CCK_CROSSCORR, 998 - { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 1002 + { 0xd6be6788, 0xd03e6788, 0xd03e6788 } }, 999 1003 { AR5K_PHY_GAIN_2GHZ, 1000 - { 0x002c0140, 0x002c0140, 0x0042c140, 0x0042c140, 0x0042c140 } }, 1004 + { 0x002c0140, 0x0042c140, 0x0042c140 } }, 1001 1005 { AR5K_PHY_CCK_RX_CTL_4, 1002 - { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } }, 1006 + { 0x1883800a, 0x1863800a, 0x1883800a } }, 1003 1007 }; 1004 1008 1005 1009 static const struct ath5k_ini rf2413_ini_common_end[] = { ··· 1090 1094 /* XXX: a mode ? */ 1091 1095 static const struct ath5k_ini_mode rf2425_ini_mode_end[] = { 1092 1096 { AR5K_TXCFG, 1093 - /* a/XR aTurbo b g (DYN) gTurbo */ 1094 - { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } }, 1097 + /* A/XR B G */ 1098 + { 0x00000015, 0x00000015, 0x00000015 } }, 1095 1099 { AR5K_USEC_5211, 1096 - { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } }, 1097 - { AR5K_PHY_TURBO, 1098 - { 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000001 } }, 1100 + { 0x128d93a7, 0x04e01395, 0x12e013ab } }, 1099 1101 { AR5K_PHY_RF_CTL3, 1100 - { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } }, 1102 + { 0x0a020001, 0x05020100, 0x0a020001 } }, 1101 1103 { AR5K_PHY_RF_CTL4, 1102 - { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 1104 + { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 1103 1105 { AR5K_PHY_PA_CTL, 1104 - { 0x00000003, 0x00000003, 0x0000000b, 0x0000000b, 0x0000000b } }, 1106 + { 0x00000003, 0x0000000b, 0x0000000b } }, 1105 1107 { AR5K_PHY_SETTLING, 1106 - { 0x1372161c, 0x13721c25, 0x13721722, 0x13721422, 0x13721c25 } }, 1108 + { 0x1372161c, 0x13721722, 0x13721422 } }, 1107 1109 { AR5K_PHY_GAIN, 1108 - { 0x0018fa61, 0x0018fa61, 0x00199a65, 0x00199a65, 0x00199a65 } }, 1110 + { 0x0018fa61, 0x00199a65, 0x00199a65 } }, 1109 1111 { AR5K_PHY_DESIRED_SIZE, 1110 - { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } }, 1112 + { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } }, 1111 1113 { AR5K_PHY_SIG, 1112 - { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } }, 1114 + { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } }, 1113 1115 { AR5K_PHY_AGCCOARSE, 1114 - { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } }, 1116 + { 0x3139605e, 0x3139605e, 0x3139605e } }, 1115 1117 { AR5K_PHY_WEAK_OFDM_LOW_THR, 1116 - { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } }, 1118 + { 0x050cb081, 0x050cb081, 0x050cb081 } }, 1117 1119 { AR5K_PHY_RX_DELAY, 1118 - { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } }, 1120 + { 0x000007d0, 0x0000044c, 0x00000898 } }, 1119 1121 { AR5K_PHY_FRAME_CTL_5211, 1120 - { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } }, 1122 + { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } }, 1121 1123 { AR5K_PHY_CCKTXCTL, 1122 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 1124 + { 0x00000000, 0x00000000, 0x00000000 } }, 1123 1125 { AR5K_PHY_CCK_CROSSCORR, 1124 - { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 1126 + { 0xd6be6788, 0xd03e6788, 0xd03e6788 } }, 1125 1127 { AR5K_PHY_GAIN_2GHZ, 1126 - { 0x00000140, 0x00000140, 0x0052c140, 0x0052c140, 0x0052c140 } }, 1128 + { 0x00000140, 0x0052c140, 0x0052c140 } }, 1127 1129 { AR5K_PHY_CCK_RX_CTL_4, 1128 - { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } }, 1130 + { 0x1883800a, 0x1863800a, 0x1883800a } }, 1129 1131 { 0xa324, 1130 - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1132 + { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1131 1133 { 0xa328, 1132 - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1134 + { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1133 1135 { 0xa32c, 1134 - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1136 + { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1135 1137 { 0xa330, 1136 - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1138 + { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1137 1139 { 0xa334, 1138 - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1140 + { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1139 1141 }; 1140 1142 1141 1143 static const struct ath5k_ini rf2425_ini_common_end[] = { ··· 1362 1368 * Write initial register dump 1363 1369 */ 1364 1370 static void ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size, 1365 - const struct ath5k_ini *ini_regs, bool change_channel) 1371 + const struct ath5k_ini *ini_regs, bool skip_pcu) 1366 1372 { 1367 1373 unsigned int i; 1368 1374 1369 1375 /* Write initial registers */ 1370 1376 for (i = 0; i < size; i++) { 1371 - /* On channel change there is 1372 - * no need to mess with PCU */ 1373 - if (change_channel && 1377 + /* Skip PCU registers if 1378 + * requested */ 1379 + if (skip_pcu && 1374 1380 ini_regs[i].ini_register >= AR5K_PCU_MIN && 1375 1381 ini_regs[i].ini_register <= AR5K_PCU_MAX) 1376 1382 continue; ··· 1403 1409 1404 1410 } 1405 1411 1406 - int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel) 1412 + int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool skip_pcu) 1407 1413 { 1408 1414 /* 1409 1415 * Write initial register settings ··· 1421 1427 * Write initial settings common for all modes 1422 1428 */ 1423 1429 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini_common_start), 1424 - ar5212_ini_common_start, change_channel); 1430 + ar5212_ini_common_start, skip_pcu); 1425 1431 1426 1432 /* Second set of mode-specific settings */ 1427 1433 switch (ah->ah_radio) { ··· 1433 1439 1434 1440 ath5k_hw_ini_registers(ah, 1435 1441 ARRAY_SIZE(rf5111_ini_common_end), 1436 - rf5111_ini_common_end, change_channel); 1442 + rf5111_ini_common_end, skip_pcu); 1437 1443 1438 1444 /* Baseband gain table */ 1439 1445 ath5k_hw_ini_registers(ah, 1440 1446 ARRAY_SIZE(rf5111_ini_bbgain), 1441 - rf5111_ini_bbgain, change_channel); 1447 + rf5111_ini_bbgain, skip_pcu); 1442 1448 1443 1449 break; 1444 1450 case AR5K_RF5112: ··· 1449 1455 1450 1456 ath5k_hw_ini_registers(ah, 1451 1457 ARRAY_SIZE(rf5112_ini_common_end), 1452 - rf5112_ini_common_end, change_channel); 1458 + rf5112_ini_common_end, skip_pcu); 1453 1459 1454 1460 ath5k_hw_ini_registers(ah, 1455 1461 ARRAY_SIZE(rf5112_ini_bbgain), 1456 - rf5112_ini_bbgain, change_channel); 1462 + rf5112_ini_bbgain, skip_pcu); 1457 1463 1458 1464 break; 1459 1465 case AR5K_RF5413: ··· 1464 1470 1465 1471 ath5k_hw_ini_registers(ah, 1466 1472 ARRAY_SIZE(rf5413_ini_common_end), 1467 - rf5413_ini_common_end, change_channel); 1473 + rf5413_ini_common_end, skip_pcu); 1468 1474 1469 1475 ath5k_hw_ini_registers(ah, 1470 1476 ARRAY_SIZE(rf5112_ini_bbgain), 1471 - rf5112_ini_bbgain, change_channel); 1477 + rf5112_ini_bbgain, skip_pcu); 1472 1478 1473 1479 break; 1474 1480 case AR5K_RF2316: ··· 1480 1486 1481 1487 ath5k_hw_ini_registers(ah, 1482 1488 ARRAY_SIZE(rf2413_ini_common_end), 1483 - rf2413_ini_common_end, change_channel); 1489 + rf2413_ini_common_end, skip_pcu); 1484 1490 1485 1491 /* Override settings from rf2413_ini_common_end */ 1486 1492 if (ah->ah_radio == AR5K_RF2316) { ··· 1492 1498 1493 1499 ath5k_hw_ini_registers(ah, 1494 1500 ARRAY_SIZE(rf5112_ini_bbgain), 1495 - rf5112_ini_bbgain, change_channel); 1501 + rf5112_ini_bbgain, skip_pcu); 1496 1502 break; 1497 1503 case AR5K_RF2317: 1504 + 1505 + ath5k_hw_ini_mode_registers(ah, 1506 + ARRAY_SIZE(rf2413_ini_mode_end), 1507 + rf2413_ini_mode_end, mode); 1508 + 1509 + ath5k_hw_ini_registers(ah, 1510 + ARRAY_SIZE(rf2425_ini_common_end), 1511 + rf2425_ini_common_end, skip_pcu); 1512 + 1513 + /* Override settings from rf2413_ini_mode_end */ 1514 + ath5k_hw_reg_write(ah, 0x00180a65, AR5K_PHY_GAIN); 1515 + 1516 + /* Override settings from rf2413_ini_common_end */ 1517 + ath5k_hw_reg_write(ah, 0x00004000, AR5K_PHY_AGC); 1518 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TPC_RG5, 1519 + AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP, 0xa); 1520 + ath5k_hw_reg_write(ah, 0x800000a8, 0x8140); 1521 + ath5k_hw_reg_write(ah, 0x000000ff, 0x9958); 1522 + 1523 + ath5k_hw_ini_registers(ah, 1524 + ARRAY_SIZE(rf5112_ini_bbgain), 1525 + rf5112_ini_bbgain, skip_pcu); 1526 + break; 1498 1527 case AR5K_RF2425: 1499 1528 1500 1529 ath5k_hw_ini_mode_registers(ah, ··· 1526 1509 1527 1510 ath5k_hw_ini_registers(ah, 1528 1511 ARRAY_SIZE(rf2425_ini_common_end), 1529 - rf2425_ini_common_end, change_channel); 1512 + rf2425_ini_common_end, skip_pcu); 1530 1513 1531 1514 ath5k_hw_ini_registers(ah, 1532 1515 ARRAY_SIZE(rf5112_ini_bbgain), 1533 - rf5112_ini_bbgain, change_channel); 1516 + rf5112_ini_bbgain, skip_pcu); 1534 1517 break; 1535 1518 default: 1536 1519 return -EINVAL; ··· 1555 1538 * Write initial settings common for all modes 1556 1539 */ 1557 1540 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5211_ini), 1558 - ar5211_ini, change_channel); 1541 + ar5211_ini, skip_pcu); 1559 1542 1560 1543 /* AR5211 only comes with 5111 */ 1561 1544 1562 1545 /* Baseband gain table */ 1563 1546 ath5k_hw_ini_registers(ah, ARRAY_SIZE(rf5111_ini_bbgain), 1564 - rf5111_ini_bbgain, change_channel); 1547 + rf5111_ini_bbgain, skip_pcu); 1565 1548 /* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */ 1566 1549 } else if (ah->ah_version == AR5K_AR5210) { 1567 1550 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5210_ini), 1568 - ar5210_ini, change_channel); 1551 + ar5210_ini, skip_pcu); 1569 1552 } 1570 1553 1571 1554 return 0;
+10 -1
drivers/net/wireless/ath/ath5k/led.c
··· 133 133 led->led_dev.default_trigger = trigger; 134 134 led->led_dev.brightness_set = ath5k_led_brightness_set; 135 135 136 - err = led_classdev_register(&sc->pdev->dev, &led->led_dev); 136 + err = led_classdev_register(sc->dev, &led->led_dev); 137 137 if (err) { 138 138 ATH5K_WARN(sc, "could not register LED %s\n", name); 139 139 led->sc = NULL; ··· 161 161 { 162 162 int ret = 0; 163 163 struct ieee80211_hw *hw = sc->hw; 164 + #ifndef CONFIG_ATHEROS_AR231X 164 165 struct pci_dev *pdev = sc->pdev; 166 + #endif 165 167 char name[ATH5K_LED_MAX_NAME_LEN + 1]; 166 168 const struct pci_device_id *match; 167 169 170 + if (!sc->pdev) 171 + return 0; 172 + 173 + #ifdef CONFIG_ATHEROS_AR231X 174 + match = NULL; 175 + #else 168 176 match = pci_match_id(&ath5k_led_devices[0], pdev); 177 + #endif 169 178 if (match) { 170 179 __set_bit(ATH_STAT_LEDSOFT, sc->status); 171 180 sc->led_pin = ATH_PIN(match->driver_data);
+326
drivers/net/wireless/ath/ath5k/pci.c
··· 1 + /* 2 + * Copyright (c) 2008-2009 Atheros Communications Inc. 3 + * 4 + * Permission to use, copy, modify, and/or distribute this software for any 5 + * purpose with or without fee is hereby granted, provided that the above 6 + * copyright notice and this permission notice appear in all copies. 7 + * 8 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 + */ 16 + 17 + #include <linux/nl80211.h> 18 + #include <linux/pci.h> 19 + #include <linux/pci-aspm.h> 20 + #include "../ath.h" 21 + #include "ath5k.h" 22 + #include "debug.h" 23 + #include "base.h" 24 + #include "reg.h" 25 + 26 + /* Known PCI ids */ 27 + static DEFINE_PCI_DEVICE_TABLE(ath5k_pci_id_table) = { 28 + { PCI_VDEVICE(ATHEROS, 0x0207) }, /* 5210 early */ 29 + { PCI_VDEVICE(ATHEROS, 0x0007) }, /* 5210 */ 30 + { PCI_VDEVICE(ATHEROS, 0x0011) }, /* 5311 - this is on AHB bus !*/ 31 + { PCI_VDEVICE(ATHEROS, 0x0012) }, /* 5211 */ 32 + { PCI_VDEVICE(ATHEROS, 0x0013) }, /* 5212 */ 33 + { PCI_VDEVICE(3COM_2, 0x0013) }, /* 3com 5212 */ 34 + { PCI_VDEVICE(3COM, 0x0013) }, /* 3com 3CRDAG675 5212 */ 35 + { PCI_VDEVICE(ATHEROS, 0x1014) }, /* IBM minipci 5212 */ 36 + { PCI_VDEVICE(ATHEROS, 0x0014) }, /* 5212 combatible */ 37 + { PCI_VDEVICE(ATHEROS, 0x0015) }, /* 5212 combatible */ 38 + { PCI_VDEVICE(ATHEROS, 0x0016) }, /* 5212 combatible */ 39 + { PCI_VDEVICE(ATHEROS, 0x0017) }, /* 5212 combatible */ 40 + { PCI_VDEVICE(ATHEROS, 0x0018) }, /* 5212 combatible */ 41 + { PCI_VDEVICE(ATHEROS, 0x0019) }, /* 5212 combatible */ 42 + { PCI_VDEVICE(ATHEROS, 0x001a) }, /* 2413 Griffin-lite */ 43 + { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */ 44 + { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ 45 + { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ 46 + { 0 } 47 + }; 48 + 49 + /* return bus cachesize in 4B word units */ 50 + static void ath5k_pci_read_cachesize(struct ath_common *common, int *csz) 51 + { 52 + struct ath5k_softc *sc = (struct ath5k_softc *) common->priv; 53 + u8 u8tmp; 54 + 55 + pci_read_config_byte(sc->pdev, PCI_CACHE_LINE_SIZE, &u8tmp); 56 + *csz = (int)u8tmp; 57 + 58 + /* 59 + * This check was put in to avoid "unplesant" consequences if 60 + * the bootrom has not fully initialized all PCI devices. 61 + * Sometimes the cache line size register is not set 62 + */ 63 + 64 + if (*csz == 0) 65 + *csz = L1_CACHE_BYTES >> 2; /* Use the default size */ 66 + } 67 + 68 + /* 69 + * Read from eeprom 70 + */ 71 + bool ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data) 72 + { 73 + struct ath5k_hw *ah = (struct ath5k_hw *) common->ah; 74 + u32 status, timeout; 75 + 76 + /* 77 + * Initialize EEPROM access 78 + */ 79 + if (ah->ah_version == AR5K_AR5210) { 80 + AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, AR5K_PCICFG_EEAE); 81 + (void)ath5k_hw_reg_read(ah, AR5K_EEPROM_BASE + (4 * offset)); 82 + } else { 83 + ath5k_hw_reg_write(ah, offset, AR5K_EEPROM_BASE); 84 + AR5K_REG_ENABLE_BITS(ah, AR5K_EEPROM_CMD, 85 + AR5K_EEPROM_CMD_READ); 86 + } 87 + 88 + for (timeout = AR5K_TUNE_REGISTER_TIMEOUT; timeout > 0; timeout--) { 89 + status = ath5k_hw_reg_read(ah, AR5K_EEPROM_STATUS); 90 + if (status & AR5K_EEPROM_STAT_RDDONE) { 91 + if (status & AR5K_EEPROM_STAT_RDERR) 92 + return -EIO; 93 + *data = (u16)(ath5k_hw_reg_read(ah, AR5K_EEPROM_DATA) & 94 + 0xffff); 95 + return 0; 96 + } 97 + udelay(15); 98 + } 99 + 100 + return -ETIMEDOUT; 101 + } 102 + 103 + int ath5k_hw_read_srev(struct ath5k_hw *ah) 104 + { 105 + ah->ah_mac_srev = ath5k_hw_reg_read(ah, AR5K_SREV); 106 + return 0; 107 + } 108 + 109 + /* Common ath_bus_opts structure */ 110 + static const struct ath_bus_ops ath_pci_bus_ops = { 111 + .ath_bus_type = ATH_PCI, 112 + .read_cachesize = ath5k_pci_read_cachesize, 113 + .eeprom_read = ath5k_pci_eeprom_read, 114 + }; 115 + 116 + /********************\ 117 + * PCI Initialization * 118 + \********************/ 119 + 120 + static int __devinit 121 + ath5k_pci_probe(struct pci_dev *pdev, 122 + const struct pci_device_id *id) 123 + { 124 + void __iomem *mem; 125 + struct ath5k_softc *sc; 126 + struct ieee80211_hw *hw; 127 + int ret; 128 + u8 csz; 129 + 130 + /* 131 + * L0s needs to be disabled on all ath5k cards. 132 + * 133 + * For distributions shipping with CONFIG_PCIEASPM (this will be enabled 134 + * by default in the future in 2.6.36) this will also mean both L1 and 135 + * L0s will be disabled when a pre 1.1 PCIe device is detected. We do 136 + * know L1 works correctly even for all ath5k pre 1.1 PCIe devices 137 + * though but cannot currently undue the effect of a blacklist, for 138 + * details you can read pcie_aspm_sanity_check() and see how it adjusts 139 + * the device link capability. 140 + * 141 + * It may be possible in the future to implement some PCI API to allow 142 + * drivers to override blacklists for pre 1.1 PCIe but for now it is 143 + * best to accept that both L0s and L1 will be disabled completely for 144 + * distributions shipping with CONFIG_PCIEASPM rather than having this 145 + * issue present. Motivation for adding this new API will be to help 146 + * with power consumption for some of these devices. 147 + */ 148 + pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S); 149 + 150 + ret = pci_enable_device(pdev); 151 + if (ret) { 152 + dev_err(&pdev->dev, "can't enable device\n"); 153 + goto err; 154 + } 155 + 156 + /* XXX 32-bit addressing only */ 157 + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 158 + if (ret) { 159 + dev_err(&pdev->dev, "32-bit DMA not available\n"); 160 + goto err_dis; 161 + } 162 + 163 + /* 164 + * Cache line size is used to size and align various 165 + * structures used to communicate with the hardware. 166 + */ 167 + pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &csz); 168 + if (csz == 0) { 169 + /* 170 + * Linux 2.4.18 (at least) writes the cache line size 171 + * register as a 16-bit wide register which is wrong. 172 + * We must have this setup properly for rx buffer 173 + * DMA to work so force a reasonable value here if it 174 + * comes up zero. 175 + */ 176 + csz = L1_CACHE_BYTES >> 2; 177 + pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, csz); 178 + } 179 + /* 180 + * The default setting of latency timer yields poor results, 181 + * set it to the value used by other systems. It may be worth 182 + * tweaking this setting more. 183 + */ 184 + pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xa8); 185 + 186 + /* Enable bus mastering */ 187 + pci_set_master(pdev); 188 + 189 + /* 190 + * Disable the RETRY_TIMEOUT register (0x41) to keep 191 + * PCI Tx retries from interfering with C3 CPU state. 192 + */ 193 + pci_write_config_byte(pdev, 0x41, 0); 194 + 195 + ret = pci_request_region(pdev, 0, "ath5k"); 196 + if (ret) { 197 + dev_err(&pdev->dev, "cannot reserve PCI memory region\n"); 198 + goto err_dis; 199 + } 200 + 201 + mem = pci_iomap(pdev, 0, 0); 202 + if (!mem) { 203 + dev_err(&pdev->dev, "cannot remap PCI memory region\n") ; 204 + ret = -EIO; 205 + goto err_reg; 206 + } 207 + 208 + /* 209 + * Allocate hw (mac80211 main struct) 210 + * and hw->priv (driver private data) 211 + */ 212 + hw = ieee80211_alloc_hw(sizeof(*sc), &ath5k_hw_ops); 213 + if (hw == NULL) { 214 + dev_err(&pdev->dev, "cannot allocate ieee80211_hw\n"); 215 + ret = -ENOMEM; 216 + goto err_map; 217 + } 218 + 219 + dev_info(&pdev->dev, "registered as '%s'\n", wiphy_name(hw->wiphy)); 220 + 221 + sc = hw->priv; 222 + sc->hw = hw; 223 + sc->pdev = pdev; 224 + sc->dev = &pdev->dev; 225 + sc->irq = pdev->irq; 226 + sc->devid = id->device; 227 + sc->iobase = mem; /* So we can unmap it on detach */ 228 + 229 + /* Initialize */ 230 + ret = ath5k_init_softc(sc, &ath_pci_bus_ops); 231 + if (ret) 232 + goto err_free; 233 + 234 + /* Set private data */ 235 + pci_set_drvdata(pdev, hw); 236 + 237 + return 0; 238 + err_free: 239 + ieee80211_free_hw(hw); 240 + err_map: 241 + pci_iounmap(pdev, mem); 242 + err_reg: 243 + pci_release_region(pdev, 0); 244 + err_dis: 245 + pci_disable_device(pdev); 246 + err: 247 + return ret; 248 + } 249 + 250 + static void __devexit 251 + ath5k_pci_remove(struct pci_dev *pdev) 252 + { 253 + struct ieee80211_hw *hw = pci_get_drvdata(pdev); 254 + struct ath5k_softc *sc = hw->priv; 255 + 256 + ath5k_deinit_softc(sc); 257 + pci_iounmap(pdev, sc->iobase); 258 + pci_release_region(pdev, 0); 259 + pci_disable_device(pdev); 260 + ieee80211_free_hw(hw); 261 + } 262 + 263 + #ifdef CONFIG_PM_SLEEP 264 + static int ath5k_pci_suspend(struct device *dev) 265 + { 266 + struct ath5k_softc *sc = pci_get_drvdata(to_pci_dev(dev)); 267 + 268 + ath5k_led_off(sc); 269 + return 0; 270 + } 271 + 272 + static int ath5k_pci_resume(struct device *dev) 273 + { 274 + struct pci_dev *pdev = to_pci_dev(dev); 275 + struct ath5k_softc *sc = pci_get_drvdata(pdev); 276 + 277 + /* 278 + * Suspend/Resume resets the PCI configuration space, so we have to 279 + * re-disable the RETRY_TIMEOUT register (0x41) to keep 280 + * PCI Tx retries from interfering with C3 CPU state 281 + */ 282 + pci_write_config_byte(pdev, 0x41, 0); 283 + 284 + ath5k_led_enable(sc); 285 + return 0; 286 + } 287 + 288 + static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume); 289 + #define ATH5K_PM_OPS (&ath5k_pm_ops) 290 + #else 291 + #define ATH5K_PM_OPS NULL 292 + #endif /* CONFIG_PM_SLEEP */ 293 + 294 + static struct pci_driver ath5k_pci_driver = { 295 + .name = KBUILD_MODNAME, 296 + .id_table = ath5k_pci_id_table, 297 + .probe = ath5k_pci_probe, 298 + .remove = __devexit_p(ath5k_pci_remove), 299 + .driver.pm = ATH5K_PM_OPS, 300 + }; 301 + 302 + /* 303 + * Module init/exit functions 304 + */ 305 + static int __init 306 + init_ath5k_pci(void) 307 + { 308 + int ret; 309 + 310 + ret = pci_register_driver(&ath5k_pci_driver); 311 + if (ret) { 312 + printk(KERN_ERR "ath5k_pci: can't register pci driver\n"); 313 + return ret; 314 + } 315 + 316 + return 0; 317 + } 318 + 319 + static void __exit 320 + exit_ath5k_pci(void) 321 + { 322 + pci_unregister_driver(&ath5k_pci_driver); 323 + } 324 + 325 + module_init(init_ath5k_pci); 326 + module_exit(exit_ath5k_pci);
+388 -205
drivers/net/wireless/ath/ath5k/pcu.c
··· 31 31 #include "debug.h" 32 32 #include "base.h" 33 33 34 + /* 35 + * AR5212+ can use higher rates for ack transmition 36 + * based on current tx rate instead of the base rate. 37 + * It does this to better utilize channel usage. 38 + * This is a mapping between G rates (that cover both 39 + * CCK and OFDM) and ack rates that we use when setting 40 + * rate -> duration table. This mapping is hw-based so 41 + * don't change anything. 42 + * 43 + * To enable this functionality we must set 44 + * ah->ah_ack_bitrate_high to true else base rate is 45 + * used (1Mb for CCK, 6Mb for OFDM). 46 + */ 47 + static const unsigned int ack_rates_high[] = 48 + /* Tx -> ACK */ 49 + /* 1Mb -> 1Mb */ { 0, 50 + /* 2MB -> 2Mb */ 1, 51 + /* 5.5Mb -> 2Mb */ 1, 52 + /* 11Mb -> 2Mb */ 1, 53 + /* 6Mb -> 6Mb */ 4, 54 + /* 9Mb -> 6Mb */ 4, 55 + /* 12Mb -> 12Mb */ 6, 56 + /* 18Mb -> 12Mb */ 6, 57 + /* 24Mb -> 24Mb */ 8, 58 + /* 36Mb -> 24Mb */ 8, 59 + /* 48Mb -> 24Mb */ 8, 60 + /* 54Mb -> 24Mb */ 8 }; 61 + 34 62 /*******************\ 35 - * Generic functions * 63 + * Helper functions * 36 64 \*******************/ 37 65 38 66 /** 39 - * ath5k_hw_set_opmode - Set PCU operating mode 67 + * ath5k_hw_get_frame_duration - Get tx time of a frame 40 68 * 41 69 * @ah: The &struct ath5k_hw 42 - * @op_mode: &enum nl80211_iftype operating mode 70 + * @len: Frame's length in bytes 71 + * @rate: The @struct ieee80211_rate 43 72 * 44 - * Initialize PCU for the various operating modes (AP/STA etc) 73 + * Calculate tx duration of a frame given it's rate and length 74 + * It extends ieee80211_generic_frame_duration for non standard 75 + * bwmodes. 45 76 */ 46 - int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode) 77 + int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, 78 + int len, struct ieee80211_rate *rate) 47 79 { 48 - struct ath_common *common = ath5k_hw_common(ah); 49 - u32 pcu_reg, beacon_reg, low_id, high_id; 80 + struct ath5k_softc *sc = ah->ah_sc; 81 + int sifs, preamble, plcp_bits, sym_time; 82 + int bitrate, bits, symbols, symbol_bits; 83 + int dur; 50 84 51 - ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_MODE, "mode %d\n", op_mode); 52 - 53 - /* Preserve rest settings */ 54 - pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; 55 - pcu_reg &= ~(AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_AP 56 - | AR5K_STA_ID1_KEYSRCH_MODE 57 - | (ah->ah_version == AR5K_AR5210 ? 58 - (AR5K_STA_ID1_PWR_SV | AR5K_STA_ID1_NO_PSPOLL) : 0)); 59 - 60 - beacon_reg = 0; 61 - 62 - switch (op_mode) { 63 - case NL80211_IFTYPE_ADHOC: 64 - pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_KEYSRCH_MODE; 65 - beacon_reg |= AR5K_BCR_ADHOC; 66 - if (ah->ah_version == AR5K_AR5210) 67 - pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; 68 - else 69 - AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); 70 - break; 71 - 72 - case NL80211_IFTYPE_AP: 73 - case NL80211_IFTYPE_MESH_POINT: 74 - pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_KEYSRCH_MODE; 75 - beacon_reg |= AR5K_BCR_AP; 76 - if (ah->ah_version == AR5K_AR5210) 77 - pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; 78 - else 79 - AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); 80 - break; 81 - 82 - case NL80211_IFTYPE_STATION: 83 - pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE 84 - | (ah->ah_version == AR5K_AR5210 ? 85 - AR5K_STA_ID1_PWR_SV : 0); 86 - case NL80211_IFTYPE_MONITOR: 87 - pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE 88 - | (ah->ah_version == AR5K_AR5210 ? 89 - AR5K_STA_ID1_NO_PSPOLL : 0); 90 - break; 91 - 92 - default: 93 - return -EINVAL; 85 + /* Fallback */ 86 + if (!ah->ah_bwmode) { 87 + dur = ieee80211_generic_frame_duration(sc->hw, 88 + NULL, len, rate); 89 + return dur; 94 90 } 95 91 96 - /* 97 - * Set PCU registers 98 - */ 99 - low_id = get_unaligned_le32(common->macaddr); 100 - high_id = get_unaligned_le16(common->macaddr + 4); 101 - ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); 102 - ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); 92 + bitrate = rate->bitrate; 93 + preamble = AR5K_INIT_OFDM_PREAMPLE_TIME; 94 + plcp_bits = AR5K_INIT_OFDM_PLCP_BITS; 95 + sym_time = AR5K_INIT_OFDM_SYMBOL_TIME; 103 96 104 - /* 105 - * Set Beacon Control Register on 5210 106 - */ 107 - if (ah->ah_version == AR5K_AR5210) 108 - ath5k_hw_reg_write(ah, beacon_reg, AR5K_BCR); 97 + switch (ah->ah_bwmode) { 98 + case AR5K_BWMODE_40MHZ: 99 + sifs = AR5K_INIT_SIFS_TURBO; 100 + preamble = AR5K_INIT_OFDM_PREAMBLE_TIME_MIN; 101 + break; 102 + case AR5K_BWMODE_10MHZ: 103 + sifs = AR5K_INIT_SIFS_HALF_RATE; 104 + preamble *= 2; 105 + sym_time *= 2; 106 + break; 107 + case AR5K_BWMODE_5MHZ: 108 + sifs = AR5K_INIT_SIFS_QUARTER_RATE; 109 + preamble *= 4; 110 + sym_time *= 4; 111 + break; 112 + default: 113 + sifs = AR5K_INIT_SIFS_DEFAULT_BG; 114 + break; 115 + } 109 116 110 - return 0; 117 + bits = plcp_bits + (len << 3); 118 + /* Bit rate is in 100Kbits */ 119 + symbol_bits = bitrate * sym_time; 120 + symbols = DIV_ROUND_UP(bits * 10, symbol_bits); 121 + 122 + dur = sifs + preamble + (sym_time * symbols); 123 + 124 + return dur; 111 125 } 112 126 113 127 /** 114 - * ath5k_hw_update - Update MIB counters (mac layer statistics) 128 + * ath5k_hw_get_default_slottime - Get the default slot time for current mode 129 + * 130 + * @ah: The &struct ath5k_hw 131 + */ 132 + unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah) 133 + { 134 + struct ieee80211_channel *channel = ah->ah_current_channel; 135 + unsigned int slot_time; 136 + 137 + switch (ah->ah_bwmode) { 138 + case AR5K_BWMODE_40MHZ: 139 + slot_time = AR5K_INIT_SLOT_TIME_TURBO; 140 + break; 141 + case AR5K_BWMODE_10MHZ: 142 + slot_time = AR5K_INIT_SLOT_TIME_HALF_RATE; 143 + break; 144 + case AR5K_BWMODE_5MHZ: 145 + slot_time = AR5K_INIT_SLOT_TIME_QUARTER_RATE; 146 + break; 147 + case AR5K_BWMODE_DEFAULT: 148 + slot_time = AR5K_INIT_SLOT_TIME_DEFAULT; 149 + default: 150 + if (channel->hw_value & CHANNEL_CCK) 151 + slot_time = AR5K_INIT_SLOT_TIME_B; 152 + break; 153 + } 154 + 155 + return slot_time; 156 + } 157 + 158 + /** 159 + * ath5k_hw_get_default_sifs - Get the default SIFS for current mode 160 + * 161 + * @ah: The &struct ath5k_hw 162 + */ 163 + unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah) 164 + { 165 + struct ieee80211_channel *channel = ah->ah_current_channel; 166 + unsigned int sifs; 167 + 168 + switch (ah->ah_bwmode) { 169 + case AR5K_BWMODE_40MHZ: 170 + sifs = AR5K_INIT_SIFS_TURBO; 171 + break; 172 + case AR5K_BWMODE_10MHZ: 173 + sifs = AR5K_INIT_SIFS_HALF_RATE; 174 + break; 175 + case AR5K_BWMODE_5MHZ: 176 + sifs = AR5K_INIT_SIFS_QUARTER_RATE; 177 + break; 178 + case AR5K_BWMODE_DEFAULT: 179 + sifs = AR5K_INIT_SIFS_DEFAULT_BG; 180 + default: 181 + if (channel->hw_value & CHANNEL_5GHZ) 182 + sifs = AR5K_INIT_SIFS_DEFAULT_A; 183 + break; 184 + } 185 + 186 + return sifs; 187 + } 188 + 189 + /** 190 + * ath5k_hw_update_mib_counters - Update MIB counters (mac layer statistics) 115 191 * 116 192 * @ah: The &struct ath5k_hw 117 193 * ··· 209 133 stats->beacons += ath5k_hw_reg_read(ah, AR5K_BEACON_CNT); 210 134 } 211 135 212 - /** 213 - * ath5k_hw_set_ack_bitrate - set bitrate for ACKs 214 - * 215 - * @ah: The &struct ath5k_hw 216 - * @high: Flag to determine if we want to use high transmission rate 217 - * for ACKs or not 218 - * 219 - * If high flag is set, we tell hw to use a set of control rates based on 220 - * the current transmission rate (check out control_rates array inside reset.c). 221 - * If not hw just uses the lowest rate available for the current modulation 222 - * scheme being used (1Mbit for CCK and 6Mbits for OFDM). 223 - */ 224 - void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high) 225 - { 226 - if (ah->ah_version != AR5K_AR5212) 227 - return; 228 - else { 229 - u32 val = AR5K_STA_ID1_BASE_RATE_11B | AR5K_STA_ID1_ACKCTS_6MB; 230 - if (high) 231 - AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, val); 232 - else 233 - AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, val); 234 - } 235 - } 236 - 237 136 238 137 /******************\ 239 138 * ACK/CTS Timeouts * 240 139 \******************/ 140 + 141 + /** 142 + * ath5k_hw_write_rate_duration - fill rate code to duration table 143 + * 144 + * @ah: the &struct ath5k_hw 145 + * @mode: one of enum ath5k_driver_mode 146 + * 147 + * Write the rate code to duration table upon hw reset. This is a helper for 148 + * ath5k_hw_pcu_init(). It seems all this is doing is setting an ACK timeout on 149 + * the hardware, based on current mode, for each rate. The rates which are 150 + * capable of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have 151 + * different rate code so we write their value twice (one for long preamble 152 + * and one for short). 153 + * 154 + * Note: Band doesn't matter here, if we set the values for OFDM it works 155 + * on both a and g modes. So all we have to do is set values for all g rates 156 + * that include all OFDM and CCK rates. 157 + * 158 + */ 159 + static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah) 160 + { 161 + struct ath5k_softc *sc = ah->ah_sc; 162 + struct ieee80211_rate *rate; 163 + unsigned int i; 164 + /* 802.11g covers both OFDM and CCK */ 165 + u8 band = IEEE80211_BAND_2GHZ; 166 + 167 + /* Write rate duration table */ 168 + for (i = 0; i < sc->sbands[band].n_bitrates; i++) { 169 + u32 reg; 170 + u16 tx_time; 171 + 172 + if (ah->ah_ack_bitrate_high) 173 + rate = &sc->sbands[band].bitrates[ack_rates_high[i]]; 174 + /* CCK -> 1Mb */ 175 + else if (i < 4) 176 + rate = &sc->sbands[band].bitrates[0]; 177 + /* OFDM -> 6Mb */ 178 + else 179 + rate = &sc->sbands[band].bitrates[4]; 180 + 181 + /* Set ACK timeout */ 182 + reg = AR5K_RATE_DUR(rate->hw_value); 183 + 184 + /* An ACK frame consists of 10 bytes. If you add the FCS, 185 + * which ieee80211_generic_frame_duration() adds, 186 + * its 14 bytes. Note we use the control rate and not the 187 + * actual rate for this rate. See mac80211 tx.c 188 + * ieee80211_duration() for a brief description of 189 + * what rate we should choose to TX ACKs. */ 190 + tx_time = ath5k_hw_get_frame_duration(ah, 10, rate); 191 + 192 + tx_time = le16_to_cpu(tx_time); 193 + 194 + ath5k_hw_reg_write(ah, tx_time, reg); 195 + 196 + if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) 197 + continue; 198 + 199 + /* 200 + * We're not distinguishing short preamble here, 201 + * This is true, all we'll get is a longer value here 202 + * which is not necessarilly bad. We could use 203 + * export ieee80211_frame_duration() but that needs to be 204 + * fixed first to be properly used by mac802111 drivers: 205 + * 206 + * - remove erp stuff and let the routine figure ofdm 207 + * erp rates 208 + * - remove passing argument ieee80211_local as 209 + * drivers don't have access to it 210 + * - move drivers using ieee80211_generic_frame_duration() 211 + * to this 212 + */ 213 + ath5k_hw_reg_write(ah, tx_time, 214 + reg + (AR5K_SET_SHORT_PREAMBLE << 2)); 215 + } 216 + } 241 217 242 218 /** 243 219 * ath5k_hw_set_ack_timeout - Set ACK timeout on PCU ··· 327 199 return 0; 328 200 } 329 201 330 - /** 331 - * ath5k_hw_htoclock - Translate usec to hw clock units 332 - * 333 - * @ah: The &struct ath5k_hw 334 - * @usec: value in microseconds 335 - */ 336 - unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec) 337 - { 338 - struct ath_common *common = ath5k_hw_common(ah); 339 - return usec * common->clockrate; 340 - } 341 202 342 - /** 343 - * ath5k_hw_clocktoh - Translate hw clock units to usec 344 - * @clock: value in hw clock units 345 - */ 346 - unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock) 347 - { 348 - struct ath_common *common = ath5k_hw_common(ah); 349 - return clock / common->clockrate; 350 - } 351 - 352 - /** 353 - * ath5k_hw_set_clockrate - Set common->clockrate for the current channel 354 - * 355 - * @ah: The &struct ath5k_hw 356 - */ 357 - void ath5k_hw_set_clockrate(struct ath5k_hw *ah) 358 - { 359 - struct ieee80211_channel *channel = ah->ah_current_channel; 360 - struct ath_common *common = ath5k_hw_common(ah); 361 - int clock; 362 - 363 - if (channel->hw_value & CHANNEL_5GHZ) 364 - clock = 40; /* 802.11a */ 365 - else if (channel->hw_value & CHANNEL_CCK) 366 - clock = 22; /* 802.11b */ 367 - else 368 - clock = 44; /* 802.11g */ 369 - 370 - /* Clock rate in turbo modes is twice the normal rate */ 371 - if (channel->hw_value & CHANNEL_TURBO) 372 - clock *= 2; 373 - 374 - common->clockrate = clock; 375 - } 376 - 377 - /** 378 - * ath5k_hw_get_default_slottime - Get the default slot time for current mode 379 - * 380 - * @ah: The &struct ath5k_hw 381 - */ 382 - static unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah) 383 - { 384 - struct ieee80211_channel *channel = ah->ah_current_channel; 385 - 386 - if (channel->hw_value & CHANNEL_TURBO) 387 - return 6; /* both turbo modes */ 388 - 389 - if (channel->hw_value & CHANNEL_CCK) 390 - return 20; /* 802.11b */ 391 - 392 - return 9; /* 802.11 a/g */ 393 - } 394 - 395 - /** 396 - * ath5k_hw_get_default_sifs - Get the default SIFS for current mode 397 - * 398 - * @ah: The &struct ath5k_hw 399 - */ 400 - static unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah) 401 - { 402 - struct ieee80211_channel *channel = ah->ah_current_channel; 403 - 404 - if (channel->hw_value & CHANNEL_TURBO) 405 - return 8; /* both turbo modes */ 406 - 407 - if (channel->hw_value & CHANNEL_5GHZ) 408 - return 16; /* 802.11a */ 409 - 410 - return 10; /* 802.11 b/g */ 411 - } 203 + /*******************\ 204 + * RX filter Control * 205 + \*******************/ 412 206 413 207 /** 414 208 * ath5k_hw_set_lladdr - Set station id ··· 410 360 memcpy(common->bssidmask, mask, ETH_ALEN); 411 361 if (ah->ah_version == AR5K_AR5212) 412 362 ath_hw_setbssidmask(common); 413 - } 414 - 415 - /************\ 416 - * RX Control * 417 - \************/ 418 - 419 - /** 420 - * ath5k_hw_start_rx_pcu - Start RX engine 421 - * 422 - * @ah: The &struct ath5k_hw 423 - * 424 - * Starts RX engine on PCU so that hw can process RXed frames 425 - * (ACK etc). 426 - * 427 - * NOTE: RX DMA should be already enabled using ath5k_hw_start_rx_dma 428 - */ 429 - void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah) 430 - { 431 - AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX); 432 - } 433 - 434 - /** 435 - * at5k_hw_stop_rx_pcu - Stop RX engine 436 - * 437 - * @ah: The &struct ath5k_hw 438 - * 439 - * Stops RX engine on PCU 440 - * 441 - * TODO: Detach ANI here 442 - */ 443 - void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah) 444 - { 445 - AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX); 446 363 } 447 364 448 365 /* ··· 763 746 * @ah: The &struct ath5k_hw 764 747 * @coverage_class: IEEE 802.11 coverage class number 765 748 * 766 - * Sets slot time, ACK timeout and CTS timeout for given coverage class. 749 + * Sets IFS intervals and ACK/CTS timeouts for given coverage class. 767 750 */ 768 751 void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class) 769 752 { ··· 772 755 int ack_timeout = ath5k_hw_get_default_sifs(ah) + slot_time; 773 756 int cts_timeout = ack_timeout; 774 757 775 - ath5k_hw_set_slot_time(ah, slot_time); 758 + ath5k_hw_set_ifs_intervals(ah, slot_time); 776 759 ath5k_hw_set_ack_timeout(ah, ack_timeout); 777 760 ath5k_hw_set_cts_timeout(ah, cts_timeout); 778 761 779 762 ah->ah_coverage_class = coverage_class; 763 + } 764 + 765 + /***************************\ 766 + * Init/Start/Stop functions * 767 + \***************************/ 768 + 769 + /** 770 + * ath5k_hw_start_rx_pcu - Start RX engine 771 + * 772 + * @ah: The &struct ath5k_hw 773 + * 774 + * Starts RX engine on PCU so that hw can process RXed frames 775 + * (ACK etc). 776 + * 777 + * NOTE: RX DMA should be already enabled using ath5k_hw_start_rx_dma 778 + */ 779 + void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah) 780 + { 781 + AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX); 782 + } 783 + 784 + /** 785 + * at5k_hw_stop_rx_pcu - Stop RX engine 786 + * 787 + * @ah: The &struct ath5k_hw 788 + * 789 + * Stops RX engine on PCU 790 + */ 791 + void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah) 792 + { 793 + AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX); 794 + } 795 + 796 + /** 797 + * ath5k_hw_set_opmode - Set PCU operating mode 798 + * 799 + * @ah: The &struct ath5k_hw 800 + * @op_mode: &enum nl80211_iftype operating mode 801 + * 802 + * Configure PCU for the various operating modes (AP/STA etc) 803 + */ 804 + int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode) 805 + { 806 + struct ath_common *common = ath5k_hw_common(ah); 807 + u32 pcu_reg, beacon_reg, low_id, high_id; 808 + 809 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_MODE, "mode %d\n", op_mode); 810 + 811 + /* Preserve rest settings */ 812 + pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; 813 + pcu_reg &= ~(AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_AP 814 + | AR5K_STA_ID1_KEYSRCH_MODE 815 + | (ah->ah_version == AR5K_AR5210 ? 816 + (AR5K_STA_ID1_PWR_SV | AR5K_STA_ID1_NO_PSPOLL) : 0)); 817 + 818 + beacon_reg = 0; 819 + 820 + switch (op_mode) { 821 + case NL80211_IFTYPE_ADHOC: 822 + pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_KEYSRCH_MODE; 823 + beacon_reg |= AR5K_BCR_ADHOC; 824 + if (ah->ah_version == AR5K_AR5210) 825 + pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; 826 + else 827 + AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); 828 + break; 829 + 830 + case NL80211_IFTYPE_AP: 831 + case NL80211_IFTYPE_MESH_POINT: 832 + pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_KEYSRCH_MODE; 833 + beacon_reg |= AR5K_BCR_AP; 834 + if (ah->ah_version == AR5K_AR5210) 835 + pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; 836 + else 837 + AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); 838 + break; 839 + 840 + case NL80211_IFTYPE_STATION: 841 + pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE 842 + | (ah->ah_version == AR5K_AR5210 ? 843 + AR5K_STA_ID1_PWR_SV : 0); 844 + case NL80211_IFTYPE_MONITOR: 845 + pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE 846 + | (ah->ah_version == AR5K_AR5210 ? 847 + AR5K_STA_ID1_NO_PSPOLL : 0); 848 + break; 849 + 850 + default: 851 + return -EINVAL; 852 + } 853 + 854 + /* 855 + * Set PCU registers 856 + */ 857 + low_id = get_unaligned_le32(common->macaddr); 858 + high_id = get_unaligned_le16(common->macaddr + 4); 859 + ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); 860 + ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); 861 + 862 + /* 863 + * Set Beacon Control Register on 5210 864 + */ 865 + if (ah->ah_version == AR5K_AR5210) 866 + ath5k_hw_reg_write(ah, beacon_reg, AR5K_BCR); 867 + 868 + return 0; 869 + } 870 + 871 + void ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode, 872 + u8 mode) 873 + { 874 + /* Set bssid and bssid mask */ 875 + ath5k_hw_set_bssid(ah); 876 + 877 + /* Set PCU config */ 878 + ath5k_hw_set_opmode(ah, op_mode); 879 + 880 + /* Write rate duration table only on AR5212 and if 881 + * virtual interface has already been brought up 882 + * XXX: rethink this after new mode changes to 883 + * mac80211 are integrated */ 884 + if (ah->ah_version == AR5K_AR5212 && 885 + ah->ah_sc->nvifs) 886 + ath5k_hw_write_rate_duration(ah); 887 + 888 + /* Set RSSI/BRSSI thresholds 889 + * 890 + * Note: If we decide to set this value 891 + * dynamicaly, have in mind that when AR5K_RSSI_THR 892 + * register is read it might return 0x40 if we haven't 893 + * wrote anything to it plus BMISS RSSI threshold is zeroed. 894 + * So doing a save/restore procedure here isn't the right 895 + * choice. Instead store it on ath5k_hw */ 896 + ath5k_hw_reg_write(ah, (AR5K_TUNE_RSSI_THRES | 897 + AR5K_TUNE_BMISS_THRES << 898 + AR5K_RSSI_THR_BMISS_S), 899 + AR5K_RSSI_THR); 900 + 901 + /* MIC QoS support */ 902 + if (ah->ah_mac_srev >= AR5K_SREV_AR2413) { 903 + ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL); 904 + ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL); 905 + } 906 + 907 + /* QoS NOACK Policy */ 908 + if (ah->ah_version == AR5K_AR5212) { 909 + ath5k_hw_reg_write(ah, 910 + AR5K_REG_SM(2, AR5K_QOS_NOACK_2BIT_VALUES) | 911 + AR5K_REG_SM(5, AR5K_QOS_NOACK_BIT_OFFSET) | 912 + AR5K_REG_SM(0, AR5K_QOS_NOACK_BYTE_OFFSET), 913 + AR5K_QOS_NOACK); 914 + } 915 + 916 + /* Restore slot time and ACK timeouts */ 917 + if (ah->ah_coverage_class > 0) 918 + ath5k_hw_set_coverage_class(ah, ah->ah_coverage_class); 919 + 920 + /* Set ACK bitrate mode (see ack_rates_high) */ 921 + if (ah->ah_version == AR5K_AR5212) { 922 + u32 val = AR5K_STA_ID1_BASE_RATE_11B | AR5K_STA_ID1_ACKCTS_6MB; 923 + if (ah->ah_ack_bitrate_high) 924 + AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, val); 925 + else 926 + AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, val); 927 + } 928 + return; 780 929 }
+494 -147
drivers/net/wireless/ath/ath5k/phy.c
··· 29 29 #include "rfbuffer.h" 30 30 #include "rfgain.h" 31 31 32 + 33 + /******************\ 34 + * Helper functions * 35 + \******************/ 36 + 37 + /* 38 + * Get the PHY Chip revision 39 + */ 40 + u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan) 41 + { 42 + unsigned int i; 43 + u32 srev; 44 + u16 ret; 45 + 46 + /* 47 + * Set the radio chip access register 48 + */ 49 + switch (chan) { 50 + case CHANNEL_2GHZ: 51 + ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_2GHZ, AR5K_PHY(0)); 52 + break; 53 + case CHANNEL_5GHZ: 54 + ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0)); 55 + break; 56 + default: 57 + return 0; 58 + } 59 + 60 + mdelay(2); 61 + 62 + /* ...wait until PHY is ready and read the selected radio revision */ 63 + ath5k_hw_reg_write(ah, 0x00001c16, AR5K_PHY(0x34)); 64 + 65 + for (i = 0; i < 8; i++) 66 + ath5k_hw_reg_write(ah, 0x00010000, AR5K_PHY(0x20)); 67 + 68 + if (ah->ah_version == AR5K_AR5210) { 69 + srev = ath5k_hw_reg_read(ah, AR5K_PHY(256) >> 28) & 0xf; 70 + ret = (u16)ath5k_hw_bitswap(srev, 4) + 1; 71 + } else { 72 + srev = (ath5k_hw_reg_read(ah, AR5K_PHY(0x100)) >> 24) & 0xff; 73 + ret = (u16)ath5k_hw_bitswap(((srev & 0xf0) >> 4) | 74 + ((srev & 0x0f) << 4), 8); 75 + } 76 + 77 + /* Reset to the 5GHz mode */ 78 + ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0)); 79 + 80 + return ret; 81 + } 82 + 83 + /* 84 + * Check if a channel is supported 85 + */ 86 + bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags) 87 + { 88 + /* Check if the channel is in our supported range */ 89 + if (flags & CHANNEL_2GHZ) { 90 + if ((freq >= ah->ah_capabilities.cap_range.range_2ghz_min) && 91 + (freq <= ah->ah_capabilities.cap_range.range_2ghz_max)) 92 + return true; 93 + } else if (flags & CHANNEL_5GHZ) 94 + if ((freq >= ah->ah_capabilities.cap_range.range_5ghz_min) && 95 + (freq <= ah->ah_capabilities.cap_range.range_5ghz_max)) 96 + return true; 97 + 98 + return false; 99 + } 100 + 101 + bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, 102 + struct ieee80211_channel *channel) 103 + { 104 + u8 refclk_freq; 105 + 106 + if ((ah->ah_radio == AR5K_RF5112) || 107 + (ah->ah_radio == AR5K_RF5413) || 108 + (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) 109 + refclk_freq = 40; 110 + else 111 + refclk_freq = 32; 112 + 113 + if ((channel->center_freq % refclk_freq != 0) && 114 + ((channel->center_freq % refclk_freq < 10) || 115 + (channel->center_freq % refclk_freq > 22))) 116 + return true; 117 + else 118 + return false; 119 + } 120 + 32 121 /* 33 122 * Used to modify RF Banks before writing them to AR5K_RF_BUFFER 34 123 */ ··· 198 109 199 110 return data; 200 111 } 112 + 113 + /** 114 + * ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212 115 + * 116 + * @ah: the &struct ath5k_hw 117 + * @channel: the currently set channel upon reset 118 + * 119 + * Write the delta slope coefficient (used on pilot tracking ?) for OFDM 120 + * operation on the AR5212 upon reset. This is a helper for ath5k_hw_phy_init. 121 + * 122 + * Since delta slope is floating point we split it on its exponent and 123 + * mantissa and provide these values on hw. 124 + * 125 + * For more infos i think this patent is related 126 + * http://www.freepatentsonline.com/7184495.html 127 + */ 128 + static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, 129 + struct ieee80211_channel *channel) 130 + { 131 + /* Get exponent and mantissa and set it */ 132 + u32 coef_scaled, coef_exp, coef_man, 133 + ds_coef_exp, ds_coef_man, clock; 134 + 135 + BUG_ON(!(ah->ah_version == AR5K_AR5212) || 136 + !(channel->hw_value & CHANNEL_OFDM)); 137 + 138 + /* Get coefficient 139 + * ALGO: coef = (5 * clock / carrier_freq) / 2 140 + * we scale coef by shifting clock value by 24 for 141 + * better precision since we use integers */ 142 + switch (ah->ah_bwmode) { 143 + case AR5K_BWMODE_40MHZ: 144 + clock = 40 * 2; 145 + break; 146 + case AR5K_BWMODE_10MHZ: 147 + clock = 40 / 2; 148 + break; 149 + case AR5K_BWMODE_5MHZ: 150 + clock = 40 / 4; 151 + break; 152 + default: 153 + clock = 40; 154 + break; 155 + } 156 + coef_scaled = ((5 * (clock << 24)) / 2) / channel->center_freq; 157 + 158 + /* Get exponent 159 + * ALGO: coef_exp = 14 - highest set bit position */ 160 + coef_exp = ilog2(coef_scaled); 161 + 162 + /* Doesn't make sense if it's zero*/ 163 + if (!coef_scaled || !coef_exp) 164 + return -EINVAL; 165 + 166 + /* Note: we've shifted coef_scaled by 24 */ 167 + coef_exp = 14 - (coef_exp - 24); 168 + 169 + 170 + /* Get mantissa (significant digits) 171 + * ALGO: coef_mant = floor(coef_scaled* 2^coef_exp+0.5) */ 172 + coef_man = coef_scaled + 173 + (1 << (24 - coef_exp - 1)); 174 + 175 + /* Calculate delta slope coefficient exponent 176 + * and mantissa (remove scaling) and set them on hw */ 177 + ds_coef_man = coef_man >> (24 - coef_exp); 178 + ds_coef_exp = coef_exp - 16; 179 + 180 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3, 181 + AR5K_PHY_TIMING_3_DSC_MAN, ds_coef_man); 182 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3, 183 + AR5K_PHY_TIMING_3_DSC_EXP, ds_coef_exp); 184 + 185 + return 0; 186 + } 187 + 188 + int ath5k_hw_phy_disable(struct ath5k_hw *ah) 189 + { 190 + /*Just a try M.F.*/ 191 + ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT); 192 + 193 + return 0; 194 + } 195 + 201 196 202 197 /**********************\ 203 198 * RF Gain optimization * ··· 609 436 /* Write initial RF gain table to set the RF sensitivity 610 437 * this one works on all RF chips and has nothing to do 611 438 * with gain_F calibration */ 612 - int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq) 439 + static int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq) 613 440 { 614 441 const struct ath5k_ini_rfgain *ath5k_rfg; 615 442 unsigned int i, size; ··· 667 494 * RF Registers setup * 668 495 \********************/ 669 496 670 - 671 497 /* 672 498 * Setup RF registers by writing RF buffer on hw 673 499 */ 674 - int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, 675 - unsigned int mode) 500 + static int ath5k_hw_rfregs_init(struct ath5k_hw *ah, 501 + struct ieee80211_channel *channel, unsigned int mode) 676 502 { 677 503 const struct ath5k_rf_reg *rf_regs; 678 504 const struct ath5k_ini_rfbuffer *ini_rfb; ··· 824 652 825 653 g_step = &go->go_step[ah->ah_gain.g_step_idx]; 826 654 655 + /* Set turbo mode (N/A on RF5413) */ 656 + if ((ah->ah_bwmode == AR5K_BWMODE_40MHZ) && 657 + (ah->ah_radio != AR5K_RF5413)) 658 + ath5k_hw_rfb_op(ah, rf_regs, 1, AR5K_RF_TURBO, false); 659 + 827 660 /* Bank Modifications (chip-specific) */ 828 661 if (ah->ah_radio == AR5K_RF5111) { 829 662 ··· 868 691 ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode], 869 692 AR5K_RF_PLO_SEL, true); 870 693 871 - /* TODO: Half/quarter channel support */ 694 + /* Tweak power detectors for half/quarter rate support */ 695 + if (ah->ah_bwmode == AR5K_BWMODE_5MHZ || 696 + ah->ah_bwmode == AR5K_BWMODE_10MHZ) { 697 + u8 wait_i; 698 + 699 + ath5k_hw_rfb_op(ah, rf_regs, 0x1f, 700 + AR5K_RF_WAIT_S, true); 701 + 702 + wait_i = (ah->ah_bwmode == AR5K_BWMODE_5MHZ) ? 703 + 0x1f : 0x10; 704 + 705 + ath5k_hw_rfb_op(ah, rf_regs, wait_i, 706 + AR5K_RF_WAIT_I, true); 707 + ath5k_hw_rfb_op(ah, rf_regs, 3, 708 + AR5K_RF_MAX_TIME, true); 709 + 710 + } 872 711 } 873 712 874 713 if (ah->ah_radio == AR5K_RF5112) { ··· 982 789 ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode], 983 790 AR5K_RF_GAIN_I, true); 984 791 985 - /* TODO: Half/quarter channel support */ 792 + /* Tweak power detector for half/quarter rates */ 793 + if (ah->ah_bwmode == AR5K_BWMODE_5MHZ || 794 + ah->ah_bwmode == AR5K_BWMODE_10MHZ) { 795 + u8 pd_delay; 986 796 797 + pd_delay = (ah->ah_bwmode == AR5K_BWMODE_5MHZ) ? 798 + 0xf : 0x8; 799 + 800 + ath5k_hw_rfb_op(ah, rf_regs, pd_delay, 801 + AR5K_RF_PD_PERIOD_A, true); 802 + ath5k_hw_rfb_op(ah, rf_regs, 0xf, 803 + AR5K_RF_PD_DELAY_A, true); 804 + 805 + } 987 806 } 988 807 989 808 if (ah->ah_radio == AR5K_RF5413 && ··· 1025 820 /**************************\ 1026 821 PHY/RF channel functions 1027 822 \**************************/ 1028 - 1029 - /* 1030 - * Check if a channel is supported 1031 - */ 1032 - bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags) 1033 - { 1034 - /* Check if the channel is in our supported range */ 1035 - if (flags & CHANNEL_2GHZ) { 1036 - if ((freq >= ah->ah_capabilities.cap_range.range_2ghz_min) && 1037 - (freq <= ah->ah_capabilities.cap_range.range_2ghz_max)) 1038 - return true; 1039 - } else if (flags & CHANNEL_5GHZ) 1040 - if ((freq >= ah->ah_capabilities.cap_range.range_5ghz_min) && 1041 - (freq <= ah->ah_capabilities.cap_range.range_5ghz_max)) 1042 - return true; 1043 - 1044 - return false; 1045 - } 1046 823 1047 824 /* 1048 825 * Convertion needed for RF5110 ··· 1232 1045 /* 1233 1046 * Set a channel on the radio chip 1234 1047 */ 1235 - int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) 1048 + static int ath5k_hw_channel(struct ath5k_hw *ah, 1049 + struct ieee80211_channel *channel) 1236 1050 { 1237 1051 int ret; 1238 1052 /* ··· 1280 1092 } 1281 1093 1282 1094 ah->ah_current_channel = channel; 1283 - ah->ah_turbo = channel->hw_value == CHANNEL_T ? true : false; 1284 - ath5k_hw_set_clockrate(ah); 1285 1095 1286 1096 return 0; 1287 1097 } ··· 1363 1177 1364 1178 switch (ah->ah_current_channel->hw_value & CHANNEL_MODES) { 1365 1179 case CHANNEL_A: 1366 - case CHANNEL_T: 1367 1180 case CHANNEL_XR: 1368 1181 ee_mode = AR5K_EEPROM_MODE_11A; 1369 1182 break; 1370 1183 case CHANNEL_G: 1371 - case CHANNEL_TG: 1372 1184 ee_mode = AR5K_EEPROM_MODE_11G; 1373 1185 break; 1374 1186 default: ··· 1603 1419 return ret; 1604 1420 } 1605 1421 1422 + 1606 1423 /***************************\ 1607 1424 * Spur mitigation functions * 1608 1425 \***************************/ 1609 1426 1610 - bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, 1611 - struct ieee80211_channel *channel) 1612 - { 1613 - u8 refclk_freq; 1614 - 1615 - if ((ah->ah_radio == AR5K_RF5112) || 1616 - (ah->ah_radio == AR5K_RF5413) || 1617 - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) 1618 - refclk_freq = 40; 1619 - else 1620 - refclk_freq = 32; 1621 - 1622 - if ((channel->center_freq % refclk_freq != 0) && 1623 - ((channel->center_freq % refclk_freq < 10) || 1624 - (channel->center_freq % refclk_freq > 22))) 1625 - return true; 1626 - else 1627 - return false; 1628 - } 1629 - 1630 - void 1427 + static void 1631 1428 ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah, 1632 1429 struct ieee80211_channel *channel) 1633 1430 { ··· 1637 1472 spur_chan_fbin = AR5K_EEPROM_NO_SPUR; 1638 1473 spur_detection_window = AR5K_SPUR_CHAN_WIDTH; 1639 1474 /* XXX: Half/Quarter channels ?*/ 1640 - if (channel->hw_value & CHANNEL_TURBO) 1475 + if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) 1641 1476 spur_detection_window *= 2; 1642 1477 1643 1478 for (i = 0; i < AR5K_EEPROM_N_SPUR_CHANS; i++) { ··· 1666 1501 * Calculate deltas: 1667 1502 * spur_freq_sigma_delta -> spur_offset / sample_freq << 21 1668 1503 * spur_delta_phase -> spur_offset / chip_freq << 11 1669 - * Note: Both values have 100KHz resolution 1504 + * Note: Both values have 100Hz resolution 1670 1505 */ 1671 - /* XXX: Half/Quarter rate channels ? */ 1672 - switch (channel->hw_value) { 1673 - case CHANNEL_A: 1674 - /* Both sample_freq and chip_freq are 40MHz */ 1675 - spur_delta_phase = (spur_offset << 17) / 25; 1676 - spur_freq_sigma_delta = (spur_delta_phase >> 10); 1677 - symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz; 1678 - break; 1679 - case CHANNEL_G: 1680 - /* sample_freq -> 40MHz chip_freq -> 44MHz 1681 - * (for b compatibility) */ 1682 - spur_freq_sigma_delta = (spur_offset << 8) / 55; 1683 - spur_delta_phase = (spur_offset << 17) / 25; 1684 - symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz; 1685 - break; 1686 - case CHANNEL_T: 1687 - case CHANNEL_TG: 1506 + switch (ah->ah_bwmode) { 1507 + case AR5K_BWMODE_40MHZ: 1688 1508 /* Both sample_freq and chip_freq are 80MHz */ 1689 1509 spur_delta_phase = (spur_offset << 16) / 25; 1690 1510 spur_freq_sigma_delta = (spur_delta_phase >> 10); 1691 - symbol_width = AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz; 1511 + symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz * 2; 1692 1512 break; 1513 + case AR5K_BWMODE_10MHZ: 1514 + /* Both sample_freq and chip_freq are 20MHz (?) */ 1515 + spur_delta_phase = (spur_offset << 18) / 25; 1516 + spur_freq_sigma_delta = (spur_delta_phase >> 10); 1517 + symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 2; 1518 + case AR5K_BWMODE_5MHZ: 1519 + /* Both sample_freq and chip_freq are 10MHz (?) */ 1520 + spur_delta_phase = (spur_offset << 19) / 25; 1521 + spur_freq_sigma_delta = (spur_delta_phase >> 10); 1522 + symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 4; 1693 1523 default: 1694 - return; 1524 + if (channel->hw_value == CHANNEL_A) { 1525 + /* Both sample_freq and chip_freq are 40MHz */ 1526 + spur_delta_phase = (spur_offset << 17) / 25; 1527 + spur_freq_sigma_delta = 1528 + (spur_delta_phase >> 10); 1529 + symbol_width = 1530 + AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz; 1531 + } else { 1532 + /* sample_freq -> 40MHz chip_freq -> 44MHz 1533 + * (for b compatibility) */ 1534 + spur_delta_phase = (spur_offset << 17) / 25; 1535 + spur_freq_sigma_delta = 1536 + (spur_offset << 8) / 55; 1537 + symbol_width = 1538 + AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz; 1539 + } 1540 + break; 1695 1541 } 1696 1542 1697 1543 /* Calculate pilot and magnitude masks */ ··· 1842 1666 } 1843 1667 } 1844 1668 1845 - /********************\ 1846 - Misc PHY functions 1847 - \********************/ 1848 - 1849 - int ath5k_hw_phy_disable(struct ath5k_hw *ah) 1850 - { 1851 - /*Just a try M.F.*/ 1852 - ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT); 1853 - 1854 - return 0; 1855 - } 1856 - 1857 - /* 1858 - * Get the PHY Chip revision 1859 - */ 1860 - u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan) 1861 - { 1862 - unsigned int i; 1863 - u32 srev; 1864 - u16 ret; 1865 - 1866 - /* 1867 - * Set the radio chip access register 1868 - */ 1869 - switch (chan) { 1870 - case CHANNEL_2GHZ: 1871 - ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_2GHZ, AR5K_PHY(0)); 1872 - break; 1873 - case CHANNEL_5GHZ: 1874 - ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0)); 1875 - break; 1876 - default: 1877 - return 0; 1878 - } 1879 - 1880 - mdelay(2); 1881 - 1882 - /* ...wait until PHY is ready and read the selected radio revision */ 1883 - ath5k_hw_reg_write(ah, 0x00001c16, AR5K_PHY(0x34)); 1884 - 1885 - for (i = 0; i < 8; i++) 1886 - ath5k_hw_reg_write(ah, 0x00010000, AR5K_PHY(0x20)); 1887 - 1888 - if (ah->ah_version == AR5K_AR5210) { 1889 - srev = ath5k_hw_reg_read(ah, AR5K_PHY(256) >> 28) & 0xf; 1890 - ret = (u16)ath5k_hw_bitswap(srev, 4) + 1; 1891 - } else { 1892 - srev = (ath5k_hw_reg_read(ah, AR5K_PHY(0x100)) >> 24) & 0xff; 1893 - ret = (u16)ath5k_hw_bitswap(((srev & 0xf0) >> 4) | 1894 - ((srev & 0x0f) << 4), 8); 1895 - } 1896 - 1897 - /* Reset to the 5GHz mode */ 1898 - ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0)); 1899 - 1900 - return ret; 1901 - } 1902 1669 1903 1670 /*****************\ 1904 1671 * Antenna control * ··· 1949 1830 1950 1831 switch (channel->hw_value & CHANNEL_MODES) { 1951 1832 case CHANNEL_A: 1952 - case CHANNEL_T: 1953 1833 case CHANNEL_XR: 1954 1834 ee_mode = AR5K_EEPROM_MODE_11A; 1955 1835 break; 1956 1836 case CHANNEL_G: 1957 - case CHANNEL_TG: 1958 1837 ee_mode = AR5K_EEPROM_MODE_11G; 1959 1838 break; 1960 1839 case CHANNEL_B: ··· 2386 2269 2387 2270 switch (channel->hw_value & CHANNEL_MODES) { 2388 2271 case CHANNEL_A: 2389 - ctl_mode |= AR5K_CTL_11A; 2272 + if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) 2273 + ctl_mode |= AR5K_CTL_TURBO; 2274 + else 2275 + ctl_mode |= AR5K_CTL_11A; 2390 2276 break; 2391 2277 case CHANNEL_G: 2392 - ctl_mode |= AR5K_CTL_11G; 2278 + if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) 2279 + ctl_mode |= AR5K_CTL_TURBOG; 2280 + else 2281 + ctl_mode |= AR5K_CTL_11G; 2393 2282 break; 2394 2283 case CHANNEL_B: 2395 2284 ctl_mode |= AR5K_CTL_11B; 2396 - break; 2397 - case CHANNEL_T: 2398 - ctl_mode |= AR5K_CTL_TURBO; 2399 - break; 2400 - case CHANNEL_TG: 2401 - ctl_mode |= AR5K_CTL_TURBOG; 2402 2285 break; 2403 2286 case CHANNEL_XR: 2404 2287 /* Fall through */ ··· 3101 2984 /* 3102 2985 * Set transmission power 3103 2986 */ 3104 - int 2987 + static int 3105 2988 ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, 3106 - u8 ee_mode, u8 txpower) 2989 + u8 ee_mode, u8 txpower, bool fast) 3107 2990 { 3108 2991 struct ath5k_rate_pcal_info rate_info; 3109 2992 u8 type; ··· 3122 3005 3123 3006 /* Initialize TX power table */ 3124 3007 switch (ah->ah_radio) { 3008 + case AR5K_RF5110: 3009 + /* TODO */ 3010 + return 0; 3125 3011 case AR5K_RF5111: 3126 3012 type = AR5K_PWRTABLE_PWR_TO_PCDAC; 3127 3013 break; ··· 3142 3022 return -EINVAL; 3143 3023 } 3144 3024 3145 - /* FIXME: Only on channel/mode change */ 3146 - ret = ath5k_setup_channel_powertable(ah, channel, ee_mode, type); 3147 - if (ret) 3148 - return ret; 3025 + /* If fast is set it means we are on the same channel/mode 3026 + * so there is no need to recalculate the powertable, we 'll 3027 + * just use the cached one */ 3028 + if (!fast) { 3029 + ret = ath5k_setup_channel_powertable(ah, channel, 3030 + ee_mode, type); 3031 + if (ret) 3032 + return ret; 3033 + } 3149 3034 3150 3035 /* Limit max power if we have a CTL available */ 3151 3036 ath5k_get_max_ctl_power(ah, channel); ··· 3211 3086 3212 3087 switch (channel->hw_value & CHANNEL_MODES) { 3213 3088 case CHANNEL_A: 3214 - case CHANNEL_T: 3215 3089 case CHANNEL_XR: 3216 3090 ee_mode = AR5K_EEPROM_MODE_11A; 3217 3091 break; 3218 3092 case CHANNEL_G: 3219 - case CHANNEL_TG: 3220 3093 ee_mode = AR5K_EEPROM_MODE_11G; 3221 3094 break; 3222 3095 case CHANNEL_B: ··· 3229 3106 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_TXPOWER, 3230 3107 "changing txpower to %d\n", txpower); 3231 3108 3232 - return ath5k_hw_txpower(ah, channel, ee_mode, txpower); 3109 + return ath5k_hw_txpower(ah, channel, ee_mode, txpower, true); 3110 + } 3111 + 3112 + /*************\ 3113 + Init function 3114 + \*************/ 3115 + 3116 + int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, 3117 + u8 mode, u8 ee_mode, u8 freq, bool fast) 3118 + { 3119 + struct ieee80211_channel *curr_channel; 3120 + int ret, i; 3121 + u32 phy_tst1; 3122 + bool fast_txp; 3123 + ret = 0; 3124 + 3125 + /* 3126 + * Sanity check for fast flag 3127 + * Don't try fast channel change when changing modulation 3128 + * mode/band. We check for chip compatibility on 3129 + * ath5k_hw_reset. 3130 + */ 3131 + curr_channel = ah->ah_current_channel; 3132 + if (fast && (channel->hw_value != curr_channel->hw_value)) 3133 + return -EINVAL; 3134 + 3135 + /* 3136 + * On fast channel change we only set the synth parameters 3137 + * while PHY is running, enable calibration and skip the rest. 3138 + */ 3139 + if (fast) { 3140 + AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_RFBUS_REQ, 3141 + AR5K_PHY_RFBUS_REQ_REQUEST); 3142 + for (i = 0; i < 100; i++) { 3143 + if (ath5k_hw_reg_read(ah, AR5K_PHY_RFBUS_GRANT)) 3144 + break; 3145 + udelay(5); 3146 + } 3147 + /* Failed */ 3148 + if (i >= 100) 3149 + return -EIO; 3150 + } 3151 + 3152 + /* 3153 + * If we don't change channel/mode skip 3154 + * tx powertable calculation and use the 3155 + * cached one. 3156 + */ 3157 + if ((channel->hw_value == curr_channel->hw_value) && 3158 + (channel->center_freq == curr_channel->center_freq)) 3159 + fast_txp = true; 3160 + else 3161 + fast_txp = false; 3162 + 3163 + /* 3164 + * Set TX power 3165 + * 3166 + * Note: We need to do that before we set 3167 + * RF buffer settings on 5211/5212+ so that we 3168 + * properly set curve indices. 3169 + */ 3170 + ret = ath5k_hw_txpower(ah, channel, ee_mode, 3171 + ah->ah_txpower.txp_max_pwr / 2, 3172 + fast_txp); 3173 + if (ret) 3174 + return ret; 3175 + 3176 + /* 3177 + * For 5210 we do all initialization using 3178 + * initvals, so we don't have to modify 3179 + * any settings (5210 also only supports 3180 + * a/aturbo modes) 3181 + */ 3182 + if ((ah->ah_version != AR5K_AR5210) && !fast) { 3183 + 3184 + /* 3185 + * Write initial RF gain settings 3186 + * This should work for both 5111/5112 3187 + */ 3188 + ret = ath5k_hw_rfgain_init(ah, freq); 3189 + if (ret) 3190 + return ret; 3191 + 3192 + mdelay(1); 3193 + 3194 + /* 3195 + * Write RF buffer 3196 + */ 3197 + ret = ath5k_hw_rfregs_init(ah, channel, mode); 3198 + if (ret) 3199 + return ret; 3200 + 3201 + /* Write OFDM timings on 5212*/ 3202 + if (ah->ah_version == AR5K_AR5212 && 3203 + channel->hw_value & CHANNEL_OFDM) { 3204 + 3205 + ret = ath5k_hw_write_ofdm_timings(ah, channel); 3206 + if (ret) 3207 + return ret; 3208 + 3209 + /* Spur info is available only from EEPROM versions 3210 + * greater than 5.3, but the EEPROM routines will use 3211 + * static values for older versions */ 3212 + if (ah->ah_mac_srev >= AR5K_SREV_AR5424) 3213 + ath5k_hw_set_spur_mitigation_filter(ah, 3214 + channel); 3215 + } 3216 + 3217 + /*Enable/disable 802.11b mode on 5111 3218 + (enable 2111 frequency converter + CCK)*/ 3219 + if (ah->ah_radio == AR5K_RF5111) { 3220 + if (mode == AR5K_MODE_11B) 3221 + AR5K_REG_ENABLE_BITS(ah, AR5K_TXCFG, 3222 + AR5K_TXCFG_B_MODE); 3223 + else 3224 + AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG, 3225 + AR5K_TXCFG_B_MODE); 3226 + } 3227 + 3228 + } else if (ah->ah_version == AR5K_AR5210) { 3229 + mdelay(1); 3230 + /* Disable phy and wait */ 3231 + ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT); 3232 + mdelay(1); 3233 + } 3234 + 3235 + /* Set channel on PHY */ 3236 + ret = ath5k_hw_channel(ah, channel); 3237 + if (ret) 3238 + return ret; 3239 + 3240 + /* 3241 + * Enable the PHY and wait until completion 3242 + * This includes BaseBand and Synthesizer 3243 + * activation. 3244 + */ 3245 + ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); 3246 + 3247 + /* 3248 + * On 5211+ read activation -> rx delay 3249 + * and use it. 3250 + */ 3251 + if (ah->ah_version != AR5K_AR5210) { 3252 + u32 delay; 3253 + delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) & 3254 + AR5K_PHY_RX_DELAY_M; 3255 + delay = (channel->hw_value & CHANNEL_CCK) ? 3256 + ((delay << 2) / 22) : (delay / 10); 3257 + if (ah->ah_bwmode == AR5K_BWMODE_10MHZ) 3258 + delay = delay << 1; 3259 + if (ah->ah_bwmode == AR5K_BWMODE_5MHZ) 3260 + delay = delay << 2; 3261 + /* XXX: /2 on turbo ? Let's be safe 3262 + * for now */ 3263 + udelay(100 + delay); 3264 + } else { 3265 + mdelay(1); 3266 + } 3267 + 3268 + if (fast) 3269 + /* 3270 + * Release RF Bus grant 3271 + */ 3272 + AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_RFBUS_REQ, 3273 + AR5K_PHY_RFBUS_REQ_REQUEST); 3274 + else { 3275 + /* 3276 + * Perform ADC test to see if baseband is ready 3277 + * Set tx hold and check adc test register 3278 + */ 3279 + phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1); 3280 + ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1); 3281 + for (i = 0; i <= 20; i++) { 3282 + if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10)) 3283 + break; 3284 + udelay(200); 3285 + } 3286 + ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1); 3287 + } 3288 + 3289 + /* 3290 + * Start automatic gain control calibration 3291 + * 3292 + * During AGC calibration RX path is re-routed to 3293 + * a power detector so we don't receive anything. 3294 + * 3295 + * This method is used to calibrate some static offsets 3296 + * used together with on-the fly I/Q calibration (the 3297 + * one performed via ath5k_hw_phy_calibrate), which doesn't 3298 + * interrupt rx path. 3299 + * 3300 + * While rx path is re-routed to the power detector we also 3301 + * start a noise floor calibration to measure the 3302 + * card's noise floor (the noise we measure when we are not 3303 + * transmitting or receiving anything). 3304 + * 3305 + * If we are in a noisy environment, AGC calibration may time 3306 + * out and/or noise floor calibration might timeout. 3307 + */ 3308 + AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, 3309 + AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF); 3310 + 3311 + /* At the same time start I/Q calibration for QAM constellation 3312 + * -no need for CCK- */ 3313 + ah->ah_calibration = false; 3314 + if (!(mode == AR5K_MODE_11B)) { 3315 + ah->ah_calibration = true; 3316 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, 3317 + AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15); 3318 + AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, 3319 + AR5K_PHY_IQ_RUN); 3320 + } 3321 + 3322 + /* Wait for gain calibration to finish (we check for I/Q calibration 3323 + * during ath5k_phy_calibrate) */ 3324 + if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, 3325 + AR5K_PHY_AGCCTL_CAL, 0, false)) { 3326 + ATH5K_ERR(ah->ah_sc, "gain calibration timeout (%uMHz)\n", 3327 + channel->center_freq); 3328 + } 3329 + 3330 + /* Restore antenna mode */ 3331 + ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode); 3332 + 3333 + return ret; 3233 3334 }
+412 -280
drivers/net/wireless/ath/ath5k/qcu.c
··· 25 25 #include "debug.h" 26 26 #include "base.h" 27 27 28 + 29 + /******************\ 30 + * Helper functions * 31 + \******************/ 32 + 28 33 /* 29 - * Get properties for a transmit queue 34 + * Get number of pending frames 35 + * for a specific queue [5211+] 30 36 */ 31 - int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue, 32 - struct ath5k_txq_info *queue_info) 37 + u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue) 33 38 { 34 - memcpy(queue_info, &ah->ah_txq[queue], sizeof(struct ath5k_txq_info)); 35 - return 0; 39 + u32 pending; 40 + AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); 41 + 42 + /* Return if queue is declared inactive */ 43 + if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) 44 + return false; 45 + 46 + /* XXX: How about AR5K_CFG_TXCNT ? */ 47 + if (ah->ah_version == AR5K_AR5210) 48 + return false; 49 + 50 + pending = ath5k_hw_reg_read(ah, AR5K_QUEUE_STATUS(queue)); 51 + pending &= AR5K_QCU_STS_FRMPENDCNT; 52 + 53 + /* It's possible to have no frames pending even if TXE 54 + * is set. To indicate that q has not stopped return 55 + * true */ 56 + if (!pending && AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue)) 57 + return true; 58 + 59 + return pending; 60 + } 61 + 62 + /* 63 + * Set a transmit queue inactive 64 + */ 65 + void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue) 66 + { 67 + if (WARN_ON(queue >= ah->ah_capabilities.cap_queues.q_tx_num)) 68 + return; 69 + 70 + /* This queue will be skipped in further operations */ 71 + ah->ah_txq[queue].tqi_type = AR5K_TX_QUEUE_INACTIVE; 72 + /*For SIMR setup*/ 73 + AR5K_Q_DISABLE_BITS(ah->ah_txq_status, queue); 36 74 } 37 75 38 76 /* ··· 85 47 cw = (cw << 1) | 1; 86 48 87 49 return cw; 50 + } 51 + 52 + /* 53 + * Get properties for a transmit queue 54 + */ 55 + int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue, 56 + struct ath5k_txq_info *queue_info) 57 + { 58 + memcpy(queue_info, &ah->ah_txq[queue], sizeof(struct ath5k_txq_info)); 59 + return 0; 88 60 } 89 61 90 62 /* ··· 220 172 return queue; 221 173 } 222 174 223 - /* 224 - * Get number of pending frames 225 - * for a specific queue [5211+] 226 - */ 227 - u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue) 228 - { 229 - u32 pending; 230 - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); 231 175 232 - /* Return if queue is declared inactive */ 233 - if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) 234 - return false; 235 - 236 - /* XXX: How about AR5K_CFG_TXCNT ? */ 237 - if (ah->ah_version == AR5K_AR5210) 238 - return false; 239 - 240 - pending = ath5k_hw_reg_read(ah, AR5K_QUEUE_STATUS(queue)); 241 - pending &= AR5K_QCU_STS_FRMPENDCNT; 242 - 243 - /* It's possible to have no frames pending even if TXE 244 - * is set. To indicate that q has not stopped return 245 - * true */ 246 - if (!pending && AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue)) 247 - return true; 248 - 249 - return pending; 250 - } 176 + /*******************************\ 177 + * Single QCU/DCU initialization * 178 + \*******************************/ 251 179 252 180 /* 253 - * Set a transmit queue inactive 181 + * Set tx retry limits on DCU 254 182 */ 255 - void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue) 256 - { 257 - if (WARN_ON(queue >= ah->ah_capabilities.cap_queues.q_tx_num)) 258 - return; 259 - 260 - /* This queue will be skipped in further operations */ 261 - ah->ah_txq[queue].tqi_type = AR5K_TX_QUEUE_INACTIVE; 262 - /*For SIMR setup*/ 263 - AR5K_Q_DISABLE_BITS(ah->ah_txq_status, queue); 264 - } 265 - 266 - /* 267 - * Set DFS properties for a transmit queue on DCU 268 - */ 269 - int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue) 183 + static void ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah, 184 + unsigned int queue) 270 185 { 271 186 u32 retry_lg, retry_sh; 272 - struct ath5k_txq_info *tq = &ah->ah_txq[queue]; 273 - 274 - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); 275 - 276 - tq = &ah->ah_txq[queue]; 277 - 278 - if (tq->tqi_type == AR5K_TX_QUEUE_INACTIVE) 279 - return 0; 280 - 281 - if (ah->ah_version == AR5K_AR5210) { 282 - /* Only handle data queues, others will be ignored */ 283 - if (tq->tqi_type != AR5K_TX_QUEUE_DATA) 284 - return 0; 285 - 286 - /* Set Slot time */ 287 - ath5k_hw_reg_write(ah, ah->ah_turbo ? 288 - AR5K_INIT_SLOT_TIME_TURBO : AR5K_INIT_SLOT_TIME, 289 - AR5K_SLOT_TIME); 290 - /* Set ACK_CTS timeout */ 291 - ath5k_hw_reg_write(ah, ah->ah_turbo ? 292 - AR5K_INIT_ACK_CTS_TIMEOUT_TURBO : 293 - AR5K_INIT_ACK_CTS_TIMEOUT, AR5K_SLOT_TIME); 294 - /* Set Transmit Latency */ 295 - ath5k_hw_reg_write(ah, ah->ah_turbo ? 296 - AR5K_INIT_TRANSMIT_LATENCY_TURBO : 297 - AR5K_INIT_TRANSMIT_LATENCY, AR5K_USEC_5210); 298 - 299 - /* Set IFS0 */ 300 - if (ah->ah_turbo) { 301 - ath5k_hw_reg_write(ah, ((AR5K_INIT_SIFS_TURBO + 302 - tq->tqi_aifs * AR5K_INIT_SLOT_TIME_TURBO) << 303 - AR5K_IFS0_DIFS_S) | AR5K_INIT_SIFS_TURBO, 304 - AR5K_IFS0); 305 - } else { 306 - ath5k_hw_reg_write(ah, ((AR5K_INIT_SIFS + 307 - tq->tqi_aifs * AR5K_INIT_SLOT_TIME) << 308 - AR5K_IFS0_DIFS_S) | 309 - AR5K_INIT_SIFS, AR5K_IFS0); 310 - } 311 - 312 - /* Set IFS1 */ 313 - ath5k_hw_reg_write(ah, ah->ah_turbo ? 314 - AR5K_INIT_PROTO_TIME_CNTRL_TURBO : 315 - AR5K_INIT_PROTO_TIME_CNTRL, AR5K_IFS1); 316 - /* Set AR5K_PHY_SETTLING */ 317 - ath5k_hw_reg_write(ah, ah->ah_turbo ? 318 - (ath5k_hw_reg_read(ah, AR5K_PHY_SETTLING) & ~0x7F) 319 - | 0x38 : 320 - (ath5k_hw_reg_read(ah, AR5K_PHY_SETTLING) & ~0x7F) 321 - | 0x1C, 322 - AR5K_PHY_SETTLING); 323 - /* Set Frame Control Register */ 324 - ath5k_hw_reg_write(ah, ah->ah_turbo ? 325 - (AR5K_PHY_FRAME_CTL_INI | AR5K_PHY_TURBO_MODE | 326 - AR5K_PHY_TURBO_SHORT | 0x2020) : 327 - (AR5K_PHY_FRAME_CTL_INI | 0x1020), 328 - AR5K_PHY_FRAME_CTL_5210); 329 - } 330 187 331 188 /* 332 189 * Calculate and set retry limits ··· 246 293 retry_sh = AR5K_INIT_SH_RETRY; 247 294 } 248 295 249 - /*No QCU/DCU [5210]*/ 296 + /* Single data queue on AR5210 */ 250 297 if (ah->ah_version == AR5K_AR5210) { 298 + struct ath5k_txq_info *tq = &ah->ah_txq[queue]; 299 + 300 + if (queue > 0) 301 + return; 302 + 251 303 ath5k_hw_reg_write(ah, 252 304 (tq->tqi_cw_min << AR5K_NODCU_RETRY_LMT_CW_MIN_S) 253 305 | AR5K_REG_SM(AR5K_INIT_SLG_RETRY, ··· 262 304 | AR5K_REG_SM(retry_lg, AR5K_NODCU_RETRY_LMT_LG_RETRY) 263 305 | AR5K_REG_SM(retry_sh, AR5K_NODCU_RETRY_LMT_SH_RETRY), 264 306 AR5K_NODCU_RETRY_LMT); 307 + /* DCU on AR5211+ */ 265 308 } else { 266 - /*QCU/DCU [5211+]*/ 267 309 ath5k_hw_reg_write(ah, 268 310 AR5K_REG_SM(AR5K_INIT_SLG_RETRY, 269 311 AR5K_DCU_RETRY_LMT_SLG_RETRY) | ··· 272 314 AR5K_REG_SM(retry_lg, AR5K_DCU_RETRY_LMT_LG_RETRY) | 273 315 AR5K_REG_SM(retry_sh, AR5K_DCU_RETRY_LMT_SH_RETRY), 274 316 AR5K_QUEUE_DFS_RETRY_LIMIT(queue)); 317 + } 318 + return; 319 + } 275 320 276 - /*===Rest is also for QCU/DCU only [5211+]===*/ 321 + /** 322 + * ath5k_hw_reset_tx_queue - Initialize a single hw queue 323 + * 324 + * @ah The &struct ath5k_hw 325 + * @queue The hw queue number 326 + * 327 + * Set DFS properties for the given transmit queue on DCU 328 + * and configures all queue-specific parameters. 329 + */ 330 + int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue) 331 + { 332 + struct ath5k_txq_info *tq = &ah->ah_txq[queue]; 277 333 278 - /* 279 - * Set contention window (cw_min/cw_max) 280 - * and arbitrated interframe space (aifs)... 281 - */ 282 - ath5k_hw_reg_write(ah, 283 - AR5K_REG_SM(tq->tqi_cw_min, AR5K_DCU_LCL_IFS_CW_MIN) | 284 - AR5K_REG_SM(tq->tqi_cw_max, AR5K_DCU_LCL_IFS_CW_MAX) | 285 - AR5K_REG_SM(tq->tqi_aifs, AR5K_DCU_LCL_IFS_AIFS), 286 - AR5K_QUEUE_DFS_LOCAL_IFS(queue)); 334 + AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); 287 335 288 - /* 289 - * Set misc registers 290 - */ 291 - /* Enable DCU early termination for this queue */ 292 - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 293 - AR5K_QCU_MISC_DCU_EARLY); 336 + tq = &ah->ah_txq[queue]; 294 337 295 - /* Enable DCU to wait for next fragment from QCU */ 338 + /* Skip if queue inactive or if we are on AR5210 339 + * that doesn't have QCU/DCU */ 340 + if ((ah->ah_version == AR5K_AR5210) || 341 + (tq->tqi_type == AR5K_TX_QUEUE_INACTIVE)) 342 + return 0; 343 + 344 + /* 345 + * Set contention window (cw_min/cw_max) 346 + * and arbitrated interframe space (aifs)... 347 + */ 348 + ath5k_hw_reg_write(ah, 349 + AR5K_REG_SM(tq->tqi_cw_min, AR5K_DCU_LCL_IFS_CW_MIN) | 350 + AR5K_REG_SM(tq->tqi_cw_max, AR5K_DCU_LCL_IFS_CW_MAX) | 351 + AR5K_REG_SM(tq->tqi_aifs, AR5K_DCU_LCL_IFS_AIFS), 352 + AR5K_QUEUE_DFS_LOCAL_IFS(queue)); 353 + 354 + /* 355 + * Set tx retry limits for this queue 356 + */ 357 + ath5k_hw_set_tx_retry_limits(ah, queue); 358 + 359 + 360 + /* 361 + * Set misc registers 362 + */ 363 + 364 + /* Enable DCU to wait for next fragment from QCU */ 365 + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 366 + AR5K_DCU_MISC_FRAG_WAIT); 367 + 368 + /* On Maui and Spirit use the global seqnum on DCU */ 369 + if (ah->ah_mac_version < AR5K_SREV_AR5211) 296 370 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 297 - AR5K_DCU_MISC_FRAG_WAIT); 371 + AR5K_DCU_MISC_SEQNUM_CTL); 298 372 299 - /* On Maui and Spirit use the global seqnum on DCU */ 300 - if (ah->ah_mac_version < AR5K_SREV_AR5211) 301 - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 302 - AR5K_DCU_MISC_SEQNUM_CTL); 373 + /* Constant bit rate period */ 374 + if (tq->tqi_cbr_period) { 375 + ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_cbr_period, 376 + AR5K_QCU_CBRCFG_INTVAL) | 377 + AR5K_REG_SM(tq->tqi_cbr_overflow_limit, 378 + AR5K_QCU_CBRCFG_ORN_THRES), 379 + AR5K_QUEUE_CBRCFG(queue)); 303 380 304 - if (tq->tqi_cbr_period) { 305 - ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_cbr_period, 306 - AR5K_QCU_CBRCFG_INTVAL) | 307 - AR5K_REG_SM(tq->tqi_cbr_overflow_limit, 308 - AR5K_QCU_CBRCFG_ORN_THRES), 309 - AR5K_QUEUE_CBRCFG(queue)); 381 + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 382 + AR5K_QCU_MISC_FRSHED_CBR); 383 + 384 + if (tq->tqi_cbr_overflow_limit) 310 385 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 311 - AR5K_QCU_MISC_FRSHED_CBR); 312 - if (tq->tqi_cbr_overflow_limit) 313 - AR5K_REG_ENABLE_BITS(ah, 314 - AR5K_QUEUE_MISC(queue), 315 386 AR5K_QCU_MISC_CBR_THRES_ENABLE); 316 - } 387 + } 317 388 318 - if (tq->tqi_ready_time && 319 - (tq->tqi_type != AR5K_TX_QUEUE_CAB)) 320 - ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time, 321 - AR5K_QCU_RDYTIMECFG_INTVAL) | 322 - AR5K_QCU_RDYTIMECFG_ENABLE, 323 - AR5K_QUEUE_RDYTIMECFG(queue)); 389 + /* Ready time interval */ 390 + if (tq->tqi_ready_time && (tq->tqi_type != AR5K_TX_QUEUE_CAB)) 391 + ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time, 392 + AR5K_QCU_RDYTIMECFG_INTVAL) | 393 + AR5K_QCU_RDYTIMECFG_ENABLE, 394 + AR5K_QUEUE_RDYTIMECFG(queue)); 324 395 325 - if (tq->tqi_burst_time) { 326 - ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_burst_time, 327 - AR5K_DCU_CHAN_TIME_DUR) | 328 - AR5K_DCU_CHAN_TIME_ENABLE, 329 - AR5K_QUEUE_DFS_CHANNEL_TIME(queue)); 396 + if (tq->tqi_burst_time) { 397 + ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_burst_time, 398 + AR5K_DCU_CHAN_TIME_DUR) | 399 + AR5K_DCU_CHAN_TIME_ENABLE, 400 + AR5K_QUEUE_DFS_CHANNEL_TIME(queue)); 330 401 331 - if (tq->tqi_flags 332 - & AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE) 333 - AR5K_REG_ENABLE_BITS(ah, 334 - AR5K_QUEUE_MISC(queue), 335 - AR5K_QCU_MISC_RDY_VEOL_POLICY); 336 - } 337 - 338 - if (tq->tqi_flags & AR5K_TXQ_FLAG_BACKOFF_DISABLE) 339 - ath5k_hw_reg_write(ah, AR5K_DCU_MISC_POST_FR_BKOFF_DIS, 340 - AR5K_QUEUE_DFS_MISC(queue)); 341 - 342 - if (tq->tqi_flags & AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE) 343 - ath5k_hw_reg_write(ah, AR5K_DCU_MISC_BACKOFF_FRAG, 344 - AR5K_QUEUE_DFS_MISC(queue)); 345 - 346 - /* 347 - * Set registers by queue type 348 - */ 349 - switch (tq->tqi_type) { 350 - case AR5K_TX_QUEUE_BEACON: 402 + if (tq->tqi_flags & AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE) 351 403 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 404 + AR5K_QCU_MISC_RDY_VEOL_POLICY); 405 + } 406 + 407 + /* Enable/disable Post frame backoff */ 408 + if (tq->tqi_flags & AR5K_TXQ_FLAG_BACKOFF_DISABLE) 409 + ath5k_hw_reg_write(ah, AR5K_DCU_MISC_POST_FR_BKOFF_DIS, 410 + AR5K_QUEUE_DFS_MISC(queue)); 411 + 412 + /* Enable/disable fragmentation burst backoff */ 413 + if (tq->tqi_flags & AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE) 414 + ath5k_hw_reg_write(ah, AR5K_DCU_MISC_BACKOFF_FRAG, 415 + AR5K_QUEUE_DFS_MISC(queue)); 416 + 417 + /* 418 + * Set registers by queue type 419 + */ 420 + switch (tq->tqi_type) { 421 + case AR5K_TX_QUEUE_BEACON: 422 + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 352 423 AR5K_QCU_MISC_FRSHED_DBA_GT | 353 424 AR5K_QCU_MISC_CBREXP_BCN_DIS | 354 425 AR5K_QCU_MISC_BCN_ENABLE); 355 426 356 - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 427 + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 357 428 (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL << 358 429 AR5K_DCU_MISC_ARBLOCK_CTL_S) | 359 430 AR5K_DCU_MISC_ARBLOCK_IGNORE | 360 431 AR5K_DCU_MISC_POST_FR_BKOFF_DIS | 361 432 AR5K_DCU_MISC_BCN_ENABLE); 362 - break; 433 + break; 363 434 364 - case AR5K_TX_QUEUE_CAB: 365 - /* XXX: use BCN_SENT_GT, if we can figure out how */ 366 - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 367 - AR5K_QCU_MISC_FRSHED_DBA_GT | 368 - AR5K_QCU_MISC_CBREXP_DIS | 369 - AR5K_QCU_MISC_CBREXP_BCN_DIS); 435 + case AR5K_TX_QUEUE_CAB: 436 + /* XXX: use BCN_SENT_GT, if we can figure out how */ 437 + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 438 + AR5K_QCU_MISC_FRSHED_DBA_GT | 439 + AR5K_QCU_MISC_CBREXP_DIS | 440 + AR5K_QCU_MISC_CBREXP_BCN_DIS); 370 441 371 - ath5k_hw_reg_write(ah, ((tq->tqi_ready_time - 372 - (AR5K_TUNE_SW_BEACON_RESP - 373 - AR5K_TUNE_DMA_BEACON_RESP) - 442 + ath5k_hw_reg_write(ah, ((tq->tqi_ready_time - 443 + (AR5K_TUNE_SW_BEACON_RESP - 444 + AR5K_TUNE_DMA_BEACON_RESP) - 374 445 AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF) * 1024) | 375 - AR5K_QCU_RDYTIMECFG_ENABLE, 376 - AR5K_QUEUE_RDYTIMECFG(queue)); 446 + AR5K_QCU_RDYTIMECFG_ENABLE, 447 + AR5K_QUEUE_RDYTIMECFG(queue)); 377 448 378 - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 379 - (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL << 380 - AR5K_DCU_MISC_ARBLOCK_CTL_S)); 449 + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 450 + (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL << 451 + AR5K_DCU_MISC_ARBLOCK_CTL_S)); 452 + break; 453 + 454 + case AR5K_TX_QUEUE_UAPSD: 455 + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 456 + AR5K_QCU_MISC_CBREXP_DIS); 457 + break; 458 + 459 + case AR5K_TX_QUEUE_DATA: 460 + default: 381 461 break; 382 - 383 - case AR5K_TX_QUEUE_UAPSD: 384 - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 385 - AR5K_QCU_MISC_CBREXP_DIS); 386 - break; 387 - 388 - case AR5K_TX_QUEUE_DATA: 389 - default: 390 - break; 391 - } 392 - 393 - /* TODO: Handle frame compression */ 394 - 395 - /* 396 - * Enable interrupts for this tx queue 397 - * in the secondary interrupt mask registers 398 - */ 399 - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXOKINT_ENABLE) 400 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txok, queue); 401 - 402 - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXERRINT_ENABLE) 403 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txerr, queue); 404 - 405 - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXURNINT_ENABLE) 406 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txurn, queue); 407 - 408 - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXDESCINT_ENABLE) 409 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txdesc, queue); 410 - 411 - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXEOLINT_ENABLE) 412 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txeol, queue); 413 - 414 - if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRORNINT_ENABLE) 415 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrorn, queue); 416 - 417 - if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRURNINT_ENABLE) 418 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrurn, queue); 419 - 420 - if (tq->tqi_flags & AR5K_TXQ_FLAG_QTRIGINT_ENABLE) 421 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_qtrig, queue); 422 - 423 - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE) 424 - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_nofrm, queue); 425 - 426 - /* Update secondary interrupt mask registers */ 427 - 428 - /* Filter out inactive queues */ 429 - ah->ah_txq_imr_txok &= ah->ah_txq_status; 430 - ah->ah_txq_imr_txerr &= ah->ah_txq_status; 431 - ah->ah_txq_imr_txurn &= ah->ah_txq_status; 432 - ah->ah_txq_imr_txdesc &= ah->ah_txq_status; 433 - ah->ah_txq_imr_txeol &= ah->ah_txq_status; 434 - ah->ah_txq_imr_cbrorn &= ah->ah_txq_status; 435 - ah->ah_txq_imr_cbrurn &= ah->ah_txq_status; 436 - ah->ah_txq_imr_qtrig &= ah->ah_txq_status; 437 - ah->ah_txq_imr_nofrm &= ah->ah_txq_status; 438 - 439 - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txok, 440 - AR5K_SIMR0_QCU_TXOK) | 441 - AR5K_REG_SM(ah->ah_txq_imr_txdesc, 442 - AR5K_SIMR0_QCU_TXDESC), AR5K_SIMR0); 443 - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txerr, 444 - AR5K_SIMR1_QCU_TXERR) | 445 - AR5K_REG_SM(ah->ah_txq_imr_txeol, 446 - AR5K_SIMR1_QCU_TXEOL), AR5K_SIMR1); 447 - /* Update simr2 but don't overwrite rest simr2 settings */ 448 - AR5K_REG_DISABLE_BITS(ah, AR5K_SIMR2, AR5K_SIMR2_QCU_TXURN); 449 - AR5K_REG_ENABLE_BITS(ah, AR5K_SIMR2, 450 - AR5K_REG_SM(ah->ah_txq_imr_txurn, 451 - AR5K_SIMR2_QCU_TXURN)); 452 - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_cbrorn, 453 - AR5K_SIMR3_QCBRORN) | 454 - AR5K_REG_SM(ah->ah_txq_imr_cbrurn, 455 - AR5K_SIMR3_QCBRURN), AR5K_SIMR3); 456 - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_qtrig, 457 - AR5K_SIMR4_QTRIG), AR5K_SIMR4); 458 - /* Set TXNOFRM_QCU for the queues with TXNOFRM enabled */ 459 - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_nofrm, 460 - AR5K_TXNOFRM_QCU), AR5K_TXNOFRM); 461 - /* No queue has TXNOFRM enabled, disable the interrupt 462 - * by setting AR5K_TXNOFRM to zero */ 463 - if (ah->ah_txq_imr_nofrm == 0) 464 - ath5k_hw_reg_write(ah, 0, AR5K_TXNOFRM); 465 - 466 - /* Set QCU mask for this DCU to save power */ 467 - AR5K_REG_WRITE_Q(ah, AR5K_QUEUE_QCUMASK(queue), queue); 468 462 } 463 + 464 + /* TODO: Handle frame compression */ 465 + 466 + /* 467 + * Enable interrupts for this tx queue 468 + * in the secondary interrupt mask registers 469 + */ 470 + if (tq->tqi_flags & AR5K_TXQ_FLAG_TXOKINT_ENABLE) 471 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txok, queue); 472 + 473 + if (tq->tqi_flags & AR5K_TXQ_FLAG_TXERRINT_ENABLE) 474 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txerr, queue); 475 + 476 + if (tq->tqi_flags & AR5K_TXQ_FLAG_TXURNINT_ENABLE) 477 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txurn, queue); 478 + 479 + if (tq->tqi_flags & AR5K_TXQ_FLAG_TXDESCINT_ENABLE) 480 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txdesc, queue); 481 + 482 + if (tq->tqi_flags & AR5K_TXQ_FLAG_TXEOLINT_ENABLE) 483 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txeol, queue); 484 + 485 + if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRORNINT_ENABLE) 486 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrorn, queue); 487 + 488 + if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRURNINT_ENABLE) 489 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrurn, queue); 490 + 491 + if (tq->tqi_flags & AR5K_TXQ_FLAG_QTRIGINT_ENABLE) 492 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_qtrig, queue); 493 + 494 + if (tq->tqi_flags & AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE) 495 + AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_nofrm, queue); 496 + 497 + /* Update secondary interrupt mask registers */ 498 + 499 + /* Filter out inactive queues */ 500 + ah->ah_txq_imr_txok &= ah->ah_txq_status; 501 + ah->ah_txq_imr_txerr &= ah->ah_txq_status; 502 + ah->ah_txq_imr_txurn &= ah->ah_txq_status; 503 + ah->ah_txq_imr_txdesc &= ah->ah_txq_status; 504 + ah->ah_txq_imr_txeol &= ah->ah_txq_status; 505 + ah->ah_txq_imr_cbrorn &= ah->ah_txq_status; 506 + ah->ah_txq_imr_cbrurn &= ah->ah_txq_status; 507 + ah->ah_txq_imr_qtrig &= ah->ah_txq_status; 508 + ah->ah_txq_imr_nofrm &= ah->ah_txq_status; 509 + 510 + ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txok, 511 + AR5K_SIMR0_QCU_TXOK) | 512 + AR5K_REG_SM(ah->ah_txq_imr_txdesc, 513 + AR5K_SIMR0_QCU_TXDESC), 514 + AR5K_SIMR0); 515 + 516 + ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txerr, 517 + AR5K_SIMR1_QCU_TXERR) | 518 + AR5K_REG_SM(ah->ah_txq_imr_txeol, 519 + AR5K_SIMR1_QCU_TXEOL), 520 + AR5K_SIMR1); 521 + 522 + /* Update SIMR2 but don't overwrite rest simr2 settings */ 523 + AR5K_REG_DISABLE_BITS(ah, AR5K_SIMR2, AR5K_SIMR2_QCU_TXURN); 524 + AR5K_REG_ENABLE_BITS(ah, AR5K_SIMR2, 525 + AR5K_REG_SM(ah->ah_txq_imr_txurn, 526 + AR5K_SIMR2_QCU_TXURN)); 527 + 528 + ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_cbrorn, 529 + AR5K_SIMR3_QCBRORN) | 530 + AR5K_REG_SM(ah->ah_txq_imr_cbrurn, 531 + AR5K_SIMR3_QCBRURN), 532 + AR5K_SIMR3); 533 + 534 + ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_qtrig, 535 + AR5K_SIMR4_QTRIG), AR5K_SIMR4); 536 + 537 + /* Set TXNOFRM_QCU for the queues with TXNOFRM enabled */ 538 + ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_nofrm, 539 + AR5K_TXNOFRM_QCU), AR5K_TXNOFRM); 540 + 541 + /* No queue has TXNOFRM enabled, disable the interrupt 542 + * by setting AR5K_TXNOFRM to zero */ 543 + if (ah->ah_txq_imr_nofrm == 0) 544 + ath5k_hw_reg_write(ah, 0, AR5K_TXNOFRM); 545 + 546 + /* Set QCU mask for this DCU to save power */ 547 + AR5K_REG_WRITE_Q(ah, AR5K_QUEUE_QCUMASK(queue), queue); 469 548 470 549 return 0; 471 550 } 472 551 473 - /* 474 - * Set slot time on DCU 552 + 553 + /**************************\ 554 + * Global QCU/DCU functions * 555 + \**************************/ 556 + 557 + /** 558 + * ath5k_hw_set_ifs_intervals - Set global inter-frame spaces on DCU 559 + * 560 + * @ah The &struct ath5k_hw 561 + * @slot_time Slot time in us 562 + * 563 + * Sets the global IFS intervals on DCU (also works on AR5210) for 564 + * the given slot time and the current bwmode. 475 565 */ 476 - int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time) 566 + int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time) 477 567 { 568 + struct ieee80211_channel *channel = ah->ah_current_channel; 569 + struct ath5k_softc *sc = ah->ah_sc; 570 + struct ieee80211_rate *rate; 571 + u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock; 478 572 u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time); 479 573 480 574 if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX) 481 575 return -EINVAL; 482 576 483 - if (ah->ah_version == AR5K_AR5210) 484 - ath5k_hw_reg_write(ah, slot_time_clock, AR5K_SLOT_TIME); 577 + sifs = ath5k_hw_get_default_sifs(ah); 578 + sifs_clock = ath5k_hw_htoclock(ah, sifs); 579 + 580 + /* EIFS 581 + * Txtime of ack at lowest rate + SIFS + DIFS 582 + * (DIFS = SIFS + 2 * Slot time) 583 + * 584 + * Note: HAL has some predefined values for EIFS 585 + * Turbo: (37 + 2 * 6) 586 + * Default: (74 + 2 * 9) 587 + * Half: (149 + 2 * 13) 588 + * Quarter: (298 + 2 * 21) 589 + * 590 + * (74 + 2 * 6) for AR5210 default and turbo ! 591 + * 592 + * According to the formula we have 593 + * ack_tx_time = 25 for turbo and 594 + * ack_tx_time = 42.5 * clock multiplier 595 + * for default/half/quarter. 596 + * 597 + * This can't be right, 42 is what we would get 598 + * from ath5k_hw_get_frame_dur_for_bwmode or 599 + * ieee80211_generic_frame_duration for zero frame 600 + * length and without SIFS ! 601 + * 602 + * Also we have different lowest rate for 802.11a 603 + */ 604 + if (channel->hw_value & CHANNEL_5GHZ) 605 + rate = &sc->sbands[IEEE80211_BAND_5GHZ].bitrates[0]; 485 606 else 486 - ath5k_hw_reg_write(ah, slot_time_clock, AR5K_DCU_GBL_IFS_SLOT); 607 + rate = &sc->sbands[IEEE80211_BAND_2GHZ].bitrates[0]; 608 + 609 + ack_tx_time = ath5k_hw_get_frame_duration(ah, 10, rate); 610 + 611 + /* ack_tx_time includes an SIFS already */ 612 + eifs = ack_tx_time + sifs + 2 * slot_time; 613 + eifs_clock = ath5k_hw_htoclock(ah, eifs); 614 + 615 + /* Set IFS settings on AR5210 */ 616 + if (ah->ah_version == AR5K_AR5210) { 617 + u32 pifs, pifs_clock, difs, difs_clock; 618 + 619 + /* Set slot time */ 620 + ath5k_hw_reg_write(ah, slot_time_clock, AR5K_SLOT_TIME); 621 + 622 + /* Set EIFS */ 623 + eifs_clock = AR5K_REG_SM(eifs_clock, AR5K_IFS1_EIFS); 624 + 625 + /* PIFS = Slot time + SIFS */ 626 + pifs = slot_time + sifs; 627 + pifs_clock = ath5k_hw_htoclock(ah, pifs); 628 + pifs_clock = AR5K_REG_SM(pifs_clock, AR5K_IFS1_PIFS); 629 + 630 + /* DIFS = SIFS + 2 * Slot time */ 631 + difs = sifs + 2 * slot_time; 632 + difs_clock = ath5k_hw_htoclock(ah, difs); 633 + 634 + /* Set SIFS/DIFS */ 635 + ath5k_hw_reg_write(ah, (difs_clock << 636 + AR5K_IFS0_DIFS_S) | sifs_clock, 637 + AR5K_IFS0); 638 + 639 + /* Set PIFS/EIFS and preserve AR5K_INIT_CARR_SENSE_EN */ 640 + ath5k_hw_reg_write(ah, pifs_clock | eifs_clock | 641 + (AR5K_INIT_CARR_SENSE_EN << AR5K_IFS1_CS_EN_S), 642 + AR5K_IFS1); 643 + 644 + return 0; 645 + } 646 + 647 + /* Set IFS slot time */ 648 + ath5k_hw_reg_write(ah, slot_time_clock, AR5K_DCU_GBL_IFS_SLOT); 649 + 650 + /* Set EIFS interval */ 651 + ath5k_hw_reg_write(ah, eifs_clock, AR5K_DCU_GBL_IFS_EIFS); 652 + 653 + /* Set SIFS interval in usecs */ 654 + AR5K_REG_WRITE_BITS(ah, AR5K_DCU_GBL_IFS_MISC, 655 + AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC, 656 + sifs); 657 + 658 + /* Set SIFS interval in clock cycles */ 659 + ath5k_hw_reg_write(ah, sifs_clock, AR5K_DCU_GBL_IFS_SIFS); 487 660 488 661 return 0; 489 662 } 490 663 664 + 665 + int ath5k_hw_init_queues(struct ath5k_hw *ah) 666 + { 667 + int i, ret; 668 + 669 + /* TODO: HW Compression support for data queues */ 670 + /* TODO: Burst prefetch for data queues */ 671 + 672 + /* 673 + * Reset queues and start beacon timers at the end of the reset routine 674 + * This also sets QCU mask on each DCU for 1:1 qcu to dcu mapping 675 + * Note: If we want we can assign multiple qcus on one dcu. 676 + */ 677 + if (ah->ah_version != AR5K_AR5210) 678 + for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++) { 679 + ret = ath5k_hw_reset_tx_queue(ah, i); 680 + if (ret) { 681 + ATH5K_ERR(ah->ah_sc, 682 + "failed to reset TX queue #%d\n", i); 683 + return ret; 684 + } 685 + } 686 + else 687 + /* No QCU/DCU on AR5210, just set tx 688 + * retry limits. We set IFS parameters 689 + * on ath5k_hw_set_ifs_intervals */ 690 + ath5k_hw_set_tx_retry_limits(ah, 0); 691 + 692 + /* Set the turbo flag when operating on 40MHz */ 693 + if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) 694 + AR5K_REG_ENABLE_BITS(ah, AR5K_DCU_GBL_IFS_MISC, 695 + AR5K_DCU_GBL_IFS_MISC_TURBO_MODE); 696 + 697 + /* If we didn't set IFS timings through 698 + * ath5k_hw_set_coverage_class make sure 699 + * we set them here */ 700 + if (!ah->ah_coverage_class) { 701 + unsigned int slot_time = ath5k_hw_get_default_slottime(ah); 702 + ath5k_hw_set_ifs_intervals(ah, slot_time); 703 + } 704 + 705 + return 0; 706 + }
+30 -1
drivers/net/wireless/ath/ath5k/reg.h
··· 787 787 #define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007 /* LFSR Slice Select */ 788 788 #define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /* Turbo mode */ 789 789 #define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /* SIFS Duration mask */ 790 + #define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_S 4 790 791 #define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00 /* USEC Duration mask */ 791 792 #define AR5K_DCU_GBL_IFS_MISC_USEC_DUR_S 10 792 793 #define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000 /* DCU Arbiter delay mask */ ··· 1312 1311 #define AR5K_IFS1_EIFS 0x03fff000 1313 1312 #define AR5K_IFS1_EIFS_S 12 1314 1313 #define AR5K_IFS1_CS_EN 0x04000000 1315 - 1314 + #define AR5K_IFS1_CS_EN_S 26 1316 1315 1317 1316 /* 1318 1317 * CFP duration register ··· 2059 2058 2060 2059 #define AR5K_PHY_SCAL 0x9878 2061 2060 #define AR5K_PHY_SCAL_32MHZ 0x0000000e 2061 + #define AR5K_PHY_SCAL_32MHZ_5311 0x00000008 2062 2062 #define AR5K_PHY_SCAL_32MHZ_2417 0x0000000a 2063 2063 #define AR5K_PHY_SCAL_32MHZ_HB63 0x00000032 2064 2064 ··· 2246 2244 #define AR5K_PHY_FRAME_CTL (ah->ah_version == AR5K_AR5210 ? \ 2247 2245 AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211) 2248 2246 /*---[5111+]---*/ 2247 + #define AR5K_PHY_FRAME_CTL_WIN_LEN 0x00000003 /* Force window length (?) */ 2248 + #define AR5K_PHY_FRAME_CTL_WIN_LEN_S 0 2249 2249 #define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038 /* Mask for tx clip (?) */ 2250 2250 #define AR5K_PHY_FRAME_CTL_TX_CLIP_S 3 2251 2251 #define AR5K_PHY_FRAME_CTL_PREP_CHINFO 0x00010000 /* Prepend chan info */ ··· 2562 2558 */ 2563 2559 #define AR5K_PHY_PDADC_TXPOWER_BASE 0xa280 2564 2560 #define AR5K_PHY_PDADC_TXPOWER(_n) (AR5K_PHY_PDADC_TXPOWER_BASE + ((_n) << 2)) 2561 + 2562 + /* 2563 + * Platform registers for WiSoC 2564 + */ 2565 + #define AR5K_AR5312_RESET 0xbc003020 2566 + #define AR5K_AR5312_RESET_BB0_COLD 0x00000004 2567 + #define AR5K_AR5312_RESET_BB1_COLD 0x00000200 2568 + #define AR5K_AR5312_RESET_WMAC0 0x00002000 2569 + #define AR5K_AR5312_RESET_BB0_WARM 0x00004000 2570 + #define AR5K_AR5312_RESET_WMAC1 0x00020000 2571 + #define AR5K_AR5312_RESET_BB1_WARM 0x00040000 2572 + 2573 + #define AR5K_AR5312_ENABLE 0xbc003080 2574 + #define AR5K_AR5312_ENABLE_WLAN0 0x00000001 2575 + #define AR5K_AR5312_ENABLE_WLAN1 0x00000008 2576 + 2577 + #define AR5K_AR2315_RESET 0xb1000004 2578 + #define AR5K_AR2315_RESET_WMAC 0x00000001 2579 + #define AR5K_AR2315_RESET_BB_WARM 0x00000002 2580 + 2581 + #define AR5K_AR2315_AHB_ARB_CTL 0xb1000008 2582 + #define AR5K_AR2315_AHB_ARB_CTL_WLAN 0x00000002 2583 + 2584 + #define AR5K_AR2315_BYTESWAP 0xb100000c 2585 + #define AR5K_AR2315_BYTESWAP_WMAC 0x00000002
+584 -651
drivers/net/wireless/ath/ath5k/reset.c
··· 27 27 28 28 #include <linux/pci.h> /* To determine if a card is pci-e */ 29 29 #include <linux/log2.h> 30 + #include <linux/platform_device.h> 30 31 #include "ath5k.h" 31 32 #include "reg.h" 32 33 #include "base.h" 33 34 #include "debug.h" 35 + 36 + 37 + /******************\ 38 + * Helper functions * 39 + \******************/ 34 40 35 41 /* 36 42 * Check if a register write has been completed ··· 59 53 return (i <= 0) ? -EAGAIN : 0; 60 54 } 61 55 56 + 57 + /*************************\ 58 + * Clock related functions * 59 + \*************************/ 60 + 62 61 /** 63 - * ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212 62 + * ath5k_hw_htoclock - Translate usec to hw clock units 64 63 * 65 - * @ah: the &struct ath5k_hw 66 - * @channel: the currently set channel upon reset 67 - * 68 - * Write the delta slope coefficient (used on pilot tracking ?) for OFDM 69 - * operation on the AR5212 upon reset. This is a helper for ath5k_hw_reset(). 70 - * 71 - * Since delta slope is floating point we split it on its exponent and 72 - * mantissa and provide these values on hw. 73 - * 74 - * For more infos i think this patent is related 75 - * http://www.freepatentsonline.com/7184495.html 64 + * @ah: The &struct ath5k_hw 65 + * @usec: value in microseconds 76 66 */ 77 - static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, 78 - struct ieee80211_channel *channel) 67 + unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec) 79 68 { 80 - /* Get exponent and mantissa and set it */ 81 - u32 coef_scaled, coef_exp, coef_man, 82 - ds_coef_exp, ds_coef_man, clock; 83 - 84 - BUG_ON(!(ah->ah_version == AR5K_AR5212) || 85 - !(channel->hw_value & CHANNEL_OFDM)); 86 - 87 - /* Get coefficient 88 - * ALGO: coef = (5 * clock / carrier_freq) / 2 89 - * we scale coef by shifting clock value by 24 for 90 - * better precision since we use integers */ 91 - /* TODO: Half/quarter rate */ 92 - clock = (channel->hw_value & CHANNEL_TURBO) ? 80 : 40; 93 - coef_scaled = ((5 * (clock << 24)) / 2) / channel->center_freq; 94 - 95 - /* Get exponent 96 - * ALGO: coef_exp = 14 - highest set bit position */ 97 - coef_exp = ilog2(coef_scaled); 98 - 99 - /* Doesn't make sense if it's zero*/ 100 - if (!coef_scaled || !coef_exp) 101 - return -EINVAL; 102 - 103 - /* Note: we've shifted coef_scaled by 24 */ 104 - coef_exp = 14 - (coef_exp - 24); 105 - 106 - 107 - /* Get mantissa (significant digits) 108 - * ALGO: coef_mant = floor(coef_scaled* 2^coef_exp+0.5) */ 109 - coef_man = coef_scaled + 110 - (1 << (24 - coef_exp - 1)); 111 - 112 - /* Calculate delta slope coefficient exponent 113 - * and mantissa (remove scaling) and set them on hw */ 114 - ds_coef_man = coef_man >> (24 - coef_exp); 115 - ds_coef_exp = coef_exp - 16; 116 - 117 - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3, 118 - AR5K_PHY_TIMING_3_DSC_MAN, ds_coef_man); 119 - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3, 120 - AR5K_PHY_TIMING_3_DSC_EXP, ds_coef_exp); 121 - 122 - return 0; 69 + struct ath_common *common = ath5k_hw_common(ah); 70 + return usec * common->clockrate; 123 71 } 124 72 125 - 126 - /* 127 - * index into rates for control rates, we can set it up like this because 128 - * this is only used for AR5212 and we know it supports G mode 73 + /** 74 + * ath5k_hw_clocktoh - Translate hw clock units to usec 75 + * @clock: value in hw clock units 129 76 */ 130 - static const unsigned int control_rates[] = 131 - { 0, 1, 1, 1, 4, 4, 6, 6, 8, 8, 8, 8 }; 77 + unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock) 78 + { 79 + struct ath_common *common = ath5k_hw_common(ah); 80 + return clock / common->clockrate; 81 + } 132 82 133 83 /** 134 - * ath5k_hw_write_rate_duration - fill rate code to duration table 84 + * ath5k_hw_init_core_clock - Initialize core clock 135 85 * 136 - * @ah: the &struct ath5k_hw 137 - * @mode: one of enum ath5k_driver_mode 86 + * @ah The &struct ath5k_hw 138 87 * 139 - * Write the rate code to duration table upon hw reset. This is a helper for 140 - * ath5k_hw_reset(). It seems all this is doing is setting an ACK timeout on 141 - * the hardware, based on current mode, for each rate. The rates which are 142 - * capable of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have 143 - * different rate code so we write their value twice (one for long preample 144 - * and one for short). 145 - * 146 - * Note: Band doesn't matter here, if we set the values for OFDM it works 147 - * on both a and g modes. So all we have to do is set values for all g rates 148 - * that include all OFDM and CCK rates. If we operate in turbo or xr/half/ 149 - * quarter rate mode, we need to use another set of bitrates (that's why we 150 - * need the mode parameter) but we don't handle these proprietary modes yet. 88 + * Initialize core clock parameters (usec, usec32, latencies etc). 151 89 */ 152 - static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah, 153 - unsigned int mode) 90 + static void ath5k_hw_init_core_clock(struct ath5k_hw *ah) 154 91 { 155 - struct ath5k_softc *sc = ah->ah_sc; 156 - struct ieee80211_rate *rate; 157 - unsigned int i; 92 + struct ieee80211_channel *channel = ah->ah_current_channel; 93 + struct ath_common *common = ath5k_hw_common(ah); 94 + u32 usec_reg, txlat, rxlat, usec, clock, sclock, txf2txs; 158 95 159 - /* Write rate duration table */ 160 - for (i = 0; i < sc->sbands[IEEE80211_BAND_2GHZ].n_bitrates; i++) { 161 - u32 reg; 162 - u16 tx_time; 96 + /* 97 + * Set core clock frequency 98 + */ 99 + if (channel->hw_value & CHANNEL_5GHZ) 100 + clock = 40; /* 802.11a */ 101 + else if (channel->hw_value & CHANNEL_CCK) 102 + clock = 22; /* 802.11b */ 103 + else 104 + clock = 44; /* 802.11g */ 163 105 164 - rate = &sc->sbands[IEEE80211_BAND_2GHZ].bitrates[control_rates[i]]; 106 + /* Use clock multiplier for non-default 107 + * bwmode */ 108 + switch (ah->ah_bwmode) { 109 + case AR5K_BWMODE_40MHZ: 110 + clock *= 2; 111 + break; 112 + case AR5K_BWMODE_10MHZ: 113 + clock /= 2; 114 + break; 115 + case AR5K_BWMODE_5MHZ: 116 + clock /= 4; 117 + break; 118 + default: 119 + break; 120 + } 165 121 166 - /* Set ACK timeout */ 167 - reg = AR5K_RATE_DUR(rate->hw_value); 122 + common->clockrate = clock; 168 123 169 - /* An ACK frame consists of 10 bytes. If you add the FCS, 170 - * which ieee80211_generic_frame_duration() adds, 171 - * its 14 bytes. Note we use the control rate and not the 172 - * actual rate for this rate. See mac80211 tx.c 173 - * ieee80211_duration() for a brief description of 174 - * what rate we should choose to TX ACKs. */ 175 - tx_time = le16_to_cpu(ieee80211_generic_frame_duration(sc->hw, 176 - NULL, 10, rate)); 124 + /* 125 + * Set USEC parameters 126 + */ 127 + /* Set USEC counter on PCU*/ 128 + usec = clock - 1; 129 + usec = AR5K_REG_SM(usec, AR5K_USEC_1); 177 130 178 - ath5k_hw_reg_write(ah, tx_time, reg); 131 + /* Set usec duration on DCU */ 132 + if (ah->ah_version != AR5K_AR5210) 133 + AR5K_REG_WRITE_BITS(ah, AR5K_DCU_GBL_IFS_MISC, 134 + AR5K_DCU_GBL_IFS_MISC_USEC_DUR, 135 + clock); 179 136 180 - if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) 181 - continue; 137 + /* Set 32MHz USEC counter */ 138 + if ((ah->ah_radio == AR5K_RF5112) || 139 + (ah->ah_radio == AR5K_RF5413) || 140 + (ah->ah_radio == AR5K_RF2316) || 141 + (ah->ah_radio == AR5K_RF2317)) 142 + /* Remain on 40MHz clock ? */ 143 + sclock = 40 - 1; 144 + else 145 + sclock = 32 - 1; 146 + sclock = AR5K_REG_SM(sclock, AR5K_USEC_32); 182 147 183 - /* 184 - * We're not distinguishing short preamble here, 185 - * This is true, all we'll get is a longer value here 186 - * which is not necessarilly bad. We could use 187 - * export ieee80211_frame_duration() but that needs to be 188 - * fixed first to be properly used by mac802111 drivers: 148 + /* 149 + * Set tx/rx latencies 150 + */ 151 + usec_reg = ath5k_hw_reg_read(ah, AR5K_USEC_5211); 152 + txlat = AR5K_REG_MS(usec_reg, AR5K_USEC_TX_LATENCY_5211); 153 + rxlat = AR5K_REG_MS(usec_reg, AR5K_USEC_RX_LATENCY_5211); 154 + 155 + /* 156 + * 5210 initvals don't include usec settings 157 + * so we need to use magic values here for 158 + * tx/rx latencies 159 + */ 160 + if (ah->ah_version == AR5K_AR5210) { 161 + /* same for turbo */ 162 + txlat = AR5K_INIT_TX_LATENCY_5210; 163 + rxlat = AR5K_INIT_RX_LATENCY_5210; 164 + } 165 + 166 + if (ah->ah_mac_srev < AR5K_SREV_AR5211) { 167 + /* 5311 has different tx/rx latency masks 168 + * from 5211, since we deal 5311 the same 169 + * as 5211 when setting initvals, shift 170 + * values here to their proper locations 189 171 * 190 - * - remove erp stuff and let the routine figure ofdm 191 - * erp rates 192 - * - remove passing argument ieee80211_local as 193 - * drivers don't have access to it 194 - * - move drivers using ieee80211_generic_frame_duration() 195 - * to this 196 - */ 197 - ath5k_hw_reg_write(ah, tx_time, 198 - reg + (AR5K_SET_SHORT_PREAMBLE << 2)); 172 + * Note: Initvals indicate tx/rx/ latencies 173 + * are the same for turbo mode */ 174 + txlat = AR5K_REG_SM(txlat, AR5K_USEC_TX_LATENCY_5210); 175 + rxlat = AR5K_REG_SM(rxlat, AR5K_USEC_RX_LATENCY_5210); 176 + } else 177 + switch (ah->ah_bwmode) { 178 + case AR5K_BWMODE_10MHZ: 179 + txlat = AR5K_REG_SM(txlat * 2, 180 + AR5K_USEC_TX_LATENCY_5211); 181 + rxlat = AR5K_REG_SM(AR5K_INIT_RX_LAT_MAX, 182 + AR5K_USEC_RX_LATENCY_5211); 183 + txf2txs = AR5K_INIT_TXF2TXD_START_DELAY_10MHZ; 184 + break; 185 + case AR5K_BWMODE_5MHZ: 186 + txlat = AR5K_REG_SM(txlat * 4, 187 + AR5K_USEC_TX_LATENCY_5211); 188 + rxlat = AR5K_REG_SM(AR5K_INIT_RX_LAT_MAX, 189 + AR5K_USEC_RX_LATENCY_5211); 190 + txf2txs = AR5K_INIT_TXF2TXD_START_DELAY_5MHZ; 191 + break; 192 + case AR5K_BWMODE_40MHZ: 193 + txlat = AR5K_INIT_TX_LAT_MIN; 194 + rxlat = AR5K_REG_SM(rxlat / 2, 195 + AR5K_USEC_RX_LATENCY_5211); 196 + txf2txs = AR5K_INIT_TXF2TXD_START_DEFAULT; 197 + break; 198 + default: 199 + break; 200 + } 201 + 202 + usec_reg = (usec | sclock | txlat | rxlat); 203 + ath5k_hw_reg_write(ah, usec_reg, AR5K_USEC); 204 + 205 + /* On 5112 set tx frane to tx data start delay */ 206 + if (ah->ah_radio == AR5K_RF5112) { 207 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RF_CTL2, 208 + AR5K_PHY_RF_CTL2_TXF2TXD_START, 209 + txf2txs); 199 210 } 200 211 } 212 + 213 + /* 214 + * If there is an external 32KHz crystal available, use it 215 + * as ref. clock instead of 32/40MHz clock and baseband clocks 216 + * to save power during sleep or restore normal 32/40MHz 217 + * operation. 218 + * 219 + * XXX: When operating on 32KHz certain PHY registers (27 - 31, 220 + * 123 - 127) require delay on access. 221 + */ 222 + static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable) 223 + { 224 + struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; 225 + u32 scal, spending; 226 + 227 + /* Only set 32KHz settings if we have an external 228 + * 32KHz crystal present */ 229 + if ((AR5K_EEPROM_HAS32KHZCRYSTAL(ee->ee_misc1) || 230 + AR5K_EEPROM_HAS32KHZCRYSTAL_OLD(ee->ee_misc1)) && 231 + enable) { 232 + 233 + /* 1 usec/cycle */ 234 + AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, 1); 235 + /* Set up tsf increment on each cycle */ 236 + AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 61); 237 + 238 + /* Set baseband sleep control registers 239 + * and sleep control rate */ 240 + ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR); 241 + 242 + if ((ah->ah_radio == AR5K_RF5112) || 243 + (ah->ah_radio == AR5K_RF5413) || 244 + (ah->ah_radio == AR5K_RF2316) || 245 + (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) 246 + spending = 0x14; 247 + else 248 + spending = 0x18; 249 + ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING); 250 + 251 + if ((ah->ah_radio == AR5K_RF5112) || 252 + (ah->ah_radio == AR5K_RF5413) || 253 + (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) { 254 + ath5k_hw_reg_write(ah, 0x26, AR5K_PHY_SLMT); 255 + ath5k_hw_reg_write(ah, 0x0d, AR5K_PHY_SCAL); 256 + ath5k_hw_reg_write(ah, 0x07, AR5K_PHY_SCLOCK); 257 + ath5k_hw_reg_write(ah, 0x3f, AR5K_PHY_SDELAY); 258 + AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, 259 + AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x02); 260 + } else { 261 + ath5k_hw_reg_write(ah, 0x0a, AR5K_PHY_SLMT); 262 + ath5k_hw_reg_write(ah, 0x0c, AR5K_PHY_SCAL); 263 + ath5k_hw_reg_write(ah, 0x03, AR5K_PHY_SCLOCK); 264 + ath5k_hw_reg_write(ah, 0x20, AR5K_PHY_SDELAY); 265 + AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, 266 + AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x03); 267 + } 268 + 269 + /* Enable sleep clock operation */ 270 + AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, 271 + AR5K_PCICFG_SLEEP_CLOCK_EN); 272 + 273 + } else { 274 + 275 + /* Disable sleep clock operation and 276 + * restore default parameters */ 277 + AR5K_REG_DISABLE_BITS(ah, AR5K_PCICFG, 278 + AR5K_PCICFG_SLEEP_CLOCK_EN); 279 + 280 + AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, 281 + AR5K_PCICFG_SLEEP_CLOCK_RATE, 0); 282 + 283 + /* Set DAC/ADC delays */ 284 + ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR); 285 + ath5k_hw_reg_write(ah, AR5K_PHY_SLMT_32MHZ, AR5K_PHY_SLMT); 286 + 287 + if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)) 288 + scal = AR5K_PHY_SCAL_32MHZ_2417; 289 + else if (ee->ee_is_hb63) 290 + scal = AR5K_PHY_SCAL_32MHZ_HB63; 291 + else 292 + scal = AR5K_PHY_SCAL_32MHZ; 293 + ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL); 294 + 295 + ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK); 296 + ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY); 297 + 298 + if ((ah->ah_radio == AR5K_RF5112) || 299 + (ah->ah_radio == AR5K_RF5413) || 300 + (ah->ah_radio == AR5K_RF2316) || 301 + (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) 302 + spending = 0x14; 303 + else 304 + spending = 0x18; 305 + ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING); 306 + 307 + /* Set up tsf increment on each cycle */ 308 + AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 1); 309 + } 310 + } 311 + 312 + 313 + /*********************\ 314 + * Reset/Sleep control * 315 + \*********************/ 201 316 202 317 /* 203 318 * Reset chipset ··· 361 234 362 235 return ret; 363 236 } 237 + 238 + /* 239 + * Reset AHB chipset 240 + * AR5K_RESET_CTL_PCU flag resets WMAC 241 + * AR5K_RESET_CTL_BASEBAND flag resets WBB 242 + */ 243 + static int ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) 244 + { 245 + u32 mask = flags ? flags : ~0U; 246 + volatile u32 *reg; 247 + u32 regval; 248 + u32 val = 0; 249 + 250 + /* ah->ah_mac_srev is not available at this point yet */ 251 + if (ah->ah_sc->devid >= AR5K_SREV_AR2315_R6) { 252 + reg = (u32 *) AR5K_AR2315_RESET; 253 + if (mask & AR5K_RESET_CTL_PCU) 254 + val |= AR5K_AR2315_RESET_WMAC; 255 + if (mask & AR5K_RESET_CTL_BASEBAND) 256 + val |= AR5K_AR2315_RESET_BB_WARM; 257 + } else { 258 + reg = (u32 *) AR5K_AR5312_RESET; 259 + if (to_platform_device(ah->ah_sc->dev)->id == 0) { 260 + if (mask & AR5K_RESET_CTL_PCU) 261 + val |= AR5K_AR5312_RESET_WMAC0; 262 + if (mask & AR5K_RESET_CTL_BASEBAND) 263 + val |= AR5K_AR5312_RESET_BB0_COLD | 264 + AR5K_AR5312_RESET_BB0_WARM; 265 + } else { 266 + if (mask & AR5K_RESET_CTL_PCU) 267 + val |= AR5K_AR5312_RESET_WMAC1; 268 + if (mask & AR5K_RESET_CTL_BASEBAND) 269 + val |= AR5K_AR5312_RESET_BB1_COLD | 270 + AR5K_AR5312_RESET_BB1_WARM; 271 + } 272 + } 273 + 274 + /* Put BB/MAC into reset */ 275 + regval = __raw_readl(reg); 276 + __raw_writel(regval | val, reg); 277 + regval = __raw_readl(reg); 278 + udelay(100); 279 + 280 + /* Bring BB/MAC out of reset */ 281 + __raw_writel(regval & ~val, reg); 282 + regval = __raw_readl(reg); 283 + 284 + /* 285 + * Reset configuration register (for hw byte-swap). Note that this 286 + * is only set for big endian. We do the necessary magic in 287 + * AR5K_INIT_CFG. 288 + */ 289 + if ((flags & AR5K_RESET_CTL_PCU) == 0) 290 + ath5k_hw_reg_write(ah, AR5K_INIT_CFG, AR5K_CFG); 291 + 292 + return 0; 293 + } 294 + 364 295 365 296 /* 366 297 * Sleep control ··· 519 334 u32 bus_flags; 520 335 int ret; 521 336 337 + if (ath5k_get_bus_type(ah) == ATH_AHB) 338 + return 0; 339 + 522 340 /* Make sure device is awake */ 523 341 ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0); 524 342 if (ret) { ··· 537 349 * we ingore that flag for PCI-E cards. On PCI cards 538 350 * this flag gets cleared after 64 PCI clocks. 539 351 */ 540 - bus_flags = (pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; 352 + bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; 541 353 542 354 if (ah->ah_version == AR5K_AR5210) { 543 355 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | ··· 566 378 567 379 /* 568 380 * Bring up MAC + PHY Chips and program PLL 569 - * TODO: Half/Quarter rate support 570 381 */ 571 382 int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) 572 383 { ··· 577 390 mode = 0; 578 391 clock = 0; 579 392 580 - /* Wakeup the device */ 581 - ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0); 582 - if (ret) { 583 - ATH5K_ERR(ah->ah_sc, "failed to wakeup the MAC Chip\n"); 584 - return ret; 393 + if ((ath5k_get_bus_type(ah) != ATH_AHB) || !initial) { 394 + /* Wakeup the device */ 395 + ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0); 396 + if (ret) { 397 + ATH5K_ERR(ah->ah_sc, "failed to wakeup the MAC Chip\n"); 398 + return ret; 399 + } 585 400 } 586 401 587 402 /* ··· 594 405 * we ingore that flag for PCI-E cards. On PCI cards 595 406 * this flag gets cleared after 64 PCI clocks. 596 407 */ 597 - bus_flags = (pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; 408 + bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; 598 409 599 410 if (ah->ah_version == AR5K_AR5210) { 600 411 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | ··· 602 413 AR5K_RESET_CTL_PHY | AR5K_RESET_CTL_PCI); 603 414 mdelay(2); 604 415 } else { 605 - ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | 606 - AR5K_RESET_CTL_BASEBAND | bus_flags); 416 + if (ath5k_get_bus_type(ah) == ATH_AHB) 417 + ret = ath5k_hw_wisoc_reset(ah, AR5K_RESET_CTL_PCU | 418 + AR5K_RESET_CTL_BASEBAND); 419 + else 420 + ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | 421 + AR5K_RESET_CTL_BASEBAND | bus_flags); 607 422 } 608 423 609 424 if (ret) { ··· 622 429 return ret; 623 430 } 624 431 625 - /* ...clear reset control register and pull device out of 626 - * warm reset */ 627 - if (ath5k_hw_nic_reset(ah, 0)) { 432 + /* ...reset configuration regiter on Wisoc ... 433 + * ...clear reset control register and pull device out of 434 + * warm reset on others */ 435 + if (ath5k_get_bus_type(ah) == ATH_AHB) 436 + ret = ath5k_hw_wisoc_reset(ah, 0); 437 + else 438 + ret = ath5k_hw_nic_reset(ah, 0); 439 + 440 + if (ret) { 628 441 ATH5K_ERR(ah->ah_sc, "failed to warm reset the MAC Chip\n"); 629 442 return -EIO; 630 443 } ··· 665 466 * CCK headers) operation. We need to test 666 467 * this, 5211 might support ofdm-only g after 667 468 * all, there are also initial register values 668 - * in the code for g mode (see initvals.c). */ 469 + * in the code for g mode (see initvals.c). 470 + */ 669 471 if (ah->ah_version == AR5K_AR5211) 670 472 mode |= AR5K_PHY_MODE_MOD_OFDM; 671 473 else ··· 679 479 } else if (flags & CHANNEL_5GHZ) { 680 480 mode |= AR5K_PHY_MODE_FREQ_5GHZ; 681 481 482 + /* Different PLL setting for 5413 */ 682 483 if (ah->ah_radio == AR5K_RF5413) 683 484 clock = AR5K_PHY_PLL_40MHZ_5413; 684 485 else ··· 697 496 return -EINVAL; 698 497 } 699 498 700 - if (flags & CHANNEL_TURBO) 701 - turbo = AR5K_PHY_TURBO_MODE | AR5K_PHY_TURBO_SHORT; 499 + /*XXX: Can bwmode be used with dynamic mode ? 500 + * (I don't think it supports 44MHz) */ 501 + /* On 2425 initvals TURBO_SHORT is not pressent */ 502 + if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) { 503 + turbo = AR5K_PHY_TURBO_MODE | 504 + (ah->ah_radio == AR5K_RF2425) ? 0 : 505 + AR5K_PHY_TURBO_SHORT; 506 + } else if (ah->ah_bwmode != AR5K_BWMODE_DEFAULT) { 507 + if (ah->ah_radio == AR5K_RF5413) { 508 + mode |= (ah->ah_bwmode == AR5K_BWMODE_10MHZ) ? 509 + AR5K_PHY_MODE_HALF_RATE : 510 + AR5K_PHY_MODE_QUARTER_RATE; 511 + } else if (ah->ah_version == AR5K_AR5212) { 512 + clock |= (ah->ah_bwmode == AR5K_BWMODE_10MHZ) ? 513 + AR5K_PHY_PLL_HALF_RATE : 514 + AR5K_PHY_PLL_QUARTER_RATE; 515 + } 516 + } 517 + 702 518 } else { /* Reset the device */ 703 519 704 520 /* ...enable Atheros turbo mode if requested */ 705 - if (flags & CHANNEL_TURBO) 521 + if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) 706 522 ath5k_hw_reg_write(ah, AR5K_PHY_TURBO_MODE, 707 523 AR5K_PHY_TURBO); 708 524 } ··· 740 522 return 0; 741 523 } 742 524 743 - /* 744 - * If there is an external 32KHz crystal available, use it 745 - * as ref. clock instead of 32/40MHz clock and baseband clocks 746 - * to save power during sleep or restore normal 32/40MHz 747 - * operation. 748 - * 749 - * XXX: When operating on 32KHz certain PHY registers (27 - 31, 750 - * 123 - 127) require delay on access. 751 - */ 752 - static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable) 753 - { 754 - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; 755 - u32 scal, spending, usec32; 756 525 757 - /* Only set 32KHz settings if we have an external 758 - * 32KHz crystal present */ 759 - if ((AR5K_EEPROM_HAS32KHZCRYSTAL(ee->ee_misc1) || 760 - AR5K_EEPROM_HAS32KHZCRYSTAL_OLD(ee->ee_misc1)) && 761 - enable) { 762 - 763 - /* 1 usec/cycle */ 764 - AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, 1); 765 - /* Set up tsf increment on each cycle */ 766 - AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 61); 767 - 768 - /* Set baseband sleep control registers 769 - * and sleep control rate */ 770 - ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR); 771 - 772 - if ((ah->ah_radio == AR5K_RF5112) || 773 - (ah->ah_radio == AR5K_RF5413) || 774 - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) 775 - spending = 0x14; 776 - else 777 - spending = 0x18; 778 - ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING); 779 - 780 - if ((ah->ah_radio == AR5K_RF5112) || 781 - (ah->ah_radio == AR5K_RF5413) || 782 - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) { 783 - ath5k_hw_reg_write(ah, 0x26, AR5K_PHY_SLMT); 784 - ath5k_hw_reg_write(ah, 0x0d, AR5K_PHY_SCAL); 785 - ath5k_hw_reg_write(ah, 0x07, AR5K_PHY_SCLOCK); 786 - ath5k_hw_reg_write(ah, 0x3f, AR5K_PHY_SDELAY); 787 - AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, 788 - AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x02); 789 - } else { 790 - ath5k_hw_reg_write(ah, 0x0a, AR5K_PHY_SLMT); 791 - ath5k_hw_reg_write(ah, 0x0c, AR5K_PHY_SCAL); 792 - ath5k_hw_reg_write(ah, 0x03, AR5K_PHY_SCLOCK); 793 - ath5k_hw_reg_write(ah, 0x20, AR5K_PHY_SDELAY); 794 - AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, 795 - AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x03); 796 - } 797 - 798 - /* Enable sleep clock operation */ 799 - AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, 800 - AR5K_PCICFG_SLEEP_CLOCK_EN); 801 - 802 - } else { 803 - 804 - /* Disable sleep clock operation and 805 - * restore default parameters */ 806 - AR5K_REG_DISABLE_BITS(ah, AR5K_PCICFG, 807 - AR5K_PCICFG_SLEEP_CLOCK_EN); 808 - 809 - AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, 810 - AR5K_PCICFG_SLEEP_CLOCK_RATE, 0); 811 - 812 - ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR); 813 - ath5k_hw_reg_write(ah, AR5K_PHY_SLMT_32MHZ, AR5K_PHY_SLMT); 814 - 815 - if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)) 816 - scal = AR5K_PHY_SCAL_32MHZ_2417; 817 - else if (ee->ee_is_hb63) 818 - scal = AR5K_PHY_SCAL_32MHZ_HB63; 819 - else 820 - scal = AR5K_PHY_SCAL_32MHZ; 821 - ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL); 822 - 823 - ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK); 824 - ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY); 825 - 826 - if ((ah->ah_radio == AR5K_RF5112) || 827 - (ah->ah_radio == AR5K_RF5413) || 828 - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) 829 - spending = 0x14; 830 - else 831 - spending = 0x18; 832 - ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING); 833 - 834 - if ((ah->ah_radio == AR5K_RF5112) || 835 - (ah->ah_radio == AR5K_RF5413)) 836 - usec32 = 39; 837 - else 838 - usec32 = 31; 839 - AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, usec32); 840 - 841 - AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 1); 842 - } 843 - } 526 + /**************************************\ 527 + * Post-initvals register modifications * 528 + \**************************************/ 844 529 845 530 /* TODO: Half/Quarter rate */ 846 531 static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah, ··· 784 663 AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG, 785 664 AR5K_TXCFG_DCU_DBL_BUF_DIS); 786 665 787 - /* Set DAC/ADC delays */ 788 - if (ah->ah_version == AR5K_AR5212) { 789 - u32 scal; 790 - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; 791 - if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)) 792 - scal = AR5K_PHY_SCAL_32MHZ_2417; 793 - else if (ee->ee_is_hb63) 794 - scal = AR5K_PHY_SCAL_32MHZ_HB63; 795 - else 796 - scal = AR5K_PHY_SCAL_32MHZ; 797 - ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL); 798 - } 799 - 800 666 /* Set fast ADC */ 801 667 if ((ah->ah_radio == AR5K_RF5413) || 802 - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) { 668 + (ah->ah_radio == AR5K_RF2317) || 669 + (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) { 803 670 u32 fast_adc = true; 804 671 805 672 if (channel->center_freq == 2462 || ··· 815 706 } 816 707 817 708 if (ah->ah_mac_srev < AR5K_SREV_AR5211) { 818 - u32 usec_reg; 819 - /* 5311 has different tx/rx latency masks 820 - * from 5211, since we deal 5311 the same 821 - * as 5211 when setting initvals, shift 822 - * values here to their proper locations */ 823 - usec_reg = ath5k_hw_reg_read(ah, AR5K_USEC_5211); 824 - ath5k_hw_reg_write(ah, usec_reg & (AR5K_USEC_1 | 825 - AR5K_USEC_32 | 826 - AR5K_USEC_TX_LATENCY_5211 | 827 - AR5K_REG_SM(29, 828 - AR5K_USEC_RX_LATENCY_5210)), 829 - AR5K_USEC_5211); 830 709 /* Clear QCU/DCU clock gating register */ 831 710 ath5k_hw_reg_write(ah, 0, AR5K_QCUDCU_CLKGT); 832 711 /* Set DAC/ADC delays */ 833 - ath5k_hw_reg_write(ah, 0x08, AR5K_PHY_SCAL); 712 + ath5k_hw_reg_write(ah, AR5K_PHY_SCAL_32MHZ_5311, 713 + AR5K_PHY_SCAL); 834 714 /* Enable PCU FIFO corruption ECO */ 835 715 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211, 836 716 AR5K_DIAG_SW_ECO_ENABLE); 717 + } 718 + 719 + if (ah->ah_bwmode) { 720 + /* Increase PHY switch and AGC settling time 721 + * on turbo mode (ath5k_hw_commit_eeprom_settings 722 + * will override settling time if available) */ 723 + if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) { 724 + 725 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING, 726 + AR5K_PHY_SETTLING_AGC, 727 + AR5K_AGC_SETTLING_TURBO); 728 + 729 + /* XXX: Initvals indicate we only increase 730 + * switch time on AR5212, 5211 and 5210 731 + * only change agc time (bug?) */ 732 + if (ah->ah_version == AR5K_AR5212) 733 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING, 734 + AR5K_PHY_SETTLING_SWITCH, 735 + AR5K_SWITCH_SETTLING_TURBO); 736 + 737 + if (ah->ah_version == AR5K_AR5210) { 738 + /* Set Frame Control Register */ 739 + ath5k_hw_reg_write(ah, 740 + (AR5K_PHY_FRAME_CTL_INI | 741 + AR5K_PHY_TURBO_MODE | 742 + AR5K_PHY_TURBO_SHORT | 0x2020), 743 + AR5K_PHY_FRAME_CTL_5210); 744 + } 745 + /* On 5413 PHY force window length for half/quarter rate*/ 746 + } else if ((ah->ah_mac_srev >= AR5K_SREV_AR5424) && 747 + (ah->ah_mac_srev <= AR5K_SREV_AR5414)) { 748 + AR5K_REG_WRITE_BITS(ah, AR5K_PHY_FRAME_CTL_5211, 749 + AR5K_PHY_FRAME_CTL_WIN_LEN, 750 + 3); 751 + } 752 + } else if (ah->ah_version == AR5K_AR5210) { 753 + /* Set Frame Control Register for normal operation */ 754 + ath5k_hw_reg_write(ah, (AR5K_PHY_FRAME_CTL_INI | 0x1020), 755 + AR5K_PHY_FRAME_CTL_5210); 837 756 } 838 757 } 839 758 ··· 870 733 { 871 734 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; 872 735 s16 cck_ofdm_pwr_delta; 736 + 737 + /* TODO: Add support for AR5210 EEPROM */ 738 + if (ah->ah_version == AR5K_AR5210) 739 + return; 873 740 874 741 /* Adjust power delta for channel 14 */ 875 742 if (channel->center_freq == 2484) ··· 913 772 AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]), 914 773 AR5K_PHY_NFTHRES); 915 774 916 - if ((channel->hw_value & CHANNEL_TURBO) && 775 + if ((ah->ah_bwmode == AR5K_BWMODE_40MHZ) && 917 776 (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_0)) { 918 777 /* Switch settling time (Turbo) */ 919 778 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING, ··· 1011 870 ath5k_hw_reg_write(ah, 0, AR5K_PHY_HEAVY_CLIP_ENABLE); 1012 871 } 1013 872 1014 - /* 1015 - * Main reset function 1016 - */ 873 + 874 + /*********************\ 875 + * Main reset function * 876 + \*********************/ 877 + 1017 878 int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, 1018 - struct ieee80211_channel *channel, bool change_channel) 879 + struct ieee80211_channel *channel, bool fast, bool skip_pcu) 1019 880 { 1020 - struct ath_common *common = ath5k_hw_common(ah); 1021 - u32 s_seq[10], s_led[3], staid1_flags, tsf_up, tsf_lo; 1022 - u32 phy_tst1; 881 + u32 s_seq[10], s_led[3], tsf_up, tsf_lo; 1023 882 u8 mode, freq, ee_mode; 1024 883 int i, ret; 1025 884 1026 885 ee_mode = 0; 1027 - staid1_flags = 0; 1028 886 tsf_up = 0; 1029 887 tsf_lo = 0; 1030 888 freq = 0; 1031 889 mode = 0; 1032 890 1033 891 /* 1034 - * Save some registers before a reset 892 + * Sanity check for fast flag 893 + * Fast channel change only available 894 + * on AR2413/AR5413. 1035 895 */ 1036 - /*DCU/Antenna selection not available on 5210*/ 1037 - if (ah->ah_version != AR5K_AR5210) { 896 + if (fast && (ah->ah_radio != AR5K_RF2413) && 897 + (ah->ah_radio != AR5K_RF5413)) 898 + fast = 0; 1038 899 1039 - switch (channel->hw_value & CHANNEL_MODES) { 1040 - case CHANNEL_A: 1041 - mode = AR5K_MODE_11A; 1042 - freq = AR5K_INI_RFGAIN_5GHZ; 1043 - ee_mode = AR5K_EEPROM_MODE_11A; 1044 - break; 1045 - case CHANNEL_G: 1046 - mode = AR5K_MODE_11G; 1047 - freq = AR5K_INI_RFGAIN_2GHZ; 1048 - ee_mode = AR5K_EEPROM_MODE_11G; 1049 - break; 1050 - case CHANNEL_B: 1051 - mode = AR5K_MODE_11B; 1052 - freq = AR5K_INI_RFGAIN_2GHZ; 1053 - ee_mode = AR5K_EEPROM_MODE_11B; 1054 - break; 1055 - case CHANNEL_T: 1056 - mode = AR5K_MODE_11A_TURBO; 1057 - freq = AR5K_INI_RFGAIN_5GHZ; 1058 - ee_mode = AR5K_EEPROM_MODE_11A; 1059 - break; 1060 - case CHANNEL_TG: 1061 - if (ah->ah_version == AR5K_AR5211) { 1062 - ATH5K_ERR(ah->ah_sc, 1063 - "TurboG mode not available on 5211"); 1064 - return -EINVAL; 1065 - } 1066 - mode = AR5K_MODE_11G_TURBO; 1067 - freq = AR5K_INI_RFGAIN_2GHZ; 1068 - ee_mode = AR5K_EEPROM_MODE_11G; 1069 - break; 1070 - case CHANNEL_XR: 1071 - if (ah->ah_version == AR5K_AR5211) { 1072 - ATH5K_ERR(ah->ah_sc, 1073 - "XR mode not available on 5211"); 1074 - return -EINVAL; 1075 - } 1076 - mode = AR5K_MODE_XR; 1077 - freq = AR5K_INI_RFGAIN_5GHZ; 1078 - ee_mode = AR5K_EEPROM_MODE_11A; 1079 - break; 1080 - default: 900 + /* Disable sleep clock operation 901 + * to avoid register access delay on certain 902 + * PHY registers */ 903 + if (ah->ah_version == AR5K_AR5212) 904 + ath5k_hw_set_sleep_clock(ah, false); 905 + 906 + /* 907 + * Stop PCU 908 + */ 909 + ath5k_hw_stop_rx_pcu(ah); 910 + 911 + /* 912 + * Stop DMA 913 + * 914 + * Note: If DMA didn't stop continue 915 + * since only a reset will fix it. 916 + */ 917 + ret = ath5k_hw_dma_stop(ah); 918 + 919 + /* RF Bus grant won't work if we have pending 920 + * frames */ 921 + if (ret && fast) { 922 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET, 923 + "DMA didn't stop, falling back to normal reset\n"); 924 + fast = 0; 925 + /* Non fatal, just continue with 926 + * normal reset */ 927 + ret = 0; 928 + } 929 + 930 + switch (channel->hw_value & CHANNEL_MODES) { 931 + case CHANNEL_A: 932 + mode = AR5K_MODE_11A; 933 + freq = AR5K_INI_RFGAIN_5GHZ; 934 + ee_mode = AR5K_EEPROM_MODE_11A; 935 + break; 936 + case CHANNEL_G: 937 + 938 + if (ah->ah_version <= AR5K_AR5211) { 1081 939 ATH5K_ERR(ah->ah_sc, 1082 - "invalid channel: %d\n", channel->center_freq); 940 + "G mode not available on 5210/5211"); 1083 941 return -EINVAL; 1084 942 } 1085 943 1086 - if (change_channel) { 1087 - /* 1088 - * Save frame sequence count 1089 - * For revs. after Oahu, only save 1090 - * seq num for DCU 0 (Global seq num) 1091 - */ 1092 - if (ah->ah_mac_srev < AR5K_SREV_AR5211) { 944 + mode = AR5K_MODE_11G; 945 + freq = AR5K_INI_RFGAIN_2GHZ; 946 + ee_mode = AR5K_EEPROM_MODE_11G; 947 + break; 948 + case CHANNEL_B: 1093 949 1094 - for (i = 0; i < 10; i++) 1095 - s_seq[i] = ath5k_hw_reg_read(ah, 1096 - AR5K_QUEUE_DCU_SEQNUM(i)); 1097 - 1098 - } else { 1099 - s_seq[0] = ath5k_hw_reg_read(ah, 1100 - AR5K_QUEUE_DCU_SEQNUM(0)); 1101 - } 1102 - 1103 - /* TSF accelerates on AR5211 during reset 1104 - * As a workaround save it here and restore 1105 - * it later so that it's back in time after 1106 - * reset. This way it'll get re-synced on the 1107 - * next beacon without breaking ad-hoc. 1108 - * 1109 - * On AR5212 TSF is almost preserved across a 1110 - * reset so it stays back in time anyway and 1111 - * we don't have to save/restore it. 1112 - * 1113 - * XXX: Since this breaks power saving we have 1114 - * to disable power saving until we receive the 1115 - * next beacon, so we can resync beacon timers */ 1116 - if (ah->ah_version == AR5K_AR5211) { 1117 - tsf_up = ath5k_hw_reg_read(ah, AR5K_TSF_U32); 1118 - tsf_lo = ath5k_hw_reg_read(ah, AR5K_TSF_L32); 1119 - } 950 + if (ah->ah_version < AR5K_AR5211) { 951 + ATH5K_ERR(ah->ah_sc, 952 + "B mode not available on 5210"); 953 + return -EINVAL; 1120 954 } 1121 955 1122 - if (ah->ah_version == AR5K_AR5212) { 1123 - /* Restore normal 32/40MHz clock operation 1124 - * to avoid register access delay on certain 1125 - * PHY registers */ 1126 - ath5k_hw_set_sleep_clock(ah, false); 956 + mode = AR5K_MODE_11B; 957 + freq = AR5K_INI_RFGAIN_2GHZ; 958 + ee_mode = AR5K_EEPROM_MODE_11B; 959 + break; 960 + case CHANNEL_XR: 961 + if (ah->ah_version == AR5K_AR5211) { 962 + ATH5K_ERR(ah->ah_sc, 963 + "XR mode not available on 5211"); 964 + return -EINVAL; 965 + } 966 + mode = AR5K_MODE_XR; 967 + freq = AR5K_INI_RFGAIN_5GHZ; 968 + ee_mode = AR5K_EEPROM_MODE_11A; 969 + break; 970 + default: 971 + ATH5K_ERR(ah->ah_sc, 972 + "invalid channel: %d\n", channel->center_freq); 973 + return -EINVAL; 974 + } 1127 975 1128 - /* Since we are going to write rf buffer 1129 - * check if we have any pending gain_F 1130 - * optimization settings */ 1131 - if (change_channel && ah->ah_rf_banks != NULL) 1132 - ath5k_hw_gainf_calibrate(ah); 976 + /* 977 + * If driver requested fast channel change and DMA has stopped 978 + * go on. If it fails continue with a normal reset. 979 + */ 980 + if (fast) { 981 + ret = ath5k_hw_phy_init(ah, channel, mode, 982 + ee_mode, freq, true); 983 + if (ret) { 984 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET, 985 + "fast chan change failed, falling back to normal reset\n"); 986 + /* Non fatal, can happen eg. 987 + * on mode change */ 988 + ret = 0; 989 + } else 990 + return 0; 991 + } 992 + 993 + /* 994 + * Save some registers before a reset 995 + */ 996 + if (ah->ah_version != AR5K_AR5210) { 997 + /* 998 + * Save frame sequence count 999 + * For revs. after Oahu, only save 1000 + * seq num for DCU 0 (Global seq num) 1001 + */ 1002 + if (ah->ah_mac_srev < AR5K_SREV_AR5211) { 1003 + 1004 + for (i = 0; i < 10; i++) 1005 + s_seq[i] = ath5k_hw_reg_read(ah, 1006 + AR5K_QUEUE_DCU_SEQNUM(i)); 1007 + 1008 + } else { 1009 + s_seq[0] = ath5k_hw_reg_read(ah, 1010 + AR5K_QUEUE_DCU_SEQNUM(0)); 1011 + } 1012 + 1013 + /* TSF accelerates on AR5211 during reset 1014 + * As a workaround save it here and restore 1015 + * it later so that it's back in time after 1016 + * reset. This way it'll get re-synced on the 1017 + * next beacon without breaking ad-hoc. 1018 + * 1019 + * On AR5212 TSF is almost preserved across a 1020 + * reset so it stays back in time anyway and 1021 + * we don't have to save/restore it. 1022 + * 1023 + * XXX: Since this breaks power saving we have 1024 + * to disable power saving until we receive the 1025 + * next beacon, so we can resync beacon timers */ 1026 + if (ah->ah_version == AR5K_AR5211) { 1027 + tsf_up = ath5k_hw_reg_read(ah, AR5K_TSF_U32); 1028 + tsf_lo = ath5k_hw_reg_read(ah, AR5K_TSF_L32); 1133 1029 } 1134 1030 } 1031 + 1135 1032 1136 1033 /*GPIOs*/ 1137 1034 s_led[0] = ath5k_hw_reg_read(ah, AR5K_PCICFG) & ··· 1177 998 s_led[1] = ath5k_hw_reg_read(ah, AR5K_GPIOCR); 1178 999 s_led[2] = ath5k_hw_reg_read(ah, AR5K_GPIODO); 1179 1000 1180 - /* AR5K_STA_ID1 flags, only preserve antenna 1181 - * settings and ack/cts rate mode */ 1182 - staid1_flags = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 1183 - (AR5K_STA_ID1_DEFAULT_ANTENNA | 1184 - AR5K_STA_ID1_DESC_ANTENNA | 1185 - AR5K_STA_ID1_RTS_DEF_ANTENNA | 1186 - AR5K_STA_ID1_ACKCTS_6MB | 1187 - AR5K_STA_ID1_BASE_RATE_11B | 1188 - AR5K_STA_ID1_SELFGEN_DEF_ANT); 1001 + 1002 + /* 1003 + * Since we are going to write rf buffer 1004 + * check if we have any pending gain_F 1005 + * optimization settings 1006 + */ 1007 + if (ah->ah_version == AR5K_AR5212 && 1008 + (ah->ah_radio <= AR5K_RF5112)) { 1009 + if (!fast && ah->ah_rf_banks != NULL) 1010 + ath5k_hw_gainf_calibrate(ah); 1011 + } 1189 1012 1190 1013 /* Wakeup the device */ 1191 1014 ret = ath5k_hw_nic_wakeup(ah, channel->hw_value, false); ··· 1202 1021 AR5K_PHY(0)); 1203 1022 1204 1023 /* Write initial settings */ 1205 - ret = ath5k_hw_write_initvals(ah, mode, change_channel); 1024 + ret = ath5k_hw_write_initvals(ah, mode, skip_pcu); 1206 1025 if (ret) 1207 1026 return ret; 1208 1027 1028 + /* Initialize core clock settings */ 1029 + ath5k_hw_init_core_clock(ah); 1030 + 1209 1031 /* 1210 - * 5211/5212 Specific 1032 + * Tweak initval settings for revised 1033 + * chipsets and add some more config 1034 + * bits 1211 1035 */ 1212 - if (ah->ah_version != AR5K_AR5210) { 1036 + ath5k_hw_tweak_initval_settings(ah, channel); 1213 1037 1214 - /* 1215 - * Write initial RF gain settings 1216 - * This should work for both 5111/5112 1217 - */ 1218 - ret = ath5k_hw_rfgain_init(ah, freq); 1219 - if (ret) 1220 - return ret; 1038 + /* Commit values from EEPROM */ 1039 + ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode); 1221 1040 1222 - mdelay(1); 1223 - 1224 - /* 1225 - * Tweak initval settings for revised 1226 - * chipsets and add some more config 1227 - * bits 1228 - */ 1229 - ath5k_hw_tweak_initval_settings(ah, channel); 1230 - 1231 - /* 1232 - * Set TX power 1233 - */ 1234 - ret = ath5k_hw_txpower(ah, channel, ee_mode, 1235 - ah->ah_txpower.txp_max_pwr / 2); 1236 - if (ret) 1237 - return ret; 1238 - 1239 - /* Write rate duration table only on AR5212 and if 1240 - * virtual interface has already been brought up 1241 - * XXX: rethink this after new mode changes to 1242 - * mac80211 are integrated */ 1243 - if (ah->ah_version == AR5K_AR5212 && 1244 - ah->ah_sc->nvifs) 1245 - ath5k_hw_write_rate_duration(ah, mode); 1246 - 1247 - /* 1248 - * Write RF buffer 1249 - */ 1250 - ret = ath5k_hw_rfregs_init(ah, channel, mode); 1251 - if (ret) 1252 - return ret; 1253 - 1254 - 1255 - /* Write OFDM timings on 5212*/ 1256 - if (ah->ah_version == AR5K_AR5212 && 1257 - channel->hw_value & CHANNEL_OFDM) { 1258 - 1259 - ret = ath5k_hw_write_ofdm_timings(ah, channel); 1260 - if (ret) 1261 - return ret; 1262 - 1263 - /* Spur info is available only from EEPROM versions 1264 - * greater than 5.3, but the EEPROM routines will use 1265 - * static values for older versions */ 1266 - if (ah->ah_mac_srev >= AR5K_SREV_AR5424) 1267 - ath5k_hw_set_spur_mitigation_filter(ah, 1268 - channel); 1269 - } 1270 - 1271 - /*Enable/disable 802.11b mode on 5111 1272 - (enable 2111 frequency converter + CCK)*/ 1273 - if (ah->ah_radio == AR5K_RF5111) { 1274 - if (mode == AR5K_MODE_11B) 1275 - AR5K_REG_ENABLE_BITS(ah, AR5K_TXCFG, 1276 - AR5K_TXCFG_B_MODE); 1277 - else 1278 - AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG, 1279 - AR5K_TXCFG_B_MODE); 1280 - } 1281 - 1282 - /* Commit values from EEPROM */ 1283 - ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode); 1284 - 1285 - } else { 1286 - /* 1287 - * For 5210 we do all initialization using 1288 - * initvals, so we don't have to modify 1289 - * any settings (5210 also only supports 1290 - * a/aturbo modes) 1291 - */ 1292 - mdelay(1); 1293 - /* Disable phy and wait */ 1294 - ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT); 1295 - mdelay(1); 1296 - } 1297 1041 1298 1042 /* 1299 1043 * Restore saved values 1300 1044 */ 1301 1045 1302 - /*DCU/Antenna selection not available on 5210*/ 1046 + /* Seqnum, TSF */ 1303 1047 if (ah->ah_version != AR5K_AR5210) { 1048 + if (ah->ah_mac_srev < AR5K_SREV_AR5211) { 1049 + for (i = 0; i < 10; i++) 1050 + ath5k_hw_reg_write(ah, s_seq[i], 1051 + AR5K_QUEUE_DCU_SEQNUM(i)); 1052 + } else { 1053 + ath5k_hw_reg_write(ah, s_seq[0], 1054 + AR5K_QUEUE_DCU_SEQNUM(0)); 1055 + } 1304 1056 1305 - if (change_channel) { 1306 - if (ah->ah_mac_srev < AR5K_SREV_AR5211) { 1307 - for (i = 0; i < 10; i++) 1308 - ath5k_hw_reg_write(ah, s_seq[i], 1309 - AR5K_QUEUE_DCU_SEQNUM(i)); 1310 - } else { 1311 - ath5k_hw_reg_write(ah, s_seq[0], 1312 - AR5K_QUEUE_DCU_SEQNUM(0)); 1313 - } 1314 - 1315 - 1316 - if (ah->ah_version == AR5K_AR5211) { 1317 - ath5k_hw_reg_write(ah, tsf_up, AR5K_TSF_U32); 1318 - ath5k_hw_reg_write(ah, tsf_lo, AR5K_TSF_L32); 1319 - } 1057 + if (ah->ah_version == AR5K_AR5211) { 1058 + ath5k_hw_reg_write(ah, tsf_up, AR5K_TSF_U32); 1059 + ath5k_hw_reg_write(ah, tsf_lo, AR5K_TSF_L32); 1320 1060 } 1321 1061 } 1322 1062 ··· 1248 1146 ath5k_hw_reg_write(ah, s_led[1], AR5K_GPIOCR); 1249 1147 ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO); 1250 1148 1251 - /* Restore sta_id flags and preserve our mac address*/ 1252 - ath5k_hw_reg_write(ah, 1253 - get_unaligned_le32(common->macaddr), 1254 - AR5K_STA_ID0); 1255 - ath5k_hw_reg_write(ah, 1256 - staid1_flags | get_unaligned_le16(common->macaddr + 4), 1257 - AR5K_STA_ID1); 1258 - 1149 + /* 1150 + * Initialize PCU 1151 + */ 1152 + ath5k_hw_pcu_init(ah, op_mode, mode); 1259 1153 1260 1154 /* 1261 - * Configure PCU 1155 + * Initialize PHY 1262 1156 */ 1263 - 1264 - /* Restore bssid and bssid mask */ 1265 - ath5k_hw_set_bssid(ah); 1266 - 1267 - /* Set PCU config */ 1268 - ath5k_hw_set_opmode(ah, op_mode); 1269 - 1270 - /* Clear any pending interrupts 1271 - * PISR/SISR Not available on 5210 */ 1272 - if (ah->ah_version != AR5K_AR5210) 1273 - ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR); 1274 - 1275 - /* Set RSSI/BRSSI thresholds 1276 - * 1277 - * Note: If we decide to set this value 1278 - * dynamically, keep in mind that when AR5K_RSSI_THR 1279 - * register is read, it might return 0x40 if we haven't 1280 - * written anything to it. Also, BMISS RSSI threshold is zeroed. 1281 - * So doing a save/restore procedure here isn't the right 1282 - * choice. Instead, store it in ath5k_hw */ 1283 - ath5k_hw_reg_write(ah, (AR5K_TUNE_RSSI_THRES | 1284 - AR5K_TUNE_BMISS_THRES << 1285 - AR5K_RSSI_THR_BMISS_S), 1286 - AR5K_RSSI_THR); 1287 - 1288 - /* MIC QoS support */ 1289 - if (ah->ah_mac_srev >= AR5K_SREV_AR2413) { 1290 - ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL); 1291 - ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL); 1292 - } 1293 - 1294 - /* QoS NOACK Policy */ 1295 - if (ah->ah_version == AR5K_AR5212) { 1296 - ath5k_hw_reg_write(ah, 1297 - AR5K_REG_SM(2, AR5K_QOS_NOACK_2BIT_VALUES) | 1298 - AR5K_REG_SM(5, AR5K_QOS_NOACK_BIT_OFFSET) | 1299 - AR5K_REG_SM(0, AR5K_QOS_NOACK_BYTE_OFFSET), 1300 - AR5K_QOS_NOACK); 1301 - } 1302 - 1303 - 1304 - /* 1305 - * Configure PHY 1306 - */ 1307 - 1308 - /* Set channel on PHY */ 1309 - ret = ath5k_hw_channel(ah, channel); 1310 - if (ret) 1157 + ret = ath5k_hw_phy_init(ah, channel, mode, ee_mode, freq, false); 1158 + if (ret) { 1159 + ATH5K_ERR(ah->ah_sc, 1160 + "failed to initialize PHY (%i) !\n", ret); 1311 1161 return ret; 1312 - 1313 - /* 1314 - * Enable the PHY and wait until completion 1315 - * This includes BaseBand and Synthesizer 1316 - * activation. 1317 - */ 1318 - ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); 1319 - 1320 - /* 1321 - * On 5211+ read activation -> rx delay 1322 - * and use it. 1323 - * 1324 - * TODO: Half/quarter rate support 1325 - */ 1326 - if (ah->ah_version != AR5K_AR5210) { 1327 - u32 delay; 1328 - delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) & 1329 - AR5K_PHY_RX_DELAY_M; 1330 - delay = (channel->hw_value & CHANNEL_CCK) ? 1331 - ((delay << 2) / 22) : (delay / 10); 1332 - 1333 - udelay(100 + (2 * delay)); 1334 - } else { 1335 - mdelay(1); 1336 1162 } 1337 - 1338 - /* 1339 - * Perform ADC test to see if baseband is ready 1340 - * Set TX hold and check ADC test register 1341 - */ 1342 - phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1); 1343 - ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1); 1344 - for (i = 0; i <= 20; i++) { 1345 - if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10)) 1346 - break; 1347 - udelay(200); 1348 - } 1349 - ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1); 1350 - 1351 - /* 1352 - * Start automatic gain control calibration 1353 - * 1354 - * During AGC calibration RX path is re-routed to 1355 - * a power detector so we don't receive anything. 1356 - * 1357 - * This method is used to calibrate some static offsets 1358 - * used together with on-the fly I/Q calibration (the 1359 - * one performed via ath5k_hw_phy_calibrate), which doesn't 1360 - * interrupt rx path. 1361 - * 1362 - * While rx path is re-routed to the power detector we also 1363 - * start a noise floor calibration to measure the 1364 - * card's noise floor (the noise we measure when we are not 1365 - * transmitting or receiving anything). 1366 - * 1367 - * If we are in a noisy environment, AGC calibration may time 1368 - * out and/or noise floor calibration might timeout. 1369 - */ 1370 - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, 1371 - AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF); 1372 - 1373 - /* At the same time start I/Q calibration for QAM constellation 1374 - * -no need for CCK- */ 1375 - ah->ah_calibration = false; 1376 - if (!(mode == AR5K_MODE_11B)) { 1377 - ah->ah_calibration = true; 1378 - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, 1379 - AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15); 1380 - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, 1381 - AR5K_PHY_IQ_RUN); 1382 - } 1383 - 1384 - /* Wait for gain calibration to finish (we check for I/Q calibration 1385 - * during ath5k_phy_calibrate) */ 1386 - if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, 1387 - AR5K_PHY_AGCCTL_CAL, 0, false)) { 1388 - ATH5K_ERR(ah->ah_sc, "gain calibration timeout (%uMHz)\n", 1389 - channel->center_freq); 1390 - } 1391 - 1392 - /* Restore antenna mode */ 1393 - ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode); 1394 - 1395 - /* Restore slot time and ACK timeouts */ 1396 - if (ah->ah_coverage_class > 0) 1397 - ath5k_hw_set_coverage_class(ah, ah->ah_coverage_class); 1398 1163 1399 1164 /* 1400 1165 * Configure QCUs/DCUs 1401 1166 */ 1402 - 1403 - /* TODO: HW Compression support for data queues */ 1404 - /* TODO: Burst prefetch for data queues */ 1405 - 1406 - /* 1407 - * Reset queues and start beacon timers at the end of the reset routine 1408 - * This also sets QCU mask on each DCU for 1:1 qcu to dcu mapping 1409 - * Note: If we want we can assign multiple qcus on one dcu. 1410 - */ 1411 - for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++) { 1412 - ret = ath5k_hw_reset_tx_queue(ah, i); 1413 - if (ret) { 1414 - ATH5K_ERR(ah->ah_sc, 1415 - "failed to reset TX queue #%d\n", i); 1416 - return ret; 1417 - } 1418 - } 1167 + ret = ath5k_hw_init_queues(ah); 1168 + if (ret) 1169 + return ret; 1419 1170 1420 1171 1421 1172 /* 1422 - * Configure DMA/Interrupts 1173 + * Initialize DMA/Interrupts 1423 1174 */ 1175 + ath5k_hw_dma_init(ah); 1424 1176 1425 - /* 1426 - * Set Rx/Tx DMA Configuration 1427 - * 1428 - * Set standard DMA size (128). Note that 1429 - * a DMA size of 512 causes rx overruns and tx errors 1430 - * on pci-e cards (tested on 5424 but since rx overruns 1431 - * also occur on 5416/5418 with madwifi we set 128 1432 - * for all PCI-E cards to be safe). 1433 - * 1434 - * XXX: need to check 5210 for this 1435 - * TODO: Check out tx triger level, it's always 64 on dumps but I 1436 - * guess we can tweak it and see how it goes ;-) 1437 - */ 1438 - if (ah->ah_version != AR5K_AR5210) { 1439 - AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, 1440 - AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B); 1441 - AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, 1442 - AR5K_RXCFG_SDMAMW, AR5K_DMASIZE_128B); 1443 - } 1444 - 1445 - /* Pre-enable interrupts on 5211/5212*/ 1446 - if (ah->ah_version != AR5K_AR5210) 1447 - ath5k_hw_set_imr(ah, ah->ah_imr); 1448 1177 1449 1178 /* Enable 32KHz clock function for AR5212+ chips 1450 1179 * Set clocks to 32KHz operation and use an
+408 -761
drivers/net/wireless/ath/ath5k/rfbuffer.h
··· 51 51 struct ath5k_ini_rfbuffer { 52 52 u8 rfb_bank; /* RF Bank number */ 53 53 u16 rfb_ctrl_register; /* RF Buffer control register */ 54 - u32 rfb_mode_data[5]; /* RF Buffer data for each mode */ 54 + u32 rfb_mode_data[3]; /* RF Buffer data for each mode */ 55 55 }; 56 56 57 57 /* ··· 79 79 * life easier by using an index for each register 80 80 * instead of a full rfb_field */ 81 81 enum ath5k_rf_regs_idx { 82 + /* BANK 2 */ 83 + AR5K_RF_TURBO = 0, 82 84 /* BANK 6 */ 83 - AR5K_RF_OB_2GHZ = 0, 85 + AR5K_RF_OB_2GHZ, 84 86 AR5K_RF_OB_5GHZ, 85 87 AR5K_RF_DB_2GHZ, 86 88 AR5K_RF_DB_5GHZ, ··· 136 134 * RF5111 (Sombrero) * 137 135 \*******************/ 138 136 137 + /* BANK 2 len pos col */ 138 + #define AR5K_RF5111_RF_TURBO { 1, 3, 0 } 139 + 139 140 /* BANK 6 len pos col */ 140 141 #define AR5K_RF5111_OB_2GHZ { 3, 119, 0 } 141 142 #define AR5K_RF5111_DB_2GHZ { 3, 122, 0 } ··· 163 158 #define AR5K_RF5111_MAX_TIME { 2, 49, 0 } 164 159 165 160 static const struct ath5k_rf_reg rf_regs_5111[] = { 161 + {2, AR5K_RF_TURBO, AR5K_RF5111_RF_TURBO}, 166 162 {6, AR5K_RF_OB_2GHZ, AR5K_RF5111_OB_2GHZ}, 167 163 {6, AR5K_RF_DB_2GHZ, AR5K_RF5111_DB_2GHZ}, 168 164 {6, AR5K_RF_OB_5GHZ, AR5K_RF5111_OB_5GHZ}, ··· 183 177 184 178 /* Default mode specific settings */ 185 179 static const struct ath5k_ini_rfbuffer rfb_5111[] = { 186 - { 0, 0x989c, 187 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 188 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 189 - { 0, 0x989c, 190 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 191 - { 0, 0x989c, 192 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 193 - { 0, 0x989c, 194 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 195 - { 0, 0x989c, 196 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 197 - { 0, 0x989c, 198 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 199 - { 0, 0x989c, 200 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 201 - { 0, 0x989c, 202 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 203 - { 0, 0x989c, 204 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 205 - { 0, 0x989c, 206 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 207 - { 0, 0x989c, 208 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 209 - { 0, 0x989c, 210 - { 0x00380000, 0x00380000, 0x00380000, 0x00380000, 0x00380000 } }, 211 - { 0, 0x989c, 212 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 213 - { 0, 0x989c, 214 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 215 - { 0, 0x989c, 216 - { 0x00000000, 0x00000000, 0x000000c0, 0x00000080, 0x00000080 } }, 217 - { 0, 0x989c, 218 - { 0x000400f9, 0x000400f9, 0x000400ff, 0x000400fd, 0x000400fd } }, 219 - { 0, 0x98d4, 220 - { 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004 } }, 221 - { 1, 0x98d4, 222 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 223 - { 2, 0x98d4, 224 - { 0x00000010, 0x00000014, 0x00000010, 0x00000010, 0x00000014 } }, 225 - { 3, 0x98d8, 226 - { 0x00601068, 0x00601068, 0x00601068, 0x00601068, 0x00601068 } }, 227 - { 6, 0x989c, 228 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 229 - { 6, 0x989c, 230 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 231 - { 6, 0x989c, 232 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 233 - { 6, 0x989c, 234 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 235 - { 6, 0x989c, 236 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 237 - { 6, 0x989c, 238 - { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } }, 239 - { 6, 0x989c, 240 - { 0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000 } }, 241 - { 6, 0x989c, 242 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 243 - { 6, 0x989c, 244 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 245 - { 6, 0x989c, 246 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 247 - { 6, 0x989c, 248 - { 0x00000000, 0x00000000, 0x0a000000, 0x00000000, 0x00000000 } }, 249 - { 6, 0x989c, 250 - { 0x003800c0, 0x00380080, 0x023800c0, 0x003800c0, 0x003800c0 } }, 251 - { 6, 0x989c, 252 - { 0x00020006, 0x00020006, 0x00000006, 0x00020006, 0x00020006 } }, 253 - { 6, 0x989c, 254 - { 0x00000089, 0x00000089, 0x00000089, 0x00000089, 0x00000089 } }, 255 - { 6, 0x989c, 256 - { 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0 } }, 257 - { 6, 0x989c, 258 - { 0x00040007, 0x00040007, 0x00040007, 0x00040007, 0x00040007 } }, 259 - { 6, 0x98d4, 260 - { 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a } }, 261 - { 7, 0x989c, 262 - { 0x00000040, 0x00000048, 0x00000040, 0x00000040, 0x00000040 } }, 263 - { 7, 0x989c, 264 - { 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010 } }, 265 - { 7, 0x989c, 266 - { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } }, 267 - { 7, 0x989c, 268 - { 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f } }, 269 - { 7, 0x989c, 270 - { 0x000000f1, 0x000000f1, 0x00000061, 0x000000f1, 0x000000f1 } }, 271 - { 7, 0x989c, 272 - { 0x0000904f, 0x0000904f, 0x0000904c, 0x0000904f, 0x0000904f } }, 273 - { 7, 0x989c, 274 - { 0x0000125a, 0x0000125a, 0x0000129a, 0x0000125a, 0x0000125a } }, 275 - { 7, 0x98cc, 276 - { 0x0000000e, 0x0000000e, 0x0000000f, 0x0000000e, 0x0000000e } }, 180 + /* BANK / C.R. A/XR B G */ 181 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 182 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 183 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 184 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 185 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 186 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 187 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 188 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 189 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 190 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 191 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 192 + { 0, 0x989c, { 0x00380000, 0x00380000, 0x00380000 } }, 193 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 194 + { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 195 + { 0, 0x989c, { 0x00000000, 0x000000c0, 0x00000080 } }, 196 + { 0, 0x989c, { 0x000400f9, 0x000400ff, 0x000400fd } }, 197 + { 0, 0x98d4, { 0x00000000, 0x00000004, 0x00000004 } }, 198 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 199 + { 2, 0x98d4, { 0x00000010, 0x00000010, 0x00000010 } }, 200 + { 3, 0x98d8, { 0x00601068, 0x00601068, 0x00601068 } }, 201 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 202 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 203 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 204 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 205 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 206 + { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } }, 207 + { 6, 0x989c, { 0x04000000, 0x04000000, 0x04000000 } }, 208 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 209 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 210 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 211 + { 6, 0x989c, { 0x00000000, 0x0a000000, 0x00000000 } }, 212 + { 6, 0x989c, { 0x003800c0, 0x023800c0, 0x003800c0 } }, 213 + { 6, 0x989c, { 0x00020006, 0x00000006, 0x00020006 } }, 214 + { 6, 0x989c, { 0x00000089, 0x00000089, 0x00000089 } }, 215 + { 6, 0x989c, { 0x000000a0, 0x000000a0, 0x000000a0 } }, 216 + { 6, 0x989c, { 0x00040007, 0x00040007, 0x00040007 } }, 217 + { 6, 0x98d4, { 0x0000001a, 0x0000001a, 0x0000001a } }, 218 + { 7, 0x989c, { 0x00000040, 0x00000040, 0x00000040 } }, 219 + { 7, 0x989c, { 0x00000010, 0x00000010, 0x00000010 } }, 220 + { 7, 0x989c, { 0x00000008, 0x00000008, 0x00000008 } }, 221 + { 7, 0x989c, { 0x0000004f, 0x0000004f, 0x0000004f } }, 222 + { 7, 0x989c, { 0x000000f1, 0x00000061, 0x000000f1 } }, 223 + { 7, 0x989c, { 0x0000904f, 0x0000904c, 0x0000904f } }, 224 + { 7, 0x989c, { 0x0000125a, 0x0000129a, 0x0000125a } }, 225 + { 7, 0x98cc, { 0x0000000e, 0x0000000f, 0x0000000e } }, 277 226 }; 278 227 279 228 ··· 236 275 /***********************\ 237 276 * RF5112/RF2112 (Derby) * 238 277 \***********************/ 278 + 279 + /* BANK 2 (Common) len pos col */ 280 + #define AR5K_RF5112X_RF_TURBO { 1, 1, 2 } 239 281 240 282 /* BANK 7 (Common) len pos col */ 241 283 #define AR5K_RF5112X_GAIN_I { 6, 14, 0 } ··· 271 307 #define AR5K_RF5112_PWD(_n) { 1, (302 - _n), 3 } 272 308 273 309 static const struct ath5k_rf_reg rf_regs_5112[] = { 310 + {2, AR5K_RF_TURBO, AR5K_RF5112X_RF_TURBO}, 274 311 {6, AR5K_RF_OB_2GHZ, AR5K_RF5112_OB_2GHZ}, 275 312 {6, AR5K_RF_DB_2GHZ, AR5K_RF5112_DB_2GHZ}, 276 313 {6, AR5K_RF_OB_5GHZ, AR5K_RF5112_OB_5GHZ}, ··· 300 335 301 336 /* Default mode specific settings */ 302 337 static const struct ath5k_ini_rfbuffer rfb_5112[] = { 303 - { 1, 0x98d4, 304 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 305 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 306 - { 2, 0x98d0, 307 - { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } }, 308 - { 3, 0x98dc, 309 - { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } }, 310 - { 6, 0x989c, 311 - { 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000 } }, 312 - { 6, 0x989c, 313 - { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } }, 314 - { 6, 0x989c, 315 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 316 - { 6, 0x989c, 317 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 318 - { 6, 0x989c, 319 - { 0x00660000, 0x00660000, 0x00660000, 0x00660000, 0x00660000 } }, 320 - { 6, 0x989c, 321 - { 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000 } }, 322 - { 6, 0x989c, 323 - { 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000 } }, 324 - { 6, 0x989c, 325 - { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, 326 - { 6, 0x989c, 327 - { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, 328 - { 6, 0x989c, 329 - { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } }, 330 - { 6, 0x989c, 331 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 332 - { 6, 0x989c, 333 - { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, 334 - { 6, 0x989c, 335 - { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 336 - { 6, 0x989c, 337 - { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 338 - { 6, 0x989c, 339 - { 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000 } }, 340 - { 6, 0x989c, 341 - { 0x00600000, 0x00600000, 0x00600000, 0x00600000, 0x00600000 } }, 342 - { 6, 0x989c, 343 - { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, 344 - { 6, 0x989c, 345 - { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } }, 346 - { 6, 0x989c, 347 - { 0x00640000, 0x00640000, 0x00640000, 0x00640000, 0x00640000 } }, 348 - { 6, 0x989c, 349 - { 0x00200000, 0x00200000, 0x00200000, 0x00200000, 0x00200000 } }, 350 - { 6, 0x989c, 351 - { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } }, 352 - { 6, 0x989c, 353 - { 0x00250000, 0x00250000, 0x00250000, 0x00250000, 0x00250000 } }, 354 - { 6, 0x989c, 355 - { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } }, 356 - { 6, 0x989c, 357 - { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } }, 358 - { 6, 0x989c, 359 - { 0x00510000, 0x00510000, 0x00510000, 0x00510000, 0x00510000 } }, 360 - { 6, 0x989c, 361 - { 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000 } }, 362 - { 6, 0x989c, 363 - { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } }, 364 - { 6, 0x989c, 365 - { 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000 } }, 366 - { 6, 0x989c, 367 - { 0x00400000, 0x00400000, 0x00400000, 0x00400000, 0x00400000 } }, 368 - { 6, 0x989c, 369 - { 0x03090000, 0x03090000, 0x03090000, 0x03090000, 0x03090000 } }, 370 - { 6, 0x989c, 371 - { 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000 } }, 372 - { 6, 0x989c, 373 - { 0x000000b0, 0x000000b0, 0x000000a8, 0x000000a8, 0x000000a8 } }, 374 - { 6, 0x989c, 375 - { 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e } }, 376 - { 6, 0x989c, 377 - { 0x006c4a41, 0x006c4a41, 0x006c4af1, 0x006c4a61, 0x006c4a61 } }, 378 - { 6, 0x989c, 379 - { 0x0050892a, 0x0050892a, 0x0050892b, 0x0050892b, 0x0050892b } }, 380 - { 6, 0x989c, 381 - { 0x00842400, 0x00842400, 0x00842400, 0x00842400, 0x00842400 } }, 382 - { 6, 0x989c, 383 - { 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200 } }, 384 - { 6, 0x98d0, 385 - { 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c } }, 386 - { 7, 0x989c, 387 - { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } }, 388 - { 7, 0x989c, 389 - { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } }, 390 - { 7, 0x989c, 391 - { 0x0000000a, 0x0000000a, 0x00000012, 0x00000012, 0x00000012 } }, 392 - { 7, 0x989c, 393 - { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } }, 394 - { 7, 0x989c, 395 - { 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1 } }, 396 - { 7, 0x989c, 397 - { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } }, 398 - { 7, 0x989c, 399 - { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } }, 400 - { 7, 0x989c, 401 - { 0x00000022, 0x00000022, 0x00000022, 0x00000022, 0x00000022 } }, 402 - { 7, 0x989c, 403 - { 0x00000092, 0x00000092, 0x00000092, 0x00000092, 0x00000092 } }, 404 - { 7, 0x989c, 405 - { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } }, 406 - { 7, 0x989c, 407 - { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } }, 408 - { 7, 0x989c, 409 - { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } }, 410 - { 7, 0x98c4, 411 - { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } }, 338 + /* BANK / C.R. A/XR B G */ 339 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 340 + { 2, 0x98d0, { 0x03060408, 0x03060408, 0x03060408 } }, 341 + { 3, 0x98dc, { 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0 } }, 342 + { 6, 0x989c, { 0x00a00000, 0x00a00000, 0x00a00000 } }, 343 + { 6, 0x989c, { 0x000a0000, 0x000a0000, 0x000a0000 } }, 344 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 345 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 346 + { 6, 0x989c, { 0x00660000, 0x00660000, 0x00660000 } }, 347 + { 6, 0x989c, { 0x00db0000, 0x00db0000, 0x00db0000 } }, 348 + { 6, 0x989c, { 0x00f10000, 0x00f10000, 0x00f10000 } }, 349 + { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } }, 350 + { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } }, 351 + { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } }, 352 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 353 + { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } }, 354 + { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 355 + { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 356 + { 6, 0x989c, { 0x008b0000, 0x008b0000, 0x008b0000 } }, 357 + { 6, 0x989c, { 0x00600000, 0x00600000, 0x00600000 } }, 358 + { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } }, 359 + { 6, 0x989c, { 0x00840000, 0x00840000, 0x00840000 } }, 360 + { 6, 0x989c, { 0x00640000, 0x00640000, 0x00640000 } }, 361 + { 6, 0x989c, { 0x00200000, 0x00200000, 0x00200000 } }, 362 + { 6, 0x989c, { 0x00240000, 0x00240000, 0x00240000 } }, 363 + { 6, 0x989c, { 0x00250000, 0x00250000, 0x00250000 } }, 364 + { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } }, 365 + { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } }, 366 + { 6, 0x989c, { 0x00510000, 0x00510000, 0x00510000 } }, 367 + { 6, 0x989c, { 0x1c040000, 0x1c040000, 0x1c040000 } }, 368 + { 6, 0x989c, { 0x000a0000, 0x000a0000, 0x000a0000 } }, 369 + { 6, 0x989c, { 0x00a10000, 0x00a10000, 0x00a10000 } }, 370 + { 6, 0x989c, { 0x00400000, 0x00400000, 0x00400000 } }, 371 + { 6, 0x989c, { 0x03090000, 0x03090000, 0x03090000 } }, 372 + { 6, 0x989c, { 0x06000000, 0x06000000, 0x06000000 } }, 373 + { 6, 0x989c, { 0x000000b0, 0x000000a8, 0x000000a8 } }, 374 + { 6, 0x989c, { 0x0000002e, 0x0000002e, 0x0000002e } }, 375 + { 6, 0x989c, { 0x006c4a41, 0x006c4af1, 0x006c4a61 } }, 376 + { 6, 0x989c, { 0x0050892a, 0x0050892b, 0x0050892b } }, 377 + { 6, 0x989c, { 0x00842400, 0x00842400, 0x00842400 } }, 378 + { 6, 0x989c, { 0x00c69200, 0x00c69200, 0x00c69200 } }, 379 + { 6, 0x98d0, { 0x0002000c, 0x0002000c, 0x0002000c } }, 380 + { 7, 0x989c, { 0x00000094, 0x00000094, 0x00000094 } }, 381 + { 7, 0x989c, { 0x00000091, 0x00000091, 0x00000091 } }, 382 + { 7, 0x989c, { 0x0000000a, 0x00000012, 0x00000012 } }, 383 + { 7, 0x989c, { 0x00000080, 0x00000080, 0x00000080 } }, 384 + { 7, 0x989c, { 0x000000c1, 0x000000c1, 0x000000c1 } }, 385 + { 7, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } }, 386 + { 7, 0x989c, { 0x000000f0, 0x000000f0, 0x000000f0 } }, 387 + { 7, 0x989c, { 0x00000022, 0x00000022, 0x00000022 } }, 388 + { 7, 0x989c, { 0x00000092, 0x00000092, 0x00000092 } }, 389 + { 7, 0x989c, { 0x000000d4, 0x000000d4, 0x000000d4 } }, 390 + { 7, 0x989c, { 0x000014cc, 0x000014cc, 0x000014cc } }, 391 + { 7, 0x989c, { 0x0000048c, 0x0000048c, 0x0000048c } }, 392 + { 7, 0x98c4, { 0x00000003, 0x00000003, 0x00000003 } }, 412 393 }; 413 394 414 395 /* RFX112A (Derby 2) */ ··· 388 477 #define AR5K_RF5112A_XB5_LVL { 2, 3, 3 } 389 478 390 479 static const struct ath5k_rf_reg rf_regs_5112a[] = { 480 + {2, AR5K_RF_TURBO, AR5K_RF5112X_RF_TURBO}, 391 481 {6, AR5K_RF_OB_2GHZ, AR5K_RF5112A_OB_2GHZ}, 392 482 {6, AR5K_RF_DB_2GHZ, AR5K_RF5112A_DB_2GHZ}, 393 483 {6, AR5K_RF_OB_5GHZ, AR5K_RF5112A_OB_5GHZ}, ··· 427 515 428 516 /* Default mode specific settings */ 429 517 static const struct ath5k_ini_rfbuffer rfb_5112a[] = { 430 - { 1, 0x98d4, 431 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 432 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 433 - { 2, 0x98d0, 434 - { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } }, 435 - { 3, 0x98dc, 436 - { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 437 - { 6, 0x989c, 438 - { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } }, 439 - { 6, 0x989c, 440 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 441 - { 6, 0x989c, 442 - { 0x00800000, 0x00800000, 0x00800000, 0x00800000, 0x00800000 } }, 443 - { 6, 0x989c, 444 - { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 445 - { 6, 0x989c, 446 - { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } }, 447 - { 6, 0x989c, 448 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 449 - { 6, 0x989c, 450 - { 0x00180000, 0x00180000, 0x00180000, 0x00180000, 0x00180000 } }, 451 - { 6, 0x989c, 452 - { 0x00600000, 0x00600000, 0x006e0000, 0x006e0000, 0x006e0000 } }, 453 - { 6, 0x989c, 454 - { 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000 } }, 455 - { 6, 0x989c, 456 - { 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000 } }, 457 - { 6, 0x989c, 458 - { 0x04480000, 0x04480000, 0x04480000, 0x04480000, 0x04480000 } }, 459 - { 6, 0x989c, 460 - { 0x004c0000, 0x004c0000, 0x004c0000, 0x004c0000, 0x004c0000 } }, 461 - { 6, 0x989c, 462 - { 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000 } }, 463 - { 6, 0x989c, 464 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 465 - { 6, 0x989c, 466 - { 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000 } }, 467 - { 6, 0x989c, 468 - { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 469 - { 6, 0x989c, 470 - { 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000 } }, 471 - { 6, 0x989c, 472 - { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, 473 - { 6, 0x989c, 474 - { 0x02190000, 0x02190000, 0x02190000, 0x02190000, 0x02190000 } }, 475 - { 6, 0x989c, 476 - { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } }, 477 - { 6, 0x989c, 478 - { 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000 } }, 479 - { 6, 0x989c, 480 - { 0x00990000, 0x00990000, 0x00990000, 0x00990000, 0x00990000 } }, 481 - { 6, 0x989c, 482 - { 0x00500000, 0x00500000, 0x00500000, 0x00500000, 0x00500000 } }, 483 - { 6, 0x989c, 484 - { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 485 - { 6, 0x989c, 486 - { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, 487 - { 6, 0x989c, 488 - { 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000 } }, 489 - { 6, 0x989c, 490 - { 0x01740000, 0x01740000, 0x01740000, 0x01740000, 0x01740000 } }, 491 - { 6, 0x989c, 492 - { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } }, 493 - { 6, 0x989c, 494 - { 0x86280000, 0x86280000, 0x86280000, 0x86280000, 0x86280000 } }, 495 - { 6, 0x989c, 496 - { 0x31840000, 0x31840000, 0x31840000, 0x31840000, 0x31840000 } }, 497 - { 6, 0x989c, 498 - { 0x00f20080, 0x00f20080, 0x00f20080, 0x00f20080, 0x00f20080 } }, 499 - { 6, 0x989c, 500 - { 0x00270019, 0x00270019, 0x00270019, 0x00270019, 0x00270019 } }, 501 - { 6, 0x989c, 502 - { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } }, 503 - { 6, 0x989c, 504 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 505 - { 6, 0x989c, 506 - { 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2 } }, 507 - { 6, 0x989c, 508 - { 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084 } }, 509 - { 6, 0x989c, 510 - { 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4 } }, 511 - { 6, 0x989c, 512 - { 0x00119220, 0x00119220, 0x00119220, 0x00119220, 0x00119220 } }, 513 - { 6, 0x989c, 514 - { 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800 } }, 515 - { 6, 0x98d8, 516 - { 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230 } }, 517 - { 7, 0x989c, 518 - { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } }, 519 - { 7, 0x989c, 520 - { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } }, 521 - { 7, 0x989c, 522 - { 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012 } }, 523 - { 7, 0x989c, 524 - { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } }, 525 - { 7, 0x989c, 526 - { 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9 } }, 527 - { 7, 0x989c, 528 - { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } }, 529 - { 7, 0x989c, 530 - { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } }, 531 - { 7, 0x989c, 532 - { 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2 } }, 533 - { 7, 0x989c, 534 - { 0x00000052, 0x00000052, 0x00000052, 0x00000052, 0x00000052 } }, 535 - { 7, 0x989c, 536 - { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } }, 537 - { 7, 0x989c, 538 - { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } }, 539 - { 7, 0x989c, 540 - { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } }, 541 - { 7, 0x98c4, 542 - { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } }, 518 + /* BANK / C.R. A/XR B G */ 519 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 520 + { 2, 0x98d0, { 0x03060408, 0x03060408, 0x03060408 } }, 521 + { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, 522 + { 6, 0x989c, { 0x0f000000, 0x0f000000, 0x0f000000 } }, 523 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 524 + { 6, 0x989c, { 0x00800000, 0x00800000, 0x00800000 } }, 525 + { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, 526 + { 6, 0x989c, { 0x00010000, 0x00010000, 0x00010000 } }, 527 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 528 + { 6, 0x989c, { 0x00180000, 0x00180000, 0x00180000 } }, 529 + { 6, 0x989c, { 0x00600000, 0x006e0000, 0x006e0000 } }, 530 + { 6, 0x989c, { 0x00c70000, 0x00c70000, 0x00c70000 } }, 531 + { 6, 0x989c, { 0x004b0000, 0x004b0000, 0x004b0000 } }, 532 + { 6, 0x989c, { 0x04480000, 0x04480000, 0x04480000 } }, 533 + { 6, 0x989c, { 0x004c0000, 0x004c0000, 0x004c0000 } }, 534 + { 6, 0x989c, { 0x00e40000, 0x00e40000, 0x00e40000 } }, 535 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 536 + { 6, 0x989c, { 0x00fc0000, 0x00fc0000, 0x00fc0000 } }, 537 + { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 538 + { 6, 0x989c, { 0x043f0000, 0x043f0000, 0x043f0000 } }, 539 + { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } }, 540 + { 6, 0x989c, { 0x02190000, 0x02190000, 0x02190000 } }, 541 + { 6, 0x989c, { 0x00240000, 0x00240000, 0x00240000 } }, 542 + { 6, 0x989c, { 0x00b40000, 0x00b40000, 0x00b40000 } }, 543 + { 6, 0x989c, { 0x00990000, 0x00990000, 0x00990000 } }, 544 + { 6, 0x989c, { 0x00500000, 0x00500000, 0x00500000 } }, 545 + { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, 546 + { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } }, 547 + { 6, 0x989c, { 0xc0320000, 0xc0320000, 0xc0320000 } }, 548 + { 6, 0x989c, { 0x01740000, 0x01740000, 0x01740000 } }, 549 + { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } }, 550 + { 6, 0x989c, { 0x86280000, 0x86280000, 0x86280000 } }, 551 + { 6, 0x989c, { 0x31840000, 0x31840000, 0x31840000 } }, 552 + { 6, 0x989c, { 0x00f20080, 0x00f20080, 0x00f20080 } }, 553 + { 6, 0x989c, { 0x00270019, 0x00270019, 0x00270019 } }, 554 + { 6, 0x989c, { 0x00000003, 0x00000003, 0x00000003 } }, 555 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 556 + { 6, 0x989c, { 0x000000b2, 0x000000b2, 0x000000b2 } }, 557 + { 6, 0x989c, { 0x00b02084, 0x00b02084, 0x00b02084 } }, 558 + { 6, 0x989c, { 0x004125a4, 0x004125a4, 0x004125a4 } }, 559 + { 6, 0x989c, { 0x00119220, 0x00119220, 0x00119220 } }, 560 + { 6, 0x989c, { 0x001a4800, 0x001a4800, 0x001a4800 } }, 561 + { 6, 0x98d8, { 0x000b0230, 0x000b0230, 0x000b0230 } }, 562 + { 7, 0x989c, { 0x00000094, 0x00000094, 0x00000094 } }, 563 + { 7, 0x989c, { 0x00000091, 0x00000091, 0x00000091 } }, 564 + { 7, 0x989c, { 0x00000012, 0x00000012, 0x00000012 } }, 565 + { 7, 0x989c, { 0x00000080, 0x00000080, 0x00000080 } }, 566 + { 7, 0x989c, { 0x000000d9, 0x000000d9, 0x000000d9 } }, 567 + { 7, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } }, 568 + { 7, 0x989c, { 0x000000f0, 0x000000f0, 0x000000f0 } }, 569 + { 7, 0x989c, { 0x000000a2, 0x000000a2, 0x000000a2 } }, 570 + { 7, 0x989c, { 0x00000052, 0x00000052, 0x00000052 } }, 571 + { 7, 0x989c, { 0x000000d4, 0x000000d4, 0x000000d4 } }, 572 + { 7, 0x989c, { 0x000014cc, 0x000014cc, 0x000014cc } }, 573 + { 7, 0x989c, { 0x0000048c, 0x0000048c, 0x0000048c } }, 574 + { 7, 0x98c4, { 0x00000003, 0x00000003, 0x00000003 } }, 543 575 }; 544 576 545 577 ··· 492 636 * RF2413 (Griffin) * 493 637 \******************/ 494 638 639 + /* BANK 2 len pos col */ 640 + #define AR5K_RF2413_RF_TURBO { 1, 1, 2 } 641 + 495 642 /* BANK 6 len pos col */ 496 643 #define AR5K_RF2413_OB_2GHZ { 3, 168, 0 } 497 644 #define AR5K_RF2413_DB_2GHZ { 3, 165, 0 } 498 645 499 646 static const struct ath5k_rf_reg rf_regs_2413[] = { 647 + {2, AR5K_RF_TURBO, AR5K_RF2413_RF_TURBO}, 500 648 {6, AR5K_RF_OB_2GHZ, AR5K_RF2413_OB_2GHZ}, 501 649 {6, AR5K_RF_DB_2GHZ, AR5K_RF2413_DB_2GHZ}, 502 650 }; ··· 509 649 * XXX: a/aTurbo ??? 510 650 */ 511 651 static const struct ath5k_ini_rfbuffer rfb_2413[] = { 512 - { 1, 0x98d4, 513 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 514 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 515 - { 2, 0x98d0, 516 - { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } }, 517 - { 3, 0x98dc, 518 - { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 519 - { 6, 0x989c, 520 - { 0xf0000000, 0xf0000000, 0xf0000000, 0xf0000000, 0xf0000000 } }, 521 - { 6, 0x989c, 522 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 523 - { 6, 0x989c, 524 - { 0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000 } }, 525 - { 6, 0x989c, 526 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 527 - { 6, 0x989c, 528 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 529 - { 6, 0x989c, 530 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 531 - { 6, 0x989c, 532 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 533 - { 6, 0x989c, 534 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 535 - { 6, 0x989c, 536 - { 0x40400000, 0x40400000, 0x40400000, 0x40400000, 0x40400000 } }, 537 - { 6, 0x989c, 538 - { 0x65050000, 0x65050000, 0x65050000, 0x65050000, 0x65050000 } }, 539 - { 6, 0x989c, 540 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 541 - { 6, 0x989c, 542 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 543 - { 6, 0x989c, 544 - { 0x00420000, 0x00420000, 0x00420000, 0x00420000, 0x00420000 } }, 545 - { 6, 0x989c, 546 - { 0x00b50000, 0x00b50000, 0x00b50000, 0x00b50000, 0x00b50000 } }, 547 - { 6, 0x989c, 548 - { 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000 } }, 549 - { 6, 0x989c, 550 - { 0x00f70000, 0x00f70000, 0x00f70000, 0x00f70000, 0x00f70000 } }, 551 - { 6, 0x989c, 552 - { 0x009d0000, 0x009d0000, 0x009d0000, 0x009d0000, 0x009d0000 } }, 553 - { 6, 0x989c, 554 - { 0x00220000, 0x00220000, 0x00220000, 0x00220000, 0x00220000 } }, 555 - { 6, 0x989c, 556 - { 0x04220000, 0x04220000, 0x04220000, 0x04220000, 0x04220000 } }, 557 - { 6, 0x989c, 558 - { 0x00230018, 0x00230018, 0x00230018, 0x00230018, 0x00230018 } }, 559 - { 6, 0x989c, 560 - { 0x00280000, 0x00280000, 0x00280060, 0x00280060, 0x00280060 } }, 561 - { 6, 0x989c, 562 - { 0x005000c0, 0x005000c0, 0x005000c3, 0x005000c3, 0x005000c3 } }, 563 - { 6, 0x989c, 564 - { 0x0004007f, 0x0004007f, 0x0004007f, 0x0004007f, 0x0004007f } }, 565 - { 6, 0x989c, 566 - { 0x00000458, 0x00000458, 0x00000458, 0x00000458, 0x00000458 } }, 567 - { 6, 0x989c, 568 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 569 - { 6, 0x989c, 570 - { 0x0000c000, 0x0000c000, 0x0000c000, 0x0000c000, 0x0000c000 } }, 571 - { 6, 0x98d8, 572 - { 0x00400230, 0x00400230, 0x00400230, 0x00400230, 0x00400230 } }, 573 - { 7, 0x989c, 574 - { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } }, 575 - { 7, 0x989c, 576 - { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } }, 577 - { 7, 0x98cc, 578 - { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } }, 652 + /* BANK / C.R. A/XR B G */ 653 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 654 + { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, 655 + { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, 656 + { 6, 0x989c, { 0xf0000000, 0xf0000000, 0xf0000000 } }, 657 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 658 + { 6, 0x989c, { 0x03000000, 0x03000000, 0x03000000 } }, 659 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 660 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 661 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 662 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 663 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 664 + { 6, 0x989c, { 0x40400000, 0x40400000, 0x40400000 } }, 665 + { 6, 0x989c, { 0x65050000, 0x65050000, 0x65050000 } }, 666 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 667 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 668 + { 6, 0x989c, { 0x00420000, 0x00420000, 0x00420000 } }, 669 + { 6, 0x989c, { 0x00b50000, 0x00b50000, 0x00b50000 } }, 670 + { 6, 0x989c, { 0x00030000, 0x00030000, 0x00030000 } }, 671 + { 6, 0x989c, { 0x00f70000, 0x00f70000, 0x00f70000 } }, 672 + { 6, 0x989c, { 0x009d0000, 0x009d0000, 0x009d0000 } }, 673 + { 6, 0x989c, { 0x00220000, 0x00220000, 0x00220000 } }, 674 + { 6, 0x989c, { 0x04220000, 0x04220000, 0x04220000 } }, 675 + { 6, 0x989c, { 0x00230018, 0x00230018, 0x00230018 } }, 676 + { 6, 0x989c, { 0x00280000, 0x00280060, 0x00280060 } }, 677 + { 6, 0x989c, { 0x005000c0, 0x005000c3, 0x005000c3 } }, 678 + { 6, 0x989c, { 0x0004007f, 0x0004007f, 0x0004007f } }, 679 + { 6, 0x989c, { 0x00000458, 0x00000458, 0x00000458 } }, 680 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 681 + { 6, 0x989c, { 0x0000c000, 0x0000c000, 0x0000c000 } }, 682 + { 6, 0x98d8, { 0x00400230, 0x00400230, 0x00400230 } }, 683 + { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, 684 + { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, 685 + { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, 579 686 }; 580 687 581 688 ··· 551 724 * RF2315/RF2316 (Cobra SoC) * 552 725 \***************************/ 553 726 727 + /* BANK 2 len pos col */ 728 + #define AR5K_RF2316_RF_TURBO { 1, 1, 2 } 729 + 554 730 /* BANK 6 len pos col */ 555 731 #define AR5K_RF2316_OB_2GHZ { 3, 178, 0 } 556 732 #define AR5K_RF2316_DB_2GHZ { 3, 175, 0 } 557 733 558 734 static const struct ath5k_rf_reg rf_regs_2316[] = { 735 + {2, AR5K_RF_TURBO, AR5K_RF2316_RF_TURBO}, 559 736 {6, AR5K_RF_OB_2GHZ, AR5K_RF2316_OB_2GHZ}, 560 737 {6, AR5K_RF_DB_2GHZ, AR5K_RF2316_DB_2GHZ}, 561 738 }; 562 739 563 740 /* Default mode specific settings */ 564 741 static const struct ath5k_ini_rfbuffer rfb_2316[] = { 565 - { 1, 0x98d4, 566 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 567 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 568 - { 2, 0x98d0, 569 - { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } }, 570 - { 3, 0x98dc, 571 - { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 572 - { 6, 0x989c, 573 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 574 - { 6, 0x989c, 575 - { 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000 } }, 576 - { 6, 0x989c, 577 - { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } }, 578 - { 6, 0x989c, 579 - { 0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000 } }, 580 - { 6, 0x989c, 581 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 582 - { 6, 0x989c, 583 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 584 - { 6, 0x989c, 585 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 586 - { 6, 0x989c, 587 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 588 - { 6, 0x989c, 589 - { 0xf8000000, 0xf8000000, 0xf8000000, 0xf8000000, 0xf8000000 } }, 590 - { 6, 0x989c, 591 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 592 - { 6, 0x989c, 593 - { 0x95150000, 0x95150000, 0x95150000, 0x95150000, 0x95150000 } }, 594 - { 6, 0x989c, 595 - { 0xc1000000, 0xc1000000, 0xc1000000, 0xc1000000, 0xc1000000 } }, 596 - { 6, 0x989c, 597 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 598 - { 6, 0x989c, 599 - { 0x00080000, 0x00080000, 0x00080000, 0x00080000, 0x00080000 } }, 600 - { 6, 0x989c, 601 - { 0x00d50000, 0x00d50000, 0x00d50000, 0x00d50000, 0x00d50000 } }, 602 - { 6, 0x989c, 603 - { 0x000e0000, 0x000e0000, 0x000e0000, 0x000e0000, 0x000e0000 } }, 604 - { 6, 0x989c, 605 - { 0x00dc0000, 0x00dc0000, 0x00dc0000, 0x00dc0000, 0x00dc0000 } }, 606 - { 6, 0x989c, 607 - { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } }, 608 - { 6, 0x989c, 609 - { 0x008a0000, 0x008a0000, 0x008a0000, 0x008a0000, 0x008a0000 } }, 610 - { 6, 0x989c, 611 - { 0x10880000, 0x10880000, 0x10880000, 0x10880000, 0x10880000 } }, 612 - { 6, 0x989c, 613 - { 0x008c0060, 0x008c0060, 0x008c0060, 0x008c0060, 0x008c0060 } }, 614 - { 6, 0x989c, 615 - { 0x00a00000, 0x00a00000, 0x00a00080, 0x00a00080, 0x00a00080 } }, 616 - { 6, 0x989c, 617 - { 0x00400000, 0x00400000, 0x0040000d, 0x0040000d, 0x0040000d } }, 618 - { 6, 0x989c, 619 - { 0x00110400, 0x00110400, 0x00110400, 0x00110400, 0x00110400 } }, 620 - { 6, 0x989c, 621 - { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } }, 622 - { 6, 0x989c, 623 - { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } }, 624 - { 6, 0x989c, 625 - { 0x00000b00, 0x00000b00, 0x00000b00, 0x00000b00, 0x00000b00 } }, 626 - { 6, 0x989c, 627 - { 0x00000be8, 0x00000be8, 0x00000be8, 0x00000be8, 0x00000be8 } }, 628 - { 6, 0x98c0, 629 - { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } }, 630 - { 7, 0x989c, 631 - { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } }, 632 - { 7, 0x989c, 633 - { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } }, 634 - { 7, 0x98cc, 635 - { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } }, 742 + /* BANK / C.R. A/XR B G */ 743 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 744 + { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, 745 + { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, 746 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 747 + { 6, 0x989c, { 0xc0000000, 0xc0000000, 0xc0000000 } }, 748 + { 6, 0x989c, { 0x0f000000, 0x0f000000, 0x0f000000 } }, 749 + { 6, 0x989c, { 0x02000000, 0x02000000, 0x02000000 } }, 750 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 751 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 752 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 753 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 754 + { 6, 0x989c, { 0xf8000000, 0xf8000000, 0xf8000000 } }, 755 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 756 + { 6, 0x989c, { 0x95150000, 0x95150000, 0x95150000 } }, 757 + { 6, 0x989c, { 0xc1000000, 0xc1000000, 0xc1000000 } }, 758 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 759 + { 6, 0x989c, { 0x00080000, 0x00080000, 0x00080000 } }, 760 + { 6, 0x989c, { 0x00d50000, 0x00d50000, 0x00d50000 } }, 761 + { 6, 0x989c, { 0x000e0000, 0x000e0000, 0x000e0000 } }, 762 + { 6, 0x989c, { 0x00dc0000, 0x00dc0000, 0x00dc0000 } }, 763 + { 6, 0x989c, { 0x00770000, 0x00770000, 0x00770000 } }, 764 + { 6, 0x989c, { 0x008a0000, 0x008a0000, 0x008a0000 } }, 765 + { 6, 0x989c, { 0x10880000, 0x10880000, 0x10880000 } }, 766 + { 6, 0x989c, { 0x008c0060, 0x008c0060, 0x008c0060 } }, 767 + { 6, 0x989c, { 0x00a00000, 0x00a00080, 0x00a00080 } }, 768 + { 6, 0x989c, { 0x00400000, 0x0040000d, 0x0040000d } }, 769 + { 6, 0x989c, { 0x00110400, 0x00110400, 0x00110400 } }, 770 + { 6, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } }, 771 + { 6, 0x989c, { 0x00000001, 0x00000001, 0x00000001 } }, 772 + { 6, 0x989c, { 0x00000b00, 0x00000b00, 0x00000b00 } }, 773 + { 6, 0x989c, { 0x00000be8, 0x00000be8, 0x00000be8 } }, 774 + { 6, 0x98c0, { 0x00010000, 0x00010000, 0x00010000 } }, 775 + { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, 776 + { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, 777 + { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, 636 778 }; 637 779 638 780 ··· 631 835 632 836 /* Default mode specific settings */ 633 837 static const struct ath5k_ini_rfbuffer rfb_5413[] = { 634 - { 1, 0x98d4, 635 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 636 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 637 - { 2, 0x98d0, 638 - { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } }, 639 - { 3, 0x98dc, 640 - { 0x00a000c0, 0x00a000c0, 0x00e000c0, 0x00e000c0, 0x00e000c0 } }, 641 - { 6, 0x989c, 642 - { 0x33000000, 0x33000000, 0x33000000, 0x33000000, 0x33000000 } }, 643 - { 6, 0x989c, 644 - { 0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000 } }, 645 - { 6, 0x989c, 646 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 647 - { 6, 0x989c, 648 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 649 - { 6, 0x989c, 650 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 651 - { 6, 0x989c, 652 - { 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000 } }, 653 - { 6, 0x989c, 654 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 655 - { 6, 0x989c, 656 - { 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000 } }, 657 - { 6, 0x989c, 658 - { 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000 } }, 659 - { 6, 0x989c, 660 - { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } }, 661 - { 6, 0x989c, 662 - { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } }, 663 - { 6, 0x989c, 664 - { 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000 } }, 665 - { 6, 0x989c, 666 - { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 667 - { 6, 0x989c, 668 - { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 669 - { 6, 0x989c, 670 - { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 671 - { 6, 0x989c, 672 - { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 673 - { 6, 0x989c, 674 - { 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000 } }, 675 - { 6, 0x989c, 676 - { 0x00610000, 0x00610000, 0x00610000, 0x00610000, 0x00610000 } }, 677 - { 6, 0x989c, 678 - { 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000 } }, 679 - { 6, 0x989c, 680 - { 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000 } }, 681 - { 6, 0x989c, 682 - { 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000 } }, 683 - { 6, 0x989c, 684 - { 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000 } }, 685 - { 6, 0x989c, 686 - { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } }, 687 - { 6, 0x989c, 688 - { 0x00440000, 0x00440000, 0x00440000, 0x00440000, 0x00440000 } }, 689 - { 6, 0x989c, 690 - { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } }, 691 - { 6, 0x989c, 692 - { 0x00100080, 0x00100080, 0x00100080, 0x00100080, 0x00100080 } }, 693 - { 6, 0x989c, 694 - { 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034 } }, 695 - { 6, 0x989c, 696 - { 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0 } }, 697 - { 6, 0x989c, 698 - { 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f } }, 699 - { 6, 0x989c, 700 - { 0x00510040, 0x00510040, 0x00510040, 0x00510040, 0x00510040 } }, 701 - { 6, 0x989c, 702 - { 0x005000da, 0x005000da, 0x005000da, 0x005000da, 0x005000da } }, 703 - { 6, 0x989c, 704 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 705 - { 6, 0x989c, 706 - { 0x00004044, 0x00004044, 0x00004044, 0x00004044, 0x00004044 } }, 707 - { 6, 0x989c, 708 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 709 - { 6, 0x989c, 710 - { 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0 } }, 711 - { 6, 0x989c, 712 - { 0x00002c00, 0x00002c00, 0x00003600, 0x00003600, 0x00002c00 } }, 713 - { 6, 0x98c8, 714 - { 0x00000403, 0x00000403, 0x00040403, 0x00040403, 0x00040403 } }, 715 - { 7, 0x989c, 716 - { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } }, 717 - { 7, 0x989c, 718 - { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } }, 719 - { 7, 0x98cc, 720 - { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } }, 838 + /* BANK / C.R. A/XR B G */ 839 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 840 + { 2, 0x98d0, { 0x00000008, 0x00000008, 0x00000008 } }, 841 + { 3, 0x98dc, { 0x00a000c0, 0x00e000c0, 0x00e000c0 } }, 842 + { 6, 0x989c, { 0x33000000, 0x33000000, 0x33000000 } }, 843 + { 6, 0x989c, { 0x01000000, 0x01000000, 0x01000000 } }, 844 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 845 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 846 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 847 + { 6, 0x989c, { 0x1f000000, 0x1f000000, 0x1f000000 } }, 848 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 849 + { 6, 0x989c, { 0x00b80000, 0x00b80000, 0x00b80000 } }, 850 + { 6, 0x989c, { 0x00b70000, 0x00b70000, 0x00b70000 } }, 851 + { 6, 0x989c, { 0x00840000, 0x00840000, 0x00840000 } }, 852 + { 6, 0x989c, { 0x00980000, 0x00980000, 0x00980000 } }, 853 + { 6, 0x989c, { 0x00c00000, 0x00c00000, 0x00c00000 } }, 854 + { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 855 + { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 856 + { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 857 + { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 858 + { 6, 0x989c, { 0x00d70000, 0x00d70000, 0x00d70000 } }, 859 + { 6, 0x989c, { 0x00610000, 0x00610000, 0x00610000 } }, 860 + { 6, 0x989c, { 0x00fe0000, 0x00fe0000, 0x00fe0000 } }, 861 + { 6, 0x989c, { 0x00de0000, 0x00de0000, 0x00de0000 } }, 862 + { 6, 0x989c, { 0x007f0000, 0x007f0000, 0x007f0000 } }, 863 + { 6, 0x989c, { 0x043d0000, 0x043d0000, 0x043d0000 } }, 864 + { 6, 0x989c, { 0x00770000, 0x00770000, 0x00770000 } }, 865 + { 6, 0x989c, { 0x00440000, 0x00440000, 0x00440000 } }, 866 + { 6, 0x989c, { 0x00980000, 0x00980000, 0x00980000 } }, 867 + { 6, 0x989c, { 0x00100080, 0x00100080, 0x00100080 } }, 868 + { 6, 0x989c, { 0x0005c034, 0x0005c034, 0x0005c034 } }, 869 + { 6, 0x989c, { 0x003100f0, 0x003100f0, 0x003100f0 } }, 870 + { 6, 0x989c, { 0x000c011f, 0x000c011f, 0x000c011f } }, 871 + { 6, 0x989c, { 0x00510040, 0x00510040, 0x00510040 } }, 872 + { 6, 0x989c, { 0x005000da, 0x005000da, 0x005000da } }, 873 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 874 + { 6, 0x989c, { 0x00004044, 0x00004044, 0x00004044 } }, 875 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 876 + { 6, 0x989c, { 0x000060c0, 0x000060c0, 0x000060c0 } }, 877 + { 6, 0x989c, { 0x00002c00, 0x00003600, 0x00003600 } }, 878 + { 6, 0x98c8, { 0x00000403, 0x00040403, 0x00040403 } }, 879 + { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, 880 + { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, 881 + { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, 721 882 }; 722 883 723 884 ··· 684 931 * AR2317 (Spider SoC) * 685 932 \***************************/ 686 933 934 + /* BANK 2 len pos col */ 935 + #define AR5K_RF2425_RF_TURBO { 1, 1, 2 } 936 + 687 937 /* BANK 6 len pos col */ 688 938 #define AR5K_RF2425_OB_2GHZ { 3, 193, 0 } 689 939 #define AR5K_RF2425_DB_2GHZ { 3, 190, 0 } 690 940 691 941 static const struct ath5k_rf_reg rf_regs_2425[] = { 942 + {2, AR5K_RF_TURBO, AR5K_RF2425_RF_TURBO}, 692 943 {6, AR5K_RF_OB_2GHZ, AR5K_RF2425_OB_2GHZ}, 693 944 {6, AR5K_RF_DB_2GHZ, AR5K_RF2425_DB_2GHZ}, 694 945 }; 695 946 696 947 /* Default mode specific settings 697 - * XXX: a/aTurbo ? 698 948 */ 699 949 static const struct ath5k_ini_rfbuffer rfb_2425[] = { 700 - { 1, 0x98d4, 701 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 702 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 703 - { 2, 0x98d0, 704 - { 0x02001408, 0x02001408, 0x02001408, 0x02001408, 0x02001408 } }, 705 - { 3, 0x98dc, 706 - { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 707 - { 6, 0x989c, 708 - { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } }, 709 - { 6, 0x989c, 710 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 711 - { 6, 0x989c, 712 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 713 - { 6, 0x989c, 714 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 715 - { 6, 0x989c, 716 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 717 - { 6, 0x989c, 718 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 719 - { 6, 0x989c, 720 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 721 - { 6, 0x989c, 722 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 723 - { 6, 0x989c, 724 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 725 - { 6, 0x989c, 726 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 727 - { 6, 0x989c, 728 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 729 - { 6, 0x989c, 730 - { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 731 - { 6, 0x989c, 732 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 733 - { 6, 0x989c, 734 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 735 - { 6, 0x989c, 736 - { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } }, 737 - { 6, 0x989c, 738 - { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } }, 739 - { 6, 0x989c, 740 - { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } }, 741 - { 6, 0x989c, 742 - { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } }, 743 - { 6, 0x989c, 744 - { 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000 } }, 745 - { 6, 0x989c, 746 - { 0x00140000, 0x00140000, 0x00140000, 0x00140000, 0x00140000 } }, 747 - { 6, 0x989c, 748 - { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } }, 749 - { 6, 0x989c, 750 - { 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a } }, 751 - { 6, 0x989c, 752 - { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } }, 753 - { 6, 0x989c, 754 - { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } }, 755 - { 6, 0x989c, 756 - { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } }, 757 - { 6, 0x989c, 758 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 759 - { 6, 0x989c, 760 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 761 - { 6, 0x989c, 762 - { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } }, 763 - { 6, 0x989c, 764 - { 0x00001688, 0x00001688, 0x00001688, 0x00001688, 0x00001688 } }, 765 - { 6, 0x98c4, 766 - { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } }, 767 - { 7, 0x989c, 768 - { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } }, 769 - { 7, 0x989c, 770 - { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } }, 771 - { 7, 0x98cc, 772 - { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } }, 950 + /* BANK / C.R. A/XR B G */ 951 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 952 + { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, 953 + { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, 954 + { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } }, 955 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 956 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 957 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 958 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 959 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 960 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 961 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 962 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 963 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 964 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 965 + { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, 966 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 967 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 968 + { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } }, 969 + { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } }, 970 + { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } }, 971 + { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } }, 972 + { 6, 0x989c, { 0x00e70000, 0x00e70000, 0x00e70000 } }, 973 + { 6, 0x989c, { 0x00140000, 0x00140000, 0x00140000 } }, 974 + { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } }, 975 + { 6, 0x989c, { 0x0007001a, 0x0007001a, 0x0007001a } }, 976 + { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } }, 977 + { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } }, 978 + { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } }, 979 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 980 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 981 + { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } }, 982 + { 6, 0x989c, { 0x00001688, 0x00001688, 0x00001688 } }, 983 + { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } }, 984 + { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, 985 + { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, 986 + { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, 773 987 }; 774 988 775 989 /* ··· 744 1024 * bank modification and get rid of this 745 1025 */ 746 1026 static const struct ath5k_ini_rfbuffer rfb_2317[] = { 747 - { 1, 0x98d4, 748 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 749 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 750 - { 2, 0x98d0, 751 - { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } }, 752 - { 3, 0x98dc, 753 - { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 754 - { 6, 0x989c, 755 - { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } }, 756 - { 6, 0x989c, 757 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 758 - { 6, 0x989c, 759 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 760 - { 6, 0x989c, 761 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 762 - { 6, 0x989c, 763 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 764 - { 6, 0x989c, 765 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 766 - { 6, 0x989c, 767 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 768 - { 6, 0x989c, 769 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 770 - { 6, 0x989c, 771 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 772 - { 6, 0x989c, 773 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 774 - { 6, 0x989c, 775 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 776 - { 6, 0x989c, 777 - { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 778 - { 6, 0x989c, 779 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 780 - { 6, 0x989c, 781 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 782 - { 6, 0x989c, 783 - { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } }, 784 - { 6, 0x989c, 785 - { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } }, 786 - { 6, 0x989c, 787 - { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } }, 788 - { 6, 0x989c, 789 - { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } }, 790 - { 6, 0x989c, 791 - { 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000 } }, 792 - { 6, 0x989c, 793 - { 0x00140100, 0x00140100, 0x00140100, 0x00140100, 0x00140100 } }, 794 - { 6, 0x989c, 795 - { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } }, 796 - { 6, 0x989c, 797 - { 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a } }, 798 - { 6, 0x989c, 799 - { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } }, 800 - { 6, 0x989c, 801 - { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } }, 802 - { 6, 0x989c, 803 - { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } }, 804 - { 6, 0x989c, 805 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 806 - { 6, 0x989c, 807 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 808 - { 6, 0x989c, 809 - { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } }, 810 - { 6, 0x989c, 811 - { 0x00009688, 0x00009688, 0x00009688, 0x00009688, 0x00009688 } }, 812 - { 6, 0x98c4, 813 - { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } }, 814 - { 7, 0x989c, 815 - { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } }, 816 - { 7, 0x989c, 817 - { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } }, 818 - { 7, 0x98cc, 819 - { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } }, 1027 + /* BANK / C.R. A/XR B G */ 1028 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 1029 + { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, 1030 + { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, 1031 + { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } }, 1032 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1033 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1034 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1035 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1036 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1037 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1038 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1039 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1040 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1041 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1042 + { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, 1043 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1044 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1045 + { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } }, 1046 + { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } }, 1047 + { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } }, 1048 + { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } }, 1049 + { 6, 0x989c, { 0x00e70000, 0x00e70000, 0x00e70000 } }, 1050 + { 6, 0x989c, { 0x00140100, 0x00140100, 0x00140100 } }, 1051 + { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } }, 1052 + { 6, 0x989c, { 0x0007001a, 0x0007001a, 0x0007001a } }, 1053 + { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } }, 1054 + { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } }, 1055 + { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } }, 1056 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1057 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1058 + { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } }, 1059 + { 6, 0x989c, { 0x00009688, 0x00009688, 0x00009688 } }, 1060 + { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } }, 1061 + { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, 1062 + { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, 1063 + { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, 820 1064 }; 821 1065 822 1066 /* 823 1067 * TODO: Handle the few differences with swan during 824 1068 * bank modification and get rid of this 825 - * XXX: a/aTurbo ? 826 1069 */ 827 1070 static const struct ath5k_ini_rfbuffer rfb_2417[] = { 828 - { 1, 0x98d4, 829 - /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 830 - { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 831 - { 2, 0x98d0, 832 - { 0x02001408, 0x02001408, 0x02001408, 0x02001408, 0x02001408 } }, 833 - { 3, 0x98dc, 834 - { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 835 - { 6, 0x989c, 836 - { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } }, 837 - { 6, 0x989c, 838 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 839 - { 6, 0x989c, 840 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 841 - { 6, 0x989c, 842 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 843 - { 6, 0x989c, 844 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 845 - { 6, 0x989c, 846 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 847 - { 6, 0x989c, 848 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 849 - { 6, 0x989c, 850 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 851 - { 6, 0x989c, 852 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 853 - { 6, 0x989c, 854 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 855 - { 6, 0x989c, 856 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 857 - { 6, 0x989c, 858 - { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 859 - { 6, 0x989c, 860 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 861 - { 6, 0x989c, 862 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 863 - { 6, 0x989c, 864 - { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } }, 865 - { 6, 0x989c, 866 - { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } }, 867 - { 6, 0x989c, 868 - { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } }, 869 - { 6, 0x989c, 870 - { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } }, 871 - { 6, 0x989c, 872 - { 0x00e70000, 0x00e70000, 0x80e70000, 0x80e70000, 0x00e70000 } }, 873 - { 6, 0x989c, 874 - { 0x00140000, 0x00140000, 0x00140000, 0x00140000, 0x00140000 } }, 875 - { 6, 0x989c, 876 - { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } }, 877 - { 6, 0x989c, 878 - { 0x0007001a, 0x0007001a, 0x0207001a, 0x0207001a, 0x0007001a } }, 879 - { 6, 0x989c, 880 - { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } }, 881 - { 6, 0x989c, 882 - { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } }, 883 - { 6, 0x989c, 884 - { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } }, 885 - { 6, 0x989c, 886 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 887 - { 6, 0x989c, 888 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 889 - { 6, 0x989c, 890 - { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } }, 891 - { 6, 0x989c, 892 - { 0x00001688, 0x00001688, 0x00001688, 0x00001688, 0x00001688 } }, 893 - { 6, 0x98c4, 894 - { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } }, 895 - { 7, 0x989c, 896 - { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } }, 897 - { 7, 0x989c, 898 - { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } }, 899 - { 7, 0x98cc, 900 - { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } }, 1071 + /* BANK / C.R. A/XR B G */ 1072 + { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, 1073 + { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, 1074 + { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, 1075 + { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } }, 1076 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1077 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1078 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1079 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1080 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1081 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1082 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1083 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1084 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1085 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1086 + { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, 1087 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1088 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1089 + { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } }, 1090 + { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } }, 1091 + { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } }, 1092 + { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } }, 1093 + { 6, 0x989c, { 0x00e70000, 0x80e70000, 0x80e70000 } }, 1094 + { 6, 0x989c, { 0x00140000, 0x00140000, 0x00140000 } }, 1095 + { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } }, 1096 + { 6, 0x989c, { 0x0007001a, 0x0207001a, 0x0207001a } }, 1097 + { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } }, 1098 + { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } }, 1099 + { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } }, 1100 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1101 + { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, 1102 + { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } }, 1103 + { 6, 0x989c, { 0x00001688, 0x00001688, 0x00001688 } }, 1104 + { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } }, 1105 + { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, 1106 + { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, 1107 + { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, 901 1108 };
+2 -2
drivers/net/wireless/ath/ath5k/sysfs.c
··· 95 95 int 96 96 ath5k_sysfs_register(struct ath5k_softc *sc) 97 97 { 98 - struct device *dev = &sc->pdev->dev; 98 + struct device *dev = sc->dev; 99 99 int err; 100 100 101 101 err = sysfs_create_group(&dev->kobj, &ath5k_attribute_group_ani); ··· 110 110 void 111 111 ath5k_sysfs_unregister(struct ath5k_softc *sc) 112 112 { 113 - struct device *dev = &sc->pdev->dev; 113 + struct device *dev = sc->dev; 114 114 115 115 sysfs_remove_group(&dev->kobj, &ath5k_attribute_group_ani); 116 116 }
+161 -156
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
··· 57 57 #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ 58 58 #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ 59 59 60 + #define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6)) 61 + 60 62 static int ar9003_hw_power_interpolate(int32_t x, 61 63 int32_t *px, int32_t *py, u_int16_t np); 64 + 62 65 static const struct ar9300_eeprom ar9300_default = { 63 66 .eepromVersion = 2, 64 67 .templateVersion = 2, ··· 299 296 } 300 297 }, 301 298 .ctlPowerData_2G = { 302 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 303 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 304 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 299 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 300 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 301 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, 305 302 306 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 307 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 308 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 303 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, 304 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 305 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 309 306 310 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 311 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 312 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 307 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, 308 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 309 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 313 310 314 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 315 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 316 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 311 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 312 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 313 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 317 314 }, 318 315 .modalHeader5G = { 319 316 /* 4 idle,t1,t2,b (4 bits per setting) */ ··· 585 582 .ctlPowerData_5G = { 586 583 { 587 584 { 588 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 589 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 585 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 586 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 590 587 } 591 588 }, 592 589 { 593 590 { 594 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 595 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 591 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 592 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 596 593 } 597 594 }, 598 595 { 599 596 { 600 - {60, 0}, {60, 1}, {60, 0}, {60, 1}, 601 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 597 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), 598 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 602 599 } 603 600 }, 604 601 { 605 602 { 606 - {60, 0}, {60, 1}, {60, 1}, {60, 0}, 607 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 603 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), 604 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 608 605 } 609 606 }, 610 607 { 611 608 { 612 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 613 - {60, 0}, {60, 0}, {60, 0}, {60, 0}, 609 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 610 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), 614 611 } 615 612 }, 616 613 { 617 614 { 618 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 619 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 615 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 616 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 620 617 } 621 618 }, 622 619 { 623 620 { 624 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 625 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 621 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 622 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 626 623 } 627 624 }, 628 625 { 629 626 { 630 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 631 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 627 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 628 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 632 629 } 633 630 }, 634 631 { 635 632 { 636 - {60, 1}, {60, 0}, {60, 1}, {60, 1}, 637 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 633 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), 634 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 638 635 } 639 636 }, 640 637 } ··· 876 873 } 877 874 }, 878 875 .ctlPowerData_2G = { 879 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 880 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 881 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 876 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 877 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 878 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, 882 879 883 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 884 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 885 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 880 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, 881 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 882 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 886 883 887 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 888 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 889 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 884 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, 885 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 886 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 890 887 891 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 892 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 893 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 888 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 889 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 890 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 894 891 }, 895 892 .modalHeader5G = { 896 893 /* 4 idle,t1,t2,b (4 bits per setting) */ ··· 1162 1159 .ctlPowerData_5G = { 1163 1160 { 1164 1161 { 1165 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1166 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1162 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1163 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1167 1164 } 1168 1165 }, 1169 1166 { 1170 1167 { 1171 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1172 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1168 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1169 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1173 1170 } 1174 1171 }, 1175 1172 { 1176 1173 { 1177 - {60, 0}, {60, 1}, {60, 0}, {60, 1}, 1178 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1174 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), 1175 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1179 1176 } 1180 1177 }, 1181 1178 { 1182 1179 { 1183 - {60, 0}, {60, 1}, {60, 1}, {60, 0}, 1184 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 1180 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1181 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 1185 1182 } 1186 1183 }, 1187 1184 { 1188 1185 { 1189 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1190 - {60, 0}, {60, 0}, {60, 0}, {60, 0}, 1186 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1187 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), 1191 1188 } 1192 1189 }, 1193 1190 { 1194 1191 { 1195 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1196 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 1192 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1193 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 1197 1194 } 1198 1195 }, 1199 1196 { 1200 1197 { 1201 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1202 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1198 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1199 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1203 1200 } 1204 1201 }, 1205 1202 { 1206 1203 { 1207 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 1208 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1204 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 1205 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1209 1206 } 1210 1207 }, 1211 1208 { 1212 1209 { 1213 - {60, 1}, {60, 0}, {60, 1}, {60, 1}, 1214 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 1210 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), 1211 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 1215 1212 } 1216 1213 }, 1217 1214 } ··· 1454 1451 } 1455 1452 }, 1456 1453 .ctlPowerData_2G = { 1457 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1458 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1459 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 1454 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 1455 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 1456 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, 1460 1457 1461 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 1462 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1463 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1458 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, 1459 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 1460 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 1464 1461 1465 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 1466 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1467 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1462 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, 1463 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 1464 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 1468 1465 1469 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 1470 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 1471 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 1466 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 1467 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 1468 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 1472 1469 }, 1473 1470 .modalHeader5G = { 1474 1471 /* 4 idle,t1,t2,b (4 bits per setting) */ ··· 1740 1737 .ctlPowerData_5G = { 1741 1738 { 1742 1739 { 1743 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1744 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1740 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1741 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1745 1742 } 1746 1743 }, 1747 1744 { 1748 1745 { 1749 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1750 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1746 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1747 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1751 1748 } 1752 1749 }, 1753 1750 { 1754 1751 { 1755 - {60, 0}, {60, 1}, {60, 0}, {60, 1}, 1756 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1752 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), 1753 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1757 1754 } 1758 1755 }, 1759 1756 { 1760 1757 { 1761 - {60, 0}, {60, 1}, {60, 1}, {60, 0}, 1762 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 1758 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1759 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 1763 1760 } 1764 1761 }, 1765 1762 { 1766 1763 { 1767 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1768 - {60, 0}, {60, 0}, {60, 0}, {60, 0}, 1764 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1765 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), 1769 1766 } 1770 1767 }, 1771 1768 { 1772 1769 { 1773 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1774 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 1770 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1771 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 1775 1772 } 1776 1773 }, 1777 1774 { 1778 1775 { 1779 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1780 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 1776 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1777 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 1781 1778 } 1782 1779 }, 1783 1780 { 1784 1781 { 1785 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 1786 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 1782 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 1783 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 1787 1784 } 1788 1785 }, 1789 1786 { 1790 1787 { 1791 - {60, 1}, {60, 0}, {60, 1}, {60, 1}, 1792 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 1788 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), 1789 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 1793 1790 } 1794 1791 }, 1795 1792 } ··· 2032 2029 } 2033 2030 }, 2034 2031 .ctlPowerData_2G = { 2035 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2036 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2037 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 2032 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2033 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2034 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, 2038 2035 2039 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 2040 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2041 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2036 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, 2037 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2038 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2042 2039 2043 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 2044 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2045 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2040 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, 2041 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2042 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2046 2043 2047 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2048 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 2049 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 2044 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2045 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 2046 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 2050 2047 }, 2051 2048 .modalHeader5G = { 2052 2049 /* 4 idle,t1,t2,b (4 bits per setting) */ ··· 2318 2315 .ctlPowerData_5G = { 2319 2316 { 2320 2317 { 2321 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2322 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2318 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2319 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2323 2320 } 2324 2321 }, 2325 2322 { 2326 2323 { 2327 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2328 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2324 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2325 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2329 2326 } 2330 2327 }, 2331 2328 { 2332 2329 { 2333 - {60, 0}, {60, 1}, {60, 0}, {60, 1}, 2334 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2330 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), 2331 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2335 2332 } 2336 2333 }, 2337 2334 { 2338 2335 { 2339 - {60, 0}, {60, 1}, {60, 1}, {60, 0}, 2340 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 2336 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2337 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 2341 2338 } 2342 2339 }, 2343 2340 { 2344 2341 { 2345 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2346 - {60, 0}, {60, 0}, {60, 0}, {60, 0}, 2342 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2343 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), 2347 2344 } 2348 2345 }, 2349 2346 { 2350 2347 { 2351 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2352 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 2348 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2349 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 2353 2350 } 2354 2351 }, 2355 2352 { 2356 2353 { 2357 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2358 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2354 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2355 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2359 2356 } 2360 2357 }, 2361 2358 { 2362 2359 { 2363 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 2364 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2360 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 2361 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2365 2362 } 2366 2363 }, 2367 2364 { 2368 2365 { 2369 - {60, 1}, {60, 0}, {60, 1}, {60, 1}, 2370 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 2366 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), 2367 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 2371 2368 } 2372 2369 }, 2373 2370 } ··· 2609 2606 } 2610 2607 }, 2611 2608 .ctlPowerData_2G = { 2612 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2613 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2614 - { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, 2609 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2610 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2611 + { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, 2615 2612 2616 - { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, 2617 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2618 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2613 + { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, 2614 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2615 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2619 2616 2620 - { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, 2621 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2622 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2617 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, 2618 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2619 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2623 2620 2624 - { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, 2625 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 2626 - { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, 2621 + { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, 2622 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 2623 + { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, 2627 2624 }, 2628 2625 .modalHeader5G = { 2629 2626 /* 4 idle,t1,t2,b (4 bits per setting) */ ··· 2895 2892 .ctlPowerData_5G = { 2896 2893 { 2897 2894 { 2898 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2899 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2895 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2896 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2900 2897 } 2901 2898 }, 2902 2899 { 2903 2900 { 2904 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2905 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2901 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2902 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2906 2903 } 2907 2904 }, 2908 2905 { 2909 2906 { 2910 - {60, 0}, {60, 1}, {60, 0}, {60, 1}, 2911 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2907 + CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), 2908 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2912 2909 } 2913 2910 }, 2914 2911 { 2915 2912 { 2916 - {60, 0}, {60, 1}, {60, 1}, {60, 0}, 2917 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 2913 + CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2914 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 2918 2915 } 2919 2916 }, 2920 2917 { 2921 2918 { 2922 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2923 - {60, 0}, {60, 0}, {60, 0}, {60, 0}, 2919 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2920 + CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), 2924 2921 } 2925 2922 }, 2926 2923 { 2927 2924 { 2928 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2929 - {60, 1}, {60, 0}, {60, 0}, {60, 0}, 2925 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2926 + CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), 2930 2927 } 2931 2928 }, 2932 2929 { 2933 2930 { 2934 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2935 - {60, 1}, {60, 1}, {60, 1}, {60, 1}, 2931 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2932 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), 2936 2933 } 2937 2934 }, 2938 2935 { 2939 2936 { 2940 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 2941 - {60, 1}, {60, 1}, {60, 1}, {60, 0}, 2937 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 2938 + CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), 2942 2939 } 2943 2940 }, 2944 2941 { 2945 2942 { 2946 - {60, 1}, {60, 0}, {60, 1}, {60, 1}, 2947 - {60, 1}, {60, 1}, {60, 0}, {60, 1}, 2943 + CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), 2944 + CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), 2948 2945 } 2949 2946 }, 2950 2947 } ··· 3032 3029 return le32_to_cpu(pBase->swreg); 3033 3030 case EEP_PAPRD: 3034 3031 return !!(pBase->featureEnable & BIT(5)); 3032 + case EEP_CHAIN_MASK_REDUCE: 3033 + return (pBase->miscConfiguration >> 0x3) & 0x1; 3035 3034 default: 3036 3035 return 0; 3037 3036 } ··· 4368 4363 struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; 4369 4364 4370 4365 if (is2GHz) 4371 - return ctl_2g[idx].ctlEdges[edge].tPower; 4366 + return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]); 4372 4367 else 4373 - return ctl_5g[idx].ctlEdges[edge].tPower; 4368 + return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]); 4374 4369 } 4375 4370 4376 4371 static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, ··· 4388 4383 4389 4384 if (is2GHz) { 4390 4385 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && 4391 - ctl_2g[idx].ctlEdges[edge - 1].flag) 4392 - return ctl_2g[idx].ctlEdges[edge - 1].tPower; 4386 + CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1])) 4387 + return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]); 4393 4388 } else { 4394 4389 if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && 4395 - ctl_5g[idx].ctlEdges[edge - 1].flag) 4396 - return ctl_5g[idx].ctlEdges[edge - 1].tPower; 4390 + CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1])) 4391 + return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]); 4397 4392 } 4398 4393 4399 4394 return AR9300_MAX_RATE_POWER;
+2 -7
drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
··· 270 270 u8 tPow2x[14]; 271 271 } __packed; 272 272 273 - struct cal_ctl_edge_pwr { 274 - u8 tPower:6, 275 - flag:2; 276 - } __packed; 277 - 278 273 struct cal_ctl_data_2g { 279 - struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_2G]; 274 + u8 ctlEdges[AR9300_NUM_BAND_EDGES_2G]; 280 275 } __packed; 281 276 282 277 struct cal_ctl_data_5g { 283 - struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_5G]; 278 + u8 ctlEdges[AR9300_NUM_BAND_EDGES_5G]; 284 279 } __packed; 285 280 286 281 struct ar9300_BaseExtension_1 {
+5 -1
drivers/net/wireless/ath/ath9k/ar9003_phy.c
··· 487 487 break; 488 488 } 489 489 490 - REG_WRITE(ah, AR_SELFGEN_MASK, tx); 490 + if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7)) 491 + REG_WRITE(ah, AR_SELFGEN_MASK, 0x3); 492 + else 493 + REG_WRITE(ah, AR_SELFGEN_MASK, tx); 494 + 491 495 if (tx == 0x5) { 492 496 REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, 493 497 AR_PHY_SWAP_ALT_CHAIN);
+6 -1
drivers/net/wireless/ath/ath9k/ath9k.h
··· 21 21 #include <linux/device.h> 22 22 #include <linux/leds.h> 23 23 #include <linux/completion.h> 24 + #include <linux/pm_qos_params.h> 24 25 25 26 #include "debug.h" 26 27 #include "common.h" ··· 545 544 #define SC_OP_BT_PRIORITY_DETECTED BIT(12) 546 545 #define SC_OP_BT_SCAN BIT(13) 547 546 #define SC_OP_ANI_RUN BIT(14) 547 + #define SC_OP_ENABLE_APM BIT(15) 548 548 549 549 /* Powersave flags */ 550 550 #define PS_WAIT_FOR_BEACON BIT(0) ··· 630 628 struct ath_descdma txsdma; 631 629 632 630 struct ath_ant_comb ant_comb; 631 + 632 + struct pm_qos_request_list pm_qos_req; 633 633 }; 634 634 635 635 struct ath_wiphy { ··· 661 657 } 662 658 663 659 extern struct ieee80211_ops ath9k_ops; 664 - extern struct pm_qos_request_list ath9k_pm_qos_req; 665 660 extern int modparam_nohwcrypt; 666 661 extern int led_blink; 667 662 ··· 697 694 698 695 void ath9k_ps_wakeup(struct ath_softc *sc); 699 696 void ath9k_ps_restore(struct ath_softc *sc); 697 + 698 + u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate); 700 699 701 700 void ath9k_set_bssid_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 702 701 int ath9k_wiphy_add(struct ath_softc *sc);
+2 -1
drivers/net/wireless/ath/ath9k/beacon.c
··· 103 103 memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4); 104 104 series[0].Tries = 1; 105 105 series[0].Rate = rate; 106 - series[0].ChSel = common->tx_chainmask; 106 + series[0].ChSel = ath_txchainmask_reduction(sc, 107 + common->tx_chainmask, series[0].Rate); 107 108 series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0; 108 109 ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration, 109 110 series, 4, 0);
-23
drivers/net/wireless/ath/ath9k/btcoex.c
··· 35 35 bool bt_hold_rx_clear; 36 36 }; 37 37 38 - static const u16 ath_subsysid_tbl[] = { 39 - AR9280_COEX2WIRE_SUBSYSID, 40 - AT9285_COEX3WIRE_SA_SUBSYSID, 41 - AT9285_COEX3WIRE_DA_SUBSYSID 42 - }; 43 - 44 - /* 45 - * Checks the subsystem id of the device to see if it 46 - * supports btcoex 47 - */ 48 - bool ath9k_hw_btcoex_supported(struct ath_hw *ah) 49 - { 50 - int i; 51 - 52 - if (!ah->hw_version.subsysid) 53 - return false; 54 - 55 - for (i = 0; i < ARRAY_SIZE(ath_subsysid_tbl); i++) 56 - if (ah->hw_version.subsysid == ath_subsysid_tbl[i]) 57 - return true; 58 - 59 - return false; 60 - } 61 38 62 39 void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum) 63 40 {
-1
drivers/net/wireless/ath/ath9k/btcoex.h
··· 49 49 u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */ 50 50 }; 51 51 52 - bool ath9k_hw_btcoex_supported(struct ath_hw *ah); 53 52 void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah); 54 53 void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah); 55 54 void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum);
+4 -31
drivers/net/wireless/ath/ath9k/debug.c
··· 24 24 #define REG_READ_D(_ah, _reg) \ 25 25 ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 26 26 27 - static struct dentry *ath9k_debugfs_root; 28 - 29 27 static int ath9k_debugfs_open(struct inode *inode, struct file *file) 30 28 { 31 29 file->private_data = inode->i_private; ··· 876 878 struct ath_common *common = ath9k_hw_common(ah); 877 879 struct ath_softc *sc = (struct ath_softc *) common->priv; 878 880 879 - if (!ath9k_debugfs_root) 880 - return -ENOENT; 881 - 882 - sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy), 883 - ath9k_debugfs_root); 881 + sc->debug.debugfs_phy = debugfs_create_dir("ath9k", 882 + sc->hw->wiphy->debugfsdir); 884 883 if (!sc->debug.debugfs_phy) 885 884 return -ENOMEM; 886 885 ··· 930 935 sc->debug.regidx = 0; 931 936 return 0; 932 937 err: 933 - ath9k_exit_debug(ah); 934 - return -ENOMEM; 935 - } 936 - 937 - void ath9k_exit_debug(struct ath_hw *ah) 938 - { 939 - struct ath_common *common = ath9k_hw_common(ah); 940 - struct ath_softc *sc = (struct ath_softc *) common->priv; 941 - 942 938 debugfs_remove_recursive(sc->debug.debugfs_phy); 943 - } 944 - 945 - int ath9k_debug_create_root(void) 946 - { 947 - ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); 948 - if (!ath9k_debugfs_root) 949 - return -ENOENT; 950 - 951 - return 0; 952 - } 953 - 954 - void ath9k_debug_remove_root(void) 955 - { 956 - debugfs_remove(ath9k_debugfs_root); 957 - ath9k_debugfs_root = NULL; 939 + sc->debug.debugfs_phy = NULL; 940 + return -ENOMEM; 958 941 }
-16
drivers/net/wireless/ath/ath9k/debug.h
··· 164 164 }; 165 165 166 166 int ath9k_init_debug(struct ath_hw *ah); 167 - void ath9k_exit_debug(struct ath_hw *ah); 168 167 169 - int ath9k_debug_create_root(void); 170 - void ath9k_debug_remove_root(void); 171 168 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); 172 169 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, 173 170 struct ath_tx_status *ts); ··· 175 178 static inline int ath9k_init_debug(struct ath_hw *ah) 176 179 { 177 180 return 0; 178 - } 179 - 180 - static inline void ath9k_exit_debug(struct ath_hw *ah) 181 - { 182 - } 183 - 184 - static inline int ath9k_debug_create_root(void) 185 - { 186 - return 0; 187 - } 188 - 189 - static inline void ath9k_debug_remove_root(void) 190 - { 191 181 } 192 182 193 183 static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
+3 -3
drivers/net/wireless/ath/ath9k/eeprom.c
··· 240 240 for (i = 0; (i < num_band_edges) && 241 241 (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { 242 242 if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { 243 - twiceMaxEdgePower = pRdEdgesPower[i].tPower; 243 + twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl); 244 244 break; 245 245 } else if ((i > 0) && 246 246 (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, 247 247 is2GHz))) { 248 248 if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, 249 249 is2GHz) < freq && 250 - pRdEdgesPower[i - 1].flag) { 250 + CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) { 251 251 twiceMaxEdgePower = 252 - pRdEdgesPower[i - 1].tPower; 252 + CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl); 253 253 } 254 254 break; 255 255 }
+15 -13
drivers/net/wireless/ath/ath9k/eeprom.h
··· 233 233 234 234 #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) 235 235 236 + #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) 237 + #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) 238 + 239 + #define LNA_CTL_BUF_MODE BIT(0) 240 + #define LNA_CTL_ISEL_LO BIT(1) 241 + #define LNA_CTL_ISEL_HI BIT(2) 242 + #define LNA_CTL_BUF_IN BIT(3) 243 + #define LNA_CTL_FEM_BAND BIT(4) 244 + #define LNA_CTL_LOCAL_BIAS BIT(5) 245 + #define LNA_CTL_FORCE_XPA BIT(6) 246 + #define LNA_CTL_USE_ANT1 BIT(7) 247 + 236 248 enum eeprom_param { 237 249 EEP_NFTHRESH_5, 238 250 EEP_NFTHRESH_2, ··· 280 268 EEP_PAPRD, 281 269 EEP_MODAL_VER, 282 270 EEP_ANT_DIV_CTL1, 271 + EEP_CHAIN_MASK_REDUCE 283 272 }; 284 273 285 274 enum ar5416_rates { ··· 391 378 u8 xatten2Margin[AR5416_MAX_CHAINS]; 392 379 u8 ob_ch1; 393 380 u8 db_ch1; 394 - u8 useAnt1:1, 395 - force_xpaon:1, 396 - local_bias:1, 397 - femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1; 381 + u8 lna_ctl; 398 382 u8 miscBits; 399 383 u16 xpaBiasLvlFreq[3]; 400 384 u8 futureModal[6]; ··· 545 535 u8 tPow2x[8]; 546 536 } __packed; 547 537 548 - 549 - #ifdef __BIG_ENDIAN_BITFIELD 550 538 struct cal_ctl_edges { 551 539 u8 bChannel; 552 - u8 flag:2, tPower:6; 540 + u8 ctl; 553 541 } __packed; 554 - #else 555 - struct cal_ctl_edges { 556 - u8 bChannel; 557 - u8 tPower:6, flag:2; 558 - } __packed; 559 - #endif 560 542 561 543 struct cal_data_op_loop_ar9287 { 562 544 u8 pwrPdg[2][5];
+6 -5
drivers/net/wireless/ath/ath9k/eeprom_def.c
··· 451 451 ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2, 452 452 AR_AN_TOP2_LOCALBIAS, 453 453 AR_AN_TOP2_LOCALBIAS_S, 454 - pModal->local_bias); 454 + !!(pModal->lna_ctl & 455 + LNA_CTL_LOCAL_BIAS)); 455 456 REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG, 456 - pModal->force_xpaon); 457 + !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA)); 457 458 } 458 459 459 460 REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, ··· 1436 1435 1437 1436 num_ant_config = 1; 1438 1437 1439 - if (pBase->version >= 0x0E0D) 1440 - if (pModal->useAnt1) 1441 - num_ant_config += 1; 1438 + if (pBase->version >= 0x0E0D && 1439 + (pModal->lna_ctl & LNA_CTL_USE_ANT1)) 1440 + num_ant_config += 1; 1442 1441 1443 1442 return num_ant_config; 1444 1443 }
+59 -62
drivers/net/wireless/ath/ath9k/hif_usb.c
··· 363 363 struct sk_buff *skb) 364 364 { 365 365 struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER]; 366 - int index = 0, i = 0, chk_idx, len = skb->len; 367 - int rx_remain_len = 0, rx_pkt_len = 0; 368 - u16 pkt_len, pkt_tag, pool_index = 0; 366 + int index = 0, i = 0, len = skb->len; 367 + int rx_remain_len, rx_pkt_len; 368 + u16 pool_index = 0; 369 369 u8 *ptr; 370 370 371 371 spin_lock(&hif_dev->rx_lock); ··· 399 399 spin_unlock(&hif_dev->rx_lock); 400 400 401 401 while (index < len) { 402 + u16 pkt_len; 403 + u16 pkt_tag; 404 + u16 pad_len; 405 + int chk_idx; 406 + 402 407 ptr = (u8 *) skb->data; 403 408 404 409 pkt_len = ptr[index] + (ptr[index+1] << 8); 405 410 pkt_tag = ptr[index+2] + (ptr[index+3] << 8); 406 411 407 - if (pkt_tag == ATH_USB_RX_STREAM_MODE_TAG) { 408 - u16 pad_len; 409 - 410 - pad_len = 4 - (pkt_len & 0x3); 411 - if (pad_len == 4) 412 - pad_len = 0; 413 - 414 - chk_idx = index; 415 - index = index + 4 + pkt_len + pad_len; 416 - 417 - if (index > MAX_RX_BUF_SIZE) { 418 - spin_lock(&hif_dev->rx_lock); 419 - hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; 420 - hif_dev->rx_transfer_len = 421 - MAX_RX_BUF_SIZE - chk_idx - 4; 422 - hif_dev->rx_pad_len = pad_len; 423 - 424 - nskb = __dev_alloc_skb(pkt_len + 32, 425 - GFP_ATOMIC); 426 - if (!nskb) { 427 - dev_err(&hif_dev->udev->dev, 428 - "ath9k_htc: RX memory allocation" 429 - " error\n"); 430 - spin_unlock(&hif_dev->rx_lock); 431 - goto err; 432 - } 433 - skb_reserve(nskb, 32); 434 - RX_STAT_INC(skb_allocated); 435 - 436 - memcpy(nskb->data, &(skb->data[chk_idx+4]), 437 - hif_dev->rx_transfer_len); 438 - 439 - /* Record the buffer pointer */ 440 - hif_dev->remain_skb = nskb; 441 - spin_unlock(&hif_dev->rx_lock); 442 - } else { 443 - nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); 444 - if (!nskb) { 445 - dev_err(&hif_dev->udev->dev, 446 - "ath9k_htc: RX memory allocation" 447 - " error\n"); 448 - goto err; 449 - } 450 - skb_reserve(nskb, 32); 451 - RX_STAT_INC(skb_allocated); 452 - 453 - memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len); 454 - skb_put(nskb, pkt_len); 455 - skb_pool[pool_index++] = nskb; 456 - } 457 - } else { 412 + if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) { 458 413 RX_STAT_INC(skb_dropped); 459 414 return; 415 + } 416 + 417 + pad_len = 4 - (pkt_len & 0x3); 418 + if (pad_len == 4) 419 + pad_len = 0; 420 + 421 + chk_idx = index; 422 + index = index + 4 + pkt_len + pad_len; 423 + 424 + if (index > MAX_RX_BUF_SIZE) { 425 + spin_lock(&hif_dev->rx_lock); 426 + hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; 427 + hif_dev->rx_transfer_len = 428 + MAX_RX_BUF_SIZE - chk_idx - 4; 429 + hif_dev->rx_pad_len = pad_len; 430 + 431 + nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); 432 + if (!nskb) { 433 + dev_err(&hif_dev->udev->dev, 434 + "ath9k_htc: RX memory allocation error\n"); 435 + spin_unlock(&hif_dev->rx_lock); 436 + goto err; 437 + } 438 + skb_reserve(nskb, 32); 439 + RX_STAT_INC(skb_allocated); 440 + 441 + memcpy(nskb->data, &(skb->data[chk_idx+4]), 442 + hif_dev->rx_transfer_len); 443 + 444 + /* Record the buffer pointer */ 445 + hif_dev->remain_skb = nskb; 446 + spin_unlock(&hif_dev->rx_lock); 447 + } else { 448 + nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); 449 + if (!nskb) { 450 + dev_err(&hif_dev->udev->dev, 451 + "ath9k_htc: RX memory allocation error\n"); 452 + goto err; 453 + } 454 + skb_reserve(nskb, 32); 455 + RX_STAT_INC(skb_allocated); 456 + 457 + memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len); 458 + skb_put(nskb, pkt_len); 459 + skb_pool[pool_index++] = nskb; 460 460 } 461 461 } 462 462 ··· 471 471 static void ath9k_hif_usb_rx_cb(struct urb *urb) 472 472 { 473 473 struct sk_buff *skb = (struct sk_buff *) urb->context; 474 - struct hif_device_usb *hif_dev = (struct hif_device_usb *) 474 + struct hif_device_usb *hif_dev = 475 475 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 476 476 int ret; 477 477 ··· 518 518 { 519 519 struct sk_buff *skb = (struct sk_buff *) urb->context; 520 520 struct sk_buff *nskb; 521 - struct hif_device_usb *hif_dev = (struct hif_device_usb *) 521 + struct hif_device_usb *hif_dev = 522 522 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 523 523 int ret; 524 524 ··· 993 993 static void ath9k_hif_usb_disconnect(struct usb_interface *interface) 994 994 { 995 995 struct usb_device *udev = interface_to_usbdev(interface); 996 - struct hif_device_usb *hif_dev = 997 - (struct hif_device_usb *) usb_get_intfdata(interface); 996 + struct hif_device_usb *hif_dev = usb_get_intfdata(interface); 998 997 999 998 if (hif_dev) { 1000 999 ath9k_htc_hw_deinit(hif_dev->htc_handle, ··· 1015 1016 static int ath9k_hif_usb_suspend(struct usb_interface *interface, 1016 1017 pm_message_t message) 1017 1018 { 1018 - struct hif_device_usb *hif_dev = 1019 - (struct hif_device_usb *) usb_get_intfdata(interface); 1019 + struct hif_device_usb *hif_dev = usb_get_intfdata(interface); 1020 1020 1021 1021 ath9k_hif_usb_dealloc_urbs(hif_dev); 1022 1022 ··· 1024 1026 1025 1027 static int ath9k_hif_usb_resume(struct usb_interface *interface) 1026 1028 { 1027 - struct hif_device_usb *hif_dev = 1028 - (struct hif_device_usb *) usb_get_intfdata(interface); 1029 + struct hif_device_usb *hif_dev = usb_get_intfdata(interface); 1029 1030 struct htc_target *htc_handle = hif_dev->htc_handle; 1030 1031 int ret; 1031 1032
+59 -5
drivers/net/wireless/ath/ath9k/htc_drv_main.c
··· 184 184 return ret; 185 185 } 186 186 187 + static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv) 188 + { 189 + struct ath_common *common = ath9k_hw_common(priv->ah); 190 + struct ath9k_htc_target_vif hvif; 191 + int ret = 0; 192 + u8 cmd_rsp; 193 + 194 + if (priv->nvifs > 0) 195 + return -ENOBUFS; 196 + 197 + memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif)); 198 + memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN); 199 + 200 + hvif.opmode = cpu_to_be32(HTC_M_MONITOR); 201 + priv->ah->opmode = NL80211_IFTYPE_MONITOR; 202 + hvif.index = priv->nvifs; 203 + 204 + WMI_CMD_BUF(WMI_VAP_CREATE_CMDID, &hvif); 205 + if (ret) 206 + return ret; 207 + 208 + priv->nvifs++; 209 + return 0; 210 + } 211 + 212 + static int ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv) 213 + { 214 + struct ath_common *common = ath9k_hw_common(priv->ah); 215 + struct ath9k_htc_target_vif hvif; 216 + int ret = 0; 217 + u8 cmd_rsp; 218 + 219 + memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif)); 220 + memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN); 221 + hvif.index = 0; /* Should do for now */ 222 + WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif); 223 + priv->nvifs--; 224 + 225 + return ret; 226 + } 227 + 187 228 static int ath9k_htc_add_station(struct ath9k_htc_priv *priv, 188 229 struct ieee80211_vif *vif, 189 230 struct ieee80211_sta *sta) ··· 1240 1199 WMI_CMD(WMI_STOP_RECV_CMDID); 1241 1200 skb_queue_purge(&priv->tx_queue); 1242 1201 1202 + /* Remove monitor interface here */ 1203 + if (ah->opmode == NL80211_IFTYPE_MONITOR) { 1204 + if (ath9k_htc_remove_monitor_interface(priv)) 1205 + ath_print(common, ATH_DBG_FATAL, 1206 + "Unable to remove monitor interface\n"); 1207 + else 1208 + ath_print(common, ATH_DBG_CONFIG, 1209 + "Monitor interface removed\n"); 1210 + } 1211 + 1243 1212 if (ah->btcoex_hw.enabled) { 1244 1213 ath9k_hw_btcoex_disable(ah); 1245 1214 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) ··· 1423 1372 } 1424 1373 } 1425 1374 1426 - if (changed & IEEE80211_CONF_CHANGE_MONITOR) 1375 + if (changed & IEEE80211_CONF_CHANGE_MONITOR) { 1427 1376 if (conf->flags & IEEE80211_CONF_MONITOR) { 1428 - ath_print(common, ATH_DBG_CONFIG, 1429 - "HW opmode set to Monitor mode\n"); 1430 - priv->ah->opmode = NL80211_IFTYPE_MONITOR; 1377 + if (ath9k_htc_add_monitor_interface(priv)) 1378 + ath_print(common, ATH_DBG_FATAL, 1379 + "Failed to set monitor mode\n"); 1380 + else 1381 + ath_print(common, ATH_DBG_CONFIG, 1382 + "HW opmode set to Monitor mode\n"); 1431 1383 } 1432 - 1384 + } 1433 1385 1434 1386 if (changed & IEEE80211_CONF_CHANGE_IDLE) { 1435 1387 mutex_lock(&priv->htc_pm_lock);
-19
drivers/net/wireless/ath/ath9k/htc_hst.h
··· 77 77 u8 credits; 78 78 } __packed; 79 79 80 - struct htc_packet { 81 - void *pktcontext; 82 - u8 *buf; 83 - u8 *buf_payload; 84 - u32 buflen; 85 - u32 payload_len; 86 - 87 - int endpoint; 88 - int status; 89 - 90 - void *context; 91 - u32 reserved; 92 - }; 93 - 94 80 struct htc_ep_callbacks { 95 81 void *priv; 96 82 void (*tx) (void *, struct sk_buff *, enum htc_endpoint_id, bool txok); ··· 108 122 #define HTC_MAX_CONTROL_MESSAGE_LENGTH 255 109 123 #define HTC_CONTROL_BUFFER_SIZE \ 110 124 (HTC_MAX_CONTROL_MESSAGE_LENGTH + sizeof(struct htc_frame_hdr)) 111 - 112 - struct htc_control_buf { 113 - struct htc_packet htc_pkt; 114 - u8 buf[HTC_CONTROL_BUFFER_SIZE]; 115 - }; 116 125 117 126 #define HTC_OP_START_WAIT BIT(0) 118 127 #define HTC_OP_CONFIG_PIPE_CREDITS BIT(1)
+9 -3
drivers/net/wireless/ath/ath9k/hw.c
··· 1925 1925 pCap->num_antcfg_2ghz = 1926 1926 ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ); 1927 1927 1928 - if (AR_SREV_9280_20_OR_LATER(ah) && 1929 - ath9k_hw_btcoex_supported(ah)) { 1928 + if (AR_SREV_9280_20_OR_LATER(ah) && common->btcoex_enabled) { 1930 1929 btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO; 1931 1930 btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO; 1932 1931 ··· 1974 1975 if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1)) 1975 1976 pCap->hw_caps |= ATH9K_HW_CAP_ANT_DIV_COMB; 1976 1977 } 1978 + if (AR_SREV_9300_20_OR_LATER(ah)) { 1979 + if (ah->eep_ops->get_eeprom(ah, EEP_CHAIN_MASK_REDUCE)) 1980 + pCap->hw_caps |= ATH9K_HW_CAP_APM; 1981 + } 1982 + 1983 + 1977 1984 1978 1985 return 0; 1979 1986 } ··· 2051 2046 val = REG_READ(ah, AR7010_GPIO_IN); 2052 2047 return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; 2053 2048 } else if (AR_SREV_9300_20_OR_LATER(ah)) 2054 - return MS_REG_READ(AR9300, gpio) != 0; 2049 + return (MS(REG_READ(ah, AR_GPIO_IN), AR9300_GPIO_IN_VAL) & 2050 + AR_GPIO_BIT(gpio)) != 0; 2055 2051 else if (AR_SREV_9271(ah)) 2056 2052 return MS_REG_READ(AR9271, gpio) != 0; 2057 2053 else if (AR_SREV_9287_11_OR_LATER(ah))
+1
drivers/net/wireless/ath/ath9k/hw.h
··· 187 187 ATH9K_HW_CAP_ANT_DIV_COMB = BIT(12), 188 188 ATH9K_HW_CAP_2GHZ = BIT(13), 189 189 ATH9K_HW_CAP_5GHZ = BIT(14), 190 + ATH9K_HW_CAP_APM = BIT(15), 190 191 }; 191 192 192 193 struct ath9k_hw_capabilities {
+17 -27
drivers/net/wireless/ath/ath9k/init.c
··· 15 15 */ 16 16 17 17 #include <linux/slab.h> 18 - #include <linux/pm_qos_params.h> 19 18 20 19 #include "ath9k.h" 21 20 ··· 36 37 int led_blink; 37 38 module_param_named(blink, led_blink, int, 0444); 38 39 MODULE_PARM_DESC(blink, "Enable LED blink on activity"); 40 + 41 + static int ath9k_btcoex_enable; 42 + module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444); 43 + MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); 39 44 40 45 /* We use the hw_value as an index into our private channel structure */ 41 46 ··· 182 179 .read = ath9k_ioread32, 183 180 .write = ath9k_iowrite32, 184 181 }; 185 - 186 - struct pm_qos_request_list ath9k_pm_qos_req; 187 182 188 183 /**************************/ 189 184 /* Initialization */ ··· 544 543 common->hw = sc->hw; 545 544 common->priv = sc; 546 545 common->debug_mask = ath9k_debug; 546 + common->btcoex_enabled = ath9k_btcoex_enable == 1; 547 547 spin_lock_init(&common->cc_lock); 548 548 549 549 spin_lock_init(&sc->wiphy_lock); ··· 566 564 ret = ath9k_hw_init(ah); 567 565 if (ret) 568 566 goto err_hw; 569 - 570 - ret = ath9k_init_debug(ah); 571 - if (ret) { 572 - ath_print(common, ATH_DBG_FATAL, 573 - "Unable to create debugfs files\n"); 574 - goto err_debug; 575 - } 576 567 577 568 ret = ath9k_init_queues(sc); 578 569 if (ret) ··· 589 594 if (ATH_TXQ_SETUP(sc, i)) 590 595 ath_tx_cleanupq(sc, &sc->tx.txq[i]); 591 596 err_queues: 592 - ath9k_exit_debug(ah); 593 - err_debug: 594 597 ath9k_hw_deinit(ah); 595 598 err_hw: 596 599 tasklet_kill(&sc->intr_tq); ··· 650 657 hw->flags |= IEEE80211_HW_MFP_CAPABLE; 651 658 652 659 hw->wiphy->interface_modes = 660 + BIT(NL80211_IFTYPE_P2P_GO) | 661 + BIT(NL80211_IFTYPE_P2P_CLIENT) | 653 662 BIT(NL80211_IFTYPE_AP) | 654 663 BIT(NL80211_IFTYPE_WDS) | 655 664 BIT(NL80211_IFTYPE_STATION) | ··· 734 739 if (error) 735 740 goto error_register; 736 741 742 + error = ath9k_init_debug(ah); 743 + if (error) { 744 + ath_print(common, ATH_DBG_FATAL, 745 + "Unable to create debugfs files\n"); 746 + goto error_world; 747 + } 748 + 737 749 /* Handle world regulatory */ 738 750 if (!ath_is_world_regd(reg)) { 739 751 error = regulatory_hint(hw->wiphy, reg->alpha2); ··· 758 756 ath_init_leds(sc); 759 757 ath_start_rfkill_poll(sc); 760 758 761 - pm_qos_add_request(&ath9k_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 759 + pm_qos_add_request(&sc->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 762 760 PM_QOS_DEFAULT_VALUE); 763 761 764 762 return 0; ··· 799 797 if (ATH_TXQ_SETUP(sc, i)) 800 798 ath_tx_cleanupq(sc, &sc->tx.txq[i]); 801 799 802 - ath9k_exit_debug(sc->sc_ah); 803 800 ath9k_hw_deinit(sc->sc_ah); 804 801 805 802 tasklet_kill(&sc->intr_tq); ··· 828 827 } 829 828 830 829 ieee80211_unregister_hw(hw); 831 - pm_qos_remove_request(&ath9k_pm_qos_req); 830 + pm_qos_remove_request(&sc->pm_qos_req); 832 831 ath_rx_cleanup(sc); 833 832 ath_tx_cleanup(sc); 834 833 ath9k_deinit_softc(sc); ··· 865 864 goto err_out; 866 865 } 867 866 868 - error = ath9k_debug_create_root(); 869 - if (error) { 870 - printk(KERN_ERR 871 - "ath9k: Unable to create debugfs root: %d\n", 872 - error); 873 - goto err_rate_unregister; 874 - } 875 - 876 867 error = ath_pci_init(); 877 868 if (error < 0) { 878 869 printk(KERN_ERR 879 870 "ath9k: No PCI devices found, driver not installed.\n"); 880 871 error = -ENODEV; 881 - goto err_remove_root; 872 + goto err_rate_unregister; 882 873 } 883 874 884 875 error = ath_ahb_init(); ··· 884 891 err_pci_exit: 885 892 ath_pci_exit(); 886 893 887 - err_remove_root: 888 - ath9k_debug_remove_root(); 889 894 err_rate_unregister: 890 895 ath_rate_control_unregister(); 891 896 err_out: ··· 895 904 { 896 905 ath_ahb_exit(); 897 906 ath_pci_exit(); 898 - ath9k_debug_remove_root(); 899 907 ath_rate_control_unregister(); 900 908 printk(KERN_INFO "%s: Driver unloaded\n", dev_info); 901 909 }
+16 -5
drivers/net/wireless/ath/ath9k/main.c
··· 15 15 */ 16 16 17 17 #include <linux/nl80211.h> 18 - #include <linux/pm_qos_params.h> 19 18 #include "ath9k.h" 20 19 #include "btcoex.h" 21 20 ··· 553 554 static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta) 554 555 { 555 556 struct ath_node *an; 556 - 557 + struct ath_hw *ah = sc->sc_ah; 557 558 an = (struct ath_node *)sta->drv_priv; 559 + 560 + if ((ah->caps.hw_caps) & ATH9K_HW_CAP_APM) 561 + sc->sc_flags |= SC_OP_ENABLE_APM; 558 562 559 563 if (sc->sc_flags & SC_OP_TXAGGR) { 560 564 ath_tx_node_init(sc, an); ··· 1186 1184 ath9k_btcoex_timer_resume(sc); 1187 1185 } 1188 1186 1189 - pm_qos_update_request(&ath9k_pm_qos_req, 55); 1187 + pm_qos_update_request(&sc->pm_qos_req, 55); 1190 1188 1191 1189 mutex_unlock: 1192 1190 mutex_unlock(&sc->mutex); ··· 1341 1339 1342 1340 sc->sc_flags |= SC_OP_INVALID; 1343 1341 1344 - pm_qos_update_request(&ath9k_pm_qos_req, PM_QOS_DEFAULT_VALUE); 1342 + pm_qos_update_request(&sc->pm_qos_req, PM_QOS_DEFAULT_VALUE); 1345 1343 1346 1344 mutex_unlock(&sc->mutex); 1347 1345 ··· 1438 1436 struct ath_softc *sc = aphy->sc; 1439 1437 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1440 1438 struct ath_vif *avp = (void *)vif->drv_priv; 1439 + bool bs_valid = false; 1441 1440 int i; 1442 1441 1443 1442 ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); ··· 1467 1464 "slot\n", __func__); 1468 1465 sc->beacon.bslot[i] = NULL; 1469 1466 sc->beacon.bslot_aphy[i] = NULL; 1470 - } 1467 + } else if (sc->beacon.bslot[i]) 1468 + bs_valid = true; 1469 + } 1470 + if (!bs_valid && (sc->sc_ah->imask & ATH9K_INT_SWBA)) { 1471 + /* Disable SWBA interrupt */ 1472 + sc->sc_ah->imask &= ~ATH9K_INT_SWBA; 1473 + ath9k_ps_wakeup(sc); 1474 + ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask); 1475 + ath9k_ps_restore(sc); 1471 1476 } 1472 1477 1473 1478 sc->nvifs--;
+4 -2
drivers/net/wireless/ath/ath9k/reg.h
··· 976 976 #define AR9287_GPIO_IN_VAL_S 11 977 977 #define AR9271_GPIO_IN_VAL 0xFFFF0000 978 978 #define AR9271_GPIO_IN_VAL_S 16 979 - #define AR9300_GPIO_IN_VAL 0x0001FFFF 980 - #define AR9300_GPIO_IN_VAL_S 0 981 979 #define AR7010_GPIO_IN_VAL 0x0000FFFF 982 980 #define AR7010_GPIO_IN_VAL_S 0 981 + 982 + #define AR_GPIO_IN 0x404c 983 + #define AR9300_GPIO_IN_VAL 0x0001FFFF 984 + #define AR9300_GPIO_IN_VAL_S 0 983 985 984 986 #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) 985 987 #define AR_GPIO_OE_OUT_DRV 0x3
+23 -4
drivers/net/wireless/ath/ath9k/xmit.c
··· 250 250 static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq, 251 251 struct sk_buff *skb) 252 252 { 253 - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 253 + struct ath_frame_info *fi = get_frame_info(skb); 254 254 struct ieee80211_hdr *hdr; 255 255 256 256 TX_STAT_INC(txq->axq_qnum, a_retries); 257 - if (tx_info->control.rates[4].count++ > 0) 257 + if (fi->retries++ > 0) 258 258 return; 259 259 260 260 hdr = (struct ieee80211_hdr *)skb->data; ··· 1506 1506 return duration; 1507 1507 } 1508 1508 1509 + u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) 1510 + { 1511 + struct ath_hw *ah = sc->sc_ah; 1512 + struct ath9k_channel *curchan = ah->curchan; 1513 + if ((sc->sc_flags & SC_OP_ENABLE_APM) && 1514 + (curchan->channelFlags & CHANNEL_5GHZ) && 1515 + (chainmask == 0x7) && (rate < 0x90)) 1516 + return 0x3; 1517 + else 1518 + return chainmask; 1519 + } 1520 + 1509 1521 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len) 1510 1522 { 1511 1523 struct ath_common *common = ath9k_hw_common(sc->sc_ah); ··· 1558 1546 1559 1547 rix = rates[i].idx; 1560 1548 series[i].Tries = rates[i].count; 1561 - series[i].ChSel = common->tx_chainmask; 1562 1549 1563 1550 if ((sc->config.ath_aggr_prot && bf_isaggr(bf)) || 1564 1551 (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS)) { ··· 1580 1569 if (rates[i].flags & IEEE80211_TX_RC_MCS) { 1581 1570 /* MCS rates */ 1582 1571 series[i].Rate = rix | 0x80; 1572 + series[i].ChSel = ath_txchainmask_reduction(sc, 1573 + common->tx_chainmask, series[i].Rate); 1583 1574 series[i].PktDuration = ath_pkt_duration(sc, rix, len, 1584 1575 is_40, is_sgi, is_sp); 1585 1576 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC)) ··· 1589 1576 continue; 1590 1577 } 1591 1578 1592 - /* legcay rates */ 1579 + /* legacy rates */ 1593 1580 if ((tx_info->band == IEEE80211_BAND_2GHZ) && 1594 1581 !(rate->flags & IEEE80211_RATE_ERP_G)) 1595 1582 phy = WLAN_RC_PHY_CCK; ··· 1604 1591 } else { 1605 1592 is_sp = false; 1606 1593 } 1594 + 1595 + if (bf->bf_state.bfs_paprd) 1596 + series[i].ChSel = common->tx_chainmask; 1597 + else 1598 + series[i].ChSel = ath_txchainmask_reduction(sc, 1599 + common->tx_chainmask, series[i].Rate); 1607 1600 1608 1601 series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah, 1609 1602 phy, rate->bitrate * 100, len, rix, is_sp);
+2 -1
drivers/net/wireless/ath/carl9170/fw.c
··· 291 291 292 292 if (SUPP(CARL9170FW_WLANTX_CAB)) { 293 293 ar->hw->wiphy->interface_modes |= 294 - BIT(NL80211_IFTYPE_AP); 294 + BIT(NL80211_IFTYPE_AP) | 295 + BIT(NL80211_IFTYPE_P2P_GO); 295 296 } 296 297 } 297 298
+2 -1
drivers/net/wireless/ath/carl9170/main.c
··· 1648 1648 * supports these modes. The code which will add the 1649 1649 * additional interface_modes is in fw.c. 1650 1650 */ 1651 - hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 1651 + hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | 1652 + BIT(NL80211_IFTYPE_P2P_CLIENT); 1652 1653 1653 1654 hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS | 1654 1655 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
+1 -1
drivers/net/wireless/ath/carl9170/tx.c
··· 867 867 868 868 mac_tmp = cpu_to_le16(AR9170_TX_MAC_HW_DURATION | 869 869 AR9170_TX_MAC_BACKOFF); 870 - mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) && 870 + mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) & 871 871 AR9170_TX_MAC_QOS); 872 872 873 873 no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK);
+1 -2
drivers/net/wireless/ath/carl9170/usb.c
··· 160 160 161 161 static void carl9170_usb_tx_data_complete(struct urb *urb) 162 162 { 163 - struct ar9170 *ar = (struct ar9170 *) 164 - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 163 + struct ar9170 *ar = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 165 164 166 165 if (WARN_ON_ONCE(!ar)) { 167 166 dev_kfree_skb_irq(urb->context);
+241 -64
drivers/net/wireless/b43/phy_n.c
··· 67 67 B43_RFSEQ_UPDATE_GAINU, 68 68 }; 69 69 70 + enum b43_nphy_rssi_type { 71 + B43_NPHY_RSSI_X = 0, 72 + B43_NPHY_RSSI_Y, 73 + B43_NPHY_RSSI_Z, 74 + B43_NPHY_RSSI_PWRDET, 75 + B43_NPHY_RSSI_TSSI_I, 76 + B43_NPHY_RSSI_TSSI_Q, 77 + B43_NPHY_RSSI_TBD, 78 + }; 79 + 80 + static void b43_nphy_stay_in_carrier_search(struct b43_wldev *dev, 81 + bool enable); 70 82 static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd, 71 83 u8 *events, u8 *delays, u8 length); 72 84 static void b43_nphy_force_rf_sequence(struct b43_wldev *dev, ··· 157 145 b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6); 158 146 } 159 147 148 + /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlEnable */ 149 + static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable) 150 + { 151 + struct b43_phy_n *nphy = dev->phy.n; 152 + u8 i; 153 + u16 tmp; 154 + 155 + if (nphy->hang_avoid) 156 + b43_nphy_stay_in_carrier_search(dev, 1); 157 + 158 + nphy->txpwrctrl = enable; 159 + if (!enable) { 160 + if (dev->phy.rev >= 3) 161 + ; /* TODO */ 162 + 163 + b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x6840); 164 + for (i = 0; i < 84; i++) 165 + b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0); 166 + 167 + b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x6C40); 168 + for (i = 0; i < 84; i++) 169 + b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0); 170 + 171 + tmp = B43_NPHY_TXPCTL_CMD_COEFF | B43_NPHY_TXPCTL_CMD_HWPCTLEN; 172 + if (dev->phy.rev >= 3) 173 + tmp |= B43_NPHY_TXPCTL_CMD_PCTLEN; 174 + b43_phy_mask(dev, B43_NPHY_TXPCTL_CMD, ~tmp); 175 + 176 + if (dev->phy.rev >= 3) { 177 + b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x0100); 178 + b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0100); 179 + } else { 180 + b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x4000); 181 + } 182 + 183 + if (dev->phy.rev == 2) 184 + b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3, 185 + ~B43_NPHY_BPHY_CTL3_SCALE, 0x53); 186 + else if (dev->phy.rev < 2) 187 + b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3, 188 + ~B43_NPHY_BPHY_CTL3_SCALE, 0x5A); 189 + 190 + if (dev->phy.rev < 2 && 0) 191 + ; /* TODO */ 192 + } else { 193 + b43err(dev->wl, "enabling tx pwr ctrl not implemented yet\n"); 194 + } 195 + 196 + if (nphy->hang_avoid) 197 + b43_nphy_stay_in_carrier_search(dev, 0); 198 + } 199 + 200 + /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */ 160 201 static void b43_nphy_tx_power_fix(struct b43_wldev *dev) 161 202 { 162 - //TODO 203 + struct b43_phy_n *nphy = dev->phy.n; 204 + struct ssb_sprom *sprom = &(dev->dev->bus->sprom); 205 + 206 + u8 txpi[2], bbmult, i; 207 + u16 tmp, radio_gain, dac_gain; 208 + u16 freq = dev->phy.channel_freq; 209 + u32 txgain; 210 + /* u32 gaintbl; rev3+ */ 211 + 212 + if (nphy->hang_avoid) 213 + b43_nphy_stay_in_carrier_search(dev, 1); 214 + 215 + if (dev->phy.rev >= 3) { 216 + txpi[0] = 40; 217 + txpi[1] = 40; 218 + } else if (sprom->revision < 4) { 219 + txpi[0] = 72; 220 + txpi[1] = 72; 221 + } else { 222 + if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 223 + txpi[0] = sprom->txpid2g[0]; 224 + txpi[1] = sprom->txpid2g[1]; 225 + } else if (freq >= 4900 && freq < 5100) { 226 + txpi[0] = sprom->txpid5gl[0]; 227 + txpi[1] = sprom->txpid5gl[1]; 228 + } else if (freq >= 5100 && freq < 5500) { 229 + txpi[0] = sprom->txpid5g[0]; 230 + txpi[1] = sprom->txpid5g[1]; 231 + } else if (freq >= 5500) { 232 + txpi[0] = sprom->txpid5gh[0]; 233 + txpi[1] = sprom->txpid5gh[1]; 234 + } else { 235 + txpi[0] = 91; 236 + txpi[1] = 91; 237 + } 238 + } 239 + 240 + /* 241 + for (i = 0; i < 2; i++) { 242 + nphy->txpwrindex[i].index_internal = txpi[i]; 243 + nphy->txpwrindex[i].index_internal_save = txpi[i]; 244 + } 245 + */ 246 + 247 + for (i = 0; i < 2; i++) { 248 + if (dev->phy.rev >= 3) { 249 + /* TODO */ 250 + radio_gain = (txgain >> 16) & 0x1FFFF; 251 + } else { 252 + txgain = b43_ntab_tx_gain_rev0_1_2[txpi[i]]; 253 + radio_gain = (txgain >> 16) & 0x1FFF; 254 + } 255 + 256 + dac_gain = (txgain >> 8) & 0x3F; 257 + bbmult = txgain & 0xFF; 258 + 259 + if (dev->phy.rev >= 3) { 260 + if (i == 0) 261 + b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x0100); 262 + else 263 + b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0100); 264 + } else { 265 + b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x4000); 266 + } 267 + 268 + if (i == 0) 269 + b43_phy_write(dev, B43_NPHY_AFECTL_DACGAIN1, dac_gain); 270 + else 271 + b43_phy_write(dev, B43_NPHY_AFECTL_DACGAIN2, dac_gain); 272 + 273 + b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x1D10 + i); 274 + b43_phy_write(dev, B43_NPHY_TABLE_DATALO, radio_gain); 275 + 276 + b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x3C57); 277 + tmp = b43_phy_read(dev, B43_NPHY_TABLE_DATALO); 278 + 279 + if (i == 0) 280 + tmp = (tmp & 0x00FF) | (bbmult << 8); 281 + else 282 + tmp = (tmp & 0xFF00) | bbmult; 283 + 284 + b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x3C57); 285 + b43_phy_write(dev, B43_NPHY_TABLE_DATALO, tmp); 286 + 287 + if (0) 288 + ; /* TODO */ 289 + } 290 + 291 + b43_phy_mask(dev, B43_NPHY_BPHY_CTL2, ~B43_NPHY_BPHY_CTL2_LUT); 292 + 293 + if (nphy->hang_avoid) 294 + b43_nphy_stay_in_carrier_search(dev, 0); 163 295 } 164 296 165 297 ··· 1749 1593 1750 1594 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */ 1751 1595 static void b43_nphy_scale_offset_rssi(struct b43_wldev *dev, u16 scale, 1752 - s8 offset, u8 core, u8 rail, u8 type) 1596 + s8 offset, u8 core, u8 rail, 1597 + enum b43_nphy_rssi_type type) 1753 1598 { 1754 1599 u16 tmp; 1755 1600 bool core1or5 = (core == 1) || (core == 5); ··· 1759 1602 offset = clamp_val(offset, -32, 31); 1760 1603 tmp = ((scale & 0x3F) << 8) | (offset & 0x3F); 1761 1604 1762 - if (core1or5 && (rail == 0) && (type == 2)) 1605 + if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_Z)) 1763 1606 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Z, tmp); 1764 - if (core1or5 && (rail == 1) && (type == 2)) 1607 + if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_Z)) 1765 1608 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Z, tmp); 1766 - if (core2or5 && (rail == 0) && (type == 2)) 1609 + if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_Z)) 1767 1610 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Z, tmp); 1768 - if (core2or5 && (rail == 1) && (type == 2)) 1611 + if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_Z)) 1769 1612 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Z, tmp); 1770 - if (core1or5 && (rail == 0) && (type == 0)) 1613 + 1614 + if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_X)) 1771 1615 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_X, tmp); 1772 - if (core1or5 && (rail == 1) && (type == 0)) 1616 + if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_X)) 1773 1617 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_X, tmp); 1774 - if (core2or5 && (rail == 0) && (type == 0)) 1618 + if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_X)) 1775 1619 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_X, tmp); 1776 - if (core2or5 && (rail == 1) && (type == 0)) 1620 + if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_X)) 1777 1621 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_X, tmp); 1778 - if (core1or5 && (rail == 0) && (type == 1)) 1622 + 1623 + if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_Y)) 1779 1624 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Y, tmp); 1780 - if (core1or5 && (rail == 1) && (type == 1)) 1625 + if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_Y)) 1781 1626 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Y, tmp); 1782 - if (core2or5 && (rail == 0) && (type == 1)) 1627 + if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_Y)) 1783 1628 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Y, tmp); 1784 - if (core2or5 && (rail == 1) && (type == 1)) 1629 + if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_Y)) 1785 1630 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y, tmp); 1786 - if (core1or5 && (rail == 0) && (type == 6)) 1631 + 1632 + if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_TBD)) 1787 1633 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_TBD, tmp); 1788 - if (core1or5 && (rail == 1) && (type == 6)) 1634 + if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_TBD)) 1789 1635 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_TBD, tmp); 1790 - if (core2or5 && (rail == 0) && (type == 6)) 1636 + if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_TBD)) 1791 1637 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_TBD, tmp); 1792 - if (core2or5 && (rail == 1) && (type == 6)) 1638 + if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_TBD)) 1793 1639 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_TBD, tmp); 1794 - if (core1or5 && (rail == 0) && (type == 3)) 1640 + 1641 + if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_PWRDET)) 1795 1642 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_PWRDET, tmp); 1796 - if (core1or5 && (rail == 1) && (type == 3)) 1643 + if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_PWRDET)) 1797 1644 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_PWRDET, tmp); 1798 - if (core2or5 && (rail == 0) && (type == 3)) 1645 + if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_PWRDET)) 1799 1646 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_PWRDET, tmp); 1800 - if (core2or5 && (rail == 1) && (type == 3)) 1647 + if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_PWRDET)) 1801 1648 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_PWRDET, tmp); 1802 - if (core1or5 && (type == 4)) 1649 + 1650 + if (core1or5 && (type == B43_NPHY_RSSI_TSSI_I)) 1803 1651 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_TSSI, tmp); 1804 - if (core2or5 && (type == 4)) 1652 + if (core2or5 && (type == B43_NPHY_RSSI_TSSI_I)) 1805 1653 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_TSSI, tmp); 1806 - if (core1or5 && (type == 5)) 1654 + 1655 + if (core1or5 && (type == B43_NPHY_RSSI_TSSI_Q)) 1807 1656 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_TSSI, tmp); 1808 - if (core2or5 && (type == 5)) 1657 + if (core2or5 && (type == B43_NPHY_RSSI_TSSI_Q)) 1809 1658 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_TSSI, tmp); 1810 1659 } 1811 1660 ··· 1839 1676 (type + 1) << 4); 1840 1677 } 1841 1678 1842 - /* TODO use some definitions */ 1843 1679 if (code == 0) { 1844 - b43_phy_maskset(dev, B43_NPHY_AFECTL_OVER, 0xCFFF, 0); 1680 + b43_phy_mask(dev, B43_NPHY_AFECTL_OVER, ~0x3000); 1845 1681 if (type < 3) { 1846 - b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFEC7, 0); 1847 - b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xEFDC, 0); 1848 - b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFFFE, 0); 1682 + b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, 1683 + ~(B43_NPHY_RFCTL_CMD_RXEN | 1684 + B43_NPHY_RFCTL_CMD_CORESEL)); 1685 + b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, 1686 + ~(0x1 << 12 | 1687 + 0x1 << 5 | 1688 + 0x1 << 1 | 1689 + 0x1)); 1690 + b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, 1691 + ~B43_NPHY_RFCTL_CMD_START); 1849 1692 udelay(20); 1850 - b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xFFFE, 0); 1693 + b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1); 1851 1694 } 1852 1695 } else { 1853 - b43_phy_maskset(dev, B43_NPHY_AFECTL_OVER, 0xCFFF, 1854 - 0x3000); 1696 + b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x3000); 1855 1697 if (type < 3) { 1856 1698 b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 1857 - 0xFEC7, 0x0180); 1858 - b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 1859 - 0xEFDC, (code << 1 | 0x1021)); 1860 - b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFFFE, 0x1); 1699 + ~(B43_NPHY_RFCTL_CMD_RXEN | 1700 + B43_NPHY_RFCTL_CMD_CORESEL), 1701 + (B43_NPHY_RFCTL_CMD_RXEN | 1702 + code << B43_NPHY_RFCTL_CMD_CORESEL_SHIFT)); 1703 + b43_phy_set(dev, B43_NPHY_RFCTL_OVER, 1704 + (0x1 << 12 | 1705 + 0x1 << 5 | 1706 + 0x1 << 1 | 1707 + 0x1)); 1708 + b43_phy_set(dev, B43_NPHY_RFCTL_CMD, 1709 + B43_NPHY_RFCTL_CMD_START); 1861 1710 udelay(20); 1862 - b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xFFFE, 0); 1711 + b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1); 1863 1712 } 1864 1713 } 1865 1714 } ··· 2093 1918 u16 class, override; 2094 1919 u8 regs_save_radio[2]; 2095 1920 u16 regs_save_phy[2]; 1921 + 2096 1922 s8 offset[4]; 1923 + u8 core; 1924 + u8 rail; 2097 1925 2098 1926 u16 clip_state[2]; 2099 1927 u16 clip_off[2] = { 0xFFFF, 0xFFFF }; ··· 2197 2019 if (results_min[i] == 248) 2198 2020 offset[i] = code - 32; 2199 2021 2200 - if (i % 2 == 0) 2201 - b43_nphy_scale_offset_rssi(dev, 0, offset[i], 1, 0, 2202 - type); 2203 - else 2204 - b43_nphy_scale_offset_rssi(dev, 0, offset[i], 2, 1, 2205 - type); 2022 + core = (i / 2) ? 2 : 1; 2023 + rail = (i % 2) ? 1 : 0; 2024 + 2025 + b43_nphy_scale_offset_rssi(dev, 0, offset[i], core, rail, 2026 + type); 2206 2027 } 2207 2028 2208 2029 b43_radio_maskset(dev, B2055_C1_PD_RSSIMISC, 0xF8, state[0]); ··· 2243 2066 2244 2067 b43_nphy_classifier(dev, 7, class); 2245 2068 b43_nphy_write_clip_detection(dev, clip_state); 2069 + /* Specs don't say about reset here, but it makes wl and b43 dumps 2070 + identical, it really seems wl performs this */ 2071 + b43_nphy_reset_cca(dev); 2246 2072 } 2247 2073 2248 2074 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */ ··· 2263 2083 if (dev->phy.rev >= 3) { 2264 2084 b43_nphy_rev3_rssi_cal(dev); 2265 2085 } else { 2266 - b43_nphy_rev2_rssi_cal(dev, 2); 2267 - b43_nphy_rev2_rssi_cal(dev, 0); 2268 - b43_nphy_rev2_rssi_cal(dev, 1); 2086 + b43_nphy_rev2_rssi_cal(dev, B43_NPHY_RSSI_Z); 2087 + b43_nphy_rev2_rssi_cal(dev, B43_NPHY_RSSI_X); 2088 + b43_nphy_rev2_rssi_cal(dev, B43_NPHY_RSSI_Y); 2269 2089 } 2270 2090 } 2271 2091 ··· 2531 2351 struct nphy_txgains target; 2532 2352 const u32 *table = NULL; 2533 2353 2534 - if (nphy->txpwrctrl == 0) { 2354 + if (!nphy->txpwrctrl) { 2535 2355 int i; 2536 2356 2537 2357 if (nphy->hang_avoid) ··· 3440 3260 b43_nphy_bphy_init(dev); 3441 3261 3442 3262 tx_pwr_state = nphy->txpwrctrl; 3443 - /* TODO N PHY TX power control with argument 0 3444 - (turning off power control) */ 3445 - /* TODO Fix the TX Power Settings */ 3263 + b43_nphy_tx_power_ctrl(dev, false); 3264 + b43_nphy_tx_power_fix(dev); 3446 3265 /* TODO N PHY TX Power Control Idle TSSI */ 3447 3266 /* TODO N PHY TX Power Control Setup */ 3448 3267 ··· 3498 3319 /* TODO N PHY Pre Calibrate TX Gain */ 3499 3320 target = b43_nphy_get_tx_gains(dev); 3500 3321 } 3501 - } 3322 + if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false)) 3323 + if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0) 3324 + b43_nphy_save_cal(dev); 3325 + } else if (nphy->mphase_cal_phase_id == 0) 3326 + ;/* N PHY Periodic Calibration with arg 3 */ 3327 + } else { 3328 + b43_nphy_restore_cal(dev); 3502 3329 } 3503 3330 } 3504 3331 3505 - if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false)) { 3506 - if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0) 3507 - b43_nphy_save_cal(dev); 3508 - else if (nphy->mphase_cal_phase_id == 0) 3509 - ;/* N PHY Periodic Calibration with argument 3 */ 3510 - } else { 3511 - b43_nphy_restore_cal(dev); 3512 - } 3513 - 3514 3332 b43_nphy_tx_pwr_ctrl_coef_setup(dev); 3515 - /* TODO N PHY TX Power Control Enable with argument tx_pwr_state */ 3333 + b43_nphy_tx_power_ctrl(dev, tx_pwr_state); 3516 3334 b43_phy_write(dev, B43_NPHY_TXMACIF_HOLDOFF, 0x0015); 3517 3335 b43_phy_write(dev, B43_NPHY_TXMACDELAY, 0x0320); 3518 3336 if (phy->rev >= 3 && phy->rev <= 6) ··· 3560 3384 b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840); 3561 3385 } 3562 3386 3563 - if (nphy->txpwrctrl) 3387 + if (!nphy->txpwrctrl) 3564 3388 b43_nphy_tx_power_fix(dev); 3565 3389 3566 3390 if (dev->phy.rev < 3) ··· 3656 3480 nphy->gain_boost = true; /* this way we follow wl, assume it is true */ 3657 3481 nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ 3658 3482 nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ 3483 + nphy->perical = 2; /* avoid additional rssi cal on init (like wl) */ 3659 3484 } 3660 3485 3661 3486 static void b43_nphy_op_free(struct b43_wldev *dev)
+1 -1
drivers/net/wireless/b43/phy_n.h
··· 782 782 u16 mphase_txcal_numcmds; 783 783 u16 mphase_txcal_bestcoeffs[11]; 784 784 785 - u8 txpwrctrl; 785 + bool txpwrctrl; 786 786 u16 txcal_bbmult; 787 787 u16 txiqlocal_bestc[11]; 788 788 bool txiqlocal_coeffsvalid;
+123 -123
drivers/net/wireless/b43/radio_2055.c
··· 304 304 { .channel = 184, 305 305 .freq = 4920, /* MHz */ 306 306 .unk2 = 3280, 307 - RADIOREGS(0x71, 0x01, 0xEC, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 307 + RADIOREGS(0x71, 0xEC, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 308 308 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, 309 309 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 310 310 PHYREGS(0x07B4, 0x07B0, 0x07AC, 0x0214, 0x0215, 0x0216), ··· 312 312 { .channel = 186, 313 313 .freq = 4930, /* MHz */ 314 314 .unk2 = 3287, 315 - RADIOREGS(0x71, 0x01, 0xED, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 315 + RADIOREGS(0x71, 0xED, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 316 316 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, 317 317 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 318 318 PHYREGS(0x07B8, 0x07B4, 0x07B0, 0x0213, 0x0214, 0x0215), ··· 320 320 { .channel = 188, 321 321 .freq = 4940, /* MHz */ 322 322 .unk2 = 3293, 323 - RADIOREGS(0x71, 0x01, 0xEE, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 323 + RADIOREGS(0x71, 0xEE, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 324 324 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 325 325 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 326 326 PHYREGS(0x07BC, 0x07B8, 0x07B4, 0x0212, 0x0213, 0x0214), ··· 328 328 { .channel = 190, 329 329 .freq = 4950, /* MHz */ 330 330 .unk2 = 3300, 331 - RADIOREGS(0x71, 0x01, 0xEF, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 331 + RADIOREGS(0x71, 0xEF, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 332 332 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 333 333 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 334 334 PHYREGS(0x07C0, 0x07BC, 0x07B8, 0x0211, 0x0212, 0x0213), ··· 336 336 { .channel = 192, 337 337 .freq = 4960, /* MHz */ 338 338 .unk2 = 3307, 339 - RADIOREGS(0x71, 0x01, 0xF0, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 339 + RADIOREGS(0x71, 0xF0, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 340 340 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 341 341 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 342 342 PHYREGS(0x07C4, 0x07C0, 0x07BC, 0x020F, 0x0211, 0x0212), ··· 344 344 { .channel = 194, 345 345 .freq = 4970, /* MHz */ 346 346 .unk2 = 3313, 347 - RADIOREGS(0x71, 0x01, 0xF1, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 347 + RADIOREGS(0x71, 0xF1, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 348 348 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 349 349 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 350 350 PHYREGS(0x07C8, 0x07C4, 0x07C0, 0x020E, 0x020F, 0x0211), ··· 352 352 { .channel = 196, 353 353 .freq = 4980, /* MHz */ 354 354 .unk2 = 3320, 355 - RADIOREGS(0x71, 0x01, 0xF2, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 355 + RADIOREGS(0x71, 0xF2, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 356 356 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 357 357 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 358 358 PHYREGS(0x07CC, 0x07C8, 0x07C4, 0x020D, 0x020E, 0x020F), ··· 360 360 { .channel = 198, 361 361 .freq = 4990, /* MHz */ 362 362 .unk2 = 3327, 363 - RADIOREGS(0x71, 0x01, 0xF3, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 363 + RADIOREGS(0x71, 0xF3, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 364 364 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 365 365 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 366 366 PHYREGS(0x07D0, 0x07CC, 0x07C8, 0x020C, 0x020D, 0x020E), ··· 368 368 { .channel = 200, 369 369 .freq = 5000, /* MHz */ 370 370 .unk2 = 3333, 371 - RADIOREGS(0x71, 0x01, 0xF4, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 371 + RADIOREGS(0x71, 0xF4, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 372 372 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 373 373 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 374 374 PHYREGS(0x07D4, 0x07D0, 0x07CC, 0x020B, 0x020C, 0x020D), ··· 376 376 { .channel = 202, 377 377 .freq = 5010, /* MHz */ 378 378 .unk2 = 3340, 379 - RADIOREGS(0x71, 0x01, 0xF5, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 379 + RADIOREGS(0x71, 0xF5, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 380 380 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 381 381 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 382 382 PHYREGS(0x07D8, 0x07D4, 0x07D0, 0x020A, 0x020B, 0x020C), ··· 384 384 { .channel = 204, 385 385 .freq = 5020, /* MHz */ 386 386 .unk2 = 3347, 387 - RADIOREGS(0x71, 0x01, 0xF6, 0x0E, 0xF7, 0x01, 0x04, 0x0A, 387 + RADIOREGS(0x71, 0xF6, 0x01, 0x0E, 0xF7, 0x01, 0x04, 0x0A, 388 388 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 389 389 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 390 390 PHYREGS(0x07DC, 0x07D8, 0x07D4, 0x0209, 0x020A, 0x020B), ··· 392 392 { .channel = 206, 393 393 .freq = 5030, /* MHz */ 394 394 .unk2 = 3353, 395 - RADIOREGS(0x71, 0x01, 0xF7, 0x0E, 0xF7, 0x01, 0x04, 0x0A, 395 + RADIOREGS(0x71, 0xF7, 0x01, 0x0E, 0xF7, 0x01, 0x04, 0x0A, 396 396 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 397 397 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 398 398 PHYREGS(0x07E0, 0x07DC, 0x07D8, 0x0208, 0x0209, 0x020A), ··· 400 400 { .channel = 208, 401 401 .freq = 5040, /* MHz */ 402 402 .unk2 = 3360, 403 - RADIOREGS(0x71, 0x01, 0xF8, 0x0D, 0xEF, 0x01, 0x04, 0x0A, 403 + RADIOREGS(0x71, 0xF8, 0x01, 0x0D, 0xEF, 0x01, 0x04, 0x0A, 404 404 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 405 405 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 406 406 PHYREGS(0x07E4, 0x07E0, 0x07DC, 0x0207, 0x0208, 0x0209), ··· 408 408 { .channel = 210, 409 409 .freq = 5050, /* MHz */ 410 410 .unk2 = 3367, 411 - RADIOREGS(0x71, 0x01, 0xF9, 0x0D, 0xEF, 0x01, 0x04, 0x0A, 411 + RADIOREGS(0x71, 0xF9, 0x01, 0x0D, 0xEF, 0x01, 0x04, 0x0A, 412 412 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 413 413 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 414 414 PHYREGS(0x07E8, 0x07E4, 0x07E0, 0x0206, 0x0207, 0x0208), ··· 416 416 { .channel = 212, 417 417 .freq = 5060, /* MHz */ 418 418 .unk2 = 3373, 419 - RADIOREGS(0x71, 0x01, 0xFA, 0x0D, 0xE6, 0x01, 0x04, 0x0A, 419 + RADIOREGS(0x71, 0xFA, 0x01, 0x0D, 0xE6, 0x01, 0x04, 0x0A, 420 420 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F, 421 421 0x8E, 0xFF, 0x00, 0x0E, 0x0F, 0x8E), 422 422 PHYREGS(0x07EC, 0x07E8, 0x07E4, 0x0205, 0x0206, 0x0207), ··· 424 424 { .channel = 214, 425 425 .freq = 5070, /* MHz */ 426 426 .unk2 = 3380, 427 - RADIOREGS(0x71, 0x01, 0xFB, 0x0D, 0xE6, 0x01, 0x04, 0x0A, 427 + RADIOREGS(0x71, 0xFB, 0x01, 0x0D, 0xE6, 0x01, 0x04, 0x0A, 428 428 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F, 429 429 0x8E, 0xFF, 0x00, 0x0E, 0x0F, 0x8E), 430 430 PHYREGS(0x07F0, 0x07EC, 0x07E8, 0x0204, 0x0205, 0x0206), ··· 432 432 { .channel = 216, 433 433 .freq = 5080, /* MHz */ 434 434 .unk2 = 3387, 435 - RADIOREGS(0x71, 0x01, 0xFC, 0x0D, 0xDE, 0x01, 0x04, 0x0A, 435 + RADIOREGS(0x71, 0xFC, 0x01, 0x0D, 0xDE, 0x01, 0x04, 0x0A, 436 436 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F, 437 437 0x8D, 0xEE, 0x00, 0x0E, 0x0F, 0x8D), 438 438 PHYREGS(0x07F4, 0x07F0, 0x07EC, 0x0203, 0x0204, 0x0205), ··· 440 440 { .channel = 218, 441 441 .freq = 5090, /* MHz */ 442 442 .unk2 = 3393, 443 - RADIOREGS(0x71, 0x01, 0xFD, 0x0D, 0xDE, 0x01, 0x04, 0x0A, 443 + RADIOREGS(0x71, 0xFD, 0x01, 0x0D, 0xDE, 0x01, 0x04, 0x0A, 444 444 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F, 445 445 0x8D, 0xEE, 0x00, 0x0E, 0x0F, 0x8D), 446 446 PHYREGS(0x07F8, 0x07F4, 0x07F0, 0x0202, 0x0203, 0x0204), ··· 448 448 { .channel = 220, 449 449 .freq = 5100, /* MHz */ 450 450 .unk2 = 3400, 451 - RADIOREGS(0x71, 0x01, 0xFE, 0x0C, 0xD6, 0x01, 0x04, 0x0A, 451 + RADIOREGS(0x71, 0xFE, 0x01, 0x0C, 0xD6, 0x01, 0x04, 0x0A, 452 452 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F, 453 453 0x8D, 0xEE, 0x00, 0x0D, 0x0F, 0x8D), 454 454 PHYREGS(0x07FC, 0x07F8, 0x07F4, 0x0201, 0x0202, 0x0203), ··· 456 456 { .channel = 222, 457 457 .freq = 5110, /* MHz */ 458 458 .unk2 = 3407, 459 - RADIOREGS(0x71, 0x01, 0xFF, 0x0C, 0xD6, 0x01, 0x04, 0x0A, 459 + RADIOREGS(0x71, 0xFF, 0x01, 0x0C, 0xD6, 0x01, 0x04, 0x0A, 460 460 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F, 461 461 0x8D, 0xEE, 0x00, 0x0D, 0x0F, 0x8D), 462 462 PHYREGS(0x0800, 0x07FC, 0x07F8, 0x0200, 0x0201, 0x0202), ··· 464 464 { .channel = 224, 465 465 .freq = 5120, /* MHz */ 466 466 .unk2 = 3413, 467 - RADIOREGS(0x71, 0x02, 0x00, 0x0C, 0xCE, 0x01, 0x04, 0x0A, 467 + RADIOREGS(0x71, 0x00, 0x02, 0x0C, 0xCE, 0x01, 0x04, 0x0A, 468 468 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F, 469 469 0x8C, 0xDD, 0x00, 0x0D, 0x0F, 0x8C), 470 470 PHYREGS(0x0804, 0x0800, 0x07FC, 0x01FF, 0x0200, 0x0201), ··· 472 472 { .channel = 226, 473 473 .freq = 5130, /* MHz */ 474 474 .unk2 = 3420, 475 - RADIOREGS(0x71, 0x02, 0x01, 0x0C, 0xCE, 0x01, 0x04, 0x0A, 475 + RADIOREGS(0x71, 0x01, 0x02, 0x0C, 0xCE, 0x01, 0x04, 0x0A, 476 476 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F, 477 477 0x8C, 0xDD, 0x00, 0x0D, 0x0F, 0x8C), 478 478 PHYREGS(0x0808, 0x0804, 0x0800, 0x01FE, 0x01FF, 0x0200), ··· 488 488 { .channel = 32, 489 489 .freq = 5160, /* MHz */ 490 490 .unk2 = 3440, 491 - RADIOREGS(0x71, 0x02, 0x04, 0x0B, 0xBE, 0x01, 0x04, 0x0A, 491 + RADIOREGS(0x71, 0x04, 0x02, 0x0B, 0xBE, 0x01, 0x04, 0x0A, 492 492 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D, 493 493 0x8A, 0xCC, 0x00, 0x0B, 0x0D, 0x8A), 494 494 PHYREGS(0x0814, 0x0810, 0x080C, 0x01FB, 0x01FC, 0x01FD), ··· 496 496 { .channel = 34, 497 497 .freq = 5170, /* MHz */ 498 498 .unk2 = 3447, 499 - RADIOREGS(0x71, 0x02, 0x05, 0x0B, 0xBE, 0x01, 0x04, 0x0A, 499 + RADIOREGS(0x71, 0x05, 0x02, 0x0B, 0xBE, 0x01, 0x04, 0x0A, 500 500 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D, 501 501 0x8A, 0xCC, 0x00, 0x0B, 0x0D, 0x8A), 502 502 PHYREGS(0x0818, 0x0814, 0x0810, 0x01FA, 0x01FB, 0x01FC), ··· 504 504 { .channel = 36, 505 505 .freq = 5180, /* MHz */ 506 506 .unk2 = 3453, 507 - RADIOREGS(0x71, 0x02, 0x06, 0x0B, 0xB6, 0x01, 0x04, 0x0A, 507 + RADIOREGS(0x71, 0x06, 0x02, 0x0B, 0xB6, 0x01, 0x04, 0x0A, 508 508 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C, 509 509 0x89, 0xCC, 0x00, 0x0B, 0x0C, 0x89), 510 510 PHYREGS(0x081C, 0x0818, 0x0814, 0x01F9, 0x01FA, 0x01FB), ··· 512 512 { .channel = 38, 513 513 .freq = 5190, /* MHz */ 514 514 .unk2 = 3460, 515 - RADIOREGS(0x71, 0x02, 0x07, 0x0B, 0xB6, 0x01, 0x04, 0x0A, 515 + RADIOREGS(0x71, 0x07, 0x02, 0x0B, 0xB6, 0x01, 0x04, 0x0A, 516 516 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C, 517 517 0x89, 0xCC, 0x00, 0x0B, 0x0C, 0x89), 518 518 PHYREGS(0x0820, 0x081C, 0x0818, 0x01F8, 0x01F9, 0x01FA), ··· 520 520 { .channel = 40, 521 521 .freq = 5200, /* MHz */ 522 522 .unk2 = 3467, 523 - RADIOREGS(0x71, 0x02, 0x08, 0x0B, 0xAF, 0x01, 0x04, 0x0A, 523 + RADIOREGS(0x71, 0x08, 0x02, 0x0B, 0xAF, 0x01, 0x04, 0x0A, 524 524 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B, 525 525 0x89, 0xBB, 0x00, 0x0A, 0x0B, 0x89), 526 526 PHYREGS(0x0824, 0x0820, 0x081C, 0x01F7, 0x01F8, 0x01F9), ··· 528 528 { .channel = 42, 529 529 .freq = 5210, /* MHz */ 530 530 .unk2 = 3473, 531 - RADIOREGS(0x71, 0x02, 0x09, 0x0B, 0xAF, 0x01, 0x04, 0x0A, 531 + RADIOREGS(0x71, 0x09, 0x02, 0x0B, 0xAF, 0x01, 0x04, 0x0A, 532 532 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B, 533 533 0x89, 0xBB, 0x00, 0x0A, 0x0B, 0x89), 534 534 PHYREGS(0x0828, 0x0824, 0x0820, 0x01F6, 0x01F7, 0x01F8), ··· 536 536 { .channel = 44, 537 537 .freq = 5220, /* MHz */ 538 538 .unk2 = 3480, 539 - RADIOREGS(0x71, 0x02, 0x0A, 0x0A, 0xA7, 0x01, 0x04, 0x0A, 539 + RADIOREGS(0x71, 0x0A, 0x02, 0x0A, 0xA7, 0x01, 0x04, 0x0A, 540 540 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A, 541 541 0x88, 0xBB, 0x00, 0x09, 0x0A, 0x88), 542 542 PHYREGS(0x082C, 0x0828, 0x0824, 0x01F5, 0x01F6, 0x01F7), ··· 544 544 { .channel = 46, 545 545 .freq = 5230, /* MHz */ 546 546 .unk2 = 3487, 547 - RADIOREGS(0x71, 0x02, 0x0B, 0x0A, 0xA7, 0x01, 0x04, 0x0A, 547 + RADIOREGS(0x71, 0x0B, 0x02, 0x0A, 0xA7, 0x01, 0x04, 0x0A, 548 548 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A, 549 549 0x88, 0xBB, 0x00, 0x09, 0x0A, 0x88), 550 550 PHYREGS(0x0830, 0x082C, 0x0828, 0x01F4, 0x01F5, 0x01F6), ··· 552 552 { .channel = 48, 553 553 .freq = 5240, /* MHz */ 554 554 .unk2 = 3493, 555 - RADIOREGS(0x71, 0x02, 0x0C, 0x0A, 0xA0, 0x01, 0x04, 0x0A, 555 + RADIOREGS(0x71, 0x0C, 0x02, 0x0A, 0xA0, 0x01, 0x04, 0x0A, 556 556 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A, 557 557 0x87, 0xAA, 0x00, 0x09, 0x0A, 0x87), 558 558 PHYREGS(0x0834, 0x0830, 0x082C, 0x01F3, 0x01F4, 0x01F5), ··· 560 560 { .channel = 50, 561 561 .freq = 5250, /* MHz */ 562 562 .unk2 = 3500, 563 - RADIOREGS(0x71, 0x02, 0x0D, 0x0A, 0xA0, 0x01, 0x04, 0x0A, 563 + RADIOREGS(0x71, 0x0D, 0x02, 0x0A, 0xA0, 0x01, 0x04, 0x0A, 564 564 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A, 565 565 0x87, 0xAA, 0x00, 0x09, 0x0A, 0x87), 566 566 PHYREGS(0x0838, 0x0834, 0x0830, 0x01F2, 0x01F3, 0x01F4), ··· 568 568 { .channel = 52, 569 569 .freq = 5260, /* MHz */ 570 570 .unk2 = 3507, 571 - RADIOREGS(0x71, 0x02, 0x0E, 0x0A, 0x98, 0x01, 0x04, 0x0A, 571 + RADIOREGS(0x71, 0x0E, 0x02, 0x0A, 0x98, 0x01, 0x04, 0x0A, 572 572 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09, 573 573 0x87, 0xAA, 0x00, 0x08, 0x09, 0x87), 574 574 PHYREGS(0x083C, 0x0838, 0x0834, 0x01F1, 0x01F2, 0x01F3), ··· 576 576 { .channel = 54, 577 577 .freq = 5270, /* MHz */ 578 578 .unk2 = 3513, 579 - RADIOREGS(0x71, 0x02, 0x0F, 0x0A, 0x98, 0x01, 0x04, 0x0A, 579 + RADIOREGS(0x71, 0x0F, 0x02, 0x0A, 0x98, 0x01, 0x04, 0x0A, 580 580 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09, 581 581 0x87, 0xAA, 0x00, 0x08, 0x09, 0x87), 582 582 PHYREGS(0x0840, 0x083C, 0x0838, 0x01F0, 0x01F1, 0x01F2), ··· 584 584 { .channel = 56, 585 585 .freq = 5280, /* MHz */ 586 586 .unk2 = 3520, 587 - RADIOREGS(0x71, 0x02, 0x10, 0x09, 0x91, 0x01, 0x04, 0x0A, 587 + RADIOREGS(0x71, 0x10, 0x02, 0x09, 0x91, 0x01, 0x04, 0x0A, 588 588 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08, 589 589 0x86, 0x99, 0x00, 0x08, 0x08, 0x86), 590 590 PHYREGS(0x0844, 0x0840, 0x083C, 0x01F0, 0x01F0, 0x01F1), ··· 592 592 { .channel = 58, 593 593 .freq = 5290, /* MHz */ 594 594 .unk2 = 3527, 595 - RADIOREGS(0x71, 0x02, 0x11, 0x09, 0x91, 0x01, 0x04, 0x0A, 595 + RADIOREGS(0x71, 0x11, 0x02, 0x09, 0x91, 0x01, 0x04, 0x0A, 596 596 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08, 597 597 0x86, 0x99, 0x00, 0x08, 0x08, 0x86), 598 598 PHYREGS(0x0848, 0x0844, 0x0840, 0x01EF, 0x01F0, 0x01F0), ··· 600 600 { .channel = 60, 601 601 .freq = 5300, /* MHz */ 602 602 .unk2 = 3533, 603 - RADIOREGS(0x71, 0x02, 0x12, 0x09, 0x8A, 0x01, 0x04, 0x0A, 603 + RADIOREGS(0x71, 0x12, 0x02, 0x09, 0x8A, 0x01, 0x04, 0x0A, 604 604 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07, 605 605 0x85, 0x99, 0x00, 0x08, 0x07, 0x85), 606 606 PHYREGS(0x084C, 0x0848, 0x0844, 0x01EE, 0x01EF, 0x01F0), ··· 608 608 { .channel = 62, 609 609 .freq = 5310, /* MHz */ 610 610 .unk2 = 3540, 611 - RADIOREGS(0x71, 0x02, 0x13, 0x09, 0x8A, 0x01, 0x04, 0x0A, 611 + RADIOREGS(0x71, 0x13, 0x02, 0x09, 0x8A, 0x01, 0x04, 0x0A, 612 612 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07, 613 613 0x85, 0x99, 0x00, 0x08, 0x07, 0x85), 614 614 PHYREGS(0x0850, 0x084C, 0x0848, 0x01ED, 0x01EE, 0x01EF), ··· 616 616 { .channel = 64, 617 617 .freq = 5320, /* MHz */ 618 618 .unk2 = 3547, 619 - RADIOREGS(0x71, 0x02, 0x14, 0x09, 0x83, 0x01, 0x04, 0x0A, 619 + RADIOREGS(0x71, 0x14, 0x02, 0x09, 0x83, 0x01, 0x04, 0x0A, 620 620 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07, 621 621 0x84, 0x88, 0x00, 0x07, 0x07, 0x84), 622 622 PHYREGS(0x0854, 0x0850, 0x084C, 0x01EC, 0x01ED, 0x01EE), ··· 624 624 { .channel = 66, 625 625 .freq = 5330, /* MHz */ 626 626 .unk2 = 3553, 627 - RADIOREGS(0x71, 0x02, 0x15, 0x09, 0x83, 0x01, 0x04, 0x0A, 627 + RADIOREGS(0x71, 0x15, 0x02, 0x09, 0x83, 0x01, 0x04, 0x0A, 628 628 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07, 629 629 0x84, 0x88, 0x00, 0x07, 0x07, 0x84), 630 630 PHYREGS(0x0858, 0x0854, 0x0850, 0x01EB, 0x01EC, 0x01ED), ··· 632 632 { .channel = 68, 633 633 .freq = 5340, /* MHz */ 634 634 .unk2 = 3560, 635 - RADIOREGS(0x71, 0x02, 0x16, 0x08, 0x7C, 0x01, 0x04, 0x0A, 635 + RADIOREGS(0x71, 0x16, 0x02, 0x08, 0x7C, 0x01, 0x04, 0x0A, 636 636 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06, 637 637 0x84, 0x88, 0x00, 0x07, 0x06, 0x84), 638 638 PHYREGS(0x085C, 0x0858, 0x0854, 0x01EA, 0x01EB, 0x01EC), ··· 640 640 { .channel = 70, 641 641 .freq = 5350, /* MHz */ 642 642 .unk2 = 3567, 643 - RADIOREGS(0x71, 0x02, 0x17, 0x08, 0x7C, 0x01, 0x04, 0x0A, 643 + RADIOREGS(0x71, 0x17, 0x02, 0x08, 0x7C, 0x01, 0x04, 0x0A, 644 644 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06, 645 645 0x84, 0x88, 0x00, 0x07, 0x06, 0x84), 646 646 PHYREGS(0x0860, 0x085C, 0x0858, 0x01E9, 0x01EA, 0x01EB), ··· 648 648 { .channel = 72, 649 649 .freq = 5360, /* MHz */ 650 650 .unk2 = 3573, 651 - RADIOREGS(0x71, 0x02, 0x18, 0x08, 0x75, 0x01, 0x04, 0x0A, 651 + RADIOREGS(0x71, 0x18, 0x02, 0x08, 0x75, 0x01, 0x04, 0x0A, 652 652 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05, 653 653 0x83, 0x77, 0x00, 0x06, 0x05, 0x83), 654 654 PHYREGS(0x0864, 0x0860, 0x085C, 0x01E8, 0x01E9, 0x01EA), ··· 656 656 { .channel = 74, 657 657 .freq = 5370, /* MHz */ 658 658 .unk2 = 3580, 659 - RADIOREGS(0x71, 0x02, 0x19, 0x08, 0x75, 0x01, 0x04, 0x0A, 659 + RADIOREGS(0x71, 0x19, 0x02, 0x08, 0x75, 0x01, 0x04, 0x0A, 660 660 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05, 661 661 0x83, 0x77, 0x00, 0x06, 0x05, 0x83), 662 662 PHYREGS(0x0868, 0x0864, 0x0860, 0x01E7, 0x01E8, 0x01E9), ··· 664 664 { .channel = 76, 665 665 .freq = 5380, /* MHz */ 666 666 .unk2 = 3587, 667 - RADIOREGS(0x71, 0x02, 0x1A, 0x08, 0x6E, 0x01, 0x04, 0x0A, 667 + RADIOREGS(0x71, 0x1A, 0x02, 0x08, 0x6E, 0x01, 0x04, 0x0A, 668 668 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04, 669 669 0x82, 0x77, 0x00, 0x06, 0x04, 0x82), 670 670 PHYREGS(0x086C, 0x0868, 0x0864, 0x01E6, 0x01E7, 0x01E8), ··· 672 672 { .channel = 78, 673 673 .freq = 5390, /* MHz */ 674 674 .unk2 = 3593, 675 - RADIOREGS(0x71, 0x02, 0x1B, 0x08, 0x6E, 0x01, 0x04, 0x0A, 675 + RADIOREGS(0x71, 0x1B, 0x02, 0x08, 0x6E, 0x01, 0x04, 0x0A, 676 676 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04, 677 677 0x82, 0x77, 0x00, 0x06, 0x04, 0x82), 678 678 PHYREGS(0x0870, 0x086C, 0x0868, 0x01E5, 0x01E6, 0x01E7), ··· 680 680 { .channel = 80, 681 681 .freq = 5400, /* MHz */ 682 682 .unk2 = 3600, 683 - RADIOREGS(0x71, 0x02, 0x1C, 0x07, 0x67, 0x01, 0x04, 0x0A, 683 + RADIOREGS(0x71, 0x1C, 0x02, 0x07, 0x67, 0x01, 0x04, 0x0A, 684 684 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04, 685 685 0x81, 0x66, 0x00, 0x05, 0x04, 0x81), 686 686 PHYREGS(0x0874, 0x0870, 0x086C, 0x01E5, 0x01E5, 0x01E6), ··· 688 688 { .channel = 82, 689 689 .freq = 5410, /* MHz */ 690 690 .unk2 = 3607, 691 - RADIOREGS(0x71, 0x02, 0x1D, 0x07, 0x67, 0x01, 0x04, 0x0A, 691 + RADIOREGS(0x71, 0x1D, 0x02, 0x07, 0x67, 0x01, 0x04, 0x0A, 692 692 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04, 693 693 0x81, 0x66, 0x00, 0x05, 0x04, 0x81), 694 694 PHYREGS(0x0878, 0x0874, 0x0870, 0x01E4, 0x01E5, 0x01E5), ··· 696 696 { .channel = 84, 697 697 .freq = 5420, /* MHz */ 698 698 .unk2 = 3613, 699 - RADIOREGS(0x71, 0x02, 0x1E, 0x07, 0x61, 0x01, 0x04, 0x0A, 699 + RADIOREGS(0x71, 0x1E, 0x02, 0x07, 0x61, 0x01, 0x04, 0x0A, 700 700 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03, 701 701 0x80, 0x66, 0x00, 0x05, 0x03, 0x80), 702 702 PHYREGS(0x087C, 0x0878, 0x0874, 0x01E3, 0x01E4, 0x01E5), ··· 704 704 { .channel = 86, 705 705 .freq = 5430, /* MHz */ 706 706 .unk2 = 3620, 707 - RADIOREGS(0x71, 0x02, 0x1F, 0x07, 0x61, 0x01, 0x04, 0x0A, 707 + RADIOREGS(0x71, 0x1F, 0x02, 0x07, 0x61, 0x01, 0x04, 0x0A, 708 708 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03, 709 709 0x80, 0x66, 0x00, 0x05, 0x03, 0x80), 710 710 PHYREGS(0x0880, 0x087C, 0x0878, 0x01E2, 0x01E3, 0x01E4), ··· 712 712 { .channel = 88, 713 713 .freq = 5440, /* MHz */ 714 714 .unk2 = 3627, 715 - RADIOREGS(0x71, 0x02, 0x20, 0x07, 0x5A, 0x01, 0x04, 0x0A, 715 + RADIOREGS(0x71, 0x20, 0x02, 0x07, 0x5A, 0x01, 0x04, 0x0A, 716 716 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02, 717 717 0x80, 0x55, 0x00, 0x04, 0x02, 0x80), 718 718 PHYREGS(0x0884, 0x0880, 0x087C, 0x01E1, 0x01E2, 0x01E3), ··· 720 720 { .channel = 90, 721 721 .freq = 5450, /* MHz */ 722 722 .unk2 = 3633, 723 - RADIOREGS(0x71, 0x02, 0x21, 0x07, 0x5A, 0x01, 0x04, 0x0A, 723 + RADIOREGS(0x71, 0x21, 0x02, 0x07, 0x5A, 0x01, 0x04, 0x0A, 724 724 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02, 725 725 0x80, 0x55, 0x00, 0x04, 0x02, 0x80), 726 726 PHYREGS(0x0888, 0x0884, 0x0880, 0x01E0, 0x01E1, 0x01E2), ··· 728 728 { .channel = 92, 729 729 .freq = 5460, /* MHz */ 730 730 .unk2 = 3640, 731 - RADIOREGS(0x71, 0x02, 0x22, 0x06, 0x53, 0x01, 0x04, 0x0A, 731 + RADIOREGS(0x71, 0x22, 0x02, 0x06, 0x53, 0x01, 0x04, 0x0A, 732 732 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01, 733 733 0x80, 0x55, 0x00, 0x04, 0x01, 0x80), 734 734 PHYREGS(0x088C, 0x0888, 0x0884, 0x01DF, 0x01E0, 0x01E1), ··· 736 736 { .channel = 94, 737 737 .freq = 5470, /* MHz */ 738 738 .unk2 = 3647, 739 - RADIOREGS(0x71, 0x02, 0x23, 0x06, 0x53, 0x01, 0x04, 0x0A, 739 + RADIOREGS(0x71, 0x23, 0x02, 0x06, 0x53, 0x01, 0x04, 0x0A, 740 740 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01, 741 741 0x80, 0x55, 0x00, 0x04, 0x01, 0x80), 742 742 PHYREGS(0x0890, 0x088C, 0x0888, 0x01DE, 0x01DF, 0x01E0), ··· 744 744 { .channel = 96, 745 745 .freq = 5480, /* MHz */ 746 746 .unk2 = 3653, 747 - RADIOREGS(0x71, 0x02, 0x24, 0x06, 0x4D, 0x01, 0x04, 0x0A, 747 + RADIOREGS(0x71, 0x24, 0x02, 0x06, 0x4D, 0x01, 0x04, 0x0A, 748 748 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00, 749 749 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), 750 750 PHYREGS(0x0894, 0x0890, 0x088C, 0x01DD, 0x01DE, 0x01DF), ··· 752 752 { .channel = 98, 753 753 .freq = 5490, /* MHz */ 754 754 .unk2 = 3660, 755 - RADIOREGS(0x71, 0x02, 0x25, 0x06, 0x4D, 0x01, 0x04, 0x0A, 755 + RADIOREGS(0x71, 0x25, 0x02, 0x06, 0x4D, 0x01, 0x04, 0x0A, 756 756 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00, 757 757 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), 758 758 PHYREGS(0x0898, 0x0894, 0x0890, 0x01DD, 0x01DD, 0x01DE), ··· 760 760 { .channel = 100, 761 761 .freq = 5500, /* MHz */ 762 762 .unk2 = 3667, 763 - RADIOREGS(0x71, 0x02, 0x26, 0x06, 0x47, 0x01, 0x04, 0x0A, 763 + RADIOREGS(0x71, 0x26, 0x02, 0x06, 0x47, 0x01, 0x04, 0x0A, 764 764 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00, 765 765 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), 766 766 PHYREGS(0x089C, 0x0898, 0x0894, 0x01DC, 0x01DD, 0x01DD), ··· 768 768 { .channel = 102, 769 769 .freq = 5510, /* MHz */ 770 770 .unk2 = 3673, 771 - RADIOREGS(0x71, 0x02, 0x27, 0x06, 0x47, 0x01, 0x04, 0x0A, 771 + RADIOREGS(0x71, 0x27, 0x02, 0x06, 0x47, 0x01, 0x04, 0x0A, 772 772 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00, 773 773 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), 774 774 PHYREGS(0x08A0, 0x089C, 0x0898, 0x01DB, 0x01DC, 0x01DD), ··· 776 776 { .channel = 104, 777 777 .freq = 5520, /* MHz */ 778 778 .unk2 = 3680, 779 - RADIOREGS(0x71, 0x02, 0x28, 0x05, 0x40, 0x01, 0x04, 0x0A, 779 + RADIOREGS(0x71, 0x28, 0x02, 0x05, 0x40, 0x01, 0x04, 0x0A, 780 780 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 781 781 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), 782 782 PHYREGS(0x08A4, 0x08A0, 0x089C, 0x01DA, 0x01DB, 0x01DC), ··· 784 784 { .channel = 106, 785 785 .freq = 5530, /* MHz */ 786 786 .unk2 = 3687, 787 - RADIOREGS(0x71, 0x02, 0x29, 0x05, 0x40, 0x01, 0x04, 0x0A, 787 + RADIOREGS(0x71, 0x29, 0x02, 0x05, 0x40, 0x01, 0x04, 0x0A, 788 788 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 789 789 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), 790 790 PHYREGS(0x08A8, 0x08A4, 0x08A0, 0x01D9, 0x01DA, 0x01DB), ··· 792 792 { .channel = 108, 793 793 .freq = 5540, /* MHz */ 794 794 .unk2 = 3693, 795 - RADIOREGS(0x71, 0x02, 0x2A, 0x05, 0x3A, 0x01, 0x04, 0x0A, 795 + RADIOREGS(0x71, 0x2A, 0x02, 0x05, 0x3A, 0x01, 0x04, 0x0A, 796 796 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 797 797 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), 798 798 PHYREGS(0x08AC, 0x08A8, 0x08A4, 0x01D8, 0x01D9, 0x01DA), ··· 800 800 { .channel = 110, 801 801 .freq = 5550, /* MHz */ 802 802 .unk2 = 3700, 803 - RADIOREGS(0x71, 0x02, 0x2B, 0x05, 0x3A, 0x01, 0x04, 0x0A, 803 + RADIOREGS(0x71, 0x2B, 0x02, 0x05, 0x3A, 0x01, 0x04, 0x0A, 804 804 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 805 805 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), 806 806 PHYREGS(0x08B0, 0x08AC, 0x08A8, 0x01D7, 0x01D8, 0x01D9), ··· 808 808 { .channel = 112, 809 809 .freq = 5560, /* MHz */ 810 810 .unk2 = 3707, 811 - RADIOREGS(0x71, 0x02, 0x2C, 0x05, 0x34, 0x01, 0x04, 0x0A, 811 + RADIOREGS(0x71, 0x2C, 0x02, 0x05, 0x34, 0x01, 0x04, 0x0A, 812 812 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 813 813 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), 814 814 PHYREGS(0x08B4, 0x08B0, 0x08AC, 0x01D7, 0x01D7, 0x01D8), ··· 816 816 { .channel = 114, 817 817 .freq = 5570, /* MHz */ 818 818 .unk2 = 3713, 819 - RADIOREGS(0x71, 0x02, 0x2D, 0x05, 0x34, 0x01, 0x04, 0x0A, 819 + RADIOREGS(0x71, 0x2D, 0x02, 0x05, 0x34, 0x01, 0x04, 0x0A, 820 820 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 821 821 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), 822 822 PHYREGS(0x08B8, 0x08B4, 0x08B0, 0x01D6, 0x01D7, 0x01D7), ··· 824 824 { .channel = 116, 825 825 .freq = 5580, /* MHz */ 826 826 .unk2 = 3720, 827 - RADIOREGS(0x71, 0x02, 0x2E, 0x04, 0x2E, 0x01, 0x04, 0x0A, 827 + RADIOREGS(0x71, 0x2E, 0x02, 0x04, 0x2E, 0x01, 0x04, 0x0A, 828 828 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 829 829 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), 830 830 PHYREGS(0x08BC, 0x08B8, 0x08B4, 0x01D5, 0x01D6, 0x01D7), ··· 832 832 { .channel = 118, 833 833 .freq = 5590, /* MHz */ 834 834 .unk2 = 3727, 835 - RADIOREGS(0x71, 0x02, 0x2F, 0x04, 0x2E, 0x01, 0x04, 0x0A, 835 + RADIOREGS(0x71, 0x2F, 0x02, 0x04, 0x2E, 0x01, 0x04, 0x0A, 836 836 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 837 837 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), 838 838 PHYREGS(0x08C0, 0x08BC, 0x08B8, 0x01D4, 0x01D5, 0x01D6), ··· 840 840 { .channel = 120, 841 841 .freq = 5600, /* MHz */ 842 842 .unk2 = 3733, 843 - RADIOREGS(0x71, 0x02, 0x30, 0x04, 0x28, 0x01, 0x04, 0x0A, 843 + RADIOREGS(0x71, 0x30, 0x02, 0x04, 0x28, 0x01, 0x04, 0x0A, 844 844 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, 845 845 0x80, 0x11, 0x00, 0x01, 0x00, 0x80), 846 846 PHYREGS(0x08C4, 0x08C0, 0x08BC, 0x01D3, 0x01D4, 0x01D5), ··· 848 848 { .channel = 122, 849 849 .freq = 5610, /* MHz */ 850 850 .unk2 = 3740, 851 - RADIOREGS(0x71, 0x02, 0x31, 0x04, 0x28, 0x01, 0x04, 0x0A, 851 + RADIOREGS(0x71, 0x31, 0x02, 0x04, 0x28, 0x01, 0x04, 0x0A, 852 852 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, 853 853 0x80, 0x11, 0x00, 0x01, 0x00, 0x80), 854 854 PHYREGS(0x08C8, 0x08C4, 0x08C0, 0x01D2, 0x01D3, 0x01D4), ··· 856 856 { .channel = 124, 857 857 .freq = 5620, /* MHz */ 858 858 .unk2 = 3747, 859 - RADIOREGS(0x71, 0x02, 0x32, 0x04, 0x21, 0x01, 0x04, 0x0A, 859 + RADIOREGS(0x71, 0x32, 0x02, 0x04, 0x21, 0x01, 0x04, 0x0A, 860 860 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 861 861 0x80, 0x11, 0x00, 0x00, 0x00, 0x80), 862 862 PHYREGS(0x08CC, 0x08C8, 0x08C4, 0x01D2, 0x01D2, 0x01D3), ··· 864 864 { .channel = 126, 865 865 .freq = 5630, /* MHz */ 866 866 .unk2 = 3753, 867 - RADIOREGS(0x71, 0x02, 0x33, 0x04, 0x21, 0x01, 0x04, 0x0A, 867 + RADIOREGS(0x71, 0x33, 0x02, 0x04, 0x21, 0x01, 0x04, 0x0A, 868 868 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 869 869 0x80, 0x11, 0x00, 0x00, 0x00, 0x80), 870 870 PHYREGS(0x08D0, 0x08CC, 0x08C8, 0x01D1, 0x01D2, 0x01D2), ··· 872 872 { .channel = 128, 873 873 .freq = 5640, /* MHz */ 874 874 .unk2 = 3760, 875 - RADIOREGS(0x71, 0x02, 0x34, 0x03, 0x1C, 0x01, 0x04, 0x0A, 875 + RADIOREGS(0x71, 0x34, 0x02, 0x03, 0x1C, 0x01, 0x04, 0x0A, 876 876 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 877 877 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 878 878 PHYREGS(0x08D4, 0x08D0, 0x08CC, 0x01D0, 0x01D1, 0x01D2), ··· 880 880 { .channel = 130, 881 881 .freq = 5650, /* MHz */ 882 882 .unk2 = 3767, 883 - RADIOREGS(0x71, 0x02, 0x35, 0x03, 0x1C, 0x01, 0x04, 0x0A, 883 + RADIOREGS(0x71, 0x35, 0x02, 0x03, 0x1C, 0x01, 0x04, 0x0A, 884 884 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 885 885 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 886 886 PHYREGS(0x08D8, 0x08D4, 0x08D0, 0x01CF, 0x01D0, 0x01D1), ··· 888 888 { .channel = 132, 889 889 .freq = 5660, /* MHz */ 890 890 .unk2 = 3773, 891 - RADIOREGS(0x71, 0x02, 0x36, 0x03, 0x16, 0x01, 0x04, 0x0A, 891 + RADIOREGS(0x71, 0x36, 0x02, 0x03, 0x16, 0x01, 0x04, 0x0A, 892 892 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 893 893 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 894 894 PHYREGS(0x08DC, 0x08D8, 0x08D4, 0x01CE, 0x01CF, 0x01D0), ··· 896 896 { .channel = 134, 897 897 .freq = 5670, /* MHz */ 898 898 .unk2 = 3780, 899 - RADIOREGS(0x71, 0x02, 0x37, 0x03, 0x16, 0x01, 0x04, 0x0A, 899 + RADIOREGS(0x71, 0x37, 0x02, 0x03, 0x16, 0x01, 0x04, 0x0A, 900 900 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 901 901 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 902 902 PHYREGS(0x08E0, 0x08DC, 0x08D8, 0x01CE, 0x01CE, 0x01CF), ··· 904 904 { .channel = 136, 905 905 .freq = 5680, /* MHz */ 906 906 .unk2 = 3787, 907 - RADIOREGS(0x71, 0x02, 0x38, 0x03, 0x10, 0x01, 0x04, 0x0A, 907 + RADIOREGS(0x71, 0x38, 0x02, 0x03, 0x10, 0x01, 0x04, 0x0A, 908 908 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 909 909 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 910 910 PHYREGS(0x08E4, 0x08E0, 0x08DC, 0x01CD, 0x01CE, 0x01CE), ··· 912 912 { .channel = 138, 913 913 .freq = 5690, /* MHz */ 914 914 .unk2 = 3793, 915 - RADIOREGS(0x71, 0x02, 0x39, 0x03, 0x10, 0x01, 0x04, 0x0A, 915 + RADIOREGS(0x71, 0x39, 0x02, 0x03, 0x10, 0x01, 0x04, 0x0A, 916 916 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 917 917 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 918 918 PHYREGS(0x08E8, 0x08E4, 0x08E0, 0x01CC, 0x01CD, 0x01CE), ··· 920 920 { .channel = 140, 921 921 .freq = 5700, /* MHz */ 922 922 .unk2 = 3800, 923 - RADIOREGS(0x71, 0x02, 0x3A, 0x02, 0x0A, 0x01, 0x04, 0x0A, 923 + RADIOREGS(0x71, 0x3A, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 924 924 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 925 925 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 926 926 PHYREGS(0x08EC, 0x08E8, 0x08E4, 0x01CB, 0x01CC, 0x01CD), ··· 928 928 { .channel = 142, 929 929 .freq = 5710, /* MHz */ 930 930 .unk2 = 3807, 931 - RADIOREGS(0x71, 0x02, 0x3B, 0x02, 0x0A, 0x01, 0x04, 0x0A, 931 + RADIOREGS(0x71, 0x3B, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 932 932 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 933 933 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 934 934 PHYREGS(0x08F0, 0x08EC, 0x08E8, 0x01CA, 0x01CB, 0x01CC), ··· 936 936 { .channel = 144, 937 937 .freq = 5720, /* MHz */ 938 938 .unk2 = 3813, 939 - RADIOREGS(0x71, 0x02, 0x3C, 0x02, 0x0A, 0x01, 0x04, 0x0A, 939 + RADIOREGS(0x71, 0x3C, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 940 940 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 941 941 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 942 942 PHYREGS(0x08F4, 0x08F0, 0x08EC, 0x01C9, 0x01CA, 0x01CB), ··· 944 944 { .channel = 145, 945 945 .freq = 5725, /* MHz */ 946 946 .unk2 = 3817, 947 - RADIOREGS(0x72, 0x04, 0x79, 0x02, 0x03, 0x01, 0x03, 0x14, 947 + RADIOREGS(0x72, 0x79, 0x04, 0x02, 0x03, 0x01, 0x03, 0x14, 948 948 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 949 949 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 950 950 PHYREGS(0x08F6, 0x08F2, 0x08EE, 0x01C9, 0x01CA, 0x01CB), ··· 952 952 { .channel = 146, 953 953 .freq = 5730, /* MHz */ 954 954 .unk2 = 3820, 955 - RADIOREGS(0x71, 0x02, 0x3D, 0x02, 0x0A, 0x01, 0x04, 0x0A, 955 + RADIOREGS(0x71, 0x3D, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 956 956 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 957 957 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 958 958 PHYREGS(0x08F8, 0x08F4, 0x08F0, 0x01C9, 0x01C9, 0x01CA), ··· 960 960 { .channel = 147, 961 961 .freq = 5735, /* MHz */ 962 962 .unk2 = 3823, 963 - RADIOREGS(0x72, 0x04, 0x7B, 0x02, 0x03, 0x01, 0x03, 0x14, 963 + RADIOREGS(0x72, 0x7B, 0x04, 0x02, 0x03, 0x01, 0x03, 0x14, 964 964 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 965 965 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 966 966 PHYREGS(0x08FA, 0x08F6, 0x08F2, 0x01C8, 0x01C9, 0x01CA), ··· 968 968 { .channel = 148, 969 969 .freq = 5740, /* MHz */ 970 970 .unk2 = 3827, 971 - RADIOREGS(0x71, 0x02, 0x3E, 0x02, 0x0A, 0x01, 0x04, 0x0A, 971 + RADIOREGS(0x71, 0x3E, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 972 972 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 973 973 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 974 974 PHYREGS(0x08FC, 0x08F8, 0x08F4, 0x01C8, 0x01C9, 0x01C9), ··· 976 976 { .channel = 149, 977 977 .freq = 5745, /* MHz */ 978 978 .unk2 = 3830, 979 - RADIOREGS(0x72, 0x04, 0x7D, 0x02, 0xFE, 0x00, 0x03, 0x14, 979 + RADIOREGS(0x72, 0x7D, 0x04, 0x02, 0xFE, 0x00, 0x03, 0x14, 980 980 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 981 981 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 982 982 PHYREGS(0x08FE, 0x08FA, 0x08F6, 0x01C8, 0x01C8, 0x01C9), ··· 984 984 { .channel = 150, 985 985 .freq = 5750, /* MHz */ 986 986 .unk2 = 3833, 987 - RADIOREGS(0x71, 0x02, 0x3F, 0x02, 0x0A, 0x01, 0x04, 0x0A, 987 + RADIOREGS(0x71, 0x3F, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 988 988 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 989 989 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 990 990 PHYREGS(0x0900, 0x08FC, 0x08F8, 0x01C7, 0x01C8, 0x01C9), ··· 992 992 { .channel = 151, 993 993 .freq = 5755, /* MHz */ 994 994 .unk2 = 3837, 995 - RADIOREGS(0x72, 0x04, 0x7F, 0x02, 0xFE, 0x00, 0x03, 0x14, 995 + RADIOREGS(0x72, 0x7F, 0x04, 0x02, 0xFE, 0x00, 0x03, 0x14, 996 996 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 997 997 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 998 998 PHYREGS(0x0902, 0x08FE, 0x08FA, 0x01C7, 0x01C8, 0x01C8), ··· 1000 1000 { .channel = 152, 1001 1001 .freq = 5760, /* MHz */ 1002 1002 .unk2 = 3840, 1003 - RADIOREGS(0x71, 0x02, 0x40, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1003 + RADIOREGS(0x71, 0x40, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1004 1004 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1005 1005 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1006 1006 PHYREGS(0x0904, 0x0900, 0x08FC, 0x01C6, 0x01C7, 0x01C8), ··· 1008 1008 { .channel = 153, 1009 1009 .freq = 5765, /* MHz */ 1010 1010 .unk2 = 3843, 1011 - RADIOREGS(0x72, 0x04, 0x81, 0x02, 0xF8, 0x00, 0x03, 0x14, 1011 + RADIOREGS(0x72, 0x81, 0x04, 0x02, 0xF8, 0x00, 0x03, 0x14, 1012 1012 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1013 1013 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1014 1014 PHYREGS(0x0906, 0x0902, 0x08FE, 0x01C6, 0x01C7, 0x01C8), ··· 1016 1016 { .channel = 154, 1017 1017 .freq = 5770, /* MHz */ 1018 1018 .unk2 = 3847, 1019 - RADIOREGS(0x71, 0x02, 0x41, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1019 + RADIOREGS(0x71, 0x41, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1020 1020 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1021 1021 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1022 1022 PHYREGS(0x0908, 0x0904, 0x0900, 0x01C6, 0x01C6, 0x01C7), ··· 1024 1024 { .channel = 155, 1025 1025 .freq = 5775, /* MHz */ 1026 1026 .unk2 = 3850, 1027 - RADIOREGS(0x72, 0x04, 0x83, 0x02, 0xF8, 0x00, 0x03, 0x14, 1027 + RADIOREGS(0x72, 0x83, 0x04, 0x02, 0xF8, 0x00, 0x03, 0x14, 1028 1028 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1029 1029 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1030 1030 PHYREGS(0x090A, 0x0906, 0x0902, 0x01C5, 0x01C6, 0x01C7), ··· 1032 1032 { .channel = 156, 1033 1033 .freq = 5780, /* MHz */ 1034 1034 .unk2 = 3853, 1035 - RADIOREGS(0x71, 0x02, 0x42, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1035 + RADIOREGS(0x71, 0x42, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1036 1036 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1037 1037 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1038 1038 PHYREGS(0x090C, 0x0908, 0x0904, 0x01C5, 0x01C6, 0x01C6), ··· 1040 1040 { .channel = 157, 1041 1041 .freq = 5785, /* MHz */ 1042 1042 .unk2 = 3857, 1043 - RADIOREGS(0x72, 0x04, 0x85, 0x02, 0xF2, 0x00, 0x03, 0x14, 1043 + RADIOREGS(0x72, 0x85, 0x04, 0x02, 0xF2, 0x00, 0x03, 0x14, 1044 1044 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1045 1045 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1046 1046 PHYREGS(0x090E, 0x090A, 0x0906, 0x01C4, 0x01C5, 0x01C6), ··· 1048 1048 { .channel = 158, 1049 1049 .freq = 5790, /* MHz */ 1050 1050 .unk2 = 3860, 1051 - RADIOREGS(0x71, 0x02, 0x43, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1051 + RADIOREGS(0x71, 0x43, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1052 1052 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1053 1053 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1054 1054 PHYREGS(0x0910, 0x090C, 0x0908, 0x01C4, 0x01C5, 0x01C6), ··· 1056 1056 { .channel = 159, 1057 1057 .freq = 5795, /* MHz */ 1058 1058 .unk2 = 3863, 1059 - RADIOREGS(0x72, 0x04, 0x87, 0x02, 0xF2, 0x00, 0x03, 0x14, 1059 + RADIOREGS(0x72, 0x87, 0x04, 0x02, 0xF2, 0x00, 0x03, 0x14, 1060 1060 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1061 1061 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1062 1062 PHYREGS(0x0912, 0x090E, 0x090A, 0x01C4, 0x01C4, 0x01C5), ··· 1064 1064 { .channel = 160, 1065 1065 .freq = 5800, /* MHz */ 1066 1066 .unk2 = 3867, 1067 - RADIOREGS(0x71, 0x02, 0x44, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1067 + RADIOREGS(0x71, 0x44, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1068 1068 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1069 1069 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1070 1070 PHYREGS(0x0914, 0x0910, 0x090C, 0x01C3, 0x01C4, 0x01C5), ··· 1072 1072 { .channel = 161, 1073 1073 .freq = 5805, /* MHz */ 1074 1074 .unk2 = 3870, 1075 - RADIOREGS(0x72, 0x04, 0x89, 0x01, 0xED, 0x00, 0x03, 0x14, 1075 + RADIOREGS(0x72, 0x89, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14, 1076 1076 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1077 1077 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1078 1078 PHYREGS(0x0916, 0x0912, 0x090E, 0x01C3, 0x01C4, 0x01C4), ··· 1080 1080 { .channel = 162, 1081 1081 .freq = 5810, /* MHz */ 1082 1082 .unk2 = 3873, 1083 - RADIOREGS(0x71, 0x02, 0x45, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1083 + RADIOREGS(0x71, 0x45, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1084 1084 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1085 1085 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1086 1086 PHYREGS(0x0918, 0x0914, 0x0910, 0x01C2, 0x01C3, 0x01C4), ··· 1088 1088 { .channel = 163, 1089 1089 .freq = 5815, /* MHz */ 1090 1090 .unk2 = 3877, 1091 - RADIOREGS(0x72, 0x04, 0x8B, 0x01, 0xED, 0x00, 0x03, 0x14, 1091 + RADIOREGS(0x72, 0x8B, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14, 1092 1092 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1093 1093 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1094 1094 PHYREGS(0x091A, 0x0916, 0x0912, 0x01C2, 0x01C3, 0x01C4), ··· 1096 1096 { .channel = 164, 1097 1097 .freq = 5820, /* MHz */ 1098 1098 .unk2 = 3880, 1099 - RADIOREGS(0x71, 0x02, 0x46, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1099 + RADIOREGS(0x71, 0x46, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1100 1100 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1101 1101 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1102 1102 PHYREGS(0x091C, 0x0918, 0x0914, 0x01C2, 0x01C2, 0x01C3), ··· 1104 1104 { .channel = 165, 1105 1105 .freq = 5825, /* MHz */ 1106 1106 .unk2 = 3883, 1107 - RADIOREGS(0x72, 0x04, 0x8D, 0x01, 0xED, 0x00, 0x03, 0x14, 1107 + RADIOREGS(0x72, 0x8D, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14, 1108 1108 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1109 1109 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1110 1110 PHYREGS(0x091E, 0x091A, 0x0916, 0x01C1, 0x01C2, 0x01C3), ··· 1112 1112 { .channel = 166, 1113 1113 .freq = 5830, /* MHz */ 1114 1114 .unk2 = 3887, 1115 - RADIOREGS(0x71, 0x02, 0x47, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1115 + RADIOREGS(0x71, 0x47, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1116 1116 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1117 1117 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1118 1118 PHYREGS(0x0920, 0x091C, 0x0918, 0x01C1, 0x01C2, 0x01C2), ··· 1120 1120 { .channel = 168, 1121 1121 .freq = 5840, /* MHz */ 1122 1122 .unk2 = 3893, 1123 - RADIOREGS(0x71, 0x02, 0x48, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1123 + RADIOREGS(0x71, 0x48, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1124 1124 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1125 1125 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1126 1126 PHYREGS(0x0924, 0x0920, 0x091C, 0x01C0, 0x01C1, 0x01C2), ··· 1128 1128 { .channel = 170, 1129 1129 .freq = 5850, /* MHz */ 1130 1130 .unk2 = 3900, 1131 - RADIOREGS(0x71, 0x02, 0x49, 0x01, 0xE0, 0x00, 0x04, 0x0A, 1131 + RADIOREGS(0x71, 0x49, 0x02, 0x01, 0xE0, 0x00, 0x04, 0x0A, 1132 1132 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1133 1133 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1134 1134 PHYREGS(0x0928, 0x0924, 0x0920, 0x01BF, 0x01C0, 0x01C1), ··· 1136 1136 { .channel = 172, 1137 1137 .freq = 5860, /* MHz */ 1138 1138 .unk2 = 3907, 1139 - RADIOREGS(0x71, 0x02, 0x4A, 0x01, 0xDE, 0x00, 0x04, 0x0A, 1139 + RADIOREGS(0x71, 0x4A, 0x02, 0x01, 0xDE, 0x00, 0x04, 0x0A, 1140 1140 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1141 1141 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1142 1142 PHYREGS(0x092C, 0x0928, 0x0924, 0x01BF, 0x01BF, 0x01C0), ··· 1144 1144 { .channel = 174, 1145 1145 .freq = 5870, /* MHz */ 1146 1146 .unk2 = 3913, 1147 - RADIOREGS(0x71, 0x02, 0x4B, 0x00, 0xDB, 0x00, 0x04, 0x0A, 1147 + RADIOREGS(0x71, 0x4B, 0x02, 0x00, 0xDB, 0x00, 0x04, 0x0A, 1148 1148 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1149 1149 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1150 1150 PHYREGS(0x0930, 0x092C, 0x0928, 0x01BE, 0x01BF, 0x01BF), ··· 1152 1152 { .channel = 176, 1153 1153 .freq = 5880, /* MHz */ 1154 1154 .unk2 = 3920, 1155 - RADIOREGS(0x71, 0x02, 0x4C, 0x00, 0xD8, 0x00, 0x04, 0x0A, 1155 + RADIOREGS(0x71, 0x4C, 0x02, 0x00, 0xD8, 0x00, 0x04, 0x0A, 1156 1156 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1157 1157 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1158 1158 PHYREGS(0x0934, 0x0930, 0x092C, 0x01BD, 0x01BE, 0x01BF), ··· 1160 1160 { .channel = 178, 1161 1161 .freq = 5890, /* MHz */ 1162 1162 .unk2 = 3927, 1163 - RADIOREGS(0x71, 0x02, 0x4D, 0x00, 0xD6, 0x00, 0x04, 0x0A, 1163 + RADIOREGS(0x71, 0x4D, 0x02, 0x00, 0xD6, 0x00, 0x04, 0x0A, 1164 1164 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1165 1165 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1166 1166 PHYREGS(0x0938, 0x0934, 0x0930, 0x01BC, 0x01BD, 0x01BE), ··· 1168 1168 { .channel = 180, 1169 1169 .freq = 5900, /* MHz */ 1170 1170 .unk2 = 3933, 1171 - RADIOREGS(0x71, 0x02, 0x4E, 0x00, 0xD3, 0x00, 0x04, 0x0A, 1171 + RADIOREGS(0x71, 0x4E, 0x02, 0x00, 0xD3, 0x00, 0x04, 0x0A, 1172 1172 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1173 1173 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1174 1174 PHYREGS(0x093C, 0x0938, 0x0934, 0x01BC, 0x01BC, 0x01BD), ··· 1176 1176 { .channel = 182, 1177 1177 .freq = 5910, /* MHz */ 1178 1178 .unk2 = 3940, 1179 - RADIOREGS(0x71, 0x02, 0x4F, 0x00, 0xD6, 0x00, 0x04, 0x0A, 1179 + RADIOREGS(0x71, 0x4F, 0x02, 0x00, 0xD6, 0x00, 0x04, 0x0A, 1180 1180 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1181 1181 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1182 1182 PHYREGS(0x0940, 0x093C, 0x0938, 0x01BB, 0x01BC, 0x01BC), ··· 1184 1184 { .channel = 1, 1185 1185 .freq = 2412, /* MHz */ 1186 1186 .unk2 = 3216, 1187 - RADIOREGS(0x73, 0x09, 0x6C, 0x0F, 0x00, 0x01, 0x07, 0x15, 1187 + RADIOREGS(0x73, 0x6C, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1188 1188 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0D, 0x0C, 1189 1189 0x80, 0xFF, 0x88, 0x0D, 0x0C, 0x80), 1190 1190 PHYREGS(0x03C9, 0x03C5, 0x03C1, 0x043A, 0x043F, 0x0443), ··· 1192 1192 { .channel = 2, 1193 1193 .freq = 2417, /* MHz */ 1194 1194 .unk2 = 3223, 1195 - RADIOREGS(0x73, 0x09, 0x71, 0x0F, 0x00, 0x01, 0x07, 0x15, 1195 + RADIOREGS(0x73, 0x71, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1196 1196 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0B, 1197 1197 0x80, 0xFF, 0x88, 0x0C, 0x0B, 0x80), 1198 1198 PHYREGS(0x03CB, 0x03C7, 0x03C3, 0x0438, 0x043D, 0x0441), ··· 1200 1200 { .channel = 3, 1201 1201 .freq = 2422, /* MHz */ 1202 1202 .unk2 = 3229, 1203 - RADIOREGS(0x73, 0x09, 0x76, 0x0F, 0x00, 0x01, 0x07, 0x15, 1203 + RADIOREGS(0x73, 0x76, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1204 1204 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A, 1205 1205 0x80, 0xFF, 0x88, 0x0C, 0x0A, 0x80), 1206 1206 PHYREGS(0x03CD, 0x03C9, 0x03C5, 0x0436, 0x043A, 0x043F), ··· 1208 1208 { .channel = 4, 1209 1209 .freq = 2427, /* MHz */ 1210 1210 .unk2 = 3236, 1211 - RADIOREGS(0x73, 0x09, 0x7B, 0x0F, 0x00, 0x01, 0x07, 0x15, 1211 + RADIOREGS(0x73, 0x7B, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1212 1212 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A, 1213 1213 0x80, 0xFF, 0x88, 0x0C, 0x0A, 0x80), 1214 1214 PHYREGS(0x03CF, 0x03CB, 0x03C7, 0x0434, 0x0438, 0x043D), ··· 1216 1216 { .channel = 5, 1217 1217 .freq = 2432, /* MHz */ 1218 1218 .unk2 = 3243, 1219 - RADIOREGS(0x73, 0x09, 0x80, 0x0F, 0x00, 0x01, 0x07, 0x15, 1219 + RADIOREGS(0x73, 0x80, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1220 1220 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x09, 1221 1221 0x80, 0xFF, 0x88, 0x0C, 0x09, 0x80), 1222 1222 PHYREGS(0x03D1, 0x03CD, 0x03C9, 0x0431, 0x0436, 0x043A), ··· 1224 1224 { .channel = 6, 1225 1225 .freq = 2437, /* MHz */ 1226 1226 .unk2 = 3249, 1227 - RADIOREGS(0x73, 0x09, 0x85, 0x0F, 0x00, 0x01, 0x07, 0x15, 1227 + RADIOREGS(0x73, 0x85, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1228 1228 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0B, 0x08, 1229 1229 0x80, 0xFF, 0x88, 0x0B, 0x08, 0x80), 1230 1230 PHYREGS(0x03D3, 0x03CF, 0x03CB, 0x042F, 0x0434, 0x0438), ··· 1232 1232 { .channel = 7, 1233 1233 .freq = 2442, /* MHz */ 1234 1234 .unk2 = 3256, 1235 - RADIOREGS(0x73, 0x09, 0x8A, 0x0F, 0x00, 0x01, 0x07, 0x15, 1235 + RADIOREGS(0x73, 0x8A, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1236 1236 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x07, 1237 1237 0x80, 0xFF, 0x88, 0x0A, 0x07, 0x80), 1238 1238 PHYREGS(0x03D5, 0x03D1, 0x03CD, 0x042D, 0x0431, 0x0436), ··· 1240 1240 { .channel = 8, 1241 1241 .freq = 2447, /* MHz */ 1242 1242 .unk2 = 3263, 1243 - RADIOREGS(0x73, 0x09, 0x8F, 0x0F, 0x00, 0x01, 0x07, 0x15, 1243 + RADIOREGS(0x73, 0x8F, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1244 1244 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x06, 1245 1245 0x80, 0xFF, 0x88, 0x0A, 0x06, 0x80), 1246 1246 PHYREGS(0x03D7, 0x03D3, 0x03CF, 0x042B, 0x042F, 0x0434), ··· 1248 1248 { .channel = 9, 1249 1249 .freq = 2452, /* MHz */ 1250 1250 .unk2 = 3269, 1251 - RADIOREGS(0x73, 0x09, 0x94, 0x0F, 0x00, 0x01, 0x07, 0x15, 1251 + RADIOREGS(0x73, 0x94, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1252 1252 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x09, 0x06, 1253 1253 0x80, 0xFF, 0x88, 0x09, 0x06, 0x80), 1254 1254 PHYREGS(0x03D9, 0x03D5, 0x03D1, 0x0429, 0x042D, 0x0431), ··· 1256 1256 { .channel = 10, 1257 1257 .freq = 2457, /* MHz */ 1258 1258 .unk2 = 3276, 1259 - RADIOREGS(0x73, 0x09, 0x99, 0x0F, 0x00, 0x01, 0x07, 0x15, 1259 + RADIOREGS(0x73, 0x99, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1260 1260 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x05, 1261 1261 0x80, 0xFF, 0x88, 0x08, 0x05, 0x80), 1262 1262 PHYREGS(0x03DB, 0x03D7, 0x03D3, 0x0427, 0x042B, 0x042F), ··· 1264 1264 { .channel = 11, 1265 1265 .freq = 2462, /* MHz */ 1266 1266 .unk2 = 3283, 1267 - RADIOREGS(0x73, 0x09, 0x9E, 0x0F, 0x00, 0x01, 0x07, 0x15, 1267 + RADIOREGS(0x73, 0x9E, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1268 1268 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x04, 1269 1269 0x80, 0xFF, 0x88, 0x08, 0x04, 0x80), 1270 1270 PHYREGS(0x03DD, 0x03D9, 0x03D5, 0x0424, 0x0429, 0x042D), ··· 1272 1272 { .channel = 12, 1273 1273 .freq = 2467, /* MHz */ 1274 1274 .unk2 = 3289, 1275 - RADIOREGS(0x73, 0x09, 0xA3, 0x0F, 0x00, 0x01, 0x07, 0x15, 1275 + RADIOREGS(0x73, 0xA3, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1276 1276 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x03, 1277 1277 0x80, 0xFF, 0x88, 0x08, 0x03, 0x80), 1278 1278 PHYREGS(0x03DF, 0x03DB, 0x03D7, 0x0422, 0x0427, 0x042B), ··· 1280 1280 { .channel = 13, 1281 1281 .freq = 2472, /* MHz */ 1282 1282 .unk2 = 3296, 1283 - RADIOREGS(0x73, 0x09, 0xA8, 0x0F, 0x00, 0x01, 0x07, 0x15, 1283 + RADIOREGS(0x73, 0xA8, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, 1284 1284 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x03, 1285 1285 0x80, 0xFF, 0x88, 0x07, 0x03, 0x80), 1286 1286 PHYREGS(0x03E1, 0x03DD, 0x03D9, 0x0420, 0x0424, 0x0429), ··· 1288 1288 { .channel = 14, 1289 1289 .freq = 2484, /* MHz */ 1290 1290 .unk2 = 3312, 1291 - RADIOREGS(0x73, 0x09, 0xB4, 0x0F, 0xFF, 0x01, 0x07, 0x15, 1291 + RADIOREGS(0x73, 0xB4, 0x09, 0x0F, 0xFF, 0x01, 0x07, 0x15, 1292 1292 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x01, 1293 1293 0x80, 0xFF, 0x88, 0x07, 0x01, 0x80), 1294 1294 PHYREGS(0x03E6, 0x03E2, 0x03DE, 0x041B, 0x041F, 0x0424),
+2 -10
drivers/net/wireless/iwlwifi/iwl-1000.c
··· 278 278 .fw_name_pre = IWL1000_FW_PRE, 279 279 .ucode_api_max = IWL1000_UCODE_API_MAX, 280 280 .ucode_api_min = IWL1000_UCODE_API_MIN, 281 - .valid_tx_ant = ANT_A, 282 - .valid_rx_ant = ANT_AB, 283 281 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 284 282 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 285 283 .ops = &iwl1000_ops, ··· 292 294 .fw_name_pre = IWL1000_FW_PRE, 293 295 .ucode_api_max = IWL1000_UCODE_API_MAX, 294 296 .ucode_api_min = IWL1000_UCODE_API_MIN, 295 - .valid_tx_ant = ANT_A, 296 - .valid_rx_ant = ANT_AB, 297 297 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 298 298 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 299 299 .ops = &iwl1000_ops, ··· 301 305 }; 302 306 303 307 struct iwl_cfg iwl100_bgn_cfg = { 304 - .name = "Intel(R) 100 Series 1x1 BGN", 308 + .name = "Intel(R) Centrino(R) Wireless-N 100 BGN", 305 309 .fw_name_pre = IWL100_FW_PRE, 306 310 .ucode_api_max = IWL100_UCODE_API_MAX, 307 311 .ucode_api_min = IWL100_UCODE_API_MIN, 308 - .valid_tx_ant = ANT_A, 309 - .valid_rx_ant = ANT_A, 310 312 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 311 313 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 312 314 .ops = &iwl1000_ops, ··· 315 321 }; 316 322 317 323 struct iwl_cfg iwl100_bg_cfg = { 318 - .name = "Intel(R) 100 Series 1x1 BG", 324 + .name = "Intel(R) Centrino(R) Wireless-N 100 BG", 319 325 .fw_name_pre = IWL100_FW_PRE, 320 326 .ucode_api_max = IWL100_UCODE_API_MAX, 321 327 .ucode_api_min = IWL100_UCODE_API_MIN, 322 - .valid_tx_ant = ANT_A, 323 - .valid_rx_ant = ANT_A, 324 328 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 325 329 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 326 330 .ops = &iwl1000_ops,
+6 -14
drivers/net/wireless/iwlwifi/iwl-5000.c
··· 527 527 .fw_name_pre = IWL5000_FW_PRE, 528 528 .ucode_api_max = IWL5000_UCODE_API_MAX, 529 529 .ucode_api_min = IWL5000_UCODE_API_MIN, 530 - .valid_tx_ant = ANT_ABC, 531 - .valid_rx_ant = ANT_ABC, 532 530 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 533 531 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 534 532 .ops = &iwl5000_ops, ··· 541 543 .fw_name_pre = IWL5000_FW_PRE, 542 544 .ucode_api_max = IWL5000_UCODE_API_MAX, 543 545 .ucode_api_min = IWL5000_UCODE_API_MIN, 544 - .valid_tx_ant = ANT_B, 545 - .valid_rx_ant = ANT_AB, 546 + .valid_tx_ant = ANT_B, /* .cfg overwrite */ 547 + .valid_rx_ant = ANT_AB, /* .cfg overwrite */ 546 548 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 547 549 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 548 550 .ops = &iwl5000_ops, ··· 557 559 .fw_name_pre = IWL5000_FW_PRE, 558 560 .ucode_api_max = IWL5000_UCODE_API_MAX, 559 561 .ucode_api_min = IWL5000_UCODE_API_MIN, 560 - .valid_tx_ant = ANT_B, 561 - .valid_rx_ant = ANT_AB, 562 + .valid_tx_ant = ANT_B, /* .cfg overwrite */ 563 + .valid_rx_ant = ANT_AB, /* .cfg overwrite */ 562 564 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 563 565 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 564 566 .ops = &iwl5000_ops, ··· 572 574 .fw_name_pre = IWL5000_FW_PRE, 573 575 .ucode_api_max = IWL5000_UCODE_API_MAX, 574 576 .ucode_api_min = IWL5000_UCODE_API_MIN, 575 - .valid_tx_ant = ANT_B, 576 - .valid_rx_ant = ANT_AB, 577 + .valid_tx_ant = ANT_B, /* .cfg overwrite */ 578 + .valid_rx_ant = ANT_AB, /* .cfg overwrite */ 577 579 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 578 580 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 579 581 .ops = &iwl5000_ops, ··· 588 590 .fw_name_pre = IWL5000_FW_PRE, 589 591 .ucode_api_max = IWL5000_UCODE_API_MAX, 590 592 .ucode_api_min = IWL5000_UCODE_API_MIN, 591 - .valid_tx_ant = ANT_ABC, 592 - .valid_rx_ant = ANT_ABC, 593 593 .eeprom_ver = EEPROM_5050_EEPROM_VERSION, 594 594 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, 595 595 .ops = &iwl5000_ops, ··· 602 606 .fw_name_pre = IWL5150_FW_PRE, 603 607 .ucode_api_max = IWL5150_UCODE_API_MAX, 604 608 .ucode_api_min = IWL5150_UCODE_API_MIN, 605 - .valid_tx_ant = ANT_A, 606 - .valid_rx_ant = ANT_AB, 607 609 .eeprom_ver = EEPROM_5050_EEPROM_VERSION, 608 610 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, 609 611 .ops = &iwl5150_ops, ··· 617 623 .fw_name_pre = IWL5150_FW_PRE, 618 624 .ucode_api_max = IWL5150_UCODE_API_MAX, 619 625 .ucode_api_min = IWL5150_UCODE_API_MIN, 620 - .valid_tx_ant = ANT_A, 621 - .valid_rx_ant = ANT_AB, 622 626 .eeprom_ver = EEPROM_5050_EEPROM_VERSION, 623 627 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, 624 628 .ops = &iwl5150_ops,
+18 -48
drivers/net/wireless/iwlwifi/iwl-6000.c
··· 553 553 }; 554 554 555 555 struct iwl_cfg iwl6000g2a_2agn_cfg = { 556 - .name = "6000 Series 2x2 AGN Gen2a", 556 + .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN", 557 557 .fw_name_pre = IWL6000G2A_FW_PRE, 558 558 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 559 559 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 560 - .valid_tx_ant = ANT_AB, 561 - .valid_rx_ant = ANT_AB, 562 560 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 563 561 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 564 562 .ops = &iwl6000_ops, ··· 569 571 }; 570 572 571 573 struct iwl_cfg iwl6000g2a_2abg_cfg = { 572 - .name = "6000 Series 2x2 ABG Gen2a", 574 + .name = "Intel(R) Centrino(R) Advanced-N 6205 ABG", 573 575 .fw_name_pre = IWL6000G2A_FW_PRE, 574 576 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 575 577 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 576 - .valid_tx_ant = ANT_AB, 577 - .valid_rx_ant = ANT_AB, 578 578 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 579 579 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 580 580 .ops = &iwl6000_ops, ··· 584 588 }; 585 589 586 590 struct iwl_cfg iwl6000g2a_2bg_cfg = { 587 - .name = "6000 Series 2x2 BG Gen2a", 591 + .name = "Intel(R) Centrino(R) Advanced-N 6205 BG", 588 592 .fw_name_pre = IWL6000G2A_FW_PRE, 589 593 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 590 594 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 591 - .valid_tx_ant = ANT_AB, 592 - .valid_rx_ant = ANT_AB, 593 595 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 594 596 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 595 597 .ops = &iwl6000_ops, ··· 599 605 }; 600 606 601 607 struct iwl_cfg iwl6000g2b_2agn_cfg = { 602 - .name = "6000 Series 2x2 AGN Gen2b", 608 + .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN", 603 609 .fw_name_pre = IWL6000G2B_FW_PRE, 604 610 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 605 611 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 606 - .valid_tx_ant = ANT_AB, 607 - .valid_rx_ant = ANT_AB, 608 612 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 609 613 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 610 614 .ops = &iwl6000g2b_ops, ··· 619 627 }; 620 628 621 629 struct iwl_cfg iwl6000g2b_2abg_cfg = { 622 - .name = "6000 Series 2x2 ABG Gen2b", 630 + .name = "Intel(R) Centrino(R) Advanced-N 6230 ABG", 623 631 .fw_name_pre = IWL6000G2B_FW_PRE, 624 632 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 625 633 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 626 - .valid_tx_ant = ANT_AB, 627 - .valid_rx_ant = ANT_AB, 628 634 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 629 635 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 630 636 .ops = &iwl6000g2b_ops, ··· 638 648 }; 639 649 640 650 struct iwl_cfg iwl6000g2b_2bgn_cfg = { 641 - .name = "6000 Series 2x2 BGN Gen2b", 651 + .name = "Intel(R) Centrino(R) Advanced-N 6230 BGN", 642 652 .fw_name_pre = IWL6000G2B_FW_PRE, 643 653 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 644 654 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 645 - .valid_tx_ant = ANT_AB, 646 - .valid_rx_ant = ANT_AB, 647 655 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 648 656 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 649 657 .ops = &iwl6000g2b_ops, ··· 658 670 }; 659 671 660 672 struct iwl_cfg iwl6000g2b_2bg_cfg = { 661 - .name = "6000 Series 2x2 BG Gen2b", 673 + .name = "Intel(R) Centrino(R) Advanced-N 6230 BG", 662 674 .fw_name_pre = IWL6000G2B_FW_PRE, 663 675 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 664 676 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 665 - .valid_tx_ant = ANT_AB, 666 - .valid_rx_ant = ANT_AB, 667 677 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 668 678 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 669 679 .ops = &iwl6000g2b_ops, ··· 677 691 }; 678 692 679 693 struct iwl_cfg iwl6000g2b_bgn_cfg = { 680 - .name = "6000 Series 1x2 BGN Gen2b", 694 + .name = "Intel(R) Centrino(R) Wireless-N 1030 BGN", 681 695 .fw_name_pre = IWL6000G2B_FW_PRE, 682 696 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 683 697 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 684 - .valid_tx_ant = ANT_A, 685 - .valid_rx_ant = ANT_AB, 686 698 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 687 699 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 688 700 .ops = &iwl6000g2b_ops, ··· 697 713 }; 698 714 699 715 struct iwl_cfg iwl6000g2b_bg_cfg = { 700 - .name = "6000 Series 1x2 BG Gen2b", 716 + .name = "Intel(R) Centrino(R) Wireless-N 1030 BG", 701 717 .fw_name_pre = IWL6000G2B_FW_PRE, 702 718 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 703 719 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 704 - .valid_tx_ant = ANT_A, 705 - .valid_rx_ant = ANT_AB, 706 720 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 707 721 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 708 722 .ops = &iwl6000g2b_ops, ··· 723 741 .fw_name_pre = IWL6000_FW_PRE, 724 742 .ucode_api_max = IWL6000_UCODE_API_MAX, 725 743 .ucode_api_min = IWL6000_UCODE_API_MIN, 726 - .valid_tx_ant = ANT_BC, 727 - .valid_rx_ant = ANT_BC, 744 + .valid_tx_ant = ANT_BC, /* .cfg overwrite */ 745 + .valid_rx_ant = ANT_BC, /* .cfg overwrite */ 728 746 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 729 747 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 730 748 .ops = &iwl6000_ops, ··· 740 758 .fw_name_pre = IWL6000_FW_PRE, 741 759 .ucode_api_max = IWL6000_UCODE_API_MAX, 742 760 .ucode_api_min = IWL6000_UCODE_API_MIN, 743 - .valid_tx_ant = ANT_BC, 744 - .valid_rx_ant = ANT_BC, 761 + .valid_tx_ant = ANT_BC, /* .cfg overwrite */ 762 + .valid_rx_ant = ANT_BC, /* .cfg overwrite */ 745 763 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 746 764 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 747 765 .ops = &iwl6000_ops, ··· 756 774 .fw_name_pre = IWL6000_FW_PRE, 757 775 .ucode_api_max = IWL6000_UCODE_API_MAX, 758 776 .ucode_api_min = IWL6000_UCODE_API_MIN, 759 - .valid_tx_ant = ANT_BC, 760 - .valid_rx_ant = ANT_BC, 777 + .valid_tx_ant = ANT_BC, /* .cfg overwrite */ 778 + .valid_rx_ant = ANT_BC, /* .cfg overwrite */ 761 779 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 762 780 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 763 781 .ops = &iwl6000_ops, ··· 772 790 .fw_name_pre = IWL6050_FW_PRE, 773 791 .ucode_api_max = IWL6050_UCODE_API_MAX, 774 792 .ucode_api_min = IWL6050_UCODE_API_MIN, 775 - .valid_tx_ant = ANT_AB, 776 - .valid_rx_ant = ANT_AB, 777 793 .ops = &iwl6050_ops, 778 794 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 779 795 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, ··· 783 803 }; 784 804 785 805 struct iwl_cfg iwl6050g2_bgn_cfg = { 786 - .name = "6050 Series 1x2 BGN Gen2", 806 + .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", 787 807 .fw_name_pre = IWL6050_FW_PRE, 788 808 .ucode_api_max = IWL6050_UCODE_API_MAX, 789 809 .ucode_api_min = IWL6050_UCODE_API_MIN, 790 - .valid_tx_ant = ANT_A, 791 - .valid_rx_ant = ANT_AB, 792 810 .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION, 793 811 .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION, 794 812 .ops = &iwl6050g2_ops, ··· 802 824 .fw_name_pre = IWL6050_FW_PRE, 803 825 .ucode_api_max = IWL6050_UCODE_API_MAX, 804 826 .ucode_api_min = IWL6050_UCODE_API_MIN, 805 - .valid_tx_ant = ANT_AB, 806 - .valid_rx_ant = ANT_AB, 807 827 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 808 828 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, 809 829 .ops = &iwl6050_ops, ··· 816 840 .fw_name_pre = IWL6000_FW_PRE, 817 841 .ucode_api_max = IWL6000_UCODE_API_MAX, 818 842 .ucode_api_min = IWL6000_UCODE_API_MIN, 819 - .valid_tx_ant = ANT_ABC, 820 - .valid_rx_ant = ANT_ABC, 821 843 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 822 844 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 823 845 .ops = &iwl6000_ops, ··· 827 853 }; 828 854 829 855 struct iwl_cfg iwl130_bgn_cfg = { 830 - .name = "Intel(R) 130 Series 1x1 BGN", 856 + .name = "Intel(R) Centrino(R) Wireless-N 130 BGN", 831 857 .fw_name_pre = IWL6000G2B_FW_PRE, 832 858 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 833 859 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 834 - .valid_tx_ant = ANT_A, 835 - .valid_rx_ant = ANT_A, 836 860 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 837 861 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 838 862 .ops = &iwl6000g2b_ops, ··· 846 874 }; 847 875 848 876 struct iwl_cfg iwl130_bg_cfg = { 849 - .name = "Intel(R) 130 Series 1x2 BG", 877 + .name = "Intel(R) Centrino(R) Wireless-N 130 BG", 850 878 .fw_name_pre = IWL6000G2B_FW_PRE, 851 879 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 852 880 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 853 - .valid_tx_ant = ANT_A, 854 - .valid_rx_ant = ANT_A, 855 881 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 856 882 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 857 883 .ops = &iwl6000g2b_ops,
+20
drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
··· 251 251 int iwl_eeprom_check_sku(struct iwl_priv *priv) 252 252 { 253 253 u16 eeprom_sku; 254 + u16 radio_cfg; 254 255 255 256 eeprom_sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); 256 257 ··· 267 266 268 267 IWL_INFO(priv, "Device SKU: 0X%x\n", priv->cfg->sku); 269 268 269 + if (!priv->cfg->valid_tx_ant && !priv->cfg->valid_rx_ant) { 270 + /* not using .cfg overwrite */ 271 + radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); 272 + priv->cfg->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg); 273 + priv->cfg->valid_rx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg); 274 + if (!priv->cfg->valid_tx_ant || !priv->cfg->valid_rx_ant) { 275 + IWL_ERR(priv, "Invalid chain (0X%x, 0X%x)\n", 276 + priv->cfg->valid_tx_ant, 277 + priv->cfg->valid_rx_ant); 278 + return -EINVAL; 279 + } 280 + IWL_INFO(priv, "Valid Tx ant: 0X%x, Valid Rx ant: 0X%x\n", 281 + priv->cfg->valid_tx_ant, priv->cfg->valid_rx_ant); 282 + } 283 + /* 284 + * for some special cases, 285 + * EEPROM did not reflect the correct antenna setting 286 + * so overwrite the valid tx/rx antenna from .cfg 287 + */ 270 288 return 0; 271 289 } 272 290
+19 -13
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
··· 1778 1778 cpu_to_le32(0xc0004000), 1779 1779 cpu_to_le32(0x00004000), 1780 1780 cpu_to_le32(0xf0005000), 1781 - cpu_to_le32(0xf0004000), 1781 + cpu_to_le32(0xf0005000), 1782 1782 }; 1783 1783 1784 1784 static const __le32 iwlagn_concurrent_lookup[12] = { ··· 1814 1814 bt_cmd.prio_boost = 0; 1815 1815 bt_cmd.kill_ack_mask = priv->kill_ack_mask; 1816 1816 bt_cmd.kill_cts_mask = priv->kill_cts_mask; 1817 + 1817 1818 bt_cmd.valid = priv->bt_valid; 1818 1819 bt_cmd.tx_prio_boost = 0; 1819 1820 bt_cmd.rx_prio_boost = 0; ··· 1997 1996 BT_UART_MSG_FRAME7CONNECTABLE_POS); 1998 1997 } 1999 1998 2000 - static void iwlagn_set_kill_ack_msk(struct iwl_priv *priv, 2001 - struct iwl_bt_uart_msg *uart_msg) 1999 + static void iwlagn_set_kill_msk(struct iwl_priv *priv, 2000 + struct iwl_bt_uart_msg *uart_msg) 2002 2001 { 2003 - u8 kill_ack_msk; 2002 + u8 kill_msk; 2004 2003 static const __le32 bt_kill_ack_msg[2] = { 2005 - cpu_to_le32(0xFFFFFFF), cpu_to_le32(0xFFFFFC00) }; 2004 + IWLAGN_BT_KILL_ACK_MASK_DEFAULT, 2005 + IWLAGN_BT_KILL_ACK_CTS_MASK_SCO }; 2006 + static const __le32 bt_kill_cts_msg[2] = { 2007 + IWLAGN_BT_KILL_CTS_MASK_DEFAULT, 2008 + IWLAGN_BT_KILL_ACK_CTS_MASK_SCO }; 2006 2009 2007 - kill_ack_msk = (((BT_UART_MSG_FRAME3A2DP_MSK | 2008 - BT_UART_MSG_FRAME3SNIFF_MSK | 2009 - BT_UART_MSG_FRAME3SCOESCO_MSK) & 2010 - uart_msg->frame3) == 0) ? 1 : 0; 2011 - if (priv->kill_ack_mask != bt_kill_ack_msg[kill_ack_msk]) { 2010 + kill_msk = (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) 2011 + ? 1 : 0; 2012 + if (priv->kill_ack_mask != bt_kill_ack_msg[kill_msk] || 2013 + priv->kill_cts_mask != bt_kill_cts_msg[kill_msk]) { 2012 2014 priv->bt_valid |= IWLAGN_BT_VALID_KILL_ACK_MASK; 2013 - priv->kill_ack_mask = bt_kill_ack_msg[kill_ack_msk]; 2015 + priv->kill_ack_mask = bt_kill_ack_msg[kill_msk]; 2016 + priv->bt_valid |= IWLAGN_BT_VALID_KILL_CTS_MASK; 2017 + priv->kill_cts_mask = bt_kill_cts_msg[kill_msk]; 2018 + 2014 2019 /* schedule to send runtime bt_config */ 2015 2020 queue_work(priv->workqueue, &priv->bt_runtime_config); 2016 2021 } 2017 - 2018 2022 } 2019 2023 2020 2024 void iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, ··· 2070 2064 } 2071 2065 } 2072 2066 2073 - iwlagn_set_kill_ack_msk(priv, uart_msg); 2067 + iwlagn_set_kill_msk(priv, uart_msg); 2074 2068 2075 2069 /* FIXME: based on notification, adjust the prio_boost */ 2076 2070
+35 -10
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
··· 67 67 */ 68 68 69 69 static const u8 tid_to_ac[] = { 70 - /* this matches the mac80211 numbers */ 71 - 2, 3, 3, 2, 1, 1, 0, 0 70 + IEEE80211_AC_BE, 71 + IEEE80211_AC_BK, 72 + IEEE80211_AC_BK, 73 + IEEE80211_AC_BE, 74 + IEEE80211_AC_VI, 75 + IEEE80211_AC_VI, 76 + IEEE80211_AC_VO, 77 + IEEE80211_AC_VO 72 78 }; 73 79 74 80 static inline int get_ac_from_tid(u16 tid) ··· 537 531 u8 tid = 0; 538 532 u8 *qc = NULL; 539 533 unsigned long flags; 534 + bool is_agg = false; 540 535 541 536 if (info->control.vif) 542 537 ctx = iwl_rxon_ctx_from_vif(info->control.vif); ··· 574 567 if (sta) 575 568 sta_priv = (void *)sta->drv_priv; 576 569 577 - if (sta_priv && sta_priv->asleep) { 578 - WARN_ON(!(info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)); 570 + if (sta_priv && sta_priv->asleep && 571 + (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)) { 579 572 /* 580 573 * This sends an asynchronous command to the device, 581 574 * but we can rely on it being processed before the ··· 623 616 if (info->flags & IEEE80211_TX_CTL_AMPDU && 624 617 priv->stations[sta_id].tid[tid].agg.state == IWL_AGG_ON) { 625 618 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; 619 + is_agg = true; 626 620 } 627 621 } 628 622 ··· 771 763 * whether or not we should update the write pointer. 772 764 */ 773 765 774 - /* avoid atomic ops if it isn't an associated client */ 775 - if (sta_priv && sta_priv->client) 766 + /* 767 + * Avoid atomic ops if it isn't an associated client. 768 + * Also, if this is a packet for aggregation, don't 769 + * increase the counter because the ucode will stop 770 + * aggregation queues when their respective station 771 + * goes to sleep. 772 + */ 773 + if (sta_priv && sta_priv->client && !is_agg) 776 774 atomic_inc(&sta_priv->pending_frames); 777 775 778 776 if ((iwl_queue_space(q) < q->high_mark) && priv->mac80211_registered) { ··· 1157 1143 return 0; 1158 1144 } 1159 1145 1160 - static void iwlagn_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info) 1146 + static void iwlagn_non_agg_tx_status(struct iwl_priv *priv, 1147 + struct iwl_rxon_context *ctx, 1148 + const u8 *addr1) 1161 1149 { 1162 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data; 1163 1150 struct ieee80211_sta *sta; 1164 1151 struct iwl_station_priv *sta_priv; 1165 1152 1166 1153 rcu_read_lock(); 1167 - sta = ieee80211_find_sta(tx_info->ctx->vif, hdr->addr1); 1154 + sta = ieee80211_find_sta(ctx->vif, addr1); 1168 1155 if (sta) { 1169 1156 sta_priv = (void *)sta->drv_priv; 1170 1157 /* avoid atomic ops if this isn't a client */ ··· 1174 1159 ieee80211_sta_block_awake(priv->hw, sta, false); 1175 1160 } 1176 1161 rcu_read_unlock(); 1162 + } 1163 + 1164 + static void iwlagn_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info, 1165 + bool is_agg) 1166 + { 1167 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data; 1168 + 1169 + if (!is_agg) 1170 + iwlagn_non_agg_tx_status(priv, tx_info->ctx, hdr->addr1); 1177 1171 1178 1172 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); 1179 1173 } ··· 1207 1183 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1208 1184 1209 1185 tx_info = &txq->txb[txq->q.read_ptr]; 1210 - iwlagn_tx_status(priv, tx_info); 1186 + iwlagn_tx_status(priv, tx_info, 1187 + txq_id >= IWLAGN_FIRST_AMPDU_QUEUE); 1211 1188 1212 1189 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1213 1190 if (hdr && ieee80211_is_data_qos(hdr->frame_control))
+12 -12
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
··· 47 47 }; 48 48 49 49 static const struct queue_to_fifo_ac iwlagn_default_queue_to_tx_fifo[] = { 50 - { IWL_TX_FIFO_VO, 0, }, 51 - { IWL_TX_FIFO_VI, 1, }, 52 - { IWL_TX_FIFO_BE, 2, }, 53 - { IWL_TX_FIFO_BK, 3, }, 50 + { IWL_TX_FIFO_VO, IEEE80211_AC_VO, }, 51 + { IWL_TX_FIFO_VI, IEEE80211_AC_VI, }, 52 + { IWL_TX_FIFO_BE, IEEE80211_AC_BE, }, 53 + { IWL_TX_FIFO_BK, IEEE80211_AC_BK, }, 54 54 { IWLAGN_CMD_FIFO_NUM, IWL_AC_UNSET, }, 55 55 { IWL_TX_FIFO_UNUSED, IWL_AC_UNSET, }, 56 56 { IWL_TX_FIFO_UNUSED, IWL_AC_UNSET, }, ··· 60 60 }; 61 61 62 62 static const struct queue_to_fifo_ac iwlagn_ipan_queue_to_tx_fifo[] = { 63 - { IWL_TX_FIFO_VO, 0, }, 64 - { IWL_TX_FIFO_VI, 1, }, 65 - { IWL_TX_FIFO_BE, 2, }, 66 - { IWL_TX_FIFO_BK, 3, }, 67 - { IWL_TX_FIFO_BK_IPAN, 3, }, 68 - { IWL_TX_FIFO_BE_IPAN, 2, }, 69 - { IWL_TX_FIFO_VI_IPAN, 1, }, 70 - { IWL_TX_FIFO_VO_IPAN, 0, }, 63 + { IWL_TX_FIFO_VO, IEEE80211_AC_VO, }, 64 + { IWL_TX_FIFO_VI, IEEE80211_AC_VI, }, 65 + { IWL_TX_FIFO_BE, IEEE80211_AC_BE, }, 66 + { IWL_TX_FIFO_BK, IEEE80211_AC_BK, }, 67 + { IWL_TX_FIFO_BK_IPAN, IEEE80211_AC_BK, }, 68 + { IWL_TX_FIFO_BE_IPAN, IEEE80211_AC_BE, }, 69 + { IWL_TX_FIFO_VI_IPAN, IEEE80211_AC_VI, }, 70 + { IWL_TX_FIFO_VO_IPAN, IEEE80211_AC_VO, }, 71 71 { IWL_TX_FIFO_BE_IPAN, 2, }, 72 72 { IWLAGN_CMD_FIFO_NUM, IWL_AC_UNSET, }, 73 73 };
+2 -1
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 3175 3175 hw->flags = IEEE80211_HW_SIGNAL_DBM | 3176 3176 IEEE80211_HW_AMPDU_AGGREGATION | 3177 3177 IEEE80211_HW_NEED_DTIM_PERIOD | 3178 - IEEE80211_HW_SPECTRUM_MGMT; 3178 + IEEE80211_HW_SPECTRUM_MGMT | 3179 + IEEE80211_HW_REPORTS_TX_ACK_STATUS; 3179 3180 3180 3181 if (!priv->cfg->base_params->broken_powersave) 3181 3182 hw->flags |= IEEE80211_HW_SUPPORTS_PS |
+1
drivers/net/wireless/iwlwifi/iwl-commands.h
··· 2453 2453 2454 2454 #define IWLAGN_BT_KILL_ACK_MASK_DEFAULT cpu_to_le32(0xffff0000) 2455 2455 #define IWLAGN_BT_KILL_CTS_MASK_DEFAULT cpu_to_le32(0xffff0000) 2456 + #define IWLAGN_BT_KILL_ACK_CTS_MASK_SCO cpu_to_le32(0xffffffff) 2456 2457 2457 2458 #define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT 2 2458 2459
-1
drivers/net/wireless/iwlwifi/iwl-eeprom.h
··· 410 410 #define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ 411 411 #define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ 412 412 #define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ 413 - #define EEPROM_3945_M_VERSION (2*0x4A) /* 1 bytes */ 414 413 #define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ 415 414 416 415 /* The following masks are to be applied on EEPROM_RADIO_CONFIG */
-1
drivers/net/wireless/libertas/if_sdio.c
··· 1170 1170 lbs_deb_sdio("call remove card\n"); 1171 1171 lbs_stop_card(card->priv); 1172 1172 lbs_remove_card(card->priv); 1173 - card->priv->surpriseremoved = 1; 1174 1173 1175 1174 flush_workqueue(card->workqueue); 1176 1175 destroy_workqueue(card->workqueue);
-1
drivers/net/wireless/libertas/if_spi.c
··· 1055 1055 lbs_stop_card(priv); 1056 1056 lbs_remove_card(priv); /* will call free_netdev */ 1057 1057 1058 - priv->surpriseremoved = 1; 1059 1058 free_irq(spi->irq, card); 1060 1059 if_spi_terminate_spi_thread(card); 1061 1060 if (card->pdata->teardown)
-2
drivers/net/wireless/libertas/main.c
··· 916 916 917 917 lbs_free_adapter(priv); 918 918 lbs_cfg_free(priv); 919 - 920 - priv->dev = NULL; 921 919 free_netdev(dev); 922 920 923 921 lbs_deb_leave(LBS_DEB_MAIN);
+5 -7
drivers/net/wireless/orinoco/main.c
··· 1392 1392 orinoco_add_hostscan_results(priv, buf, len); 1393 1393 1394 1394 kfree(buf); 1395 - } else if (priv->scan_request) { 1395 + } else { 1396 1396 /* Either abort or complete the scan */ 1397 - cfg80211_scan_done(priv->scan_request, (len < 0)); 1398 - priv->scan_request = NULL; 1397 + orinoco_scan_done(priv, (len < 0)); 1399 1398 } 1400 1399 1401 1400 spin_lock_irqsave(&priv->scan_lock, flags); ··· 1683 1684 hermes_write_regn(hw, EVACK, 0xffff); 1684 1685 } 1685 1686 1687 + orinoco_scan_done(priv, true); 1688 + 1686 1689 /* firmware will have to reassociate */ 1687 1690 netif_carrier_off(dev); 1688 1691 priv->last_linkstatus = 0xffff; ··· 1763 1762 orinoco_unlock(priv, &flags); 1764 1763 1765 1764 /* Scanning support: Notify scan cancellation */ 1766 - if (priv->scan_request) { 1767 - cfg80211_scan_done(priv->scan_request, 1); 1768 - priv->scan_request = NULL; 1769 - } 1765 + orinoco_scan_done(priv, true); 1770 1766 1771 1767 if (priv->hard_reset) { 1772 1768 err = (*priv->hard_reset)(priv);
+8
drivers/net/wireless/orinoco/scan.c
··· 229 229 priv->scan_request = NULL; 230 230 } 231 231 } 232 + 233 + void orinoco_scan_done(struct orinoco_private *priv, bool abort) 234 + { 235 + if (priv->scan_request) { 236 + cfg80211_scan_done(priv->scan_request, abort); 237 + priv->scan_request = NULL; 238 + } 239 + }
+1
drivers/net/wireless/orinoco/scan.h
··· 16 16 void orinoco_add_hostscan_results(struct orinoco_private *dev, 17 17 unsigned char *buf, 18 18 size_t len); 19 + void orinoco_scan_done(struct orinoco_private *priv, bool abort); 19 20 20 21 #endif /* _ORINOCO_SCAN_H_ */
+1 -1
drivers/net/wireless/p54/p54usb.c
··· 183 183 static void p54u_tx_cb(struct urb *urb) 184 184 { 185 185 struct sk_buff *skb = urb->context; 186 - struct ieee80211_hw *dev = (struct ieee80211_hw *) 186 + struct ieee80211_hw *dev = 187 187 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 188 188 189 189 p54_free_skb(dev, skb);
+4 -10
drivers/net/wireless/ray_cs.c
··· 1776 1776 /* Copy the kernel's list of MC addresses to card */ 1777 1777 netdev_for_each_mc_addr(ha, dev) { 1778 1778 memcpy_toio(p, ha->addr, ETH_ALEN); 1779 - dev_dbg(&link->dev, 1780 - "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", 1781 - ha->addr[0], ha->addr[1], 1782 - ha->addr[2], ha->addr[3], 1783 - ha->addr[4], ha->addr[5]); 1779 + dev_dbg(&link->dev, "ray_update_multi add addr %pm\n", 1780 + ha->addr); 1784 1781 p += ETH_ALEN; 1785 1782 i++; 1786 1783 } ··· 2012 2015 memcpy_fromio(&local->bss_id, 2013 2016 prcs->var.rejoin_net_complete. 2014 2017 bssid, ADDRLEN); 2015 - dev_dbg(&link->dev, 2016 - "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n", 2017 - local->bss_id[0], local->bss_id[1], 2018 - local->bss_id[2], local->bss_id[3], 2019 - local->bss_id[4], local->bss_id[5]); 2018 + dev_dbg(&link->dev, "ray_cs new BSSID = %pm\n", 2019 + local->bss_id); 2020 2020 if (!sniffer) 2021 2021 authenticate(local); 2022 2022 }
+1
drivers/net/wireless/rt2x00/rt2800pci.c
··· 911 911 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 912 912 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); 913 913 __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags); 914 + __set_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags); 914 915 if (!modparam_nohwcrypt) 915 916 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); 916 917 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
+1
drivers/net/wireless/rt2x00/rt2x00.h
··· 664 664 DRIVER_REQUIRE_COPY_IV, 665 665 DRIVER_REQUIRE_L2PAD, 666 666 DRIVER_REQUIRE_TXSTATUS_FIFO, 667 + DRIVER_REQUIRE_TASKLET_CONTEXT, 667 668 668 669 /* 669 670 * Driver features
+6 -3
drivers/net/wireless/rt2x00/rt2x00dev.c
··· 379 379 * through a mac80211 library call (RTS/CTS) then we should not 380 380 * send the status report back. 381 381 */ 382 - if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) 383 - ieee80211_tx_status(rt2x00dev->hw, entry->skb); 384 - else 382 + if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) { 383 + if (test_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags)) 384 + ieee80211_tx_status(rt2x00dev->hw, entry->skb); 385 + else 386 + ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); 387 + } else 385 388 dev_kfree_skb_any(entry->skb); 386 389 387 390 /*
+1 -1
drivers/net/wireless/zd1201.c
··· 1830 1830 1831 1831 static void zd1201_disconnect(struct usb_interface *interface) 1832 1832 { 1833 - struct zd1201 *zd=(struct zd1201 *)usb_get_intfdata(interface); 1833 + struct zd1201 *zd = usb_get_intfdata(interface); 1834 1834 struct hlist_node *node, *node2; 1835 1835 struct zd1201_frag *frag; 1836 1836
+30
drivers/ssb/main.c
··· 383 383 ssb_dev->id.revision); 384 384 } 385 385 386 + #define ssb_config_attr(attrib, field, format_string) \ 387 + static ssize_t \ 388 + attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \ 389 + { \ 390 + return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \ 391 + } 392 + 393 + ssb_config_attr(core_num, core_index, "%u\n") 394 + ssb_config_attr(coreid, id.coreid, "0x%04x\n") 395 + ssb_config_attr(vendor, id.vendor, "0x%04x\n") 396 + ssb_config_attr(revision, id.revision, "%u\n") 397 + ssb_config_attr(irq, irq, "%u\n") 398 + static ssize_t 399 + name_show(struct device *dev, struct device_attribute *attr, char *buf) 400 + { 401 + return sprintf(buf, "%s\n", 402 + ssb_core_name(dev_to_ssb_dev(dev)->id.coreid)); 403 + } 404 + 405 + static struct device_attribute ssb_device_attrs[] = { 406 + __ATTR_RO(name), 407 + __ATTR_RO(core_num), 408 + __ATTR_RO(coreid), 409 + __ATTR_RO(vendor), 410 + __ATTR_RO(revision), 411 + __ATTR_RO(irq), 412 + __ATTR_NULL, 413 + }; 414 + 386 415 static struct bus_type ssb_bustype = { 387 416 .name = "ssb", 388 417 .match = ssb_bus_match, ··· 421 392 .suspend = ssb_device_suspend, 422 393 .resume = ssb_device_resume, 423 394 .uevent = ssb_device_uevent, 395 + .dev_attrs = ssb_device_attrs, 424 396 }; 425 397 426 398 static void ssb_buses_lock(void)
+44
drivers/ssb/pci.c
··· 406 406 out->antenna_gain.ghz5.a3 = gain; 407 407 } 408 408 409 + /* Revs 4 5 and 8 have partially shared layout */ 410 + static void sprom_extract_r458(struct ssb_sprom *out, const u16 *in) 411 + { 412 + SPEX(txpid2g[0], SSB_SPROM4_TXPID2G01, 413 + SSB_SPROM4_TXPID2G0, SSB_SPROM4_TXPID2G0_SHIFT); 414 + SPEX(txpid2g[1], SSB_SPROM4_TXPID2G01, 415 + SSB_SPROM4_TXPID2G1, SSB_SPROM4_TXPID2G1_SHIFT); 416 + SPEX(txpid2g[2], SSB_SPROM4_TXPID2G23, 417 + SSB_SPROM4_TXPID2G2, SSB_SPROM4_TXPID2G2_SHIFT); 418 + SPEX(txpid2g[3], SSB_SPROM4_TXPID2G23, 419 + SSB_SPROM4_TXPID2G3, SSB_SPROM4_TXPID2G3_SHIFT); 420 + 421 + SPEX(txpid5gl[0], SSB_SPROM4_TXPID5GL01, 422 + SSB_SPROM4_TXPID5GL0, SSB_SPROM4_TXPID5GL0_SHIFT); 423 + SPEX(txpid5gl[1], SSB_SPROM4_TXPID5GL01, 424 + SSB_SPROM4_TXPID5GL1, SSB_SPROM4_TXPID5GL1_SHIFT); 425 + SPEX(txpid5gl[2], SSB_SPROM4_TXPID5GL23, 426 + SSB_SPROM4_TXPID5GL2, SSB_SPROM4_TXPID5GL2_SHIFT); 427 + SPEX(txpid5gl[3], SSB_SPROM4_TXPID5GL23, 428 + SSB_SPROM4_TXPID5GL3, SSB_SPROM4_TXPID5GL3_SHIFT); 429 + 430 + SPEX(txpid5g[0], SSB_SPROM4_TXPID5G01, 431 + SSB_SPROM4_TXPID5G0, SSB_SPROM4_TXPID5G0_SHIFT); 432 + SPEX(txpid5g[1], SSB_SPROM4_TXPID5G01, 433 + SSB_SPROM4_TXPID5G1, SSB_SPROM4_TXPID5G1_SHIFT); 434 + SPEX(txpid5g[2], SSB_SPROM4_TXPID5G23, 435 + SSB_SPROM4_TXPID5G2, SSB_SPROM4_TXPID5G2_SHIFT); 436 + SPEX(txpid5g[3], SSB_SPROM4_TXPID5G23, 437 + SSB_SPROM4_TXPID5G3, SSB_SPROM4_TXPID5G3_SHIFT); 438 + 439 + SPEX(txpid5gh[0], SSB_SPROM4_TXPID5GH01, 440 + SSB_SPROM4_TXPID5GH0, SSB_SPROM4_TXPID5GH0_SHIFT); 441 + SPEX(txpid5gh[1], SSB_SPROM4_TXPID5GH01, 442 + SSB_SPROM4_TXPID5GH1, SSB_SPROM4_TXPID5GH1_SHIFT); 443 + SPEX(txpid5gh[2], SSB_SPROM4_TXPID5GH23, 444 + SSB_SPROM4_TXPID5GH2, SSB_SPROM4_TXPID5GH2_SHIFT); 445 + SPEX(txpid5gh[3], SSB_SPROM4_TXPID5GH23, 446 + SSB_SPROM4_TXPID5GH3, SSB_SPROM4_TXPID5GH3_SHIFT); 447 + } 448 + 409 449 static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) 410 450 { 411 451 int i; ··· 510 470 SSB_SPROM4_AGAIN3, SSB_SPROM4_AGAIN3_SHIFT); 511 471 memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24, 512 472 sizeof(out->antenna_gain.ghz5)); 473 + 474 + sprom_extract_r458(out, in); 513 475 514 476 /* TODO - get remaining rev 4 stuff needed */ 515 477 } ··· 602 560 SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT); 603 561 memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24, 604 562 sizeof(out->antenna_gain.ghz5)); 563 + 564 + sprom_extract_r458(out, in); 605 565 606 566 /* TODO - get remaining rev 8 stuff needed */ 607 567 }
+20 -5
include/linux/nl80211.h
··· 358 358 * user space application). %NL80211_ATTR_FRAME is used to specify the 359 359 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and 360 360 * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on 361 - * which channel the frame is to be transmitted or was received. This 362 - * channel has to be the current channel (remain-on-channel or the 363 - * operational channel). When called, this operation returns a cookie 364 - * (%NL80211_ATTR_COOKIE) that will be included with the TX status event 365 - * pertaining to the TX request. 361 + * which channel the frame is to be transmitted or was received. If this 362 + * channel is not the current channel (remain-on-channel or the 363 + * operational channel) the device will switch to the given channel and 364 + * transmit the frame, optionally waiting for a response for the time 365 + * specified using %NL80211_ATTR_DURATION. When called, this operation 366 + * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the 367 + * TX status event pertaining to the TX request. 368 + * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this 369 + * command may be used with the corresponding cookie to cancel the wait 370 + * time if it is known that it is no longer necessary. 366 371 * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility. 367 372 * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame 368 373 * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies ··· 497 492 498 493 NL80211_CMD_SET_CHANNEL, 499 494 NL80211_CMD_SET_WDS_PEER, 495 + 496 + NL80211_CMD_FRAME_WAIT_CANCEL, 500 497 501 498 /* add new commands above here */ 502 499 ··· 835 828 * 836 829 * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS 837 830 * 831 + * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be 832 + * transmitted on another channel when the channel given doesn't match 833 + * the current channel. If the current channel doesn't match and this 834 + * flag isn't set, the frame will be rejected. This is also used as an 835 + * nl80211 capability flag. 836 + * 838 837 * @NL80211_ATTR_MAX: highest attribute number currently defined 839 838 * @__NL80211_ATTR_AFTER_LAST: internal use 840 839 */ ··· 1014 1001 NL80211_ATTR_WIPHY_ANTENNA_RX, 1015 1002 1016 1003 NL80211_ATTR_MCAST_RATE, 1004 + 1005 + NL80211_ATTR_OFFCHANNEL_TX_OK, 1017 1006 1018 1007 /* add attributes here, update the policy in nl80211.c */ 1019 1008
+4
include/linux/ssb/ssb.h
··· 55 55 u8 tri5gl; /* 5.2GHz TX isolation */ 56 56 u8 tri5g; /* 5.3GHz TX isolation */ 57 57 u8 tri5gh; /* 5.8GHz TX isolation */ 58 + u8 txpid2g[4]; /* 2GHz TX power index */ 59 + u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */ 60 + u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */ 61 + u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */ 58 62 u8 rxpo2g; /* 2GHz RX power offset */ 59 63 u8 rxpo5g; /* 5GHz RX power offset */ 60 64 u8 rssisav2g; /* 2GHz RSSI params */
+40
include/linux/ssb/ssb_regs.h
··· 299 299 #define SSB_SPROM4_AGAIN2_SHIFT 0 300 300 #define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */ 301 301 #define SSB_SPROM4_AGAIN3_SHIFT 8 302 + #define SSB_SPROM4_TXPID2G01 0x0062 /* TX Power Index 2GHz */ 303 + #define SSB_SPROM4_TXPID2G0 0x00FF 304 + #define SSB_SPROM4_TXPID2G0_SHIFT 0 305 + #define SSB_SPROM4_TXPID2G1 0xFF00 306 + #define SSB_SPROM4_TXPID2G1_SHIFT 8 307 + #define SSB_SPROM4_TXPID2G23 0x0064 /* TX Power Index 2GHz */ 308 + #define SSB_SPROM4_TXPID2G2 0x00FF 309 + #define SSB_SPROM4_TXPID2G2_SHIFT 0 310 + #define SSB_SPROM4_TXPID2G3 0xFF00 311 + #define SSB_SPROM4_TXPID2G3_SHIFT 8 312 + #define SSB_SPROM4_TXPID5G01 0x0066 /* TX Power Index 5GHz middle subband */ 313 + #define SSB_SPROM4_TXPID5G0 0x00FF 314 + #define SSB_SPROM4_TXPID5G0_SHIFT 0 315 + #define SSB_SPROM4_TXPID5G1 0xFF00 316 + #define SSB_SPROM4_TXPID5G1_SHIFT 8 317 + #define SSB_SPROM4_TXPID5G23 0x0068 /* TX Power Index 5GHz middle subband */ 318 + #define SSB_SPROM4_TXPID5G2 0x00FF 319 + #define SSB_SPROM4_TXPID5G2_SHIFT 0 320 + #define SSB_SPROM4_TXPID5G3 0xFF00 321 + #define SSB_SPROM4_TXPID5G3_SHIFT 8 322 + #define SSB_SPROM4_TXPID5GL01 0x006A /* TX Power Index 5GHz low subband */ 323 + #define SSB_SPROM4_TXPID5GL0 0x00FF 324 + #define SSB_SPROM4_TXPID5GL0_SHIFT 0 325 + #define SSB_SPROM4_TXPID5GL1 0xFF00 326 + #define SSB_SPROM4_TXPID5GL1_SHIFT 8 327 + #define SSB_SPROM4_TXPID5GL23 0x006C /* TX Power Index 5GHz low subband */ 328 + #define SSB_SPROM4_TXPID5GL2 0x00FF 329 + #define SSB_SPROM4_TXPID5GL2_SHIFT 0 330 + #define SSB_SPROM4_TXPID5GL3 0xFF00 331 + #define SSB_SPROM4_TXPID5GL3_SHIFT 8 332 + #define SSB_SPROM4_TXPID5GH01 0x006E /* TX Power Index 5GHz high subband */ 333 + #define SSB_SPROM4_TXPID5GH0 0x00FF 334 + #define SSB_SPROM4_TXPID5GH0_SHIFT 0 335 + #define SSB_SPROM4_TXPID5GH1 0xFF00 336 + #define SSB_SPROM4_TXPID5GH1_SHIFT 8 337 + #define SSB_SPROM4_TXPID5GH23 0x0070 /* TX Power Index 5GHz high subband */ 338 + #define SSB_SPROM4_TXPID5GH2 0x00FF 339 + #define SSB_SPROM4_TXPID5GH2_SHIFT 0 340 + #define SSB_SPROM4_TXPID5GH3 0xFF00 341 + #define SSB_SPROM4_TXPID5GH3_SHIFT 8 302 342 #define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */ 303 343 #define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 304 344 #define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
+8 -8
include/net/bluetooth/hci.h
··· 1 - /* 1 + /* 2 2 BlueZ - Bluetooth protocol stack for Linux 3 3 Copyright (C) 2000-2001 Qualcomm Incorporated 4 4 ··· 12 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 14 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 15 - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 16 - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 16 + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 19 20 - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 21 - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 20 + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 21 + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 22 22 SOFTWARE IS DISCLAIMED. 23 23 */ 24 24 ··· 489 489 490 490 #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 491 491 492 - #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 492 + #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 493 493 #define SCAN_DISABLED 0x00 494 494 #define SCAN_INQUIRY 0x01 495 495 #define SCAN_PAGE 0x02 ··· 874 874 875 875 struct hci_command_hdr { 876 876 __le16 opcode; /* OCF & OGF */ 877 - __u8 plen; 877 + __u8 plen; 878 878 } __packed; 879 879 880 880 struct hci_event_hdr {
+7 -7
include/net/bluetooth/hci_core.h
··· 44 44 }; 45 45 46 46 struct inquiry_entry { 47 - struct inquiry_entry *next; 47 + struct inquiry_entry *next; 48 48 __u32 timestamp; 49 49 struct inquiry_data data; 50 50 }; 51 51 52 52 struct inquiry_cache { 53 - spinlock_t lock; 53 + spinlock_t lock; 54 54 __u32 timestamp; 55 - struct inquiry_entry *list; 55 + struct inquiry_entry *list; 56 56 }; 57 57 58 58 struct hci_conn_hash { ··· 141 141 void *driver_data; 142 142 void *core_data; 143 143 144 - atomic_t promisc; 144 + atomic_t promisc; 145 145 146 146 struct dentry *debugfs; 147 147 ··· 150 150 151 151 struct rfkill *rfkill; 152 152 153 - struct module *owner; 153 + struct module *owner; 154 154 155 155 int (*open)(struct hci_dev *hdev); 156 156 int (*close)(struct hci_dev *hdev); ··· 215 215 extern rwlock_t hci_cb_list_lock; 216 216 217 217 /* ----- Inquiry cache ----- */ 218 - #define INQUIRY_CACHE_AGE_MAX (HZ*30) // 30 seconds 219 - #define INQUIRY_ENTRY_AGE_MAX (HZ*60) // 60 seconds 218 + #define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ 219 + #define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ 220 220 221 221 #define inquiry_cache_lock(c) spin_lock(&c->lock) 222 222 #define inquiry_cache_unlock(c) spin_unlock(&c->lock)
+11 -11
include/net/bluetooth/l2cap.h
··· 1 - /* 1 + /* 2 2 BlueZ - Bluetooth protocol stack for Linux 3 3 Copyright (C) 2000-2001 Qualcomm Incorporated 4 4 Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org> ··· 14 14 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 16 16 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 17 - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 18 - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19 - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 18 + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19 + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20 20 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21 21 22 - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 23 - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 22 + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 23 + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 24 24 SOFTWARE IS DISCLAIMED. 25 25 */ 26 26 ··· 417 417 return sub == pi->remote_tx_win; 418 418 } 419 419 420 - #define __get_txseq(ctrl) ((ctrl) & L2CAP_CTRL_TXSEQ) >> 1 421 - #define __get_reqseq(ctrl) ((ctrl) & L2CAP_CTRL_REQSEQ) >> 8 422 - #define __is_iframe(ctrl) !((ctrl) & L2CAP_CTRL_FRAME_TYPE) 423 - #define __is_sframe(ctrl) (ctrl) & L2CAP_CTRL_FRAME_TYPE 424 - #define __is_sar_start(ctrl) ((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START 420 + #define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1) 421 + #define __get_reqseq(ctrl) (((ctrl) & L2CAP_CTRL_REQSEQ) >> 8) 422 + #define __is_iframe(ctrl) (!((ctrl) & L2CAP_CTRL_FRAME_TYPE)) 423 + #define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) 424 + #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) 425 425 426 426 void l2cap_load(void); 427 427
+9 -9
include/net/bluetooth/rfcomm.h
··· 1 - /* 2 - RFCOMM implementation for Linux Bluetooth stack (BlueZ). 1 + /* 2 + RFCOMM implementation for Linux Bluetooth stack (BlueZ) 3 3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 4 4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> 5 5 ··· 11 11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 13 13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 14 - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 15 - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 15 + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 18 19 - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 20 - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 19 + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 20 + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 21 21 SOFTWARE IS DISCLAIMED. 22 22 */ 23 23 ··· 105 105 struct rfcomm_hdr { 106 106 u8 addr; 107 107 u8 ctrl; 108 - u8 len; // Actual size can be 2 bytes 108 + u8 len; /* Actual size can be 2 bytes */ 109 109 } __packed; 110 110 111 111 struct rfcomm_cmd { ··· 228 228 /* ---- RFCOMM SEND RPN ---- */ 229 229 int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, 230 230 u8 bit_rate, u8 data_bits, u8 stop_bits, 231 - u8 parity, u8 flow_ctrl_settings, 231 + u8 parity, u8 flow_ctrl_settings, 232 232 u8 xon_char, u8 xoff_char, u16 param_mask); 233 233 234 234 /* ---- RFCOMM DLCs (channels) ---- */
+10 -10
include/net/bluetooth/sco.h
··· 1 - /* 1 + /* 2 2 BlueZ - Bluetooth protocol stack for Linux 3 3 Copyright (C) 2000-2001 Qualcomm Incorporated 4 4 ··· 12 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 14 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 15 - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 16 - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 16 + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 19 20 - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 21 - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 20 + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 21 + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 22 22 SOFTWARE IS DISCLAIMED. 23 23 */ 24 24 ··· 55 55 struct sco_conn { 56 56 struct hci_conn *hcon; 57 57 58 - bdaddr_t *dst; 59 - bdaddr_t *src; 60 - 58 + bdaddr_t *dst; 59 + bdaddr_t *src; 60 + 61 61 spinlock_t lock; 62 - struct sock *sk; 62 + struct sock *sk; 63 63 64 64 unsigned int mtu; 65 65 };
+15 -3
include/net/cfg80211.h
··· 1134 1134 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 1135 1135 * This allows the operation to be terminated prior to timeout based on 1136 1136 * the duration value. 1137 - * @mgmt_tx: Transmit a management frame 1137 + * @mgmt_tx: Transmit a management frame. 1138 + * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management 1139 + * frame on another channel 1138 1140 * 1139 1141 * @testmode_cmd: run a test mode command 1140 1142 * ··· 1154 1152 * @mgmt_frame_register: Notify driver that a management frame type was 1155 1153 * registered. Note that this callback may not sleep, and cannot run 1156 1154 * concurrently with itself. 1155 + * 1156 + * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 1157 + * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 1158 + * reject TX/RX mask combinations they cannot support by returning -EINVAL 1159 + * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 1160 + * 1161 + * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 1157 1162 */ 1158 1163 struct cfg80211_ops { 1159 1164 int (*suspend)(struct wiphy *wiphy); ··· 1300 1291 u64 cookie); 1301 1292 1302 1293 int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, 1303 - struct ieee80211_channel *chan, 1294 + struct ieee80211_channel *chan, bool offchan, 1304 1295 enum nl80211_channel_type channel_type, 1305 - bool channel_type_valid, 1296 + bool channel_type_valid, unsigned int wait, 1306 1297 const u8 *buf, size_t len, u64 *cookie); 1298 + int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1299 + struct net_device *dev, 1300 + u64 cookie); 1307 1301 1308 1302 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1309 1303 bool enabled, int timeout);
+24 -4
include/net/mac80211.h
··· 2055 2055 * 2056 2056 * This function may not be called in IRQ context. Calls to this function 2057 2057 * for a single hardware must be synchronized against each other. Calls 2058 - * to this function and ieee80211_tx_status_irqsafe() may not be mixed 2059 - * for a single hardware. 2058 + * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe() 2059 + * may not be mixed for a single hardware. 2060 2060 * 2061 2061 * @hw: the hardware the frame was transmitted by 2062 2062 * @skb: the frame that was transmitted, owned by mac80211 after this call ··· 2065 2065 struct sk_buff *skb); 2066 2066 2067 2067 /** 2068 + * ieee80211_tx_status_ni - transmit status callback (in process context) 2069 + * 2070 + * Like ieee80211_tx_status() but can be called in process context. 2071 + * 2072 + * Calls to this function, ieee80211_tx_status() and 2073 + * ieee80211_tx_status_irqsafe() may not be mixed 2074 + * for a single hardware. 2075 + * 2076 + * @hw: the hardware the frame was transmitted by 2077 + * @skb: the frame that was transmitted, owned by mac80211 after this call 2078 + */ 2079 + static inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw, 2080 + struct sk_buff *skb) 2081 + { 2082 + local_bh_disable(); 2083 + ieee80211_tx_status(hw, skb); 2084 + local_bh_enable(); 2085 + } 2086 + 2087 + /** 2068 2088 * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback 2069 2089 * 2070 2090 * Like ieee80211_tx_status() but can be called in IRQ context 2071 2091 * (internally defers to a tasklet.) 2072 2092 * 2073 - * Calls to this function and ieee80211_tx_status() may not be mixed for a 2074 - * single hardware. 2093 + * Calls to this function, ieee80211_tx_status() and 2094 + * ieee80211_tx_status_ni() may not be mixed for a single hardware. 2075 2095 * 2076 2096 * @hw: the hardware the frame was transmitted by 2077 2097 * @skb: the frame that was transmitted, owned by mac80211 after this call
+1
net/bluetooth/bnep/core.c
··· 648 648 649 649 static void __bnep_copy_ci(struct bnep_conninfo *ci, struct bnep_session *s) 650 650 { 651 + memset(ci, 0, sizeof(*ci)); 651 652 memcpy(ci->dst, s->eh.h_source, ETH_ALEN); 652 653 strcpy(ci->device, s->dev->name); 653 654 ci->flags = s->flags;
+1
net/bluetooth/cmtp/core.c
··· 78 78 79 79 static void __cmtp_copy_session(struct cmtp_session *session, struct cmtp_conninfo *ci) 80 80 { 81 + memset(ci, 0, sizeof(*ci)); 81 82 bacpy(&ci->bdaddr, &session->bdaddr); 82 83 83 84 ci->flags = session->flags;
+15 -8
net/bluetooth/hci_conn.c
··· 39 39 #include <net/sock.h> 40 40 41 41 #include <asm/system.h> 42 - #include <asm/uaccess.h> 42 + #include <linux/uaccess.h> 43 43 #include <asm/unaligned.h> 44 44 45 45 #include <net/bluetooth/bluetooth.h> ··· 66 66 bacpy(&cp.bdaddr, &conn->dst); 67 67 cp.pscan_rep_mode = 0x02; 68 68 69 - if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst))) { 69 + ie = hci_inquiry_cache_lookup(hdev, &conn->dst); 70 + if (ie) { 70 71 if (inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) { 71 72 cp.pscan_rep_mode = ie->data.pscan_rep_mode; 72 73 cp.pscan_mode = ie->data.pscan_mode; ··· 369 368 370 369 BT_DBG("%s dst %s", hdev->name, batostr(dst)); 371 370 372 - if (!(acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst))) { 373 - if (!(acl = hci_conn_add(hdev, ACL_LINK, dst))) 371 + acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); 372 + if (!acl) { 373 + acl = hci_conn_add(hdev, ACL_LINK, dst); 374 + if (!acl) 374 375 return NULL; 375 376 } 376 377 ··· 392 389 if (type == ACL_LINK) 393 390 return acl; 394 391 395 - if (!(sco = hci_conn_hash_lookup_ba(hdev, type, dst))) { 396 - if (!(sco = hci_conn_add(hdev, type, dst))) { 392 + sco = hci_conn_hash_lookup_ba(hdev, type, dst); 393 + if (!sco) { 394 + sco = hci_conn_add(hdev, type, dst); 395 + if (!sco) { 397 396 hci_conn_put(acl); 398 397 return NULL; 399 398 } ··· 652 647 653 648 size = sizeof(req) + req.conn_num * sizeof(*ci); 654 649 655 - if (!(cl = kmalloc(size, GFP_KERNEL))) 650 + cl = kmalloc(size, GFP_KERNEL); 651 + if (!cl) 656 652 return -ENOMEM; 657 653 658 - if (!(hdev = hci_dev_get(req.dev_id))) { 654 + hdev = hci_dev_get(req.dev_id); 655 + if (!hdev) { 659 656 kfree(cl); 660 657 return -ENODEV; 661 658 }
+42 -24
net/bluetooth/hci_core.c
··· 44 44 #include <net/sock.h> 45 45 46 46 #include <asm/system.h> 47 - #include <asm/uaccess.h> 47 + #include <linux/uaccess.h> 48 48 #include <asm/unaligned.h> 49 49 50 50 #include <net/bluetooth/bluetooth.h> ··· 349 349 void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data) 350 350 { 351 351 struct inquiry_cache *cache = &hdev->inq_cache; 352 - struct inquiry_entry *e; 352 + struct inquiry_entry *ie; 353 353 354 354 BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr)); 355 355 356 - if (!(e = hci_inquiry_cache_lookup(hdev, &data->bdaddr))) { 356 + ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr); 357 + if (!ie) { 357 358 /* Entry not in the cache. Add new one. */ 358 - if (!(e = kzalloc(sizeof(struct inquiry_entry), GFP_ATOMIC))) 359 + ie = kzalloc(sizeof(struct inquiry_entry), GFP_ATOMIC); 360 + if (!ie) 359 361 return; 360 - e->next = cache->list; 361 - cache->list = e; 362 + 363 + ie->next = cache->list; 364 + cache->list = ie; 362 365 } 363 366 364 - memcpy(&e->data, data, sizeof(*data)); 365 - e->timestamp = jiffies; 367 + memcpy(&ie->data, data, sizeof(*data)); 368 + ie->timestamp = jiffies; 366 369 cache->timestamp = jiffies; 367 370 } 368 371 ··· 425 422 426 423 hci_dev_lock_bh(hdev); 427 424 if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || 428 - inquiry_cache_empty(hdev) || 429 - ir.flags & IREQ_CACHE_FLUSH) { 425 + inquiry_cache_empty(hdev) || 426 + ir.flags & IREQ_CACHE_FLUSH) { 430 427 inquiry_cache_flush(hdev); 431 428 do_inquiry = 1; 432 429 } 433 430 hci_dev_unlock_bh(hdev); 434 431 435 432 timeo = ir.length * msecs_to_jiffies(2000); 436 - if (do_inquiry && (err = hci_request(hdev, hci_inq_req, (unsigned long)&ir, timeo)) < 0) 437 - goto done; 433 + 434 + if (do_inquiry) { 435 + err = hci_request(hdev, hci_inq_req, (unsigned long)&ir, timeo); 436 + if (err < 0) 437 + goto done; 438 + } 438 439 439 440 /* for unlimited number of responses we will use buffer with 255 entries */ 440 441 max_rsp = (ir.num_rsp == 0) ? 255 : ir.num_rsp; ··· 446 439 /* cache_dump can't sleep. Therefore we allocate temp buffer and then 447 440 * copy it to the user space. 448 441 */ 449 - if (!(buf = kmalloc(sizeof(struct inquiry_info) * max_rsp, GFP_KERNEL))) { 442 + buf = kmalloc(sizeof(struct inquiry_info) *max_rsp, GFP_KERNEL); 443 + if (!buf) { 450 444 err = -ENOMEM; 451 445 goto done; 452 446 } ··· 619 611 struct hci_dev *hdev; 620 612 int err; 621 613 622 - if (!(hdev = hci_dev_get(dev))) 614 + hdev = hci_dev_get(dev); 615 + if (!hdev) 623 616 return -ENODEV; 624 617 err = hci_dev_do_close(hdev); 625 618 hci_dev_put(hdev); ··· 632 623 struct hci_dev *hdev; 633 624 int ret = 0; 634 625 635 - if (!(hdev = hci_dev_get(dev))) 626 + hdev = hci_dev_get(dev); 627 + if (!hdev) 636 628 return -ENODEV; 637 629 638 630 hci_req_lock(hdev); ··· 673 663 struct hci_dev *hdev; 674 664 int ret = 0; 675 665 676 - if (!(hdev = hci_dev_get(dev))) 666 + hdev = hci_dev_get(dev); 667 + if (!hdev) 677 668 return -ENODEV; 678 669 679 670 memset(&hdev->stat, 0, sizeof(struct hci_dev_stats)); ··· 693 682 if (copy_from_user(&dr, arg, sizeof(dr))) 694 683 return -EFAULT; 695 684 696 - if (!(hdev = hci_dev_get(dr.dev_id))) 685 + hdev = hci_dev_get(dr.dev_id); 686 + if (!hdev) 697 687 return -ENODEV; 698 688 699 689 switch (cmd) { ··· 775 763 776 764 size = sizeof(*dl) + dev_num * sizeof(*dr); 777 765 778 - if (!(dl = kzalloc(size, GFP_KERNEL))) 766 + dl = kzalloc(size, GFP_KERNEL); 767 + if (!dl) 779 768 return -ENOMEM; 780 769 781 770 dr = dl->dev_req; ··· 810 797 if (copy_from_user(&di, arg, sizeof(di))) 811 798 return -EFAULT; 812 799 813 - if (!(hdev = hci_dev_get(di.dev_id))) 800 + hdev = hci_dev_get(di.dev_id); 801 + if (!hdev) 814 802 return -ENODEV; 815 803 816 804 strcpy(di.name, hdev->name); ··· 919 905 hdev->sniff_max_interval = 800; 920 906 hdev->sniff_min_interval = 80; 921 907 922 - tasklet_init(&hdev->cmd_task, hci_cmd_task,(unsigned long) hdev); 908 + tasklet_init(&hdev->cmd_task, hci_cmd_task, (unsigned long) hdev); 923 909 tasklet_init(&hdev->rx_task, hci_rx_task, (unsigned long) hdev); 924 910 tasklet_init(&hdev->tx_task, hci_tx_task, (unsigned long) hdev); 925 911 ··· 1382 1368 bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT; 1383 1369 hci_add_acl_hdr(skb, conn->handle, flags | ACL_START); 1384 1370 1385 - if (!(list = skb_shinfo(skb)->frag_list)) { 1371 + list = skb_shinfo(skb)->frag_list; 1372 + if (!list) { 1386 1373 /* Non fragmented */ 1387 1374 BT_DBG("%s nonfrag skb %p len %d", hdev->name, skb, skb->len); 1388 1375 ··· 1624 1609 hci_conn_enter_active_mode(conn); 1625 1610 1626 1611 /* Send to upper protocol */ 1627 - if ((hp = hci_proto[HCI_PROTO_L2CAP]) && hp->recv_acldata) { 1612 + hp = hci_proto[HCI_PROTO_L2CAP]; 1613 + if (hp && hp->recv_acldata) { 1628 1614 hp->recv_acldata(conn, skb, flags); 1629 1615 return; 1630 1616 } ··· 1660 1644 register struct hci_proto *hp; 1661 1645 1662 1646 /* Send to upper protocol */ 1663 - if ((hp = hci_proto[HCI_PROTO_SCO]) && hp->recv_scodata) { 1647 + hp = hci_proto[HCI_PROTO_SCO]; 1648 + if (hp && hp->recv_scodata) { 1664 1649 hp->recv_scodata(conn, skb); 1665 1650 return; 1666 1651 } ··· 1744 1727 if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) { 1745 1728 kfree_skb(hdev->sent_cmd); 1746 1729 1747 - if ((hdev->sent_cmd = skb_clone(skb, GFP_ATOMIC))) { 1730 + hdev->sent_cmd = skb_clone(skb, GFP_ATOMIC); 1731 + if (hdev->sent_cmd) { 1748 1732 atomic_dec(&hdev->cmd_cnt); 1749 1733 hci_send_frame(skb); 1750 1734 hdev->cmd_last_tx = jiffies;
+125 -52
net/bluetooth/hci_event.c
··· 39 39 #include <net/sock.h> 40 40 41 41 #include <asm/system.h> 42 - #include <asm/uaccess.h> 42 + #include <linux/uaccess.h> 43 43 #include <asm/unaligned.h> 44 44 45 45 #include <net/bluetooth/bluetooth.h> ··· 677 677 hci_dev_unlock(hdev); 678 678 } 679 679 680 + static int hci_outgoing_auth_needed(struct hci_dev *hdev, 681 + struct hci_conn *conn) 682 + { 683 + if (conn->state != BT_CONFIG || !conn->out) 684 + return 0; 685 + 686 + if (conn->sec_level == BT_SECURITY_SDP) 687 + return 0; 688 + 689 + /* Only request authentication for SSP connections or non-SSP 690 + * devices with sec_level HIGH */ 691 + if (!(hdev->ssp_mode > 0 && conn->ssp_mode > 0) && 692 + conn->sec_level != BT_SECURITY_HIGH) 693 + return 0; 694 + 695 + return 1; 696 + } 697 + 680 698 static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status) 681 699 { 700 + struct hci_cp_remote_name_req *cp; 701 + struct hci_conn *conn; 702 + 682 703 BT_DBG("%s status 0x%x", hdev->name, status); 704 + 705 + /* If successful wait for the name req complete event before 706 + * checking for the need to do authentication */ 707 + if (!status) 708 + return; 709 + 710 + cp = hci_sent_cmd_data(hdev, HCI_OP_REMOTE_NAME_REQ); 711 + if (!cp) 712 + return; 713 + 714 + hci_dev_lock(hdev); 715 + 716 + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); 717 + if (conn && hci_outgoing_auth_needed(hdev, conn)) { 718 + struct hci_cp_auth_requested cp; 719 + cp.handle = __cpu_to_le16(conn->handle); 720 + hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); 721 + } 722 + 723 + hci_dev_unlock(hdev); 683 724 } 684 725 685 726 static void hci_cs_read_remote_features(struct hci_dev *hdev, __u8 status) ··· 996 955 997 956 hci_dev_lock(hdev); 998 957 999 - if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) 958 + ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); 959 + if (ie) 1000 960 memcpy(ie->data.dev_class, ev->dev_class, 3); 1001 961 1002 962 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); 1003 963 if (!conn) { 1004 - if (!(conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr))) { 964 + conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr); 965 + if (!conn) { 1005 966 BT_ERR("No memory for new connection"); 1006 967 hci_dev_unlock(hdev); 1007 968 return; ··· 1133 1090 1134 1091 static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb) 1135 1092 { 1093 + struct hci_ev_remote_name *ev = (void *) skb->data; 1094 + struct hci_conn *conn; 1095 + 1136 1096 BT_DBG("%s", hdev->name); 1137 1097 1138 1098 hci_conn_check_pending(hdev); 1099 + 1100 + hci_dev_lock(hdev); 1101 + 1102 + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 1103 + if (conn && hci_outgoing_auth_needed(hdev, conn)) { 1104 + struct hci_cp_auth_requested cp; 1105 + cp.handle = __cpu_to_le16(conn->handle); 1106 + hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); 1107 + } 1108 + 1109 + hci_dev_unlock(hdev); 1139 1110 } 1140 1111 1141 1112 static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) ··· 1219 1162 hci_dev_lock(hdev); 1220 1163 1221 1164 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 1222 - if (conn) { 1223 - if (!ev->status) 1224 - memcpy(conn->features, ev->features, 8); 1165 + if (!conn) 1166 + goto unlock; 1225 1167 1226 - if (conn->state == BT_CONFIG) { 1227 - if (!ev->status && lmp_ssp_capable(hdev) && 1228 - lmp_ssp_capable(conn)) { 1229 - struct hci_cp_read_remote_ext_features cp; 1230 - cp.handle = ev->handle; 1231 - cp.page = 0x01; 1232 - hci_send_cmd(hdev, 1233 - HCI_OP_READ_REMOTE_EXT_FEATURES, 1168 + if (!ev->status) 1169 + memcpy(conn->features, ev->features, 8); 1170 + 1171 + if (conn->state != BT_CONFIG) 1172 + goto unlock; 1173 + 1174 + if (!ev->status && lmp_ssp_capable(hdev) && lmp_ssp_capable(conn)) { 1175 + struct hci_cp_read_remote_ext_features cp; 1176 + cp.handle = ev->handle; 1177 + cp.page = 0x01; 1178 + hci_send_cmd(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES, 1234 1179 sizeof(cp), &cp); 1235 - } else if (!ev->status && conn->out && 1236 - conn->sec_level == BT_SECURITY_HIGH) { 1237 - struct hci_cp_auth_requested cp; 1238 - cp.handle = ev->handle; 1239 - hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, 1240 - sizeof(cp), &cp); 1241 - } else { 1242 - conn->state = BT_CONNECTED; 1243 - hci_proto_connect_cfm(conn, ev->status); 1244 - hci_conn_put(conn); 1245 - } 1246 - } 1180 + goto unlock; 1247 1181 } 1248 1182 1183 + if (!ev->status) { 1184 + struct hci_cp_remote_name_req cp; 1185 + memset(&cp, 0, sizeof(cp)); 1186 + bacpy(&cp.bdaddr, &conn->dst); 1187 + cp.pscan_rep_mode = 0x02; 1188 + hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); 1189 + } 1190 + 1191 + if (!hci_outgoing_auth_needed(hdev, conn)) { 1192 + conn->state = BT_CONNECTED; 1193 + hci_proto_connect_cfm(conn, ev->status); 1194 + hci_conn_put(conn); 1195 + } 1196 + 1197 + unlock: 1249 1198 hci_dev_unlock(hdev); 1250 1199 } 1251 1200 ··· 1512 1449 conn->sent -= count; 1513 1450 1514 1451 if (conn->type == ACL_LINK) { 1515 - if ((hdev->acl_cnt += count) > hdev->acl_pkts) 1452 + hdev->acl_cnt += count; 1453 + if (hdev->acl_cnt > hdev->acl_pkts) 1516 1454 hdev->acl_cnt = hdev->acl_pkts; 1517 1455 } else { 1518 - if ((hdev->sco_cnt += count) > hdev->sco_pkts) 1456 + hdev->sco_cnt += count; 1457 + if (hdev->sco_cnt > hdev->sco_pkts) 1519 1458 hdev->sco_cnt = hdev->sco_pkts; 1520 1459 } 1521 1460 } ··· 1612 1547 if (conn && !ev->status) { 1613 1548 struct inquiry_entry *ie; 1614 1549 1615 - if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst))) { 1550 + ie = hci_inquiry_cache_lookup(hdev, &conn->dst); 1551 + if (ie) { 1616 1552 ie->data.clock_offset = ev->clock_offset; 1617 1553 ie->timestamp = jiffies; 1618 1554 } ··· 1647 1581 1648 1582 hci_dev_lock(hdev); 1649 1583 1650 - if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) { 1584 + ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); 1585 + if (ie) { 1651 1586 ie->data.pscan_rep_mode = ev->pscan_rep_mode; 1652 1587 ie->timestamp = jiffies; 1653 1588 } ··· 1713 1646 hci_dev_lock(hdev); 1714 1647 1715 1648 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 1716 - if (conn) { 1717 - if (!ev->status && ev->page == 0x01) { 1718 - struct inquiry_entry *ie; 1649 + if (!conn) 1650 + goto unlock; 1719 1651 1720 - if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst))) 1721 - ie->data.ssp_mode = (ev->features[0] & 0x01); 1652 + if (!ev->status && ev->page == 0x01) { 1653 + struct inquiry_entry *ie; 1722 1654 1723 - conn->ssp_mode = (ev->features[0] & 0x01); 1724 - } 1655 + ie = hci_inquiry_cache_lookup(hdev, &conn->dst); 1656 + if (ie) 1657 + ie->data.ssp_mode = (ev->features[0] & 0x01); 1725 1658 1726 - if (conn->state == BT_CONFIG) { 1727 - if (!ev->status && hdev->ssp_mode > 0 && 1728 - conn->ssp_mode > 0 && conn->out && 1729 - conn->sec_level != BT_SECURITY_SDP) { 1730 - struct hci_cp_auth_requested cp; 1731 - cp.handle = ev->handle; 1732 - hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, 1733 - sizeof(cp), &cp); 1734 - } else { 1735 - conn->state = BT_CONNECTED; 1736 - hci_proto_connect_cfm(conn, ev->status); 1737 - hci_conn_put(conn); 1738 - } 1739 - } 1659 + conn->ssp_mode = (ev->features[0] & 0x01); 1740 1660 } 1741 1661 1662 + if (conn->state != BT_CONFIG) 1663 + goto unlock; 1664 + 1665 + if (!ev->status) { 1666 + struct hci_cp_remote_name_req cp; 1667 + memset(&cp, 0, sizeof(cp)); 1668 + bacpy(&cp.bdaddr, &conn->dst); 1669 + cp.pscan_rep_mode = 0x02; 1670 + hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); 1671 + } 1672 + 1673 + if (!hci_outgoing_auth_needed(hdev, conn)) { 1674 + conn->state = BT_CONNECTED; 1675 + hci_proto_connect_cfm(conn, ev->status); 1676 + hci_conn_put(conn); 1677 + } 1678 + 1679 + unlock: 1742 1680 hci_dev_unlock(hdev); 1743 1681 } 1744 1682 ··· 1893 1821 1894 1822 hci_dev_lock(hdev); 1895 1823 1896 - if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) 1824 + ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); 1825 + if (ie) 1897 1826 ie->data.ssp_mode = (ev->features[0] & 0x01); 1898 1827 1899 1828 hci_dev_unlock(hdev);
+11 -6
net/bluetooth/hci_sock.c
··· 43 43 #include <net/sock.h> 44 44 45 45 #include <asm/system.h> 46 - #include <asm/uaccess.h> 46 + #include <linux/uaccess.h> 47 47 #include <asm/unaligned.h> 48 48 49 49 #include <net/bluetooth/bluetooth.h> ··· 125 125 continue; 126 126 } 127 127 128 - if (!(nskb = skb_clone(skb, GFP_ATOMIC))) 128 + nskb = skb_clone(skb, GFP_ATOMIC); 129 + if (!nskb) 129 130 continue; 130 131 131 132 /* Put type byte before the data */ ··· 371 370 } 372 371 373 372 if (haddr->hci_dev != HCI_DEV_NONE) { 374 - if (!(hdev = hci_dev_get(haddr->hci_dev))) { 373 + hdev = hci_dev_get(haddr->hci_dev); 374 + if (!hdev) { 375 375 err = -ENODEV; 376 376 goto done; 377 377 } ··· 459 457 if (sk->sk_state == BT_CLOSED) 460 458 return 0; 461 459 462 - if (!(skb = skb_recv_datagram(sk, flags, noblock, &err))) 460 + skb = skb_recv_datagram(sk, flags, noblock, &err); 461 + if (!skb) 463 462 return err; 464 463 465 464 msg->msg_namelen = 0; ··· 502 499 503 500 lock_sock(sk); 504 501 505 - if (!(hdev = hci_pi(sk)->hdev)) { 502 + hdev = hci_pi(sk)->hdev; 503 + if (!hdev) { 506 504 err = -EBADFD; 507 505 goto done; 508 506 } ··· 513 509 goto done; 514 510 } 515 511 516 - if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err))) 512 + skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err); 513 + if (!skb) 517 514 goto done; 518 515 519 516 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
+1 -1
net/bluetooth/hidp/core.c
··· 107 107 108 108 static void __hidp_copy_session(struct hidp_session *session, struct hidp_conninfo *ci) 109 109 { 110 + memset(ci, 0, sizeof(*ci)); 110 111 bacpy(&ci->bdaddr, &session->bdaddr); 111 112 112 113 ci->flags = session->flags; ··· 116 115 ci->vendor = 0x0000; 117 116 ci->product = 0x0000; 118 117 ci->version = 0x0000; 119 - memset(ci->name, 0, 128); 120 118 121 119 if (session->input) { 122 120 ci->vendor = session->input->id.vendor;
+63 -31
net/bluetooth/l2cap.c
··· 57 57 58 58 #define VERSION "2.15" 59 59 60 - static int disable_ertm = 0; 60 + static int disable_ertm; 61 61 62 62 static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN; 63 63 static u8 l2cap_fixed_chan[8] = { 0x02, }; ··· 83 83 static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb); 84 84 85 85 /* ---- L2CAP timers ---- */ 86 + static void l2cap_sock_set_timer(struct sock *sk, long timeout) 87 + { 88 + BT_DBG("sk %p state %d timeout %ld", sk, sk->sk_state, timeout); 89 + sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout); 90 + } 91 + 92 + static void l2cap_sock_clear_timer(struct sock *sk) 93 + { 94 + BT_DBG("sock %p state %d", sk, sk->sk_state); 95 + sk_stop_timer(sk, &sk->sk_timer); 96 + } 97 + 86 98 static void l2cap_sock_timeout(unsigned long arg) 87 99 { 88 100 struct sock *sk = (struct sock *) arg; ··· 103 91 BT_DBG("sock %p state %d", sk, sk->sk_state); 104 92 105 93 bh_lock_sock(sk); 94 + 95 + if (sock_owned_by_user(sk)) { 96 + /* sk is owned by user. Try again later */ 97 + l2cap_sock_set_timer(sk, HZ / 5); 98 + bh_unlock_sock(sk); 99 + sock_put(sk); 100 + return; 101 + } 106 102 107 103 if (sk->sk_state == BT_CONNECTED || sk->sk_state == BT_CONFIG) 108 104 reason = ECONNREFUSED; ··· 126 106 127 107 l2cap_sock_kill(sk); 128 108 sock_put(sk); 129 - } 130 - 131 - static void l2cap_sock_set_timer(struct sock *sk, long timeout) 132 - { 133 - BT_DBG("sk %p state %d timeout %ld", sk, sk->sk_state, timeout); 134 - sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout); 135 - } 136 - 137 - static void l2cap_sock_clear_timer(struct sock *sk) 138 - { 139 - BT_DBG("sock %p state %d", sk, sk->sk_state); 140 - sk_stop_timer(sk, &sk->sk_timer); 141 109 } 142 110 143 111 /* ---- L2CAP channels ---- */ ··· 751 743 /* Find socket with psm and source bdaddr. 752 744 * Returns closest match. 753 745 */ 754 - static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) 746 + static struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) 755 747 { 756 748 struct sock *sk = NULL, *sk1 = NULL; 757 749 struct hlist_node *node; 750 + 751 + read_lock(&l2cap_sk_list.lock); 758 752 759 753 sk_for_each(sk, node, &l2cap_sk_list.head) { 760 754 if (state && sk->sk_state != state) ··· 772 762 sk1 = sk; 773 763 } 774 764 } 775 - return node ? sk : sk1; 776 - } 777 765 778 - /* Find socket with given address (psm, src). 779 - * Returns locked socket */ 780 - static inline struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) 781 - { 782 - struct sock *s; 783 - read_lock(&l2cap_sk_list.lock); 784 - s = __l2cap_get_sock_by_psm(state, psm, src); 785 - if (s) 786 - bh_lock_sock(s); 787 766 read_unlock(&l2cap_sk_list.lock); 788 - return s; 767 + 768 + return node ? sk : sk1; 789 769 } 790 770 791 771 static void l2cap_sock_destruct(struct sock *sk) ··· 2926 2926 goto sendresp; 2927 2927 } 2928 2928 2929 + bh_lock_sock(parent); 2930 + 2929 2931 /* Check if the ACL is secure enough (if not SDP) */ 2930 2932 if (psm != cpu_to_le16(0x0001) && 2931 2933 !hci_conn_check_link_mode(conn->hcon)) { ··· 3080 3078 break; 3081 3079 3082 3080 default: 3081 + /* don't delete l2cap channel if sk is owned by user */ 3082 + if (sock_owned_by_user(sk)) { 3083 + sk->sk_state = BT_DISCONN; 3084 + l2cap_sock_clear_timer(sk); 3085 + l2cap_sock_set_timer(sk, HZ / 5); 3086 + break; 3087 + } 3088 + 3083 3089 l2cap_chan_del(sk, ECONNREFUSED); 3084 3090 break; 3085 3091 } ··· 3293 3283 3294 3284 sk->sk_shutdown = SHUTDOWN_MASK; 3295 3285 3286 + /* don't delete l2cap channel if sk is owned by user */ 3287 + if (sock_owned_by_user(sk)) { 3288 + sk->sk_state = BT_DISCONN; 3289 + l2cap_sock_clear_timer(sk); 3290 + l2cap_sock_set_timer(sk, HZ / 5); 3291 + bh_unlock_sock(sk); 3292 + return 0; 3293 + } 3294 + 3296 3295 l2cap_chan_del(sk, ECONNRESET); 3297 3296 bh_unlock_sock(sk); 3298 3297 ··· 3323 3304 sk = l2cap_get_chan_by_scid(&conn->chan_list, scid); 3324 3305 if (!sk) 3325 3306 return 0; 3307 + 3308 + /* don't delete l2cap channel if sk is owned by user */ 3309 + if (sock_owned_by_user(sk)) { 3310 + sk->sk_state = BT_DISCONN; 3311 + l2cap_sock_clear_timer(sk); 3312 + l2cap_sock_set_timer(sk, HZ / 5); 3313 + bh_unlock_sock(sk); 3314 + return 0; 3315 + } 3326 3316 3327 3317 l2cap_chan_del(sk, 0); 3328 3318 bh_unlock_sock(sk); ··· 4162 4134 __mod_retrans_timer(); 4163 4135 4164 4136 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; 4165 - if (pi->conn_state & L2CAP_CONN_SREJ_SENT) { 4137 + if (pi->conn_state & L2CAP_CONN_SREJ_SENT) 4166 4138 l2cap_send_ack(pi); 4167 - } else { 4139 + else 4168 4140 l2cap_ertm_send(sk); 4169 - } 4170 4141 } 4171 4142 } 4172 4143 ··· 4456 4429 sk = l2cap_get_sock_by_psm(0, psm, conn->src); 4457 4430 if (!sk) 4458 4431 goto drop; 4432 + 4433 + bh_lock_sock(sk); 4459 4434 4460 4435 BT_DBG("sk %p, len %d", sk, skb->len); 4461 4436 ··· 4870 4841 return err; 4871 4842 4872 4843 _busy_wq = create_singlethread_workqueue("l2cap"); 4873 - if (!_busy_wq) 4874 - goto error; 4844 + if (!_busy_wq) { 4845 + proto_unregister(&l2cap_proto); 4846 + return -ENOMEM; 4847 + } 4875 4848 4876 4849 err = bt_sock_register(BTPROTO_L2CAP, &l2cap_sock_family_ops); 4877 4850 if (err < 0) { ··· 4901 4870 return 0; 4902 4871 4903 4872 error: 4873 + destroy_workqueue(_busy_wq); 4904 4874 proto_unregister(&l2cap_proto); 4905 4875 return err; 4906 4876 }
+4 -4
net/bluetooth/rfcomm/core.c
··· 41 41 #include <linux/slab.h> 42 42 43 43 #include <net/sock.h> 44 - #include <asm/uaccess.h> 44 + #include <linux/uaccess.h> 45 45 #include <asm/unaligned.h> 46 46 47 47 #include <net/bluetooth/bluetooth.h> ··· 51 51 52 52 #define VERSION "1.11" 53 53 54 - static int disable_cfc = 0; 54 + static int disable_cfc; 55 + static int l2cap_ertm; 55 56 static int channel_mtu = -1; 56 57 static unsigned int l2cap_mtu = RFCOMM_MAX_L2CAP_MTU; 57 - static int l2cap_ertm = 0; 58 58 59 59 static struct task_struct *rfcomm_thread; 60 60 ··· 1901 1901 1902 1902 BT_DBG("%p state %ld", s, s->state); 1903 1903 1904 - switch(sk->sk_state) { 1904 + switch (sk->sk_state) { 1905 1905 case BT_CONNECTED: 1906 1906 s->state = BT_CONNECT; 1907 1907
+10 -14
net/bluetooth/rfcomm/sock.c
··· 45 45 #include <net/sock.h> 46 46 47 47 #include <asm/system.h> 48 - #include <asm/uaccess.h> 48 + #include <linux/uaccess.h> 49 49 50 50 #include <net/bluetooth/bluetooth.h> 51 51 #include <net/bluetooth/hci_core.h> ··· 140 140 /* Find socket with channel and source bdaddr. 141 141 * Returns closest match. 142 142 */ 143 - static struct sock *__rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src) 143 + static struct sock *rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src) 144 144 { 145 145 struct sock *sk = NULL, *sk1 = NULL; 146 146 struct hlist_node *node; 147 + 148 + read_lock(&rfcomm_sk_list.lock); 147 149 148 150 sk_for_each(sk, node, &rfcomm_sk_list.head) { 149 151 if (state && sk->sk_state != state) ··· 161 159 sk1 = sk; 162 160 } 163 161 } 164 - return node ? sk : sk1; 165 - } 166 162 167 - /* Find socket with given address (channel, src). 168 - * Returns locked socket */ 169 - static inline struct sock *rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src) 170 - { 171 - struct sock *s; 172 - read_lock(&rfcomm_sk_list.lock); 173 - s = __rfcomm_get_sock_by_channel(state, channel, src); 174 - if (s) bh_lock_sock(s); 175 163 read_unlock(&rfcomm_sk_list.lock); 176 - return s; 164 + 165 + return node ? sk : sk1; 177 166 } 178 167 179 168 static void rfcomm_sock_destruct(struct sock *sk) ··· 888 895 889 896 BT_DBG("sock %p, sk %p", sock, sk); 890 897 891 - if (!sk) return 0; 898 + if (!sk) 899 + return 0; 892 900 893 901 lock_sock(sk); 894 902 if (!sk->sk_shutdown) { ··· 938 944 parent = rfcomm_get_sock_by_channel(BT_LISTEN, channel, &src); 939 945 if (!parent) 940 946 return 0; 947 + 948 + bh_lock_sock(parent); 941 949 942 950 /* Check for backlog size */ 943 951 if (sk_acceptq_is_full(parent)) {
+16 -12
net/bluetooth/rfcomm/tty.c
··· 58 58 59 59 bdaddr_t src; 60 60 bdaddr_t dst; 61 - u8 channel; 61 + u8 channel; 62 62 63 - uint modem_status; 63 + uint modem_status; 64 64 65 65 struct rfcomm_dlc *dlc; 66 66 struct tty_struct *tty; ··· 69 69 70 70 struct device *tty_dev; 71 71 72 - atomic_t wmem_alloc; 72 + atomic_t wmem_alloc; 73 73 74 74 struct sk_buff_head pending; 75 75 }; ··· 431 431 432 432 BT_DBG("dev_id %d flags 0x%x", req.dev_id, req.flags); 433 433 434 - if (!(dev = rfcomm_dev_get(req.dev_id))) 434 + dev = rfcomm_dev_get(req.dev_id); 435 + if (!dev) 435 436 return -ENODEV; 436 437 437 438 if (dev->flags != NOCAP_FLAGS && !capable(CAP_NET_ADMIN)) { ··· 471 470 472 471 size = sizeof(*dl) + dev_num * sizeof(*di); 473 472 474 - if (!(dl = kmalloc(size, GFP_KERNEL))) 473 + dl = kmalloc(size, GFP_KERNEL); 474 + if (!dl) 475 475 return -ENOMEM; 476 476 477 477 di = dl->dev_info; ··· 515 513 if (copy_from_user(&di, arg, sizeof(di))) 516 514 return -EFAULT; 517 515 518 - if (!(dev = rfcomm_dev_get(di.id))) 516 + dev = rfcomm_dev_get(di.id); 517 + if (!dev) 519 518 return -ENODEV; 520 519 521 520 di.flags = dev->flags; ··· 564 561 return; 565 562 } 566 563 567 - if (!(tty = dev->tty) || !skb_queue_empty(&dev->pending)) { 564 + tty = dev->tty; 565 + if (!tty || !skb_queue_empty(&dev->pending)) { 568 566 skb_queue_tail(&dev->pending, skb); 569 567 return; 570 568 } ··· 800 796 801 797 memcpy(skb_put(skb, size), buf + sent, size); 802 798 803 - if ((err = rfcomm_dlc_send(dlc, skb)) < 0) { 799 + err = rfcomm_dlc_send(dlc, skb); 800 + if (err < 0) { 804 801 kfree_skb(skb); 805 802 break; 806 803 } ··· 897 892 898 893 /* Parity on/off and when on, odd/even */ 899 894 if (((old->c_cflag & PARENB) != (new->c_cflag & PARENB)) || 900 - ((old->c_cflag & PARODD) != (new->c_cflag & PARODD)) ) { 895 + ((old->c_cflag & PARODD) != (new->c_cflag & PARODD))) { 901 896 changes |= RFCOMM_RPN_PM_PARITY; 902 897 BT_DBG("Parity change detected."); 903 898 } ··· 942 937 /* POSIX does not support 1.5 stop bits and RFCOMM does not 943 938 * support 2 stop bits. So a request for 2 stop bits gets 944 939 * translated to 1.5 stop bits */ 945 - if (new->c_cflag & CSTOPB) { 940 + if (new->c_cflag & CSTOPB) 946 941 stop_bits = RFCOMM_RPN_STOP_15; 947 - } else { 942 + else 948 943 stop_bits = RFCOMM_RPN_STOP_1; 949 - } 950 944 951 945 /* Handle number of data bits [5-8] */ 952 946 if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE))
+16 -12
net/bluetooth/sco.c
··· 44 44 #include <net/sock.h> 45 45 46 46 #include <asm/system.h> 47 - #include <asm/uaccess.h> 47 + #include <linux/uaccess.h> 48 48 49 49 #include <net/bluetooth/bluetooth.h> 50 50 #include <net/bluetooth/hci_core.h> ··· 52 52 53 53 #define VERSION "0.6" 54 54 55 - static int disable_esco = 0; 55 + static int disable_esco; 56 56 57 57 static const struct proto_ops sco_sock_ops; 58 58 ··· 138 138 139 139 static int sco_conn_del(struct hci_conn *hcon, int err) 140 140 { 141 - struct sco_conn *conn; 141 + struct sco_conn *conn = hcon->sco_data; 142 142 struct sock *sk; 143 143 144 - if (!(conn = hcon->sco_data)) 144 + if (!conn) 145 145 return 0; 146 146 147 147 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); 148 148 149 149 /* Kill socket */ 150 - if ((sk = sco_chan_get(conn))) { 150 + sk = sco_chan_get(conn); 151 + if (sk) { 151 152 bh_lock_sock(sk); 152 153 sco_sock_clear_timer(sk); 153 154 sco_chan_del(sk, err); ··· 186 185 187 186 BT_DBG("%s -> %s", batostr(src), batostr(dst)); 188 187 189 - if (!(hdev = hci_get_route(dst, src))) 188 + hdev = hci_get_route(dst, src); 189 + if (!hdev) 190 190 return -EHOSTUNREACH; 191 191 192 192 hci_dev_lock_bh(hdev); ··· 512 510 /* Set destination address and psm */ 513 511 bacpy(&bt_sk(sk)->dst, &sa->sco_bdaddr); 514 512 515 - if ((err = sco_connect(sk))) 513 + err = sco_connect(sk); 514 + if (err) 516 515 goto done; 517 516 518 517 err = bt_sock_wait_state(sk, BT_CONNECTED, ··· 831 828 832 829 static void sco_conn_ready(struct sco_conn *conn) 833 830 { 834 - struct sock *parent, *sk; 831 + struct sock *parent; 832 + struct sock *sk = conn->sk; 835 833 836 834 BT_DBG("conn %p", conn); 837 835 838 836 sco_conn_lock(conn); 839 837 840 - if ((sk = conn->sk)) { 838 + if (sk) { 841 839 sco_sock_clear_timer(sk); 842 840 bh_lock_sock(sk); 843 841 sk->sk_state = BT_CONNECTED; ··· 886 882 int lm = 0; 887 883 888 884 if (type != SCO_LINK && type != ESCO_LINK) 889 - return 0; 885 + return -EINVAL; 890 886 891 887 BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); 892 888 ··· 912 908 BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); 913 909 914 910 if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) 915 - return 0; 911 + return -EINVAL; 916 912 917 913 if (!status) { 918 914 struct sco_conn *conn; ··· 931 927 BT_DBG("hcon %p reason %d", hcon, reason); 932 928 933 929 if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) 934 - return 0; 930 + return -EINVAL; 935 931 936 932 sco_conn_del(hcon, bt_err(reason)); 937 933
+3 -5
net/mac80211/agg-rx.c
··· 129 129 timer_to_tid[0]); 130 130 131 131 rcu_read_lock(); 132 - spin_lock(&sta->lock); 133 132 ieee80211_release_reorder_timeout(sta, *ptid); 134 - spin_unlock(&sta->lock); 135 133 rcu_read_unlock(); 136 134 } 137 135 ··· 254 256 } 255 257 256 258 /* prepare A-MPDU MLME for Rx aggregation */ 257 - tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC); 259 + tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL); 258 260 if (!tid_agg_rx) { 259 261 #ifdef CONFIG_MAC80211_HT_DEBUG 260 262 if (net_ratelimit()) ··· 278 280 279 281 /* prepare reordering buffer */ 280 282 tid_agg_rx->reorder_buf = 281 - kcalloc(buf_size, sizeof(struct sk_buff *), GFP_ATOMIC); 283 + kcalloc(buf_size, sizeof(struct sk_buff *), GFP_KERNEL); 282 284 tid_agg_rx->reorder_time = 283 - kcalloc(buf_size, sizeof(unsigned long), GFP_ATOMIC); 285 + kcalloc(buf_size, sizeof(unsigned long), GFP_KERNEL); 284 286 if (!tid_agg_rx->reorder_buf || !tid_agg_rx->reorder_time) { 285 287 #ifdef CONFIG_MAC80211_HT_DEBUG 286 288 if (net_ratelimit())
+90 -4
net/mac80211/cfg.c
··· 1551 1551 return ieee80211_wk_cancel_remain_on_channel(sdata, cookie); 1552 1552 } 1553 1553 1554 + static enum work_done_result 1555 + ieee80211_offchan_tx_done(struct ieee80211_work *wk, struct sk_buff *skb) 1556 + { 1557 + /* 1558 + * Use the data embedded in the work struct for reporting 1559 + * here so if the driver mangled the SKB before dropping 1560 + * it (which is the only way we really should get here) 1561 + * then we don't report mangled data. 1562 + * 1563 + * If there was no wait time, then by the time we get here 1564 + * the driver will likely not have reported the status yet, 1565 + * so in that case userspace will have to deal with it. 1566 + */ 1567 + 1568 + if (wk->offchan_tx.wait && wk->offchan_tx.frame) 1569 + cfg80211_mgmt_tx_status(wk->sdata->dev, 1570 + (unsigned long) wk->offchan_tx.frame, 1571 + wk->ie, wk->ie_len, false, GFP_KERNEL); 1572 + 1573 + return WORK_DONE_DESTROY; 1574 + } 1575 + 1554 1576 static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev, 1555 - struct ieee80211_channel *chan, 1577 + struct ieee80211_channel *chan, bool offchan, 1556 1578 enum nl80211_channel_type channel_type, 1557 - bool channel_type_valid, 1579 + bool channel_type_valid, unsigned int wait, 1558 1580 const u8 *buf, size_t len, u64 *cookie) 1559 1581 { 1560 1582 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1561 1583 struct ieee80211_local *local = sdata->local; 1562 1584 struct sk_buff *skb; 1563 1585 struct sta_info *sta; 1586 + struct ieee80211_work *wk; 1564 1587 const struct ieee80211_mgmt *mgmt = (void *)buf; 1565 1588 u32 flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX | 1566 1589 IEEE80211_TX_CTL_REQ_TX_STATUS; 1590 + bool is_offchan = false; 1567 1591 1568 1592 /* Check that we are on the requested channel for transmission */ 1569 1593 if (chan != local->tmp_channel && 1570 1594 chan != local->oper_channel) 1571 - return -EBUSY; 1595 + is_offchan = true; 1572 1596 if (channel_type_valid && 1573 1597 (channel_type != local->tmp_channel_type && 1574 1598 channel_type != local->_oper_channel_type)) 1599 + is_offchan = true; 1600 + 1601 + if (is_offchan && !offchan) 1575 1602 return -EBUSY; 1576 1603 1577 1604 switch (sdata->vif.type) { ··· 1632 1605 IEEE80211_SKB_CB(skb)->flags = flags; 1633 1606 1634 1607 skb->dev = sdata->dev; 1635 - ieee80211_tx_skb(sdata, skb); 1636 1608 1637 1609 *cookie = (unsigned long) skb; 1610 + 1611 + /* 1612 + * Can transmit right away if the channel was the 1613 + * right one and there's no wait involved... If a 1614 + * wait is involved, we might otherwise not be on 1615 + * the right channel for long enough! 1616 + */ 1617 + if (!is_offchan && !wait && !sdata->vif.bss_conf.idle) { 1618 + ieee80211_tx_skb(sdata, skb); 1619 + return 0; 1620 + } 1621 + 1622 + wk = kzalloc(sizeof(*wk) + len, GFP_KERNEL); 1623 + if (!wk) { 1624 + kfree_skb(skb); 1625 + return -ENOMEM; 1626 + } 1627 + 1628 + wk->type = IEEE80211_WORK_OFFCHANNEL_TX; 1629 + wk->chan = chan; 1630 + wk->sdata = sdata; 1631 + wk->done = ieee80211_offchan_tx_done; 1632 + wk->offchan_tx.frame = skb; 1633 + wk->offchan_tx.wait = wait; 1634 + wk->ie_len = len; 1635 + memcpy(wk->ie, buf, len); 1636 + 1637 + ieee80211_add_work(wk); 1638 1638 return 0; 1639 + } 1640 + 1641 + static int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, 1642 + struct net_device *dev, 1643 + u64 cookie) 1644 + { 1645 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1646 + struct ieee80211_local *local = sdata->local; 1647 + struct ieee80211_work *wk; 1648 + int ret = -ENOENT; 1649 + 1650 + mutex_lock(&local->mtx); 1651 + list_for_each_entry(wk, &local->work_list, list) { 1652 + if (wk->sdata != sdata) 1653 + continue; 1654 + 1655 + if (wk->type != IEEE80211_WORK_OFFCHANNEL_TX) 1656 + continue; 1657 + 1658 + if (cookie != (unsigned long) wk->offchan_tx.frame) 1659 + continue; 1660 + 1661 + wk->timeout = jiffies; 1662 + 1663 + ieee80211_queue_work(&local->hw, &local->work_work); 1664 + ret = 0; 1665 + break; 1666 + } 1667 + mutex_unlock(&local->mtx); 1668 + 1669 + return ret; 1639 1670 } 1640 1671 1641 1672 static void ieee80211_mgmt_frame_register(struct wiphy *wiphy, ··· 1780 1695 .remain_on_channel = ieee80211_remain_on_channel, 1781 1696 .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel, 1782 1697 .mgmt_tx = ieee80211_mgmt_tx, 1698 + .mgmt_tx_cancel_wait = ieee80211_mgmt_tx_cancel_wait, 1783 1699 .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config, 1784 1700 .mgmt_frame_register = ieee80211_mgmt_frame_register, 1785 1701 .set_antenna = ieee80211_set_antenna,
+19 -18
net/mac80211/debugfs_sta.c
··· 112 112 char buf[71 + STA_TID_NUM * 40], *p = buf; 113 113 int i; 114 114 struct sta_info *sta = file->private_data; 115 + struct tid_ampdu_rx *tid_rx; 116 + struct tid_ampdu_tx *tid_tx; 115 117 116 - spin_lock_bh(&sta->lock); 118 + rcu_read_lock(); 119 + 117 120 p += scnprintf(p, sizeof(buf) + buf - p, "next dialog_token: %#02x\n", 118 121 sta->ampdu_mlme.dialog_token_allocator + 1); 119 122 p += scnprintf(p, sizeof(buf) + buf - p, 120 123 "TID\t\tRX active\tDTKN\tSSN\t\tTX\tDTKN\tpending\n"); 121 - for (i = 0; i < STA_TID_NUM; i++) { 122 - p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i); 123 - p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", 124 - !!sta->ampdu_mlme.tid_rx[i]); 125 - p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", 126 - sta->ampdu_mlme.tid_rx[i] ? 127 - sta->ampdu_mlme.tid_rx[i]->dialog_token : 0); 128 - p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x", 129 - sta->ampdu_mlme.tid_rx[i] ? 130 - sta->ampdu_mlme.tid_rx[i]->ssn : 0); 131 124 132 - p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", 133 - !!sta->ampdu_mlme.tid_tx[i]); 125 + for (i = 0; i < STA_TID_NUM; i++) { 126 + tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]); 127 + tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[i]); 128 + 129 + p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i); 130 + p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", !!tid_rx); 134 131 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", 135 - sta->ampdu_mlme.tid_tx[i] ? 136 - sta->ampdu_mlme.tid_tx[i]->dialog_token : 0); 132 + tid_rx ? tid_rx->dialog_token : 0); 133 + p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x", 134 + tid_rx ? tid_rx->ssn : 0); 135 + 136 + p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", !!tid_tx); 137 + p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", 138 + tid_tx ? tid_tx->dialog_token : 0); 137 139 p += scnprintf(p, sizeof(buf) + buf - p, "\t%03d", 138 - sta->ampdu_mlme.tid_tx[i] ? 139 - skb_queue_len(&sta->ampdu_mlme.tid_tx[i]->pending) : 0); 140 + tid_tx ? skb_queue_len(&tid_tx->pending) : 0); 140 141 p += scnprintf(p, sizeof(buf) + buf - p, "\n"); 141 142 } 142 - spin_unlock_bh(&sta->lock); 143 + rcu_read_unlock(); 143 144 144 145 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); 145 146 }
+5
net/mac80211/ieee80211_i.h
··· 260 260 IEEE80211_WORK_ASSOC_BEACON_WAIT, 261 261 IEEE80211_WORK_ASSOC, 262 262 IEEE80211_WORK_REMAIN_ON_CHANNEL, 263 + IEEE80211_WORK_OFFCHANNEL_TX, 263 264 }; 264 265 265 266 /** ··· 321 320 struct { 322 321 u32 duration; 323 322 } remain; 323 + struct { 324 + struct sk_buff *frame; 325 + u32 wait; 326 + } offchan_tx; 324 327 }; 325 328 326 329 int ie_len;
+21 -7
net/mac80211/rx.c
··· 538 538 { 539 539 struct sk_buff *skb = tid_agg_rx->reorder_buf[index]; 540 540 541 + lockdep_assert_held(&tid_agg_rx->reorder_lock); 542 + 541 543 if (!skb) 542 544 goto no_frame; 543 545 ··· 558 556 struct sk_buff_head *frames) 559 557 { 560 558 int index; 559 + 560 + lockdep_assert_held(&tid_agg_rx->reorder_lock); 561 561 562 562 while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) { 563 563 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % ··· 584 580 struct sk_buff_head *frames) 585 581 { 586 582 int index, j; 583 + 584 + lockdep_assert_held(&tid_agg_rx->reorder_lock); 587 585 588 586 /* release the buffer until next missing frame */ 589 587 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % ··· 689 683 int index; 690 684 bool ret = true; 691 685 686 + spin_lock(&tid_agg_rx->reorder_lock); 687 + 692 688 buf_size = tid_agg_rx->buf_size; 693 689 head_seq_num = tid_agg_rx->head_seq_num; 694 690 695 - spin_lock(&tid_agg_rx->reorder_lock); 696 691 /* frame with out of date sequence number */ 697 692 if (seq_less(mpdu_seq_num, head_seq_num)) { 698 693 dev_kfree_skb(skb); ··· 1877 1870 dev->stats.rx_packets++; 1878 1871 dev->stats.rx_bytes += rx->skb->len; 1879 1872 1880 - if (ieee80211_is_data(hdr->frame_control) && 1881 - !is_multicast_ether_addr(hdr->addr1) && 1882 - local->hw.conf.dynamic_ps_timeout > 0 && local->ps_sdata) { 1873 + if (local->ps_sdata && local->hw.conf.dynamic_ps_timeout > 0 && 1874 + !is_multicast_ether_addr(((struct ethhdr *)rx->skb->data)->h_dest)) { 1883 1875 mod_timer(&local->dynamic_ps_timer, jiffies + 1884 1876 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); 1885 1877 } ··· 1927 1921 mod_timer(&tid_agg_rx->session_timer, 1928 1922 TU_TO_EXP_TIME(tid_agg_rx->timeout)); 1929 1923 1924 + spin_lock(&tid_agg_rx->reorder_lock); 1930 1925 /* release stored frames up to start of BAR */ 1931 1926 ieee80211_release_reorder_frames(hw, tid_agg_rx, start_seq_num, 1932 1927 frames); 1928 + spin_unlock(&tid_agg_rx->reorder_lock); 1929 + 1933 1930 kfree_skb(skb); 1934 1931 return RX_QUEUED; 1935 1932 } ··· 2254 2245 break; 2255 2246 case cpu_to_le16(IEEE80211_STYPE_DEAUTH): 2256 2247 case cpu_to_le16(IEEE80211_STYPE_DISASSOC): 2248 + if (is_multicast_ether_addr(mgmt->da) && 2249 + !is_broadcast_ether_addr(mgmt->da)) 2250 + return RX_DROP_MONITOR; 2251 + 2257 2252 /* process only for station */ 2258 2253 if (sdata->vif.type != NL80211_IFTYPE_STATION) 2259 2254 return RX_DROP_MONITOR; ··· 2528 2515 } 2529 2516 2530 2517 /* 2531 - * This function makes calls into the RX path. Therefore the 2532 - * caller must hold the sta_info->lock and everything has to 2533 - * be under rcu_read_lock protection as well. 2518 + * This function makes calls into the RX path, therefore 2519 + * it has to be invoked under RCU read lock. 2534 2520 */ 2535 2521 void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) 2536 2522 { ··· 2751 2739 2752 2740 if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) 2753 2741 return; 2742 + goto out; 2754 2743 } 2755 2744 } 2756 2745 ··· 2791 2778 return; 2792 2779 } 2793 2780 2781 + out: 2794 2782 dev_kfree_skb(skb); 2795 2783 } 2796 2784
+14 -15
net/mac80211/sta_info.h
··· 81 81 * @stop_initiator: initiator of a session stop 82 82 * @tx_stop: TX DelBA frame when stopping 83 83 * 84 - * This structure is protected by RCU and the per-station 85 - * spinlock. Assignments to the array holding it must hold 86 - * the spinlock, only the TX path can access it under RCU 87 - * lock-free if, and only if, the state has the flag 88 - * %HT_AGG_STATE_OPERATIONAL set. Otherwise, the TX path 89 - * must also acquire the spinlock and re-check the state, 90 - * see comments in the tx code touching it. 84 + * This structure's lifetime is managed by RCU, assignments to 85 + * the array holding it must hold the aggregation mutex. 86 + * 87 + * The TX path can access it under RCU lock-free if, and 88 + * only if, the state has the flag %HT_AGG_STATE_OPERATIONAL 89 + * set. Otherwise, the TX path must also acquire the spinlock 90 + * and re-check the state, see comments in the tx code 91 + * touching it. 91 92 */ 92 93 struct tid_ampdu_tx { 93 94 struct rcu_head rcu_head; ··· 116 115 * @rcu_head: RCU head used for freeing this struct 117 116 * @reorder_lock: serializes access to reorder buffer, see below. 118 117 * 119 - * This structure is protected by RCU and the per-station 120 - * spinlock. Assignments to the array holding it must hold 121 - * the spinlock. 118 + * This structure's lifetime is managed by RCU, assignments to 119 + * the array holding it must hold the aggregation mutex. 122 120 * 123 - * The @reorder_lock is used to protect the variables and 124 - * arrays such as @reorder_buf, @reorder_time, @head_seq_num, 125 - * @stored_mpdu_num and @reorder_time from being corrupted by 126 - * concurrent access of the RX path and the expired frame 127 - * release timer. 121 + * The @reorder_lock is used to protect the members of this 122 + * struct, except for @timeout, @buf_size and @dialog_token, 123 + * which are constant across the lifetime of the struct (the 124 + * dialog token being used only for debugging). 128 125 */ 129 126 struct tid_ampdu_rx { 130 127 struct rcu_head rcu_head;
+14 -1
net/mac80211/status.c
··· 321 321 msecs_to_jiffies(10)); 322 322 } 323 323 324 - if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) 324 + if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) { 325 + struct ieee80211_work *wk; 326 + 327 + rcu_read_lock(); 328 + list_for_each_entry_rcu(wk, &local->work_list, list) { 329 + if (wk->type != IEEE80211_WORK_OFFCHANNEL_TX) 330 + continue; 331 + if (wk->offchan_tx.frame != skb) 332 + continue; 333 + wk->offchan_tx.frame = NULL; 334 + break; 335 + } 336 + rcu_read_unlock(); 325 337 cfg80211_mgmt_tx_status( 326 338 skb->dev, (unsigned long) skb, skb->data, skb->len, 327 339 !!(info->flags & IEEE80211_TX_STAT_ACK), GFP_ATOMIC); 340 + } 328 341 329 342 /* this was a transmitted frame, but now we want to reuse it */ 330 343 skb_orphan(skb);
+6 -1
net/mac80211/tx.c
··· 1595 1595 list) { 1596 1596 if (!ieee80211_sdata_running(tmp_sdata)) 1597 1597 continue; 1598 - if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) 1598 + if (tmp_sdata->vif.type == 1599 + NL80211_IFTYPE_MONITOR || 1600 + tmp_sdata->vif.type == 1601 + NL80211_IFTYPE_AP_VLAN || 1602 + tmp_sdata->vif.type == 1603 + NL80211_IFTYPE_WDS) 1599 1604 continue; 1600 1605 if (compare_ether_addr(tmp_sdata->vif.addr, 1601 1606 hdr->addr2) == 0) {
+22
net/mac80211/work.c
··· 561 561 } 562 562 563 563 static enum work_action __must_check 564 + ieee80211_offchannel_tx(struct ieee80211_work *wk) 565 + { 566 + if (!wk->started) { 567 + wk->timeout = jiffies + msecs_to_jiffies(wk->offchan_tx.wait); 568 + 569 + /* 570 + * After this, offchan_tx.frame remains but now is no 571 + * longer a valid pointer -- we still need it as the 572 + * cookie for canceling this work. 573 + */ 574 + ieee80211_tx_skb(wk->sdata, wk->offchan_tx.frame); 575 + 576 + return WORK_ACT_NONE; 577 + } 578 + 579 + return WORK_ACT_TIMEOUT; 580 + } 581 + 582 + static enum work_action __must_check 564 583 ieee80211_assoc_beacon_wait(struct ieee80211_work *wk) 565 584 { 566 585 if (wk->started) ··· 973 954 break; 974 955 case IEEE80211_WORK_REMAIN_ON_CHANNEL: 975 956 rma = ieee80211_remain_on_channel_timeout(wk); 957 + break; 958 + case IEEE80211_WORK_OFFCHANNEL_TX: 959 + rma = ieee80211_offchannel_tx(wk); 976 960 break; 977 961 case IEEE80211_WORK_ASSOC_BEACON_WAIT: 978 962 rma = ieee80211_assoc_beacon_wait(wk);
+2 -2
net/wireless/core.h
··· 341 341 void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev); 342 342 int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, 343 343 struct net_device *dev, 344 - struct ieee80211_channel *chan, 344 + struct ieee80211_channel *chan, bool offchan, 345 345 enum nl80211_channel_type channel_type, 346 - bool channel_type_valid, 346 + bool channel_type_valid, unsigned int wait, 347 347 const u8 *buf, size_t len, u64 *cookie); 348 348 349 349 /* SME */
+5 -4
net/wireless/mlme.c
··· 864 864 865 865 int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, 866 866 struct net_device *dev, 867 - struct ieee80211_channel *chan, 867 + struct ieee80211_channel *chan, bool offchan, 868 868 enum nl80211_channel_type channel_type, 869 - bool channel_type_valid, 869 + bool channel_type_valid, unsigned int wait, 870 870 const u8 *buf, size_t len, u64 *cookie) 871 871 { 872 872 struct wireless_dev *wdev = dev->ieee80211_ptr; ··· 946 946 return -EINVAL; 947 947 948 948 /* Transmit the Action frame as requested by user space */ 949 - return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, channel_type, 950 - channel_type_valid, buf, len, cookie); 949 + return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, offchan, 950 + channel_type, channel_type_valid, 951 + wait, buf, len, cookie); 951 952 } 952 953 953 954 bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf,
+51 -6
net/wireless/nl80211.c
··· 163 163 [NL80211_ATTR_CQM] = { .type = NLA_NESTED, }, 164 164 [NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG }, 165 165 [NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 }, 166 - 167 166 [NL80211_ATTR_WIPHY_TX_POWER_SETTING] = { .type = NLA_U32 }, 168 167 [NL80211_ATTR_WIPHY_TX_POWER_LEVEL] = { .type = NLA_U32 }, 169 - 170 168 [NL80211_ATTR_FRAME_TYPE] = { .type = NLA_U16 }, 171 - 172 169 [NL80211_ATTR_WIPHY_ANTENNA_TX] = { .type = NLA_U32 }, 173 170 [NL80211_ATTR_WIPHY_ANTENNA_RX] = { .type = NLA_U32 }, 174 - 175 171 [NL80211_ATTR_MCAST_RATE] = { .type = NLA_U32 }, 172 + [NL80211_ATTR_OFFCHANNEL_TX_OK] = { .type = NLA_FLAG }, 176 173 }; 177 174 178 175 /* policy for the key attributes */ ··· 674 677 CMD(remain_on_channel, REMAIN_ON_CHANNEL); 675 678 CMD(set_bitrate_mask, SET_TX_BITRATE_MASK); 676 679 CMD(mgmt_tx, FRAME); 680 + CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL); 677 681 if (dev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { 678 682 i++; 679 683 NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); ··· 695 697 } 696 698 697 699 nla_nest_end(msg, nl_cmds); 700 + 701 + /* for now at least assume all drivers have it */ 702 + if (dev->ops->mgmt_tx) 703 + NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK); 698 704 699 705 if (mgmt_stypes) { 700 706 u16 stypes; ··· 4246 4244 void *hdr; 4247 4245 u64 cookie; 4248 4246 struct sk_buff *msg; 4247 + unsigned int wait = 0; 4248 + bool offchan; 4249 4249 4250 4250 if (!info->attrs[NL80211_ATTR_FRAME] || 4251 4251 !info->attrs[NL80211_ATTR_WIPHY_FREQ]) ··· 4264 4260 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 4265 4261 return -EOPNOTSUPP; 4266 4262 4263 + if (info->attrs[NL80211_ATTR_DURATION]) { 4264 + if (!rdev->ops->mgmt_tx_cancel_wait) 4265 + return -EINVAL; 4266 + wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); 4267 + } 4268 + 4267 4269 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { 4268 4270 channel_type = nla_get_u32( 4269 4271 info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); ··· 4280 4270 return -EINVAL; 4281 4271 channel_type_valid = true; 4282 4272 } 4273 + 4274 + offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; 4283 4275 4284 4276 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); 4285 4277 chan = rdev_freq_to_chan(rdev, freq, channel_type); ··· 4299 4287 err = PTR_ERR(hdr); 4300 4288 goto free_msg; 4301 4289 } 4302 - err = cfg80211_mlme_mgmt_tx(rdev, dev, chan, channel_type, 4303 - channel_type_valid, 4290 + err = cfg80211_mlme_mgmt_tx(rdev, dev, chan, offchan, channel_type, 4291 + channel_type_valid, wait, 4304 4292 nla_data(info->attrs[NL80211_ATTR_FRAME]), 4305 4293 nla_len(info->attrs[NL80211_ATTR_FRAME]), 4306 4294 &cookie); ··· 4317 4305 free_msg: 4318 4306 nlmsg_free(msg); 4319 4307 return err; 4308 + } 4309 + 4310 + static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *info) 4311 + { 4312 + struct cfg80211_registered_device *rdev = info->user_ptr[0]; 4313 + struct net_device *dev = info->user_ptr[1]; 4314 + u64 cookie; 4315 + 4316 + if (!info->attrs[NL80211_ATTR_COOKIE]) 4317 + return -EINVAL; 4318 + 4319 + if (!rdev->ops->mgmt_tx_cancel_wait) 4320 + return -EOPNOTSUPP; 4321 + 4322 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && 4323 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && 4324 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && 4325 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 4326 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && 4327 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 4328 + return -EOPNOTSUPP; 4329 + 4330 + cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); 4331 + 4332 + return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, dev, cookie); 4320 4333 } 4321 4334 4322 4335 static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info) ··· 4911 4874 { 4912 4875 .cmd = NL80211_CMD_FRAME, 4913 4876 .doit = nl80211_tx_mgmt, 4877 + .policy = nl80211_policy, 4878 + .flags = GENL_ADMIN_PERM, 4879 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 4880 + NL80211_FLAG_NEED_RTNL, 4881 + }, 4882 + { 4883 + .cmd = NL80211_CMD_FRAME_WAIT_CANCEL, 4884 + .doit = nl80211_tx_mgmt_cancel_wait, 4914 4885 .policy = nl80211_policy, 4915 4886 .flags = GENL_ADMIN_PERM, 4916 4887 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |