iwlwifi: 3945 remove iwl-3945-commands.h
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl3945-base.c
index d645808..3d8669c 100644 (file)
@@ -47,7 +47,9 @@
 #include <asm/div64.h>
 
 #include "iwl-3945-core.h"
+#include "iwl-commands.h"
 #include "iwl-3945.h"
+#include "iwl-3945-fh.h"
 #include "iwl-helpers.h"
 
 #ifdef CONFIG_IWL3945_DEBUG
@@ -460,8 +462,6 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8
        /* Turn on both antennas for the station... */
        station->sta.rate_n_flags =
                        iwl3945_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK);
-       station->current_rate.rate_n_flags =
-                       le16_to_cpu(station->sta.rate_n_flags);
 
        spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
 
@@ -634,7 +634,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) |
                        INDEX_TO_SEQ(q->write_ptr));
        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 +
                        offsetof(struct iwl3945_cmd, hdr);
@@ -745,7 +745,7 @@ static int iwl3945_send_cmd_sync(struct iwl3945_priv *priv, struct iwl3945_host_
                IWL_ERROR("Error: Response NULL in '%s'\n",
                          get_cmd_string(cmd->id));
                ret = -EIO;
-               goto out;
+               goto cancel;
        }
 
        ret = 0;
@@ -969,7 +969,7 @@ static int iwl3945_full_rxon_required(struct iwl3945_priv *priv)
 static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
 {
        int rc = 0;
-       struct iwl3945_rx_packet *res = NULL;
+       struct iwl_rx_packet *res = NULL;
        struct iwl3945_rxon_assoc_cmd rxon_assoc;
        struct iwl3945_host_cmd cmd = {
                .id = REPLY_RXON_ASSOC,
@@ -998,7 +998,7 @@ static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
        if (rc)
                return rc;
 
-       res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
+       res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
                IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n");
                rc = -EIO;
@@ -1138,7 +1138,7 @@ static int iwl3945_commit_rxon(struct iwl3945_priv *priv)
 
 static int iwl3945_send_bt_config(struct iwl3945_priv *priv)
 {
-       struct iwl3945_bt_cmd bt_cmd = {
+       struct iwl_bt_cmd bt_cmd = {
                .flags = 3,
                .lead_time = 0xAA,
                .max_kill = 1,
@@ -1147,13 +1147,13 @@ static int iwl3945_send_bt_config(struct iwl3945_priv *priv)
        };
 
        return iwl3945_send_cmd_pdu(priv, REPLY_BT_CONFIG,
-                               sizeof(struct iwl3945_bt_cmd), &bt_cmd);
+                                       sizeof(bt_cmd), &bt_cmd);
 }
 
 static int iwl3945_send_scan_abort(struct iwl3945_priv *priv)
 {
        int rc = 0;
-       struct iwl3945_rx_packet *res;
+       struct iwl_rx_packet *res;
        struct iwl3945_host_cmd cmd = {
                .id = REPLY_SCAN_ABORT_CMD,
                .meta.flags = CMD_WANT_SKB,
@@ -1173,7 +1173,7 @@ static int iwl3945_send_scan_abort(struct iwl3945_priv *priv)
                return rc;
        }
 
-       res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
+       res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->u.status != CAN_ABORT_STATUS) {
                /* The scan abort will return 1 for success or
                 * 2 for "failure".  A failure condition can be
@@ -1226,14 +1226,14 @@ static int iwl3945_send_card_state(struct iwl3945_priv *priv, u32 flags, u8 meta
 static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv,
                                     struct iwl3945_cmd *cmd, struct sk_buff *skb)
 {
-       struct iwl3945_rx_packet *res = NULL;
+       struct iwl_rx_packet *res = NULL;
 
        if (!skb) {
                IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
                return 1;
        }
 
-       res = (struct iwl3945_rx_packet *)skb->data;
+       res = (struct iwl_rx_packet *)skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
                IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
                          res->hdr.flags);
@@ -1254,7 +1254,7 @@ static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv,
 int iwl3945_send_add_station(struct iwl3945_priv *priv,
                         struct iwl3945_addsta_cmd *sta, u8 flags)
 {
-       struct iwl3945_rx_packet *res = NULL;
+       struct iwl_rx_packet *res = NULL;
        int rc = 0;
        struct iwl3945_host_cmd cmd = {
                .id = REPLY_ADD_STA,
@@ -1273,7 +1273,7 @@ int iwl3945_send_add_station(struct iwl3945_priv *priv,
        if (rc || (flags & CMD_ASYNC))
                return rc;
 
-       res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
+       res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
                IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
                          res->hdr.flags);
@@ -1342,7 +1342,8 @@ static int iwl3945_clear_sta_key_info(struct iwl3945_priv *priv, u8 sta_id)
 
        spin_lock_irqsave(&priv->sta_lock, flags);
        memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl3945_hw_key));
-       memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl3945_keyinfo));
+       memset(&priv->stations[sta_id].sta.key, 0,
+               sizeof(struct iwl4965_keyinfo));
        priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
        priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
        priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
@@ -1671,11 +1672,11 @@ static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv,
  * QoS  support
 */
 static int iwl3945_send_qos_params_command(struct iwl3945_priv *priv,
-                                      struct iwl3945_qosparam_cmd *qos)
+                                      struct iwl_qosparam_cmd *qos)
 {
 
        return iwl3945_send_cmd_pdu(priv, REPLY_QOS_PARAM,
-                               sizeof(struct iwl3945_qosparam_cmd), qos);
+                               sizeof(struct iwl_qosparam_cmd), qos);
 }
 
 static void iwl3945_reset_qos(struct iwl3945_priv *priv)
@@ -1804,8 +1805,9 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
  */
 #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_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \
                                     __constant_cpu_to_le32(X1), \
@@ -1813,7 +1815,6 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
                                     __constant_cpu_to_le32(X3), \
                                     __constant_cpu_to_le32(X4)}
 
