Commit 600c0e11 authored by Tomas Winkler's avatar Tomas Winkler Committed by John W. Linville

iwlwifi: use iwl-commands.h also in 3945

This patch uses iwl-commands.h also for iwl3945
more clean ups are required but this get to stage where it
compiles cleanly.
Most massive changes are in spectrum and power managment.
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Acked-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b936d9be
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "iwl-commands.h"
#include "iwl-3945-commands.h" #include "iwl-3945-commands.h"
#include "iwl-3945.h" #include "iwl-3945.h"
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include "iwl-commands.h"
#include "iwl-3945-commands.h" #include "iwl-3945-commands.h"
#include "iwl-3945.h" #include "iwl-3945.h"
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "iwl-3945-core.h" #include "iwl-3945-core.h"
#include "iwl-3945-fh.h" #include "iwl-3945-fh.h"
#include "iwl-commands.h"
#include "iwl-3945-commands.h" #include "iwl-3945-commands.h"
#include "iwl-3945.h" #include "iwl-3945.h"
#include "iwl-helpers.h" #include "iwl-helpers.h"
......
...@@ -250,7 +250,7 @@ struct iwl3945_clip_group { ...@@ -250,7 +250,7 @@ struct iwl3945_clip_group {
/* Power management (not Tx power) structures */ /* Power management (not Tx power) structures */
struct iwl3945_power_vec_entry { struct iwl3945_power_vec_entry {
struct iwl3945_powertable_cmd cmd; struct iwl_powertable_cmd cmd;
u8 no_dtim; u8 no_dtim;
}; };
#define IWL_POWER_RANGE_0 (0) #define IWL_POWER_RANGE_0 (0)
...@@ -289,12 +289,6 @@ struct iwl3945_frame { ...@@ -289,12 +289,6 @@ struct iwl3945_frame {
struct list_head list; struct list_head list;
}; };
#define SEQ_TO_QUEUE(x) ((x >> 8) & 0xbf)
#define QUEUE_TO_SEQ(x) ((x & 0xbf) << 8)
#define SEQ_TO_INDEX(x) ((u8)(x & 0xff))
#define INDEX_TO_SEQ(x) ((u8)(x & 0xff))
#define SEQ_HUGE_FRAME (0x4000)
#define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000)
#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
...@@ -344,7 +338,7 @@ struct iwl3945_cmd { ...@@ -344,7 +338,7 @@ struct iwl3945_cmd {
u32 val32; u32 val32;
struct iwl3945_bt_cmd bt; struct iwl3945_bt_cmd bt;
struct iwl3945_rxon_time_cmd rxon_time; struct iwl3945_rxon_time_cmd rxon_time;
struct iwl3945_powertable_cmd powertable; struct iwl_powertable_cmd powertable;
struct iwl3945_qosparam_cmd qosparam; struct iwl3945_qosparam_cmd qosparam;
struct iwl3945_tx_cmd tx; struct iwl3945_tx_cmd tx;
struct iwl3945_tx_beacon_cmd tx_beacon; struct iwl3945_tx_beacon_cmd tx_beacon;
...@@ -707,7 +701,7 @@ struct iwl3945_priv { ...@@ -707,7 +701,7 @@ struct iwl3945_priv {
#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
/* spectrum measurement report caching */ /* spectrum measurement report caching */
struct iwl3945_spectrum_notification measure_report; struct iwl_spectrum_notification measure_report;
u8 measurement_status; u8 measurement_status;
#endif #endif
/* ucode beacon time */ /* ucode beacon time */
......
...@@ -300,11 +300,12 @@ struct iwl_cmd_header { ...@@ -300,11 +300,12 @@ struct iwl_cmd_header {
* 5350 has 3 transmitters * 5350 has 3 transmitters
* bit14:16 * bit14:16
*/ */
#define RATE_MCS_ANT_POS 14 #define RATE_MCS_ANT_POS 14
#define RATE_MCS_ANT_A_MSK 0x04000 #define RATE_MCS_ANT_A_MSK 0x04000
#define RATE_MCS_ANT_B_MSK 0x08000 #define RATE_MCS_ANT_B_MSK 0x08000
#define RATE_MCS_ANT_C_MSK 0x10000 #define RATE_MCS_ANT_C_MSK 0x10000
#define RATE_MCS_ANT_ABC_MSK 0x1C000 #define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
#define RATE_ANT_NUM 3 #define RATE_ANT_NUM 3
#define POWER_TABLE_NUM_ENTRIES 33 #define POWER_TABLE_NUM_ENTRIES 33
...@@ -2044,15 +2045,23 @@ struct iwl_spectrum_notification { ...@@ -2044,15 +2045,23 @@ struct iwl_spectrum_notification {
*/ */
#define IWL_POWER_VEC_SIZE 5 #define IWL_POWER_VEC_SIZE 5
#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(1 << 0) #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
#define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(1 << 2) #define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2))
#define IWL_POWER_PCI_PM_MSK cpu_to_le16(1 << 3) #define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
#define IWL_POWER_FAST_PD cpu_to_le16(1 << 4) #define IWL_POWER_FAST_PD cpu_to_le16(BIT(4))
struct iwl3945_powertable_cmd {
__le16 flags;
u8 reserved[2];
__le32 rx_data_timeout;
__le32 tx_data_timeout;
__le32 sleep_interval[IWL_POWER_VEC_SIZE];
} __attribute__ ((packed));
struct iwl_powertable_cmd { struct iwl_powertable_cmd {
__le16 flags; __le16 flags;
u8 keep_alive_seconds; u8 keep_alive_seconds; /* 3945 reserved */
u8 debug_flags; u8 debug_flags; /* 3945 reserved */
__le32 rx_data_timeout; __le32 rx_data_timeout;
__le32 tx_data_timeout; __le32 tx_data_timeout;
__le32 sleep_interval[IWL_POWER_VEC_SIZE]; __le32 sleep_interval[IWL_POWER_VEC_SIZE];
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <asm/div64.h> #include <asm/div64.h>
#include "iwl-3945-core.h" #include "iwl-3945-core.h"
#include "iwl-commands.h"
#include "iwl-3945-commands.h" #include "iwl-3945-commands.h"
#include "iwl-3945.h" #include "iwl-3945.h"
#include "iwl-3945-fh.h" #include "iwl-3945-fh.h"
...@@ -634,7 +635,7 @@ static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_c ...@@ -634,7 +635,7 @@ static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_c
out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) |
INDEX_TO_SEQ(q->write_ptr)); INDEX_TO_SEQ(q->write_ptr));
if (out_cmd->meta.flags & CMD_SIZE_HUGE) if (out_cmd->meta.flags & CMD_SIZE_HUGE)
out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
offsetof(struct iwl3945_cmd, hdr); offsetof(struct iwl3945_cmd, hdr);
...@@ -1804,8 +1805,9 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force) ...@@ -1804,8 +1805,9 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
*/ */
#define MSEC_TO_USEC 1024 #define MSEC_TO_USEC 1024
#define NOSLP __constant_cpu_to_le32(0)
#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK #define NOSLP __constant_cpu_to_le16(0), 0, 0
#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0
#define SLP_TIMEOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC) #define SLP_TIMEOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC)
#define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \ #define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \
__constant_cpu_to_le32(X1), \ __constant_cpu_to_le32(X1), \
...@@ -1813,7 +1815,6 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force) ...@@ -1813,7 +1815,6 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
__constant_cpu_to_le32(X3), \ __constant_cpu_to_le32(X3), \
__constant_cpu_to_le32(X4)} __constant_cpu_to_le32(X4)}
/* default power management (not Tx power) table values */ /* default power management (not Tx power) table values */
/* for TIM 0-10 */ /* for TIM 0-10 */
static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = { static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
...@@ -1862,7 +1863,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv) ...@@ -1862,7 +1863,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
if (rc != 0) if (rc != 0)
return 0; return 0;
else { else {
struct iwl3945_powertable_cmd *cmd; struct iwl_powertable_cmd *cmd;
IWL_DEBUG_POWER("adjust power command flags\n"); IWL_DEBUG_POWER("adjust power command flags\n");
...@@ -1879,7 +1880,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv) ...@@ -1879,7 +1880,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
} }
static int iwl3945_update_power_cmd(struct iwl3945_priv *priv, static int iwl3945_update_power_cmd(struct iwl3945_priv *priv,
struct iwl3945_powertable_cmd *cmd, u32 mode) struct iwl_powertable_cmd *cmd, u32 mode)
{ {
int rc = 0, i; int rc = 0, i;
u8 skip; u8 skip;
...@@ -1946,7 +1947,7 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode) ...@@ -1946,7 +1947,7 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
{ {
u32 uninitialized_var(final_mode); u32 uninitialized_var(final_mode);
int rc; int rc;
struct iwl3945_powertable_cmd cmd; struct iwl_powertable_cmd cmd;
/* If on battery, set to 3, /* If on battery, set to 3,
* if plugged into AC power, set to CAM ("continuously aware mode"), * if plugged into AC power, set to CAM ("continuously aware mode"),
...@@ -1965,7 +1966,9 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode) ...@@ -1965,7 +1966,9 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
iwl3945_update_power_cmd(priv, &cmd, final_mode); iwl3945_update_power_cmd(priv, &cmd, final_mode);
rc = iwl3945_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); /* FIXME use get_hcmd_size 3945 command is 4 bytes shorter */
rc = iwl3945_send_cmd_pdu(priv, POWER_TABLE_CMD,
sizeof(struct iwl3945_powertable_cmd), &cmd);
if (final_mode == IWL_POWER_MODE_CAM) if (final_mode == IWL_POWER_MODE_CAM)
clear_bit(STATUS_POWER_PMI, &priv->status); clear_bit(STATUS_POWER_PMI, &priv->status);
...@@ -2867,7 +2870,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv, ...@@ -2867,7 +2870,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
struct ieee80211_measurement_params *params, struct ieee80211_measurement_params *params,
u8 type) u8 type)
{ {
struct iwl3945_spectrum_cmd spectrum; struct iwl_spectrum_cmd spectrum;
struct iwl3945_rx_packet *res; struct iwl3945_rx_packet *res;
struct iwl3945_host_cmd cmd = { struct iwl3945_host_cmd cmd = {
.id = REPLY_SPECTRUM_MEASUREMENT_CMD, .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
...@@ -3008,7 +3011,7 @@ static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buff ...@@ -3008,7 +3011,7 @@ static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buff
{ {
struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon; struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon;
struct iwl3945_csa_notification *csa = &(pkt->u.csa_notif); struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
rxon->channel = csa->channel; rxon->channel = csa->channel;
...@@ -3020,7 +3023,7 @@ static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv, ...@@ -3020,7 +3023,7 @@ static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv,
{ {
#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl3945_spectrum_notification *report = &(pkt->u.spectrum_notif); struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif);
if (!report->state) { if (!report->state) {
IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO, IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO,
...@@ -3038,7 +3041,7 @@ static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv, ...@@ -3038,7 +3041,7 @@ static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
{ {
#ifdef CONFIG_IWL3945_DEBUG #ifdef CONFIG_IWL3945_DEBUG
struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
struct iwl3945_sleep_notification *sleep = &(pkt->u.sleep_notif); struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif);
IWL_DEBUG_RX("sleep mode: %d, src: %d\n", IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
sleep->pm_sleep_mode, sleep->pm_wakeup_src); sleep->pm_sleep_mode, sleep->pm_wakeup_src);
#endif #endif
...@@ -3345,7 +3348,7 @@ static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv, ...@@ -3345,7 +3348,7 @@ static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
u16 sequence = le16_to_cpu(pkt->hdr.sequence); u16 sequence = le16_to_cpu(pkt->hdr.sequence);
int txq_id = SEQ_TO_QUEUE(sequence); int txq_id = SEQ_TO_QUEUE(sequence);
int index = SEQ_TO_INDEX(sequence); int index = SEQ_TO_INDEX(sequence);
int huge = sequence & SEQ_HUGE_FRAME; int huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
int cmd_index; int cmd_index;
struct iwl3945_cmd *cmd; struct iwl3945_cmd *cmd;
...@@ -7407,7 +7410,7 @@ static ssize_t show_measurement(struct device *d, ...@@ -7407,7 +7410,7 @@ static ssize_t show_measurement(struct device *d,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct iwl3945_priv *priv = dev_get_drvdata(d); struct iwl3945_priv *priv = dev_get_drvdata(d);
struct iwl3945_spectrum_notification measure_report; struct iwl_spectrum_notification measure_report;
u32 size = sizeof(measure_report), len = 0, ofs = 0; u32 size = sizeof(measure_report), len = 0, ofs = 0;
u8 *data = (u8 *)&measure_report; u8 *data = (u8 *)&measure_report;
unsigned long flags; unsigned long flags;
......
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