mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
This commit is contained in:
@@ -153,7 +153,7 @@ config LIBERTAS_SDIO
|
||||
|
||||
config LIBERTAS_SPI
|
||||
tristate "Marvell Libertas 8686 SPI 802.11b/g cards"
|
||||
depends on LIBERTAS && SPI && GENERIC_GPIO
|
||||
depends on LIBERTAS && SPI
|
||||
---help---
|
||||
A driver for Marvell Libertas 8686 SPI devices.
|
||||
|
||||
|
||||
@@ -109,6 +109,11 @@ struct ar9170_rxstream_mpdu_merge {
|
||||
bool has_plcp;
|
||||
};
|
||||
|
||||
#define AR9170_QUEUE_TIMEOUT 64
|
||||
#define AR9170_TX_TIMEOUT 8
|
||||
#define AR9170_JANITOR_DELAY 128
|
||||
#define AR9170_TX_INVALID_RATE 0xffffffff
|
||||
|
||||
struct ar9170 {
|
||||
struct ieee80211_hw *hw;
|
||||
struct mutex mutex;
|
||||
@@ -117,10 +122,11 @@ struct ar9170 {
|
||||
|
||||
int (*open)(struct ar9170 *);
|
||||
void (*stop)(struct ar9170 *);
|
||||
int (*tx)(struct ar9170 *, struct sk_buff *, bool, unsigned int);
|
||||
int (*tx)(struct ar9170 *, struct sk_buff *);
|
||||
int (*exec_cmd)(struct ar9170 *, enum ar9170_cmd, u32 ,
|
||||
void *, u32 , void *);
|
||||
void (*callback_cmd)(struct ar9170 *, u32 , void *);
|
||||
int (*flush)(struct ar9170 *);
|
||||
|
||||
/* interface mode settings */
|
||||
struct ieee80211_vif *vif;
|
||||
@@ -177,10 +183,10 @@ struct ar9170 {
|
||||
struct ar9170_eeprom eeprom;
|
||||
struct ath_regulatory regulatory;
|
||||
|
||||
/* global tx status for unregistered Stations. */
|
||||
struct sk_buff_head global_tx_status;
|
||||
struct sk_buff_head global_tx_status_waste;
|
||||
struct delayed_work tx_status_janitor;
|
||||
/* tx queues - as seen by hw - */
|
||||
struct sk_buff_head tx_pending[__AR9170_NUM_TXQ];
|
||||
struct sk_buff_head tx_status[__AR9170_NUM_TXQ];
|
||||
struct delayed_work tx_janitor;
|
||||
|
||||
/* rxstream mpdu merge */
|
||||
struct ar9170_rxstream_mpdu_merge rx_mpdu;
|
||||
@@ -189,11 +195,19 @@ struct ar9170 {
|
||||
};
|
||||
|
||||
struct ar9170_sta_info {
|
||||
struct sk_buff_head tx_status[__AR9170_NUM_TXQ];
|
||||
};
|
||||
|
||||
#define IS_STARTED(a) (a->state >= AR9170_STARTED)
|
||||
#define IS_ACCEPTING_CMD(a) (a->state >= AR9170_IDLE)
|
||||
#define AR9170_TX_FLAG_WAIT_FOR_ACK BIT(0)
|
||||
#define AR9170_TX_FLAG_NO_ACK BIT(1)
|
||||
#define AR9170_TX_FLAG_BLOCK_ACK BIT(2)
|
||||
|
||||
struct ar9170_tx_info {
|
||||
unsigned long timeout;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
#define IS_STARTED(a) (((struct ar9170 *)a)->state >= AR9170_STARTED)
|
||||
#define IS_ACCEPTING_CMD(a) (((struct ar9170 *)a)->state >= AR9170_IDLE)
|
||||
|
||||
#define AR9170_FILTER_CHANGED_MODE BIT(0)
|
||||
#define AR9170_FILTER_CHANGED_MULTICAST BIT(1)
|
||||
@@ -204,9 +218,9 @@ void *ar9170_alloc(size_t priv_size);
|
||||
int ar9170_register(struct ar9170 *ar, struct device *pdev);
|
||||
void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb);
|
||||
void ar9170_unregister(struct ar9170 *ar);
|
||||
void ar9170_handle_tx_status(struct ar9170 *ar, struct sk_buff *skb,
|
||||
bool update_statistics, u16 tx_status);
|
||||
void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb);
|
||||
void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len);
|
||||
int ar9170_nag_limiter(struct ar9170 *ar);
|
||||
|
||||
/* MAC */
|
||||
int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
|
||||
|
||||
@@ -420,4 +420,7 @@ enum ar9170_txq {
|
||||
__AR9170_NUM_TXQ,
|
||||
};
|
||||
|
||||
#define AR9170_TXQ_DEPTH 32
|
||||
#define AR9170_TX_MAX_PENDING 128
|
||||
|
||||
#endif /* __AR9170_HW_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -96,7 +96,49 @@ static struct usb_device_id ar9170_usb_ids[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, ar9170_usb_ids);
|
||||
|
||||
static void ar9170_usb_tx_urb_complete_free(struct urb *urb)
|
||||
static void ar9170_usb_submit_urb(struct ar9170_usb *aru)
|
||||
{
|
||||
struct urb *urb;
|
||||
unsigned long flags;
|
||||
int err;
|
||||
|
||||
if (unlikely(!IS_STARTED(&aru->common)))
|
||||
return ;
|
||||
|
||||
spin_lock_irqsave(&aru->tx_urb_lock, flags);
|
||||
if (aru->tx_submitted_urbs >= AR9170_NUM_TX_URBS) {
|
||||
spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
|
||||
return ;
|
||||
}
|
||||
aru->tx_submitted_urbs++;
|
||||
|
||||
urb = usb_get_from_anchor(&aru->tx_pending);
|
||||
if (!urb) {
|
||||
aru->tx_submitted_urbs--;
|
||||
spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
|
||||
|
||||
return ;
|
||||
}
|
||||
spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
|
||||
|
||||
aru->tx_pending_urbs--;
|
||||
usb_anchor_urb(urb, &aru->tx_submitted);
|
||||
|
||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (unlikely(err)) {
|
||||
if (ar9170_nag_limiter(&aru->common))
|
||||
dev_err(&aru->udev->dev, "submit_urb failed (%d).\n",
|
||||
err);
|
||||
|
||||
usb_unanchor_urb(urb);
|
||||
aru->tx_submitted_urbs--;
|
||||
ar9170_tx_callback(&aru->common, urb->context);
|
||||
}
|
||||
|
||||
usb_free_urb(urb);
|
||||
}
|
||||
|
||||
static void ar9170_usb_tx_urb_complete_frame(struct urb *urb)
|
||||
{
|
||||
struct sk_buff *skb = urb->context;
|
||||
struct ar9170_usb *aru = (struct ar9170_usb *)
|
||||
@@ -107,8 +149,11 @@ static void ar9170_usb_tx_urb_complete_free(struct urb *urb)
|
||||
return ;
|
||||
}
|
||||
|
||||
ar9170_handle_tx_status(&aru->common, skb, false,
|
||||
AR9170_TX_STATUS_COMPLETE);
|
||||
aru->tx_submitted_urbs--;
|
||||
|
||||
ar9170_tx_callback(&aru->common, skb);
|
||||
|
||||
ar9170_usb_submit_urb(aru);
|
||||
}
|
||||
|
||||
static void ar9170_usb_tx_urb_complete(struct urb *urb)
|
||||
@@ -290,21 +335,47 @@ err_out:
|
||||
return err;
|
||||
}
|
||||
|
||||
static void ar9170_usb_cancel_urbs(struct ar9170_usb *aru)
|
||||
static int ar9170_usb_flush(struct ar9170 *ar)
|
||||
{
|
||||
int ret;
|
||||
struct ar9170_usb *aru = (void *) ar;
|
||||
struct urb *urb;
|
||||
int ret, err = 0;
|
||||
|
||||
aru->common.state = AR9170_UNKNOWN_STATE;
|
||||
if (IS_STARTED(ar))
|
||||
aru->common.state = AR9170_IDLE;
|
||||
|
||||
usb_unlink_anchored_urbs(&aru->tx_submitted);
|
||||
usb_wait_anchor_empty_timeout(&aru->tx_pending,
|
||||
msecs_to_jiffies(800));
|
||||
while ((urb = usb_get_from_anchor(&aru->tx_pending))) {
|
||||
ar9170_tx_callback(&aru->common, (void *) urb->context);
|
||||
usb_free_urb(urb);
|
||||
}
|
||||
|
||||
/* give the LED OFF command and the deauth frame a chance to air. */
|
||||
/* lets wait a while until the tx - queues are dried out */
|
||||
ret = usb_wait_anchor_empty_timeout(&aru->tx_submitted,
|
||||
msecs_to_jiffies(100));
|
||||
if (ret == 0)
|
||||
dev_err(&aru->udev->dev, "kill pending tx urbs.\n");
|
||||
usb_poison_anchored_urbs(&aru->tx_submitted);
|
||||
err = -ETIMEDOUT;
|
||||
|
||||
usb_kill_anchored_urbs(&aru->tx_submitted);
|
||||
|
||||
if (IS_ACCEPTING_CMD(ar))
|
||||
aru->common.state = AR9170_STARTED;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void ar9170_usb_cancel_urbs(struct ar9170_usb *aru)
|
||||
{
|
||||
int err;
|
||||
|
||||
aru->common.state = AR9170_UNKNOWN_STATE;
|
||||
|
||||
err = ar9170_usb_flush(&aru->common);
|
||||
if (err)
|
||||
dev_err(&aru->udev->dev, "stuck tx urbs!\n");
|
||||
|
||||
usb_poison_anchored_urbs(&aru->tx_submitted);
|
||||
usb_poison_anchored_urbs(&aru->rx_submitted);
|
||||
}
|
||||
|
||||
@@ -388,12 +459,10 @@ err_free:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ar9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb,
|
||||
bool txstatus_needed, unsigned int extra_len)
|
||||
static int ar9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb)
|
||||
{
|
||||
struct ar9170_usb *aru = (struct ar9170_usb *) ar;
|
||||
struct urb *urb;
|
||||
int err;
|
||||
|
||||
if (unlikely(!IS_STARTED(ar))) {
|
||||
/* Seriously, what were you drink... err... thinking!? */
|
||||
@@ -406,18 +475,17 @@ static int ar9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb,
|
||||
|
||||
usb_fill_bulk_urb(urb, aru->udev,
|
||||
usb_sndbulkpipe(aru->udev, AR9170_EP_TX),
|
||||
skb->data, skb->len + extra_len, (txstatus_needed ?
|
||||
ar9170_usb_tx_urb_complete :
|
||||
ar9170_usb_tx_urb_complete_free), skb);
|
||||
skb->data, skb->len,
|
||||
ar9170_usb_tx_urb_complete_frame, skb);
|
||||
urb->transfer_flags |= URB_ZERO_PACKET;
|
||||
|
||||
usb_anchor_urb(urb, &aru->tx_submitted);
|
||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (unlikely(err))
|
||||
usb_unanchor_urb(urb);
|
||||
usb_anchor_urb(urb, &aru->tx_pending);
|
||||
aru->tx_pending_urbs++;
|
||||
|
||||
usb_free_urb(urb);
|
||||
return err;
|
||||
|
||||
ar9170_usb_submit_urb(aru);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ar9170_usb_callback_cmd(struct ar9170 *ar, u32 len , void *buffer)
|
||||
@@ -617,10 +685,8 @@ static void ar9170_usb_stop(struct ar9170 *ar)
|
||||
if (IS_ACCEPTING_CMD(ar))
|
||||
aru->common.state = AR9170_STOPPED;
|
||||
|
||||
/* lets wait a while until the tx - queues are dried out */
|
||||
ret = usb_wait_anchor_empty_timeout(&aru->tx_submitted,
|
||||
msecs_to_jiffies(1000));
|
||||
if (ret == 0)
|
||||
ret = ar9170_usb_flush(ar);
|
||||
if (ret)
|
||||
dev_err(&aru->udev->dev, "kill pending tx urbs.\n");
|
||||
|
||||
usb_poison_anchored_urbs(&aru->tx_submitted);
|
||||
@@ -716,10 +782,16 @@ static int ar9170_usb_probe(struct usb_interface *intf,
|
||||
SET_IEEE80211_DEV(ar->hw, &udev->dev);
|
||||
|
||||
init_usb_anchor(&aru->rx_submitted);
|
||||
init_usb_anchor(&aru->tx_pending);
|
||||
init_usb_anchor(&aru->tx_submitted);
|
||||
init_completion(&aru->cmd_wait);
|
||||
spin_lock_init(&aru->tx_urb_lock);
|
||||
|
||||
aru->tx_pending_urbs = 0;
|
||||
aru->tx_submitted_urbs = 0;
|
||||
|
||||
aru->common.stop = ar9170_usb_stop;
|
||||
aru->common.flush = ar9170_usb_flush;
|
||||
aru->common.open = ar9170_usb_open;
|
||||
aru->common.tx = ar9170_usb_tx;
|
||||
aru->common.exec_cmd = ar9170_usb_exec_cmd;
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "ar9170.h"
|
||||
|
||||
#define AR9170_NUM_RX_URBS 16
|
||||
#define AR9170_NUM_TX_URBS 8
|
||||
|
||||
struct firmware;
|
||||
|
||||
@@ -60,11 +61,15 @@ struct ar9170_usb {
|
||||
struct usb_interface *intf;
|
||||
|
||||
struct usb_anchor rx_submitted;
|
||||
struct usb_anchor tx_pending;
|
||||
struct usb_anchor tx_submitted;
|
||||
|
||||
bool req_one_stage_fw;
|
||||
|
||||
spinlock_t cmdlock;
|
||||
spinlock_t tx_urb_lock;
|
||||
unsigned int tx_submitted_urbs;
|
||||
unsigned int tx_pending_urbs;
|
||||
|
||||
struct completion cmd_wait;
|
||||
int readlen;
|
||||
u8 *readbuf;
|
||||
|
||||
@@ -11,5 +11,6 @@ ath5k-y += reset.o
|
||||
ath5k-y += attach.o
|
||||
ath5k-y += base.o
|
||||
ath5k-y += led.o
|
||||
ath5k-y += rfkill.o
|
||||
ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o
|
||||
obj-$(CONFIG_ATH5K) += ath5k.o
|
||||
|
||||
@@ -1256,6 +1256,10 @@ extern u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio);
|
||||
extern int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val);
|
||||
extern void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level);
|
||||
|
||||
/* rfkill Functions */
|
||||
extern void ath5k_rfkill_hw_start(struct ath5k_hw *ah);
|
||||
extern void ath5k_rfkill_hw_stop(struct ath5k_hw *ah);
|
||||
|
||||
/* Misc functions */
|
||||
int ath5k_hw_set_capabilities(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_get_capability(struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability, u32 *result);
|
||||
|
||||
@@ -2360,6 +2360,8 @@ ath5k_init(struct ath5k_softc *sc)
|
||||
if (ret)
|
||||
goto done;
|
||||
|
||||
ath5k_rfkill_hw_start(ah);
|
||||
|
||||
/*
|
||||
* Reset the key cache since some parts do not reset the
|
||||
* contents on initial power up or resume from suspend.
|
||||
@@ -2468,6 +2470,8 @@ ath5k_stop_hw(struct ath5k_softc *sc)
|
||||
tasklet_kill(&sc->restq);
|
||||
tasklet_kill(&sc->beacontq);
|
||||
|
||||
ath5k_rfkill_hw_stop(sc->ah);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2526,6 +2530,9 @@ ath5k_intr(int irq, void *dev_id)
|
||||
*/
|
||||
ath5k_hw_update_mib_counters(ah, &sc->ll_stats);
|
||||
}
|
||||
if (status & AR5K_INT_GPIO)
|
||||
tasklet_schedule(&sc->rf_kill.toggleq);
|
||||
|
||||
}
|
||||
} while (ath5k_hw_is_intr_pending(ah) && --counter > 0);
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <linux/wireless.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/rfkill.h>
|
||||
|
||||
#include "ath5k.h"
|
||||
#include "debug.h"
|
||||
@@ -91,6 +92,15 @@ struct ath5k_led
|
||||
struct led_classdev led_dev; /* led classdev */
|
||||
};
|
||||
|
||||
/* Rfkill */
|
||||
struct ath5k_rfkill {
|
||||
/* GPIO PIN for rfkill */
|
||||
u16 gpio;
|
||||
/* polarity of rfkill GPIO PIN */
|
||||
bool polarity;
|
||||
/* RFKILL toggle tasklet */
|
||||
struct tasklet_struct toggleq;
|
||||
};
|
||||
|
||||
#if CHAN_DEBUG
|
||||
#define ATH_CHAN_MAX (26+26+26+200+200)
|
||||
@@ -167,6 +177,8 @@ struct ath5k_softc {
|
||||
struct tasklet_struct txtq; /* tx intr tasklet */
|
||||
struct ath5k_led tx_led; /* tx led */
|
||||
|
||||
struct ath5k_rfkill rf_kill;
|
||||
|
||||
spinlock_t block; /* protects beacon */
|
||||
struct tasklet_struct beacontq; /* beacon intr tasklet */
|
||||
struct ath5k_buf *bbuf; /* beacon buffer */
|
||||
|
||||
@@ -1304,23 +1304,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
||||
if (ah->ah_version != AR5K_AR5210)
|
||||
ath5k_hw_set_imr(ah, ah->ah_imr);
|
||||
|
||||
/*
|
||||
* Setup RFKill interrupt if rfkill flag is set on eeprom.
|
||||
* TODO: Use gpio pin and polarity infos from eeprom
|
||||
* TODO: Handle this in ath5k_intr because it'll result
|
||||
* a nasty interrupt storm.
|
||||
*/
|
||||
#if 0
|
||||
if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header)) {
|
||||
ath5k_hw_set_gpio_input(ah, 0);
|
||||
ah->ah_gpio[0] = ath5k_hw_get_gpio(ah, 0);
|
||||
if (ah->ah_gpio[0] == 0)
|
||||
ath5k_hw_set_gpio_intr(ah, 0, 1);
|
||||
else
|
||||
ath5k_hw_set_gpio_intr(ah, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Enable 32KHz clock function for AR5212+ chips
|
||||
* Set clocks to 32KHz operation and use an
|
||||
* external 32KHz crystal when sleeping if one
|
||||
|
||||
121
drivers/net/wireless/ath/ath5k/rfkill.c
Normal file
121
drivers/net/wireless/ath/ath5k/rfkill.c
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* RFKILL support for ath5k
|
||||
*
|
||||
* Copyright (c) 2009 Tobias Doerffel <tobias.doerffel@gmail.com>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer,
|
||||
* without modification.
|
||||
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
||||
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
|
||||
* redistribution must be conditioned upon including a substantially
|
||||
* similar Disclaimer requirement for further binary redistribution.
|
||||
* 3. Neither the names of the above-listed copyright holders nor the names
|
||||
* of any contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* NO WARRANTY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include "base.h"
|
||||
|
||||
|
||||
static inline void ath5k_rfkill_disable(struct ath5k_softc *sc)
|
||||
{
|
||||
ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "rfkill disable (gpio:%d polarity:%d)\n",
|
||||
sc->rf_kill.gpio, sc->rf_kill.polarity);
|
||||
ath5k_hw_set_gpio_output(sc->ah, sc->rf_kill.gpio);
|
||||
ath5k_hw_set_gpio(sc->ah, sc->rf_kill.gpio, !sc->rf_kill.polarity);
|
||||
}
|
||||
|
||||
|
||||
static inline void ath5k_rfkill_enable(struct ath5k_softc *sc)
|
||||
{
|
||||
ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "rfkill enable (gpio:%d polarity:%d)\n",
|
||||
sc->rf_kill.gpio, sc->rf_kill.polarity);
|
||||
ath5k_hw_set_gpio_output(sc->ah, sc->rf_kill.gpio);
|
||||
ath5k_hw_set_gpio(sc->ah, sc->rf_kill.gpio, sc->rf_kill.polarity);
|
||||
}
|
||||
|
||||
static inline void ath5k_rfkill_set_intr(struct ath5k_softc *sc, bool enable)
|
||||
{
|
||||
struct ath5k_hw *ah = sc->ah;
|
||||
u32 curval;
|
||||
|
||||
ath5k_hw_set_gpio_input(ah, sc->rf_kill.gpio);
|
||||
curval = ath5k_hw_get_gpio(ah, sc->rf_kill.gpio);
|
||||
ath5k_hw_set_gpio_intr(ah, sc->rf_kill.gpio, enable ?
|
||||
!!curval : !curval);
|
||||
}
|
||||
|
||||
static bool
|
||||
ath5k_is_rfkill_set(struct ath5k_softc *sc)
|
||||
{
|
||||
/* configuring GPIO for input for some reason disables rfkill */
|
||||
/*ath5k_hw_set_gpio_input(sc->ah, sc->rf_kill.gpio);*/
|
||||
return ath5k_hw_get_gpio(sc->ah, sc->rf_kill.gpio) ==
|
||||
sc->rf_kill.polarity;
|
||||
}
|
||||
|
||||
static void
|
||||
ath5k_tasklet_rfkill_toggle(unsigned long data)
|
||||
{
|
||||
struct ath5k_softc *sc = (void *)data;
|
||||
bool blocked;
|
||||
|
||||
blocked = ath5k_is_rfkill_set(sc);
|
||||
wiphy_rfkill_set_hw_state(sc->hw->wiphy, blocked);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ath5k_rfkill_hw_start(struct ath5k_hw *ah)
|
||||
{
|
||||
struct ath5k_softc *sc = ah->ah_sc;
|
||||
|
||||
/* read rfkill GPIO configuration from EEPROM header */
|
||||
sc->rf_kill.gpio = ah->ah_capabilities.cap_eeprom.ee_rfkill_pin;
|
||||
sc->rf_kill.polarity = ah->ah_capabilities.cap_eeprom.ee_rfkill_pol;
|
||||
|
||||
tasklet_init(&sc->rf_kill.toggleq, ath5k_tasklet_rfkill_toggle,
|
||||
(unsigned long)sc);
|
||||
|
||||
ath5k_rfkill_disable(sc);
|
||||
|
||||
/* enable interrupt for rfkill switch */
|
||||
if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header))
|
||||
ath5k_rfkill_set_intr(sc, true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ath5k_rfkill_hw_stop(struct ath5k_hw *ah)
|
||||
{
|
||||
struct ath5k_softc *sc = ah->ah_sc;
|
||||
|
||||
/* disable interrupt for rfkill switch */
|
||||
if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header))
|
||||
ath5k_rfkill_set_intr(sc, false);
|
||||
|
||||
tasklet_kill(&sc->rf_kill.toggleq);
|
||||
|
||||
/* enable RFKILL when stopping HW so Wifi LED is turned off */
|
||||
ath5k_rfkill_enable(sc);
|
||||
}
|
||||
|
||||
@@ -711,6 +711,7 @@ int ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
|
||||
return 0;
|
||||
|
||||
if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
|
||||
txtid->state &= ~AGGR_ADDBA_PROGRESS;
|
||||
txtid->addba_exchangeattempts = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -98,13 +98,6 @@ config B43_LEDS
|
||||
depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43)
|
||||
default y
|
||||
|
||||
# This config option automatically enables b43 RFKILL support,
|
||||
# if it's possible.
|
||||
config B43_RFKILL
|
||||
bool
|
||||
depends on B43 && (RFKILL = y || RFKILL = B43)
|
||||
default y
|
||||
|
||||
# This config option automatically enables b43 HW-RNG support,
|
||||
# if the HW-RNG core is enabled.
|
||||
config B43_HWRNG
|
||||
|
||||
@@ -13,7 +13,7 @@ b43-y += lo.o
|
||||
b43-y += wa.o
|
||||
b43-y += dma.o
|
||||
b43-$(CONFIG_B43_PIO) += pio.o
|
||||
b43-$(CONFIG_B43_RFKILL) += rfkill.o
|
||||
b43-y += rfkill.o
|
||||
b43-$(CONFIG_B43_LEDS) += leds.o
|
||||
b43-$(CONFIG_B43_PCMCIA) += pcmcia.o
|
||||
b43-$(CONFIG_B43_DEBUG) += debugfs.o
|
||||
|
||||
@@ -163,6 +163,7 @@ enum {
|
||||
#define B43_SHM_SH_WLCOREREV 0x0016 /* 802.11 core revision */
|
||||
#define B43_SHM_SH_PCTLWDPOS 0x0008
|
||||
#define B43_SHM_SH_RXPADOFF 0x0034 /* RX Padding data offset (PIO only) */
|
||||
#define B43_SHM_SH_FWCAPA 0x0042 /* Firmware capabilities (Opensource firmware only) */
|
||||
#define B43_SHM_SH_PHYVER 0x0050 /* PHY version */
|
||||
#define B43_SHM_SH_PHYTYPE 0x0052 /* PHY type */
|
||||
#define B43_SHM_SH_ANTSWAP 0x005C /* Antenna swap threshold */
|
||||
@@ -297,6 +298,10 @@ enum {
|
||||
#define B43_HF_MLADVW 0x001000000000ULL /* N PHY ML ADV workaround (rev >= 13 only) */
|
||||
#define B43_HF_PR45960W 0x080000000000ULL /* PR 45960 workaround (rev >= 13 only) */
|
||||
|
||||
/* Firmware capabilities field in SHM (Opensource firmware only) */
|
||||
#define B43_FWCAPA_HWCRYPTO 0x0001
|
||||
#define B43_FWCAPA_QOS 0x0002
|
||||
|
||||
/* MacFilter offsets. */
|
||||
#define B43_MACFILTER_SELF 0x0000
|
||||
#define B43_MACFILTER_BSSID 0x0003
|
||||
@@ -596,6 +601,13 @@ struct b43_wl {
|
||||
/* Pointer to the ieee80211 hardware data structure */
|
||||
struct ieee80211_hw *hw;
|
||||
|
||||
/* The number of queues that were registered with the mac80211 subsystem
|
||||
* initially. This is a backup copy of hw->queues in case hw->queues has
|
||||
* to be dynamically lowered at runtime (Firmware does not support QoS).
|
||||
* hw->queues has to be restored to the original value before unregistering
|
||||
* from the mac80211 subsystem. */
|
||||
u16 mac80211_initially_registered_queues;
|
||||
|
||||
struct mutex mutex;
|
||||
spinlock_t irq_lock;
|
||||
/* R/W lock for data transmission.
|
||||
@@ -631,9 +643,6 @@ struct b43_wl {
|
||||
char rng_name[30 + 1];
|
||||
#endif /* CONFIG_B43_HWRNG */
|
||||
|
||||
/* The RF-kill button */
|
||||
struct b43_rfkill rfkill;
|
||||
|
||||
/* List of all wireless devices on this chip */
|
||||
struct list_head devlist;
|
||||
u8 nr_devs;
|
||||
@@ -752,6 +761,8 @@ struct b43_wldev {
|
||||
bool dfq_valid; /* Directed frame queue valid (IBSS PS mode, ATIM) */
|
||||
bool radio_hw_enable; /* saved state of radio hardware enabled state */
|
||||
bool suspend_in_progress; /* TRUE, if we are in a suspend/resume cycle */
|
||||
bool qos_enabled; /* TRUE, if QoS is used. */
|
||||
bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */
|
||||
|
||||
/* PHY/Radio device. */
|
||||
struct b43_phy phy;
|
||||
|
||||
@@ -1285,7 +1285,7 @@ static struct b43_dmaring *select_ring_by_priority(struct b43_wldev *dev,
|
||||
{
|
||||
struct b43_dmaring *ring;
|
||||
|
||||
if (b43_modparam_qos) {
|
||||
if (dev->qos_enabled) {
|
||||
/* 0 = highest priority */
|
||||
switch (queue_prio) {
|
||||
default:
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "b43.h"
|
||||
#include "leds.h"
|
||||
#include "rfkill.h"
|
||||
|
||||
|
||||
static void b43_led_turn_on(struct b43_wldev *dev, u8 led_index,
|
||||
@@ -164,10 +165,10 @@ static void b43_map_led(struct b43_wldev *dev,
|
||||
snprintf(name, sizeof(name),
|
||||
"b43-%s::radio", wiphy_name(hw->wiphy));
|
||||
b43_register_led(dev, &dev->led_radio, name,
|
||||
b43_rfkill_led_name(dev),
|
||||
ieee80211_get_radio_led_name(hw),
|
||||
led_index, activelow);
|
||||
/* Sync the RF-kill LED state with the switch state. */
|
||||
if (dev->radio_hw_enable)
|
||||
/* Sync the RF-kill LED state with radio and switch states. */
|
||||
if (dev->phy.radio_on && b43_is_hw_radio_enabled(dev))
|
||||
b43_led_turn_on(dev, led_index, activelow);
|
||||
break;
|
||||
case B43_LED_WEIRD:
|
||||
|
||||
@@ -80,8 +80,8 @@ static int modparam_nohwcrypt;
|
||||
module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
|
||||
MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
|
||||
|
||||
int b43_modparam_qos = 1;
|
||||
module_param_named(qos, b43_modparam_qos, int, 0444);
|
||||
static int modparam_qos = 1;
|
||||
module_param_named(qos, modparam_qos, int, 0444);
|
||||
MODULE_PARM_DESC(qos, "Enable QOS support (default on)");
|
||||
|
||||
static int modparam_btcoex = 1;
|
||||
@@ -538,6 +538,13 @@ void b43_hf_write(struct b43_wldev *dev, u64 value)
|
||||
b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTFHI, hi);
|
||||
}
|
||||
|
||||
/* Read the firmware capabilities bitmask (Opensource firmware only) */
|
||||
static u16 b43_fwcapa_read(struct b43_wldev *dev)
|
||||
{
|
||||
B43_WARN_ON(!dev->fw.opensource);
|
||||
return b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_FWCAPA);
|
||||
}
|
||||
|
||||
void b43_tsf_read(struct b43_wldev *dev, u64 *tsf)
|
||||
{
|
||||
u32 low, high;
|
||||
@@ -2307,12 +2314,34 @@ static int b43_upload_microcode(struct b43_wldev *dev)
|
||||
dev->fw.patch = fwpatch;
|
||||
dev->fw.opensource = (fwdate == 0xFFFF);
|
||||
|
||||
/* Default to use-all-queues. */
|
||||
dev->wl->hw->queues = dev->wl->mac80211_initially_registered_queues;
|
||||
dev->qos_enabled = !!modparam_qos;
|
||||
/* Default to firmware/hardware crypto acceleration. */
|
||||
dev->hwcrypto_enabled = 1;
|
||||
|
||||
if (dev->fw.opensource) {
|
||||
u16 fwcapa;
|
||||
|
||||
/* Patchlevel info is encoded in the "time" field. */
|
||||
dev->fw.patch = fwtime;
|
||||
b43info(dev->wl, "Loading OpenSource firmware version %u.%u%s\n",
|
||||
dev->fw.rev, dev->fw.patch,
|
||||
dev->fw.pcm_request_failed ? " (Hardware crypto not supported)" : "");
|
||||
b43info(dev->wl, "Loading OpenSource firmware version %u.%u\n",
|
||||
dev->fw.rev, dev->fw.patch);
|
||||
|
||||
fwcapa = b43_fwcapa_read(dev);
|
||||
if (!(fwcapa & B43_FWCAPA_HWCRYPTO) || dev->fw.pcm_request_failed) {
|
||||
b43info(dev->wl, "Hardware crypto acceleration not supported by firmware\n");
|
||||
/* Disable hardware crypto and fall back to software crypto. */
|
||||
dev->hwcrypto_enabled = 0;
|
||||
}
|
||||
if (!(fwcapa & B43_FWCAPA_QOS)) {
|
||||
b43info(dev->wl, "QoS not supported by firmware\n");
|
||||
/* Disable QoS. Tweak hw->queues to 1. It will be restored before
|
||||
* ieee80211_unregister to make sure the networking core can
|
||||
* properly free possible resources. */
|
||||
dev->wl->hw->queues = 1;
|
||||
dev->qos_enabled = 0;
|
||||
}
|
||||
} else {
|
||||
b43info(dev->wl, "Loading firmware version %u.%u "
|
||||
"(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
|
||||
@@ -3627,7 +3656,7 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
|
||||
if (!dev || b43_status(dev) < B43_STAT_INITIALIZED)
|
||||
goto out_unlock;
|
||||
|
||||
if (dev->fw.pcm_request_failed) {
|
||||
if (dev->fw.pcm_request_failed || !dev->hwcrypto_enabled) {
|
||||
/* We don't have firmware for the crypto engine.
|
||||
* Must use software-crypto. */
|
||||
err = -EOPNOTSUPP;
|
||||
@@ -4298,7 +4327,6 @@ static int b43_op_start(struct ieee80211_hw *hw)
|
||||
struct b43_wldev *dev = wl->current_dev;
|
||||
int did_init = 0;
|
||||
int err = 0;
|
||||
bool do_rfkill_exit = 0;
|
||||
|
||||
/* Kill all old instance specific information to make sure
|
||||
* the card won't use it in the short timeframe between start
|
||||
@@ -4312,18 +4340,12 @@ static int b43_op_start(struct ieee80211_hw *hw)
|
||||
wl->beacon1_uploaded = 0;
|
||||
wl->beacon_templates_virgin = 1;
|
||||
|
||||
/* First register RFkill.
|
||||
* LEDs that are registered later depend on it. */
|
||||
b43_rfkill_init(dev);
|
||||
|
||||
mutex_lock(&wl->mutex);
|
||||
|
||||
if (b43_status(dev) < B43_STAT_INITIALIZED) {
|
||||
err = b43_wireless_core_init(dev);
|
||||
if (err) {
|
||||
do_rfkill_exit = 1;
|
||||
if (err)
|
||||
goto out_mutex_unlock;
|
||||
}
|
||||
did_init = 1;
|
||||
}
|
||||
|
||||
@@ -4332,17 +4354,16 @@ static int b43_op_start(struct ieee80211_hw *hw)
|
||||
if (err) {
|
||||
if (did_init)
|
||||
b43_wireless_core_exit(dev);
|
||||
do_rfkill_exit = 1;
|
||||
goto out_mutex_unlock;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX: only do if device doesn't support rfkill irq */
|
||||
wiphy_rfkill_start_polling(hw->wiphy);
|
||||
|
||||
out_mutex_unlock:
|
||||
mutex_unlock(&wl->mutex);
|
||||
|
||||
if (do_rfkill_exit)
|
||||
b43_rfkill_exit(dev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -4351,7 +4372,6 @@ static void b43_op_stop(struct ieee80211_hw *hw)
|
||||
struct b43_wl *wl = hw_to_b43_wl(hw);
|
||||
struct b43_wldev *dev = wl->current_dev;
|
||||
|
||||
b43_rfkill_exit(dev);
|
||||
cancel_work_sync(&(wl->beacon_update_trigger));
|
||||
|
||||
mutex_lock(&wl->mutex);
|
||||
@@ -4433,6 +4453,7 @@ static const struct ieee80211_ops b43_hw_ops = {
|
||||
.sta_notify = b43_op_sta_notify,
|
||||
.sw_scan_start = b43_op_sw_scan_start_notifier,
|
||||
.sw_scan_complete = b43_op_sw_scan_complete_notifier,
|
||||
.rfkill_poll = b43_rfkill_poll,
|
||||
};
|
||||
|
||||
/* Hard-reset the chip. Do not call this directly.
|
||||
@@ -4735,6 +4756,7 @@ static int b43_wireless_init(struct ssb_device *dev)
|
||||
b43err(NULL, "Could not allocate ieee80211 device\n");
|
||||
goto out;
|
||||
}
|
||||
wl = hw_to_b43_wl(hw);
|
||||
|
||||
/* fill hw info */
|
||||
hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
|
||||
@@ -4748,7 +4770,8 @@ static int b43_wireless_init(struct ssb_device *dev)
|
||||
BIT(NL80211_IFTYPE_WDS) |
|
||||
BIT(NL80211_IFTYPE_ADHOC);
|
||||
|
||||
hw->queues = b43_modparam_qos ? 4 : 1;
|
||||
hw->queues = modparam_qos ? 4 : 1;
|
||||
wl->mac80211_initially_registered_queues = hw->queues;
|
||||
hw->max_rates = 2;
|
||||
SET_IEEE80211_DEV(hw, dev->dev);
|
||||
if (is_valid_ether_addr(sprom->et1mac))
|
||||
@@ -4756,9 +4779,7 @@ static int b43_wireless_init(struct ssb_device *dev)
|
||||
else
|
||||
SET_IEEE80211_PERM_ADDR(hw, sprom->il0mac);
|
||||
|
||||
/* Get and initialize struct b43_wl */
|
||||
wl = hw_to_b43_wl(hw);
|
||||
memset(wl, 0, sizeof(*wl));
|
||||
/* Initialize struct b43_wl */
|
||||
wl->hw = hw;
|
||||
spin_lock_init(&wl->irq_lock);
|
||||
rwlock_init(&wl->tx_lock);
|
||||
@@ -4824,8 +4845,13 @@ static void b43_remove(struct ssb_device *dev)
|
||||
cancel_work_sync(&wldev->restart_work);
|
||||
|
||||
B43_WARN_ON(!wl);
|
||||
if (wl->current_dev == wldev)
|
||||
if (wl->current_dev == wldev) {
|
||||
/* Restore the queues count before unregistering, because firmware detect
|
||||
* might have modified it. Restoring is important, so the networking
|
||||
* stack can properly free resources. */
|
||||
wl->hw->queues = wl->mac80211_initially_registered_queues;
|
||||
ieee80211_unregister_hw(wl->hw);
|
||||
}
|
||||
|
||||
b43_one_core_detach(dev);
|
||||
|
||||
@@ -4920,7 +4946,7 @@ static struct ssb_driver b43_ssb_driver = {
|
||||
static void b43_print_driverinfo(void)
|
||||
{
|
||||
const char *feat_pci = "", *feat_pcmcia = "", *feat_nphy = "",
|
||||
*feat_leds = "", *feat_rfkill = "";
|
||||
*feat_leds = "";
|
||||
|
||||
#ifdef CONFIG_B43_PCI_AUTOSELECT
|
||||
feat_pci = "P";
|
||||
@@ -4933,15 +4959,12 @@ static void b43_print_driverinfo(void)
|
||||
#endif
|
||||
#ifdef CONFIG_B43_LEDS
|
||||
feat_leds = "L";
|
||||
#endif
|
||||
#ifdef CONFIG_B43_RFKILL
|
||||
feat_rfkill = "R";
|
||||
#endif
|
||||
printk(KERN_INFO "Broadcom 43xx driver loaded "
|
||||
"[ Features: %s%s%s%s%s, Firmware-ID: "
|
||||
"[ Features: %s%s%s%s, Firmware-ID: "
|
||||
B43_SUPPORTED_FIRMWARE_ID " ]\n",
|
||||
feat_pci, feat_pcmcia, feat_nphy,
|
||||
feat_leds, feat_rfkill);
|
||||
feat_leds);
|
||||
}
|
||||
|
||||
static int __init b43_init(void)
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes))
|
||||
|
||||
|
||||
extern int b43_modparam_qos;
|
||||
extern int b43_modparam_verbose;
|
||||
|
||||
/* Logmessage verbosity levels. Update the b43_modparam_verbose helptext, if
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user