aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-12-18 21:37:04 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:58:53 -0500
commit600c0e11ea6161e00e8cb4b4dda39a64ce988c60 (patch)
tree282d6b6d4a4b2bed814509083669c68da5e8c097 /drivers/net/wireless/iwlwifi/iwl3945-base.c
parentb936d9be05d66172b2c035eaca002a134f078c64 (diff)
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: Tomas Winkler <tomas.winkler@intel.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index d5fb65e54343..13a0b9a3ec7d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -47,6 +47,7 @@
47#include <asm/div64.h> 47#include <asm/div64.h>
48 48
49#include "iwl-3945-core.h" 49#include "iwl-3945-core.h"
50#include "iwl-commands.h"
50#include "iwl-3945-commands.h" 51#include "iwl-3945-commands.h"
51#include "iwl-3945.h" 52#include "iwl-3945.h"
52#include "iwl-3945-fh.h" 53#include "iwl-3945-fh.h"
@@ -634,7 +635,7 @@ static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_c
634 out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | 635 out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) |
635 INDEX_TO_SEQ(q->write_ptr)); 636 INDEX_TO_SEQ(q->write_ptr));
636 if (out_cmd->meta.flags & CMD_SIZE_HUGE) 637 if (out_cmd->meta.flags & CMD_SIZE_HUGE)
637 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 638 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
638 639
639 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + 640 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
640 offsetof(struct iwl3945_cmd, hdr); 641 offsetof(struct iwl3945_cmd, hdr);
@@ -1804,8 +1805,9 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
1804 */ 1805 */
1805#define MSEC_TO_USEC 1024 1806#define MSEC_TO_USEC 1024
1806 1807
1807#define NOSLP __constant_cpu_to_le32(0) 1808
1808#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK 1809#define NOSLP __constant_cpu_to_le16(0), 0, 0
1810#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0
1809#define SLP_TIMEOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC) 1811#define SLP_TIMEOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC)
1810#define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \ 1812#define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \
1811 __constant_cpu_to_le32(X1), \ 1813 __constant_cpu_to_le32(X1), \
@@ -1813,7 +1815,6 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
1813 __constant_cpu_to_le32(X3), \ 1815 __constant_cpu_to_le32(X3), \
1814 __constant_cpu_to_le32(X4)} 1816 __constant_cpu_to_le32(X4)}
1815 1817
1816
1817/* default power management (not Tx power) table values */ 1818/* default power management (not Tx power) table values */
1818/* for TIM 0-10 */ 1819/* for TIM 0-10 */
1819static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = { 1820static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
@@ -1862,7 +1863,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
1862 if (rc != 0) 1863 if (rc != 0)
1863 return 0; 1864 return 0;
1864 else { 1865 else {
1865 struct iwl3945_powertable_cmd *cmd; 1866 struct iwl_powertable_cmd *cmd;
1866 1867
1867 IWL_DEBUG_POWER("adjust power command flags\n"); 1868 IWL_DEBUG_POWER("adjust power command flags\n");
1868 1869
@@ -1879,7 +1880,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
1879} 1880}
1880 1881
1881static int iwl3945_update_power_cmd(struct iwl3945_priv *priv, 1882static int iwl3945_update_power_cmd(struct iwl3945_priv *priv,
1882 struct iwl3945_powertable_cmd *cmd, u32 mode) 1883 struct iwl_powertable_cmd *cmd, u32 mode)
1883{ 1884{
1884 int rc = 0, i; 1885 int rc = 0, i;
1885 u8 skip; 1886 u8 skip;
@@ -1946,7 +1947,7 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
1946{ 1947{
1947 u32 uninitialized_var(final_mode); 1948 u32 uninitialized_var(final_mode);
1948 int rc; 1949 int rc;
1949 struct iwl3945_powertable_cmd cmd; 1950 struct iwl_powertable_cmd cmd;
1950 1951
1951 /* If on battery, set to 3, 1952 /* If on battery, set to 3,
1952 * if plugged into AC power, set to CAM ("continuously aware mode"), 1953 * 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 1966
1966 iwl3945_update_power_cmd(priv, &cmd, final_mode); 1967 iwl3945_update_power_cmd(priv, &cmd, final_mode);
1967 1968
1968 rc = iwl3945_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); 1969 /* FIXME use get_hcmd_size 3945 command is 4 bytes shorter */
1970 rc = iwl3945_send_cmd_pdu(priv, POWER_TABLE_CMD,
1971 sizeof(struct iwl3945_powertable_cmd), &cmd);
1969 1972
1970 if (final_mode == IWL_POWER_MODE_CAM) 1973 if (final_mode == IWL_POWER_MODE_CAM)
1971 clear_bit(STATUS_POWER_PMI, &priv->status); 1974 clear_bit(STATUS_POWER_PMI, &priv->status);
@@ -2867,7 +2870,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
2867 struct ieee80211_measurement_params *params, 2870 struct ieee80211_measurement_params *params,
2868 u8 type) 2871 u8 type)
2869{ 2872{
2870 struct iwl3945_spectrum_cmd spectrum; 2873 struct iwl_spectrum_cmd spectrum;
2871 struct iwl3945_rx_packet *res; 2874 struct iwl3945_rx_packet *res;
2872 struct iwl3945_host_cmd cmd = { 2875 struct iwl3945_host_cmd cmd = {
2873 .id = REPLY_SPECTRUM_MEASUREMENT_CMD, 2876 .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
@@ -3008,7 +3011,7 @@ static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buff
3008{ 3011{
3009 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3012 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3010 struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon; 3013 struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon;
3011 struct iwl3945_csa_notification *csa = &(pkt->u.csa_notif); 3014 struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
3012 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", 3015 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
3013 le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); 3016 le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
3014 rxon->channel = csa->channel; 3017 rxon->channel = csa->channel;
@@ -3020,7 +3023,7 @@ static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv,
3020{ 3023{
3021#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 3024#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
3022 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3025 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3023 struct iwl3945_spectrum_notification *report = &(pkt->u.spectrum_notif); 3026 struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif);
3024 3027
3025 if (!report->state) { 3028 if (!report->state) {
3026 IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO, 3029 IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO,
@@ -3038,7 +3041,7 @@ static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
3038{ 3041{
3039#ifdef CONFIG_IWL3945_DEBUG 3042#ifdef CONFIG_IWL3945_DEBUG
3040 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3043 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
3041 struct iwl3945_sleep_notification *sleep = &(pkt->u.sleep_notif); 3044 struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif);
3042 IWL_DEBUG_RX("sleep mode: %d, src: %d\n", 3045 IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
3043 sleep->pm_sleep_mode, sleep->pm_wakeup_src); 3046 sleep->pm_sleep_mode, sleep->pm_wakeup_src);
3044#endif 3047#endif
@@ -3345,7 +3348,7 @@ static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
3345 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 3348 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
3346 int txq_id = SEQ_TO_QUEUE(sequence); 3349 int txq_id = SEQ_TO_QUEUE(sequence);
3347 int index = SEQ_TO_INDEX(sequence); 3350 int index = SEQ_TO_INDEX(sequence);
3348 int huge = sequence & SEQ_HUGE_FRAME; 3351 int huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
3349 int cmd_index; 3352 int cmd_index;
3350 struct iwl3945_cmd *cmd; 3353 struct iwl3945_cmd *cmd;
3351 3354
@@ -7407,7 +7410,7 @@ static ssize_t show_measurement(struct device *d,
7407 struct device_attribute *attr, char *buf) 7410 struct device_attribute *attr, char *buf)
7408{ 7411{
7409 struct iwl3945_priv *priv = dev_get_drvdata(d); 7412 struct iwl3945_priv *priv = dev_get_drvdata(d);
7410 struct iwl3945_spectrum_notification measure_report; 7413 struct iwl_spectrum_notification measure_report;
7411 u32 size = sizeof(measure_report), len = 0, ofs = 0; 7414 u32 size = sizeof(measure_report), len = 0, ofs = 0;
7412 u8 *data = (u8 *)&measure_report; 7415 u8 *data = (u8 *)&measure_report;
7413 unsigned long flags; 7416 unsigned long flags;