-
 /* default power management (not Tx power) table values */
 /* for TIM  0-10 */
 static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
@@ -1862,7 +1863,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
        if (rc != 0)
                return 0;
        else {
-               struct iwl3945_powertable_cmd *cmd;
+               struct iwl_powertable_cmd *cmd;
 
                IWL_DEBUG_POWER("adjust power command flags\n");
 
@@ -1879,7 +1880,7 @@ int iwl3945_power_init_handle(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;
        u8 skip;
@@ -1946,7 +1947,7 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
 {
        u32 uninitialized_var(final_mode);
        int rc;
-       struct iwl3945_powertable_cmd cmd;
+       struct iwl_powertable_cmd cmd;
 
        /* If on battery, set to 3,
         * 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)
 
        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)
                clear_bit(STATUS_POWER_PMI, &priv->status);
@@ -2054,13 +2057,10 @@ static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv)
        conf = ieee80211_get_hw_conf(priv->hw);
 
        spin_lock_irqsave(&priv->lock, flags);
-       priv->rxon_timing.timestamp.dw[1] = cpu_to_le32(priv->timestamp1);
-       priv->rxon_timing.timestamp.dw[0] = cpu_to_le32(priv->timestamp0);
-
+       priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp);
        priv->rxon_timing.listen_interval = INTEL_CONN_LISTEN_INTERVAL;
 
-       tsf = priv->timestamp1;
-       tsf = ((tsf << 32) | priv->timestamp0);
+       tsf = priv->timestamp;
 
        beacon_int = priv->beacon_int;
        spin_unlock_irqrestore(&priv->lock, flags);
@@ -2578,7 +2578,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
         * We'll tell device about this padding later.
         */
        len = priv->hw_setting.tx_cmd_len +
-               sizeof(struct iwl3945_cmd_header) + hdr_len;
+                       sizeof(struct iwl_cmd_header) + hdr_len;
 
        len_org = len;
        len = (len + 3) & ~3;
@@ -2867,8 +2867,8 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
                               struct ieee80211_measurement_params *params,
                               u8 type)
 {
-       struct iwl3945_spectrum_cmd spectrum;
-       struct iwl3945_rx_packet *res;
+       struct iwl_spectrum_cmd spectrum;
+       struct iwl_rx_packet *res;
        struct iwl3945_host_cmd cmd = {
                .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
                .data = (void *)&spectrum,
@@ -2913,7 +2913,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
        if (rc)
                return rc;
 
-       res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
+       res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
                IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n");
                rc = -EIO;
@@ -2945,8 +2945,8 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
 static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
                               struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_alive_resp *palive;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_alive_resp *palive;
        struct delayed_work *pwork;
 
        palive = &pkt->u.alive_frame;
@@ -2958,14 +2958,13 @@ static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
 
        if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
                IWL_DEBUG_INFO("Initialization Alive received.\n");
-               memcpy(&priv->card_alive_init,
-                      &pkt->u.alive_frame,
-                      sizeof(struct iwl3945_init_alive_resp));
+               memcpy(&priv->card_alive_init, &pkt->u.alive_frame,
+                      sizeof(struct iwl_alive_resp));
                pwork = &priv->init_alive_start;
        } else {
                IWL_DEBUG_INFO("Runtime Alive received.\n");
                memcpy(&priv->card_alive, &pkt->u.alive_frame,
-                      sizeof(struct iwl3945_alive_resp));
+                      sizeof(struct iwl_alive_resp));
                pwork = &priv->alive_start;
                iwl3945_disable_events(priv);
        }
@@ -2982,7 +2981,7 @@ static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
 static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv,
                                 struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
 
        IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
        return;
@@ -2991,7 +2990,7 @@ static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv,
 static void iwl3945_rx_reply_error(struct iwl3945_priv *priv,
                               struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
 
        IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) "
                "seq 0x%04X ser 0x%08X\n",
@@ -3006,9 +3005,9 @@ static void iwl3945_rx_reply_error(struct iwl3945_priv *priv,
 
 static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
        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",
                      le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
        rxon->channel = csa->channel;
@@ -3019,8 +3018,8 @@ static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv,
                                          struct iwl3945_rx_mem_buffer *rxb)
 {
 #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_spectrum_notification *report = &(pkt->u.spectrum_notif);
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif);
 
        if (!report->state) {
                IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO,
@@ -3037,8 +3036,8 @@ static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
                                  struct iwl3945_rx_mem_buffer *rxb)
 {
 #ifdef CONFIG_IWL3945_DEBUG
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_sleep_notification *sleep = &(pkt->u.sleep_notif);
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif);
        IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
                     sleep->pm_sleep_mode, sleep->pm_wakeup_src);
 #endif
@@ -3047,7 +3046,7 @@ static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
 static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv,
                                             struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
        IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
                        "notification for %s:\n",
                        le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
@@ -3083,7 +3082,7 @@ static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv,
                                struct iwl3945_rx_mem_buffer *rxb)
 {
 #ifdef CONFIG_IWL3945_DEBUG
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
        struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status);
        u8 rate = beacon->beacon_notify_hdr.rate;
 
