Commit 6392cb38 authored by John W. Linville's avatar John W. Linville

Merge branch 'wireless-next-2.6' of...

Merge branch 'wireless-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-2.6
parents 0521ecf3 89434421
...@@ -13,6 +13,7 @@ iwlagn-objs += iwl-5000.o ...@@ -13,6 +13,7 @@ iwlagn-objs += iwl-5000.o
iwlagn-objs += iwl-6000.o iwlagn-objs += iwl-6000.o
iwlagn-objs += iwl-1000.o iwlagn-objs += iwl-1000.o
iwlagn-objs += iwl-2000.o iwlagn-objs += iwl-2000.o
iwlagn-objs += iwl-pci.o
iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -194,8 +192,6 @@ static struct iwl_lib_ops iwl1000_lib = { ...@@ -194,8 +192,6 @@ static struct iwl_lib_ops iwl1000_lib = {
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
.txfifo_flush = iwlagn_txfifo_flush,
.dev_txfifo_flush = iwlagn_dev_txfifo_flush,
}; };
static const struct iwl_ops iwl1000_ops = { static const struct iwl_ops iwl1000_ops = {
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -76,21 +74,7 @@ static void iwl2000_set_ct_threshold(struct iwl_priv *priv) ...@@ -76,21 +74,7 @@ static void iwl2000_set_ct_threshold(struct iwl_priv *priv)
/* NIC configuration for 2000 series */ /* NIC configuration for 2000 series */
static void iwl2000_nic_config(struct iwl_priv *priv) static void iwl2000_nic_config(struct iwl_priv *priv)
{ {
u16 radio_cfg; iwl_rf_config(priv);
radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
/* write radio config values to register */
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX)
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
EEPROM_RF_CFG_DASH_MSK(radio_cfg));
/* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
if (priv->cfg->iq_invert) if (priv->cfg->iq_invert)
iwl_set_bit(priv, CSR_GP_DRIVER_REG, iwl_set_bit(priv, CSR_GP_DRIVER_REG,
...@@ -204,8 +188,6 @@ static struct iwl_lib_ops iwl2000_lib = { ...@@ -204,8 +188,6 @@ static struct iwl_lib_ops iwl2000_lib = {
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
.txfifo_flush = iwlagn_txfifo_flush,
.dev_txfifo_flush = iwlagn_dev_txfifo_flush,
}; };
static const struct iwl_ops iwl2000_ops = { static const struct iwl_ops iwl2000_ops = {
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
...@@ -66,23 +64,10 @@ ...@@ -66,23 +64,10 @@
static void iwl5000_nic_config(struct iwl_priv *priv) static void iwl5000_nic_config(struct iwl_priv *priv)
{ {
unsigned long flags; unsigned long flags;
u16 radio_cfg;
spin_lock_irqsave(&priv->lock, flags); iwl_rf_config(priv);
radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
/* write radio config values to register */ spin_lock_irqsave(&priv->lock, flags);
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_RF_CONFIG_TYPE_MAX)
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
EEPROM_RF_CFG_DASH_MSK(radio_cfg));
/* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
/* W/A : NIC is stuck in a reset state after Early PCIe power off /* W/A : NIC is stuck in a reset state after Early PCIe power off
* (PCIe power is lost before PERST# is asserted), * (PCIe power is lost before PERST# is asserted),
...@@ -361,8 +346,6 @@ static struct iwl_lib_ops iwl5000_lib = { ...@@ -361,8 +346,6 @@ static struct iwl_lib_ops iwl5000_lib = {
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
.txfifo_flush = iwlagn_txfifo_flush,
.dev_txfifo_flush = iwlagn_dev_txfifo_flush,
}; };
static struct iwl_lib_ops iwl5150_lib = { static struct iwl_lib_ops iwl5150_lib = {
...@@ -391,8 +374,6 @@ static struct iwl_lib_ops iwl5150_lib = { ...@@ -391,8 +374,6 @@ static struct iwl_lib_ops iwl5150_lib = {
.temp_ops = { .temp_ops = {
.temperature = iwl5150_temperature, .temperature = iwl5150_temperature,
}, },
.txfifo_flush = iwlagn_txfifo_flush,
.dev_txfifo_flush = iwlagn_dev_txfifo_flush,
}; };
static const struct iwl_ops iwl5000_ops = { static const struct iwl_ops iwl5000_ops = {
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -97,21 +95,7 @@ static void iwl6150_additional_nic_config(struct iwl_priv *priv) ...@@ -97,21 +95,7 @@ static void iwl6150_additional_nic_config(struct iwl_priv *priv)
/* NIC configuration for 6000 series */ /* NIC configuration for 6000 series */
static void iwl6000_nic_config(struct iwl_priv *priv) static void iwl6000_nic_config(struct iwl_priv *priv)
{ {
u16 radio_cfg; iwl_rf_config(priv);
radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
/* write radio config values to register */
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX)
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
EEPROM_RF_CFG_DASH_MSK(radio_cfg));
/* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
/* no locking required for register write */ /* no locking required for register write */
if (priv->cfg->pa_type == IWL_PA_INTERNAL) { if (priv->cfg->pa_type == IWL_PA_INTERNAL) {
...@@ -301,8 +285,6 @@ static struct iwl_lib_ops iwl6000_lib = { ...@@ -301,8 +285,6 @@ static struct iwl_lib_ops iwl6000_lib = {
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
.txfifo_flush = iwlagn_txfifo_flush,
.dev_txfifo_flush = iwlagn_dev_txfifo_flush,
}; };
static struct iwl_lib_ops iwl6030_lib = { static struct iwl_lib_ops iwl6030_lib = {
...@@ -333,8 +315,6 @@ static struct iwl_lib_ops iwl6030_lib = { ...@@ -333,8 +315,6 @@ static struct iwl_lib_ops iwl6030_lib = {
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
.txfifo_flush = iwlagn_txfifo_flush,
.dev_txfifo_flush = iwlagn_dev_txfifo_flush,
}; };
static struct iwl_nic_ops iwl6050_nic_ops = { static struct iwl_nic_ops iwl6050_nic_ops = {
......
...@@ -81,13 +81,6 @@ ...@@ -81,13 +81,6 @@
/* RSSI to dBm */ /* RSSI to dBm */
#define IWLAGN_RSSI_OFFSET 44 #define IWLAGN_RSSI_OFFSET 44
/* PCI registers */
#define PCI_CFG_RETRY_TIMEOUT 0x041
/* PCI register values */
#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
#define IWLAGN_DEFAULT_TX_RETRY 15 #define IWLAGN_DEFAULT_TX_RETRY 15
/* Limit range of txpower output target to be between these values */ /* Limit range of txpower output target to be between these values */
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
void iwl_free_isr_ict(struct iwl_priv *priv) void iwl_free_isr_ict(struct iwl_priv *priv)
{ {
if (priv->_agn.ict_tbl_vir) { if (priv->_agn.ict_tbl_vir) {
dma_free_coherent(&priv->pci_dev->dev, dma_free_coherent(priv->bus.dev,
(sizeof(u32) * ICT_COUNT) + PAGE_SIZE, (sizeof(u32) * ICT_COUNT) + PAGE_SIZE,
priv->_agn.ict_tbl_vir, priv->_agn.ict_tbl_vir,
priv->_agn.ict_tbl_dma); priv->_agn.ict_tbl_dma);
...@@ -61,7 +61,7 @@ int iwl_alloc_isr_ict(struct iwl_priv *priv) ...@@ -61,7 +61,7 @@ int iwl_alloc_isr_ict(struct iwl_priv *priv)
/* allocate shrared data table */ /* allocate shrared data table */
priv->_agn.ict_tbl_vir = priv->_agn.ict_tbl_vir =
dma_alloc_coherent(&priv->pci_dev->dev, dma_alloc_coherent(priv->bus.dev,
(sizeof(u32) * ICT_COUNT) + PAGE_SIZE, (sizeof(u32) * ICT_COUNT) + PAGE_SIZE,
&priv->_agn.ict_tbl_dma, GFP_KERNEL); &priv->_agn.ict_tbl_dma, GFP_KERNEL);
if (!priv->_agn.ict_tbl_vir) if (!priv->_agn.ict_tbl_vir)
......
...@@ -624,6 +624,7 @@ struct iwl_mod_params iwlagn_mod_params = { ...@@ -624,6 +624,7 @@ struct iwl_mod_params iwlagn_mod_params = {
.plcp_check = true, .plcp_check = true,
.bt_coex_active = true, .bt_coex_active = true,
.no_sleep_autoadjust = true, .no_sleep_autoadjust = true,
.power_level = IWL_POWER_INDEX_1,
/* the rest are 0 by default */ /* the rest are 0 by default */
}; };
...@@ -639,9 +640,9 @@ void iwlagn_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) ...@@ -639,9 +640,9 @@ void iwlagn_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
/* In the reset function, these buffers may have been allocated /* In the reset function, these buffers may have been allocated
* to an SKB, so we need to unmap and free potential storage */ * to an SKB, so we need to unmap and free potential storage */
if (rxq->pool[i].page != NULL) { if (rxq->pool[i].page != NULL) {
pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, dma_unmap_page(priv->bus.dev, rxq->pool[i].page_dma,
PAGE_SIZE << priv->hw_params.rx_page_order, PAGE_SIZE << priv->hw_params.rx_page_order,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
__iwl_free_pages(priv, rxq->pool[i].page); __iwl_free_pages(priv, rxq->pool[i].page);
rxq->pool[i].page = NULL; rxq->pool[i].page = NULL;
} }
...@@ -913,9 +914,9 @@ void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority) ...@@ -913,9 +914,9 @@ void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority)
BUG_ON(rxb->page); BUG_ON(rxb->page);
rxb->page = page; rxb->page = page;
/* Get physical address of the RB */ /* Get physical address of the RB */
rxb->page_dma = pci_map_page(priv->pci_dev, page, 0, rxb->page_dma = dma_map_page(priv->bus.dev, page, 0,
PAGE_SIZE << priv->hw_params.rx_page_order, PAGE_SIZE << priv->hw_params.rx_page_order,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
/* dma address must be no more than 36 bits */ /* dma address must be no more than 36 bits */
BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
/* and also 256 byte aligned! */ /* and also 256 byte aligned! */
...@@ -958,17 +959,18 @@ void iwlagn_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) ...@@ -958,17 +959,18 @@ void iwlagn_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
int i; int i;
for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
if (rxq->pool[i].page != NULL) { if (rxq->pool[i].page != NULL) {
pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, dma_unmap_page(priv->bus.dev, rxq->pool[i].page_dma,
PAGE_SIZE << priv->hw_params.rx_page_order, PAGE_SIZE << priv->hw_params.rx_page_order,
PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
__iwl_free_pages(priv, rxq->pool[i].page); __iwl_free_pages(priv, rxq->pool[i].page);
rxq->pool[i].page = NULL; rxq->pool[i].page = NULL;
} }
} }
dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, dma_free_coherent(priv->bus.dev, 4 * RX_QUEUE_SIZE,
rxq->bd_dma); rxq->bd, rxq->bd_dma);
dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), dma_free_coherent(priv->bus.dev,
sizeof(struct iwl_rb_status),
rxq->rb_stts, rxq->rb_stts_dma); rxq->rb_stts, rxq->rb_stts_dma);
rxq->bd = NULL; rxq->bd = NULL;
rxq->rb_stts = NULL; rxq->rb_stts = NULL;
...@@ -1530,8 +1532,17 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) ...@@ -1530,8 +1532,17 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
might_sleep(); might_sleep();
memset(&flush_cmd, 0, sizeof(flush_cmd)); memset(&flush_cmd, 0, sizeof(flush_cmd));
flush_cmd.fifo_control = IWL_TX_FIFO_VO_MSK | IWL_TX_FIFO_VI_MSK | if (flush_control & BIT(IWL_RXON_CTX_BSS))
IWL_TX_FIFO_BE_MSK | IWL_TX_FIFO_BK_MSK; flush_cmd.fifo_control = IWL_SCD_VO_MSK | IWL_SCD_VI_MSK |
IWL_SCD_BE_MSK | IWL_SCD_BK_MSK |
IWL_SCD_MGMT_MSK;
if ((flush_control & BIT(IWL_RXON_CTX_PAN)) &&
(priv->valid_contexts != BIT(IWL_RXON_CTX_BSS)))
flush_cmd.fifo_control |= IWL_PAN_SCD_VO_MSK |
IWL_PAN_SCD_VI_MSK | IWL_PAN_SCD_BE_MSK |
IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK |
IWL_PAN_SCD_MULTICAST_MSK;
if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE) if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)
flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK; flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK;
...@@ -1546,7 +1557,7 @@ void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control) ...@@ -1546,7 +1557,7 @@ void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
{ {
mutex_lock(&priv->mutex); mutex_lock(&priv->mutex);
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
if (priv->cfg->ops->lib->txfifo_flush(priv, IWL_DROP_ALL)) { if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) {
IWL_ERR(priv, "flush request fail\n"); IWL_ERR(priv, "flush request fail\n");
goto done; goto done;
} }
......
...@@ -716,10 +716,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -716,10 +716,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
/* Physical address of this Tx command's header (not MAC header!), /* Physical address of this Tx command's header (not MAC header!),
* within command buffer array. */ * within command buffer array. */
txcmd_phys = pci_map_single(priv->pci_dev, txcmd_phys = dma_map_single(priv->bus.dev,
&out_cmd->hdr, firstlen, &out_cmd->hdr, firstlen,
PCI_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
if (unlikely(pci_dma_mapping_error(priv->pci_dev, txcmd_phys))) if (unlikely(dma_mapping_error(priv->bus.dev, txcmd_phys)))
goto drop_unlock_sta; goto drop_unlock_sta;
dma_unmap_addr_set(out_meta, mapping, txcmd_phys); dma_unmap_addr_set(out_meta, mapping, txcmd_phys);
dma_unmap_len_set(out_meta, len, firstlen); dma_unmap_len_set(out_meta, len, firstlen);
...@@ -735,13 +735,13 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -735,13 +735,13 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
* if any (802.11 null frames have no payload). */ * if any (802.11 null frames have no payload). */
secondlen = skb->len - hdr_len; secondlen = skb->len - hdr_len;
if (secondlen > 0) { if (secondlen > 0) {
phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, phys_addr = dma_map_single(priv->bus.dev, skb->data + hdr_len,
secondlen, PCI_DMA_TODEVICE); secondlen, DMA_TO_DEVICE);
if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) { if (unlikely(dma_mapping_error(priv->bus.dev, phys_addr))) {
pci_unmap_single(priv->pci_dev, dma_unmap_single(priv->bus.dev,
dma_unmap_addr(out_meta, mapping), dma_unmap_addr(out_meta, mapping),
dma_unmap_len(out_meta, len), dma_unmap_len(out_meta, len),
PCI_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
goto drop_unlock_sta; goto drop_unlock_sta;
} }
} }
...@@ -764,8 +764,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -764,8 +764,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
offsetof(struct iwl_tx_cmd, scratch); offsetof(struct iwl_tx_cmd, scratch);
/* take back ownership of DMA buffer to enable update */ /* take back ownership of DMA buffer to enable update */
pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys, dma_sync_single_for_cpu(priv->bus.dev, txcmd_phys, firstlen,
firstlen, PCI_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys);
tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys);
...@@ -780,8 +780,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -780,8 +780,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
iwlagn_txq_update_byte_cnt_tbl(priv, txq, iwlagn_txq_update_byte_cnt_tbl(priv, txq,
le16_to_cpu(tx_cmd->len)); le16_to_cpu(tx_cmd->len));
pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys, dma_sync_single_for_device(priv->bus.dev, txcmd_phys, firstlen,
firstlen, PCI_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
trace_iwlwifi_dev_tx(priv, trace_iwlwifi_dev_tx(priv,
&((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr], &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr],
...@@ -834,8 +834,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -834,8 +834,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
static inline int iwlagn_alloc_dma_ptr(struct iwl_priv *priv, static inline int iwlagn_alloc_dma_ptr(struct iwl_priv *priv,
struct iwl_dma_ptr *ptr, size_t size) struct iwl_dma_ptr *ptr, size_t size)
{ {
ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, ptr->addr = dma_alloc_coherent(priv->bus.dev, size,
GFP_KERNEL); &ptr->dma, GFP_KERNEL);
if (!ptr->addr) if (!ptr->addr)
return -ENOMEM; return -ENOMEM;
ptr->size = size; ptr->size = size;
...@@ -848,7 +848,7 @@ static inline void iwlagn_free_dma_ptr(struct iwl_priv *priv, ...@@ -848,7 +848,7 @@ static inline void iwlagn_free_dma_ptr(struct iwl_priv *priv,
if (unlikely(!ptr->addr)) if (unlikely(!ptr->addr))
return; return;
dma_free_coherent(&priv->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); dma_free_coherent(priv->bus.dev, ptr->size, ptr->addr, ptr->dma);
memset(ptr, 0, sizeof(*ptr)); memset(ptr, 0, sizeof(*ptr));
} }
......
This diff is collapsed.
...@@ -125,7 +125,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data); ...@@ -125,7 +125,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data);
static inline void iwl_synchronize_irq(struct iwl_priv *priv) static inline void iwl_synchronize_irq(struct iwl_priv *priv)
{ {
/* wait to make sure we flush pending tasklet*/ /* wait to make sure we flush pending tasklet*/
synchronize_irq(priv->pci_dev->irq); synchronize_irq(priv->bus.irq);
tasklet_kill(&priv->irq_tasklet); tasklet_kill(&priv->irq_tasklet);
} }
...@@ -379,4 +379,8 @@ void iwl_testmode_cleanup(struct iwl_priv *priv) ...@@ -379,4 +379,8 @@ void iwl_testmode_cleanup(struct iwl_priv *priv)
} }
#endif #endif
int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops,
struct iwl_cfg *cfg);
void __devexit iwl_remove(struct iwl_priv * priv);
#endif /* __iwl_agn_h__ */ #endif /* __iwl_agn_h__ */
...@@ -972,15 +972,26 @@ struct iwl_rem_sta_cmd { ...@@ -972,15 +972,26 @@ struct iwl_rem_sta_cmd {
u8 reserved2[2]; u8 reserved2[2];
} __packed; } __packed;
#define IWL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
#define IWL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1)) /* WiFi queues mask */
#define IWL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2)) #define IWL_SCD_BK_MSK cpu_to_le32(BIT(0))
#define IWL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3)) #define IWL_SCD_BE_MSK cpu_to_le32(BIT(1))
#define IWL_SCD_VI_MSK cpu_to_le32(BIT(2))
#define IWL_SCD_VO_MSK cpu_to_le32(BIT(3))
#define IWL_SCD_MGMT_MSK cpu_to_le32(BIT(3))
/* PAN queues mask */
#define IWL_PAN_SCD_BK_MSK cpu_to_le32(BIT(4))
#define IWL_PAN_SCD_BE_MSK cpu_to_le32(BIT(5))
#define IWL_PAN_SCD_VI_MSK cpu_to_le32(BIT(6))
#define IWL_PAN_SCD_VO_MSK cpu_to_le32(BIT(7))
#define IWL_PAN_SCD_MGMT_MSK cpu_to_le32(BIT(7))
#define IWL_PAN_SCD_MULTICAST_MSK cpu_to_le32(BIT(8))
#define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) #define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
#define IWL_DROP_SINGLE 0 #define IWL_DROP_SINGLE 0
#define IWL_DROP_SELECTED 1 #define IWL_DROP_ALL (BIT(IWL_RXON_CTX_BSS) | BIT(IWL_RXON_CTX_PAN))
#define IWL_DROP_ALL 2
/* /*
* REPLY_TXFIFO_FLUSH = 0x1e(command and response) * REPLY_TXFIFO_FLUSH = 0x1e(command and response)
......
...@@ -209,10 +209,10 @@ int iwlcore_init_geos(struct iwl_priv *priv) ...@@ -209,10 +209,10 @@ int iwlcore_init_geos(struct iwl_priv *priv)
if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
priv->cfg->sku & EEPROM_SKU_CAP_BAND_52GHZ) { priv->cfg->sku & EEPROM_SKU_CAP_BAND_52GHZ) {
char buf[32];
priv->bus.ops->get_hw_id(&priv->bus, buf, sizeof(buf));
IWL_INFO(priv, "Incorrectly detected BG card as ABG. " IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
"Please send your PCI ID 0x%04X:0x%04X to maintainer.\n", "Please send your %s to maintainer.\n", buf);
priv->pci_dev->device,
priv->pci_dev->subsystem_device);
priv->cfg->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ; priv->cfg->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ;
} }
...@@ -997,8 +997,6 @@ void iwl_apm_stop(struct iwl_priv *priv) ...@@ -997,8 +997,6 @@ void iwl_apm_stop(struct iwl_priv *priv)
int iwl_apm_init(struct iwl_priv *priv) int iwl_apm_init(struct iwl_priv *priv)
{ {
int ret = 0; int ret = 0;
u16 lctl;
IWL_DEBUG_INFO(priv, "Init card's basic functions\n"); IWL_DEBUG_INFO(priv, "Init card's basic functions\n");
/* /*
...@@ -1027,27 +1025,7 @@ int iwl_apm_init(struct iwl_priv *priv) ...@@ -1027,27 +1025,7 @@ int iwl_apm_init(struct iwl_priv *priv)
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A);
/* priv->bus.ops->apm_config(&priv->bus);
* HW bug W/A for instability in PCIe bus L0->L0S->L1 transition.
* Check if BIOS (or OS) enabled L1-ASPM on this device.
* If so (likely), disable L0S, so device moves directly L0->L1;
* costs negligible amount of power savings.
* If not (unlikely), enable L0S, so there is at least some
* power savings, even without L1.
*/
lctl = iwl_pcie_link_ctl(priv);
if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) ==
PCI_CFG_LINK_CTRL_VAL_L1_EN) {
/* L1-ASPM enabled; disable(!) L0S */
iwl_set_bit(priv, CSR_GIO_REG,
CSR_GIO_REG_VAL_L0S_ENABLED);
IWL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n");
} else {
/* L1-ASPM disabled; enable(!) L0S */
iwl_clear_bit(priv, CSR_GIO_REG,
CSR_GIO_REG_VAL_L0S_ENABLED);
IWL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n");
}
/* Configure analog phase-lock-loop before activating to D0A */ /* Configure analog phase-lock-loop before activating to D0A */
if (priv->cfg->base_params->pll_cfg_val) if (priv->cfg->base_params->pll_cfg_val)
...@@ -1948,11 +1926,8 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, ...@@ -1948,11 +1926,8 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
#ifdef CONFIG_PM #ifdef CONFIG_PM
int iwl_pci_suspend(struct device *device) int iwl_suspend(struct iwl_priv *priv)
{ {
struct pci_dev *pdev = to_pci_dev(device);
struct iwl_priv *priv = pci_get_drvdata(pdev);
/* /*
* This function is called when system goes into suspend state * This function is called when system goes into suspend state
* mac80211 will call iwl_mac_stop() from the mac80211 suspend function * mac80211 will call iwl_mac_stop() from the mac80211 suspend function
...@@ -1965,18 +1940,10 @@ int iwl_pci_suspend(struct device *device) ...@@ -1965,18 +1940,10 @@ int iwl_pci_suspend(struct device *device)
return 0; return 0;
} }
int iwl_pci_resume(struct device *device) int iwl_resume(struct iwl_priv *priv)
{ {
struct pci_dev *pdev = to_pci_dev(device);
struct iwl_priv *priv = pci_get_drvdata(pdev);
bool hw_rfkill = false; bool hw_rfkill = false;
/*
* We disable the RETRY_TIMEOUT register (0x41) to keep
* PCI Tx retries from interfering with C3 CPU state.
*/
pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
iwl_enable_interrupts(priv); iwl_enable_interrupts(priv);
if (!(iwl_read32(priv, CSR_GP_CNTRL) & if (!(iwl_read32(priv, CSR_GP_CNTRL) &
...@@ -1993,13 +1960,4 @@ int iwl_pci_resume(struct device *device) ...@@ -1993,13 +1960,4 @@ int iwl_pci_resume(struct device *device)
return 0; return 0;
} }
const struct dev_pm_ops iwl_pm_ops = {
.suspend = iwl_pci_suspend,
.resume = iwl_pci_resume,
.freeze = iwl_pci_suspend,
.thaw = iwl_pci_resume,
.poweroff = iwl_pci_suspend,
.restore = iwl_pci_resume,
};
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
...@@ -76,11 +76,6 @@ struct iwl_cmd; ...@@ -76,11 +76,6 @@ struct iwl_cmd;
#define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" #define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation"
#define DRV_AUTHOR "<ilw@linux.intel.com>" #define DRV_AUTHOR "<ilw@linux.intel.com>"
#define IWL_PCI_DEVICE(dev, subdev, cfg) \
.vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
.subvendor = PCI_ANY_ID, .subdevice = (subdev), \
.driver_data = (kernel_ulong_t)&(cfg)
#define TIME_UNIT 1024 #define TIME_UNIT 1024
#define IWL_CMD(x) case x: return #x #define IWL_CMD(x) case x: return #x
...@@ -142,10 +137,6 @@ struct iwl_lib_ops { ...@@ -142,10 +137,6 @@ struct iwl_lib_ops {
/* temperature */ /* temperature */
struct iwl_temp_ops temp_ops; struct iwl_temp_ops temp_ops;
int (*txfifo_flush)(struct iwl_priv *priv, u16 flush_control);
void (*dev_txfifo_flush)(struct iwl_priv *priv, u16 flush_control);
}; };
/* NIC specific ops */ /* NIC specific ops */
...@@ -172,6 +163,8 @@ struct iwl_mod_params { ...@@ -172,6 +163,8 @@ struct iwl_mod_params {
bool bt_coex_active; /* def: true = enable bt coex */ bool bt_coex_active; /* def: true = enable bt coex */
int led_mode; /* def: 0 = system default */ int led_mode; /* def: 0 = system default */
bool no_sleep_autoadjust; /* def: true = disable autoadjust */ bool no_sleep_autoadjust; /* def: true = disable autoadjust */
bool power_save; /* def: false = disable power save */
int power_level; /* def: 1 = power level */
}; };
/* /*
...@@ -479,36 +472,14 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, ...@@ -479,36 +472,14 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,
int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
/*****************************************************
* PCI *
*****************************************************/
static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv)
{
int pos;
u16 pci_lnk_ctl;
pos = pci_find_capability(priv->pci_dev, PCI_CAP_ID_EXP);
pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl);
return pci_lnk_ctl;
}
void iwl_bg_watchdog(unsigned long data); void iwl_bg_watchdog(unsigned long data);
u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval); u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval);
__le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
u32 addon, u32 beacon_interval); u32 addon, u32 beacon_interval);
#ifdef CONFIG_PM #ifdef CONFIG_PM
int iwl_pci_suspend(struct device *device); int iwl_suspend(struct iwl_priv *priv);
int iwl_pci_resume(struct device *device); int iwl_resume(struct iwl_priv *priv);
extern const struct dev_pm_ops iwl_pm_ops;
#define IWL_PM_OPS (&iwl_pm_ops)
#else /* !CONFIG_PM */
#define IWL_PM_OPS NULL
#endif /* !CONFIG_PM */ #endif /* !CONFIG_PM */
/***************************************************** /*****************************************************
......
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
struct iwl_priv; struct iwl_priv;
extern u32 iwl_debug_level; extern u32 iwl_debug_level;
#define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a) #define IWL_ERR(p, f, a...) dev_err(p->bus.ops->get_dev(&p->bus), f, ## a)
#define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a) #define IWL_WARN(p, f, a...) dev_warn(p->bus.ops->get_dev(&p->bus), f, ## a)
#define IWL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a) #define IWL_INFO(p, f, a...) dev_info(p->bus.ops->get_dev(&p->bus), f, ## a)
#define IWL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a) #define IWL_CRIT(p, f, a...) dev_crit(p->bus.ops->get_dev(&p->bus), f, ## a)
#define iwl_print_hex_error(priv, p, len) \ #define iwl_print_hex_error(priv, p, len) \
do { \ do { \
......
...@@ -2493,7 +2493,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file, ...@@ -2493,7 +2493,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file,
if (iwl_is_rfkill(priv)) if (iwl_is_rfkill(priv))
return -EFAULT; return -EFAULT;
priv->cfg->ops->lib->dev_txfifo_flush(priv, IWL_DROP_ALL); iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL);
return count; return count;
} }
...@@ -2693,7 +2693,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) ...@@ -2693,7 +2693,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
if (priv->cfg->ops->lib->dev_txfifo_flush)
DEBUGFS_ADD_FILE(txfifo_flush, dir_debug, S_IWUSR); DEBUGFS_ADD_FILE(txfifo_flush, dir_debug, S_IWUSR);
DEBUGFS_ADD_FILE(protection_mode, dir_debug, S_IWUSR | S_IRUSR); DEBUGFS_ADD_FILE(protection_mode, dir_debug, S_IWUSR | S_IRUSR);
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include "iwl-agn-rs.h" #include "iwl-agn-rs.h"
#include "iwl-agn-tt.h" #include "iwl-agn-tt.h"
#define DRV_NAME "iwlagn"
struct iwl_tx_queue; struct iwl_tx_queue;
/* CT-KILL constants */ /* CT-KILL constants */
...@@ -1186,6 +1188,45 @@ struct iwl_testmode_trace { ...@@ -1186,6 +1188,45 @@ struct iwl_testmode_trace {
bool trace_enabled; bool trace_enabled;
}; };
#endif #endif
struct iwl_bus;
/**
* struct iwl_bus_ops - bus specific operations
* @get_pm_support: must returns true if the bus can go to sleep
* @apm_config: will be called during the config of the APM configuration
* @set_drv_data: set the priv pointer to the bus layer
* @get_dev: returns the device struct
* @get_irq: returns the irq number
* @get_hw_id: prints the hw_id in the provided buffer
* @write8: write a byte to register at offset ofs
* @write32: write a dword to register at offset ofs
* @wread32: read a dword at register at offset ofs
*/
struct iwl_bus_ops {
bool (*get_pm_support)(struct iwl_bus *bus);
void (*apm_config)(struct iwl_bus *bus);
void (*set_drv_data)(struct iwl_bus *bus, void *priv);
struct device *(*get_dev)(const struct iwl_bus *bus);
unsigned int (*get_irq)(const struct iwl_bus *bus);
void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len);
void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
u32 (*read32)(struct iwl_bus *bus, u32 ofs);
};
struct iwl_bus {
/* pointer to bus specific struct */
void *bus_specific;
/* Common data to all buses */
struct iwl_priv *priv; /* driver's context */
struct device *dev;
struct iwl_bus_ops *ops;
unsigned int irq;
};
struct iwl_priv { struct iwl_priv {
/* ieee device used by generic ieee processing code */ /* ieee device used by generic ieee processing code */
...@@ -1253,17 +1294,14 @@ struct iwl_priv { ...@@ -1253,17 +1294,14 @@ struct iwl_priv {
spinlock_t reg_lock; /* protect hw register access */ spinlock_t reg_lock; /* protect hw register access */
struct mutex mutex; struct mutex mutex;
/* basic pci-network driver stuff */ struct iwl_bus bus; /* bus specific data */
struct pci_dev *pci_dev;
/* pci hardware address support */
void __iomem *hw_base;
/* microcode/device supports multiple contexts */ /* microcode/device supports multiple contexts */
u8 valid_contexts; u8 valid_contexts;
/* command queue number */ /* command queue number */
u8 cmd_queue; u8 cmd_queue;
u8 last_sync_cmd_id;
/* max number of station keys */ /* max number of station keys */
u8 sta_key_max_num; u8 sta_key_max_num;
......
...@@ -834,3 +834,28 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, ...@@ -834,3 +834,28 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv,
return NULL; return NULL;
} }
void iwl_rf_config(struct iwl_priv *priv)
{
u16 radio_cfg;
radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
/* write radio config values to register */
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) {
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
EEPROM_RF_CFG_DASH_MSK(radio_cfg));
IWL_INFO(priv, "Radio type=0x%x-0x%x-0x%x\n",
EEPROM_RF_CFG_TYPE_MSK(radio_cfg),
EEPROM_RF_CFG_STEP_MSK(radio_cfg),
EEPROM_RF_CFG_DASH_MSK(radio_cfg));
} else
WARN_ON(1);
/* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
}
...@@ -268,13 +268,13 @@ extern const u8 iwl_eeprom_band_1[14]; ...@@ -268,13 +268,13 @@ extern const u8 iwl_eeprom_band_1[14];
/* General */ /* General */
#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
#define EEPROM_SUBSYSTEM_ID (2*0x0A) /* 2 bytes */
#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ #define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ #define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ #define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
#define EEPROM_VERSION (2*0x44) /* 2 bytes */ #define EEPROM_VERSION (2*0x44) /* 2 bytes */
#define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */ #define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */
#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ #define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
#define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ #define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */
#define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ #define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */
...@@ -309,5 +309,6 @@ void iwl_free_channel_map(struct iwl_priv *priv); ...@@ -309,5 +309,6 @@ void iwl_free_channel_map(struct iwl_priv *priv);
const struct iwl_channel_info *iwl_get_channel_info( const struct iwl_channel_info *iwl_get_channel_info(
const struct iwl_priv *priv, const struct iwl_priv *priv,
enum ieee80211_band band, u16 channel); enum ieee80211_band band, u16 channel);
void iwl_rf_config(struct iwl_priv *priv);
#endif /* __iwl_eeprom_h__ */ #endif /* __iwl_eeprom_h__ */
...@@ -181,7 +181,16 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -181,7 +181,16 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n",
get_cmd_string(cmd->id)); get_cmd_string(cmd->id));
set_bit(STATUS_HCMD_ACTIVE, &priv->status); if (test_and_set_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
IWL_ERR(priv, "STATUS_HCMD_ACTIVE already set while sending %s"
". Previous SYNC cmdn is %s\n",
get_cmd_string(cmd->id),
get_cmd_string(priv->last_sync_cmd_id));
WARN_ON(1);
} else {
priv->last_sync_cmd_id = cmd->id;
}
IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n", IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n",
get_cmd_string(cmd->id)); get_cmd_string(cmd->id));
......
...@@ -38,18 +38,18 @@ ...@@ -38,18 +38,18 @@
static inline void iwl_write8(struct iwl_priv *priv, u32 ofs, u8 val) static inline void iwl_write8(struct iwl_priv *priv, u32 ofs, u8 val)
{ {
trace_iwlwifi_dev_iowrite8(priv, ofs, val); trace_iwlwifi_dev_iowrite8(priv, ofs, val);
iowrite8(val, priv->hw_base + ofs); priv->bus.ops->write8(&priv->bus, ofs, val);
} }
static inline void iwl_write32(struct iwl_priv *priv, u32 ofs, u32 val) static inline void iwl_write32(struct iwl_priv *priv, u32 ofs, u32 val)
{ {
trace_iwlwifi_dev_iowrite32(priv, ofs, val); trace_iwlwifi_dev_iowrite32(priv, ofs, val);
iowrite32(val, priv->hw_base + ofs); priv->bus.ops->write32(&priv->bus, ofs, val);
} }
static inline u32 iwl_read32(struct iwl_priv *priv, u32 ofs) static inline u32 iwl_read32(struct iwl_priv *priv, u32 ofs)
{ {
u32 val = ioread32(priv->hw_base + ofs); u32 val = priv->bus.ops->read32(&priv->bus, ofs);
trace_iwlwifi_dev_ioread32(priv, ofs, val); trace_iwlwifi_dev_ioread32(priv, ofs, val);
return val; return val;
} }
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -204,7 +202,8 @@ void iwl_leds_init(struct iwl_priv *priv) ...@@ -204,7 +202,8 @@ void iwl_leds_init(struct iwl_priv *priv)
break; break;
} }
ret = led_classdev_register(&priv->pci_dev->dev, &priv->led); ret = led_classdev_register(priv->bus.dev,
&priv->led);
if (ret) { if (ret) {
kfree(priv->led.name); kfree(priv->led.name);
return; return;
......
This diff is collapsed.
/******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* Contact Information:
* Intel Linux Wireless <ilw@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
* BSD LICENSE
*
* Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 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 MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* 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 DAMAGE.
*
*****************************************************************************/
#ifndef __iwl_pci_h__
#define __iwl_pci_h__
int __must_check iwl_pci_register_driver(void);
void iwl_pci_unregister_driver(void);
#endif
...@@ -245,7 +245,7 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv, ...@@ -245,7 +245,7 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv,
} }
} }
if (priv->power_data.pci_pm) if (priv->power_data.bus_pm)
cmd->flags |= IWL_POWER_PCI_PM_MSK; cmd->flags |= IWL_POWER_PCI_PM_MSK;
else else
cmd->flags &= ~IWL_POWER_PCI_PM_MSK; cmd->flags &= ~IWL_POWER_PCI_PM_MSK;
...@@ -260,7 +260,7 @@ static void iwl_power_sleep_cam_cmd(struct iwl_priv *priv, ...@@ -260,7 +260,7 @@ static void iwl_power_sleep_cam_cmd(struct iwl_priv *priv,
{ {
memset(cmd, 0, sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd));
if (priv->power_data.pci_pm) if (priv->power_data.bus_pm)
cmd->flags |= IWL_POWER_PCI_PM_MSK; cmd->flags |= IWL_POWER_PCI_PM_MSK;
IWL_DEBUG_POWER(priv, "Sleep command for CAM\n"); IWL_DEBUG_POWER(priv, "Sleep command for CAM\n");
...@@ -296,7 +296,7 @@ static void iwl_power_fill_sleep_cmd(struct iwl_priv *priv, ...@@ -296,7 +296,7 @@ static void iwl_power_fill_sleep_cmd(struct iwl_priv *priv,
cmd->flags = IWL_POWER_DRIVER_ALLOW_SLEEP_MSK | cmd->flags = IWL_POWER_DRIVER_ALLOW_SLEEP_MSK |
IWL_POWER_FAST_PD; /* no use seeing frames for others */ IWL_POWER_FAST_PD; /* no use seeing frames for others */
if (priv->power_data.pci_pm) if (priv->power_data.bus_pm)
cmd->flags |= IWL_POWER_PCI_PM_MSK; cmd->flags |= IWL_POWER_PCI_PM_MSK;
if (priv->cfg->base_params->shadow_reg_enable) if (priv->cfg->base_params->shadow_reg_enable)
...@@ -358,9 +358,15 @@ static void iwl_power_build_cmd(struct iwl_priv *priv, ...@@ -358,9 +358,15 @@ static void iwl_power_build_cmd(struct iwl_priv *priv,
iwl_static_sleep_cmd(priv, cmd, iwl_static_sleep_cmd(priv, cmd,
priv->power_data.debug_sleep_level_override, priv->power_data.debug_sleep_level_override,
dtimper); dtimper);
else if (iwlagn_mod_params.no_sleep_autoadjust) else if (iwlagn_mod_params.no_sleep_autoadjust) {
iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_1, dtimper); if (iwlagn_mod_params.power_level > IWL_POWER_INDEX_1 &&
iwlagn_mod_params.power_level <= IWL_POWER_INDEX_5)
iwl_static_sleep_cmd(priv, cmd,
iwlagn_mod_params.power_level, dtimper);
else else
iwl_static_sleep_cmd(priv, cmd,
IWL_POWER_INDEX_1, dtimper);
} else
iwl_power_fill_sleep_cmd(priv, cmd, iwl_power_fill_sleep_cmd(priv, cmd,
priv->hw->conf.dynamic_ps_timeout, priv->hw->conf.dynamic_ps_timeout,
priv->hw->conf.max_sleep_period); priv->hw->conf.max_sleep_period);
...@@ -425,9 +431,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) ...@@ -425,9 +431,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
/* initialize to default */ /* initialize to default */
void iwl_power_initialize(struct iwl_priv *priv) void iwl_power_initialize(struct iwl_priv *priv)
{ {
u16 lctl = iwl_pcie_link_ctl(priv); priv->power_data.bus_pm = priv->bus.ops->get_pm_support(&priv->bus);
priv->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN);
priv->power_data.debug_sleep_level_override = -1; priv->power_data.debug_sleep_level_override = -1;
......
...@@ -43,7 +43,7 @@ struct iwl_power_mgr { ...@@ -43,7 +43,7 @@ struct iwl_power_mgr {
struct iwl_powertable_cmd sleep_cmd; struct iwl_powertable_cmd sleep_cmd;
struct iwl_powertable_cmd sleep_cmd_next; struct iwl_powertable_cmd sleep_cmd_next;
int debug_sleep_level_override; int debug_sleep_level_override;
bool pci_pm; bool bus_pm;
}; };
int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd,
......
...@@ -182,7 +182,7 @@ void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q ...@@ -182,7 +182,7 @@ void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q
int iwl_rx_queue_alloc(struct iwl_priv *priv) int iwl_rx_queue_alloc(struct iwl_priv *priv)
{ {
struct iwl_rx_queue *rxq = &priv->rxq; struct iwl_rx_queue *rxq = &priv->rxq;
struct device *dev = &priv->pci_dev->dev; struct device *dev = priv->bus.dev;
int i; int i;
spin_lock_init(&rxq->lock); spin_lock_init(&rxq->lock);
...@@ -213,7 +213,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) ...@@ -213,7 +213,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
return 0; return 0;
err_rb: err_rb:
dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, dma_free_coherent(dev, 4 * RX_QUEUE_SIZE, rxq->bd,
rxq->bd_dma); rxq->bd_dma);
err_bd: err_bd:
return -ENOMEM; return -ENOMEM;
......
...@@ -180,7 +180,7 @@ void iwl_testmode_init(struct iwl_priv *priv) ...@@ -180,7 +180,7 @@ void iwl_testmode_init(struct iwl_priv *priv)
static void iwl_trace_cleanup(struct iwl_priv *priv) static void iwl_trace_cleanup(struct iwl_priv *priv)
{ {
struct device *dev = &priv->pci_dev->dev; struct device *dev = priv->bus.dev;
if (priv->testmode_trace.trace_enabled) { if (priv->testmode_trace.trace_enabled) {
if (priv->testmode_trace.cpu_addr && if (priv->testmode_trace.cpu_addr &&
...@@ -484,7 +484,7 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -484,7 +484,7 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb)
struct iwl_priv *priv = hw->priv; struct iwl_priv *priv = hw->priv;
struct sk_buff *skb; struct sk_buff *skb;
int status = 0; int status = 0;
struct device *dev = &priv->pci_dev->dev; struct device *dev = priv->bus.dev;
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: case IWL_TM_CMD_APP2DEV_BEGIN_TRACE:
......
...@@ -128,7 +128,6 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd) ...@@ -128,7 +128,6 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
struct iwl_tfd *tfd) struct iwl_tfd *tfd)
{ {
struct pci_dev *dev = priv->pci_dev;
int i; int i;
int num_tbs; int num_tbs;
...@@ -143,15 +142,15 @@ static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, ...@@ -143,15 +142,15 @@ static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
/* Unmap tx_cmd */ /* Unmap tx_cmd */
if (num_tbs) if (num_tbs)
pci_unmap_single(dev, dma_unmap_single(priv->bus.dev,
dma_unmap_addr(meta, mapping), dma_unmap_addr(meta, mapping),
dma_unmap_len(meta, len), dma_unmap_len(meta, len),
PCI_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
/* Unmap chunks, if any. */ /* Unmap chunks, if any. */
for (i = 1; i < num_tbs; i++) for (i = 1; i < num_tbs; i++)
pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i), dma_unmap_single(priv->bus.dev, iwl_tfd_tb_get_addr(tfd, i),
iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); iwl_tfd_tb_get_len(tfd, i), DMA_TO_DEVICE);
} }
/** /**
...@@ -266,7 +265,7 @@ void iwl_tx_queue_unmap(struct iwl_priv *priv, int txq_id) ...@@ -266,7 +265,7 @@ void iwl_tx_queue_unmap(struct iwl_priv *priv, int txq_id)
void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
{ {
struct iwl_tx_queue *txq = &priv->txq[txq_id]; struct iwl_tx_queue *txq = &priv->txq[txq_id];
struct device *dev = &priv->pci_dev->dev; struct device *dev = priv->bus.dev;
int i; int i;
iwl_tx_queue_unmap(priv, txq_id); iwl_tx_queue_unmap(priv, txq_id);
...@@ -310,10 +309,10 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv) ...@@ -310,10 +309,10 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv)
i = get_cmd_index(q, q->read_ptr); i = get_cmd_index(q, q->read_ptr);
if (txq->meta[i].flags & CMD_MAPPED) { if (txq->meta[i].flags & CMD_MAPPED) {
pci_unmap_single(priv->pci_dev, dma_unmap_single(priv->bus.dev,
dma_unmap_addr(&txq->meta[i], mapping), dma_unmap_addr(&txq->meta[i], mapping),
dma_unmap_len(&txq->meta[i], len), dma_unmap_len(&txq->meta[i], len),
PCI_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
txq->meta[i].flags = 0; txq->meta[i].flags = 0;
} }
...@@ -332,7 +331,7 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv) ...@@ -332,7 +331,7 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv)
void iwl_cmd_queue_free(struct iwl_priv *priv) void iwl_cmd_queue_free(struct iwl_priv *priv)
{ {
struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue];
struct device *dev = &priv->pci_dev->dev; struct device *dev = priv->bus.dev;
int i; int i;
iwl_cmd_queue_unmap(priv); iwl_cmd_queue_unmap(priv);
...@@ -434,7 +433,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, ...@@ -434,7 +433,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
static int iwl_tx_queue_alloc(struct iwl_priv *priv, static int iwl_tx_queue_alloc(struct iwl_priv *priv,
struct iwl_tx_queue *txq, u32 id) struct iwl_tx_queue *txq, u32 id)
{ {
struct device *dev = &priv->pci_dev->dev; struct device *dev = priv->bus.dev;
size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX;
/* Driver private data, only for Tx (not command) queues, /* Driver private data, only for Tx (not command) queues,
...@@ -456,7 +455,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, ...@@ -456,7 +455,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr,
GFP_KERNEL); GFP_KERNEL);
if (!txq->tfds) { if (!txq->tfds) {
IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); IWL_ERR(priv, "dma_alloc_coherent(%zd) failed\n", tfd_sz);
goto error; goto error;
} }
txq->q.id = id; txq->q.id = id;
...@@ -677,9 +676,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -677,9 +676,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
le16_to_cpu(out_cmd->hdr.sequence), cmd_size, le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
q->write_ptr, idx, priv->cmd_queue); q->write_ptr, idx, priv->cmd_queue);
phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr, phys_addr = dma_map_single(priv->bus.dev, &out_cmd->hdr, copy_size,
copy_size, PCI_DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) { if (unlikely(dma_mapping_error(priv->bus.dev, phys_addr))) {
idx = -ENOMEM; idx = -ENOMEM;
goto out; goto out;
} }
...@@ -699,9 +698,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -699,9 +698,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
continue; continue;
if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
continue; continue;
phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i], phys_addr = dma_map_single(priv->bus.dev, (void *)cmd->data[i],
cmd->len[i], PCI_DMA_TODEVICE); cmd->len[i], DMA_TO_DEVICE);
if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) { if (dma_mapping_error(priv->bus.dev, phys_addr)) {
iwlagn_unmap_tfd(priv, out_meta, iwlagn_unmap_tfd(priv, out_meta,
&txq->tfds[q->write_ptr]); &txq->tfds[q->write_ptr]);
idx = -ENOMEM; idx = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment