aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath5k')
-rw-r--r--drivers/net/wireless/ath5k/Kconfig3
-rw-r--r--drivers/net/wireless/ath5k/base.c263
-rw-r--r--drivers/net/wireless/ath5k/base.h32
-rw-r--r--drivers/net/wireless/ath5k/hw.c4
4 files changed, 138 insertions, 164 deletions
diff --git a/drivers/net/wireless/ath5k/Kconfig b/drivers/net/wireless/ath5k/Kconfig
index f1f2aea2eab4..75383a5df992 100644
--- a/drivers/net/wireless/ath5k/Kconfig
+++ b/drivers/net/wireless/ath5k/Kconfig
@@ -1,6 +1,9 @@
1config ATH5K 1config ATH5K
2 tristate "Atheros 5xxx wireless cards support" 2 tristate "Atheros 5xxx wireless cards support"
3 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL 3 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
4 select MAC80211_LEDS
5 select LEDS_CLASS
6 select NEW_LEDS
4 ---help--- 7 ---help---
5 This module adds support for wireless adapters based on 8 This module adds support for wireless adapters based on
6 Atheros 5xxx chipset. 9 Atheros 5xxx chipset.
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 85045afc1ba7..a43e9b25169b 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -58,11 +58,6 @@
58#include "reg.h" 58#include "reg.h"
59#include "debug.h" 59#include "debug.h"
60 60
61enum {
62 ATH_LED_TX,
63 ATH_LED_RX,
64};
65
66static int ath5k_calinterval = 10; /* Calibrate PHY every 10 secs (TODO: Fixme) */ 61static int ath5k_calinterval = 10; /* Calibrate PHY every 10 secs (TODO: Fixme) */
67 62
68 63
@@ -309,13 +304,10 @@ static void ath5k_tasklet_reset(unsigned long data);
309 304
310static void ath5k_calibrate(unsigned long data); 305static void ath5k_calibrate(unsigned long data);
311/* LED functions */ 306/* LED functions */
312static void ath5k_led_off(unsigned long data); 307static int ath5k_init_leds(struct ath5k_softc *sc);
313static void ath5k_led_blink(struct ath5k_softc *sc, 308static void ath5k_led_enable(struct ath5k_softc *sc);
314 unsigned int on, 309static void ath5k_led_off(struct ath5k_softc *sc);
315 unsigned int off); 310static void ath5k_unregister_leds(struct ath5k_softc *sc);
316static void ath5k_led_event(struct ath5k_softc *sc,
317 int event);
318
319 311
320/* 312/*
321 * Module init/exit functions 313 * Module init/exit functions
@@ -596,8 +588,7 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
596 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 588 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
597 struct ath5k_softc *sc = hw->priv; 589 struct ath5k_softc *sc = hw->priv;
598 590
599 if (test_bit(ATH_STAT_LEDSOFT, sc->status)) 591 ath5k_led_off(sc);
600 ath5k_hw_set_gpio(sc->ah, sc->led_pin, 1);
601 592
602 ath5k_stop_hw(sc); 593 ath5k_stop_hw(sc);
603 pci_save_state(pdev); 594 pci_save_state(pdev);
@@ -632,10 +623,7 @@ ath5k_pci_resume(struct pci_dev *pdev)
632 pci_write_config_byte(pdev, 0x41, 0); 623 pci_write_config_byte(pdev, 0x41, 0);
633 624
634 ath5k_init(sc); 625 ath5k_init(sc);
635 if (test_bit(ATH_STAT_LEDSOFT, sc->status)) { 626 ath5k_led_enable(sc);
636 ath5k_hw_set_gpio_output(ah, sc->led_pin);
637 ath5k_hw_set_gpio(ah, sc->led_pin, 0);
638 }
639 627
640 /* 628 /*
641 * Reset the key cache since some parts do not 629 * Reset the key cache since some parts do not
@@ -742,27 +730,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
742 tasklet_init(&sc->txtq, ath5k_tasklet_tx, (unsigned long)sc); 730 tasklet_init(&sc->txtq, ath5k_tasklet_tx, (unsigned long)sc);
743 tasklet_init(&sc->restq, ath5k_tasklet_reset, (unsigned long)sc); 731 tasklet_init(&sc->restq, ath5k_tasklet_reset, (unsigned long)sc);
744 setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc); 732 setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc);
745 setup_timer(&sc->led_tim, ath5k_led_off, (unsigned long)sc);
746
747 sc->led_on = 0; /* low true */
748 /*
749 * Auto-enable soft led processing for IBM cards and for
750 * 5211 minipci cards.
751 */
752 if (pdev->device == PCI_DEVICE_ID_ATHEROS_AR5212_IBM ||
753 pdev->device == PCI_DEVICE_ID_ATHEROS_AR5211) {
754 __set_bit(ATH_STAT_LEDSOFT, sc->status);
755 sc->led_pin = 0;
756 }
757 /* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */
758 if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ) {
759 __set_bit(ATH_STAT_LEDSOFT, sc->status);
760 sc->led_pin = 0;
761 }
762 if (test_bit(ATH_STAT_LEDSOFT, sc->status)) {
763 ath5k_hw_set_gpio_output(ah, sc->led_pin);
764 ath5k_hw_set_gpio(ah, sc->led_pin, !sc->led_on);
765 }
766 733
767 ath5k_hw_get_lladdr(ah, mac); 734 ath5k_hw_get_lladdr(ah, mac);
768 SET_IEEE80211_PERM_ADDR(hw, mac); 735 SET_IEEE80211_PERM_ADDR(hw, mac);
@@ -776,6 +743,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
776 goto err_queues; 743 goto err_queues;
777 } 744 }
778 745
746 ath5k_init_leds(sc);
747
779 return 0; 748 return 0;
780err_queues: 749err_queues:
781 ath5k_txq_release(sc); 750 ath5k_txq_release(sc);
@@ -809,6 +778,7 @@ ath5k_detach(struct pci_dev *pdev, struct ieee80211_hw *hw)
809 ath5k_desc_free(sc, pdev); 778 ath5k_desc_free(sc, pdev);
810 ath5k_txq_release(sc); 779 ath5k_txq_release(sc);
811 ath5k_hw_release_tx_queue(sc->ah, sc->bhalq); 780 ath5k_hw_release_tx_queue(sc->ah, sc->bhalq);
781 ath5k_unregister_leds(sc);
812 782
813 /* 783 /*
814 * NB: can't reclaim these until after ieee80211_ifdetach 784 * NB: can't reclaim these until after ieee80211_ifdetach
@@ -1060,65 +1030,9 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
1060 return 0; 1030 return 0;
1061} 1031}
1062 1032
1063/*
1064 * TODO: CLEAN THIS !!!
1065 */
1066static void 1033static void
1067ath5k_setcurmode(struct ath5k_softc *sc, unsigned int mode) 1034ath5k_setcurmode(struct ath5k_softc *sc, unsigned int mode)
1068{ 1035{
1069 if (unlikely(test_bit(ATH_STAT_LEDSOFT, sc->status))) {
1070 /* from Atheros NDIS driver, w/ permission */
1071 static const struct {
1072 u16 rate; /* tx/rx 802.11 rate */
1073 u16 timeOn; /* LED on time (ms) */
1074 u16 timeOff; /* LED off time (ms) */
1075 } blinkrates[] = {
1076 { 108, 40, 10 },
1077 { 96, 44, 11 },
1078 { 72, 50, 13 },
1079 { 48, 57, 14 },
1080 { 36, 67, 16 },
1081 { 24, 80, 20 },
1082 { 22, 100, 25 },
1083 { 18, 133, 34 },
1084 { 12, 160, 40 },
1085 { 10, 200, 50 },
1086 { 6, 240, 58 },
1087 { 4, 267, 66 },
1088 { 2, 400, 100 },
1089 { 0, 500, 130 }
1090 };
1091 const struct ath5k_rate_table *rt =
1092 ath5k_hw_get_rate_table(sc->ah, mode);
1093 unsigned int i, j;
1094
1095 BUG_ON(rt == NULL);
1096
1097 memset(sc->hwmap, 0, sizeof(sc->hwmap));
1098 for (i = 0; i < 32; i++) {
1099 u8 ix = rt->rate_code_to_index[i];
1100 if (ix == 0xff) {
1101 sc->hwmap[i].ledon = msecs_to_jiffies(500);
1102 sc->hwmap[i].ledoff = msecs_to_jiffies(130);
1103 continue;
1104 }
1105 sc->hwmap[i].txflags = IEEE80211_RADIOTAP_F_DATAPAD;
1106 /* receive frames include FCS */
1107 sc->hwmap[i].rxflags = sc->hwmap[i].txflags |
1108 IEEE80211_RADIOTAP_F_FCS;
1109 /* setup blink rate table to avoid per-packet lookup */
1110 for (j = 0; j < ARRAY_SIZE(blinkrates) - 1; j++)
1111 if (blinkrates[j].rate == /* XXX why 7f? */
1112 (rt->rates[ix].dot11_rate&0x7f))
1113 break;
1114
1115 sc->hwmap[i].ledon = msecs_to_jiffies(blinkrates[j].
1116 timeOn);
1117 sc->hwmap[i].ledoff = msecs_to_jiffies(blinkrates[j].
1118 timeOff);
1119 }
1120 }
1121
1122 sc->curmode = mode; 1036 sc->curmode = mode;
1123 1037
1124 if (mode == AR5K_MODE_11A) { 1038 if (mode == AR5K_MODE_11A) {
@@ -1691,9 +1605,9 @@ ath5k_rx_decrypted(struct ath5k_softc *sc, struct ath5k_desc *ds,
1691 /* Apparently when a default key is used to decrypt the packet 1605 /* Apparently when a default key is used to decrypt the packet
1692 the hw does not set the index used to decrypt. In such cases 1606 the hw does not set the index used to decrypt. In such cases
1693 get the index from the packet. */ 1607 get the index from the packet. */
1694 if ((le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_PROTECTED) && 1608 if (ieee80211_has_protected(hdr->frame_control) &&
1695 !(rs->rs_status & AR5K_RXERR_DECRYPT) && 1609 !(rs->rs_status & AR5K_RXERR_DECRYPT) &&
1696 skb->len >= hlen + 4) { 1610 skb->len >= hlen + 4) {
1697 keyix = skb->data[hlen + 3] >> 6; 1611 keyix = skb->data[hlen + 3] >> 6;
1698 1612
1699 if (test_bit(keyix, sc->keymap)) 1613 if (test_bit(keyix, sc->keymap))
@@ -1712,10 +1626,7 @@ ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb,
1712 u32 hw_tu; 1626 u32 hw_tu;
1713 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; 1627 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1714 1628
1715 if ((le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_FTYPE) == 1629 if (ieee80211_is_beacon(mgmt->frame_control) &&
1716 IEEE80211_FTYPE_MGMT &&
1717 (le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE) ==
1718 IEEE80211_STYPE_BEACON &&
1719 le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS && 1630 le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS &&
1720 memcmp(mgmt->bssid, sc->ah->ah_bssid, ETH_ALEN) == 0) { 1631 memcmp(mgmt->bssid, sc->ah->ah_bssid, ETH_ALEN) == 0) {
1721 /* 1632 /*
@@ -1903,8 +1814,6 @@ accept:
1903 ath5k_check_ibss_tsf(sc, skb, &rxs); 1814 ath5k_check_ibss_tsf(sc, skb, &rxs);
1904 1815
1905 __ieee80211_rx(sc->hw, skb, &rxs); 1816 __ieee80211_rx(sc->hw, skb, &rxs);
1906 sc->led_rxrate = rs.rs_rate;
1907 ath5k_led_event(sc, ATH_LED_RX);
1908next: 1817next:
1909 list_move_tail(&bf->list, &sc->rxbuf); 1818 list_move_tail(&bf->list, &sc->rxbuf);
1910 } while (ath5k_rxbuf_setup(sc, bf) == 0); 1819 } while (ath5k_rxbuf_setup(sc, bf) == 0);
@@ -1985,13 +1894,9 @@ ath5k_tasklet_tx(unsigned long data)
1985 struct ath5k_softc *sc = (void *)data; 1894 struct ath5k_softc *sc = (void *)data;
1986 1895
1987 ath5k_tx_processq(sc, sc->txq); 1896 ath5k_tx_processq(sc, sc->txq);
1988
1989 ath5k_led_event(sc, ATH_LED_TX);
1990} 1897}
1991 1898
1992 1899
1993
1994
1995/*****************\ 1900/*****************\
1996* Beacon handling * 1901* Beacon handling *
1997\*****************/ 1902\*****************/
@@ -2366,11 +2271,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
2366 ieee80211_stop_queues(sc->hw); 2271 ieee80211_stop_queues(sc->hw);
2367 2272
2368 if (!test_bit(ATH_STAT_INVALID, sc->status)) { 2273 if (!test_bit(ATH_STAT_INVALID, sc->status)) {
2369 if (test_bit(ATH_STAT_LEDSOFT, sc->status)) { 2274 ath5k_led_off(sc);
2370 del_timer_sync(&sc->led_tim);
2371 ath5k_hw_set_gpio(ah, sc->led_pin, !sc->led_on);
2372 __clear_bit(ATH_STAT_LEDBLINKING, sc->status);
2373 }
2374 ath5k_hw_set_intr(ah, 0); 2275 ath5k_hw_set_intr(ah, 0);
2375 } 2276 }
2376 ath5k_txq_cleanup(sc); 2277 ath5k_txq_cleanup(sc);
@@ -2566,55 +2467,124 @@ ath5k_calibrate(unsigned long data)
2566\***************/ 2467\***************/
2567 2468
2568static void 2469static void
2569ath5k_led_off(unsigned long data) 2470ath5k_led_enable(struct ath5k_softc *sc)
2570{ 2471{
2571 struct ath5k_softc *sc = (void *)data; 2472 if (test_bit(ATH_STAT_LEDSOFT, sc->status)) {
2572 2473 ath5k_hw_set_gpio_output(sc->ah, sc->led_pin);
2573 if (test_bit(ATH_STAT_LEDENDBLINK, sc->status)) 2474 ath5k_led_off(sc);
2574 __clear_bit(ATH_STAT_LEDBLINKING, sc->status);
2575 else {
2576 __set_bit(ATH_STAT_LEDENDBLINK, sc->status);
2577 ath5k_hw_set_gpio(sc->ah, sc->led_pin, !sc->led_on);
2578 mod_timer(&sc->led_tim, jiffies + sc->led_off);
2579 } 2475 }
2580} 2476}
2581 2477
2582/*
2583 * Blink the LED according to the specified on/off times.
2584 */
2585static void 2478static void
2586ath5k_led_blink(struct ath5k_softc *sc, unsigned int on, 2479ath5k_led_on(struct ath5k_softc *sc)
2587 unsigned int off)
2588{ 2480{
2589 ATH5K_DBG(sc, ATH5K_DEBUG_LED, "on %u off %u\n", on, off); 2481 if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
2482 return;
2590 ath5k_hw_set_gpio(sc->ah, sc->led_pin, sc->led_on); 2483 ath5k_hw_set_gpio(sc->ah, sc->led_pin, sc->led_on);
2591 __set_bit(ATH_STAT_LEDBLINKING, sc->status);
2592 __clear_bit(ATH_STAT_LEDENDBLINK, sc->status);
2593 sc->led_off = off;
2594 mod_timer(&sc->led_tim, jiffies + on);
2595} 2484}
2596 2485
2597static void 2486static void
2598ath5k_led_event(struct ath5k_softc *sc, int event) 2487ath5k_led_off(struct ath5k_softc *sc)
2599{ 2488{
2600 if (likely(!test_bit(ATH_STAT_LEDSOFT, sc->status))) 2489 if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
2601 return; 2490 return;
2602 if (unlikely(test_bit(ATH_STAT_LEDBLINKING, sc->status))) 2491 ath5k_hw_set_gpio(sc->ah, sc->led_pin, !sc->led_on);
2603 return; /* don't interrupt active blink */ 2492}
2604 switch (event) { 2493
2605 case ATH_LED_TX: 2494static void
2606 ath5k_led_blink(sc, sc->hwmap[sc->led_txrate].ledon, 2495ath5k_led_brightness_set(struct led_classdev *led_dev,
2607 sc->hwmap[sc->led_txrate].ledoff); 2496 enum led_brightness brightness)
2608 break; 2497{
2609 case ATH_LED_RX: 2498 struct ath5k_led *led = container_of(led_dev, struct ath5k_led,
2610 ath5k_led_blink(sc, sc->hwmap[sc->led_rxrate].ledon, 2499 led_dev);
2611 sc->hwmap[sc->led_rxrate].ledoff); 2500
2612 break; 2501 if (brightness == LED_OFF)
2502 ath5k_led_off(led->sc);
2503 else
2504 ath5k_led_on(led->sc);
2505}
2506
2507static int
2508ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led,
2509 const char *name, char *trigger)
2510{
2511 int err;
2512
2513 led->sc = sc;
2514 strncpy(led->name, name, sizeof(led->name));
2515 led->led_dev.name = led->name;
2516 led->led_dev.default_trigger = trigger;
2517 led->led_dev.brightness_set = ath5k_led_brightness_set;
2518
2519 err = led_classdev_register(&sc->pdev->dev, &led->led_dev);
2520 if (err)
2521 {
2522 ATH5K_WARN(sc, "could not register LED %s\n", name);
2523 led->sc = NULL;
2613 } 2524 }
2525 return err;
2526}
2527
2528static void
2529ath5k_unregister_led(struct ath5k_led *led)
2530{
2531 if (!led->sc)
2532 return;
2533 led_classdev_unregister(&led->led_dev);
2534 ath5k_led_off(led->sc);
2535 led->sc = NULL;
2614} 2536}
2615 2537
2538static void
2539ath5k_unregister_leds(struct ath5k_softc *sc)
2540{
2541 ath5k_unregister_led(&sc->rx_led);
2542 ath5k_unregister_led(&sc->tx_led);
2543}
2616 2544
2617 2545
2546static int
2547ath5k_init_leds(struct ath5k_softc *sc)
2548{
2549 int ret = 0;
2550 struct ieee80211_hw *hw = sc->hw;
2551 struct pci_dev *pdev = sc->pdev;
2552 char name[ATH5K_LED_MAX_NAME_LEN + 1];
2553
2554 sc->led_on = 0; /* active low */
2555
2556 /*
2557 * Auto-enable soft led processing for IBM cards and for
2558 * 5211 minipci cards.
2559 */
2560 if (pdev->device == PCI_DEVICE_ID_ATHEROS_AR5212_IBM ||
2561 pdev->device == PCI_DEVICE_ID_ATHEROS_AR5211) {
2562 __set_bit(ATH_STAT_LEDSOFT, sc->status);
2563 sc->led_pin = 0;
2564 }
2565 /* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */
2566 if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ) {
2567 __set_bit(ATH_STAT_LEDSOFT, sc->status);
2568 sc->led_pin = 1;
2569 }
2570 if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
2571 goto out;
2572
2573 ath5k_led_enable(sc);
2574
2575 snprintf(name, sizeof(name), "ath5k-%s::rx", wiphy_name(hw->wiphy));
2576 ret = ath5k_register_led(sc, &sc->rx_led, name,
2577 ieee80211_get_rx_led_name(hw));
2578 if (ret)
2579 goto out;
2580
2581 snprintf(name, sizeof(name), "ath5k-%s::tx", wiphy_name(hw->wiphy));
2582 ret = ath5k_register_led(sc, &sc->tx_led, name,
2583 ieee80211_get_tx_led_name(hw));
2584out:
2585 return ret;
2586}
2587
2618 2588
2619/********************\ 2589/********************\
2620* Mac80211 functions * 2590* Mac80211 functions *
@@ -2625,7 +2595,6 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2625{ 2595{
2626 struct ath5k_softc *sc = hw->priv; 2596 struct ath5k_softc *sc = hw->priv;
2627 struct ath5k_buf *bf; 2597 struct ath5k_buf *bf;
2628 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2629 unsigned long flags; 2598 unsigned long flags;
2630 int hdrlen; 2599 int hdrlen;
2631 int pad; 2600 int pad;
@@ -2651,8 +2620,6 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2651 memmove(skb->data, skb->data+pad, hdrlen); 2620 memmove(skb->data, skb->data+pad, hdrlen);
2652 } 2621 }
2653 2622
2654 sc->led_txrate = ieee80211_get_tx_rate(hw, info)->hw_value;
2655
2656 spin_lock_irqsave(&sc->txbuflock, flags); 2623 spin_lock_irqsave(&sc->txbuflock, flags);
2657 if (list_empty(&sc->txbuf)) { 2624 if (list_empty(&sc->txbuf)) {
2658 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); 2625 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n");
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
index bb4b26d523ab..47f414b09e67 100644
--- a/drivers/net/wireless/ath5k/base.h
+++ b/drivers/net/wireless/ath5k/base.h
@@ -45,6 +45,7 @@
45#include <linux/list.h> 45#include <linux/list.h>
46#include <linux/wireless.h> 46#include <linux/wireless.h>
47#include <linux/if_ether.h> 47#include <linux/if_ether.h>
48#include <linux/leds.h>
48 49
49#include "ath5k.h" 50#include "ath5k.h"
50#include "debug.h" 51#include "debug.h"
@@ -79,6 +80,19 @@ struct ath5k_txq {
79 bool setup; 80 bool setup;
80}; 81};
81 82
83#define ATH5K_LED_MAX_NAME_LEN 31
84
85/*
86 * State for LED triggers
87 */
88struct ath5k_led
89{
90 char name[ATH5K_LED_MAX_NAME_LEN + 1]; /* name of the LED in sysfs */
91 struct ath5k_softc *sc; /* driver state */
92 struct led_classdev led_dev; /* led classdev */
93};
94
95
82#if CHAN_DEBUG 96#if CHAN_DEBUG
83#define ATH_CHAN_MAX (26+26+26+200+200) 97#define ATH_CHAN_MAX (26+26+26+200+200)
84#else 98#else
@@ -118,13 +132,11 @@ struct ath5k_softc {
118 size_t desc_len; /* size of TX/RX descriptors */ 132 size_t desc_len; /* size of TX/RX descriptors */
119 u16 cachelsz; /* cache line size */ 133 u16 cachelsz; /* cache line size */
120 134
121 DECLARE_BITMAP(status, 6); 135 DECLARE_BITMAP(status, 4);
122#define ATH_STAT_INVALID 0 /* disable hardware accesses */ 136#define ATH_STAT_INVALID 0 /* disable hardware accesses */
123#define ATH_STAT_MRRETRY 1 /* multi-rate retry support */ 137#define ATH_STAT_MRRETRY 1 /* multi-rate retry support */
124#define ATH_STAT_PROMISC 2 138#define ATH_STAT_PROMISC 2
125#define ATH_STAT_LEDBLINKING 3 /* LED blink operation active */ 139#define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */
126#define ATH_STAT_LEDENDBLINK 4 /* finish LED blink operation */
127#define ATH_STAT_LEDSOFT 5 /* enable LED gpio status */
128 140
129 unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */ 141 unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
130 unsigned int curmode; /* current phy mode */ 142 unsigned int curmode; /* current phy mode */
@@ -132,13 +144,6 @@ struct ath5k_softc {
132 144
133 struct ieee80211_vif *vif; 145 struct ieee80211_vif *vif;
134 146
135 struct {
136 u8 rxflags; /* radiotap rx flags */
137 u8 txflags; /* radiotap tx flags */
138 u16 ledon; /* softled on time */
139 u16 ledoff; /* softled off time */
140 } hwmap[32]; /* h/w rate ix mappings */
141
142 enum ath5k_int imask; /* interrupt mask copy */ 147 enum ath5k_int imask; /* interrupt mask copy */
143 148
144 DECLARE_BITMAP(keymap, AR5K_KEYCACHE_SIZE); /* key use bit map */ 149 DECLARE_BITMAP(keymap, AR5K_KEYCACHE_SIZE); /* key use bit map */
@@ -148,9 +153,6 @@ struct ath5k_softc {
148 unsigned int led_pin, /* GPIO pin for driving LED */ 153 unsigned int led_pin, /* GPIO pin for driving LED */
149 led_on, /* pin setting for LED on */ 154 led_on, /* pin setting for LED on */
150 led_off; /* off time for current blink */ 155 led_off; /* off time for current blink */
151 struct timer_list led_tim; /* led off timer */
152 u8 led_rxrate; /* current rx rate for LED */
153 u8 led_txrate; /* current tx rate for LED */
154 156
155 struct tasklet_struct restq; /* reset tasklet */ 157 struct tasklet_struct restq; /* reset tasklet */
156 158
@@ -159,6 +161,7 @@ struct ath5k_softc {
159 spinlock_t rxbuflock; 161 spinlock_t rxbuflock;
160 u32 *rxlink; /* link ptr in last RX desc */ 162 u32 *rxlink; /* link ptr in last RX desc */
161 struct tasklet_struct rxtq; /* rx intr tasklet */ 163 struct tasklet_struct rxtq; /* rx intr tasklet */
164 struct ath5k_led rx_led; /* rx led */
162 165
163 struct list_head txbuf; /* transmit buffer */ 166 struct list_head txbuf; /* transmit buffer */
164 spinlock_t txbuflock; 167 spinlock_t txbuflock;
@@ -167,6 +170,7 @@ struct ath5k_softc {
167 170
168 struct ath5k_txq *txq; /* beacon and tx*/ 171 struct ath5k_txq *txq; /* beacon and tx*/
169 struct tasklet_struct txtq; /* tx intr tasklet */ 172 struct tasklet_struct txtq; /* tx intr tasklet */
173 struct ath5k_led tx_led; /* tx led */
170 174
171 struct ath5k_buf *bbuf; /* beacon buffer */ 175 struct ath5k_buf *bbuf; /* beacon buffer */
172 unsigned int bhalq, /* SW q for outgoing beacons */ 176 unsigned int bhalq, /* SW q for outgoing beacons */
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 77990b56860b..c6d12c53bda4 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -31,14 +31,14 @@
31#include "base.h" 31#include "base.h"
32#include "debug.h" 32#include "debug.h"
33 33
34/*Rate tables*/ 34/* Rate tables */
35static const struct ath5k_rate_table ath5k_rt_11a = AR5K_RATES_11A; 35static const struct ath5k_rate_table ath5k_rt_11a = AR5K_RATES_11A;
36static const struct ath5k_rate_table ath5k_rt_11b = AR5K_RATES_11B; 36static const struct ath5k_rate_table ath5k_rt_11b = AR5K_RATES_11B;
37static const struct ath5k_rate_table ath5k_rt_11g = AR5K_RATES_11G; 37static const struct ath5k_rate_table ath5k_rt_11g = AR5K_RATES_11G;
38static const struct ath5k_rate_table ath5k_rt_turbo = AR5K_RATES_TURBO; 38static const struct ath5k_rate_table ath5k_rt_turbo = AR5K_RATES_TURBO;
39static const struct ath5k_rate_table ath5k_rt_xr = AR5K_RATES_XR; 39static const struct ath5k_rate_table ath5k_rt_xr = AR5K_RATES_XR;
40 40
41/*Prototypes*/ 41/* Prototypes */
42static int ath5k_hw_nic_reset(struct ath5k_hw *, u32); 42static int ath5k_hw_nic_reset(struct ath5k_hw *, u32);
43static int ath5k_hw_nic_wakeup(struct ath5k_hw *, int, bool); 43static int ath5k_hw_nic_wakeup(struct ath5k_hw *, int, bool);
44static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *, struct ath5k_desc *, 44static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *, struct ath5k_desc *,