@@ -3106,9 +3105,9 @@ static void iwl3945_rx_reply_scan(struct iwl3945_priv *priv,
                              struct iwl3945_rx_mem_buffer *rxb)
 {
 #ifdef CONFIG_IWL3945_DEBUG
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_scanreq_notification *notif =
-           (struct iwl3945_scanreq_notification *)pkt->u.raw;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_scanreq_notification *notif =
+           (struct iwl_scanreq_notification *)pkt->u.raw;
 
        IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status);
 #endif
@@ -3118,9 +3117,9 @@ static void iwl3945_rx_reply_scan(struct iwl3945_priv *priv,
 static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv,
                                    struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_scanstart_notification *notif =
-           (struct iwl3945_scanstart_notification *)pkt->u.raw;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_scanstart_notification *notif =
+           (struct iwl_scanstart_notification *)pkt->u.raw;
        priv->scan_start_tsf = le32_to_cpu(notif->tsf_low);
        IWL_DEBUG_SCAN("Scan start: "
                       "%d [802.11%s] "
@@ -3135,9 +3134,9 @@ static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv,
 static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
                                      struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_scanresults_notification *notif =
-           (struct iwl3945_scanresults_notification *)pkt->u.raw;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_scanresults_notification *notif =
+           (struct iwl_scanresults_notification *)pkt->u.raw;
 
        IWL_DEBUG_SCAN("Scan ch.res: "
                       "%d [802.11%s] "
@@ -3160,8 +3159,8 @@ static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
 static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
                                       struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
 
        IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
                       scan_notif->scanned_channels,
@@ -3223,7 +3222,7 @@ reschedule:
 static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv,
                                    struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
        u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
        unsigned long status = priv->status;
 
@@ -3341,11 +3340,11 @@ static void iwl3945_cmd_queue_reclaim(struct iwl3945_priv *priv,
 static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
                                struct iwl3945_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
        u16 sequence = le16_to_cpu(pkt->hdr.sequence);
        int txq_id = SEQ_TO_QUEUE(sequence);
        int index = SEQ_TO_INDEX(sequence);
-       int huge = sequence & SEQ_HUGE_FRAME;
+       int huge =  !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
        int cmd_index;
        struct iwl3945_cmd *cmd;
 
@@ -3479,14 +3478,14 @@ int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_
                        goto exit_unlock;
 
                /* Device expects a multiple of 8 */
-               iwl3945_write_direct32(priv, FH_RSCSR_CHNL0_WPTR,
+               iwl3945_write_direct32(priv, FH39_RSCSR_CHNL0_WPTR,
                                     q->write & ~0x7);
                iwl3945_release_nic_access(priv);
 
        /* Else device is assumed to be awake */
        } else
                /* Device expects a multiple of 8 */
-               iwl3945_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7);
+               iwl3945_write32(priv, FH39_RSCSR_CHNL0_WPTR, q->write & ~0x7);
 
 
        q->need_update = 0;
@@ -3803,7 +3802,7 @@ int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm)
 static void iwl3945_rx_handle(struct iwl3945_priv *priv)
 {
        struct iwl3945_rx_mem_buffer *rxb;
-       struct iwl3945_rx_packet *pkt;
+       struct iwl_rx_packet *pkt;
        struct iwl3945_rx_queue *rxq = &priv->rxq;
        u32 r, i;
        int reclaim;
@@ -3835,7 +3834,7 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
                pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
                                            IWL_RX_BUF_SIZE,
                                            PCI_DMA_FROMDEVICE);
-               pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
+               pkt = (struct iwl_rx_packet *)rxb->skb->data;
 
                /* Reclaim a command buffer only if this packet is a response
                 *   to a (driver-originated) command.
@@ -4339,9 +4338,8 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
 
                iwl3945_write32(priv, CSR_FH_INT_STATUS, (1 << 6));
                if (!iwl3945_grab_nic_access(priv)) {
-                       iwl3945_write_direct32(priv,
-                                            FH_TCSR_CREDIT
-                                            (ALM_FH_SRVC_CHNL), 0x0);
+                       iwl3945_write_direct32(priv, FH39_TCSR_CREDIT
+                                            (FH39_SRVC_CHNL), 0x0);
                        iwl3945_release_nic_access(priv);
                }
                handled |= CSR_INT_BIT_FH_TX;
@@ -5837,7 +5835,7 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
        iwl3945_hw_nic_reset(priv);
 
  exit:
-       memset(&priv->card_alive, 0, sizeof(struct iwl3945_alive_resp));
+       memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp));
 
        if (priv->ibss_beacon)
                dev_kfree_skb(priv->ibss_beacon);
@@ -6303,7 +6301,7 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv)
        priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
        iwl3945_commit_rxon(priv);
 
-       memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd));
+       memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
        iwl3945_setup_rxon_timing(priv);
        rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING,
                              sizeof(priv->rxon_timing), &priv->rxon_timing);
@@ -6538,7 +6536,7 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
                dev_kfree_skb_any(skb);
 
        IWL_DEBUG_MAC80211("leave\n");
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
@@ -6683,7 +6681,7 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv)
                iwl3945_commit_rxon(priv);
 
                /* RXON Timing */
-               memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd));
+               memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
                iwl3945_setup_rxon_timing(priv);
                rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING,
                                sizeof(priv->rxon_timing), &priv->rxon_timing);
@@ -6931,9 +6929,7 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
                if (bss_conf->assoc) {
                        priv->assoc_id = bss_conf->aid;
                        priv->beacon_int = bss_conf->beacon_int;
-                       priv->timestamp0 = bss_conf->timestamp & 0xFFFFFFFF;
-                       priv->timestamp1 = (bss_conf->timestamp >> 32) &
-                                            0xFFFFFFFF;
+                       priv->timestamp = bss_conf->timestamp;
                        priv->assoc_capability = bss_conf->assoc_capability;
                        priv->next_scan_jiffies = jiffies +
                                        IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
@@ -7175,8 +7171,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
        priv->ibss_beacon = NULL;
 
        priv->beacon_int = priv->hw->conf.beacon_int;
-       priv->timestamp1 = 0;
-       priv->timestamp0 = 0;
+       priv->timestamp = 0;
        if ((priv->iw_mode == NL80211_IFTYPE_STATION))
                priv->beacon_int = 0;
 
@@ -7408,7 +7403,7 @@ static ssize_t show_measurement(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
        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;
        u8 *data = (u8 *)&measure_report;
        unsigned long flags;